@epam/ai-dial-attachment-canvas 1.2.0-dev.112 → 1.2.0-dev.116
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.
|
@@ -15,6 +15,8 @@ export interface AttachmentCanvasContainerProps {
|
|
|
15
15
|
codeBlockTheme?: CodeBlockTheme;
|
|
16
16
|
/** Filename used when downloading a `MarkdownTable`'s content as CSV. Defaults to `'table.csv'`. */
|
|
17
17
|
tableDownloadFilename?: string;
|
|
18
|
+
/** Host-owned PDF loader. When omitted, the viewer fetches the URL with browser defaults. */
|
|
19
|
+
loadPdf?: (url: string) => Promise<Blob>;
|
|
18
20
|
/**
|
|
19
21
|
* Configures `pdfjs-dist`'s worker (`GlobalWorkerOptions.workerSrc`) for the
|
|
20
22
|
* host app. Called once, the first time a PDF attachment is opened, and
|
|
@@ -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,oGAAoG;IACpG,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,
|
|
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,oGAAoG;IACpG,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6FAA6F;IAC7F,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,yFAAyF;AACzF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,8BAA8B,CAgJtE,CAAC"}
|
package/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { AttachmentType as c, CodeBlockTheme as l, DEFAULT_MARKDOWN_CLASS_NAMES
|
|
|
4
4
|
import { SidebarOrientation as y, SidebarPanel as b } from "@epam/ai-dial-sidebar";
|
|
5
5
|
import { DIAL_ICON_SIZE as x, DIAL_KIT_ICON_STROKE as S, ElementSize as C, GhostIconButton as w, LinkButton as T, Spinner as E } from "@epam/ai-dial-ui-kit";
|
|
6
6
|
import { IconAlertTriangle as D, IconArrowsMaximize as O, IconCheck as k, IconCode as ee, IconCopy as te, IconDownload as ne, IconEye as re, IconLock as ie, IconMarkdown as ae, IconRefresh as oe } from "@tabler/icons-react";
|
|
7
|
-
import { createContext as A, lazy as j, memo as M, useCallback as N, useContext as
|
|
8
|
-
import { JsonView as
|
|
7
|
+
import { createContext as A, lazy as j, memo as M, useCallback as N, useContext as se, useEffect as P, useMemo as F, useRef as I, useState as L } from "react";
|
|
8
|
+
import { JsonView as R, defaultStyles as ce } from "react-json-view-lite";
|
|
9
9
|
import { Fragment as le, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
10
10
|
import { AppBridge as V, AppFrame as H } from "@mcp-ui/client";
|
|
11
11
|
import { McpUiHostContextChangedNotificationSchema as ue } from "@modelcontextprotocol/ext-apps/app-bridge";
|
|
@@ -22,7 +22,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
22
22
|
let { Prism: e } = await import("react-syntax-highlighter");
|
|
23
23
|
return { default: e };
|
|
24
24
|
}), ge = M(({ content: e, codeBlockTheme: t = l.Light, labels: n }) => {
|
|
25
|
-
let { text: r, language: i } = e, a = i == null || i === "plaintext", o = he[t], c = t === l.Light, [u, d] =
|
|
25
|
+
let { text: r, language: i } = e, a = i == null || i === "plaintext", o = he[t], c = t === l.Light, [u, d] = L(0), f = F(U, [u]), p = N(() => {
|
|
26
26
|
d((e) => e + 1);
|
|
27
27
|
}, []), m = /* @__PURE__ */ z("pre", {
|
|
28
28
|
className: "whitespace-pre-wrap break-words p-4",
|
|
@@ -55,8 +55,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
55
55
|
})
|
|
56
56
|
});
|
|
57
57
|
}), _e = { openInNewTabButton: "_openInNewTabButton_c1arc_1" }, ve = M(({ content: e, labels: t, isSourceView: n, title: r, codeBlockTheme: a, openInNewTabButtonTypographyClassName: o = "dial-body-semi-text" }) => {
|
|
58
|
-
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] =
|
|
59
|
-
|
|
58
|
+
let { htmlFrameBlockedLabel: s = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: c = "Open in new tab" } = t, [l, u] = L(!0), [d, f] = L(!1), p = I(null);
|
|
59
|
+
P(() => {
|
|
60
60
|
u(!0), f(!1);
|
|
61
61
|
}, [e]);
|
|
62
62
|
let m = N((t) => {
|
|
@@ -131,12 +131,12 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
131
131
|
let r = t;
|
|
132
132
|
r != null && (r.width != null && (e.style.width = `${r.width}px`), r.maxWidth != null && (e.style.maxWidth = `${r.maxWidth}px`), r.height != null && (e.style.height = `${r.height}px`), r.maxHeight != null && (e.style.maxHeight = `${r.maxHeight}px`));
|
|
133
133
|
}, Ce = (e, t, n) => {
|
|
134
|
-
let r =
|
|
135
|
-
|
|
134
|
+
let r = I(e);
|
|
135
|
+
P(() => {
|
|
136
136
|
r.current = e;
|
|
137
137
|
});
|
|
138
|
-
let [i, a] =
|
|
139
|
-
return
|
|
138
|
+
let [i, a] = L(null), [o, s] = L(!1);
|
|
139
|
+
return P(() => {
|
|
140
140
|
let e = null;
|
|
141
141
|
try {
|
|
142
142
|
let n = t.current?.getBoundingClientRect(), i = n != null && n.width > 0 && n.height > 0 ? {
|
|
@@ -162,7 +162,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
162
162
|
return () => {
|
|
163
163
|
e?.close().catch((e) => console.error("[useMcpAppBridge] Error closing AppBridge:", e));
|
|
164
164
|
};
|
|
165
|
-
}, [t]),
|
|
165
|
+
}, [t]), P(() => {
|
|
166
166
|
i != null && i.transport != null && n != null && i.setHostContext(n);
|
|
167
167
|
}, [i, n]), {
|
|
168
168
|
appBridge: i,
|
|
@@ -176,8 +176,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
176
176
|
statusDetail: "_statusDetail_iea4a_38",
|
|
177
177
|
errorIcon: "_errorIcon_iea4a_42"
|
|
178
178
|
}, we = ({ content: e, errorLabel: t = "Failed to load app", onAppInfo: n }) => {
|
|
179
|
-
let [r, i] =
|
|
180
|
-
|
|
179
|
+
let [r, i] = L("loading"), [a, o] = L(), { html: s, sandboxUrl: c, toolInput: l, toolResult: u, hostContext: d } = e, f = F(() => ({ url: new URL(c) }), [c]), p = d?.displayMode === "fullscreen", m = I(null), [h, _] = L();
|
|
180
|
+
P(() => {
|
|
181
181
|
let e = m.current;
|
|
182
182
|
if (!e) return;
|
|
183
183
|
let t = new ResizeObserver(([e]) => {
|
|
@@ -190,7 +190,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
190
190
|
});
|
|
191
191
|
return t.observe(e), () => t.disconnect();
|
|
192
192
|
}, []);
|
|
193
|
-
let { appBridge: v, hasFailed: y } = Ce(e, m,
|
|
193
|
+
let { appBridge: v, hasFailed: y } = Ce(e, m, F(() => d == null || h == null ? d : {
|
|
194
194
|
...d,
|
|
195
195
|
containerDimensions: h
|
|
196
196
|
}, [d, h])), b = y || r === "error";
|
|
@@ -362,10 +362,10 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
}, Oe = class extends Error {}, ke = ({ content: t, fileName: n, loadErrorLabel: i, formulaLabel: a, formulaLabelClassName: o, highlightsLabel: s = "Cited locations", highlightNavigatedLabel: c = "Scrolled to the cited location" }) => {
|
|
365
|
-
let l =
|
|
365
|
+
let l = I(null), [u, d] = L(!0), [f, p] = L(!1), [m, h] = L(""), [_, v] = L([]), [y, b] = L(!1), { highlights: x, selectedHighlightId: C } = t, w = x != null && x.length > 0, T = I(void 0), O = I(x);
|
|
366
366
|
O.current = x;
|
|
367
|
-
let k =
|
|
368
|
-
return
|
|
367
|
+
let k = I(void 0);
|
|
368
|
+
return P(() => {
|
|
369
369
|
let e = l.current;
|
|
370
370
|
if (e == null) return;
|
|
371
371
|
let n, r, i = !1, a, o = () => i;
|
|
@@ -426,9 +426,9 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
426
426
|
t.format,
|
|
427
427
|
t.url,
|
|
428
428
|
w
|
|
429
|
-
]),
|
|
429
|
+
]), P(() => {
|
|
430
430
|
k.current?.();
|
|
431
|
-
}, [x]),
|
|
431
|
+
}, [x]), P(() => {
|
|
432
432
|
b(!1);
|
|
433
433
|
let t = T.current;
|
|
434
434
|
if (t == null || u) return;
|
|
@@ -521,8 +521,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
521
521
|
statusLabel: "_statusLabel_12637_5",
|
|
522
522
|
errorIcon: "_errorIcon_12637_9"
|
|
523
523
|
}, je = ({ content: e, loadingLabel: t, errorLabel: n = "Failed to load visualizer", frameTitle: r, colors: a }) => {
|
|
524
|
-
let o =
|
|
525
|
-
return f.current = e,
|
|
524
|
+
let o = I(null), [s, c] = L("loading"), { url: l, visualizerName: u, requestTimeout: d } = e, f = I(e);
|
|
525
|
+
return f.current = e, P(() => {
|
|
526
526
|
let e = o.current;
|
|
527
527
|
if (!e) return;
|
|
528
528
|
c("loading");
|
|
@@ -559,7 +559,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
559
559
|
l,
|
|
560
560
|
u,
|
|
561
561
|
d
|
|
562
|
-
]),
|
|
562
|
+
]), P(() => {
|
|
563
563
|
let e = r ?? u.trim();
|
|
564
564
|
e !== "" && o.current?.querySelector("iframe")?.setAttribute("title", e);
|
|
565
565
|
}, [
|
|
@@ -617,8 +617,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
617
617
|
jsonCollapseIcon: "_jsonCollapseIcon_13ogb_67",
|
|
618
618
|
jsonCollapsedContent: "_jsonCollapsedContent_13ogb_84"
|
|
619
619
|
}, Me = () => j(async () => ({ default: (await import("./PdfContent-BoAtghsO.js")).PdfContent })), Ne = ({ url: e, fileName: t, loadErrorLabel: n }) => {
|
|
620
|
-
let [r, i] =
|
|
621
|
-
return
|
|
620
|
+
let [r, i] = L(!1);
|
|
621
|
+
return P(() => {
|
|
622
622
|
i(!1);
|
|
623
623
|
}, [e]), r ? /* @__PURE__ */ B("div", {
|
|
624
624
|
className: "flex flex-col items-center gap-2",
|
|
@@ -640,10 +640,10 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
640
640
|
i.PlainText,
|
|
641
641
|
i.Code,
|
|
642
642
|
i.Ooxml
|
|
643
|
-
]), Fe = M(({ content: e, isLoading: t = !1, fileName: r, isHtmlSourceView: a = !1, labels: { unsupportedLabel: o = "Preview is not supported for this file", loadErrorLabel: c = "Failed to load file", forbiddenErrorLabel: l = "You don't have permission to access this file", visualizerErrorLabel: d, htmlFrameBlockedLabel: f = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: h = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: C, pdfContentRetryLabel: w, xlsxFormulaLabel: T = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: k, codeContentRetryLabel: ee, tableCopyLabel: te, tableCopiedLabel: ne, tableDownloadCsvLabel: re, ooxmlHighlightsLabel: ae, ooxmlHighlightNavigatedLabel: oe } = {}, styles: A, codeBlockTheme: j, tableDownloadFilename: M, loadPdf:
|
|
644
|
-
let { colors: V, typography: H, bodyClassName: ue, cssVars: de } = A ?? {}, [fe, pe] =
|
|
643
|
+
]), Fe = M(({ content: e, isLoading: t = !1, fileName: r, isHtmlSourceView: a = !1, labels: { unsupportedLabel: o = "Preview is not supported for this file", loadErrorLabel: c = "Failed to load file", forbiddenErrorLabel: l = "You don't have permission to access this file", visualizerErrorLabel: d, htmlFrameBlockedLabel: f = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: h = "Open in new tab", pdfThumbnailsLabel: _, pdfShowThumbnailsLabel: v, pdfHideThumbnailsLabel: y, pdfPageNumberLabel: b, pdfContentLoadingLabel: x, pdfContentErrorLabel: C, pdfContentRetryLabel: w, xlsxFormulaLabel: T = "Formula", codeContentLoadingLabel: O, codeContentErrorLabel: k, codeContentRetryLabel: ee, tableCopyLabel: te, tableCopiedLabel: ne, tableDownloadCsvLabel: re, ooxmlHighlightsLabel: ae, ooxmlHighlightNavigatedLabel: oe } = {}, styles: A, codeBlockTheme: j, tableDownloadFilename: M, loadPdf: se, hidePdfToolbar: P = !1, configurePdfWorker: I, onAppInfo: le }) => {
|
|
644
|
+
let { colors: V, typography: H, bodyClassName: ue, cssVars: de } = A ?? {}, [fe, pe] = L(0), me = F(Me, [fe]), he = N(() => {
|
|
645
645
|
pe((e) => e + 1);
|
|
646
|
-
}, []), U = H?.fontClassName != null, _e =
|
|
646
|
+
}, []), U = H?.fontClassName != null, _e = F(() => ({
|
|
647
647
|
...m({
|
|
648
648
|
"--ac-text": V?.text,
|
|
649
649
|
"--ac-status-text": V?.statusText,
|
|
@@ -675,7 +675,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
675
675
|
"--ac-letter-spacing": U ? void 0 : H?.letterSpacing
|
|
676
676
|
}),
|
|
677
677
|
...de
|
|
678
|
-
}), [A]), ye =
|
|
678
|
+
}), [A]), ye = F(() => {
|
|
679
679
|
switch (e.type) {
|
|
680
680
|
case i.Image:
|
|
681
681
|
case i.Audio:
|
|
@@ -693,7 +693,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
693
693
|
case i.MarkdownTable: return "flex h-full min-h-0 flex-col overflow-hidden p-4";
|
|
694
694
|
default: return "h-full overflow-auto p-4";
|
|
695
695
|
}
|
|
696
|
-
}, [e.type]), be =
|
|
696
|
+
}, [e.type]), be = F(() => {
|
|
697
697
|
switch (e.type) {
|
|
698
698
|
case i.PlainText: return /* @__PURE__ */ z("pre", {
|
|
699
699
|
className: g("whitespace-pre-wrap break-words", K.body, H?.fontClassName),
|
|
@@ -743,7 +743,7 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
743
743
|
className: "h-full overflow-auto",
|
|
744
744
|
children: /* @__PURE__ */ z("div", {
|
|
745
745
|
className: g("m-3 overflow-auto rounded-md border", K.jsonWrapper),
|
|
746
|
-
children: /* @__PURE__ */ z(
|
|
746
|
+
children: /* @__PURE__ */ z(R, {
|
|
747
747
|
data: e.value,
|
|
748
748
|
style: {
|
|
749
749
|
container: g("whitespace-pre-wrap break-words p-2", H?.jsonClassName ?? "dial-code-text"),
|
|
@@ -798,9 +798,9 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
798
798
|
highlights: e.highlights ?? [],
|
|
799
799
|
selectedHighlightId: e.selectedHighlightId,
|
|
800
800
|
selectedPageNumber: e.page,
|
|
801
|
-
loadPdf:
|
|
802
|
-
hideHeader:
|
|
803
|
-
configurePdfWorker:
|
|
801
|
+
loadPdf: se,
|
|
802
|
+
hideHeader: P,
|
|
803
|
+
configurePdfWorker: I,
|
|
804
804
|
labels: {
|
|
805
805
|
thumbnailsLabel: _,
|
|
806
806
|
showThumbnailsLabel: v,
|
|
@@ -864,9 +864,9 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
864
864
|
h,
|
|
865
865
|
a,
|
|
866
866
|
M,
|
|
867
|
+
se,
|
|
867
868
|
P,
|
|
868
|
-
|
|
869
|
-
L,
|
|
869
|
+
I,
|
|
870
870
|
le,
|
|
871
871
|
_,
|
|
872
872
|
v,
|
|
@@ -896,24 +896,24 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
896
896
|
}), Ie = {
|
|
897
897
|
mcpAppDivider: "_mcpAppDivider_1jh5p_1",
|
|
898
898
|
mcpAppVersion: "_mcpAppVersion_1jh5p_5"
|
|
899
|
-
}, Le = 2e3, Re = M(({ isOpen: e, isLoading: t = !1, onClose: n, content: r, fileName: a, labels: { ariaLabel: s, closeLabel: c = "Close", resizeLabel: l = "Resize panel", downloadLabel: u = "Download", copyTextLabel: d = "Copy text", copiedTextLabel: f = "Copied!", copyMarkdownLabel: p = "Copy as Markdown", copiedMarkdownLabel: h = "Copied!", copyJsonLabel: _ = "Copy as JSON", copiedJsonLabel: v = "Copied!", visualizerErrorLabel: C, unsupportedLabel: T = "Preview is not supported for this file", loadErrorLabel: E = "Failed to load file", forbiddenErrorLabel: D = "You don't have permission to access this file", htmlFrameBlockedLabel: O = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: ie = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: M = "Reload", pdfThumbnailsLabel:
|
|
900
|
-
let [Me, Ne] =
|
|
899
|
+
}, Le = 2e3, Re = M(({ isOpen: e, isLoading: t = !1, onClose: n, content: r, fileName: a, labels: { ariaLabel: s, closeLabel: c = "Close", resizeLabel: l = "Resize panel", downloadLabel: u = "Download", copyTextLabel: d = "Copy text", copiedTextLabel: f = "Copied!", copyMarkdownLabel: p = "Copy as Markdown", copiedMarkdownLabel: h = "Copied!", copyJsonLabel: _ = "Copy as JSON", copiedJsonLabel: v = "Copied!", visualizerErrorLabel: C, unsupportedLabel: T = "Preview is not supported for this file", loadErrorLabel: E = "Failed to load file", forbiddenErrorLabel: D = "You don't have permission to access this file", htmlFrameBlockedLabel: O = "This page cannot be displayed in preview", htmlOpenInNewTabLabel: ie = "Open in new tab", htmlViewSourceLabel: A = "View source", htmlViewRenderedLabel: j = "View rendered", mcpAppReloadLabel: M = "Reload", pdfThumbnailsLabel: se, pdfShowThumbnailsLabel: R, pdfHideThumbnailsLabel: ce, pdfPageNumberLabel: V, pdfContentLoadingLabel: H, pdfContentErrorLabel: ue, pdfContentRetryLabel: de, xlsxFormulaLabel: fe, codeContentLoadingLabel: me, codeContentErrorLabel: he, codeContentRetryLabel: U, tableCopyLabel: ge, tableCopiedLabel: _e, tableDownloadCsvLabel: ve, ooxmlHighlightsLabel: ye, ooxmlHighlightNavigatedLabel: be }, onDownload: xe, onCopyText: Se, onCopyMarkdown: Ce, onCopyJson: W, tableDownloadFilename: we, isMobile: G = !1, defaultWidth: Te, minWidth: Ee = 600, maxWidth: De = 1500, onResizeStop: Oe, styles: ke, codeBlockTheme: Ae, loadPdf: je, configurePdfWorker: K }) => {
|
|
900
|
+
let [Me, Ne] = L(!1), [Pe, Re] = L(!1), [ze, q] = L(!1), [J, Be] = L(!1), [Ve, He] = L(void 0), Y = I(null), X = I(null), Z = I(null), Ue = N(() => {
|
|
901
901
|
Se?.(), Y.current != null && clearTimeout(Y.current), Ne(!0), Y.current = setTimeout(() => Ne(!1), Le);
|
|
902
902
|
}, [Se]), We = N(() => {
|
|
903
903
|
Ce?.(), X.current != null && clearTimeout(X.current), Re(!0), X.current = setTimeout(() => Re(!1), Le);
|
|
904
904
|
}, [Ce]), Ge = N(() => {
|
|
905
905
|
W?.(), Z.current != null && clearTimeout(Z.current), q(!0), Z.current = setTimeout(() => q(!1), Le);
|
|
906
906
|
}, [W]);
|
|
907
|
-
|
|
907
|
+
P(() => () => {
|
|
908
908
|
Y.current != null && clearTimeout(Y.current), X.current != null && clearTimeout(X.current), Z.current != null && clearTimeout(Z.current);
|
|
909
909
|
}, []);
|
|
910
910
|
let Ke = N(() => {
|
|
911
911
|
Be((e) => !e);
|
|
912
912
|
}, []);
|
|
913
|
-
|
|
913
|
+
P(() => {
|
|
914
914
|
Be(!1), He(void 0);
|
|
915
915
|
}, [r]);
|
|
916
|
-
let { className: Q, panelStyles: qe, ...Je } = ke ?? {}, { colors: $, typography: Ye } = Je, Xe =
|
|
916
|
+
let { className: Q, panelStyles: qe, ...Je } = ke ?? {}, { colors: $, typography: Ye } = Je, Xe = F(() => m({
|
|
917
917
|
"--ac-mcp-app-divider": $?.mcpAppDividerColor,
|
|
918
918
|
"--ac-mcp-app-version": $?.mcpAppVersionColor
|
|
919
919
|
}), [$?.mcpAppDividerColor, $?.mcpAppVersionColor]), Ze = r.type === i.McpApp && Ve != null ? /* @__PURE__ */ B("span", {
|
|
@@ -1027,8 +1027,8 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
1027
1027
|
visualizerErrorLabel: C,
|
|
1028
1028
|
htmlFrameBlockedLabel: O,
|
|
1029
1029
|
htmlOpenInNewTabLabel: ie,
|
|
1030
|
-
pdfThumbnailsLabel:
|
|
1031
|
-
pdfShowThumbnailsLabel:
|
|
1030
|
+
pdfThumbnailsLabel: se,
|
|
1031
|
+
pdfShowThumbnailsLabel: R,
|
|
1032
1032
|
pdfHideThumbnailsLabel: ce,
|
|
1033
1033
|
pdfPageNumberLabel: V,
|
|
1034
1034
|
pdfContentLoadingLabel: H,
|
|
@@ -1157,18 +1157,18 @@ var pe = { panel: "dial-attachment-canvas-panel" }, me = {
|
|
|
1157
1157
|
}, Ze = A(void 0);
|
|
1158
1158
|
Ze.displayName = "AttachmentCanvasContext";
|
|
1159
1159
|
var Qe = ({ children: e }) => {
|
|
1160
|
-
let [t, n] =
|
|
1160
|
+
let [t, n] = L(!1), [r, i] = L(!1), [a, o] = L(Xe), [s, c] = L(void 0), [l, u] = L(void 0), d = N((e, t) => {
|
|
1161
1161
|
c(e), u(t), i(!0), n(!0);
|
|
1162
1162
|
}, []), f = N((e, t, r) => {
|
|
1163
1163
|
o(e), c(t), u(r), i(!1), n(!0);
|
|
1164
1164
|
}, []), p = N(() => {
|
|
1165
1165
|
o(Xe), n(!1), i(!1), u(void 0);
|
|
1166
1166
|
}, []);
|
|
1167
|
-
return
|
|
1167
|
+
return P(() => () => {
|
|
1168
1168
|
let e = $(a);
|
|
1169
1169
|
e != null && URL.revokeObjectURL(e);
|
|
1170
1170
|
}, [a]), /* @__PURE__ */ z(Ze.Provider, {
|
|
1171
|
-
value:
|
|
1171
|
+
value: F(() => ({
|
|
1172
1172
|
isOpen: t,
|
|
1173
1173
|
isLoading: r,
|
|
1174
1174
|
content: a,
|
|
@@ -1190,69 +1190,70 @@ var Qe = ({ children: e }) => {
|
|
|
1190
1190
|
children: e
|
|
1191
1191
|
});
|
|
1192
1192
|
}, $e = () => {
|
|
1193
|
-
let e =
|
|
1193
|
+
let e = se(Ze);
|
|
1194
1194
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
1195
1195
|
return e;
|
|
1196
|
-
}, et = M(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s,
|
|
1197
|
-
let { ariaLabel:
|
|
1198
|
-
a(R,
|
|
1199
|
-
}, [R,
|
|
1196
|
+
}, et = M(({ labels: e, isMobile: t = !1, defaultWidth: n, maxWidth: r, codeBlockTheme: o, tableDownloadFilename: s, loadPdf: c, configurePdfWorker: l }) => {
|
|
1197
|
+
let { ariaLabel: u = "Attachment preview", closeLabel: d = "Close", downloadLabel: f = "Download", unsupportedLabel: p = "Preview is not supported for this file", loadErrorLabel: m = "Failed to load file", forbiddenErrorLabel: g = "You don't have permission to access this file", copyTextLabel: _, copiedTextLabel: v, copyMarkdownLabel: y, copiedMarkdownLabel: b, copyJsonLabel: x, copiedJsonLabel: S, htmlFrameBlockedLabel: C, htmlOpenInNewTabLabel: w, htmlViewSourceLabel: T, htmlViewRenderedLabel: E, pdfThumbnailsLabel: D, pdfShowThumbnailsLabel: O, pdfHideThumbnailsLabel: k, pdfPageNumberLabel: ee, pdfContentLoadingLabel: te, pdfContentErrorLabel: ne, pdfContentRetryLabel: re, xlsxFormulaLabel: ie, codeContentLoadingLabel: ae, codeContentErrorLabel: oe, codeContentRetryLabel: A, tableCopyLabel: j, tableCopiedLabel: M, tableDownloadCsvLabel: se, ooxmlHighlightsLabel: P, ooxmlHighlightNavigatedLabel: F } = e ?? {}, { isOpen: I, isLoading: L, content: R, fileName: ce, closeCanvas: le } = $e(), B = N(() => {
|
|
1198
|
+
a(R, ce);
|
|
1199
|
+
}, [R, ce]), V = N(() => {
|
|
1200
1200
|
(R.type === i.PlainText || R.type === i.Code) && h(R.text);
|
|
1201
|
-
}, [R]), V = N(() => {
|
|
1202
|
-
R.type === i.Markdown && h(R.text);
|
|
1203
1201
|
}, [R]), H = N(() => {
|
|
1202
|
+
R.type === i.Markdown && h(R.text);
|
|
1203
|
+
}, [R]), ue = N(() => {
|
|
1204
1204
|
R.type === i.Json && h(JSON.stringify(R.value, null, 2));
|
|
1205
1205
|
}, [R]);
|
|
1206
1206
|
return /* @__PURE__ */ z(Re, {
|
|
1207
1207
|
isOpen: I,
|
|
1208
1208
|
isLoading: L,
|
|
1209
|
-
onClose:
|
|
1209
|
+
onClose: le,
|
|
1210
1210
|
content: R,
|
|
1211
|
-
fileName:
|
|
1211
|
+
fileName: ce,
|
|
1212
1212
|
labels: {
|
|
1213
|
-
ariaLabel:
|
|
1214
|
-
closeLabel:
|
|
1215
|
-
downloadLabel:
|
|
1216
|
-
copyTextLabel:
|
|
1217
|
-
copiedTextLabel:
|
|
1218
|
-
copyMarkdownLabel:
|
|
1219
|
-
copiedMarkdownLabel:
|
|
1220
|
-
copyJsonLabel:
|
|
1221
|
-
copiedJsonLabel:
|
|
1222
|
-
unsupportedLabel:
|
|
1223
|
-
loadErrorLabel:
|
|
1224
|
-
forbiddenErrorLabel:
|
|
1225
|
-
htmlFrameBlockedLabel:
|
|
1226
|
-
htmlOpenInNewTabLabel:
|
|
1227
|
-
htmlViewSourceLabel:
|
|
1228
|
-
htmlViewRenderedLabel:
|
|
1229
|
-
pdfThumbnailsLabel:
|
|
1230
|
-
pdfShowThumbnailsLabel:
|
|
1231
|
-
pdfHideThumbnailsLabel:
|
|
1232
|
-
pdfPageNumberLabel:
|
|
1233
|
-
pdfContentLoadingLabel:
|
|
1234
|
-
pdfContentErrorLabel:
|
|
1235
|
-
pdfContentRetryLabel:
|
|
1236
|
-
xlsxFormulaLabel:
|
|
1237
|
-
codeContentLoadingLabel:
|
|
1238
|
-
codeContentErrorLabel:
|
|
1239
|
-
codeContentRetryLabel:
|
|
1240
|
-
tableCopyLabel:
|
|
1241
|
-
tableCopiedLabel:
|
|
1242
|
-
tableDownloadCsvLabel:
|
|
1213
|
+
ariaLabel: u,
|
|
1214
|
+
closeLabel: d,
|
|
1215
|
+
downloadLabel: f,
|
|
1216
|
+
copyTextLabel: _,
|
|
1217
|
+
copiedTextLabel: v,
|
|
1218
|
+
copyMarkdownLabel: y,
|
|
1219
|
+
copiedMarkdownLabel: b,
|
|
1220
|
+
copyJsonLabel: x,
|
|
1221
|
+
copiedJsonLabel: S,
|
|
1222
|
+
unsupportedLabel: p,
|
|
1223
|
+
loadErrorLabel: m,
|
|
1224
|
+
forbiddenErrorLabel: g,
|
|
1225
|
+
htmlFrameBlockedLabel: C,
|
|
1226
|
+
htmlOpenInNewTabLabel: w,
|
|
1227
|
+
htmlViewSourceLabel: T,
|
|
1228
|
+
htmlViewRenderedLabel: E,
|
|
1229
|
+
pdfThumbnailsLabel: D,
|
|
1230
|
+
pdfShowThumbnailsLabel: O,
|
|
1231
|
+
pdfHideThumbnailsLabel: k,
|
|
1232
|
+
pdfPageNumberLabel: ee,
|
|
1233
|
+
pdfContentLoadingLabel: te,
|
|
1234
|
+
pdfContentErrorLabel: ne,
|
|
1235
|
+
pdfContentRetryLabel: re,
|
|
1236
|
+
xlsxFormulaLabel: ie,
|
|
1237
|
+
codeContentLoadingLabel: ae,
|
|
1238
|
+
codeContentErrorLabel: oe,
|
|
1239
|
+
codeContentRetryLabel: A,
|
|
1240
|
+
tableCopyLabel: j,
|
|
1241
|
+
tableCopiedLabel: M,
|
|
1242
|
+
tableDownloadCsvLabel: se,
|
|
1243
1243
|
ooxmlHighlightsLabel: P,
|
|
1244
1244
|
ooxmlHighlightNavigatedLabel: F
|
|
1245
1245
|
},
|
|
1246
|
-
onDownload:
|
|
1247
|
-
onCopyText: R.type === i.PlainText || R.type === i.Code ?
|
|
1248
|
-
onCopyMarkdown: R.type === i.Markdown ?
|
|
1249
|
-
onCopyJson: R.type === i.Json ?
|
|
1246
|
+
onDownload: B,
|
|
1247
|
+
onCopyText: R.type === i.PlainText || R.type === i.Code ? V : void 0,
|
|
1248
|
+
onCopyMarkdown: R.type === i.Markdown ? H : void 0,
|
|
1249
|
+
onCopyJson: R.type === i.Json ? ue : void 0,
|
|
1250
1250
|
tableDownloadFilename: s,
|
|
1251
1251
|
isMobile: t,
|
|
1252
1252
|
defaultWidth: n,
|
|
1253
1253
|
maxWidth: r,
|
|
1254
1254
|
codeBlockTheme: o,
|
|
1255
|
-
configurePdfWorker:
|
|
1255
|
+
configurePdfWorker: l,
|
|
1256
|
+
loadPdf: c
|
|
1256
1257
|
});
|
|
1257
1258
|
}), tt = {
|
|
1258
1259
|
frame: "_frame_g47g7_1",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-attachment-canvas",
|
|
3
3
|
"description": "Canvas viewer for rendering attachment content — images, PDFs, Office documents, CSV, JSON, markdown, and plain text",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.116",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
30
30
|
"@modelcontextprotocol/ext-apps": "1.7.5",
|
|
31
31
|
"pdfjs-dist": "^5.4.149",
|
|
32
|
-
"@epam/ai-dial-sidebar": "1.2.0-dev.
|
|
32
|
+
"@epam/ai-dial-sidebar": "1.2.0-dev.116"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
35
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.116",
|
|
36
36
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.15",
|
|
37
37
|
"react": "^19.2.8"
|
|
38
38
|
},
|