react-magazine 1.0.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/LICENSE +21 -0
- package/README.md +205 -0
- package/dist/cjs/_virtual/_commonjsHelpers.js +6 -0
- package/dist/cjs/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/cjs/_virtual/page-flip.browser.js +6 -0
- package/dist/cjs/_virtual/page-flip.browser.js.map +1 -0
- package/dist/cjs/components/MagazineBook.js +264 -0
- package/dist/cjs/components/MagazineBook.js.map +1 -0
- package/dist/cjs/components/Page.js +21 -0
- package/dist/cjs/components/Page.js.map +1 -0
- package/dist/cjs/components/PageCover.js +21 -0
- package/dist/cjs/components/PageCover.js.map +1 -0
- package/dist/cjs/hooks/useFlipBook.js +100 -0
- package/dist/cjs/hooks/useFlipBook.js.map +1 -0
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/node_modules/page-flip/dist/js/page-flip.browser.js +13 -0
- package/dist/cjs/node_modules/page-flip/dist/js/page-flip.browser.js.map +1 -0
- package/dist/esm/_virtual/_commonjsHelpers.js +4 -0
- package/dist/esm/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/esm/_virtual/page-flip.browser.js +4 -0
- package/dist/esm/_virtual/page-flip.browser.js.map +1 -0
- package/dist/esm/components/MagazineBook.js +262 -0
- package/dist/esm/components/MagazineBook.js.map +1 -0
- package/dist/esm/components/Page.js +19 -0
- package/dist/esm/components/Page.js.map +1 -0
- package/dist/esm/components/PageCover.js +19 -0
- package/dist/esm/components/PageCover.js.map +1 -0
- package/dist/esm/hooks/useFlipBook.js +98 -0
- package/dist/esm/hooks/useFlipBook.js.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/node_modules/page-flip/dist/js/page-flip.browser.js +11 -0
- package/dist/esm/node_modules/page-flip/dist/js/page-flip.browser.js.map +1 -0
- package/dist/styles.css +164 -0
- package/dist/types/components/MagazineBook.d.ts +21 -0
- package/dist/types/components/MagazineBook.d.ts.map +1 -0
- package/dist/types/components/Page.d.ts +8 -0
- package/dist/types/components/Page.d.ts.map +1 -0
- package/dist/types/components/PageCover.d.ts +8 -0
- package/dist/types/components/PageCover.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +4 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/useFlipBook.d.ts +58 -0
- package/dist/types/hooks/useFlipBook.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +144 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Gnanaprakash
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# react-magazine
|
|
2
|
+
|
|
3
|
+
React component for creating realistic magazine-style page flip animations with built-in controls and full TypeScript support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install react-magazine
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { MagazineBook, Page } from 'react-magazine';
|
|
15
|
+
import 'react-magazine/styles.css';
|
|
16
|
+
|
|
17
|
+
function App() {
|
|
18
|
+
return (
|
|
19
|
+
<MagazineBook
|
|
20
|
+
width={400}
|
|
21
|
+
height={500}
|
|
22
|
+
showCover={true}
|
|
23
|
+
showControls={true}
|
|
24
|
+
>
|
|
25
|
+
<Page number={1}>Front Cover</Page>
|
|
26
|
+
<Page number={2}>Page 2</Page>
|
|
27
|
+
<Page number={3}>Page 3</Page>
|
|
28
|
+
<Page number={4}>Back Cover</Page>
|
|
29
|
+
</MagazineBook>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- Realistic page flip animation
|
|
37
|
+
- Built-in navigation controls
|
|
38
|
+
- Hard/soft page density support
|
|
39
|
+
- Responsive design (fixed/stretch modes)
|
|
40
|
+
- Portrait and landscape orientation
|
|
41
|
+
- Touch and mouse support
|
|
42
|
+
- TypeScript support
|
|
43
|
+
- SSR compatible (with dynamic import)
|
|
44
|
+
|
|
45
|
+
## Using the useFlipBook Hook
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { MagazineBook, Page, useFlipBook } from 'react-magazine';
|
|
49
|
+
import 'react-magazine/styles.css';
|
|
50
|
+
|
|
51
|
+
function App() {
|
|
52
|
+
const { bookRef, state, flipNext, flipPrev, handlers } = useFlipBook();
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div>
|
|
56
|
+
<MagazineBook ref={bookRef} width={400} height={500} {...handlers}>
|
|
57
|
+
<Page number={1}>Page 1</Page>
|
|
58
|
+
<Page number={2}>Page 2</Page>
|
|
59
|
+
<Page number={3}>Page 3</Page>
|
|
60
|
+
<Page number={4}>Page 4</Page>
|
|
61
|
+
</MagazineBook>
|
|
62
|
+
|
|
63
|
+
<p>Page {state.currentPage + 1} of {state.pageCount}</p>
|
|
64
|
+
<button onClick={() => flipPrev()}>Previous</button>
|
|
65
|
+
<button onClick={() => flipNext()}>Next</button>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Props
|
|
72
|
+
|
|
73
|
+
### MagazineBook Props
|
|
74
|
+
|
|
75
|
+
| Prop | Type | Default | Description |
|
|
76
|
+
|------|------|---------|-------------|
|
|
77
|
+
| `width` | `number` | `400` | Page width in pixels |
|
|
78
|
+
| `height` | `number` | `300` | Page height in pixels |
|
|
79
|
+
| `size` | `'fixed' \| 'stretch'` | `'fixed'` | Size mode |
|
|
80
|
+
| `startPage` | `number` | `0` | Starting page index |
|
|
81
|
+
| `showCover` | `boolean` | `false` | Makes first & last pages hard (like book covers) |
|
|
82
|
+
| `showControls` | `boolean` | `false` | Show built-in navigation controls |
|
|
83
|
+
| `drawShadow` | `boolean` | `true` | Draw shadow when flipping |
|
|
84
|
+
| `flippingTime` | `number` | `1000` | Flip animation duration (ms) |
|
|
85
|
+
| `usePortrait` | `boolean` | `false` | Use portrait mode |
|
|
86
|
+
| `mobileScrollSupport` | `boolean` | `true` | Enable mobile scroll |
|
|
87
|
+
| `swipeDistance` | `number` | `30` | Swipe distance threshold |
|
|
88
|
+
| `showPageCorners` | `boolean` | `true` | Show page corner fold on hover |
|
|
89
|
+
| `disableFlipByClick` | `boolean` | `false` | Disable click to flip |
|
|
90
|
+
| `clickEventForward` | `boolean` | `true` | Forward click events to children |
|
|
91
|
+
| `useMouseEvents` | `boolean` | `true` | Enable mouse/touch events |
|
|
92
|
+
| `maxShadowOpacity` | `number` | `1` | Shadow intensity (0-1) |
|
|
93
|
+
| `autoSize` | `boolean` | `true` | Auto-resize based on container |
|
|
94
|
+
| `isLoading` | `boolean` | `false` | Show loading state |
|
|
95
|
+
| `disabled` | `boolean` | `false` | Disable all interactions |
|
|
96
|
+
| `controlsClassName` | `string` | `''` | Custom class for controls |
|
|
97
|
+
| `controlsStyle` | `CSSProperties` | `{}` | Custom style for controls |
|
|
98
|
+
|
|
99
|
+
### Event Props
|
|
100
|
+
|
|
101
|
+
| Prop | Type | Description |
|
|
102
|
+
|------|------|-------------|
|
|
103
|
+
| `onFlip` | `(e: FlipEvent) => void` | Called when page flips |
|
|
104
|
+
| `onChangeState` | `(e: StateEvent) => void` | Called when state changes |
|
|
105
|
+
| `onChangeOrientation` | `(e: OrientationEvent) => void` | Called when orientation changes |
|
|
106
|
+
| `onInit` | `(e: FlipEvent) => void` | Called when initialized |
|
|
107
|
+
| `onUpdate` | `(e: FlipEvent) => void` | Called when updated |
|
|
108
|
+
|
|
109
|
+
### Page Props
|
|
110
|
+
|
|
111
|
+
| Prop | Type | Default | Description |
|
|
112
|
+
|------|------|---------|-------------|
|
|
113
|
+
| `number` | `number` | - | Page number (for display) |
|
|
114
|
+
| `density` | `'soft' \| 'hard'` | `'soft'` | Page density (soft bends, hard doesn't) |
|
|
115
|
+
| `className` | `string` | `''` | Custom class |
|
|
116
|
+
| `style` | `CSSProperties` | `{}` | Custom style |
|
|
117
|
+
|
|
118
|
+
## showCover Behavior
|
|
119
|
+
|
|
120
|
+
When `showCover={true}`:
|
|
121
|
+
- First page automatically becomes **hard** (doesn't bend)
|
|
122
|
+
- Last page automatically becomes **hard** (doesn't bend)
|
|
123
|
+
- All inner pages remain **soft** (paper flip effect)
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
<MagazineBook showCover={true}>
|
|
127
|
+
<Page>Front Cover (auto hard)</Page>
|
|
128
|
+
<Page>Page 2 (soft - bends)</Page>
|
|
129
|
+
<Page>Page 3 (soft - bends)</Page>
|
|
130
|
+
<Page>Back Cover (auto hard)</Page>
|
|
131
|
+
</MagazineBook>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Ref API Methods
|
|
135
|
+
|
|
136
|
+
Access via `bookRef.current`:
|
|
137
|
+
|
|
138
|
+
| Method | Description |
|
|
139
|
+
|--------|-------------|
|
|
140
|
+
| `flipNext(corner?)` | Flip to next page |
|
|
141
|
+
| `flipPrev(corner?)` | Flip to previous page |
|
|
142
|
+
| `flip(pageNum, corner?)` | Flip to specific page with animation |
|
|
143
|
+
| `turnToPage(pageNum)` | Jump to page without animation |
|
|
144
|
+
| `getCurrentPageIndex()` | Get current page index (0-based) |
|
|
145
|
+
| `getPageCount()` | Get total page count |
|
|
146
|
+
| `getOrientation()` | Get current orientation |
|
|
147
|
+
| `getState()` | Get current state |
|
|
148
|
+
| `pageFlip()` | Get underlying PageFlip instance |
|
|
149
|
+
|
|
150
|
+
## useFlipBook Hook
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
|
|
154
|
+
| Property | Type | Description |
|
|
155
|
+
|----------|------|-------------|
|
|
156
|
+
| `bookRef` | `RefObject` | Ref to attach to MagazineBook |
|
|
157
|
+
| `state` | `object` | `{ currentPage, pageCount, orientation, pageState, isFlipping }` |
|
|
158
|
+
| `flipNext` | `function` | Flip to next page |
|
|
159
|
+
| `flipPrev` | `function` | Flip to previous page |
|
|
160
|
+
| `flipTo` | `function` | Flip to specific page |
|
|
161
|
+
| `turnTo` | `function` | Jump without animation |
|
|
162
|
+
| `canFlipNext` | `function` | Check if can flip next |
|
|
163
|
+
| `canFlipPrev` | `function` | Check if can flip prev |
|
|
164
|
+
| `handlers` | `object` | Event handlers to spread on MagazineBook |
|
|
165
|
+
|
|
166
|
+
## Next.js Usage
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
import dynamic from 'next/dynamic';
|
|
170
|
+
|
|
171
|
+
const MagazineBook = dynamic(
|
|
172
|
+
() => import('react-magazine').then((mod) => mod.MagazineBook),
|
|
173
|
+
{ ssr: false }
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const Page = dynamic(
|
|
177
|
+
() => import('react-magazine').then((mod) => mod.Page),
|
|
178
|
+
{ ssr: false }
|
|
179
|
+
);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## TypeScript
|
|
183
|
+
|
|
184
|
+
All types are exported:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import type {
|
|
188
|
+
PageFlipInstance,
|
|
189
|
+
IFlipSetting,
|
|
190
|
+
IEventProps,
|
|
191
|
+
PageProps,
|
|
192
|
+
FlipEvent,
|
|
193
|
+
OrientationEvent,
|
|
194
|
+
StateEvent,
|
|
195
|
+
PageDensity,
|
|
196
|
+
PageOrientation,
|
|
197
|
+
PageState,
|
|
198
|
+
FlipCorner,
|
|
199
|
+
SizeType,
|
|
200
|
+
} from 'react-magazine';
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
MIT
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
|
+
|
|
5
|
+
exports.commonjsGlobal = commonjsGlobal;
|
|
6
|
+
//# sourceMappingURL=_commonjsHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-flip.browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var pageFlip_browser = require('../node_modules/page-flip/dist/js/page-flip.browser.js');
|
|
6
|
+
|
|
7
|
+
// SVG Arrow Icons
|
|
8
|
+
const ChevronLeft = () => (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: jsxRuntime.jsx("polyline", { points: "15 18 9 12 15 6" }) }));
|
|
9
|
+
const ChevronRight = () => (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: jsxRuntime.jsx("polyline", { points: "9 18 15 12 9 6" }) }));
|
|
10
|
+
const MagazineBookForward = React.forwardRef((props, ref) => {
|
|
11
|
+
const { className = '', style = {}, children, renderOnlyPageLengthChange = false, isLoading = false, disabled = false, showControls = false, controlsClassName = '', controlsStyle = {}, width = 400, height = 300, size = 'fixed', minWidth = 100, maxWidth = 2000, minHeight = 100, maxHeight = 2000, drawShadow = true, flippingTime = 1000, usePortrait = false, startZIndex = 0, autoSize = true, maxShadowOpacity = 1, showCover = false, mobileScrollSupport = true, clickEventForward = true, useMouseEvents = true, swipeDistance = 30, showPageCorners = true, disableFlipByClick = false, startPage = 0, onFlip, onChangeOrientation, onChangeState, onInit, onUpdate, } = props;
|
|
12
|
+
const htmlElementRef = React.useRef(null);
|
|
13
|
+
const childRef = React.useRef([]);
|
|
14
|
+
const pageFlip = React.useRef(null);
|
|
15
|
+
const [pages, setPages] = React.useState([]);
|
|
16
|
+
const [orientation, setOrientation] = React.useState('landscape');
|
|
17
|
+
const [currentPage, setCurrentPage] = React.useState(0);
|
|
18
|
+
const [pageCount, setPageCount] = React.useState(0);
|
|
19
|
+
// Expose pageFlip instance and helper methods via ref
|
|
20
|
+
React.useImperativeHandle(ref, () => ({
|
|
21
|
+
pageFlip: () => pageFlip.current,
|
|
22
|
+
flipNext: (corner) => {
|
|
23
|
+
pageFlip.current?.flipNext(corner);
|
|
24
|
+
},
|
|
25
|
+
flipPrev: (corner) => {
|
|
26
|
+
pageFlip.current?.flipPrev(corner);
|
|
27
|
+
},
|
|
28
|
+
flip: (pageNum, corner) => {
|
|
29
|
+
pageFlip.current?.flip(pageNum, corner);
|
|
30
|
+
},
|
|
31
|
+
turnToPage: (pageNum) => {
|
|
32
|
+
pageFlip.current?.turnToPage(pageNum);
|
|
33
|
+
},
|
|
34
|
+
getCurrentPageIndex: () => {
|
|
35
|
+
return pageFlip.current?.getCurrentPageIndex() ?? 0;
|
|
36
|
+
},
|
|
37
|
+
getPageCount: () => {
|
|
38
|
+
return pageFlip.current?.getPageCount() ?? 0;
|
|
39
|
+
},
|
|
40
|
+
getOrientation: () => {
|
|
41
|
+
const o = pageFlip.current?.getOrientation();
|
|
42
|
+
return o;
|
|
43
|
+
},
|
|
44
|
+
getState: () => {
|
|
45
|
+
const s = pageFlip.current?.getState();
|
|
46
|
+
return s;
|
|
47
|
+
},
|
|
48
|
+
}));
|
|
49
|
+
const refreshOnPageDelete = React.useCallback(() => {
|
|
50
|
+
if (pageFlip.current) {
|
|
51
|
+
pageFlip.current.clear();
|
|
52
|
+
}
|
|
53
|
+
}, []);
|
|
54
|
+
const removeHandlers = React.useCallback(() => {
|
|
55
|
+
const flip = pageFlip.current;
|
|
56
|
+
if (flip) {
|
|
57
|
+
flip.off('flip');
|
|
58
|
+
flip.off('changeOrientation');
|
|
59
|
+
flip.off('changeState');
|
|
60
|
+
flip.off('init');
|
|
61
|
+
flip.off('update');
|
|
62
|
+
}
|
|
63
|
+
}, []);
|
|
64
|
+
// Handle children changes
|
|
65
|
+
React.useEffect(() => {
|
|
66
|
+
childRef.current = [];
|
|
67
|
+
if (children) {
|
|
68
|
+
const childArray = React.Children.toArray(children).filter(React.isValidElement);
|
|
69
|
+
const totalChildren = childArray.length;
|
|
70
|
+
const childList = childArray.map((child, index) => {
|
|
71
|
+
if (!React.isValidElement(child))
|
|
72
|
+
return null;
|
|
73
|
+
// Get the density from child props, default to 'soft'
|
|
74
|
+
const childProps = child.props;
|
|
75
|
+
let density = childProps.density || 'soft';
|
|
76
|
+
// If showCover is true, force first and last pages to be hard
|
|
77
|
+
if (showCover) {
|
|
78
|
+
const isFirstPage = index === 0;
|
|
79
|
+
const isLastPage = index === totalChildren - 1;
|
|
80
|
+
if (isFirstPage || isLastPage) {
|
|
81
|
+
density = 'hard';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return React.cloneElement(child, {
|
|
85
|
+
ref: (dom) => {
|
|
86
|
+
if (dom) {
|
|
87
|
+
// Ensure data-density is set correctly on the DOM element
|
|
88
|
+
dom.setAttribute('data-density', density);
|
|
89
|
+
childRef.current[index] = dom;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
})?.filter(Boolean);
|
|
94
|
+
if (!renderOnlyPageLengthChange || pages.length !== childList?.length) {
|
|
95
|
+
if (childList && childList.length < pages.length) {
|
|
96
|
+
refreshOnPageDelete();
|
|
97
|
+
}
|
|
98
|
+
setPages(childList || []);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, [children, renderOnlyPageLengthChange, pages.length, refreshOnPageDelete, showCover]);
|
|
102
|
+
// Initialize PageFlip and handle updates
|
|
103
|
+
React.useEffect(() => {
|
|
104
|
+
const setHandlers = () => {
|
|
105
|
+
const flip = pageFlip.current;
|
|
106
|
+
if (flip) {
|
|
107
|
+
// Always track current page for controls
|
|
108
|
+
flip.on('flip', (e) => {
|
|
109
|
+
const event = e;
|
|
110
|
+
setCurrentPage(event.data);
|
|
111
|
+
if (onFlip) {
|
|
112
|
+
onFlip(e);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
// Always track orientation for CSS classes
|
|
116
|
+
flip.on('changeOrientation', (e) => {
|
|
117
|
+
const event = e;
|
|
118
|
+
setOrientation(event.data);
|
|
119
|
+
if (onChangeOrientation) {
|
|
120
|
+
onChangeOrientation(e);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
if (onChangeState) {
|
|
124
|
+
flip.on('changeState', (e) => onChangeState(e));
|
|
125
|
+
}
|
|
126
|
+
// Always track page count on init
|
|
127
|
+
flip.on('init', (e) => {
|
|
128
|
+
// Get actual page count from the flip instance
|
|
129
|
+
const count = flip.getPageCount();
|
|
130
|
+
setPageCount(count);
|
|
131
|
+
// Set initial page
|
|
132
|
+
setCurrentPage(flip.getCurrentPageIndex());
|
|
133
|
+
if (onInit) {
|
|
134
|
+
onInit(e);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
if (onUpdate) {
|
|
138
|
+
flip.on('update', (e) => onUpdate(e));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
// Filter out any undefined entries and ensure proper order
|
|
143
|
+
const validRefs = childRef.current.filter((ref) => ref !== null && ref !== undefined);
|
|
144
|
+
if (pages.length > 0 && validRefs.length > 0) {
|
|
145
|
+
removeHandlers();
|
|
146
|
+
if (htmlElementRef.current && !pageFlip.current) {
|
|
147
|
+
pageFlip.current = new pageFlip_browser.pageFlip_browserExports.PageFlip(htmlElementRef.current, {
|
|
148
|
+
width,
|
|
149
|
+
height,
|
|
150
|
+
size,
|
|
151
|
+
minWidth,
|
|
152
|
+
maxWidth,
|
|
153
|
+
minHeight,
|
|
154
|
+
maxHeight,
|
|
155
|
+
drawShadow,
|
|
156
|
+
flippingTime,
|
|
157
|
+
usePortrait,
|
|
158
|
+
startZIndex,
|
|
159
|
+
autoSize,
|
|
160
|
+
maxShadowOpacity,
|
|
161
|
+
showCover,
|
|
162
|
+
mobileScrollSupport,
|
|
163
|
+
clickEventForward,
|
|
164
|
+
useMouseEvents,
|
|
165
|
+
swipeDistance,
|
|
166
|
+
showPageCorners,
|
|
167
|
+
disableFlipByClick,
|
|
168
|
+
startPage,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
if (pageFlip.current) {
|
|
172
|
+
// Use requestAnimationFrame to ensure DOM is fully rendered
|
|
173
|
+
requestAnimationFrame(() => {
|
|
174
|
+
if (pageFlip.current) {
|
|
175
|
+
if (!pageFlip.current.getFlipController()) {
|
|
176
|
+
pageFlip.current.loadFromHTML(validRefs);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
pageFlip.current.updateFromHtml(validRefs);
|
|
180
|
+
}
|
|
181
|
+
setHandlers();
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
setHandlers();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return () => {
|
|
190
|
+
removeHandlers();
|
|
191
|
+
};
|
|
192
|
+
}, [
|
|
193
|
+
pages,
|
|
194
|
+
width,
|
|
195
|
+
height,
|
|
196
|
+
size,
|
|
197
|
+
minWidth,
|
|
198
|
+
maxWidth,
|
|
199
|
+
minHeight,
|
|
200
|
+
maxHeight,
|
|
201
|
+
drawShadow,
|
|
202
|
+
flippingTime,
|
|
203
|
+
usePortrait,
|
|
204
|
+
startZIndex,
|
|
205
|
+
autoSize,
|
|
206
|
+
maxShadowOpacity,
|
|
207
|
+
showCover,
|
|
208
|
+
mobileScrollSupport,
|
|
209
|
+
clickEventForward,
|
|
210
|
+
useMouseEvents,
|
|
211
|
+
swipeDistance,
|
|
212
|
+
showPageCorners,
|
|
213
|
+
disableFlipByClick,
|
|
214
|
+
startPage,
|
|
215
|
+
onFlip,
|
|
216
|
+
onChangeOrientation,
|
|
217
|
+
onChangeState,
|
|
218
|
+
onInit,
|
|
219
|
+
onUpdate,
|
|
220
|
+
removeHandlers,
|
|
221
|
+
]);
|
|
222
|
+
// Cleanup on unmount
|
|
223
|
+
React.useEffect(() => {
|
|
224
|
+
return () => {
|
|
225
|
+
if (pageFlip.current) {
|
|
226
|
+
pageFlip.current.destroy();
|
|
227
|
+
pageFlip.current = null;
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}, []);
|
|
231
|
+
// Control handlers
|
|
232
|
+
const handlePrevPage = React.useCallback(() => {
|
|
233
|
+
pageFlip.current?.flipPrev();
|
|
234
|
+
}, []);
|
|
235
|
+
const handleNextPage = React.useCallback(() => {
|
|
236
|
+
pageFlip.current?.flipNext();
|
|
237
|
+
}, []);
|
|
238
|
+
// Build CSS classes
|
|
239
|
+
const cssClasses = [
|
|
240
|
+
'react-magazine',
|
|
241
|
+
`react-magazine--${orientation}`,
|
|
242
|
+
isLoading ? 'react-magazine--loading' : '',
|
|
243
|
+
disabled ? 'react-magazine--disabled' : '',
|
|
244
|
+
className,
|
|
245
|
+
]
|
|
246
|
+
.filter(Boolean)
|
|
247
|
+
.join(' ');
|
|
248
|
+
return (jsxRuntime.jsxs("div", { className: "react-magazine-wrapper", children: [jsxRuntime.jsx("div", { ref: htmlElementRef, className: cssClasses, style: {
|
|
249
|
+
...style,
|
|
250
|
+
pointerEvents: disabled ? 'none' : undefined,
|
|
251
|
+
}, children: pages }), showControls && (jsxRuntime.jsxs("div", { className: `react-magazine-controls ${controlsClassName}`, style: {
|
|
252
|
+
display: 'flex',
|
|
253
|
+
justifyContent: 'center',
|
|
254
|
+
alignItems: 'center',
|
|
255
|
+
gap: '15px',
|
|
256
|
+
marginTop: '8px',
|
|
257
|
+
...controlsStyle,
|
|
258
|
+
}, children: [jsxRuntime.jsxs("button", { className: "react-magazine-controls__btn react-magazine-controls__btn--prev", onClick: handlePrevPage, disabled: currentPage === 0, type: "button", children: [jsxRuntime.jsx(ChevronLeft, {}), jsxRuntime.jsx("span", { children: "Previous" })] }), jsxRuntime.jsxs("span", { className: "react-magazine-controls__page-info", children: ["Page ", currentPage + 1, " of ", pageCount || '...'] }), jsxRuntime.jsxs("button", { className: "react-magazine-controls__btn react-magazine-controls__btn--next", onClick: handleNextPage, disabled: currentPage >= pageCount - 1, type: "button", children: [jsxRuntime.jsx("span", { children: "Next" }), jsxRuntime.jsx(ChevronRight, {})] })] }))] }));
|
|
259
|
+
});
|
|
260
|
+
MagazineBookForward.displayName = 'MagazineBook';
|
|
261
|
+
const MagazineBook = React.memo(MagazineBookForward);
|
|
262
|
+
|
|
263
|
+
exports.MagazineBook = MagazineBook;
|
|
264
|
+
//# sourceMappingURL=MagazineBook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MagazineBook.js","sources":["../../../../src/components/MagazineBook.tsx"],"sourcesContent":[null],"names":["_jsx","forwardRef","useRef","useState","useImperativeHandle","useCallback","useEffect","PageFlip","_jsxs"],"mappings":";;;;;;AAoCA;AACA,MAAM,WAAW,GAAG,OAClBA,cAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,YAC5IA,cAAA,CAAA,UAAA,EAAA,EAAU,MAAM,EAAC,iBAAiB,EAAA,CAAY,EAAA,CAC1C,CACP;AAED,MAAM,YAAY,GAAG,OACnBA,cAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,YAC5IA,cAAA,CAAA,UAAA,EAAA,EAAU,MAAM,EAAC,gBAAgB,EAAA,CAAY,EAAA,CACzC,CACP;AAED,MAAM,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AAA,QAAA,EAAA,EACE,SAAS,EAAC,iEAAiE,EAC3E,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,WAAW,KAAK,CAAC,EAC3B,IAAI,EAAC,QAAQ,EAAA,QAAA,EAAA,CAEbR,cAAA,CAAC,WAAW,EAAA,EAAA,CAAG,EACfA,cAAA,CAAA,MAAA,EAAA,EAAA,QAAA,EAAA,UAAA,EAAA,CAAqB,CAAA,EAAA,CACd,EACTQ,eAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAA,CAAA,OAAA,EAC5C,WAAW,GAAG,CAAC,EAAA,MAAA,EAAM,SAAS,IAAI,KAAK,CAAA,EAAA,CACxC,EACPA,eAAA,CAAA,QAAA,EAAA,EACE,SAAS,EAAC,iEAAiE,EAC3E,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,WAAW,IAAI,SAAS,GAAG,CAAC,EACtC,IAAI,EAAC,QAAQ,aAEbR,cAAA,CAAA,MAAA,EAAA,EAAA,QAAA,EAAA,MAAA,EAAA,CAAiB,EACjBA,cAAA,CAAC,YAAY,KAAG,CAAA,EAAA,CACT,CAAA,EAAA,CACL,CACP,CAAA,EAAA,CACG;AAEV,CAAC,CACF;AAED,mBAAmB,CAAC,WAAW,GAAG,cAAc;AAEzC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,mBAAmB;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Page component for use inside MagazineBook
|
|
8
|
+
* Each page should be wrapped in this component to properly integrate with the flip book
|
|
9
|
+
*/
|
|
10
|
+
const Page = React.forwardRef(({ children, number, density = 'soft', className = '', style = {} }, ref) => {
|
|
11
|
+
return (jsxRuntime.jsx("div", { ref: ref, className: `react-magazine-page ${className}`, "data-density": density, "data-page-number": number, style: {
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100%',
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
...style,
|
|
16
|
+
}, children: children }));
|
|
17
|
+
});
|
|
18
|
+
Page.displayName = 'Page';
|
|
19
|
+
|
|
20
|
+
exports.Page = Page;
|
|
21
|
+
//# sourceMappingURL=Page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page.js","sources":["../../../../src/components/Page.tsx"],"sourcesContent":[null],"names":["forwardRef","_jsx"],"mappings":";;;;;AAGA;;;AAGG;AACI,MAAM,IAAI,GAAGA,gBAAU,CAC5B,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,GAAG,KAAI;AAC1E,IAAA,QACEC,cAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,CAAA,oBAAA,EAAuB,SAAS,EAAE,EAAA,cAAA,EAC/B,OAAO,sBACH,MAAM,EACxB,KAAK,EAAE;AACL,YAAA,KAAK,EAAE,MAAM;AACb,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,SAAS,EAAE,YAAY;AACvB,YAAA,GAAG,KAAK;SACT,EAAA,QAAA,EAEA,QAAQ,EAAA,CACL;AAEV,CAAC;AAGH,IAAI,CAAC,WAAW,GAAG,MAAM;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* PageCover component for hard cover pages (front/back)
|
|
8
|
+
* This is a specialized Page component with density="hard" preset
|
|
9
|
+
*/
|
|
10
|
+
const PageCover = React.forwardRef(({ children, number, position = 'front', className = '', style = {} }, ref) => {
|
|
11
|
+
return (jsxRuntime.jsx("div", { ref: ref, className: `react-magazine-page react-magazine-cover react-magazine-cover--${position} ${className}`, "data-density": "hard", "data-page-number": number, "data-cover-position": position, style: {
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100%',
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
...style,
|
|
16
|
+
}, children: children }));
|
|
17
|
+
});
|
|
18
|
+
PageCover.displayName = 'PageCover';
|
|
19
|
+
|
|
20
|
+
exports.PageCover = PageCover;
|
|
21
|
+
//# sourceMappingURL=PageCover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageCover.js","sources":["../../../../src/components/PageCover.tsx"],"sourcesContent":[null],"names":["forwardRef","_jsx"],"mappings":";;;;;AAGA;;;AAGG;AACI,MAAM,SAAS,GAAGA,gBAAU,CACjC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,GAAG,KAAI;IAC5E,QACEC,wBACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,CAAA,+DAAA,EAAkE,QAAQ,IAAI,SAAS,CAAA,CAAE,kBACvF,MAAM,EAAA,kBAAA,EACD,MAAM,EAAA,qBAAA,EACH,QAAQ,EAC7B,KAAK,EAAE;AACL,YAAA,KAAK,EAAE,MAAM;AACb,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,SAAS,EAAE,YAAY;AACvB,YAAA,GAAG,KAAK;SACT,EAAA,QAAA,EAEA,QAAQ,EAAA,CACL;AAEV,CAAC;AAGH,SAAS,CAAC,WAAW,GAAG,WAAW;;;;"}
|