@epam/ai-dial-attachment-canvas 1.0.0-dev.484 → 1.0.0-dev.489
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/context/AttachmentCanvasContext.d.ts.map +1 -1
- package/index.js +20 -15
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentCanvasContext.d.ts","sourceRoot":"","sources":["../../src/context/AttachmentCanvasContext.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AttachmentCanvasContext.d.ts","sourceRoot":"","sources":["../../src/context/AttachmentCanvasContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AA0B3E,sDAAsD;AACtD,MAAM,WAAW,4BAA4B;IAC3C,kDAAkD;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,OAAO,EAAE,uBAAuB,CAAC;IACjC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,qEAAqE;IACrE,UAAU,EAAE,CAAC,OAAO,EAAE,uBAAuB,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1E,wBAAwB;IACxB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAOD,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,GAAI,eAEtC;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAqCA,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB,QAAO,4BAQtC,CAAC"}
|
package/index.js
CHANGED
|
@@ -17188,7 +17188,7 @@ var To = fo.map((e) => ({
|
|
|
17188
17188
|
onResizeStop: he,
|
|
17189
17189
|
styles: {
|
|
17190
17190
|
...je,
|
|
17191
|
-
className: a(t ? "mobile:w-full" : "w-0", _e, je?.className)
|
|
17191
|
+
className: a(t ? "mobile:w-full mobile:max-w-full" : "w-0", _e, je?.className)
|
|
17192
17192
|
},
|
|
17193
17193
|
rightActions: B || V || H || Ne ? /* @__PURE__ */ N(le, { children: [
|
|
17194
17194
|
B && /* @__PURE__ */ M(h, {
|
|
@@ -17237,13 +17237,18 @@ var To = fo.map((e) => ({
|
|
|
17237
17237
|
}), Mo = {
|
|
17238
17238
|
type: P.PlainText,
|
|
17239
17239
|
text: ""
|
|
17240
|
-
}, No =
|
|
17241
|
-
|
|
17242
|
-
|
|
17240
|
+
}, No = (e) => {
|
|
17241
|
+
if (!(e.type !== P.Image && e.type !== P.Pdf)) return e.url.startsWith("blob:") ? e.url : void 0;
|
|
17242
|
+
}, Po = D(void 0);
|
|
17243
|
+
Po.displayName = "AttachmentCanvasContext";
|
|
17244
|
+
var Fo = ({ children: e }) => {
|
|
17243
17245
|
let [t, n] = j(!1), [r, i] = j(Mo), [a, o] = j(void 0), s = k((e, t) => {
|
|
17244
17246
|
i(e), o(t), n(!0);
|
|
17245
17247
|
}, []), c = k(() => n(!1), []);
|
|
17246
|
-
return
|
|
17248
|
+
return A(() => () => {
|
|
17249
|
+
let e = No(r);
|
|
17250
|
+
e != null && URL.revokeObjectURL(e);
|
|
17251
|
+
}, [r]), /* @__PURE__ */ M(Po.Provider, {
|
|
17247
17252
|
value: ae(() => ({
|
|
17248
17253
|
isOpen: t,
|
|
17249
17254
|
content: r,
|
|
@@ -17259,12 +17264,12 @@ var Po = ({ children: e }) => {
|
|
|
17259
17264
|
]),
|
|
17260
17265
|
children: e
|
|
17261
17266
|
});
|
|
17262
|
-
},
|
|
17263
|
-
let e = ie(
|
|
17267
|
+
}, Io = () => {
|
|
17268
|
+
let e = ie(Po);
|
|
17264
17269
|
if (!e) throw Error("useAttachmentCanvas must be used within an AttachmentCanvasProvider");
|
|
17265
17270
|
return e;
|
|
17266
|
-
},
|
|
17267
|
-
let { isOpen: g, content: _, fileName: v, closeCanvas: y } =
|
|
17271
|
+
}, Lo = O(({ ariaLabel: e = "Attachment preview", closeLabel: t = "Close", downloadLabel: n = "Download", unsupportedLabel: r = "Preview is not supported for this file", loadErrorLabel: a = "Failed to load file", forbiddenErrorLabel: o = "You don't have permission to access this file", copyTextLabel: s, copiedTextLabel: c, copyMarkdownLabel: l, copiedMarkdownLabel: u, copyJsonLabel: d, copiedJsonLabel: f, isMobile: p = !1, defaultWidth: m, codeBlockTheme: h }) => {
|
|
17272
|
+
let { isOpen: g, content: _, fileName: v, closeCanvas: y } = Io(), b = k(() => {
|
|
17268
17273
|
pe(_, v);
|
|
17269
17274
|
}, [_, v]), x = k(() => {
|
|
17270
17275
|
_.type === P.PlainText && i(_.text);
|
|
@@ -17298,20 +17303,20 @@ var Po = ({ children: e }) => {
|
|
|
17298
17303
|
defaultWidth: m,
|
|
17299
17304
|
codeBlockTheme: h
|
|
17300
17305
|
});
|
|
17301
|
-
}),
|
|
17306
|
+
}), Ro = new Set(/* @__PURE__ */ "txt.md.markdown.json.jsonl.ndjson.xml.csv.tsv.yaml.yml.toml.ini.conf.cfg.html.htm.css.scss.sass.less.js.jsx.ts.tsx.mjs.cjs.mts.cts.py.rb.go.rs.java.kt.swift.c.h.cpp.cs.sh.bash.zsh.fish.ps1.log.env.gitignore.dockerfile.makefile.sql".split(".")), zo = (e) => {
|
|
17302
17307
|
let t = e.lastIndexOf(".");
|
|
17303
|
-
return t === -1 ? !1 :
|
|
17304
|
-
},
|
|
17308
|
+
return t === -1 ? !1 : Ro.has(e.slice(t + 1).toLowerCase());
|
|
17309
|
+
}, Bo = (e) => ({
|
|
17305
17310
|
type: P.Unsupported,
|
|
17306
17311
|
...e != null && { url: e }
|
|
17307
|
-
}),
|
|
17312
|
+
}), Vo = (e) => ({
|
|
17308
17313
|
type: P.Error,
|
|
17309
17314
|
errorType: ue.LoadFailed,
|
|
17310
17315
|
...e != null && { url: e }
|
|
17311
|
-
}),
|
|
17316
|
+
}), Ho = (e) => ({
|
|
17312
17317
|
type: P.Error,
|
|
17313
17318
|
errorType: ue.Forbidden,
|
|
17314
17319
|
...e != null && { url: e }
|
|
17315
17320
|
});
|
|
17316
17321
|
//#endregion
|
|
17317
|
-
export { jo as AttachmentCanvas,
|
|
17322
|
+
export { jo as AttachmentCanvas, Lo as AttachmentCanvasContainer, Fo as AttachmentCanvasProvider, P as AttachmentContentType, ue as AttachmentErrorType, Ho as createForbiddenCanvasContent, Vo as createLoadErrorCanvasContent, Bo as createUnsupportedCanvasContent, pe as downloadAttachmentContent, de as isDownloadable, zo as isTextPreviewable, Io as useAttachmentCanvas };
|
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, JSON, markdown, and plain text",
|
|
4
|
-
"version": "1.0.0-dev.
|
|
4
|
+
"version": "1.0.0-dev.489",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@epam/ai-dial-chat-shared": "1.0.0-dev.
|
|
21
|
-
"@epam/ai-dial-sidebar": "1.0.0-dev.
|
|
20
|
+
"@epam/ai-dial-chat-shared": "1.0.0-dev.489",
|
|
21
|
+
"@epam/ai-dial-sidebar": "1.0.0-dev.489",
|
|
22
22
|
"@epam/ai-dial-ui-kit": "0.12.0-dev.28",
|
|
23
23
|
"@epam/pdf-highlighter-kit": ">=0.0.14",
|
|
24
24
|
"@tabler/icons-react": "^3.44.0",
|