@factorialco/f0-react 6.88.4 → 6.89.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.
@@ -1,7 +1,7 @@
1
1
  import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
2
  import { useState as b, useCallback as m, useMemo as p } from "react";
3
- import { u as x, i as w, j as k, k as S, l as C } from "./F0CanvasPanel-CHIKqAx1.js";
4
- import { n as g, a as h, f as v, T as n, d as F } from "./index-ChySRaDP.js";
3
+ import { u as x, i as w, j as k, k as S, l as C } from "./F0CanvasPanel-Dtc7dfno.js";
4
+ import { n as g, a as h, f as v, T as n, d as F } from "./index-WLqYUzlI.js";
5
5
  const D = () => {
6
6
  const [r, a] = b(1), t = m(
7
7
  () => a((e) => g(e) ?? e),
@@ -1,42 +1,39 @@
1
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
2
  import { r as g } from "./docx-preview-BaRDMyPN.js";
3
- import { useRef as h, useState as b, useEffect as p } from "react";
4
- import { u as v, S as w } from "./F0CanvasPanel-CHIKqAx1.js";
5
- import { u as x, D as y } from "./DocumentToolbar-yRNLFw0I.js";
3
+ import { useRef as b, useState as h, useEffect as w } from "react";
4
+ import { u as p, S as v } from "./F0CanvasPanel-Dtc7dfno.js";
5
+ import { u as x, D as y } from "./DocumentToolbar-DIehxyRO.js";
6
6
  const V = ({
7
- url: o,
7
+ url: t,
8
8
  filename: d,
9
9
  withCredentials: a = !0,
10
10
  actions: m
11
11
  }) => {
12
- const s = v(), i = x(), u = h(null), [l, n] = b("loading");
13
- return p(() => {
12
+ const s = p(), i = x(), u = b(null), [l, n] = h("loading");
13
+ return w(() => {
14
14
  const f = u.current;
15
15
  if (!f)
16
16
  return;
17
17
  let r = !1;
18
- return n("loading"), fetch(o, { credentials: a ? "include" : "same-origin" }).then((e) => {
18
+ return n("loading"), fetch(t, { credentials: a ? "include" : "same-origin" }).then((e) => {
19
19
  if (!e.ok)
20
20
  throw new Error(`${e.status}`);
21
21
  return e.blob();
22
- }).then((e) => {
23
- if (!r)
24
- return g(e, f, void 0, {
25
- inWrapper: !0,
26
- breakPages: !0
27
- }).then(() => {
28
- r || n("ready");
29
- });
22
+ }).then(async (e) => {
23
+ r || (await g(e, f, void 0, {
24
+ inWrapper: !0,
25
+ breakPages: !0
26
+ }), r || n("ready"));
30
27
  }).catch(() => {
31
28
  r || n("failed");
32
29
  }), () => {
33
30
  r = !0;
34
31
  };
35
- }, [o, a]), /* @__PURE__ */ c("div", { className: "flex h-full w-full flex-col bg-f1-background", children: [
36
- /* @__PURE__ */ t(
32
+ }, [t, a]), /* @__PURE__ */ c("div", { className: "flex h-full w-full flex-col bg-f1-background", children: [
33
+ /* @__PURE__ */ o(
37
34
  y,
38
35
  {
39
- url: o,
36
+ url: t,
40
37
  filename: d,
41
38
  withCredentials: a,
42
39
  actions: m,
@@ -44,8 +41,8 @@ const V = ({
44
41
  }
45
42
  ),
46
43
  /* @__PURE__ */ c("div", { className: "relative min-h-0 grow overflow-auto bg-f1-background-secondary", children: [
47
- l === "loading" ? /* @__PURE__ */ t(
48
- w,
44
+ l === "loading" ? /* @__PURE__ */ o(
45
+ v,
49
46
  {
50
47
  role: "status",
51
48
  "aria-busy": !0,
@@ -53,8 +50,8 @@ const V = ({
53
50
  className: "absolute inset-0 h-full w-full rounded-none"
54
51
  }
55
52
  ) : null,
56
- 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 }) : null,
57
- /* @__PURE__ */ t(
53
+ l === "failed" ? /* @__PURE__ */ o("div", { className: "flex h-full w-full items-center justify-center bg-f1-background text-f1-foreground-secondary", children: s.pdfViewer.previewFailed }) : null,
54
+ /* @__PURE__ */ o(
58
55
  "div",
59
56
  {
60
57
  ref: u,