epub-flow 0.0.5 → 0.0.12
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/README.md +79 -29
- package/fesm2022/epub-flow.mjs +440 -226
- package/fesm2022/epub-flow.mjs.map +1 -1
- package/lib/reader-main/reader-main.component.d.ts +60 -37
- package/lib/shared-mocks/models-mocks.d.ts +56 -0
- package/package.json +1 -1
- package/epub-flow-0.0.5.tgz +0 -0
package/README.md
CHANGED
|
@@ -5,25 +5,33 @@ A premium, feature-rich EPUB reader library for Angular applications. Built with
|
|
|
5
5
|
## ✨ Features
|
|
6
6
|
|
|
7
7
|
- 📖 **Smooth Reading**: Powered by Epub.js for reliable rendering.
|
|
8
|
-
- 🌓 **Aesthetic
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
8
|
+
- 🌓 **Aesthetic Dark Mode**: Support for modern dark aesthetics with `rgb(32 33 32)` background.
|
|
9
|
+
- 🖋️ **Rich Text Notes**: Integrated `ngx-editor` for professionally formatted notes.
|
|
10
|
+
- 📚 **Beautiful TOC**: Hierarchical Table of Contents with smooth navigation.
|
|
11
|
+
- 🖼️ **Cover Preview**: pulse-animated book cover previews during load.
|
|
12
|
+
- 🏷️ **State-Managed Annotations**: Fully event-driven highlights and underlines.
|
|
13
|
+
- 📱 **Responsive**: Mobile-first design that looks great on any device.
|
|
14
|
+
- 🔍 **Advanced Search**: Case-insensitive search with highlighted snippets.
|
|
15
15
|
|
|
16
16
|
## 🚀 Installation
|
|
17
17
|
|
|
18
|
+
Install the package via npm:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install epub-flow --legacy-peer-deps
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Ensure the following peer dependencies are installed:
|
|
25
|
+
|
|
18
26
|
```bash
|
|
19
|
-
npm install
|
|
27
|
+
npm install epubjs ngx-editor @angular/cdk primeng primeicons --save
|
|
20
28
|
```
|
|
21
29
|
|
|
22
30
|
## 🛠 Setup
|
|
23
31
|
|
|
24
32
|
### 1. Import EpubReaderModule
|
|
25
33
|
|
|
26
|
-
Add `EpubReaderModule` to your
|
|
34
|
+
Add `EpubReaderModule` to your module:
|
|
27
35
|
|
|
28
36
|
```typescript
|
|
29
37
|
import { EpubReaderModule } from 'epub-flow';
|
|
@@ -37,8 +45,17 @@ import { EpubReaderModule } from 'epub-flow';
|
|
|
37
45
|
export class AppModule { }
|
|
38
46
|
```
|
|
39
47
|
|
|
40
|
-
### 2. Required Styles
|
|
41
|
-
|
|
48
|
+
### 2. Include Required Styles
|
|
49
|
+
|
|
50
|
+
Add the necessary styles to your `styles.scss` or `angular.json`:
|
|
51
|
+
|
|
52
|
+
```scss
|
|
53
|
+
/* In styles.scss */
|
|
54
|
+
@import "primeicons/primeicons.css";
|
|
55
|
+
@import "primeng/resources/themes/lara-light-blue/theme.css";
|
|
56
|
+
@import "primeng/resources/primeng.min.css";
|
|
57
|
+
@import "ngx-editor/lib/styles/editor.scss";
|
|
58
|
+
```
|
|
42
59
|
|
|
43
60
|
## 📖 Usage
|
|
44
61
|
|
|
@@ -47,35 +64,68 @@ The package is designed to be standalone. You only need to ensure your global `s
|
|
|
47
64
|
<epub-flow [epubUrl]="'assets/books/sample.epub'"></epub-flow>
|
|
48
65
|
```
|
|
49
66
|
|
|
50
|
-
### Advanced Usage
|
|
67
|
+
### Advanced Usage (Event-Driven)
|
|
68
|
+
The component is designed to be stateless regarding annotations, allowing the parent application to manage persistence.
|
|
69
|
+
|
|
51
70
|
```html
|
|
52
71
|
<epub-flow
|
|
53
|
-
[
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
[
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
[bookId]="123"
|
|
73
|
+
[epubUrl]="bookUrl"
|
|
74
|
+
[underlineCfiList]="myUnderlines"
|
|
75
|
+
[highlightCfiList]="myHighlights"
|
|
76
|
+
(underlineAddRequest)="onUnderlineAdd($event)"
|
|
77
|
+
(underlineRemoveRequest)="onUnderlineRemove($event)"
|
|
78
|
+
(highlightAddRequest)="onHighlightAdd($event)"
|
|
79
|
+
(highlightRemoveRequest)="onHighlightRemove($event)">
|
|
61
80
|
</epub-flow>
|
|
62
81
|
```
|
|
63
82
|
|
|
64
|
-
|
|
83
|
+
```typescript
|
|
84
|
+
// Example Handler
|
|
85
|
+
onHighlightAdd(event: {cfi: string, color: string}) {
|
|
86
|
+
console.log('User added highlight:', event.cfi, 'with color:', event.color);
|
|
87
|
+
// 1. Save to your DB via API
|
|
88
|
+
// 2. Update your local 'myHighlights' array to persist across sessions
|
|
89
|
+
}
|
|
90
|
+
```
|
|
65
91
|
|
|
92
|
+
## ⚙️ Configuration
|
|
93
|
+
|
|
94
|
+
### Inputs
|
|
66
95
|
| Input | Type | Default | Description |
|
|
67
96
|
|---|---|---|---|
|
|
68
97
|
| `epubUrl` | `string` | `null` | URL to a remote EPUB file. |
|
|
69
|
-
| `epubBlob` | `Blob` | `null` | Local Blob
|
|
98
|
+
| `epubBlob` | `Blob` | `null` | Local Blob object for direct loading. |
|
|
70
99
|
| `coverPage` | `string` | `null` | URL to a cover image displayed during loading. |
|
|
71
|
-
| `bookId` | `string \| number` | `0` | Unique ID for backend
|
|
100
|
+
| `bookId` | `string \| number` | `0` | Unique ID for backend synchronization. |
|
|
101
|
+
| `underlineCfiList` | `string[]` | `[]` | List of CFIs to be rendered as underlines. |
|
|
102
|
+
| `highlightCfiList` | `{cfi:string, color:string}[]` | `[]` | List of objects to be rendered as highlights. |
|
|
72
103
|
| `enableDarkMode` | `boolean` | `true` | Toggle Dark Mode availability. |
|
|
73
|
-
| `enableSearch` | `boolean` | `true` | Toggle Search tool. |
|
|
74
|
-
| `enableHighlights` | `boolean` | `true` | Toggle Highlighting tools. |
|
|
75
|
-
| `enableBookmarks` | `boolean` | `true` | Toggle Bookmarking. |
|
|
76
|
-
| `
|
|
77
|
-
|
|
78
|
-
|
|
104
|
+
| `enableSearch` | `boolean` | `true` | Toggle the Search tool. |
|
|
105
|
+
| `enableHighlights` | `boolean` | `true` | Toggle Underline/Highlighting tools. |
|
|
106
|
+
| `enableBookmarks` | `boolean` | `true` | Toggle Bookmarking tool. |
|
|
107
|
+
| `enableNotes` | `boolean` | `true` | Toggle Rich Text note creation. |
|
|
108
|
+
|
|
109
|
+
### Outputs
|
|
110
|
+
| Output | Payload | Description |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| `underlineAddRequest` | `{cfi: string}` | Emits when a user selects text to underline. |
|
|
113
|
+
| `underlineRemoveRequest` | `{cfi: string}` | Emits when a user confirms removal of an underline. |
|
|
114
|
+
| `highlightAddRequest` | `{cfi: string, color: string}` | Emits when a user selects a highlight color. |
|
|
115
|
+
| `highlightRemoveRequest` | `{cfi: string}` | Emits when a user confirms removal of a highlight. |
|
|
116
|
+
|
|
117
|
+
## 🛠 Development
|
|
118
|
+
|
|
119
|
+
### Building the library
|
|
120
|
+
```bash
|
|
121
|
+
npx -y @angular/cli build epub-reader
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Creating a package
|
|
125
|
+
```bash
|
|
126
|
+
cd dist/epub-reader
|
|
127
|
+
npm pack
|
|
128
|
+
```
|
|
79
129
|
|
|
80
130
|
## 📄 License
|
|
81
131
|
MIT
|