@prose-reader/react-reader 1.230.0 → 1.231.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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx as t, jsxs as c, Fragment as oe } from "react/jsx-runtime";
2
2
  import * as z from "react";
3
- import ze, { createContext as Ee, memo as g, useMemo as ce, useEffect as W, useContext as Be, useState as k, useLayoutEffect as Me, useCallback as N } from "react";
3
+ import ze, { createContext as Ee, memo as g, useMemo as ce, useEffect as j, useContext as Be, useState as k, useLayoutEffect as Me, useCallback as N } from "react";
4
4
  import { signal as de, useSignalState as Ce, useConstant as Le, useLiveRef as $e, useSubscribe as E, useObserve as v, isDefined as Ie, useSignalValue as _e } from "reactjrx";
5
- import { Subject as he, tap as ue, map as L, filter as ee, switchMap as F, of as Ne, withLatestFrom as Fe, NEVER as re, startWith as ye, distinctUntilChanged as Se, throttleTime as He, first as Te, combineLatest as je, EMPTY as We, finalize as ke, mergeMap as Ge, skip as we, merge as Ve, timer as Ye } from "rxjs";
5
+ import { Subject as he, tap as ue, map as L, filter as ee, switchMap as F, of as Ne, withLatestFrom as Fe, NEVER as re, startWith as ye, distinctUntilChanged as Se, throttleTime as He, first as Te, combineLatest as We, EMPTY as je, finalize as ke, mergeMap as Ge, skip as we, merge as Ve, timer as Ye } from "rxjs";
6
6
  import { IconButton as I, Portal as ge, Dialog as S, List as w, Link as pe, Stack as R, Text as f, Tabs as O, Button as G, Presence as te, Box as P, createToaster as Ue, Toaster as qe, Toast as B, Spinner as Qe, Heading as le, HStack as D, Kbd as xe, Popover as M, Progress as H, chakra as Ke, Collapsible as se, Input as Ze } from "@chakra-ui/react";
7
7
  import { LuX as Xe, LuNotebookPen as ne, LuBookmark as Je, LuArrowBigRight as et, LuArrowBigLeft as tt, LuChevronDown as nt, LuCircleHelp as ot, LuTableOfContents as rt, LuSearch as it, LuGalleryHorizontal as st, LuCircleCheck as ve } from "react-icons/lu";
8
8
  import { createPortal as lt } from "react-dom";
@@ -41,7 +41,7 @@ const Pe = Ee({
41
41
  }),
42
42
  [i, n, s]
43
43
  );
44
- return W(() => {
44
+ return j(() => {
45
45
  i.setValue(o);
46
46
  }, [o, i]), E(
47
47
  () => i.pipe(ue(d.current)),
@@ -82,8 +82,8 @@ S.Trigger;
82
82
  const X = S.ActionTrigger, J = () => Be(Pe), p = () => {
83
83
  const { reader: e } = J();
84
84
  return e;
85
- }, Re = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, j = (e) => !!e && "__PROSE_READER_ENHANCER_ANNOTATIONS" in e, Ae = (e) => !!e && "__PROSE_READER_ENHANCER_GALLERY" in e, kt = (e) => {
86
- const n = p(), o = j(n) ? n : void 0;
85
+ }, Re = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, W = (e) => !!e && "__PROSE_READER_ENHANCER_ANNOTATIONS" in e, Ae = (e) => !!e && "__PROSE_READER_ENHANCER_GALLERY" in e, kt = (e) => {
86
+ const n = p(), o = W(n) ? n : void 0;
87
87
  return { data: v(
88
88
  () => o == null ? void 0 : o.annotations.annotations$.pipe(
89
89
  L((i) => i.find((s) => s.id === e)),
@@ -123,7 +123,7 @@ const X = S.ActionTrigger, J = () => Be(Pe), p = () => {
123
123
  }
124
124
  ) });
125
125
  }, ie = () => {
126
- const e = p(), n = j(e) ? e : void 0;
126
+ const e = p(), n = W(e) ? e : void 0;
127
127
  return { data: v(
128
128
  () => n == null ? void 0 : n.annotations.annotations$.pipe(
129
129
  F(
@@ -310,10 +310,10 @@ const X = S.ActionTrigger, J = () => Be(Pe), p = () => {
310
310
  ) });
311
311
  }), $t = () => {
312
312
  const e = p();
313
- return j(e) ? e : void 0;
313
+ return W(e) ? e : void 0;
314
314
  }, _t = () => {
315
315
  const e = $t(), { data: n } = ie();
316
- W(() => e ? e.gestures.hooks.register(
316
+ j(() => e ? e.gestures.hooks.register(
317
317
  "beforeTapGesture",
318
318
  ({ event$: r }) => r.pipe(
319
319
  Fe(e == null ? void 0 : e.annotations.candidates$),
@@ -398,7 +398,7 @@ function Ht() {
398
398
  };
399
399
  }, [e, i]), [n, o, e];
400
400
  }
401
- const jt = (e, n, o) => {
401
+ const Wt = (e, n, o) => {
402
402
  const r = p(), i = Ae(r) ? r : void 0;
403
403
  E(() => {
404
404
  if (!i || !e) return re;
@@ -425,14 +425,14 @@ const jt = (e, n, o) => {
425
425
  ))
426
426
  );
427
427
  }, [i, n, o, e]);
428
- }, Wt = g(
428
+ }, jt = g(
429
429
  ({
430
430
  item: e,
431
431
  onNavigated: n
432
432
  }) => {
433
433
  var l;
434
434
  const [o, r, i] = Ht(), s = p();
435
- jt(i, e, r);
435
+ Wt(i, e, r);
436
436
  const d = v(
437
437
  () => s == null ? void 0 : s.locateResource(e, { mode: "shallow" }),
438
438
  [s, e]
@@ -513,7 +513,7 @@ const jt = (e, n, o) => {
513
513
  pt: 2,
514
514
  "data-grid": !0,
515
515
  children: r == null ? void 0 : r.map((i) => /* @__PURE__ */ t(
516
- Wt,
516
+ jt,
517
517
  {
518
518
  item: i,
519
519
  onNavigated: () => {
@@ -530,7 +530,7 @@ const jt = (e, n, o) => {
530
530
  }
531
531
  );
532
532
  }
533
- ), Vt = "@prose-reader/react-reader", Yt = "1.229.0", Ut = g(
533
+ ), Vt = "@prose-reader/react-reader", Yt = "1.230.0", Ut = g(
534
534
  ({
535
535
  open: e,
536
536
  setOpen: n
@@ -572,7 +572,7 @@ const jt = (e, n, o) => {
572
572
  ), $ = () => {
573
573
  const e = p();
574
574
  return v(
575
- () => e ? je([e.pagination.state$, e.context.state$]).pipe(
575
+ () => e ? We([e.pagination.state$, e.context.state$]).pipe(
576
576
  L(([n, o]) => {
577
577
  var i;
578
578
  const r = (i = o.manifest) == null ? void 0 : i.spineItems.every(
@@ -599,7 +599,7 @@ const jt = (e, n, o) => {
599
599
  ] }) });
600
600
  }, Qt = () => {
601
601
  const [e, n] = k(/* @__PURE__ */ new Date());
602
- return W(() => {
602
+ return j(() => {
603
603
  const o = setInterval(() => {
604
604
  n(/* @__PURE__ */ new Date());
605
605
  }, 6e4);
@@ -646,7 +646,7 @@ const jt = (e, n, o) => {
646
646
  E(
647
647
  () => e == null ? void 0 : e.zoom.isZooming$.pipe(
648
648
  F((o) => {
649
- if (!o) return We;
649
+ if (!o) return je;
650
650
  const r = new he();
651
651
  return n.next({
652
652
  key: "zoom",
@@ -900,7 +900,7 @@ const sn = H.Root, ln = H.ValueText, fe = () => {
900
900
  0,
901
901
  n ? Math.floor((r - 1) / 2) : r - 1
902
902
  );
903
- return W(() => {
903
+ return j(() => {
904
904
  d.update(i || 0);
905
905
  }, [i, d]), {
906
906
  value: s,
@@ -959,58 +959,67 @@ const sn = H.Root, ln = H.ValueText, fe = () => {
959
959
  overflow: "auto",
960
960
  pb: 8,
961
961
  children: [
962
- /* @__PURE__ */ c(D, { flex: 1, alignItems: "center", justifyContent: "center", children: [
963
- /* @__PURE__ */ t(
964
- I,
965
- {
966
- "aria-label": "left",
967
- size: "lg",
968
- variant: "ghost",
969
- flexShrink: 0,
970
- onClick: () => o == null ? void 0 : o.navigation.goToLeftOrTopSpineItem(),
971
- disabled: !(r != null && r.canGoLeftSpineItem) && !(r != null && r.canGoTopSpineItem),
972
- children: s ? /* @__PURE__ */ t(pt, {}) : /* @__PURE__ */ t(mt, {})
973
- }
974
- ),
975
- /* @__PURE__ */ c(
976
- R,
977
- {
978
- flex: 1,
979
- maxW: 400,
980
- gap: 2,
981
- alignItems: "center",
982
- overflow: "auto",
983
- px: 4,
984
- children: [
985
- /* @__PURE__ */ t(an, {}),
986
- /* @__PURE__ */ t(
987
- un,
988
- {
989
- style: {
990
- width: "100%",
991
- maxWidth: "300px",
992
- height: "35px"
993
- }
994
- }
995
- )
996
- ]
997
- }
998
- ),
999
- /* @__PURE__ */ t(
1000
- I,
1001
- {
1002
- "aria-label": "right",
1003
- size: "lg",
1004
- flexShrink: 0,
1005
- variant: "ghost",
1006
- disabled: !(r != null && r.canGoRightSpineItem) && !(r != null && r.canGoBottomSpineItem),
1007
- onClick: () => {
1008
- o == null || o.navigation.goToRightOrBottomSpineItem();
1009
- },
1010
- children: s ? /* @__PURE__ */ t(ft, {}) : /* @__PURE__ */ t(bt, {})
1011
- }
1012
- )
1013
- ] }),
962
+ /* @__PURE__ */ c(
963
+ D,
964
+ {
965
+ flex: 1,
966
+ alignItems: "center",
967
+ justifyContent: "center",
968
+ maxWidth: "100%",
969
+ children: [
970
+ /* @__PURE__ */ t(
971
+ I,
972
+ {
973
+ "aria-label": "left",
974
+ size: "lg",
975
+ variant: "ghost",
976
+ flexShrink: 0,
977
+ onClick: () => o == null ? void 0 : o.navigation.goToLeftOrTopSpineItem(),
978
+ disabled: !(r != null && r.canGoLeftSpineItem) && !(r != null && r.canGoTopSpineItem),
979
+ children: s ? /* @__PURE__ */ t(pt, {}) : /* @__PURE__ */ t(mt, {})
980
+ }
981
+ ),
982
+ /* @__PURE__ */ c(
983
+ R,
984
+ {
985
+ flex: 1,
986
+ maxW: 400,
987
+ gap: 2,
988
+ alignItems: "center",
989
+ overflow: "auto",
990
+ px: 4,
991
+ children: [
992
+ /* @__PURE__ */ t(an, {}),
993
+ /* @__PURE__ */ t(
994
+ un,
995
+ {
996
+ style: {
997
+ width: "100%",
998
+ maxWidth: "300px",
999
+ height: "35px"
1000
+ }
1001
+ }
1002
+ )
1003
+ ]
1004
+ }
1005
+ ),
1006
+ /* @__PURE__ */ t(
1007
+ I,
1008
+ {
1009
+ "aria-label": "right",
1010
+ size: "lg",
1011
+ flexShrink: 0,
1012
+ variant: "ghost",
1013
+ disabled: !(r != null && r.canGoRightSpineItem) && !(r != null && r.canGoBottomSpineItem),
1014
+ onClick: () => {
1015
+ o == null || o.navigation.goToRightOrBottomSpineItem();
1016
+ },
1017
+ children: s ? /* @__PURE__ */ t(ft, {}) : /* @__PURE__ */ t(bt, {})
1018
+ }
1019
+ )
1020
+ ]
1021
+ }
1022
+ ),
1014
1023
  /* @__PURE__ */ t(D, { alignSelf: "stretch", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ c(
1015
1024
  se.Root,
1016
1025
  {
@@ -1068,7 +1077,7 @@ const sn = H.Root, ln = H.ValueText, fe = () => {
1068
1077
  children: /* @__PURE__ */ t(it, {})
1069
1078
  }
1070
1079
  ),
1071
- j(o) && /* @__PURE__ */ t(
1080
+ W(o) && /* @__PURE__ */ t(
1072
1081
  I,
1073
1082
  {
1074
1083
  "aria-label": "Bookmarks",
@@ -1078,7 +1087,7 @@ const sn = H.Root, ln = H.ValueText, fe = () => {
1078
1087
  children: /* @__PURE__ */ t(ut, {})
1079
1088
  }
1080
1089
  ),
1081
- j(o) && /* @__PURE__ */ t(
1090
+ W(o) && /* @__PURE__ */ t(
1082
1091
  I,
1083
1092
  {
1084
1093
  "aria-label": "Annotations",
@@ -1126,7 +1135,7 @@ const sn = H.Root, ln = H.ValueText, fe = () => {
1126
1135
  }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
1127
1136
  n(!0);
1128
1137
  }), []);
1129
- return W(() => {
1138
+ return j(() => {
1130
1139
  function r() {
1131
1140
  n(!!document.fullscreenElement);
1132
1141
  }