pdfjs-reader-core 0.2.12 → 0.2.13
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 +209 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +209 -118
- 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,
|
|
7774
|
+
var import_react33, import_jsx_runtime19, phaseMessages, PDFLoadingScreen;
|
|
7775
7775
|
var init_PDFLoadingScreen = __esm({
|
|
7776
7776
|
"src/components/PDFLoadingScreen/PDFLoadingScreen.tsx"() {
|
|
7777
7777
|
"use strict";
|
|
@@ -7779,16 +7779,10 @@ var init_PDFLoadingScreen = __esm({
|
|
|
7779
7779
|
init_utils();
|
|
7780
7780
|
import_jsx_runtime19 = require("react/jsx-runtime");
|
|
7781
7781
|
phaseMessages = {
|
|
7782
|
-
initializing: "Preparing viewer
|
|
7783
|
-
fetching: "Loading document
|
|
7784
|
-
parsing: "Processing pages
|
|
7785
|
-
rendering: "Almost ready
|
|
7786
|
-
};
|
|
7787
|
-
phaseIcons = {
|
|
7788
|
-
initializing: "\u2699\uFE0F",
|
|
7789
|
-
fetching: "\u{1F4C4}",
|
|
7790
|
-
parsing: "\u{1F4D1}",
|
|
7791
|
-
rendering: "\u2728"
|
|
7782
|
+
initializing: "Preparing viewer",
|
|
7783
|
+
fetching: "Loading document",
|
|
7784
|
+
parsing: "Processing pages",
|
|
7785
|
+
rendering: "Almost ready"
|
|
7792
7786
|
};
|
|
7793
7787
|
PDFLoadingScreen = (0, import_react33.memo)(function PDFLoadingScreen2({
|
|
7794
7788
|
progress,
|
|
@@ -7805,122 +7799,219 @@ var init_PDFLoadingScreen = __esm({
|
|
|
7805
7799
|
{
|
|
7806
7800
|
className: cn(
|
|
7807
7801
|
"pdf-loading-screen",
|
|
7808
|
-
"flex flex-col items-center justify-center",
|
|
7809
|
-
"w-full h-full min-h-[400px]",
|
|
7810
|
-
"bg-gradient-to-b from-slate-50 to-slate-100",
|
|
7811
|
-
"dark:from-slate-900 dark:to-slate-800",
|
|
7812
7802
|
className
|
|
7813
7803
|
),
|
|
7804
|
+
style: {
|
|
7805
|
+
display: "flex",
|
|
7806
|
+
flexDirection: "column",
|
|
7807
|
+
alignItems: "center",
|
|
7808
|
+
justifyContent: "center",
|
|
7809
|
+
width: "100%",
|
|
7810
|
+
height: "100%",
|
|
7811
|
+
minHeight: "400px",
|
|
7812
|
+
background: "linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%)",
|
|
7813
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
7814
|
+
},
|
|
7814
7815
|
role: "status",
|
|
7815
7816
|
"aria-live": "polite",
|
|
7816
7817
|
"aria-label": phaseMessages[phase],
|
|
7817
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
"
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
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
|
-
),
|
|
7841
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7842
|
-
"path",
|
|
7843
|
-
{
|
|
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",
|
|
7845
|
-
className: "fill-white dark:fill-slate-700"
|
|
7846
|
-
}
|
|
7847
|
-
),
|
|
7848
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7849
|
-
"path",
|
|
7850
|
-
{
|
|
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"
|
|
7875
|
-
}
|
|
7876
|
-
),
|
|
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" }),
|
|
7880
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7881
|
-
"path",
|
|
7882
|
-
{
|
|
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",
|
|
7886
|
-
fill: "none"
|
|
7887
|
-
}
|
|
7888
|
-
)
|
|
7889
|
-
]
|
|
7890
|
-
}
|
|
7891
|
-
) })
|
|
7892
|
-
] }),
|
|
7893
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-info", children: [
|
|
7894
|
-
documentName && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "pdf-loading-document-name", children: documentName }),
|
|
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
|
-
] }),
|
|
7899
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pdf-loading-progress-container", children: [
|
|
7900
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pdf-loading-progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7818
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7819
|
+
"div",
|
|
7820
|
+
{
|
|
7821
|
+
style: {
|
|
7822
|
+
display: "flex",
|
|
7823
|
+
flexDirection: "column",
|
|
7824
|
+
alignItems: "center",
|
|
7825
|
+
padding: "48px 40px",
|
|
7826
|
+
background: "white",
|
|
7827
|
+
borderRadius: "20px",
|
|
7828
|
+
boxShadow: "0 10px 40px -10px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05)"
|
|
7829
|
+
},
|
|
7830
|
+
children: [
|
|
7831
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7901
7832
|
"div",
|
|
7902
7833
|
{
|
|
7903
|
-
className:
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7834
|
+
className: "pdf-loading-icon-container",
|
|
7835
|
+
style: {
|
|
7836
|
+
position: "relative",
|
|
7837
|
+
marginBottom: "32px"
|
|
7838
|
+
},
|
|
7839
|
+
children: [
|
|
7840
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7841
|
+
"div",
|
|
7842
|
+
{
|
|
7843
|
+
className: "pdf-loading-glow",
|
|
7844
|
+
style: {
|
|
7845
|
+
position: "absolute",
|
|
7846
|
+
top: "50%",
|
|
7847
|
+
left: "50%",
|
|
7848
|
+
width: "120px",
|
|
7849
|
+
height: "120px",
|
|
7850
|
+
transform: "translate(-50%, -50%)",
|
|
7851
|
+
background: "radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%)",
|
|
7852
|
+
borderRadius: "50%"
|
|
7853
|
+
}
|
|
7854
|
+
}
|
|
7855
|
+
),
|
|
7856
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7857
|
+
"svg",
|
|
7858
|
+
{
|
|
7859
|
+
width: "72",
|
|
7860
|
+
height: "88",
|
|
7861
|
+
viewBox: "0 0 72 88",
|
|
7862
|
+
fill: "none",
|
|
7863
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7864
|
+
className: "pdf-document-icon",
|
|
7865
|
+
style: {
|
|
7866
|
+
position: "relative",
|
|
7867
|
+
zIndex: 1,
|
|
7868
|
+
filter: "drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1))"
|
|
7869
|
+
},
|
|
7870
|
+
children: [
|
|
7871
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7872
|
+
"path",
|
|
7873
|
+
{
|
|
7874
|
+
d: "M4 8C4 3.58172 7.58172 0 12 0H44L68 24V80C68 84.4183 64.4183 88 60 88H12C7.58172 88 4 84.4183 4 80V8Z",
|
|
7875
|
+
fill: "#ffffff",
|
|
7876
|
+
stroke: "#e2e8f0",
|
|
7877
|
+
strokeWidth: "2"
|
|
7878
|
+
}
|
|
7879
|
+
),
|
|
7880
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7881
|
+
"path",
|
|
7882
|
+
{
|
|
7883
|
+
d: "M44 0L68 24H52C47.5817 24 44 20.4183 44 16V0Z",
|
|
7884
|
+
fill: "#dbeafe"
|
|
7885
|
+
}
|
|
7886
|
+
),
|
|
7887
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7888
|
+
"rect",
|
|
7889
|
+
{
|
|
7890
|
+
x: "14",
|
|
7891
|
+
y: "36",
|
|
7892
|
+
width: "44",
|
|
7893
|
+
height: "20",
|
|
7894
|
+
rx: "4",
|
|
7895
|
+
fill: "#3b82f6"
|
|
7896
|
+
}
|
|
7897
|
+
),
|
|
7898
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7899
|
+
"text",
|
|
7900
|
+
{
|
|
7901
|
+
x: "36",
|
|
7902
|
+
y: "50",
|
|
7903
|
+
textAnchor: "middle",
|
|
7904
|
+
fill: "white",
|
|
7905
|
+
style: {
|
|
7906
|
+
fontSize: "12px",
|
|
7907
|
+
fontWeight: 700,
|
|
7908
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
7909
|
+
},
|
|
7910
|
+
children: "PDF"
|
|
7911
|
+
}
|
|
7912
|
+
),
|
|
7913
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { className: "pdf-line-1", x: "14", y: "64", width: "44", height: "4", rx: "2", fill: "#e2e8f0" }),
|
|
7914
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { className: "pdf-line-2", x: "14", y: "72", width: "32", height: "4", rx: "2", fill: "#e2e8f0" })
|
|
7915
|
+
]
|
|
7916
|
+
}
|
|
7917
|
+
)
|
|
7918
|
+
]
|
|
7908
7919
|
}
|
|
7909
|
-
)
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
+
),
|
|
7921
|
+
documentName && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7922
|
+
"p",
|
|
7923
|
+
{
|
|
7924
|
+
style: {
|
|
7925
|
+
fontSize: "13px",
|
|
7926
|
+
fontWeight: 500,
|
|
7927
|
+
color: "#64748b",
|
|
7928
|
+
marginBottom: "8px",
|
|
7929
|
+
maxWidth: "240px",
|
|
7930
|
+
overflow: "hidden",
|
|
7931
|
+
textOverflow: "ellipsis",
|
|
7932
|
+
whiteSpace: "nowrap",
|
|
7933
|
+
textAlign: "center"
|
|
7934
|
+
},
|
|
7935
|
+
children: documentName
|
|
7936
|
+
}
|
|
7937
|
+
),
|
|
7938
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7939
|
+
"p",
|
|
7940
|
+
{
|
|
7941
|
+
style: {
|
|
7942
|
+
fontSize: "16px",
|
|
7943
|
+
fontWeight: 600,
|
|
7944
|
+
color: "#1e293b",
|
|
7945
|
+
marginBottom: "24px",
|
|
7946
|
+
textAlign: "center"
|
|
7947
|
+
},
|
|
7948
|
+
children: [
|
|
7949
|
+
phaseMessages[phase],
|
|
7950
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "pdf-loading-dots", style: { display: "inline-block", width: "24px", textAlign: "left" }, children: [
|
|
7951
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "pdf-dot-1", children: "." }),
|
|
7952
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "pdf-dot-2", children: "." }),
|
|
7953
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "pdf-dot-3", children: "." })
|
|
7954
|
+
] })
|
|
7955
|
+
]
|
|
7956
|
+
}
|
|
7957
|
+
),
|
|
7958
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { width: "240px" }, children: [
|
|
7959
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7960
|
+
"div",
|
|
7961
|
+
{
|
|
7962
|
+
style: {
|
|
7963
|
+
width: "100%",
|
|
7964
|
+
height: "8px",
|
|
7965
|
+
borderRadius: "4px",
|
|
7966
|
+
background: "#e2e8f0",
|
|
7967
|
+
overflow: "hidden"
|
|
7968
|
+
},
|
|
7969
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
7970
|
+
"div",
|
|
7971
|
+
{
|
|
7972
|
+
className: cn(
|
|
7973
|
+
"pdf-loading-progress-fill",
|
|
7974
|
+
!hasProgress && "pdf-loading-progress-indeterminate"
|
|
7975
|
+
),
|
|
7976
|
+
style: {
|
|
7977
|
+
height: "100%",
|
|
7978
|
+
borderRadius: "4px",
|
|
7979
|
+
background: "linear-gradient(90deg, #3b82f6 0%, #60a5fa 50%, #3b82f6 100%)",
|
|
7980
|
+
backgroundSize: "200% 100%",
|
|
7981
|
+
transition: "width 300ms ease-out",
|
|
7982
|
+
...hasProgress ? { width: `${Math.min(100, progress)}%` } : {}
|
|
7983
|
+
}
|
|
7984
|
+
}
|
|
7985
|
+
)
|
|
7986
|
+
}
|
|
7987
|
+
),
|
|
7988
|
+
(hasProgress || hasBytes) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
7989
|
+
"div",
|
|
7990
|
+
{
|
|
7991
|
+
style: {
|
|
7992
|
+
display: "flex",
|
|
7993
|
+
justifyContent: "space-between",
|
|
7994
|
+
marginTop: "12px",
|
|
7995
|
+
fontSize: "13px",
|
|
7996
|
+
fontWeight: 500
|
|
7997
|
+
},
|
|
7998
|
+
children: [
|
|
7999
|
+
hasProgress && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { style: { color: "#3b82f6" }, children: [
|
|
8000
|
+
Math.round(progress),
|
|
8001
|
+
"%"
|
|
8002
|
+
] }),
|
|
8003
|
+
hasBytes && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { style: { color: "#94a3b8", fontFamily: "ui-monospace, monospace", fontSize: "12px" }, children: [
|
|
8004
|
+
formatBytes(bytesLoaded),
|
|
8005
|
+
" / ",
|
|
8006
|
+
formatBytes(totalBytes)
|
|
8007
|
+
] })
|
|
8008
|
+
]
|
|
8009
|
+
}
|
|
8010
|
+
)
|
|
7920
8011
|
] })
|
|
7921
|
-
]
|
|
7922
|
-
|
|
7923
|
-
|
|
8012
|
+
]
|
|
8013
|
+
}
|
|
8014
|
+
)
|
|
7924
8015
|
}
|
|
7925
8016
|
);
|
|
7926
8017
|
});
|