@epam/ai-dial-attachment-canvas 1.1.0-dev.392 → 1.1.0-dev.397
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/LazyContentBoundary-CqvIcNMp.js +167 -0
- package/PdfContent-CU1Q5IV6.js +226 -0
- package/PdfContent.css +1 -0
- package/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
- package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -1
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts +7 -3
- package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
- package/components/CodeContent/CodeContent.d.ts +11 -0
- package/components/CodeContent/CodeContent.d.ts.map +1 -1
- package/components/LazyContentBoundary/LazyContentBoundary.d.ts +73 -0
- package/components/LazyContentBoundary/LazyContentBoundary.d.ts.map +1 -0
- package/components/PdfContent/PdfContent.d.ts +13 -3
- package/components/PdfContent/PdfContent.d.ts.map +1 -1
- package/index.css +1 -2
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +578 -15535
- package/models/attachment-canvas.d.ts +27 -7
- package/models/attachment-canvas.d.ts.map +1 -1
- package/package.json +7 -6
- package/utils/vite-external-matcher.d.ts +16 -0
- package/utils/vite-external-matcher.d.ts.map +1 -0
- package/PdfContent-CES32aGU.js +0 -17154
- package/download-BBbVchnm.js +0 -119
- package/esm-bFpgu8Tl.js +0 -17407
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { MIMEType as e, ensureDownloadFilename as t, mergeClasses as n, triggerAnchorDownload as r, triggerBlobDownload as i } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { Button as a, Spinner as o } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { Component as s, Suspense as c } from "react";
|
|
4
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
|
+
//#region src/types/attachment-canvas.ts
|
|
6
|
+
var d = /* @__PURE__ */ function(e) {
|
|
7
|
+
return e.PlainText = "plain_text", e.Image = "image", e.Audio = "audio", e.Markdown = "markdown", e.Json = "json", e.Pdf = "pdf", e.Ooxml = "ooxml", e.Code = "code", e.Html = "html", e.Visualizer = "visualizer", e.McpApp = "mcp_app", e.Unsupported = "unsupported", e.Error = "error", e;
|
|
8
|
+
}({}), f = /* @__PURE__ */ function(e) {
|
|
9
|
+
return e.Docx = "docx", e.Xlsx = "xlsx", e.Pptx = "pptx", e;
|
|
10
|
+
}({}), p = /* @__PURE__ */ function(e) {
|
|
11
|
+
return e.LoadFailed = "load_failed", e.Forbidden = "forbidden", e;
|
|
12
|
+
}({}), m = {
|
|
13
|
+
[f.Docx]: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
14
|
+
[f.Xlsx]: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
15
|
+
[f.Pptx]: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
16
|
+
}, h = (e) => {
|
|
17
|
+
switch (e.type) {
|
|
18
|
+
case d.PlainText:
|
|
19
|
+
case d.Markdown:
|
|
20
|
+
case d.Json:
|
|
21
|
+
case d.Image:
|
|
22
|
+
case d.Audio:
|
|
23
|
+
case d.Pdf:
|
|
24
|
+
case d.Ooxml:
|
|
25
|
+
case d.Code: return !0;
|
|
26
|
+
case d.Html: return e.url != null;
|
|
27
|
+
case d.Visualizer:
|
|
28
|
+
case d.McpApp: return !1;
|
|
29
|
+
case d.Unsupported: return e.url != null;
|
|
30
|
+
case d.Error: return e.errorType !== p.Forbidden && e.url != null;
|
|
31
|
+
}
|
|
32
|
+
}, g = async (e) => {
|
|
33
|
+
let t = await fetch(e);
|
|
34
|
+
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
35
|
+
return t.blob();
|
|
36
|
+
}, _ = (t) => {
|
|
37
|
+
switch (t.type) {
|
|
38
|
+
case d.Image: return {
|
|
39
|
+
url: t.url,
|
|
40
|
+
mimeType: void 0
|
|
41
|
+
};
|
|
42
|
+
case d.Audio: return {
|
|
43
|
+
url: t.url,
|
|
44
|
+
mimeType: t.mimeType
|
|
45
|
+
};
|
|
46
|
+
case d.Pdf: return {
|
|
47
|
+
url: t.url,
|
|
48
|
+
mimeType: e.PDF
|
|
49
|
+
};
|
|
50
|
+
case d.Ooxml: return {
|
|
51
|
+
url: t.url,
|
|
52
|
+
mimeType: m[t.format]
|
|
53
|
+
};
|
|
54
|
+
case d.Html: return {
|
|
55
|
+
url: t.url,
|
|
56
|
+
mimeType: e.HTML
|
|
57
|
+
};
|
|
58
|
+
case d.Unsupported:
|
|
59
|
+
case d.Error: return {
|
|
60
|
+
url: t.url,
|
|
61
|
+
mimeType: void 0
|
|
62
|
+
};
|
|
63
|
+
case d.PlainText:
|
|
64
|
+
case d.Code: return {
|
|
65
|
+
url: void 0,
|
|
66
|
+
mimeType: e.Plain
|
|
67
|
+
};
|
|
68
|
+
case d.Markdown: return {
|
|
69
|
+
url: void 0,
|
|
70
|
+
mimeType: e.Markdown
|
|
71
|
+
};
|
|
72
|
+
case d.Json: return {
|
|
73
|
+
url: void 0,
|
|
74
|
+
mimeType: e.JSON
|
|
75
|
+
};
|
|
76
|
+
default: return {
|
|
77
|
+
url: void 0,
|
|
78
|
+
mimeType: void 0
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}, v = (n, a) => {
|
|
82
|
+
let { url: o, mimeType: s } = _(n), c = t(a ?? "attachment", o, s);
|
|
83
|
+
switch (n.type) {
|
|
84
|
+
case d.PlainText:
|
|
85
|
+
if (n.text === "") return;
|
|
86
|
+
i(new Blob([n.text], { type: e.Plain }), c);
|
|
87
|
+
return;
|
|
88
|
+
case d.Markdown:
|
|
89
|
+
if (n.text === "") return;
|
|
90
|
+
i(new Blob([n.text], { type: e.Markdown }), c);
|
|
91
|
+
return;
|
|
92
|
+
case d.Json:
|
|
93
|
+
i(new Blob([JSON.stringify(n.value, null, 2)], { type: e.JSON }), c);
|
|
94
|
+
return;
|
|
95
|
+
case d.Image:
|
|
96
|
+
case d.Audio:
|
|
97
|
+
case d.Pdf:
|
|
98
|
+
case d.Ooxml:
|
|
99
|
+
r(n.url, c);
|
|
100
|
+
return;
|
|
101
|
+
case d.Code:
|
|
102
|
+
if (n.text === "") return;
|
|
103
|
+
i(new Blob([n.text], { type: e.Plain }), c);
|
|
104
|
+
return;
|
|
105
|
+
case d.Html:
|
|
106
|
+
if (n.url == null) return;
|
|
107
|
+
r(n.url, c);
|
|
108
|
+
return;
|
|
109
|
+
case d.Visualizer:
|
|
110
|
+
case d.McpApp: return;
|
|
111
|
+
case d.Unsupported:
|
|
112
|
+
if (n.url == null) return;
|
|
113
|
+
r(n.url, c);
|
|
114
|
+
return;
|
|
115
|
+
case d.Error:
|
|
116
|
+
if (!h(n) || n.url == null) return;
|
|
117
|
+
r(n.url, c);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
}, y = ({ loadingLabel: e, pendingContent: t }) => /* @__PURE__ */ u("div", {
|
|
121
|
+
role: "status",
|
|
122
|
+
"aria-live": "polite",
|
|
123
|
+
className: "flex h-full items-center justify-center",
|
|
124
|
+
children: [t ?? /* @__PURE__ */ l(o, {}), /* @__PURE__ */ l("span", {
|
|
125
|
+
className: "sr-only",
|
|
126
|
+
children: e
|
|
127
|
+
})]
|
|
128
|
+
}), b = ({ errorLabel: e, retryLabel: t, onRetry: r, errorContent: i }) => /* @__PURE__ */ u("div", {
|
|
129
|
+
className: "flex h-full flex-col items-center justify-center gap-3 p-4",
|
|
130
|
+
children: [i, /* @__PURE__ */ u("div", {
|
|
131
|
+
role: "alert",
|
|
132
|
+
className: "flex flex-col items-center gap-3 text-center",
|
|
133
|
+
children: [/* @__PURE__ */ l("p", {
|
|
134
|
+
className: n("dial-body-text", "text-secondary"),
|
|
135
|
+
children: e
|
|
136
|
+
}), /* @__PURE__ */ l(a, {
|
|
137
|
+
label: t,
|
|
138
|
+
"aria-label": t,
|
|
139
|
+
onClick: r
|
|
140
|
+
})]
|
|
141
|
+
})]
|
|
142
|
+
}), x = class extends s {
|
|
143
|
+
state = { hasError: !1 };
|
|
144
|
+
static getDerivedStateFromError() {
|
|
145
|
+
return { hasError: !0 };
|
|
146
|
+
}
|
|
147
|
+
componentDidUpdate(e) {
|
|
148
|
+
e.retryKey !== this.props.retryKey && this.state.hasError && this.setState({ hasError: !1 });
|
|
149
|
+
}
|
|
150
|
+
render() {
|
|
151
|
+
let { children: e, onRetry: t, pendingContent: n, errorContent: r, labels: { loadingLabel: i = "Loading…", errorLabel: a = "Failed to load content", retryLabel: o = "Retry" } = {} } = this.props;
|
|
152
|
+
return this.state.hasError ? /* @__PURE__ */ l(b, {
|
|
153
|
+
errorLabel: a,
|
|
154
|
+
retryLabel: o,
|
|
155
|
+
onRetry: t,
|
|
156
|
+
errorContent: r
|
|
157
|
+
}) : /* @__PURE__ */ l(c, {
|
|
158
|
+
fallback: /* @__PURE__ */ l(y, {
|
|
159
|
+
loadingLabel: i,
|
|
160
|
+
pendingContent: n
|
|
161
|
+
}),
|
|
162
|
+
children: e
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
//#endregion
|
|
167
|
+
export { g as a, p as c, v as i, f as l, b as n, h as o, y as r, d as s, x as t };
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import "./PdfContent.css";
|
|
2
|
+
import { a as e, n as t, r as n } from "./LazyContentBoundary-CqvIcNMp.js";
|
|
3
|
+
import { mergeClasses as r } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
import { DIAL_ICON_SIZE as i, DIAL_KIT_ICON_STROKE as a, Dropdown as o, ElementSize as s, FabButton as c, Input as l } from "@epam/ai-dial-ui-kit";
|
|
5
|
+
import { IconMenu2 as ee, IconX as u } from "@tabler/icons-react";
|
|
6
|
+
import { useCallback as d, useEffect as f, useId as te, useRef as p, useState as m } from "react";
|
|
7
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
8
|
+
import { DocumentPreview as ne, PageThumbnail as re } from "@epam/ai-dial-react-pdf-highlighter";
|
|
9
|
+
var ie = { viewer: "_viewer_1gfxm_1" }, _ = null, v = (e) => (_ ||= new Promise((t, n) => {
|
|
10
|
+
try {
|
|
11
|
+
t(e());
|
|
12
|
+
} catch (e) {
|
|
13
|
+
n(e);
|
|
14
|
+
}
|
|
15
|
+
}).catch((e) => {
|
|
16
|
+
throw _ = null, e;
|
|
17
|
+
}), _), y = 15, b = 3, x = 172, ae = 400, oe = 150, se = 60, S = ({ url: _, highlights: S, selectedHighlightId: C, loadPdf: ce, configurePdfWorker: w, hideHeader: le = !1, labels: { thumbnailsLabel: ue = "Thumbnails", showThumbnailsLabel: de = "Show thumbnails", hideThumbnailsLabel: fe = "Hide thumbnails", pageNumberLabel: pe = "Page number", loadingLabel: me = "Loading…", errorLabel: he = "Failed to load content", retryLabel: ge = "Retry" } = {} }) => {
|
|
18
|
+
let [T, E] = m(() => w ? "preparing" : "ready"), [_e, ve] = m(0);
|
|
19
|
+
f(() => {
|
|
20
|
+
if (!w) return;
|
|
21
|
+
E("preparing");
|
|
22
|
+
let e = !1;
|
|
23
|
+
return v(w).then(() => {
|
|
24
|
+
e || E("ready");
|
|
25
|
+
}).catch(() => {
|
|
26
|
+
e || E("error");
|
|
27
|
+
}), () => {
|
|
28
|
+
e = !0;
|
|
29
|
+
};
|
|
30
|
+
}, [w, _e]);
|
|
31
|
+
let D = d(() => {
|
|
32
|
+
ve((e) => e + 1);
|
|
33
|
+
}, []), O = te(), [k, A] = m(0), [j, M] = m(/* @__PURE__ */ new Map()), [N, P] = m(!1), [F, I] = m(() => C ? S.find((e) => e.id === C)?.bboxes[0]?.page ?? 1 : 1), L = p(null), R = p(null), [ye, z] = m([]), [B, be] = m(x), [xe, Se] = m(ae), [Ce, we] = m(0), V = p(!1), H = p(0), U = p(null);
|
|
34
|
+
f(() => {
|
|
35
|
+
if (!C) return;
|
|
36
|
+
let e = S.find((e) => e.id === C)?.bboxes[0]?.page;
|
|
37
|
+
e != null && I(e);
|
|
38
|
+
}, [C, S]), f(() => {
|
|
39
|
+
let e = R.current;
|
|
40
|
+
if (!N || !e) return;
|
|
41
|
+
let t = new ResizeObserver((e) => {
|
|
42
|
+
let t = e[0]?.contentRect.height;
|
|
43
|
+
t && Se(t);
|
|
44
|
+
});
|
|
45
|
+
return t.observe(e), () => t.disconnect();
|
|
46
|
+
}, [N]);
|
|
47
|
+
let Te = d((e) => {
|
|
48
|
+
if (!e || V.current) return;
|
|
49
|
+
let t = e.getBoundingClientRect().height;
|
|
50
|
+
t > 0 && (V.current = !0, be(t));
|
|
51
|
+
}, []), Ee = d((e) => {
|
|
52
|
+
H.current = e.currentTarget.scrollTop, U.current ??= requestAnimationFrame(() => {
|
|
53
|
+
U.current = null, we(H.current);
|
|
54
|
+
});
|
|
55
|
+
}, []);
|
|
56
|
+
f(() => () => {
|
|
57
|
+
U.current != null && cancelAnimationFrame(U.current);
|
|
58
|
+
}, []), f(() => {
|
|
59
|
+
let e = R.current;
|
|
60
|
+
if (!e || k === 0) return;
|
|
61
|
+
let t = (F - 1) * B - e.clientHeight / 2 + B / 2;
|
|
62
|
+
e.scrollTo({
|
|
63
|
+
top: Math.max(0, t),
|
|
64
|
+
behavior: "smooth"
|
|
65
|
+
});
|
|
66
|
+
}, [
|
|
67
|
+
F,
|
|
68
|
+
k,
|
|
69
|
+
N,
|
|
70
|
+
B
|
|
71
|
+
]);
|
|
72
|
+
let W = Math.max(0, Math.floor(Ce / B) - b), De = Math.ceil(xe / B) + b * 2, G = Math.min(k - 1, W + De);
|
|
73
|
+
f(() => {
|
|
74
|
+
if (k === 0) return;
|
|
75
|
+
let e = Math.min(k, y);
|
|
76
|
+
z(Array.from({ length: e }, (e, t) => t + 1));
|
|
77
|
+
}, [k]), f(() => {
|
|
78
|
+
if (!N || k === 0) return;
|
|
79
|
+
let e = setTimeout(() => {
|
|
80
|
+
z((e) => {
|
|
81
|
+
let t = new Set(e), n = !1;
|
|
82
|
+
for (let e = W + 1; e <= G + 1; e++) t.has(e) || (t.add(e), n = !0);
|
|
83
|
+
return n ? Array.from(t).sort((e, t) => e - t) : e;
|
|
84
|
+
});
|
|
85
|
+
}, oe);
|
|
86
|
+
return () => clearTimeout(e);
|
|
87
|
+
}, [
|
|
88
|
+
N,
|
|
89
|
+
W,
|
|
90
|
+
G,
|
|
91
|
+
k
|
|
92
|
+
]);
|
|
93
|
+
let K = d((e) => {
|
|
94
|
+
M((t) => new Map([...t, ...e]));
|
|
95
|
+
}, []), [q, Oe] = m(!1), ke = d((e) => {
|
|
96
|
+
L.current = e, Oe(!0);
|
|
97
|
+
}, []), J = p(null);
|
|
98
|
+
f(() => {
|
|
99
|
+
if (!q) return;
|
|
100
|
+
let e = J.current, t = e?.querySelector(".pdf-container"), n = e?.querySelector(".pdf-highlight-viewer");
|
|
101
|
+
if (!t || !n) return;
|
|
102
|
+
let r = () => {
|
|
103
|
+
let e = n.scrollWidth - n.clientWidth;
|
|
104
|
+
e > 0 && (n.scrollLeft = e / 2);
|
|
105
|
+
};
|
|
106
|
+
r();
|
|
107
|
+
let i = new ResizeObserver(r);
|
|
108
|
+
i.observe(t), i.observe(n);
|
|
109
|
+
let a = L.current?.getZoom(), o = 0, s, c = () => {
|
|
110
|
+
let e = L.current?.getZoom();
|
|
111
|
+
e !== a && (a = e, o = se), o > 0 && (r(), --o), s = requestAnimationFrame(c);
|
|
112
|
+
};
|
|
113
|
+
return s = requestAnimationFrame(c), () => {
|
|
114
|
+
cancelAnimationFrame(s), i.disconnect();
|
|
115
|
+
};
|
|
116
|
+
}, [q]), f(() => {
|
|
117
|
+
if (!q || C) return;
|
|
118
|
+
let e = requestAnimationFrame(() => {
|
|
119
|
+
L.current?.navigateToPage(1);
|
|
120
|
+
});
|
|
121
|
+
return () => cancelAnimationFrame(e);
|
|
122
|
+
}, [q, C]);
|
|
123
|
+
let Y = d((e) => {
|
|
124
|
+
I(e), L.current?.navigateToPage(e);
|
|
125
|
+
}, []), [X, Z] = m(() => String(F));
|
|
126
|
+
f(() => {
|
|
127
|
+
Z(String(F));
|
|
128
|
+
}, [F]);
|
|
129
|
+
let Q = d((e) => {
|
|
130
|
+
let t = Number(e);
|
|
131
|
+
Number.isInteger(t) && t >= 1 && t <= k ? Y(t) : Z(String(F));
|
|
132
|
+
}, [
|
|
133
|
+
k,
|
|
134
|
+
F,
|
|
135
|
+
Y
|
|
136
|
+
]);
|
|
137
|
+
if (!_) return null;
|
|
138
|
+
if (T === "preparing") return /* @__PURE__ */ h(n, { loadingLabel: me });
|
|
139
|
+
if (T === "error") return /* @__PURE__ */ h(t, {
|
|
140
|
+
errorLabel: he,
|
|
141
|
+
retryLabel: ge,
|
|
142
|
+
onRetry: D
|
|
143
|
+
});
|
|
144
|
+
let $ = [];
|
|
145
|
+
for (let e = W + 1; e <= G + 1 && e <= k; e++) $.push(/* @__PURE__ */ h("div", {
|
|
146
|
+
ref: e === W + 1 ? Te : void 0,
|
|
147
|
+
children: /* @__PURE__ */ h(re, {
|
|
148
|
+
pageNum: e,
|
|
149
|
+
onSelectPage: Y,
|
|
150
|
+
isSelected: F === e,
|
|
151
|
+
isLoading: !j.has(e),
|
|
152
|
+
thumbnailUrl: j.get(e) ?? null
|
|
153
|
+
})
|
|
154
|
+
}, e));
|
|
155
|
+
let Ae = W * B, je = Math.max(0, k - G - 1) * B;
|
|
156
|
+
return /* @__PURE__ */ g("div", {
|
|
157
|
+
className: "relative flex h-full overflow-hidden",
|
|
158
|
+
children: [k > 0 && /* @__PURE__ */ h("div", {
|
|
159
|
+
className: "absolute start-3 top-3 z-10",
|
|
160
|
+
children: /* @__PURE__ */ h(o, {
|
|
161
|
+
open: N,
|
|
162
|
+
onOpenChange: P,
|
|
163
|
+
placement: "bottom-start",
|
|
164
|
+
matchReferenceWidth: !1,
|
|
165
|
+
renderOverlay: () => /* @__PURE__ */ g("div", {
|
|
166
|
+
className: "flex w-36 flex-col",
|
|
167
|
+
children: [/* @__PURE__ */ h("div", {
|
|
168
|
+
className: "shrink-0 p-1",
|
|
169
|
+
children: /* @__PURE__ */ h(l, {
|
|
170
|
+
size: s.Small,
|
|
171
|
+
"aria-label": pe,
|
|
172
|
+
value: X,
|
|
173
|
+
postfix: `/ ${k}`,
|
|
174
|
+
inputMode: "numeric",
|
|
175
|
+
onChange: (e) => Z(e ?? ""),
|
|
176
|
+
onBlur: () => Q(X),
|
|
177
|
+
onKeyDown: (e) => {
|
|
178
|
+
e.key === "Enter" && Q(X);
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
}), /* @__PURE__ */ g("div", {
|
|
182
|
+
ref: R,
|
|
183
|
+
id: O,
|
|
184
|
+
role: "region",
|
|
185
|
+
"aria-label": ue,
|
|
186
|
+
onScroll: Ee,
|
|
187
|
+
className: "max-h-[70vh] min-h-0 overflow-y-auto overflow-x-hidden p-1 [scrollbar-gutter:stable]",
|
|
188
|
+
children: [
|
|
189
|
+
/* @__PURE__ */ h("div", { style: { height: Ae } }),
|
|
190
|
+
$,
|
|
191
|
+
/* @__PURE__ */ h("div", { style: { height: je } })
|
|
192
|
+
]
|
|
193
|
+
})]
|
|
194
|
+
}),
|
|
195
|
+
children: /* @__PURE__ */ h(c, {
|
|
196
|
+
icon: h(N ? u : ee, {
|
|
197
|
+
size: i.LG,
|
|
198
|
+
stroke: a,
|
|
199
|
+
"aria-hidden": !0
|
|
200
|
+
}),
|
|
201
|
+
"aria-label": N ? fe : de,
|
|
202
|
+
"aria-expanded": N,
|
|
203
|
+
"aria-controls": N ? O : void 0
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
}), /* @__PURE__ */ h("div", {
|
|
207
|
+
ref: J,
|
|
208
|
+
className: r("min-w-0 flex-1 overflow-hidden", ie.viewer),
|
|
209
|
+
children: /* @__PURE__ */ h(ne, {
|
|
210
|
+
fileUrl: _,
|
|
211
|
+
loadFileCb: ce ?? e,
|
|
212
|
+
highlights: S,
|
|
213
|
+
selectedHighlightId: C,
|
|
214
|
+
showOccurrences: !1,
|
|
215
|
+
onTotalPagesChange: A,
|
|
216
|
+
thumbnailPageNumbers: ye,
|
|
217
|
+
onThumbnailsLoaded: K,
|
|
218
|
+
onViewerReady: ke,
|
|
219
|
+
viewerOptions: { enableVirtualScrolling: !0 },
|
|
220
|
+
containerClassName: le ? "[&>div:first-child]:hidden" : void 0
|
|
221
|
+
})
|
|
222
|
+
})]
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
//#endregion
|
|
226
|
+
export { S as PdfContent };
|
package/PdfContent.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._viewer_1gfxm_1 .pdf-container{min-width:max-content}*,:after,:before,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:after,:before{box-sizing:border-box;border:0 solid}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre,fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=769px){.container{max-width:769px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.visible{visibility:visible}.static{position:static}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-1{left:.25rem}.top-1{top:.25rem}.z-10{z-index:10}.z-20{z-index:20}.mx-auto{margin-left:auto;margin-right:auto}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.hidden{display:none}.h-4{height:1rem}.h-6{height:1.5rem}.h-\[146px\]{height:146px}.h-\[186px\]{height:186px}.h-\[600px\]{height:600px}.h-\[700px\]{height:700px}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-6{min-height:1.5rem}.min-h-\[26px\]{min-height:26px}.w-64{width:16rem}.w-\[104px\]{width:104px}.w-\[120px\]{width:120px}.w-\[208px\]{width:208px}.w-\[28\%\]{width:28%}.w-\[500px\]{width:500px}.w-\[58\%\]{width:58%}.w-fit{width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.min-w-3{min-width:.75rem}.max-w-\[320px\]{max-width:320px}.max-w-\[40\%\]{max-width:40%}.max-w-\[520px\]{max-width:520px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}@keyframes skeleton-wave{0%{background-position:200% 0}to{background-position:-200% 0}}.animate-skeleton-wave{animation:3.5s ease-in-out infinite skeleton-wave}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.\!justify-start{justify-content:flex-start!important}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.self-center{align-self:center}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:4px}.rounded-\[120px\]{border-radius:120px}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-r{border-right-width:1px}.border-accent{border-color:var(--stroke-accent,#1d4ed8)}.border-primary{border-color:var(--stroke-primary,#57647a)}.border-tertiary{border-color:var(--stroke-tertiary,#e0e6f0)}.border-transparent{border-color:#0000}.bg-backdrop{background-color:var(--bg-backdrop,#161b2d4d)}.bg-control-accent-alpha{background-color:var(--bg-control-accent-alpha,#2764d90f)}.bg-control-neutral{background-color:var(--bg-control-neutral,#fcfcfc)}.bg-layer-base{background-color:var(--bg-layer-base,#f5f7fa)}.bg-layer-raised{background-color:var(--bg-layer-raised,#fcfcfc)}.bg-layer-sunken{background-color:var(--bg-layer-sunken,#eef1f7)}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-layer-sunken{--tw-gradient-from:var(--bg-layer-sunken,#eef1f7) var(--tw-gradient-from-position);--tw-gradient-to:#fff0 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-layer-raised{--tw-gradient-to:#fff0 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--bg-layer-raised,#fcfcfc) var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-layer-sunken{--tw-gradient-to:var(--bg-layer-sunken,#eef1f7) var(--tw-gradient-to-position)}.bg-\[length\:200\%_100\%\]{background-size:200% 100%}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-10{padding:2.5rem}.p-2{padding:.5rem}.p-4{padding:1rem}.\!py-0{padding-top:0!important;padding-bottom:0!important}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-\[60px\]{padding-left:60px;padding-right:60px}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pl-0\.5{padding-left:.125rem}.pt-10{padding-top:2.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-xs{font-size:.75rem;line-height:1rem}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.text-accent{color:var(--text-accent,#1d4ed8)}.text-primary{color:var(--text-primary,#161b2d)}.text-secondary{color:var(--text-secondary,#57647a)}.outline{outline-width:1px;outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\:border-accent-alpha:hover{border-color:var(--stroke-accent-alpha,#2764d933)}.hover\:bg-control-accent-alpha-hover:hover{background-color:var(--bg-control-accent-alpha-hover,#2764d924)}.pdf-highlight-viewer{contain:layout style paint;background:#f5f5f5;width:100%;height:100%;position:relative;overflow:auto}.pdf-container{contain:layout style paint;margin:0 auto;padding:20px;position:relative}.pdf-page-container{contain:layout style paint;background:#fff;margin:0 auto 20px;position:relative;box-shadow:0 2px 8px #0000001a}.pdf-canvas{z-index:1;-webkit-user-select:none;user-select:none;width:100%;height:auto;display:block;position:relative}.unified-layer{z-index:2;pointer-events:none;opacity:.01;contain:layout style;width:100%;height:100%;position:absolute;top:0;left:0}.unified-layer .text-segment,.unified-layer .highlight-wrapper{pointer-events:auto}.text-segment{white-space:pre;transform-origin:0 0;-webkit-user-select:text;user-select:text;color:#0000;background:0 0;border:none;outline:none;margin:0;padding:0;line-height:1;position:absolute}.text-segment.selectable{cursor:text}.highlight-wrapper{cursor:pointer;transform-origin:0 0;contain:layout style;transition:opacity .2s;position:absolute}.highlight-wrapper:hover{z-index:3}.highlight-background{z-index:-1;will-change:opacity, transform;border-radius:3px;transition:opacity .2s,transform .2s;position:absolute;inset:-2px}.highlight-wrapper:hover .highlight-background{transform:scale(1.02)}.highlight-label{white-space:nowrap;box-sizing:border-box;border:1px solid #0000;flex-shrink:0;align-items:center;padding:2px 4px;font-size:12px;line-height:1.2;display:flex}.highlight-label-icon{box-sizing:border-box;flex-shrink:0;justify-content:center;align-items:center;min-width:0;min-height:0;display:inline-flex;overflow:hidden}.highlight-label-icon svg{max-width:100%;max-height:100%;color:inherit;fill:none;stroke:currentColor;flex-shrink:0;display:block;width:100%!important;height:100%!important}.unified-layer .highlight-label{margin-right:0}.protein-highlight .highlight-background{background:#ffc8004d;border:1px solid #ffb40099}.protein-highlight:hover .highlight-background{background:#ffc80080;border-color:#ffa000cc}.protein-highlight.selected .highlight-background{outline-offset:1px;background:#ffc800b3;border:2px solid #ff8c00;outline:2px solid #007acc}.gene-highlight .highlight-background{background:#00c8644d;border:1px solid #00b45a99}.gene-highlight:hover .highlight-background{background:#00c86480;border-color:#00a050cc}.gene-highlight.selected .highlight-background{outline-offset:1px;background:#00c864b3;border:2px solid #008c46;outline:2px solid #007acc}.disease-highlight .highlight-background{background:#dc32324d;border:1px solid #c8282899}.disease-highlight:hover .highlight-background{background:#dc323280;border-color:#b41e1ecc}.disease-highlight.selected .highlight-background{outline-offset:1px;background:#dc3232b3;border:2px solid #a01414;outline:2px solid #007acc}.chemical-highlight .highlight-background{background:#0096ff4d;border:1px solid #0082eb99}.chemical-highlight:hover .highlight-background{background:#0096ff80;border-color:#006ed7cc}.chemical-highlight.selected .highlight-background{outline-offset:1px;background:#0096ffb3;border:2px solid #005ac3;outline:2px solid #007acc}.species-highlight .highlight-background{background:#9664c84d;border:1px solid #8250b499}.species-highlight:hover .highlight-background{background:#9664c880;border-color:#6e3ca0cc}.species-highlight.selected .highlight-background{outline-offset:1px;background:#9664c8b3;border:2px solid #5a288c;outline:2px solid #007acc}.pdf-highlight-viewer.scrolling .unified-layer{will-change:transform}.pdf-highlight-viewer.scrolling .highlight-background{transition:none}.highlight-background{backface-visibility:hidden;transform:translateZ(0)}.highlight-wrapper{contain:layout style paint}.text-segment::-moz-selection{color:#0000;background:#007bff4d}.text-segment::selection{color:#0000;background:#007bff4d}.highlight-wrapper .text-segment::-moz-selection{color:#0000;background:#ffffff80}.highlight-wrapper .text-segment::selection{color:#0000;background:#ffffff80}.pdf-page-container.loading{opacity:.7}.pdf-page-container.loading:after{content:"";border:3px solid #f3f3f3;border-top-color:#007acc;border-radius:50%;width:32px;height:32px;margin:-16px 0 0 -16px;animation:1s linear infinite spin;position:absolute;top:50%;left:50%}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.search-result-highlight .highlight-background{animation:1s ease-in-out infinite alternate pulse-search;background:#ff06!important;border:2px solid #ffd700cc!important}@keyframes pulse-search{0%{opacity:.4}to{opacity:.8}}@media (prefers-contrast:high){.highlight-background{opacity:.8!important;border-width:2px!important}.protein-highlight .highlight-background{background:#ffc80099;border-color:#ff8c00}.gene-highlight .highlight-background{background:#00c86499;border-color:#008c46}.disease-highlight .highlight-background{background:#dc323299;border-color:#a01414}.chemical-highlight .highlight-background{background:#0096ff99;border-color:#005ac3}.species-highlight .highlight-background{background:#9664c899;border-color:#5a288c}}@media (prefers-reduced-motion:reduce){.highlight-background,.highlight-wrapper{transition:none!important;animation:none!important}}.highlight-wrapper:focus{outline-offset:2px;outline:2px solid #007acc}.highlight-wrapper:focus .highlight-background{opacity:.8;transform:scale(1.05)}.pdf-context-menu{z-index:1000;background:#fff;border:1px solid #ccc;border-radius:4px;min-width:180px;padding:4px 0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:14px;position:fixed;box-shadow:0 4px 12px #00000026}.pdf-context-menu-item{cursor:pointer;text-align:left;color:#333;background:0 0;border:none;width:100%;padding:8px 16px}.pdf-context-menu-item:hover{background:#f0f0f0}.pdf-context-menu-item:disabled{color:#999;cursor:not-allowed}.pdf-context-menu-separator{background:#eee;height:1px;margin:4px 0}.pdf-tooltip{color:#fff;z-index:1001;pointer-events:none;word-wrap:break-word;background:#000c;border-radius:4px;max-width:300px;padding:8px 12px;font-size:12px;position:fixed}.pdf-tooltip:after{content:"";border:5px solid #0000;border-top-color:#000c;width:0;height:0;margin-left:-5px;position:absolute;top:100%;left:50%}@media (width<=768px){.pdf-container{padding:10px}.pdf-page-container{margin-bottom:10px}.highlight-wrapper{min-width:44px;min-height:44px}.pdf-context-menu{min-width:200px;font-size:16px}.pdf-context-menu-item{padding:12px 16px}}@media print{.pdf-highlight-viewer{background:#fff}.pdf-page-container{box-shadow:none;page-break-after:always;margin-bottom:0}.highlight-background{transition:none;opacity:.6!important}.pdf-context-menu,.pdf-tooltip{display:none!important}}@media (prefers-color-scheme:dark){.pdf-highlight-viewer{background:#1a1a1a}.pdf-page-container{background:#2a2a2a;box-shadow:0 2px 8px #0000004d}.pdf-context-menu{color:#fff;background:#333;border-color:#555}.pdf-context-menu-item{color:#fff}.pdf-context-menu-item:hover,.pdf-context-menu-separator{background:#555}}.highlight-enter{opacity:0;transform:scale(.8)}.highlight-enter-active{opacity:1;transition:opacity .3s,transform .3s;transform:scale(1)}.highlight-exit{opacity:1;transform:scale(1)}.highlight-exit-active{opacity:0;transition:opacity .3s,transform .3s;transform:scale(.8)}.pdf-hidden{display:none!important}.pdf-invisible{visibility:hidden!important}.pdf-no-select{-webkit-user-select:none!important;user-select:none!important}.pdf-no-pointer-events{pointer-events:none!important}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvas/AttachmentCanvas.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"AttachmentCanvas.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvas/AttachmentCanvas.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAuU5E,wGAAwG;AACxG,eAAO,MAAM,gBAAgB,6DAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCanvasBody.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasBody/AttachmentCanvasBody.tsx"],"names":[],"mappings":"AAkBA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"AttachmentCanvasBody.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasBody/AttachmentCanvasBody.tsx"],"names":[],"mappings":"AAkBA,OAAO,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AA0bhF,uNAAuN;AACvN,eAAO,MAAM,oBAAoB,iEAAiC,CAAC"}
|
|
@@ -15,9 +15,13 @@ export interface AttachmentCanvasContainerProps {
|
|
|
15
15
|
codeBlockTheme?: CodeBlockTheme;
|
|
16
16
|
/**
|
|
17
17
|
* Configures `pdfjs-dist`'s worker (`GlobalWorkerOptions.workerSrc`) for the
|
|
18
|
-
* host app. Called once, the first time a PDF attachment is opened
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* host app. Called once, the first time a PDF attachment is opened, and
|
|
19
|
+
* awaited before the viewer mounts. Concurrent PDF opens share one
|
|
20
|
+
* in-flight call; a successful call is memoized so later opens never
|
|
21
|
+
* repeat it. A rejected call is not cached — the next PDF open (or a
|
|
22
|
+
* subsequent retry) invokes it again. When omitted,
|
|
23
|
+
* `@epam/pdf-highlighter-kit`'s own CDN-hosted worker fallback is used
|
|
24
|
+
* instead, so PDF rendering still works, just without the host's own
|
|
21
25
|
* bundled worker asset.
|
|
22
26
|
*/
|
|
23
27
|
configurePdfWorker?: () => void | Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCanvasContainer.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasContainer/AttachmentCanvasContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AAKxC,yDAAyD;AACzD,MAAM,WAAW,8BAA8B;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC
|
|
1
|
+
{"version":3,"file":"AttachmentCanvasContainer.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentCanvasContainer/AttachmentCanvasContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,gCAAgC,CAAC;AAKxC,yDAAyD;AACzD,MAAM,WAAW,8BAA8B;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CAgItE,CAAC"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { CodeBlockTheme } from '@epam/ai-dial-chat-shared';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { CodeCanvasContent } from '../../models/attachment-canvas';
|
|
4
|
+
/** User-visible strings for {@link CodeContent}'s syntax-highlighter loading/error states. */
|
|
5
|
+
export interface CodeContentLabels {
|
|
6
|
+
/** Accessible status text announced while the highlighter engine loads. Defaults to `'Loading…'`. */
|
|
7
|
+
loadingLabel?: string;
|
|
8
|
+
/** Message shown when the highlighter engine fails to load. Defaults to `'Failed to load content'`. */
|
|
9
|
+
errorLabel?: string;
|
|
10
|
+
/** Label and accessible name for the retry control. Defaults to `'Retry'`. */
|
|
11
|
+
retryLabel?: string;
|
|
12
|
+
}
|
|
4
13
|
/** Props for {@link CodeContent}. */
|
|
5
14
|
export interface CodeContentProps {
|
|
6
15
|
/** The code/text content to render. */
|
|
7
16
|
content: CodeCanvasContent;
|
|
8
17
|
/** Syntax-highlight color theme. Defaults to `CodeBlockTheme.Light`. */
|
|
9
18
|
codeBlockTheme?: CodeBlockTheme;
|
|
19
|
+
/** User-visible strings for the syntax-highlighter loading/error states. All fields have English defaults. */
|
|
20
|
+
labels?: CodeContentLabels;
|
|
10
21
|
}
|
|
11
22
|
/** Renders syntax-highlighted source code or plain text for a `CodeCanvasContent` payload. */
|
|
12
23
|
export declare const CodeContent: FC<CodeContentProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeContent.d.ts","sourceRoot":"","sources":["../../../src/components/CodeContent/CodeContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAGf,MAAM,2BAA2B,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"CodeContent.d.ts","sourceRoot":"","sources":["../../../src/components/CodeContent/CodeContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAGf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAA8C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAyBxE,8FAA8F;AAC9F,MAAM,WAAW,iBAAiB;IAChC,qGAAqG;IACrG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uGAAuG;IACvG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,wEAAwE;IACxE,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,8GAA8G;IAC9G,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,8FAA8F;AAC9F,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA2D5C,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Component, FC, ReactNode } from 'react';
|
|
2
|
+
/** User-visible strings for {@link LazyContentBoundary}. All fields have English defaults. */
|
|
3
|
+
export interface LazyContentBoundaryLabels {
|
|
4
|
+
/** Accessible status text announced while the lazy content loads. Defaults to `'Loading…'`. */
|
|
5
|
+
loadingLabel?: string;
|
|
6
|
+
/** Message shown when the lazy content fails to load. Defaults to `'Failed to load content'`. */
|
|
7
|
+
errorLabel?: string;
|
|
8
|
+
/** Label and accessible name for the retry control. Defaults to `'Retry'`. */
|
|
9
|
+
retryLabel?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Props for {@link LazyContentBoundary}. */
|
|
12
|
+
export interface LazyContentBoundaryProps {
|
|
13
|
+
/** The lazy-loaded content to render once ready. */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Changing this value clears a previously caught error. The caller must
|
|
17
|
+
* pair it with recreating the `lazy()` reference passed as `children` —
|
|
18
|
+
* React caches a rejected `lazy()` promise forever, so retrying only
|
|
19
|
+
* works if a genuinely new `lazy()` component is mounted, not the same one
|
|
20
|
+
* that already rejected.
|
|
21
|
+
*/
|
|
22
|
+
retryKey: number;
|
|
23
|
+
/**
|
|
24
|
+
* Called when the user activates the retry control. The caller is
|
|
25
|
+
* responsible for changing `retryKey` and recreating the `lazy()`
|
|
26
|
+
* reference in response (see `retryKey`'s doc).
|
|
27
|
+
*/
|
|
28
|
+
onRetry: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Rendered inside the `role="status"` region while the lazy import is
|
|
31
|
+
* pending, alongside the accessible `loadingLabel`. Defaults to a
|
|
32
|
+
* centered `Spinner`.
|
|
33
|
+
*/
|
|
34
|
+
pendingContent?: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Rendered above the `role="alert"` retry message when the lazy import
|
|
37
|
+
* fails — e.g. a plain-text fallback that stays usable while retry is
|
|
38
|
+
* offered. Omitted by default.
|
|
39
|
+
*/
|
|
40
|
+
errorContent?: ReactNode;
|
|
41
|
+
/** User-visible strings. All fields have English defaults. */
|
|
42
|
+
labels?: LazyContentBoundaryLabels;
|
|
43
|
+
}
|
|
44
|
+
interface LazyContentPendingProps {
|
|
45
|
+
loadingLabel: string;
|
|
46
|
+
pendingContent?: ReactNode;
|
|
47
|
+
}
|
|
48
|
+
/** Accessible pending state shared by lazy imports and asynchronous runtime preparation. */
|
|
49
|
+
export declare const LazyContentPending: FC<LazyContentPendingProps>;
|
|
50
|
+
interface LazyContentErrorProps {
|
|
51
|
+
errorLabel: string;
|
|
52
|
+
retryLabel: string;
|
|
53
|
+
onRetry: () => void;
|
|
54
|
+
errorContent?: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
/** Accessible retry state shared by lazy imports and asynchronous runtime preparation. */
|
|
57
|
+
export declare const LazyContentError: FC<LazyContentErrorProps>;
|
|
58
|
+
interface LazyContentBoundaryState {
|
|
59
|
+
/** Whether the wrapped lazy import has thrown (a rejected dynamic import). */
|
|
60
|
+
hasError: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Wraps a `lazy()`-loaded component with an accessible pending state
|
|
64
|
+
* (`role="status"`) and a retryable failure state (`role="alert"`).
|
|
65
|
+
*/
|
|
66
|
+
export declare class LazyContentBoundary extends Component<LazyContentBoundaryProps, LazyContentBoundaryState> {
|
|
67
|
+
state: LazyContentBoundaryState;
|
|
68
|
+
static getDerivedStateFromError(): LazyContentBoundaryState;
|
|
69
|
+
componentDidUpdate(prevProps: LazyContentBoundaryProps): void;
|
|
70
|
+
render(): ReactNode;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=LazyContentBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyContentBoundary.d.ts","sourceRoot":"","sources":["../../../src/components/LazyContentBoundary/LazyContentBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAY,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAErE,8FAA8F;AAC9F,MAAM,WAAW,yBAAyB;IACxC,+FAA+F;IAC/F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,oDAAoD;IACpD,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,yBAAyB,CAAC;CACpC;AAED,UAAU,uBAAuB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED,4FAA4F;AAC5F,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAY1D,CAAC;AAEF,UAAU,qBAAqB;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B;AAED,0FAA0F;AAC1F,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAetD,CAAC;AAEF,UAAU,wBAAwB;IAChC,8EAA8E;IAC9E,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,SAAS,CAChD,wBAAwB,EACxB,wBAAwB,CACzB;IACU,KAAK,EAAE,wBAAwB,CAAuB;IAE/D,MAAM,CAAC,wBAAwB,IAAI,wBAAwB;IAIlD,kBAAkB,CAAC,SAAS,EAAE,wBAAwB,GAAG,IAAI;IAY7D,MAAM,IAAI,SAAS;CAqC7B"}
|
|
@@ -10,6 +10,12 @@ export interface PdfContentLabels {
|
|
|
10
10
|
hideThumbnailsLabel?: string;
|
|
11
11
|
/** Accessible label for the current-page number input at the top of the thumbnails panel. Defaults to `'Page number'`. */
|
|
12
12
|
pageNumberLabel?: string;
|
|
13
|
+
/** Accessible status text announced while the host prepares the PDF runtime. Defaults to `'Loading…'`. */
|
|
14
|
+
loadingLabel?: string;
|
|
15
|
+
/** Message shown when the host fails to prepare the PDF runtime. Defaults to `'Failed to load content'`. */
|
|
16
|
+
errorLabel?: string;
|
|
17
|
+
/** Label and accessible name for retrying PDF runtime preparation. Defaults to `'Retry'`. */
|
|
18
|
+
retryLabel?: string;
|
|
13
19
|
}
|
|
14
20
|
/** Props for the `PdfContent` component. */
|
|
15
21
|
export interface PdfContentProps {
|
|
@@ -25,9 +31,13 @@ export interface PdfContentProps {
|
|
|
25
31
|
fileName?: string;
|
|
26
32
|
/**
|
|
27
33
|
* Configures `pdfjs-dist`'s worker (`GlobalWorkerOptions.workerSrc`) for the
|
|
28
|
-
* host app. Called once, the first time a PDF attachment is opened
|
|
29
|
-
*
|
|
30
|
-
*
|
|
34
|
+
* host app. Called once, the first time a PDF attachment is opened, and
|
|
35
|
+
* awaited before the viewer mounts. Concurrent PDF opens share one
|
|
36
|
+
* in-flight call; a successful call is memoized so later opens never
|
|
37
|
+
* repeat it. A rejected call is not cached — the next PDF open (or a
|
|
38
|
+
* subsequent retry) invokes it again. When omitted,
|
|
39
|
+
* `@epam/pdf-highlighter-kit`'s own CDN-hosted worker fallback is used
|
|
40
|
+
* instead, so PDF rendering still works, just without the host's own
|
|
31
41
|
* bundled worker asset.
|
|
32
42
|
*/
|
|
33
43
|
configurePdfWorker?: () => void | Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PdfContent.d.ts","sourceRoot":"","sources":["../../../src/components/PdfContent/PdfContent.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EACL,KAAK,EAAE,EAQR,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PdfContent.d.ts","sourceRoot":"","sources":["../../../src/components/PdfContent/PdfContent.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EACL,KAAK,EAAE,EAQR,MAAM,OAAO,CAAC;AAcf,OAAO,gDAAgD,CAAC;AACxD,OAAO,yDAAyD,CAAC;AAkFjE,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC/B,iGAAiG;IACjG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gHAAgH;IAChH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,8GAA8G;IAC9G,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,0HAA0H;IAC1H,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0GAA0G;IAC1G,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4GAA4G;IAC5G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6FAA6F;IAC7F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,8EAA8E;IAC9E,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yFAAyF;IACzF,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED,8GAA8G;AAC9G,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAqb1C,CAAC"}
|