ssovee-os-web-ui 0.1.105 → 0.1.107
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 +14 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +4 -3
- package/dist/index.js +14 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -3
package/dist/index.cjs
CHANGED
|
@@ -7,9 +7,7 @@ var Editor = require('@monaco-editor/react');
|
|
|
7
7
|
var react$1 = require('@tiptap/react');
|
|
8
8
|
var StarterKit = require('@tiptap/starter-kit');
|
|
9
9
|
var uaParserJs = require('ua-parser-js');
|
|
10
|
-
var reactPdf = require('react-pdf');
|
|
11
10
|
|
|
12
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
13
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
12
|
|
|
15
13
|
function _interopNamespace(e) {
|
|
@@ -2320,10 +2318,6 @@ var Tabs = ({
|
|
|
2320
2318
|
] });
|
|
2321
2319
|
};
|
|
2322
2320
|
var Tabs_default = Tabs;
|
|
2323
|
-
reactPdf.pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
|
2324
|
-
"pdfjs-dist/build/pdf.worker.min.mjs",
|
|
2325
|
-
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))
|
|
2326
|
-
).toString();
|
|
2327
2321
|
var imageExtensions = /\.(avif|bmp|gif|heic|jpe?g|png|svg|tiff?|webp)$/i;
|
|
2328
2322
|
var textExtensions = /\.(c|cc|conf|cpp|css|csv|env|h|hpp|html?|ini|java|js|jsx|log|md|mjs|php|py|rb|rs|sh|sql|swift|ts|tsx|txt|xml|yaml|yml)$/i;
|
|
2329
2323
|
var audioExtensions = /\.(aac|flac|m4a|mp3|ogg|wav|weba)$/i;
|
|
@@ -2389,55 +2383,29 @@ var decodeBase64 = (base64) => {
|
|
|
2389
2383
|
const bytes = Uint8Array.from(atob(value), (character) => character.charCodeAt(0));
|
|
2390
2384
|
return new TextDecoder().decode(bytes);
|
|
2391
2385
|
};
|
|
2392
|
-
var
|
|
2386
|
+
var toBlobUrl = (base64, fileName) => {
|
|
2393
2387
|
const value = base64.includes(",") ? base64.slice(base64.indexOf(",") + 1) : base64;
|
|
2394
|
-
|
|
2388
|
+
const bytes = Uint8Array.from(atob(value), (character) => character.charCodeAt(0));
|
|
2389
|
+
return URL.createObjectURL(new Blob([bytes], { type: getMimeType(fileName) }));
|
|
2395
2390
|
};
|
|
2396
2391
|
var PreviewComponent = ({ fileName, base64, className }) => {
|
|
2397
2392
|
const previewType = getPreviewType(fileName);
|
|
2398
2393
|
const dataUrl = toDataUrl(base64, fileName);
|
|
2399
|
-
const [
|
|
2400
|
-
|
|
2394
|
+
const [pdfUrl, setPdfUrl] = React24.useState();
|
|
2395
|
+
React24.useEffect(() => {
|
|
2396
|
+
if (previewType !== "pdf") {
|
|
2397
|
+
setPdfUrl(void 0);
|
|
2398
|
+
return;
|
|
2399
|
+
}
|
|
2400
|
+
const objectUrl = toBlobUrl(base64, fileName);
|
|
2401
|
+
setPdfUrl(objectUrl);
|
|
2402
|
+
return () => URL.revokeObjectURL(objectUrl);
|
|
2403
|
+
}, [base64, fileName, previewType]);
|
|
2401
2404
|
if (previewType === "image") {
|
|
2402
2405
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex h-full min-h-48 w-full items-center justify-center overflow-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: dataUrl, alt: fileName, className: "max-h-full max-w-full object-contain" }) });
|
|
2403
2406
|
}
|
|
2404
2407
|
if (previewType === "pdf") {
|
|
2405
|
-
return /* @__PURE__ */ jsxRuntime.jsx("
|
|
2406
|
-
"Unable to render ",
|
|
2407
|
-
fileName,
|
|
2408
|
-
". The PDF may be invalid or corrupted."
|
|
2409
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2410
|
-
reactPdf.Document,
|
|
2411
|
-
{
|
|
2412
|
-
file: { data: toPdfBytes(base64) },
|
|
2413
|
-
loading: /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
2414
|
-
"Loading ",
|
|
2415
|
-
fileName,
|
|
2416
|
-
"..."
|
|
2417
|
-
] }),
|
|
2418
|
-
error: /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
2419
|
-
"Unable to render ",
|
|
2420
|
-
fileName,
|
|
2421
|
-
". The PDF may be invalid or corrupted."
|
|
2422
|
-
] }),
|
|
2423
|
-
onLoadSuccess: ({ numPages }) => {
|
|
2424
|
-
setPageCount(numPages);
|
|
2425
|
-
setPdfError(false);
|
|
2426
|
-
},
|
|
2427
|
-
onLoadError: () => setPdfError(true),
|
|
2428
|
-
className: "flex w-full flex-col items-center",
|
|
2429
|
-
children: pageCount !== null && Array.from({ length: pageCount }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2430
|
-
reactPdf.Page,
|
|
2431
|
-
{
|
|
2432
|
-
pageNumber: index + 1,
|
|
2433
|
-
renderAnnotationLayer: false,
|
|
2434
|
-
renderTextLayer: false,
|
|
2435
|
-
className: "mb-3 max-w-full shadow-sm"
|
|
2436
|
-
},
|
|
2437
|
-
`${fileName}-${index + 1}`
|
|
2438
|
-
))
|
|
2439
|
-
}
|
|
2440
|
-
) });
|
|
2408
|
+
return pdfUrl ? /* @__PURE__ */ jsxRuntime.jsx("iframe", { title: fileName, src: pdfUrl, className: cn("h-full min-h-96 w-full border-0", className) }) : null;
|
|
2441
2409
|
}
|
|
2442
2410
|
if (previewType === "audio") {
|
|
2443
2411
|
return /* @__PURE__ */ jsxRuntime.jsx("audio", { controls: true, src: dataUrl, className: cn("w-full", className) });
|