pdfjs-reader-core 0.2.11 → 0.2.12
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.cjs +67 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +67 -29
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7771,7 +7771,7 @@ function formatBytes(bytes) {
|
|
|
7771
7771
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
7772
7772
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
7773
7773
|
}
|
|
7774
|
-
var import_react33, import_jsx_runtime19, phaseMessages, PDFLoadingScreen;
|
|
7774
|
+
var import_react33, import_jsx_runtime19, phaseMessages, phaseIcons, PDFLoadingScreen;
|
|
7775
7775
|
var init_PDFLoadingScreen = __esm({
|
|
7776
7776
|
"src/components/PDFLoadingScreen/PDFLoadingScreen.tsx"() {
|
|
7777
7777
|
"use strict";
|
|
@@ -7779,10 +7779,16 @@ var init_PDFLoadingScreen = __esm({
|
|
|
7779
7779
|
init_utils();
|
|
7780
7780
|
import_jsx_runtime19 = require("react/jsx-runtime");
|
|
7781
7781
|
phaseMessages = {
|
|
7782
|
-
initializing: "
|
|
7782
|
+
initializing: "Preparing viewer...",
|
|
7783
7783
|
fetching: "Loading document...",
|
|
7784
7784
|
parsing: "Processing pages...",
|
|
7785
|
-
rendering: "
|
|
7785
|
+
rendering: "Almost ready..."
|
|
7786
|
+
};
|
|
7787
|
+
phaseIcons = {
|
|
7788
|
+
initializing: "\u2699\uFE0F",
|
|
7789
|
+
fetching: "\u{1F4C4}",
|
|
7790
|
+
parsing: "\u{1F4D1}",
|
|
7791
|
+
rendering: "\u2728"
|
|
7786
7792
|
};
|
|
7787
7793
|
PDFLoadingScreen = (0, import_react33.memo)(function PDFLoadingScreen2({
|
|
7788
7794
|
progress,
|
|
@@ -7794,70 +7800,102 @@ var init_PDFLoadingScreen = __esm({
|
|
|
7794
7800
|
}) {
|
|
7795
7801
|
const hasProgress = progress !== void 0 && progress >= 0;
|
|
7796
7802
|
const hasBytes = bytesLoaded !== void 0 && totalBytes !== void 0 && totalBytes > 0;
|
|
7797
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.
|
|
7803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7798
7804
|
"div",
|
|
7799
7805
|
{
|
|
7800
7806
|
className: cn(
|
|
7801
7807
|
"pdf-loading-screen",
|
|
7802
7808
|
"flex flex-col items-center justify-center",
|
|
7803
7809
|
"w-full h-full min-h-[400px]",
|
|
7804
|
-
"bg-slate-50
|
|
7810
|
+
"bg-gradient-to-b from-slate-50 to-slate-100",
|
|
7811
|
+
"dark:from-slate-900 dark:to-slate-800",
|
|
7805
7812
|
className
|
|
7806
7813
|
),
|
|
7807
7814
|
role: "status",
|
|
7808
7815
|
"aria-live": "polite",
|
|
7809
7816
|
"aria-label": phaseMessages[phase],
|
|
7810
|
-
children: [
|
|
7811
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-
|
|
7817
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-card", children: [
|
|
7818
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-icon-wrapper", children: [
|
|
7819
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pdf-loading-icon-glow" }),
|
|
7812
7820
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pdf-loading-icon", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7813
7821
|
"svg",
|
|
7814
7822
|
{
|
|
7815
|
-
width: "
|
|
7816
|
-
height: "
|
|
7817
|
-
viewBox: "0 0
|
|
7823
|
+
width: "64",
|
|
7824
|
+
height: "80",
|
|
7825
|
+
viewBox: "0 0 64 80",
|
|
7818
7826
|
fill: "none",
|
|
7819
7827
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7820
7828
|
className: "pdf-document-icon",
|
|
7821
7829
|
children: [
|
|
7830
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7831
|
+
"ellipse",
|
|
7832
|
+
{
|
|
7833
|
+
cx: "32",
|
|
7834
|
+
cy: "76",
|
|
7835
|
+
rx: "24",
|
|
7836
|
+
ry: "4",
|
|
7837
|
+
className: "fill-slate-200 dark:fill-slate-700",
|
|
7838
|
+
opacity: "0.5"
|
|
7839
|
+
}
|
|
7840
|
+
),
|
|
7822
7841
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7823
7842
|
"path",
|
|
7824
7843
|
{
|
|
7825
|
-
d: "
|
|
7844
|
+
d: "M8 4C8 1.79086 9.79086 0 12 0H40L56 16V72C56 74.2091 54.2091 76 52 76H12C9.79086 76 8 74.2091 8 72V4Z",
|
|
7826
7845
|
className: "fill-white dark:fill-slate-700"
|
|
7827
7846
|
}
|
|
7828
7847
|
),
|
|
7829
7848
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7830
7849
|
"path",
|
|
7831
7850
|
{
|
|
7832
|
-
d: "
|
|
7833
|
-
className: "fill-
|
|
7851
|
+
d: "M40 0L56 16H44C41.7909 16 40 14.2091 40 12V0Z",
|
|
7852
|
+
className: "fill-blue-100 dark:fill-blue-900"
|
|
7853
|
+
}
|
|
7854
|
+
),
|
|
7855
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7856
|
+
"rect",
|
|
7857
|
+
{
|
|
7858
|
+
x: "14",
|
|
7859
|
+
y: "28",
|
|
7860
|
+
width: "28",
|
|
7861
|
+
height: "12",
|
|
7862
|
+
rx: "2",
|
|
7863
|
+
className: "fill-blue-500 dark:fill-blue-400"
|
|
7864
|
+
}
|
|
7865
|
+
),
|
|
7866
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7867
|
+
"text",
|
|
7868
|
+
{
|
|
7869
|
+
x: "28",
|
|
7870
|
+
y: "37",
|
|
7871
|
+
textAnchor: "middle",
|
|
7872
|
+
className: "fill-white text-[8px] font-bold",
|
|
7873
|
+
style: { fontSize: "8px", fontWeight: 700 },
|
|
7874
|
+
children: "PDF"
|
|
7834
7875
|
}
|
|
7835
7876
|
),
|
|
7836
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "
|
|
7837
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "
|
|
7838
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "
|
|
7839
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "10", y: "40", width: "16", height: "3", rx: "1.5", className: "fill-slate-200 dark:fill-slate-600" }),
|
|
7877
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "14", y: "48", width: "28", height: "3", rx: "1.5", className: "pdf-line-1 fill-slate-200 dark:fill-slate-600" }),
|
|
7878
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "14", y: "54", width: "22", height: "3", rx: "1.5", className: "pdf-line-2 fill-slate-200 dark:fill-slate-600" }),
|
|
7879
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "14", y: "60", width: "18", height: "3", rx: "1.5", className: "pdf-line-3 fill-slate-200 dark:fill-slate-600" }),
|
|
7840
7880
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7841
7881
|
"path",
|
|
7842
7882
|
{
|
|
7843
|
-
d: "
|
|
7844
|
-
className: "stroke-slate-
|
|
7845
|
-
strokeWidth: "1",
|
|
7883
|
+
d: "M8 4C8 1.79086 9.79086 0 12 0H40L56 16V72C56 74.2091 54.2091 76 52 76H12C9.79086 76 8 74.2091 8 72V4Z",
|
|
7884
|
+
className: "stroke-slate-200 dark:stroke-slate-600",
|
|
7885
|
+
strokeWidth: "1.5",
|
|
7846
7886
|
fill: "none"
|
|
7847
7887
|
}
|
|
7848
7888
|
)
|
|
7849
7889
|
]
|
|
7850
7890
|
}
|
|
7851
|
-
) })
|
|
7852
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-skeleton-lines", children: [
|
|
7853
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pdf-skeleton-line pdf-skeleton-line-1" }),
|
|
7854
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pdf-skeleton-line pdf-skeleton-line-2" }),
|
|
7855
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pdf-skeleton-line pdf-skeleton-line-3" })
|
|
7856
|
-
] })
|
|
7891
|
+
) })
|
|
7857
7892
|
] }),
|
|
7858
7893
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-info", children: [
|
|
7859
7894
|
documentName && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "pdf-loading-document-name", children: documentName }),
|
|
7860
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.
|
|
7895
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-message-wrapper", children: [
|
|
7896
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "pdf-loading-phase-icon", children: phaseIcons[phase] }),
|
|
7897
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "pdf-loading-message", children: phaseMessages[phase] })
|
|
7898
|
+
] }),
|
|
7861
7899
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-progress-container", children: [
|
|
7862
7900
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pdf-loading-progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7863
7901
|
"div",
|
|
@@ -7869,7 +7907,7 @@ var init_PDFLoadingScreen = __esm({
|
|
|
7869
7907
|
style: hasProgress ? { width: `${Math.min(100, progress)}%` } : void 0
|
|
7870
7908
|
}
|
|
7871
7909
|
) }),
|
|
7872
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-progress-details", children: [
|
|
7910
|
+
(hasProgress || hasBytes) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-progress-details", children: [
|
|
7873
7911
|
hasProgress && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "pdf-loading-progress-percent", children: [
|
|
7874
7912
|
Math.round(progress),
|
|
7875
7913
|
"%"
|
|
@@ -7882,7 +7920,7 @@ var init_PDFLoadingScreen = __esm({
|
|
|
7882
7920
|
] })
|
|
7883
7921
|
] })
|
|
7884
7922
|
] })
|
|
7885
|
-
]
|
|
7923
|
+
] })
|
|
7886
7924
|
}
|
|
7887
7925
|
);
|
|
7888
7926
|
});
|