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.js
CHANGED
|
@@ -7736,22 +7736,16 @@ function formatBytes(bytes) {
|
|
|
7736
7736
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
7737
7737
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
7738
7738
|
}
|
|
7739
|
-
var phaseMessages,
|
|
7739
|
+
var phaseMessages, PDFLoadingScreen;
|
|
7740
7740
|
var init_PDFLoadingScreen = __esm({
|
|
7741
7741
|
"src/components/PDFLoadingScreen/PDFLoadingScreen.tsx"() {
|
|
7742
7742
|
"use strict";
|
|
7743
7743
|
init_utils();
|
|
7744
7744
|
phaseMessages = {
|
|
7745
|
-
initializing: "Preparing viewer
|
|
7746
|
-
fetching: "Loading document
|
|
7747
|
-
parsing: "Processing pages
|
|
7748
|
-
rendering: "Almost ready
|
|
7749
|
-
};
|
|
7750
|
-
phaseIcons = {
|
|
7751
|
-
initializing: "\u2699\uFE0F",
|
|
7752
|
-
fetching: "\u{1F4C4}",
|
|
7753
|
-
parsing: "\u{1F4D1}",
|
|
7754
|
-
rendering: "\u2728"
|
|
7745
|
+
initializing: "Preparing viewer",
|
|
7746
|
+
fetching: "Loading document",
|
|
7747
|
+
parsing: "Processing pages",
|
|
7748
|
+
rendering: "Almost ready"
|
|
7755
7749
|
};
|
|
7756
7750
|
PDFLoadingScreen = memo18(function PDFLoadingScreen2({
|
|
7757
7751
|
progress,
|
|
@@ -7768,122 +7762,219 @@ var init_PDFLoadingScreen = __esm({
|
|
|
7768
7762
|
{
|
|
7769
7763
|
className: cn(
|
|
7770
7764
|
"pdf-loading-screen",
|
|
7771
|
-
"flex flex-col items-center justify-center",
|
|
7772
|
-
"w-full h-full min-h-[400px]",
|
|
7773
|
-
"bg-gradient-to-b from-slate-50 to-slate-100",
|
|
7774
|
-
"dark:from-slate-900 dark:to-slate-800",
|
|
7775
7765
|
className
|
|
7776
7766
|
),
|
|
7767
|
+
style: {
|
|
7768
|
+
display: "flex",
|
|
7769
|
+
flexDirection: "column",
|
|
7770
|
+
alignItems: "center",
|
|
7771
|
+
justifyContent: "center",
|
|
7772
|
+
width: "100%",
|
|
7773
|
+
height: "100%",
|
|
7774
|
+
minHeight: "400px",
|
|
7775
|
+
background: "linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%)",
|
|
7776
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
7777
|
+
},
|
|
7777
7778
|
role: "status",
|
|
7778
7779
|
"aria-live": "polite",
|
|
7779
7780
|
"aria-label": phaseMessages[phase],
|
|
7780
|
-
children: /* @__PURE__ */ jsxs16(
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
"
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
"ellipse",
|
|
7795
|
-
{
|
|
7796
|
-
cx: "32",
|
|
7797
|
-
cy: "76",
|
|
7798
|
-
rx: "24",
|
|
7799
|
-
ry: "4",
|
|
7800
|
-
className: "fill-slate-200 dark:fill-slate-700",
|
|
7801
|
-
opacity: "0.5"
|
|
7802
|
-
}
|
|
7803
|
-
),
|
|
7804
|
-
/* @__PURE__ */ jsx19(
|
|
7805
|
-
"path",
|
|
7806
|
-
{
|
|
7807
|
-
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",
|
|
7808
|
-
className: "fill-white dark:fill-slate-700"
|
|
7809
|
-
}
|
|
7810
|
-
),
|
|
7811
|
-
/* @__PURE__ */ jsx19(
|
|
7812
|
-
"path",
|
|
7813
|
-
{
|
|
7814
|
-
d: "M40 0L56 16H44C41.7909 16 40 14.2091 40 12V0Z",
|
|
7815
|
-
className: "fill-blue-100 dark:fill-blue-900"
|
|
7816
|
-
}
|
|
7817
|
-
),
|
|
7818
|
-
/* @__PURE__ */ jsx19(
|
|
7819
|
-
"rect",
|
|
7820
|
-
{
|
|
7821
|
-
x: "14",
|
|
7822
|
-
y: "28",
|
|
7823
|
-
width: "28",
|
|
7824
|
-
height: "12",
|
|
7825
|
-
rx: "2",
|
|
7826
|
-
className: "fill-blue-500 dark:fill-blue-400"
|
|
7827
|
-
}
|
|
7828
|
-
),
|
|
7829
|
-
/* @__PURE__ */ jsx19(
|
|
7830
|
-
"text",
|
|
7831
|
-
{
|
|
7832
|
-
x: "28",
|
|
7833
|
-
y: "37",
|
|
7834
|
-
textAnchor: "middle",
|
|
7835
|
-
className: "fill-white text-[8px] font-bold",
|
|
7836
|
-
style: { fontSize: "8px", fontWeight: 700 },
|
|
7837
|
-
children: "PDF"
|
|
7838
|
-
}
|
|
7839
|
-
),
|
|
7840
|
-
/* @__PURE__ */ jsx19("rect", { x: "14", y: "48", width: "28", height: "3", rx: "1.5", className: "pdf-line-1 fill-slate-200 dark:fill-slate-600" }),
|
|
7841
|
-
/* @__PURE__ */ jsx19("rect", { x: "14", y: "54", width: "22", height: "3", rx: "1.5", className: "pdf-line-2 fill-slate-200 dark:fill-slate-600" }),
|
|
7842
|
-
/* @__PURE__ */ jsx19("rect", { x: "14", y: "60", width: "18", height: "3", rx: "1.5", className: "pdf-line-3 fill-slate-200 dark:fill-slate-600" }),
|
|
7843
|
-
/* @__PURE__ */ jsx19(
|
|
7844
|
-
"path",
|
|
7845
|
-
{
|
|
7846
|
-
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",
|
|
7847
|
-
className: "stroke-slate-200 dark:stroke-slate-600",
|
|
7848
|
-
strokeWidth: "1.5",
|
|
7849
|
-
fill: "none"
|
|
7850
|
-
}
|
|
7851
|
-
)
|
|
7852
|
-
]
|
|
7853
|
-
}
|
|
7854
|
-
) })
|
|
7855
|
-
] }),
|
|
7856
|
-
/* @__PURE__ */ jsxs16("div", { className: "pdf-loading-info", children: [
|
|
7857
|
-
documentName && /* @__PURE__ */ jsx19("p", { className: "pdf-loading-document-name", children: documentName }),
|
|
7858
|
-
/* @__PURE__ */ jsxs16("div", { className: "pdf-loading-message-wrapper", children: [
|
|
7859
|
-
/* @__PURE__ */ jsx19("span", { className: "pdf-loading-phase-icon", children: phaseIcons[phase] }),
|
|
7860
|
-
/* @__PURE__ */ jsx19("p", { className: "pdf-loading-message", children: phaseMessages[phase] })
|
|
7861
|
-
] }),
|
|
7862
|
-
/* @__PURE__ */ jsxs16("div", { className: "pdf-loading-progress-container", children: [
|
|
7863
|
-
/* @__PURE__ */ jsx19("div", { className: "pdf-loading-progress-track", children: /* @__PURE__ */ jsx19(
|
|
7781
|
+
children: /* @__PURE__ */ jsxs16(
|
|
7782
|
+
"div",
|
|
7783
|
+
{
|
|
7784
|
+
style: {
|
|
7785
|
+
display: "flex",
|
|
7786
|
+
flexDirection: "column",
|
|
7787
|
+
alignItems: "center",
|
|
7788
|
+
padding: "48px 40px",
|
|
7789
|
+
background: "white",
|
|
7790
|
+
borderRadius: "20px",
|
|
7791
|
+
boxShadow: "0 10px 40px -10px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05)"
|
|
7792
|
+
},
|
|
7793
|
+
children: [
|
|
7794
|
+
/* @__PURE__ */ jsxs16(
|
|
7864
7795
|
"div",
|
|
7865
7796
|
{
|
|
7866
|
-
className:
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7797
|
+
className: "pdf-loading-icon-container",
|
|
7798
|
+
style: {
|
|
7799
|
+
position: "relative",
|
|
7800
|
+
marginBottom: "32px"
|
|
7801
|
+
},
|
|
7802
|
+
children: [
|
|
7803
|
+
/* @__PURE__ */ jsx19(
|
|
7804
|
+
"div",
|
|
7805
|
+
{
|
|
7806
|
+
className: "pdf-loading-glow",
|
|
7807
|
+
style: {
|
|
7808
|
+
position: "absolute",
|
|
7809
|
+
top: "50%",
|
|
7810
|
+
left: "50%",
|
|
7811
|
+
width: "120px",
|
|
7812
|
+
height: "120px",
|
|
7813
|
+
transform: "translate(-50%, -50%)",
|
|
7814
|
+
background: "radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%)",
|
|
7815
|
+
borderRadius: "50%"
|
|
7816
|
+
}
|
|
7817
|
+
}
|
|
7818
|
+
),
|
|
7819
|
+
/* @__PURE__ */ jsxs16(
|
|
7820
|
+
"svg",
|
|
7821
|
+
{
|
|
7822
|
+
width: "72",
|
|
7823
|
+
height: "88",
|
|
7824
|
+
viewBox: "0 0 72 88",
|
|
7825
|
+
fill: "none",
|
|
7826
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7827
|
+
className: "pdf-document-icon",
|
|
7828
|
+
style: {
|
|
7829
|
+
position: "relative",
|
|
7830
|
+
zIndex: 1,
|
|
7831
|
+
filter: "drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1))"
|
|
7832
|
+
},
|
|
7833
|
+
children: [
|
|
7834
|
+
/* @__PURE__ */ jsx19(
|
|
7835
|
+
"path",
|
|
7836
|
+
{
|
|
7837
|
+
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",
|
|
7838
|
+
fill: "#ffffff",
|
|
7839
|
+
stroke: "#e2e8f0",
|
|
7840
|
+
strokeWidth: "2"
|
|
7841
|
+
}
|
|
7842
|
+
),
|
|
7843
|
+
/* @__PURE__ */ jsx19(
|
|
7844
|
+
"path",
|
|
7845
|
+
{
|
|
7846
|
+
d: "M44 0L68 24H52C47.5817 24 44 20.4183 44 16V0Z",
|
|
7847
|
+
fill: "#dbeafe"
|
|
7848
|
+
}
|
|
7849
|
+
),
|
|
7850
|
+
/* @__PURE__ */ jsx19(
|
|
7851
|
+
"rect",
|
|
7852
|
+
{
|
|
7853
|
+
x: "14",
|
|
7854
|
+
y: "36",
|
|
7855
|
+
width: "44",
|
|
7856
|
+
height: "20",
|
|
7857
|
+
rx: "4",
|
|
7858
|
+
fill: "#3b82f6"
|
|
7859
|
+
}
|
|
7860
|
+
),
|
|
7861
|
+
/* @__PURE__ */ jsx19(
|
|
7862
|
+
"text",
|
|
7863
|
+
{
|
|
7864
|
+
x: "36",
|
|
7865
|
+
y: "50",
|
|
7866
|
+
textAnchor: "middle",
|
|
7867
|
+
fill: "white",
|
|
7868
|
+
style: {
|
|
7869
|
+
fontSize: "12px",
|
|
7870
|
+
fontWeight: 700,
|
|
7871
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
7872
|
+
},
|
|
7873
|
+
children: "PDF"
|
|
7874
|
+
}
|
|
7875
|
+
),
|
|
7876
|
+
/* @__PURE__ */ jsx19("rect", { className: "pdf-line-1", x: "14", y: "64", width: "44", height: "4", rx: "2", fill: "#e2e8f0" }),
|
|
7877
|
+
/* @__PURE__ */ jsx19("rect", { className: "pdf-line-2", x: "14", y: "72", width: "32", height: "4", rx: "2", fill: "#e2e8f0" })
|
|
7878
|
+
]
|
|
7879
|
+
}
|
|
7880
|
+
)
|
|
7881
|
+
]
|
|
7871
7882
|
}
|
|
7872
|
-
)
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
+
),
|
|
7884
|
+
documentName && /* @__PURE__ */ jsx19(
|
|
7885
|
+
"p",
|
|
7886
|
+
{
|
|
7887
|
+
style: {
|
|
7888
|
+
fontSize: "13px",
|
|
7889
|
+
fontWeight: 500,
|
|
7890
|
+
color: "#64748b",
|
|
7891
|
+
marginBottom: "8px",
|
|
7892
|
+
maxWidth: "240px",
|
|
7893
|
+
overflow: "hidden",
|
|
7894
|
+
textOverflow: "ellipsis",
|
|
7895
|
+
whiteSpace: "nowrap",
|
|
7896
|
+
textAlign: "center"
|
|
7897
|
+
},
|
|
7898
|
+
children: documentName
|
|
7899
|
+
}
|
|
7900
|
+
),
|
|
7901
|
+
/* @__PURE__ */ jsxs16(
|
|
7902
|
+
"p",
|
|
7903
|
+
{
|
|
7904
|
+
style: {
|
|
7905
|
+
fontSize: "16px",
|
|
7906
|
+
fontWeight: 600,
|
|
7907
|
+
color: "#1e293b",
|
|
7908
|
+
marginBottom: "24px",
|
|
7909
|
+
textAlign: "center"
|
|
7910
|
+
},
|
|
7911
|
+
children: [
|
|
7912
|
+
phaseMessages[phase],
|
|
7913
|
+
/* @__PURE__ */ jsxs16("span", { className: "pdf-loading-dots", style: { display: "inline-block", width: "24px", textAlign: "left" }, children: [
|
|
7914
|
+
/* @__PURE__ */ jsx19("span", { className: "pdf-dot-1", children: "." }),
|
|
7915
|
+
/* @__PURE__ */ jsx19("span", { className: "pdf-dot-2", children: "." }),
|
|
7916
|
+
/* @__PURE__ */ jsx19("span", { className: "pdf-dot-3", children: "." })
|
|
7917
|
+
] })
|
|
7918
|
+
]
|
|
7919
|
+
}
|
|
7920
|
+
),
|
|
7921
|
+
/* @__PURE__ */ jsxs16("div", { style: { width: "240px" }, children: [
|
|
7922
|
+
/* @__PURE__ */ jsx19(
|
|
7923
|
+
"div",
|
|
7924
|
+
{
|
|
7925
|
+
style: {
|
|
7926
|
+
width: "100%",
|
|
7927
|
+
height: "8px",
|
|
7928
|
+
borderRadius: "4px",
|
|
7929
|
+
background: "#e2e8f0",
|
|
7930
|
+
overflow: "hidden"
|
|
7931
|
+
},
|
|
7932
|
+
children: /* @__PURE__ */ jsx19(
|
|
7933
|
+
"div",
|
|
7934
|
+
{
|
|
7935
|
+
className: cn(
|
|
7936
|
+
"pdf-loading-progress-fill",
|
|
7937
|
+
!hasProgress && "pdf-loading-progress-indeterminate"
|
|
7938
|
+
),
|
|
7939
|
+
style: {
|
|
7940
|
+
height: "100%",
|
|
7941
|
+
borderRadius: "4px",
|
|
7942
|
+
background: "linear-gradient(90deg, #3b82f6 0%, #60a5fa 50%, #3b82f6 100%)",
|
|
7943
|
+
backgroundSize: "200% 100%",
|
|
7944
|
+
transition: "width 300ms ease-out",
|
|
7945
|
+
...hasProgress ? { width: `${Math.min(100, progress)}%` } : {}
|
|
7946
|
+
}
|
|
7947
|
+
}
|
|
7948
|
+
)
|
|
7949
|
+
}
|
|
7950
|
+
),
|
|
7951
|
+
(hasProgress || hasBytes) && /* @__PURE__ */ jsxs16(
|
|
7952
|
+
"div",
|
|
7953
|
+
{
|
|
7954
|
+
style: {
|
|
7955
|
+
display: "flex",
|
|
7956
|
+
justifyContent: "space-between",
|
|
7957
|
+
marginTop: "12px",
|
|
7958
|
+
fontSize: "13px",
|
|
7959
|
+
fontWeight: 500
|
|
7960
|
+
},
|
|
7961
|
+
children: [
|
|
7962
|
+
hasProgress && /* @__PURE__ */ jsxs16("span", { style: { color: "#3b82f6" }, children: [
|
|
7963
|
+
Math.round(progress),
|
|
7964
|
+
"%"
|
|
7965
|
+
] }),
|
|
7966
|
+
hasBytes && /* @__PURE__ */ jsxs16("span", { style: { color: "#94a3b8", fontFamily: "ui-monospace, monospace", fontSize: "12px" }, children: [
|
|
7967
|
+
formatBytes(bytesLoaded),
|
|
7968
|
+
" / ",
|
|
7969
|
+
formatBytes(totalBytes)
|
|
7970
|
+
] })
|
|
7971
|
+
]
|
|
7972
|
+
}
|
|
7973
|
+
)
|
|
7883
7974
|
] })
|
|
7884
|
-
]
|
|
7885
|
-
|
|
7886
|
-
|
|
7975
|
+
]
|
|
7976
|
+
}
|
|
7977
|
+
)
|
|
7887
7978
|
}
|
|
7888
7979
|
);
|
|
7889
7980
|
});
|