next-flipbook 2.1.0 → 2.2.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.
Files changed (82) hide show
  1. package/README.md +4 -2
  2. package/dist/core/index.d.ts +1 -1
  3. package/dist/core/index.d.ts.map +1 -1
  4. package/dist/core/types.d.ts +14 -1
  5. package/dist/core/types.d.ts.map +1 -1
  6. package/dist/core/ui/UiStore.d.ts +3 -0
  7. package/dist/core/ui/UiStore.d.ts.map +1 -1
  8. package/dist/core/ui/UiStore.js +5 -1
  9. package/dist/core/ui/UiStore.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/react/components/FlipBook.d.ts.map +1 -1
  14. package/dist/react/components/FlipBook.js +62 -7
  15. package/dist/react/components/FlipBook.js.map +1 -1
  16. package/dist/react/components/FlipBookControls.d.ts +2 -0
  17. package/dist/react/components/FlipBookControls.d.ts.map +1 -1
  18. package/dist/react/components/FlipBookControls.js +18 -0
  19. package/dist/react/components/FlipBookControls.js.map +1 -1
  20. package/dist/react/components/FlipBookDock.d.ts +14 -0
  21. package/dist/react/components/FlipBookDock.d.ts.map +1 -0
  22. package/dist/react/components/FlipBookDock.js +167 -0
  23. package/dist/react/components/FlipBookDock.js.map +1 -0
  24. package/dist/react/components/FlipBookEdgeArrows.d.ts +6 -0
  25. package/dist/react/components/FlipBookEdgeArrows.d.ts.map +1 -0
  26. package/dist/react/components/FlipBookEdgeArrows.js +34 -0
  27. package/dist/react/components/FlipBookEdgeArrows.js.map +1 -0
  28. package/dist/react/components/FlipBookHeader.d.ts +14 -0
  29. package/dist/react/components/FlipBookHeader.d.ts.map +1 -0
  30. package/dist/react/components/FlipBookHeader.js +61 -0
  31. package/dist/react/components/FlipBookHeader.js.map +1 -0
  32. package/dist/react/components/FlipBookMoreMenu.d.ts +13 -0
  33. package/dist/react/components/FlipBookMoreMenu.d.ts.map +1 -0
  34. package/dist/react/components/FlipBookMoreMenu.js +125 -0
  35. package/dist/react/components/FlipBookMoreMenu.js.map +1 -0
  36. package/dist/react/components/FlipBookRail.d.ts +10 -0
  37. package/dist/react/components/FlipBookRail.d.ts.map +1 -0
  38. package/dist/react/components/FlipBookRail.js +65 -0
  39. package/dist/react/components/FlipBookRail.js.map +1 -0
  40. package/dist/react/components/FlipBookSidePanel.d.ts +11 -3
  41. package/dist/react/components/FlipBookSidePanel.d.ts.map +1 -1
  42. package/dist/react/components/FlipBookSidePanel.js +41 -25
  43. package/dist/react/components/FlipBookSidePanel.js.map +1 -1
  44. package/dist/react/components/FlipBookStage.d.ts.map +1 -1
  45. package/dist/react/components/FlipBookStage.js +1 -1
  46. package/dist/react/components/FlipBookStage.js.map +1 -1
  47. package/dist/react/components/FlipBookToolbar.d.ts.map +1 -1
  48. package/dist/react/components/FlipBookToolbar.js +4 -17
  49. package/dist/react/components/FlipBookToolbar.js.map +1 -1
  50. package/dist/react/components/FlipBookTour.d.ts +16 -0
  51. package/dist/react/components/FlipBookTour.d.ts.map +1 -0
  52. package/dist/react/components/FlipBookTour.js +257 -0
  53. package/dist/react/components/FlipBookTour.js.map +1 -0
  54. package/dist/react/controller.d.ts.map +1 -1
  55. package/dist/react/controller.js +5 -0
  56. package/dist/react/controller.js.map +1 -1
  57. package/dist/react/icons.d.ts +1 -1
  58. package/dist/react/icons.d.ts.map +1 -1
  59. package/dist/react/icons.js +3 -0
  60. package/dist/react/icons.js.map +1 -1
  61. package/dist/react/index.d.ts +11 -0
  62. package/dist/react/index.d.ts.map +1 -1
  63. package/dist/react/index.js +6 -0
  64. package/dist/react/index.js.map +1 -1
  65. package/dist/react/locale.d.ts.map +1 -1
  66. package/dist/react/locale.js +29 -0
  67. package/dist/react/locale.js.map +1 -1
  68. package/dist/react/studioStyles.d.ts +14 -0
  69. package/dist/react/studioStyles.d.ts.map +1 -0
  70. package/dist/react/studioStyles.js +26 -0
  71. package/dist/react/studioStyles.js.map +1 -0
  72. package/dist/react/theme.d.ts.map +1 -1
  73. package/dist/react/theme.js +29 -0
  74. package/dist/react/theme.js.map +1 -1
  75. package/dist/react/tutorialStorage.d.ts +8 -0
  76. package/dist/react/tutorialStorage.d.ts.map +1 -0
  77. package/dist/react/tutorialStorage.js +38 -0
  78. package/dist/react/tutorialStorage.js.map +1 -0
  79. package/dist/styles.css +111 -0
  80. package/dist/types/index.d.ts +77 -2
  81. package/dist/types/index.d.ts.map +1 -1
  82. package/package.json +1 -1
@@ -0,0 +1,167 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { useFlipBook } from "../hooks/useFlipBook.js";
5
+ import { formatPageRange } from "../locale.js";
6
+ import { FONT } from "../studioStyles.js";
7
+ import { ZoomGroup } from "./FlipBookControls.js";
8
+ import { FlipBookToolbarButton } from "./FlipBookToolbarButton.js";
9
+ /** While the slider is dragged, the book follows at most this often, in ms. */
10
+ const SCRUB_EVERY_MS = 120;
11
+ /**
12
+ * The studio layout's dock: previous and next, a box where a page number is typed, a slider that
13
+ * moves through the pages (bookmarked pages are marked on it), and, in a wide viewer, zoom and
14
+ * fullscreen. It floats over the bottom of the book.
15
+ */
16
+ export function FlipBookDock({ compact, className, style }) {
17
+ const book = useFlipBook();
18
+ const { features, locale, state, ui, bookmarks } = book;
19
+ const rtl = state.direction === "rtl";
20
+ const total = state.pageCount;
21
+ const lead = state.visiblePages[0] ?? 1;
22
+ const range = formatPageRange(state.visiblePages);
23
+ // The page box: `null` while it shows the page you are on, a string while you type.
24
+ const [draft, setDraft] = useState(null);
25
+ const commitDraft = () => {
26
+ if (draft === null)
27
+ return;
28
+ const page = Number.parseInt(draft.replace(/[^0-9]/g, " ").trim(), 10);
29
+ setDraft(null);
30
+ if (Number.isFinite(page) && page >= 1 && page <= total)
31
+ book.goToPage(page);
32
+ };
33
+ const onFieldKeyDown = (event) => {
34
+ if (event.key === "Enter") {
35
+ event.preventDefault();
36
+ commitDraft();
37
+ event.currentTarget.blur();
38
+ }
39
+ else if (event.key === "Escape") {
40
+ event.preventDefault();
41
+ event.stopPropagation();
42
+ setDraft(null);
43
+ event.currentTarget.blur();
44
+ }
45
+ };
46
+ // The slider: shows the value being dragged to, and moves the book to it a few times a second.
47
+ const [scrub, setScrub] = useState(null);
48
+ const [hover, setHover] = useState(false);
49
+ const pending = useRef(null);
50
+ const timer = useRef(undefined);
51
+ const flush = () => {
52
+ if (timer.current !== undefined) {
53
+ clearTimeout(timer.current);
54
+ timer.current = undefined;
55
+ }
56
+ if (pending.current !== null) {
57
+ const page = pending.current;
58
+ pending.current = null;
59
+ // A slider jumps: an animated turn for every step would lag behind the thumb.
60
+ book.jumpToPage(page);
61
+ }
62
+ };
63
+ useEffect(() => () => {
64
+ if (timer.current !== undefined)
65
+ clearTimeout(timer.current);
66
+ }, []);
67
+ const onScrub = (value) => {
68
+ setScrub(value);
69
+ pending.current = value;
70
+ if (timer.current === undefined) {
71
+ timer.current = setTimeout(() => {
72
+ timer.current = undefined;
73
+ flush();
74
+ }, SCRUB_EVERY_MS);
75
+ }
76
+ };
77
+ const endScrub = () => {
78
+ flush();
79
+ setScrub(null);
80
+ };
81
+ const shown = scrub ?? lead;
82
+ const fraction = total > 1 ? (shown - 1) / (total - 1) : 0;
83
+ const fullscreen = ui.fullscreen !== "none";
84
+ const edge = (fractionOf) => `calc(9px + (100% - 18px) * ${fractionOf})`;
85
+ return (_jsxs("div", { role: "group", "aria-label": locale.navigationLabel, "data-flipbook-dock": "", className: className,
86
+ // Like the toolbar: a right-to-left book mirrors the dock, slider included.
87
+ dir: rtl ? "rtl" : undefined, style: {
88
+ position: "absolute",
89
+ left: "50%",
90
+ bottom: 16,
91
+ transform: "translateX(-50%)",
92
+ zIndex: 3,
93
+ width: "min(760px, calc(100% - 24px))",
94
+ boxSizing: "border-box",
95
+ display: "flex",
96
+ alignItems: "center",
97
+ gap: 4,
98
+ padding: "8px 10px",
99
+ background: "var(--flipbook-toolbar-background, rgba(255, 255, 255, 0.92))",
100
+ color: "var(--flipbook-toolbar-color, #1f2328)",
101
+ backdropFilter: "blur(var(--flipbook-glass-blur, 0px))",
102
+ WebkitBackdropFilter: "blur(var(--flipbook-glass-blur, 0px))",
103
+ border: "var(--flipbook-bar-border, 1px solid rgba(127, 127, 127, 0.28))",
104
+ borderRadius: "var(--flipbook-bar-radius, 18px)",
105
+ boxShadow: "var(--flipbook-bar-shadow, 0 10px 30px rgba(0, 0, 0, 0.16))",
106
+ font: `14px/1 ${FONT}`,
107
+ fontVariantNumeric: "tabular-nums",
108
+ ...style,
109
+ }, children: [_jsx(FlipBookToolbarButton, { label: locale.previous, icon: rtl ? "chevron-right" : "chevron-left", disabled: !book.canGoPrevious, onClick: book.previous }), _jsx("input", { type: "text", inputMode: "numeric", "data-flipbook-page-field": "", "aria-label": locale.pageField, autoComplete: "off", value: draft ?? range,
110
+ // The words stay as they are until something is typed, and are selected, so that a page number
111
+ // typed over them replaces them. (Filling the box with a new value on focus would move the
112
+ // caret after the first digit, and "8" would come out as "28".)
113
+ onFocus: (event) => {
114
+ const box = event.currentTarget;
115
+ requestAnimationFrame(() => {
116
+ if (document.activeElement === box)
117
+ box.select();
118
+ });
119
+ }, onChange: (event) => setDraft(event.target.value), onBlur: commitDraft, onKeyDown: onFieldKeyDown, style: {
120
+ flex: "none",
121
+ width: "7ch",
122
+ height: 40,
123
+ boxSizing: "border-box",
124
+ padding: "0 6px",
125
+ border: "1px solid rgba(127, 127, 127, 0.4)",
126
+ borderRadius: "var(--flipbook-button-radius, 12px)",
127
+ background: "rgba(127, 127, 127, 0.12)",
128
+ color: "inherit",
129
+ font: `600 14px/1 ${FONT}`,
130
+ fontVariantNumeric: "tabular-nums",
131
+ textAlign: "center",
132
+ } }), _jsxs("span", { style: { flex: "none", opacity: 0.85, whiteSpace: "nowrap", paddingInline: "0 2px" }, children: ["/ ", total] }), _jsx(FlipBookToolbarButton, { label: locale.next, icon: rtl ? "chevron-left" : "chevron-right", disabled: !book.canGoNext, onClick: book.next }), _jsxs("div", { "data-flipbook-tour": "scrubber", style: { position: "relative", flex: 1, minWidth: 72, height: 28, marginInline: 8 }, children: [total > 1
133
+ ? bookmarks.map((page) => (_jsx("span", { "aria-hidden": "true", "data-flipbook-scrub-mark": "", style: {
134
+ position: "absolute",
135
+ top: 1,
136
+ insetInlineStart: edge((page - 1) / (total - 1)),
137
+ width: 3,
138
+ height: 8,
139
+ marginInlineStart: -1.5,
140
+ borderRadius: 2,
141
+ background: "var(--flipbook-accent, #2563eb)",
142
+ pointerEvents: "none",
143
+ } }, page)))
144
+ : null, _jsx("input", { type: "range", "data-flipbook-scrubber": "", min: 1, max: Math.max(total, 1), step: 1, value: shown, disabled: total < 2, "aria-label": locale.scrubber, "aria-valuetext": `${shown} / ${total}`, onChange: (event) => onScrub(Number(event.target.value)), onPointerUp: endScrub, onKeyUp: endScrub, onBlur: endScrub, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), style: {
145
+ position: "absolute",
146
+ inset: 0,
147
+ width: "100%",
148
+ height: "100%",
149
+ margin: 0,
150
+ accentColor: "var(--flipbook-accent, #2563eb)",
151
+ cursor: "pointer",
152
+ "--flipbook-scrub": `${(fraction * 100).toFixed(2)}%`,
153
+ } }), scrub !== null || hover ? (_jsx("span", { "aria-hidden": "true", "data-flipbook-scrub-badge": "", style: {
154
+ position: "absolute",
155
+ bottom: "calc(100% + 10px)",
156
+ insetInlineStart: edge(fraction),
157
+ transform: "translateX(-50%)",
158
+ padding: "4px 10px",
159
+ borderRadius: 999,
160
+ background: "rgba(20, 22, 25, 0.94)",
161
+ color: "#ffffff",
162
+ font: `600 12px/1.2 ${FONT}`,
163
+ whiteSpace: "nowrap",
164
+ pointerEvents: "none",
165
+ }, children: scrub ?? lead })) : null] }), !compact ? (_jsxs(_Fragment, { children: [features.zoom ? (_jsxs("div", { "data-flipbook-tour": "zoom", style: { display: "inline-flex", alignItems: "center" }, children: [_jsx("span", { "aria-hidden": "true", style: { width: 1, height: 28, marginInline: "0 6px", background: "rgba(127, 127, 127, 0.4)" } }), _jsx(ZoomGroup, {})] })) : null, features.fullscreen ? (_jsx(FlipBookToolbarButton, { label: fullscreen ? locale.exitFullscreen : locale.fullscreen, icon: fullscreen ? "shrink" : "expand", pressed: fullscreen, onClick: book.toggleFullscreen })) : null] })) : null] }));
166
+ }
167
+ //# sourceMappingURL=FlipBookDock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlipBookDock.js","sourceRoot":"","sources":["../../../src/react/components/FlipBookDock.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAA0C,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AASnE,+EAA+E;AAC/E,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB;IAC3E,MAAM,IAAI,GAAG,WAAW,EAAE,CAAC;IAC3B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACxD,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC;IACtC,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;IAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,KAAK,GAA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,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAAE,GAAI,EAC3H,KAAC,SAAS,KAAG,IACT,CACP,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CACrB,KAAC,qBAAqB,IACpB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAC7D,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EACtC,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,IAAI,CAAC,gBAAgB,GAC9B,CACH,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Round previous and next buttons on the left and right edges of the book, for the mouse. They
3
+ * repeat the dock's buttons, so they are hidden from screen readers and skipped by the Tab key.
4
+ */
5
+ export declare function FlipBookEdgeArrows(): import("react").JSX.Element;
6
+ //# sourceMappingURL=FlipBookEdgeArrows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlipBookEdgeArrows.d.ts","sourceRoot":"","sources":["../../../src/react/components/FlipBookEdgeArrows.tsx"],"names":[],"mappings":"AA0BA;;;GAGG;AACH,wBAAgB,kBAAkB,gCA8BjC"}
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useFlipBook } from "../hooks/useFlipBook.js";
4
+ import { FlipBookIcon } from "../icons.js";
5
+ const ARROW = {
6
+ position: "absolute",
7
+ top: "calc(50% - 66px)",
8
+ width: 44,
9
+ height: 44,
10
+ zIndex: 2,
11
+ display: "inline-flex",
12
+ alignItems: "center",
13
+ justifyContent: "center",
14
+ padding: 0,
15
+ borderRadius: "50%",
16
+ border: "var(--flipbook-bar-border, 1px solid rgba(127, 127, 127, 0.28))",
17
+ background: "var(--flipbook-toolbar-background, rgba(255, 255, 255, 0.92))",
18
+ color: "var(--flipbook-toolbar-color, #1f2328)",
19
+ backdropFilter: "blur(var(--flipbook-glass-blur, 0px))",
20
+ WebkitBackdropFilter: "blur(var(--flipbook-glass-blur, 0px))",
21
+ boxShadow: "0 6px 18px rgba(0, 0, 0, 0.18)",
22
+ cursor: "pointer",
23
+ };
24
+ /**
25
+ * Round previous and next buttons on the left and right edges of the book, for the mouse. They
26
+ * repeat the dock's buttons, so they are hidden from screen readers and skipped by the Tab key.
27
+ */
28
+ export function FlipBookEdgeArrows() {
29
+ const book = useFlipBook();
30
+ const rtl = book.state.direction === "rtl";
31
+ const leftGoesNext = rtl;
32
+ return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", "data-flipbook-edge": "left", "aria-hidden": "true", tabIndex: -1, disabled: leftGoesNext ? !book.canGoNext : !book.canGoPrevious, onClick: leftGoesNext ? book.next : book.previous, style: { ...ARROW, left: 12 }, children: _jsx(FlipBookIcon, { name: "chevron-left", size: 22 }) }), _jsx("button", { type: "button", "data-flipbook-edge": "right", "aria-hidden": "true", tabIndex: -1, disabled: leftGoesNext ? !book.canGoPrevious : !book.canGoNext, onClick: leftGoesNext ? book.previous : book.next, style: { ...ARROW, right: 12 }, children: _jsx(FlipBookIcon, { name: "chevron-right", size: 22 }) })] }));
33
+ }
34
+ //# sourceMappingURL=FlipBookEdgeArrows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlipBookEdgeArrows.js","sourceRoot":"","sources":["../../../src/react/components/FlipBookEdgeArrows.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,KAAK,GAAkB;IAC3B,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,kBAAkB;IAC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S,EAC9D,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EACjD,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,YAE9B,KAAC,YAAY,IAAC,IAAI,EAAC,eAAe,EAAC,IAAI,EAAE,EAAE,GAAI,GACxC,IACR,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ export interface FlipBookHeaderProps {
2
+ /** Printed above the page range. Default: the viewer's name from the locale. */
3
+ title?: string;
4
+ /** A narrow viewer: the search field becomes a button. */
5
+ compact: boolean;
6
+ /** Put "Take the tour" in the more menu. */
7
+ tutorial: boolean;
8
+ }
9
+ /**
10
+ * The studio layout's header: the title and where you are, a way into search, the bookmark button,
11
+ * the background picker when it is on, and the more menu.
12
+ */
13
+ export declare function FlipBookHeader({ title, compact, tutorial }: FlipBookHeaderProps): import("react").JSX.Element;
14
+ //# sourceMappingURL=FlipBookHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlipBookHeader.d.ts","sourceRoot":"","sources":["../../../src/react/components/FlipBookHeader.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,mBAAmB;IAClC,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,mBAAmB,+BAiH/E"}
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useFlipBook } from "../hooks/useFlipBook.js";
4
+ import { FlipBookIcon } from "../icons.js";
5
+ import { formatMessage, formatPageRange } from "../locale.js";
6
+ import { FONT, GLASS, LINE } from "../studioStyles.js";
7
+ import { FlipBookBackgroundControl } from "./FlipBookBackgroundControl.js";
8
+ import { FlipBookMoreMenu } from "./FlipBookMoreMenu.js";
9
+ import { FlipBookToolbarButton } from "./FlipBookToolbarButton.js";
10
+ /**
11
+ * The studio layout's header: the title and where you are, a way into search, the bookmark button,
12
+ * the background picker when it is on, and the more menu.
13
+ */
14
+ export function FlipBookHeader({ title, compact, tutorial }) {
15
+ const book = useFlipBook();
16
+ const { features, locale, state, ui } = book;
17
+ const subtitle = formatMessage(state.visiblePages.length > 1 ? locale.pagesStatus : locale.pageStatus, {
18
+ page: formatPageRange(state.visiblePages),
19
+ total: state.pageCount,
20
+ });
21
+ const openSearch = (element) => {
22
+ // With the panel already open this goes to its box, where the typing happens.
23
+ if (ui.panel === "search") {
24
+ element.closest(".flipbook-root")?.querySelector("[data-flipbook-search-input]")?.focus();
25
+ }
26
+ else {
27
+ book.openPanel("search");
28
+ }
29
+ };
30
+ return (_jsxs("header", { "data-flipbook-header": "", dir: state.direction === "rtl" ? "rtl" : undefined, style: {
31
+ ...GLASS,
32
+ flex: "none",
33
+ position: "relative",
34
+ zIndex: 4,
35
+ display: "flex",
36
+ alignItems: "center",
37
+ gap: 8,
38
+ minHeight: 56,
39
+ boxSizing: "border-box",
40
+ paddingBlock: 6,
41
+ paddingInline: "16px 8px",
42
+ borderBottom: LINE,
43
+ font: `14px/1.2 ${FONT}`,
44
+ }, children: [_jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [_jsx("div", { "data-flipbook-title": "", style: { font: `700 15px/1.25 ${FONT}`, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: title ?? locale.viewerLabel }), _jsx("div", { style: { font: `400 13px/1.3 ${FONT}`, opacity: 0.82, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: subtitle })] }), features.search ? (_jsx("div", { "data-flipbook-tour": "search", style: { display: "inline-flex" }, children: compact ? (_jsx(FlipBookToolbarButton, { label: locale.search, icon: "search", pressed: ui.panel === "search", onClick: () => book.togglePanel("search") })) : (_jsxs("button", { type: "button", "data-flipbook-search-launcher": "", "aria-label": locale.searchLabel, "aria-keyshortcuts": "/", onClick: (event) => openSearch(event.currentTarget), style: {
45
+ display: "flex",
46
+ alignItems: "center",
47
+ gap: 8,
48
+ width: 280,
49
+ height: "var(--flipbook-button-size, 44px)",
50
+ boxSizing: "border-box",
51
+ padding: "0 10px",
52
+ border: "1px solid rgba(127, 127, 127, 0.4)",
53
+ borderRadius: "var(--flipbook-button-radius, 12px)",
54
+ background: "rgba(127, 127, 127, 0.12)",
55
+ color: "inherit",
56
+ font: `14px/1 ${FONT}`,
57
+ textAlign: "start",
58
+ cursor: "pointer",
59
+ }, children: [_jsx(FlipBookIcon, { name: "search", size: 18 }), _jsx("span", { style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: locale.searchLabel }), _jsx("kbd", { "aria-hidden": "true", style: { padding: "2px 7px", border: "1px solid rgba(127, 127, 127, 0.6)", borderRadius: 6, font: `600 12px/1 ${FONT}` }, children: "/" })] })) })) : null, features.bookmarks ? (_jsx("div", { "data-flipbook-tour": "bookmark", style: { display: "inline-flex" }, children: _jsx(FlipBookToolbarButton, { label: book.currentBookmarked ? locale.removeBookmark : locale.addBookmark, icon: book.currentBookmarked ? "bookmark-filled" : "bookmark", pressed: book.currentBookmarked, onClick: () => book.toggleBookmark() }) })) : null, features.backgroundControl ? _jsx(FlipBookBackgroundControl, {}) : null, _jsx(FlipBookMoreMenu, { tutorial: tutorial, compact: compact })] }));
60
+ }
61
+ //# sourceMappingURL=FlipBookHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlipBookHeader.js","sourceRoot":"","sources":["../../../src/react/components/FlipBookHeader.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EA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M,CAAC,WAAW,EAC1E,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,UAAU,EAC7D,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,GACpC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,EAEP,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAC,yBAAyB,KAAG,CAAC,CAAC,CAAC,IAAI,EAElE,KAAC,gBAAgB,IAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAI,IACnD,CACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface FlipBookMoreMenuProps {
2
+ /** Add "Take the tour" to the menu. */
3
+ tutorial?: boolean;
4
+ /** A narrow viewer has no fullscreen button in its dock, so the menu has one. */
5
+ compact?: boolean;
6
+ }
7
+ /**
8
+ * The header's "more" button and the menu it opens: download, print, share, and the tutorial. It
9
+ * only shows what is switched on, and not at all when there is nothing to put in it. Escape and a
10
+ * click outside close it; the arrow keys, Home and End move through it.
11
+ */
12
+ export declare function FlipBookMoreMenu({ tutorial, compact }: FlipBookMoreMenuProps): import("react").JSX.Element | null;
13
+ //# sourceMappingURL=FlipBookMoreMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlipBookMoreMenu.d.ts","sourceRoot":"","sources":["../../../src/react/components/FlipBookMoreMenu.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,qBAAqB;IACpC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAUD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAgB,EAAE,OAAe,EAAE,EAAE,qBAAqB,sCA0I5F"}
@@ -0,0 +1,125 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useRef, useState } from "react";
4
+ import { useFlipBook } from "../hooks/useFlipBook.js";
5
+ import { FlipBookIcon } from "../icons.js";
6
+ import { FONT, POPUP } from "../studioStyles.js";
7
+ import { FlipBookToolbarButton } from "./FlipBookToolbarButton.js";
8
+ /**
9
+ * The header's "more" button and the menu it opens: download, print, share, and the tutorial. It
10
+ * only shows what is switched on, and not at all when there is nothing to put in it. Escape and a
11
+ * click outside close it; the arrow keys, Home and End move through it.
12
+ */
13
+ export function FlipBookMoreMenu({ tutorial = false, compact = false }) {
14
+ const book = useFlipBook();
15
+ const { features, locale, ui } = book;
16
+ const [open, setOpen] = useState(false);
17
+ const id = useId();
18
+ const wrapper = useRef(null);
19
+ const trigger = useRef(null);
20
+ const menu = useRef(null);
21
+ const items = [];
22
+ if (features.download)
23
+ items.push({ key: "download", label: locale.download, icon: "download", run: () => void book.download() });
24
+ if (features.print) {
25
+ items.push({ key: "print", label: locale.print, icon: "print", disabled: ui.printing !== null, run: () => void book.print() });
26
+ }
27
+ if (features.share)
28
+ items.push({ key: "share", label: locale.share, icon: "share", run: () => void book.share() });
29
+ if (compact && features.fullscreen) {
30
+ const on = ui.fullscreen !== "none";
31
+ items.push({
32
+ key: "fullscreen",
33
+ label: on ? locale.exitFullscreen : locale.fullscreen,
34
+ icon: on ? "shrink" : "expand",
35
+ run: book.toggleFullscreen,
36
+ });
37
+ }
38
+ if (tutorial)
39
+ items.push({ key: "tour", label: locale.tourStart, icon: "help", run: book.startTutorial });
40
+ const close = (refocus) => {
41
+ setOpen(false);
42
+ if (refocus)
43
+ trigger.current?.querySelector("button")?.focus();
44
+ };
45
+ // Focus the first entry when it opens.
46
+ useEffect(() => {
47
+ if (open)
48
+ menu.current?.querySelector("[role='menuitem']")?.focus();
49
+ }, [open]);
50
+ // A click or tap anywhere else closes it.
51
+ useEffect(() => {
52
+ if (!open)
53
+ return;
54
+ const onPointerDown = (event) => {
55
+ if (event.target instanceof Node && wrapper.current?.contains(event.target))
56
+ return;
57
+ setOpen(false);
58
+ };
59
+ document.addEventListener("pointerdown", onPointerDown, true);
60
+ return () => document.removeEventListener("pointerdown", onPointerDown, true);
61
+ }, [open]);
62
+ if (items.length === 0)
63
+ return null;
64
+ const onKeyDown = (event) => {
65
+ if (!open)
66
+ return;
67
+ if (event.key === "Escape") {
68
+ event.preventDefault();
69
+ event.stopPropagation();
70
+ close(true);
71
+ return;
72
+ }
73
+ if (event.key === "Tab") {
74
+ setOpen(false);
75
+ return;
76
+ }
77
+ const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
78
+ if (!keys.includes(event.key))
79
+ return;
80
+ // The arrow keys move through the menu; they must not also turn the page.
81
+ event.preventDefault();
82
+ event.stopPropagation();
83
+ const entries = [...(menu.current?.querySelectorAll("[role='menuitem']") ?? [])];
84
+ if (entries.length === 0)
85
+ return;
86
+ const at = entries.indexOf(document.activeElement);
87
+ const last = entries.length - 1;
88
+ const to = event.key === "ArrowDown" ? (at + 1) % entries.length : event.key === "ArrowUp" ? (at - 1 + entries.length) % entries.length : event.key === "Home" ? 0 : last;
89
+ entries[to]?.focus();
90
+ };
91
+ return (_jsxs("div", { ref: wrapper, "data-flipbook-tour": "more", onKeyDown: onKeyDown, style: { position: "relative", display: "inline-flex" }, children: [_jsx("div", { ref: trigger, style: { display: "inline-flex" }, children: _jsx(FlipBookToolbarButton, { label: locale.moreActions, icon: "more", expanded: open, onClick: () => setOpen((value) => !value) }) }), open ? (_jsx("div", { ref: menu, id: `${id}-menu`, role: "menu", "aria-label": locale.moreActions, "data-flipbook-menu": "", style: {
92
+ ...POPUP,
93
+ position: "absolute",
94
+ insetInlineEnd: 0,
95
+ top: "calc(100% + 8px)",
96
+ zIndex: 12,
97
+ minWidth: 224,
98
+ padding: 6,
99
+ display: "flex",
100
+ flexDirection: "column",
101
+ gap: 2,
102
+ font: `500 14px/1.2 ${FONT}`,
103
+ }, children: items.map((item) => (_jsxs("button", { type: "button", role: "menuitem", tabIndex: -1, "aria-disabled": item.disabled === true, onClick: () => {
104
+ if (item.disabled)
105
+ return;
106
+ setOpen(false);
107
+ item.run();
108
+ }, style: {
109
+ display: "flex",
110
+ alignItems: "center",
111
+ gap: 12,
112
+ width: "100%",
113
+ height: 44,
114
+ padding: "0 12px",
115
+ border: 0,
116
+ borderRadius: "var(--flipbook-button-radius, 10px)",
117
+ background: "transparent",
118
+ color: "inherit",
119
+ font: "inherit",
120
+ textAlign: "start",
121
+ cursor: item.disabled ? "default" : "pointer",
122
+ opacity: item.disabled ? 0.4 : 1,
123
+ }, children: [_jsx(FlipBookIcon, { name: item.icon, size: 20 }), _jsx("span", { children: item.label })] }, item.key))) })) : null] }));
124
+ }
125
+ //# sourceMappingURL=FlipBookMoreMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlipBookMoreMenu.js","sourceRoot":"","sources":["../../../src/react/components/FlipBookMoreMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAyB,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAiBnE;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,EAAyB;IAC3F,MAAM,IAAI,GAAG,WAAW,EAAE,CAAC;IAC3B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IACtC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;I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GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,kBAEE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,UAAU,EACf,QAAQ,EAAE,CAAC,CAAC,mBACG,IAAI,CAAC,QAAQ,KAAK,IAAI,EACrC,OAAO,EAAE,GAAG,EAAE;wBACZ,IAAI,IAAI,CAAC,QAAQ;4BAAE,OAAO;wBAC1B,OAAO,CAAC,KAAK,CAAC,CAAC;wBACf,IAAI,CAAC,GAAG,EAAE,CAAC;oBACb,CAAC,EACD,KAAK,EAAE;wBACL,OAAO,EAAE,MAAM;wBACf,UAAU,EAAE,QAAQ;wBACpB,GAAG,EAAE,EAAE;wBACP,KAAK,EAAE,MAAM;wBACb,MAAM,EAAE,EAAE;wBACV,OAAO,EAAE,QAAQ;wBACjB,MAAM,EAAE,CAAC;wBACT,YAAY,EAAE,qCAAqC;wBACnD,UAAU,EAAE,aAAa;wBACzB,KAAK,EAAE,SAAS;wBAChB,IAAI,EAAE,SAAS;wBACf,SAAS,EAAE,OAAO;wBAClB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;wBAC7C,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;qBACjC,aAED,KAAC,YAAY,IAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,GAAI,EAC3C,yBAAO,IAAI,CAAC,KAAK,GAAQ,KA5BpB,IAAI,CAAC,GAAG,CA6BN,CACV,CAAC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface FlipBookRailProps {
2
+ /** `side` is a column beside the book; `bottom` is a tab bar under it, for phones. */
3
+ placement: "side" | "bottom";
4
+ }
5
+ /**
6
+ * The studio layout's panel buttons: Pages, Search, Contents and Bookmarks, each with its name under
7
+ * its icon. They are the one way into a panel; choosing the open one closes it again.
8
+ */
9
+ export declare function FlipBookRail({ placement }: FlipBookRailProps): import("react").JSX.Element | null;
10
+ //# sourceMappingURL=FlipBookRail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlipBookRail.d.ts","sourceRoot":"","sources":["../../../src/react/components/FlipBookRail.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,iBAAiB;IAChC,sFAAsF;IACtF,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC9B;AAQD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,iBAAiB,sCAyE5D"}
@@ -0,0 +1,65 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useFlipBook } from "../hooks/useFlipBook.js";
4
+ import { FlipBookIcon } from "../icons.js";
5
+ import { FONT, GLASS, LINE } from "../studioStyles.js";
6
+ /**
7
+ * The studio layout's panel buttons: Pages, Search, Contents and Bookmarks, each with its name under
8
+ * its icon. They are the one way into a panel; choosing the open one closes it again.
9
+ */
10
+ export function FlipBookRail({ placement }) {
11
+ const book = useFlipBook();
12
+ const { features, locale, ui } = book;
13
+ const tabs = [];
14
+ if (features.thumbnails)
15
+ tabs.push({ id: "thumbnails", label: locale.pagesTab, icon: "grid" });
16
+ if (features.search)
17
+ tabs.push({ id: "search", label: locale.search, icon: "search" });
18
+ if (features.outline)
19
+ tabs.push({ id: "outline", label: locale.outline, icon: "list" });
20
+ if (features.bookmarks)
21
+ tabs.push({ id: "bookmarks", label: locale.bookmarks, icon: "bookmarks" });
22
+ if (tabs.length === 0)
23
+ return null;
24
+ const side = placement === "side";
25
+ const bar = side
26
+ ? {
27
+ flex: "none",
28
+ width: 80,
29
+ flexDirection: "column",
30
+ alignItems: "center",
31
+ gap: 6,
32
+ padding: "12px 0",
33
+ borderInlineEnd: LINE,
34
+ overflowY: "auto",
35
+ }
36
+ : {
37
+ flex: "none",
38
+ gap: 4,
39
+ padding: "6px 8px",
40
+ paddingBottom: "max(6px, env(safe-area-inset-bottom))",
41
+ borderTop: LINE,
42
+ };
43
+ return (_jsx("nav", { "aria-label": locale.railLabel, "data-flipbook-rail": placement, "data-flipbook-tour": "rail", style: { display: "flex", boxSizing: "border-box", font: `600 12px/1 ${FONT}`, ...GLASS, ...bar }, children: tabs.map((tab) => {
44
+ const pressed = ui.panel === tab.id;
45
+ return (_jsxs("button", { type: "button", "data-flipbook-rail-button": "", "aria-pressed": pressed, onClick: () => book.togglePanel(tab.id), style: {
46
+ flex: side ? "none" : "1 1 0",
47
+ minWidth: 0,
48
+ width: side ? 72 : undefined,
49
+ height: side ? 60 : 56,
50
+ display: "flex",
51
+ flexDirection: "column",
52
+ alignItems: "center",
53
+ justifyContent: "center",
54
+ gap: 5,
55
+ padding: 0,
56
+ border: 0,
57
+ borderRadius: "var(--flipbook-button-radius, 12px)",
58
+ background: pressed ? "var(--flipbook-button-pressed-background, rgba(127, 127, 127, 0.22))" : "transparent",
59
+ color: pressed ? "var(--flipbook-button-pressed-color, inherit)" : "inherit",
60
+ font: "inherit",
61
+ cursor: "pointer",
62
+ }, children: [_jsx(FlipBookIcon, { name: tab.icon, size: 22 }), _jsx("span", { style: { whiteSpace: "nowrap" }, children: tab.label })] }, tab.id));
63
+ }) }));
64
+ }
65
+ //# sourceMappingURL=FlipBookRail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlipBookRail.js","sourceRoot":"","sources":["../../../src/react/components/FlipBookRail.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAyB,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAavD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,SAAS,EAAqB;IAC3D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,MAAM,EAAE,SAAS;iBAClB,aAED,KAAC,YAAY,IAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,GAAI,EAC1C,eAAM,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAG,GAAG,CAAC,KAAK,GAAQ,KAzBpD,GAAG,CAAC,EAAE,CA0BJ,CACV,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
@@ -1,12 +1,20 @@
1
1
  import type { AspectRatioProp } from "../../core/layout/sizing.js";
2
2
  export interface FlipBookSidePanelProps {
3
- /** `sidebar` sits beside the book; `sheet` slides over the bottom of it on narrow screens. */
4
- variant?: "sidebar" | "sheet";
3
+ /**
4
+ * `sidebar` sits beside the book; `sheet` slides over the bottom of it on narrow screens; `docked`
5
+ * sits under the book and makes it smaller instead of covering it (the studio layout's phone sheet).
6
+ */
7
+ variant?: "sidebar" | "sheet" | "docked";
5
8
  aspectRatio?: AspectRatioProp;
9
+ /**
10
+ * The studio layout's panel: no tab strip, because its rail is the way between panels, but a
11
+ * heading with the panel's name and a close button. Default false.
12
+ */
13
+ studio?: boolean;
6
14
  }
7
15
  /**
8
16
  * The panel the toolbar opens: thumbnails and, when bookmarks are on, the
9
17
  * bookmark list, with tabs to switch. Escape closes it.
10
18
  */
11
- export declare function FlipBookSidePanel({ variant, aspectRatio }: FlipBookSidePanelProps): import("react").JSX.Element | null;
19
+ export declare function FlipBookSidePanel({ variant, aspectRatio, studio }: FlipBookSidePanelProps): import("react").JSX.Element | null;
12
20
  //# sourceMappingURL=FlipBookSidePanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlipBookSidePanel.d.ts","sourceRoot":"","sources":["../../../src/react/components/FlipBookSidePanel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAWnE,MAAM,WAAW,sBAAsB;IACrC,8FAA8F;IAC9F,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAwBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,OAAmB,EAAE,WAAoB,EAAE,EAAE,sBAAsB,sCA6JtG"}
1
+ {"version":3,"file":"FlipBookSidePanel.d.ts","sourceRoot":"","sources":["../../../src/react/components/FlipBookSidePanel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAWnE,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IACzC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAmCD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,OAAmB,EAAE,WAAoB,EAAE,MAAc,EAAE,EAAE,sBAAsB,sCA4KtH"}