@factorialco/f0-react 4.44.0 → 4.46.0
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/ChatDocxThumbnail-B3DMs45n.js +48 -0
- package/dist/ChatPdfThumbnail-BFbYv0sb.js +38 -0
- package/dist/ChatSheetThumbnail-BvnxT-4A.js +38 -0
- package/dist/ChatTextThumbnail-yVt_iYi7.js +33 -0
- package/dist/{DocumentToolbar-D3GqxyBD.js → DocumentToolbar-BLcBoeNU.js} +5 -5
- package/dist/DocxViewer-C0K6oFym.js +68 -0
- package/dist/{F0AiProcessingOverlay-rViVqtAb.js → F0AiProcessingOverlay-BZka5wSN.js} +713 -761
- package/dist/{F0CanvasPanel-VGTPb68G.js → F0CanvasPanel-BDwye32b.js} +10679 -10600
- package/dist/{LocationMap-CdKO0X5V.js → LocationMap-NloaE37G.js} +1 -1
- package/dist/Printer-B7iDPx2r.js +54 -0
- package/dist/SheetViewer-1AsPdzFt.js +108 -0
- package/dist/{TextViewer-Dn0MDAXs.js → TextViewer-Ba0xZQdy.js} +2 -2
- package/dist/_commonjs-dynamic-modules-BpilXLfW.js +6 -0
- package/dist/ai.d.ts +34 -1
- package/dist/ai.js +2 -2
- package/dist/component-status.js +1 -1
- package/dist/{DocxViewer-BIZmtyWY.js → docx-preview-CSg41tKY.js} +971 -1034
- package/dist/experimental.d.ts +31 -4
- package/dist/experimental.js +10210 -6404
- package/dist/f0.css +1 -1
- package/dist/f0.d.ts +74 -1
- package/dist/f0.js +65853 -299
- package/dist/i18n-provider-defaults.d.ts +4 -0
- package/dist/i18n-provider-defaults.js +5 -1
- package/dist/{index-DoDUaTro.js → index-3x-af82e.js} +14657 -14408
- package/dist/index-BuP079h-.js +545 -0
- package/dist/index.css +1 -1
- package/dist/index2.css +1 -0
- package/dist/pdfWorker-XwYoO_oV.js +13118 -0
- package/dist/pdfWorker.css +1 -0
- package/dist/sheetPreview-5qeAOp0W.js +35 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -1
- package/tailwind.config.ts +8 -0
- package/dist/SheetViewer-HsR5toIL.js +0 -137
- package/dist/f0-BaDuQbAV.js +0 -79441
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as n, useState as b, useEffect as g } from "react";
|
|
3
|
+
import { r as p } from "./docx-preview-CSg41tKY.js";
|
|
4
|
+
const x = ({
|
|
5
|
+
url: a,
|
|
6
|
+
width: s,
|
|
7
|
+
onError: o,
|
|
8
|
+
onRendered: f
|
|
9
|
+
}) => {
|
|
10
|
+
const l = n(null), [c, m] = b(null), u = n(o);
|
|
11
|
+
u.current = o;
|
|
12
|
+
const i = n(f);
|
|
13
|
+
return i.current = f, g(() => {
|
|
14
|
+
const t = l.current;
|
|
15
|
+
if (!t) return;
|
|
16
|
+
let r = !1;
|
|
17
|
+
return fetch(a).then((e) => {
|
|
18
|
+
if (!e.ok) throw new Error(`${e.status}`);
|
|
19
|
+
return e.blob();
|
|
20
|
+
}).then((e) => {
|
|
21
|
+
if (!r)
|
|
22
|
+
return p(e, t, void 0, {
|
|
23
|
+
inWrapper: !1,
|
|
24
|
+
breakPages: !1,
|
|
25
|
+
ignoreLastRenderedPageBreak: !0,
|
|
26
|
+
renderHeaders: !1,
|
|
27
|
+
renderFooters: !1
|
|
28
|
+
}).then(() => {
|
|
29
|
+
if (r) return;
|
|
30
|
+
const d = t.scrollWidth;
|
|
31
|
+
m(d > 0 ? Math.min(1, s / d) : 1), i.current();
|
|
32
|
+
});
|
|
33
|
+
}).catch(() => {
|
|
34
|
+
r || u.current();
|
|
35
|
+
}), () => {
|
|
36
|
+
r = !0;
|
|
37
|
+
};
|
|
38
|
+
}, [a, s]), /* @__PURE__ */ h("div", { className: "overflow-hidden bg-f1-background text-left", children: /* @__PURE__ */ h(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
ref: l,
|
|
42
|
+
style: c !== null ? { transform: `scale(${c})`, transformOrigin: "top left" } : void 0
|
|
43
|
+
}
|
|
44
|
+
) });
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
x as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { D as l, P as d, e as s } from "./pdfWorker-XwYoO_oV.js";
|
|
3
|
+
s();
|
|
4
|
+
const f = ({
|
|
5
|
+
url: n,
|
|
6
|
+
width: o,
|
|
7
|
+
onError: e,
|
|
8
|
+
onRendered: a
|
|
9
|
+
}) => (
|
|
10
|
+
// No inner loading skeletons: the card keeps its own skeleton UNDER this
|
|
11
|
+
// layer and fades the snapshot in over it once the page paints.
|
|
12
|
+
/* @__PURE__ */ r(
|
|
13
|
+
l,
|
|
14
|
+
{
|
|
15
|
+
file: n,
|
|
16
|
+
loading: null,
|
|
17
|
+
error: null,
|
|
18
|
+
onLoadError: e,
|
|
19
|
+
onSourceError: e,
|
|
20
|
+
children: /* @__PURE__ */ r(
|
|
21
|
+
d,
|
|
22
|
+
{
|
|
23
|
+
pageNumber: 1,
|
|
24
|
+
width: o,
|
|
25
|
+
renderTextLayer: !1,
|
|
26
|
+
renderAnnotationLayer: !1,
|
|
27
|
+
loading: null,
|
|
28
|
+
error: null,
|
|
29
|
+
onRenderError: e,
|
|
30
|
+
onRenderSuccess: a
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
export {
|
|
37
|
+
f as default
|
|
38
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useRef as u, useEffect as h } from "react";
|
|
3
|
+
import { f as b } from "./sheetPreview-5qeAOp0W.js";
|
|
4
|
+
const p = 12, x = 8, S = ({
|
|
5
|
+
url: s,
|
|
6
|
+
onError: c,
|
|
7
|
+
onRendered: l
|
|
8
|
+
}) => {
|
|
9
|
+
const [a, d] = m(null), o = u(c);
|
|
10
|
+
o.current = c;
|
|
11
|
+
const f = u(l);
|
|
12
|
+
return f.current = l, h(() => {
|
|
13
|
+
let e = !1;
|
|
14
|
+
return b(s, { maxRows: p, maxCols: x }).then((n) => {
|
|
15
|
+
if (e) return;
|
|
16
|
+
const r = n[0];
|
|
17
|
+
if (!r || r.rows.length === 0) {
|
|
18
|
+
o.current();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
d(r.rows), f.current();
|
|
22
|
+
}).catch(() => {
|
|
23
|
+
e || o.current();
|
|
24
|
+
}), () => {
|
|
25
|
+
e = !0;
|
|
26
|
+
};
|
|
27
|
+
}, [s]), a ? /* @__PURE__ */ t("table", { className: "w-full border-collapse bg-f1-background text-left", children: /* @__PURE__ */ t("tbody", { children: a.map((e, n) => /* @__PURE__ */ t("tr", { children: e.map((r, i) => /* @__PURE__ */ t(
|
|
28
|
+
"td",
|
|
29
|
+
{
|
|
30
|
+
className: "whitespace-nowrap border border-solid border-f1-border-secondary px-1.5 py-0.5 text-xs text-f1-foreground",
|
|
31
|
+
children: r
|
|
32
|
+
},
|
|
33
|
+
i
|
|
34
|
+
)) }, n)) }) }) : null;
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
S as default
|
|
38
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useRef as a, useEffect as x } from "react";
|
|
3
|
+
const h = 4096, p = ({
|
|
4
|
+
url: n,
|
|
5
|
+
onError: u,
|
|
6
|
+
onRendered: c
|
|
7
|
+
}) => {
|
|
8
|
+
const [f, s] = i(null), e = a(u);
|
|
9
|
+
e.current = u;
|
|
10
|
+
const o = a(c);
|
|
11
|
+
return o.current = c, x(() => {
|
|
12
|
+
let r = !1;
|
|
13
|
+
return fetch(n).then((t) => {
|
|
14
|
+
if (!t.ok) throw new Error(`${t.status}`);
|
|
15
|
+
return t.text();
|
|
16
|
+
}).then((t) => {
|
|
17
|
+
if (!r) {
|
|
18
|
+
if (t.trim() === "") {
|
|
19
|
+
e.current();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
s(t.slice(0, h)), o.current();
|
|
23
|
+
}
|
|
24
|
+
}).catch(() => {
|
|
25
|
+
r || e.current();
|
|
26
|
+
}), () => {
|
|
27
|
+
r = !0;
|
|
28
|
+
};
|
|
29
|
+
}, [n]), f === null ? null : /* @__PURE__ */ l("pre", { className: "m-0 whitespace-pre-wrap break-words bg-f1-background p-3 text-left font-mono text-xs leading-5 text-f1-foreground-secondary", children: f });
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
p as default
|
|
33
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as i, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { useState as u, useCallback as m, useMemo as p } from "react";
|
|
3
|
-
import { u as x,
|
|
4
|
-
import { n as
|
|
3
|
+
import { u as x, i as w, j as k, k as S, l as C } from "./F0CanvasPanel-BDwye32b.js";
|
|
4
|
+
import { n as g, a as h, f as v, T as r, d as F } from "./index-BuP079h-.js";
|
|
5
5
|
const D = () => {
|
|
6
6
|
const [t, a] = u(1), n = m(
|
|
7
|
-
() => a((e) =>
|
|
7
|
+
() => a((e) => g(e) ?? e),
|
|
8
8
|
[]
|
|
9
9
|
), c = m(
|
|
10
|
-
() => a((e) =>
|
|
10
|
+
() => a((e) => h(e) ?? e),
|
|
11
11
|
[]
|
|
12
12
|
);
|
|
13
13
|
return { scale: t, zoomIn: n, zoomOut: c, setScale: a };
|
|
@@ -70,7 +70,7 @@ const D = () => {
|
|
|
70
70
|
onClick: () => {
|
|
71
71
|
F(t, a, n);
|
|
72
72
|
},
|
|
73
|
-
icon:
|
|
73
|
+
icon: C
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
76
|
c?.map((o, b) => /* @__PURE__ */ l(
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as g, useState as h, useEffect as b } from "react";
|
|
3
|
+
import { r as p } from "./docx-preview-CSg41tKY.js";
|
|
4
|
+
import { u as v, S as w } from "./F0CanvasPanel-BDwye32b.js";
|
|
5
|
+
import { u as x, D as y } from "./DocumentToolbar-BLcBoeNU.js";
|
|
6
|
+
const V = ({
|
|
7
|
+
url: o,
|
|
8
|
+
filename: d,
|
|
9
|
+
withCredentials: a = !0,
|
|
10
|
+
actions: m
|
|
11
|
+
}) => {
|
|
12
|
+
const s = v(), i = x(), f = g(null), [l, n] = h("loading");
|
|
13
|
+
return b(() => {
|
|
14
|
+
const u = f.current;
|
|
15
|
+
if (!u) return;
|
|
16
|
+
let r = !1;
|
|
17
|
+
return n("loading"), fetch(o, { credentials: a ? "include" : "same-origin" }).then((e) => {
|
|
18
|
+
if (!e.ok) throw new Error(`${e.status}`);
|
|
19
|
+
return e.blob();
|
|
20
|
+
}).then((e) => {
|
|
21
|
+
if (!r)
|
|
22
|
+
return p(e, u, void 0, {
|
|
23
|
+
inWrapper: !0,
|
|
24
|
+
breakPages: !0
|
|
25
|
+
}).then(() => {
|
|
26
|
+
r || n("ready");
|
|
27
|
+
});
|
|
28
|
+
}).catch(() => {
|
|
29
|
+
r || n("failed");
|
|
30
|
+
}), () => {
|
|
31
|
+
r = !0;
|
|
32
|
+
};
|
|
33
|
+
}, [o, a]), /* @__PURE__ */ c("div", { className: "flex h-full w-full flex-col bg-f1-background", children: [
|
|
34
|
+
/* @__PURE__ */ t(
|
|
35
|
+
y,
|
|
36
|
+
{
|
|
37
|
+
url: o,
|
|
38
|
+
filename: d,
|
|
39
|
+
withCredentials: a,
|
|
40
|
+
actions: m,
|
|
41
|
+
zoom: i
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ c("div", { className: "relative min-h-0 grow overflow-auto bg-f1-background-secondary", children: [
|
|
45
|
+
l === "loading" && /* @__PURE__ */ t(
|
|
46
|
+
w,
|
|
47
|
+
{
|
|
48
|
+
role: "status",
|
|
49
|
+
"aria-busy": !0,
|
|
50
|
+
"aria-label": s.pdfViewer.loading,
|
|
51
|
+
className: "absolute inset-0 h-full w-full rounded-none"
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
l === "failed" && /* @__PURE__ */ t("div", { className: "flex h-full w-full items-center justify-center bg-f1-background text-f1-foreground-secondary", children: s.pdfViewer.previewFailed }),
|
|
55
|
+
/* @__PURE__ */ t(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
ref: f,
|
|
59
|
+
className: l === "failed" ? "hidden" : void 0,
|
|
60
|
+
style: { zoom: i.scale }
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] })
|
|
64
|
+
] });
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
V as default
|
|
68
|
+
};
|