aksos-react-native-epub-reader 0.1.0 → 0.2.1
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/CHANGELOG.md +60 -0
- package/README.md +178 -20
- package/lib/EpubReader.d.ts +66 -15
- package/lib/EpubReader.js +168 -30
- package/lib/EpubReaderView.d.ts +37 -5
- package/lib/EpubReaderView.js +194 -93
- package/lib/cfiOrder.d.ts +2 -0
- package/lib/cfiOrder.js +34 -0
- package/lib/engine/html.js +1 -1
- package/lib/index.d.ts +5 -2
- package/lib/index.js +5 -1
- package/lib/strings.d.ts +94 -0
- package/lib/strings.js +96 -0
- package/lib/themes.d.ts +28 -6
- package/lib/themes.js +80 -20
- package/lib/types.d.ts +82 -1
- package/lib/ui/AppearanceSheet.d.ts +4 -2
- package/lib/ui/AppearanceSheet.js +40 -26
- package/lib/ui/ContentsSheet.d.ts +2 -0
- package/lib/ui/ContentsSheet.js +32 -22
- package/lib/ui/CustomizeSheet.d.ts +4 -2
- package/lib/ui/CustomizeSheet.js +31 -27
- package/lib/ui/HighlightMenu.d.ts +4 -2
- package/lib/ui/HighlightMenu.js +13 -11
- package/lib/ui/NoteEditor.js +12 -9
- package/lib/ui/SearchSheet.js +19 -6
- package/lib/ui/Sheet.js +7 -4
- package/lib/ui/Text.d.ts +9 -0
- package/lib/ui/Text.js +62 -0
- package/package.json +81 -76
- package/src/EpubReader.tsx +239 -43
- package/src/EpubReaderView.tsx +287 -99
- package/src/cfiOrder.ts +28 -0
- package/src/engine/epubcfi.js +527 -0
- package/src/engine/html.ts +1 -1
- package/src/engine/reader.js +1273 -157
- package/src/index.ts +5 -2
- package/src/strings.ts +187 -0
- package/src/themes.ts +97 -21
- package/src/types.ts +88 -2
- package/src/ui/AppearanceSheet.tsx +47 -29
- package/src/ui/ContentsSheet.tsx +34 -22
- package/src/ui/CustomizeSheet.tsx +27 -21
- package/src/ui/HighlightMenu.tsx +17 -13
- package/src/ui/NoteEditor.tsx +12 -9
- package/src/ui/SearchSheet.tsx +22 -5
- package/src/ui/Sheet.tsx +8 -5
- package/src/ui/Text.tsx +27 -0
package/lib/ui/Text.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TextInput = exports.UiFontsContext = void 0;
|
|
37
|
+
exports.Text = Text;
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const react_native_1 = require("react-native");
|
|
40
|
+
exports.UiFontsContext = (0, react_1.createContext)(null);
|
|
41
|
+
/** Text of the reader's interface. Uses the host's `uiFonts` when given; a style with its own fontFamily keeps it. */
|
|
42
|
+
function Text(props) {
|
|
43
|
+
const fonts = (0, react_1.useContext)(exports.UiFontsContext);
|
|
44
|
+
if (!fonts)
|
|
45
|
+
return react_1.default.createElement(react_native_1.Text, { ...props });
|
|
46
|
+
const flat = react_native_1.StyleSheet.flatten(props.style) || {};
|
|
47
|
+
if (flat.fontFamily)
|
|
48
|
+
return react_1.default.createElement(react_native_1.Text, { ...props });
|
|
49
|
+
const weight = flat.fontWeight === 'bold' ? 700 : Number(flat.fontWeight) || 400;
|
|
50
|
+
// a font file per weight: the weight is in the family, so the style's weight must not be applied again
|
|
51
|
+
const family = (weight >= 600 && fonts.bold) || (weight >= 500 && fonts.medium) || null;
|
|
52
|
+
const style = family ? { fontFamily: family, fontWeight: 'normal' } : { fontFamily: fonts.regular };
|
|
53
|
+
return react_1.default.createElement(react_native_1.Text, { ...props, style: [props.style, style] });
|
|
54
|
+
}
|
|
55
|
+
/** Text field of the reader's interface, in the host's regular `uiFonts` font when given. */
|
|
56
|
+
exports.TextInput = (0, react_1.forwardRef)(function TextInput(props, ref) {
|
|
57
|
+
const fonts = (0, react_1.useContext)(exports.UiFontsContext);
|
|
58
|
+
const flat = react_native_1.StyleSheet.flatten(props.style) || {};
|
|
59
|
+
if (!fonts || flat.fontFamily)
|
|
60
|
+
return react_1.default.createElement(react_native_1.TextInput, { ref: ref, ...props });
|
|
61
|
+
return react_1.default.createElement(react_native_1.TextInput, { ref: ref, ...props, style: [props.style, { fontFamily: fonts.regular }] });
|
|
62
|
+
});
|
package/package.json
CHANGED
|
@@ -1,76 +1,81 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name":
|
|
3
|
-
"version":
|
|
4
|
-
"description":
|
|
5
|
-
"keywords":
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"license":
|
|
21
|
-
"main":
|
|
22
|
-
"types":
|
|
23
|
-
"react-native":
|
|
24
|
-
"source":
|
|
25
|
-
"files":
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "aksos-react-native-epub-reader",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "A complete EPUB reader for React Native and Expo: page curl and slide, themes, highlights, notes, bookmarks, search, line guide, and full right-to-left support (Pashto, Dari, Persian, Arabic, Urdu).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"expo",
|
|
8
|
+
"epub",
|
|
9
|
+
"ebook",
|
|
10
|
+
"reader",
|
|
11
|
+
"book",
|
|
12
|
+
"pashto",
|
|
13
|
+
"dari",
|
|
14
|
+
"persian",
|
|
15
|
+
"arabic",
|
|
16
|
+
"rtl",
|
|
17
|
+
"highlight",
|
|
18
|
+
"page-curl"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"main": "lib/index.js",
|
|
22
|
+
"types": "lib/index.d.ts",
|
|
23
|
+
"react-native": "src/index.ts",
|
|
24
|
+
"source": "src/index.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"src",
|
|
27
|
+
"lib",
|
|
28
|
+
"README.md",
|
|
29
|
+
"CHANGELOG.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build:engine": "node scripts/build-engine.js",
|
|
34
|
+
"build:lib": "node scripts/build-lib.js",
|
|
35
|
+
"typecheck": "tsc -p tsconfig.build.json --noEmit",
|
|
36
|
+
"prepublishOnly": "npm run build:engine && npm run build:lib",
|
|
37
|
+
"test:harness": "node test/serve.js",
|
|
38
|
+
"test:compat": "node scripts/build-engine.js && node test/compat/make-books.js && node test/compat/run.js",
|
|
39
|
+
"test:features": "node scripts/build-engine.js && node test/compat/make-books.js && node test/compat/features.js"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"expo-audio": "*",
|
|
43
|
+
"expo-blur": "*",
|
|
44
|
+
"expo-screen-orientation": "*",
|
|
45
|
+
"react": ">=18",
|
|
46
|
+
"react-native": ">=0.73",
|
|
47
|
+
"react-native-svg": ">=13",
|
|
48
|
+
"react-native-webview": ">=13"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"expo-audio": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"expo-blur": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"expo-screen-orientation": {
|
|
58
|
+
"optional": true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/react": "^18.3.0",
|
|
63
|
+
"epubjs": "0.3.93",
|
|
64
|
+
"jszip": "3.10.1",
|
|
65
|
+
"puppeteer-core": "^23.11.1",
|
|
66
|
+
"react": "18.3.1",
|
|
67
|
+
"react-native": "0.76.5",
|
|
68
|
+
"react-native-svg": "15.9.0",
|
|
69
|
+
"react-native-webview": "13.12.5",
|
|
70
|
+
"typescript": "^5.6.0"
|
|
71
|
+
},
|
|
72
|
+
"author": "Aksos",
|
|
73
|
+
"homepage": "https://github.com/AhmadNasary/aksos-react-native-epub-reader#readme",
|
|
74
|
+
"repository": {
|
|
75
|
+
"type": "git",
|
|
76
|
+
"url": "git+https://github.com/AhmadNasary/aksos-react-native-epub-reader.git"
|
|
77
|
+
},
|
|
78
|
+
"bugs": {
|
|
79
|
+
"url": "https://github.com/AhmadNasary/aksos-react-native-epub-reader/issues"
|
|
80
|
+
}
|
|
81
|
+
}
|