react-native-readium 1.2.0 → 1.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/README.md +23 -2
- package/lib/src/components/BaseReadiumView.d.ts +2 -0
- package/lib/src/components/BaseReadiumView.js +7 -0
- package/lib/src/components/BaseReadiumView.web.d.ts +1 -0
- package/lib/src/components/BaseReadiumView.web.js +1 -0
- package/lib/{typescript → src}/components/ReadiumView.d.ts +1 -1
- package/lib/src/components/ReadiumView.js +43 -0
- package/lib/src/components/ReadiumView.web.d.ts +5 -0
- package/lib/src/components/ReadiumView.web.js +67 -0
- package/lib/src/enums/Appearance.js +13 -0
- package/lib/src/enums/ColumnCount.js +7 -0
- package/lib/src/enums/FontFamily.js +12 -0
- package/lib/src/enums/TextAlignment.js +6 -0
- package/lib/{module → src}/enums/index.js +0 -1
- package/lib/{module → src}/index.js +0 -1
- package/lib/{typescript/components/BaseReadiumView.d.ts → src/interfaces/BaseReadiumViewProps.d.ts} +5 -3
- package/lib/src/interfaces/BaseReadiumViewProps.js +1 -0
- package/lib/src/interfaces/Dimensions.js +1 -0
- package/lib/src/interfaces/File.js +1 -0
- package/lib/src/interfaces/Link.js +1 -0
- package/lib/src/interfaces/Locator.js +1 -0
- package/lib/src/interfaces/Settings.js +61 -0
- package/lib/{typescript → src}/interfaces/index.d.ts +1 -0
- package/lib/{module → src}/interfaces/index.js +1 -1
- package/lib/{module → src}/utils/COMPONENT_NAME.js +0 -1
- package/lib/src/utils/LINKING_ERROR.js +5 -0
- package/lib/src/utils/RANGES.js +8 -0
- package/lib/src/utils/clamp.js +7 -0
- package/lib/src/utils/createFragment.js +10 -0
- package/lib/src/utils/getWidthOrHeightValue.js +4 -0
- package/lib/{module → src}/utils/index.js +0 -1
- package/lib/src/utils/indexOfObjectValue.js +3 -0
- package/lib/web/hooks/useLocationObserver.d.ts +2 -0
- package/lib/web/hooks/useLocationObserver.js +13 -0
- package/lib/web/hooks/useReaderRef.d.ts +3 -0
- package/lib/web/hooks/useReaderRef.js +48 -0
- package/lib/web/hooks/useSettingsObserver.d.ts +2 -0
- package/lib/web/hooks/useSettingsObserver.js +13 -0
- package/package.json +8 -23
- package/src/components/BaseReadiumView.tsx +1 -14
- package/src/components/BaseReadiumView.web.tsx +1 -0
- package/src/components/ReadiumView.tsx +1 -2
- package/src/{web/ReadiumView.tsx → components/ReadiumView.web.tsx} +1 -1
- package/src/interfaces/BaseReadiumViewProps.ts +18 -0
- package/src/interfaces/index.ts +1 -0
- package/{lib/module/web/hooks/index.js → web/hooks/index.ts} +0 -1
- package/{src/web → web}/hooks/useLocationObserver.ts +1 -3
- package/{src/web → web}/hooks/useReaderRef.ts +20 -17
- package/{src/web → web}/hooks/useSettingsObserver.ts +2 -4
- package/lib/commonjs/components/BaseReadiumView.js +0 -16
- package/lib/commonjs/components/BaseReadiumView.js.map +0 -1
- package/lib/commonjs/components/ReadiumView.js +0 -94
- package/lib/commonjs/components/ReadiumView.js.map +0 -1
- package/lib/commonjs/enums/Appearance.js +0 -16
- package/lib/commonjs/enums/Appearance.js.map +0 -1
- package/lib/commonjs/enums/ColumnCount.js +0 -16
- package/lib/commonjs/enums/ColumnCount.js.map +0 -1
- package/lib/commonjs/enums/FontFamily.js +0 -21
- package/lib/commonjs/enums/FontFamily.js.map +0 -1
- package/lib/commonjs/enums/TextAlignment.js +0 -15
- package/lib/commonjs/enums/TextAlignment.js.map +0 -1
- package/lib/commonjs/enums/index.js +0 -58
- package/lib/commonjs/enums/index.js.map +0 -1
- package/lib/commonjs/index.js +0 -59
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/index.web.js +0 -54
- package/lib/commonjs/index.web.js.map +0 -1
- package/lib/commonjs/interfaces/Dimensions.js +0 -2
- package/lib/commonjs/interfaces/Dimensions.js.map +0 -1
- package/lib/commonjs/interfaces/File.js +0 -6
- package/lib/commonjs/interfaces/File.js.map +0 -1
- package/lib/commonjs/interfaces/Link.js +0 -2
- package/lib/commonjs/interfaces/Link.js.map +0 -1
- package/lib/commonjs/interfaces/Locator.js +0 -2
- package/lib/commonjs/interfaces/Locator.js.map +0 -1
- package/lib/commonjs/interfaces/Settings.js +0 -71
- package/lib/commonjs/interfaces/Settings.js.map +0 -1
- package/lib/commonjs/interfaces/index.js +0 -71
- package/lib/commonjs/interfaces/index.js.map +0 -1
- package/lib/commonjs/utils/COMPONENT_NAME.js +0 -9
- package/lib/commonjs/utils/COMPONENT_NAME.js.map +0 -1
- package/lib/commonjs/utils/LINKING_ERROR.js +0 -15
- package/lib/commonjs/utils/LINKING_ERROR.js.map +0 -1
- package/lib/commonjs/utils/RANGES.js +0 -16
- package/lib/commonjs/utils/RANGES.js.map +0 -1
- package/lib/commonjs/utils/clamp.js +0 -15
- package/lib/commonjs/utils/clamp.js.map +0 -1
- package/lib/commonjs/utils/createFragment.js +0 -21
- package/lib/commonjs/utils/createFragment.js.map +0 -1
- package/lib/commonjs/utils/getWidthOrHeightValue.js +0 -15
- package/lib/commonjs/utils/getWidthOrHeightValue.js.map +0 -1
- package/lib/commonjs/utils/index.js +0 -97
- package/lib/commonjs/utils/index.js.map +0 -1
- package/lib/commonjs/utils/indexOfObjectValue.js +0 -13
- package/lib/commonjs/utils/indexOfObjectValue.js.map +0 -1
- package/lib/commonjs/web/ReadiumView.js +0 -106
- package/lib/commonjs/web/ReadiumView.js.map +0 -1
- package/lib/commonjs/web/hooks/index.js +0 -45
- package/lib/commonjs/web/hooks/index.js.map +0 -1
- package/lib/commonjs/web/hooks/useLocationObserver.js +0 -21
- package/lib/commonjs/web/hooks/useLocationObserver.js.map +0 -1
- package/lib/commonjs/web/hooks/useReaderRef.js +0 -63
- package/lib/commonjs/web/hooks/useReaderRef.js.map +0 -1
- package/lib/commonjs/web/hooks/useSettingsObserver.js +0 -21
- package/lib/commonjs/web/hooks/useSettingsObserver.js.map +0 -1
- package/lib/module/components/BaseReadiumView.js +0 -6
- package/lib/module/components/BaseReadiumView.js.map +0 -1
- package/lib/module/components/ReadiumView.js +0 -75
- package/lib/module/components/ReadiumView.js.map +0 -1
- package/lib/module/enums/Appearance.js +0 -9
- package/lib/module/enums/Appearance.js.map +0 -1
- package/lib/module/enums/ColumnCount.js +0 -9
- package/lib/module/enums/ColumnCount.js.map +0 -1
- package/lib/module/enums/FontFamily.js +0 -14
- package/lib/module/enums/FontFamily.js.map +0 -1
- package/lib/module/enums/TextAlignment.js +0 -8
- package/lib/module/enums/TextAlignment.js.map +0 -1
- package/lib/module/enums/index.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/index.web.js +0 -5
- package/lib/module/index.web.js.map +0 -1
- package/lib/module/interfaces/Dimensions.js +0 -2
- package/lib/module/interfaces/Dimensions.js.map +0 -1
- package/lib/module/interfaces/File.js +0 -2
- package/lib/module/interfaces/File.js.map +0 -1
- package/lib/module/interfaces/Link.js +0 -2
- package/lib/module/interfaces/Link.js.map +0 -1
- package/lib/module/interfaces/Locator.js +0 -2
- package/lib/module/interfaces/Locator.js.map +0 -1
- package/lib/module/interfaces/Settings.js +0 -61
- package/lib/module/interfaces/Settings.js.map +0 -1
- package/lib/module/interfaces/index.js.map +0 -1
- package/lib/module/utils/COMPONENT_NAME.js.map +0 -1
- package/lib/module/utils/LINKING_ERROR.js +0 -6
- package/lib/module/utils/LINKING_ERROR.js.map +0 -1
- package/lib/module/utils/RANGES.js +0 -9
- package/lib/module/utils/RANGES.js.map +0 -1
- package/lib/module/utils/clamp.js +0 -6
- package/lib/module/utils/clamp.js.map +0 -1
- package/lib/module/utils/createFragment.js +0 -10
- package/lib/module/utils/createFragment.js.map +0 -1
- package/lib/module/utils/getWidthOrHeightValue.js +0 -5
- package/lib/module/utils/getWidthOrHeightValue.js.map +0 -1
- package/lib/module/utils/index.js.map +0 -1
- package/lib/module/utils/indexOfObjectValue.js +0 -4
- package/lib/module/utils/indexOfObjectValue.js.map +0 -1
- package/lib/module/web/ReadiumView.js +0 -89
- package/lib/module/web/ReadiumView.js.map +0 -1
- package/lib/module/web/hooks/index.js.map +0 -1
- package/lib/module/web/hooks/useLocationObserver.js +0 -11
- package/lib/module/web/hooks/useLocationObserver.js.map +0 -1
- package/lib/module/web/hooks/useReaderRef.js +0 -50
- package/lib/module/web/hooks/useReaderRef.js.map +0 -1
- package/lib/module/web/hooks/useSettingsObserver.js +0 -11
- package/lib/module/web/hooks/useSettingsObserver.js.map +0 -1
- package/lib/typescript/index.web.d.ts +0 -4
- package/lib/typescript/web/ReadiumView.d.ts +0 -5
- package/lib/typescript/web/hooks/useLocationObserver.d.ts +0 -3
- package/lib/typescript/web/hooks/useReaderRef.d.ts +0 -4
- package/lib/typescript/web/hooks/useSettingsObserver.d.ts +0 -3
- package/src/index.web.tsx +0 -5
- /package/lib/{typescript → src}/enums/Appearance.d.ts +0 -0
- /package/lib/{typescript → src}/enums/ColumnCount.d.ts +0 -0
- /package/lib/{typescript → src}/enums/FontFamily.d.ts +0 -0
- /package/lib/{typescript → src}/enums/TextAlignment.d.ts +0 -0
- /package/lib/{typescript → src}/enums/index.d.ts +0 -0
- /package/lib/{typescript → src}/index.d.ts +0 -0
- /package/lib/{typescript → src}/interfaces/Dimensions.d.ts +0 -0
- /package/lib/{typescript → src}/interfaces/File.d.ts +0 -0
- /package/lib/{typescript → src}/interfaces/Link.d.ts +0 -0
- /package/lib/{typescript → src}/interfaces/Locator.d.ts +0 -0
- /package/lib/{typescript → src}/interfaces/Settings.d.ts +0 -0
- /package/lib/{typescript → src}/utils/COMPONENT_NAME.d.ts +0 -0
- /package/lib/{typescript → src}/utils/LINKING_ERROR.d.ts +0 -0
- /package/lib/{typescript → src}/utils/RANGES.d.ts +0 -0
- /package/lib/{typescript → src}/utils/clamp.d.ts +0 -0
- /package/lib/{typescript → src}/utils/createFragment.d.ts +0 -0
- /package/lib/{typescript → src}/utils/getWidthOrHeightValue.d.ts +0 -0
- /package/lib/{typescript → src}/utils/index.d.ts +0 -0
- /package/lib/{typescript → src}/utils/indexOfObjectValue.d.ts +0 -0
- /package/lib/{typescript/web → web}/hooks/index.d.ts +0 -0
- /package/{src/web/hooks/index.ts → lib/web/hooks/index.js} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { Settings } from './Settings';
|
|
4
|
+
import type { Link } from './Link';
|
|
5
|
+
import type { Locator } from './Locator';
|
|
6
|
+
import type { File } from './File';
|
|
7
|
+
|
|
8
|
+
export type BaseReadiumViewProps = {
|
|
9
|
+
file: File;
|
|
10
|
+
location?: Locator | Link;
|
|
11
|
+
settings?: Partial<Settings>;
|
|
12
|
+
style?: ViewStyle;
|
|
13
|
+
onLocationChange?: (locator: Locator) => void;
|
|
14
|
+
onTableOfContents?: (toc: Link[] | null) => void;
|
|
15
|
+
ref?: any;
|
|
16
|
+
height?: number;
|
|
17
|
+
width?: number;
|
|
18
|
+
};
|
package/src/interfaces/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useDeepCompareEffect } from 'use-deep-compare';
|
|
2
|
-
import type D2Reader from '@d-i-t-a/reader';
|
|
3
|
-
import type { Locator as R2Locator } from '@d-i-t-a/reader';
|
|
4
2
|
|
|
5
|
-
import type { Link, Locator } from '../../interfaces';
|
|
3
|
+
import type { Link, Locator } from '../../src/interfaces';
|
|
6
4
|
|
|
7
5
|
export const useLocationObserver = (
|
|
8
6
|
reader?: D2Reader | null,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
-
import D2Reader from '@d-i-t-a/reader';
|
|
3
2
|
|
|
4
|
-
import type { ReadiumProps } from '../../components/ReadiumView';
|
|
5
|
-
import type { Locator } from '../../interfaces';
|
|
3
|
+
import type { ReadiumProps } from '../../src/components/ReadiumView';
|
|
4
|
+
import type { Locator } from '../../src/interfaces';
|
|
6
5
|
|
|
7
6
|
export const useReaderRef = ({
|
|
8
7
|
file,
|
|
@@ -12,23 +11,27 @@ export const useReaderRef = ({
|
|
|
12
11
|
const readerRef = useRef<D2Reader | null>(null);
|
|
13
12
|
|
|
14
13
|
useEffect(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
async function run() {
|
|
15
|
+
const D2Reader = await import('@d-i-t-a/reader');
|
|
16
|
+
const ref = await D2Reader.load({
|
|
17
|
+
url: new URL(file.url),
|
|
18
|
+
lastReadingPosition: file.initialLocation,
|
|
19
|
+
userSettings: { verticalScroll: false },
|
|
20
|
+
api: {
|
|
21
|
+
updateCurrentLocation: async (location: Locator) => {
|
|
22
|
+
if (onLocationChange) onLocationChange(location);
|
|
23
|
+
return location;
|
|
24
|
+
},
|
|
23
25
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
injectables: injectables,
|
|
27
|
+
});
|
|
28
|
+
|
|
27
29
|
if (onTableOfContents) {
|
|
28
|
-
onTableOfContents(
|
|
30
|
+
onTableOfContents(ref.tableOfContents);
|
|
29
31
|
}
|
|
30
|
-
readerRef.current =
|
|
31
|
-
}
|
|
32
|
+
readerRef.current = ref;
|
|
33
|
+
}
|
|
34
|
+
run();
|
|
32
35
|
}, []);
|
|
33
36
|
|
|
34
37
|
return readerRef
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useDeepCompareEffect } from 'use-deep-compare';
|
|
2
|
-
import type D2Reader from '@d-i-t-a/reader';
|
|
3
|
-
import type { UserSettings } from '@d-i-t-a/reader/dist/types/model/user-settings/UserSettings';
|
|
4
2
|
|
|
5
|
-
import type { Settings } from '../../interfaces';
|
|
3
|
+
import type { Settings } from '../../src/interfaces';
|
|
6
4
|
|
|
7
5
|
export const useSettingsObserver = (
|
|
8
6
|
reader?: D2Reader | null,
|
|
@@ -12,7 +10,7 @@ export const useSettingsObserver = (
|
|
|
12
10
|
if (reader && settings) {
|
|
13
11
|
// @ts-ignore - FIXME need to do some deeper investigation if these
|
|
14
12
|
// are equivalent or not
|
|
15
|
-
reader?.applyUserSettings(settings as Partial<
|
|
13
|
+
reader?.applyUserSettings(settings as Partial<D2UserSettings>);
|
|
16
14
|
}
|
|
17
15
|
}, [
|
|
18
16
|
settings,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.BaseReadiumView = void 0;
|
|
7
|
-
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
|
|
12
|
-
const BaseReadiumView = _reactNative.UIManager.getViewManagerConfig(_utils.COMPONENT_NAME) != null ? (0, _reactNative.requireNativeComponent)(_utils.COMPONENT_NAME) : () => {
|
|
13
|
-
throw new Error(_utils.LINKING_ERROR);
|
|
14
|
-
};
|
|
15
|
-
exports.BaseReadiumView = BaseReadiumView;
|
|
16
|
-
//# sourceMappingURL=BaseReadiumView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["BaseReadiumView.tsx"],"names":["BaseReadiumView","UIManager","getViewManagerConfig","COMPONENT_NAME","Error","LINKING_ERROR"],"mappings":";;;;;;;AAAA;;AAOA;;AAcO,MAAMA,eAAe,GAC1BC,uBAAUC,oBAAV,CAA+BC,qBAA/B,KAAkD,IAAlD,GACI,yCAA6CA,qBAA7C,CADJ,GAEI,MAAM;AACJ,QAAM,IAAIC,KAAJ,CAAUC,oBAAV,CAAN;AACD,CALA","sourcesContent":["import {\n requireNativeComponent,\n UIManager,\n ViewStyle,\n} from 'react-native';\n\nimport type { Settings, Link, Locator, File, } from '../interfaces';\nimport { COMPONENT_NAME, LINKING_ERROR } from '../utils';\n\nexport type BaseReadiumViewProps = {\n file: File;\n location?: Locator | Link;\n settings?: Partial<Settings>;\n style?: ViewStyle;\n onLocationChange?: (locator: Locator) => void;\n onTableOfContents?: (toc: Link[] | null) => void;\n ref?: any;\n height?: number;\n width?: number;\n};\n\nexport const BaseReadiumView =\n UIManager.getViewManagerConfig(COMPONENT_NAME) != null\n ? requireNativeComponent<BaseReadiumViewProps>(COMPONENT_NAME)\n : () => {\n throw new Error(LINKING_ERROR);\n };\n"]}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ReadiumView = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
|
-
var _interfaces = require("../interfaces");
|
|
13
|
-
|
|
14
|
-
var _utils = require("../utils");
|
|
15
|
-
|
|
16
|
-
var _BaseReadiumView = require("./BaseReadiumView");
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
-
|
|
24
|
-
const ReadiumView = _ref => {
|
|
25
|
-
let {
|
|
26
|
-
onLocationChange: wrappedOnLocationChange,
|
|
27
|
-
onTableOfContents: wrappedOnTableOfContents,
|
|
28
|
-
settings: unmappedSettings,
|
|
29
|
-
...props
|
|
30
|
-
} = _ref;
|
|
31
|
-
const ref = (0, _react.useRef)(null);
|
|
32
|
-
const [{
|
|
33
|
-
height,
|
|
34
|
-
width
|
|
35
|
-
}, setDimensions] = (0, _react.useState)({
|
|
36
|
-
width: 0,
|
|
37
|
-
height: 0
|
|
38
|
-
}); // set the view dimensions on layout
|
|
39
|
-
|
|
40
|
-
const onLayout = (0, _react.useCallback)(_ref2 => {
|
|
41
|
-
let {
|
|
42
|
-
nativeEvent: {
|
|
43
|
-
layout: {
|
|
44
|
-
width,
|
|
45
|
-
height
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
} = _ref2;
|
|
49
|
-
setDimensions({
|
|
50
|
-
width: (0, _utils.getWidthOrHeightValue)(width),
|
|
51
|
-
height: (0, _utils.getWidthOrHeightValue)(height)
|
|
52
|
-
});
|
|
53
|
-
}, []); // wrap the native onLocationChange and extract the raw event value
|
|
54
|
-
|
|
55
|
-
const onLocationChange = (0, _react.useCallback)(event => {
|
|
56
|
-
if (wrappedOnLocationChange) {
|
|
57
|
-
wrappedOnLocationChange(event.nativeEvent);
|
|
58
|
-
}
|
|
59
|
-
}, [wrappedOnLocationChange]);
|
|
60
|
-
const onTableOfContents = (0, _react.useCallback)(event => {
|
|
61
|
-
if (wrappedOnTableOfContents) {
|
|
62
|
-
const toc = event.nativeEvent.toc || null;
|
|
63
|
-
wrappedOnTableOfContents(toc);
|
|
64
|
-
}
|
|
65
|
-
}, [wrappedOnTableOfContents]);
|
|
66
|
-
(0, _react.useEffect)(() => {
|
|
67
|
-
if (_reactNative.Platform.OS === 'android') {
|
|
68
|
-
const viewId = (0, _reactNative.findNodeHandle)(ref.current);
|
|
69
|
-
(0, _utils.createFragment)(viewId);
|
|
70
|
-
}
|
|
71
|
-
}, []);
|
|
72
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
73
|
-
style: styles.container,
|
|
74
|
-
onLayout: onLayout
|
|
75
|
-
}, /*#__PURE__*/_react.default.createElement(_BaseReadiumView.BaseReadiumView, _extends({
|
|
76
|
-
height: height,
|
|
77
|
-
width: width
|
|
78
|
-
}, props, {
|
|
79
|
-
onLocationChange: onLocationChange,
|
|
80
|
-
onTableOfContents: onTableOfContents,
|
|
81
|
-
settings: unmappedSettings ? _interfaces.Settings.map(unmappedSettings) : undefined,
|
|
82
|
-
ref: ref
|
|
83
|
-
})));
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
exports.ReadiumView = ReadiumView;
|
|
87
|
-
|
|
88
|
-
const styles = _reactNative.StyleSheet.create({
|
|
89
|
-
container: {
|
|
90
|
-
width: '100%',
|
|
91
|
-
height: '100%'
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
//# sourceMappingURL=ReadiumView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["ReadiumView.tsx"],"names":["ReadiumView","onLocationChange","wrappedOnLocationChange","onTableOfContents","wrappedOnTableOfContents","settings","unmappedSettings","props","ref","height","width","setDimensions","onLayout","nativeEvent","layout","event","toc","Platform","OS","viewId","current","styles","container","Settings","map","undefined","StyleSheet","create"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;AACA;;AAEA;;;;;;;;AAIO,MAAMA,WAAmC,GAAG,QAK7C;AAAA,MAL8C;AAClDC,IAAAA,gBAAgB,EAAEC,uBADgC;AAElDC,IAAAA,iBAAiB,EAAEC,wBAF+B;AAGlDC,IAAAA,QAAQ,EAAEC,gBAHwC;AAIlD,OAAGC;AAJ+C,GAK9C;AACJ,QAAMC,GAAG,GAAG,mBAAO,IAAP,CAAZ;AACA,QAAM,CAAC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAD,EAAoBC,aAApB,IAAqC,qBAAqB;AAC9DD,IAAAA,KAAK,EAAE,CADuD;AAE9DD,IAAAA,MAAM,EAAE;AAFsD,GAArB,CAA3C,CAFI,CAMJ;;AACA,QAAMG,QAAQ,GAAG,wBAAY,SAAwD;AAAA,QAAvD;AAAEC,MAAAA,WAAW,EAAE;AAAEC,QAAAA,MAAM,EAAE;AAAEJ,UAAAA,KAAF;AAASD,UAAAA;AAAT;AAAV;AAAf,KAAuD;AACnFE,IAAAA,aAAa,CAAC;AACZD,MAAAA,KAAK,EAAE,kCAAUA,KAAV,CADK;AAEZD,MAAAA,MAAM,EAAE,kCAAUA,MAAV;AAFI,KAAD,CAAb;AAID,GALgB,EAKd,EALc,CAAjB,CAPI,CAaJ;;AACA,QAAMR,gBAAgB,GAAG,wBAAac,KAAD,IAAgB;AACnD,QAAIb,uBAAJ,EAA6B;AAC3BA,MAAAA,uBAAuB,CAACa,KAAK,CAACF,WAAP,CAAvB;AACD;AACF,GAJwB,EAItB,CAACX,uBAAD,CAJsB,CAAzB;AAMA,QAAMC,iBAAiB,GAAG,wBAAaY,KAAD,IAAgB;AACpD,QAAIX,wBAAJ,EAA8B;AAC5B,YAAMY,GAAG,GAAGD,KAAK,CAACF,WAAN,CAAkBG,GAAlB,IAAyB,IAArC;AACAZ,MAAAA,wBAAwB,CAACY,GAAD,CAAxB;AACD;AACF,GALyB,EAKvB,CAACZ,wBAAD,CALuB,CAA1B;AAOA,wBAAU,MAAM;AACd,QAAIa,sBAASC,EAAT,KAAgB,SAApB,EAA+B;AAC7B,YAAMC,MAAM,GAAG,iCAAeX,GAAG,CAACY,OAAnB,CAAf;AACA,iCAAeD,MAAf;AACD;AACF,GALD,EAKG,EALH;AAOA,sBACE,6BAAC,iBAAD;AACE,IAAA,KAAK,EAAEE,MAAM,CAACC,SADhB;AAEE,IAAA,QAAQ,EAAEV;AAFZ,kBAIE,6BAAC,gCAAD;AACE,IAAA,MAAM,EAAEH,MADV;AAEE,IAAA,KAAK,EAAEC;AAFT,KAGMH,KAHN;AAIE,IAAA,gBAAgB,EAAEN,gBAJpB;AAKE,IAAA,iBAAiB,EAAEE,iBALrB;AAME,IAAA,QAAQ,EAAEG,gBAAgB,GAAGiB,qBAASC,GAAT,CAAalB,gBAAb,CAAH,GAAoCmB,SANhE;AAOE,IAAA,GAAG,EAAEjB;AAPP,KAJF,CADF;AAgBD,CAvDM;;;;AAyDP,MAAMa,MAAM,GAAGK,wBAAWC,MAAX,CAAkB;AAC/BL,EAAAA,SAAS,EAAE;AAAEZ,IAAAA,KAAK,EAAE,MAAT;AAAiBD,IAAAA,MAAM,EAAE;AAAzB;AADoB,CAAlB,CAAf","sourcesContent":["import React, { useCallback, useState, useRef, useEffect } from 'react';\nimport { View, Platform, findNodeHandle, StyleSheet } from 'react-native';\n\nimport type { Dimensions } from '../interfaces';\nimport { Settings } from '../interfaces';\nimport { createFragment, getWidthOrHeightValue as dimension } from '../utils';\nimport type { BaseReadiumViewProps } from './BaseReadiumView';\nimport { BaseReadiumView } from './BaseReadiumView';\n\nexport type ReadiumProps = BaseReadiumViewProps;\n\nexport const ReadiumView: React.FC<ReadiumProps> = ({\n onLocationChange: wrappedOnLocationChange,\n onTableOfContents: wrappedOnTableOfContents,\n settings: unmappedSettings,\n ...props\n}) => {\n const ref = useRef(null);\n const [{ height, width }, setDimensions] = useState<Dimensions>({\n width: 0,\n height: 0,\n });\n // set the view dimensions on layout\n const onLayout = useCallback(({ nativeEvent: { layout: { width, height } }}: any) => {\n setDimensions({\n width: dimension(width),\n height: dimension(height),\n });\n }, []);\n // wrap the native onLocationChange and extract the raw event value\n const onLocationChange = useCallback((event: any) => {\n if (wrappedOnLocationChange) {\n wrappedOnLocationChange(event.nativeEvent);\n }\n }, [wrappedOnLocationChange]);\n\n const onTableOfContents = useCallback((event: any) => {\n if (wrappedOnTableOfContents) {\n const toc = event.nativeEvent.toc || null;\n wrappedOnTableOfContents(toc);\n }\n }, [wrappedOnTableOfContents]);\n\n useEffect(() => {\n if (Platform.OS === 'android') {\n const viewId = findNodeHandle(ref.current);\n createFragment(viewId);\n }\n }, [])\n\n return (\n <View\n style={styles.container}\n onLayout={onLayout}\n >\n <BaseReadiumView\n height={height}\n width={width}\n {...props}\n onLocationChange={onLocationChange}\n onTableOfContents={onTableOfContents}\n settings={unmappedSettings ? Settings.map(unmappedSettings) : undefined}\n ref={ref}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { width: '100%', height: '100%' },\n});\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Appearance = void 0;
|
|
7
|
-
// NOTE: readium uses an index so the order is very important here
|
|
8
|
-
let Appearance;
|
|
9
|
-
exports.Appearance = Appearance;
|
|
10
|
-
|
|
11
|
-
(function (Appearance) {
|
|
12
|
-
Appearance["DEFAULT"] = "readium-default-on";
|
|
13
|
-
Appearance["SEPIA"] = "readium-sepia-on";
|
|
14
|
-
Appearance["NIGHT"] = "readium-night-on";
|
|
15
|
-
})(Appearance || (exports.Appearance = Appearance = {}));
|
|
16
|
-
//# sourceMappingURL=Appearance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["Appearance.ts"],"names":["Appearance"],"mappings":";;;;;;AAAA;IACYA,U;;;WAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;GAAAA,U,0BAAAA,U","sourcesContent":["// NOTE: readium uses an index so the order is very important here\nexport enum Appearance {\n /**\n * A traditional \"light\" mode\n */\n DEFAULT = 'readium-default-on',\n\n SEPIA = 'readium-sepia-on',\n\n /**\n * A traditional \"dark\" mode\n */\n NIGHT = 'readium-night-on',\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ColumnCount = void 0;
|
|
7
|
-
// NOTE: readium uses an index so the order is very important here
|
|
8
|
-
let ColumnCount;
|
|
9
|
-
exports.ColumnCount = ColumnCount;
|
|
10
|
-
|
|
11
|
-
(function (ColumnCount) {
|
|
12
|
-
ColumnCount["AUTO"] = "auto";
|
|
13
|
-
ColumnCount["ONE"] = "1";
|
|
14
|
-
ColumnCount["TWO"] = "2";
|
|
15
|
-
})(ColumnCount || (exports.ColumnCount = ColumnCount = {}));
|
|
16
|
-
//# sourceMappingURL=ColumnCount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["ColumnCount.ts"],"names":["ColumnCount"],"mappings":";;;;;;AAAA;IACYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W","sourcesContent":["// NOTE: readium uses an index so the order is very important here\nexport enum ColumnCount {\n AUTO = 'auto',\n ONE = '1',\n TWO = '2',\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.FontFamily = void 0;
|
|
7
|
-
// NOTE: readium uses an index so the order is very important here
|
|
8
|
-
let FontFamily;
|
|
9
|
-
exports.FontFamily = FontFamily;
|
|
10
|
-
|
|
11
|
-
(function (FontFamily) {
|
|
12
|
-
FontFamily["ORIGINAL"] = "Original";
|
|
13
|
-
FontFamily["HELVETICA_NEUE"] = "Helvetica Neue";
|
|
14
|
-
FontFamily["IOWAN_OLD_STYLE"] = "Iowan Old Style";
|
|
15
|
-
FontFamily["ATHELAS"] = "Athelas";
|
|
16
|
-
FontFamily["SERAVEK"] = "Seravek";
|
|
17
|
-
FontFamily["OPEN_DYSLEXIC"] = "OpenDyslexic";
|
|
18
|
-
FontFamily["ACCESSIBLE_DFA"] = "AccessibleDfA";
|
|
19
|
-
FontFamily["IA_WRITER_DUOSPACE"] = "IA Writer Duospace";
|
|
20
|
-
})(FontFamily || (exports.FontFamily = FontFamily = {}));
|
|
21
|
-
//# sourceMappingURL=FontFamily.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["FontFamily.ts"],"names":["FontFamily"],"mappings":";;;;;;AAAA;IACYA,U;;;WAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;GAAAA,U,0BAAAA,U","sourcesContent":["// NOTE: readium uses an index so the order is very important here\nexport enum FontFamily {\n ORIGINAL = 'Original',\n HELVETICA_NEUE = 'Helvetica Neue',\n IOWAN_OLD_STYLE = 'Iowan Old Style',\n ATHELAS = 'Athelas',\n SERAVEK = 'Seravek',\n OPEN_DYSLEXIC = 'OpenDyslexic',\n ACCESSIBLE_DFA = 'AccessibleDfA',\n IA_WRITER_DUOSPACE = 'IA Writer Duospace',\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TextAlignment = void 0;
|
|
7
|
-
// NOTE: readium uses an index so the order is very important here
|
|
8
|
-
let TextAlignment;
|
|
9
|
-
exports.TextAlignment = TextAlignment;
|
|
10
|
-
|
|
11
|
-
(function (TextAlignment) {
|
|
12
|
-
TextAlignment["JUSTIFY"] = "justify";
|
|
13
|
-
TextAlignment["START"] = "start";
|
|
14
|
-
})(TextAlignment || (exports.TextAlignment = TextAlignment = {}));
|
|
15
|
-
//# sourceMappingURL=TextAlignment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["TextAlignment.ts"],"names":["TextAlignment"],"mappings":";;;;;;AAAA;IACYA,a;;;WAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["// NOTE: readium uses an index so the order is very important here\nexport enum TextAlignment {\n JUSTIFY = 'justify',\n START = 'start',\n}\n"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _Appearance = require("./Appearance");
|
|
8
|
-
|
|
9
|
-
Object.keys(_Appearance).forEach(function (key) {
|
|
10
|
-
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (key in exports && exports[key] === _Appearance[key]) return;
|
|
12
|
-
Object.defineProperty(exports, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _Appearance[key];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
var _ColumnCount = require("./ColumnCount");
|
|
21
|
-
|
|
22
|
-
Object.keys(_ColumnCount).forEach(function (key) {
|
|
23
|
-
if (key === "default" || key === "__esModule") return;
|
|
24
|
-
if (key in exports && exports[key] === _ColumnCount[key]) return;
|
|
25
|
-
Object.defineProperty(exports, key, {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _ColumnCount[key];
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var _FontFamily = require("./FontFamily");
|
|
34
|
-
|
|
35
|
-
Object.keys(_FontFamily).forEach(function (key) {
|
|
36
|
-
if (key === "default" || key === "__esModule") return;
|
|
37
|
-
if (key in exports && exports[key] === _FontFamily[key]) return;
|
|
38
|
-
Object.defineProperty(exports, key, {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _FontFamily[key];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
var _TextAlignment = require("./TextAlignment");
|
|
47
|
-
|
|
48
|
-
Object.keys(_TextAlignment).forEach(function (key) {
|
|
49
|
-
if (key === "default" || key === "__esModule") return;
|
|
50
|
-
if (key in exports && exports[key] === _TextAlignment[key]) return;
|
|
51
|
-
Object.defineProperty(exports, key, {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
get: function () {
|
|
54
|
-
return _TextAlignment[key];
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './Appearance';\nexport * from './ColumnCount';\nexport * from './FontFamily';\nexport * from './TextAlignment';\n"]}
|
package/lib/commonjs/index.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
RANGES: true
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "RANGES", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () {
|
|
12
|
-
return _utils.RANGES;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
var _enums = require("./enums");
|
|
17
|
-
|
|
18
|
-
Object.keys(_enums).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
21
|
-
if (key in exports && exports[key] === _enums[key]) return;
|
|
22
|
-
Object.defineProperty(exports, key, {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () {
|
|
25
|
-
return _enums[key];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
var _interfaces = require("./interfaces");
|
|
31
|
-
|
|
32
|
-
Object.keys(_interfaces).forEach(function (key) {
|
|
33
|
-
if (key === "default" || key === "__esModule") return;
|
|
34
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
35
|
-
if (key in exports && exports[key] === _interfaces[key]) return;
|
|
36
|
-
Object.defineProperty(exports, key, {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _interfaces[key];
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
var _utils = require("./utils");
|
|
45
|
-
|
|
46
|
-
var _ReadiumView = require("./components/ReadiumView");
|
|
47
|
-
|
|
48
|
-
Object.keys(_ReadiumView).forEach(function (key) {
|
|
49
|
-
if (key === "default" || key === "__esModule") return;
|
|
50
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
51
|
-
if (key in exports && exports[key] === _ReadiumView[key]) return;
|
|
52
|
-
Object.defineProperty(exports, key, {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function () {
|
|
55
|
-
return _ReadiumView[key];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './enums';\nexport * from './interfaces';\nexport { RANGES } from './utils';\nexport * from './components/ReadiumView';\n"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
RANGES: true,
|
|
8
|
-
ReadiumView: true
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "RANGES", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _utils.RANGES;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "ReadiumView", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return _ReadiumView.ReadiumView;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
var _enums = require("./enums");
|
|
24
|
-
|
|
25
|
-
Object.keys(_enums).forEach(function (key) {
|
|
26
|
-
if (key === "default" || key === "__esModule") return;
|
|
27
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
-
if (key in exports && exports[key] === _enums[key]) return;
|
|
29
|
-
Object.defineProperty(exports, key, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return _enums[key];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
var _interfaces = require("./interfaces");
|
|
38
|
-
|
|
39
|
-
Object.keys(_interfaces).forEach(function (key) {
|
|
40
|
-
if (key === "default" || key === "__esModule") return;
|
|
41
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
42
|
-
if (key in exports && exports[key] === _interfaces[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _interfaces[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
var _utils = require("./utils");
|
|
52
|
-
|
|
53
|
-
var _ReadiumView = require("./web/ReadiumView");
|
|
54
|
-
//# sourceMappingURL=index.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.web.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAEA","sourcesContent":["export * from './enums';\nexport * from './interfaces';\nexport { RANGES } from './utils';\n\nexport { ReadiumView } from './web/ReadiumView';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Settings = void 0;
|
|
7
|
-
|
|
8
|
-
var _enums = require("../enums");
|
|
9
|
-
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A reader settings object with sensible defaults.
|
|
16
|
-
*/
|
|
17
|
-
class Settings {
|
|
18
|
-
constructor() {
|
|
19
|
-
_defineProperty(this, "appearance", _enums.Appearance.DEFAULT);
|
|
20
|
-
|
|
21
|
-
_defineProperty(this, "fontFamily", _enums.FontFamily.ORIGINAL);
|
|
22
|
-
|
|
23
|
-
_defineProperty(this, "textAlign", _enums.TextAlignment.JUSTIFY);
|
|
24
|
-
|
|
25
|
-
_defineProperty(this, "colCount", _enums.ColumnCount.AUTO);
|
|
26
|
-
|
|
27
|
-
_defineProperty(this, "scroll", false);
|
|
28
|
-
|
|
29
|
-
_defineProperty(this, "fontOverride", false);
|
|
30
|
-
|
|
31
|
-
_defineProperty(this, "verticalScroll", false);
|
|
32
|
-
|
|
33
|
-
_defineProperty(this, "bodyHyphens", false);
|
|
34
|
-
|
|
35
|
-
_defineProperty(this, "advancedSettings", true);
|
|
36
|
-
|
|
37
|
-
_defineProperty(this, "fontSize", 100);
|
|
38
|
-
|
|
39
|
-
_defineProperty(this, "wordSpacing", 0);
|
|
40
|
-
|
|
41
|
-
_defineProperty(this, "letterSpacing", 0);
|
|
42
|
-
|
|
43
|
-
_defineProperty(this, "pageMargins", 0);
|
|
44
|
-
|
|
45
|
-
_defineProperty(this, "lineHeight", 1);
|
|
46
|
-
|
|
47
|
-
_defineProperty(this, "paragraphMargins", 0);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
static map(settings) {
|
|
51
|
-
const defaultValues = new Settings();
|
|
52
|
-
const mapped = {};
|
|
53
|
-
Object.keys(defaultValues).forEach(key => {
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
mapped[key] = settings[key] !== undefined ? settings[key] : defaultValues[key];
|
|
56
|
-
});
|
|
57
|
-
mapped.appearance = (0, _utils.indexOfObjectValue)(_enums.Appearance, mapped.appearance);
|
|
58
|
-
mapped.fontFamily = (0, _utils.indexOfObjectValue)(_enums.FontFamily, mapped.fontFamily);
|
|
59
|
-
mapped.textAlign = (0, _utils.indexOfObjectValue)(_enums.TextAlignment, mapped.textAlign);
|
|
60
|
-
mapped.colCount = (0, _utils.indexOfObjectValue)(_enums.ColumnCount, mapped.colCount);
|
|
61
|
-
Object.keys(_utils.RANGES).forEach(key => {
|
|
62
|
-
// @ts-ignore
|
|
63
|
-
mapped[key] = (0, _utils.clamp)(mapped[key], _utils.RANGES[key][0], _utils.RANGES[key][1]);
|
|
64
|
-
});
|
|
65
|
-
return mapped;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
exports.Settings = Settings;
|
|
71
|
-
//# sourceMappingURL=Settings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["Settings.ts"],"names":["Settings","Appearance","DEFAULT","FontFamily","ORIGINAL","TextAlignment","JUSTIFY","ColumnCount","AUTO","map","settings","defaultValues","mapped","Object","keys","forEach","key","undefined","appearance","fontFamily","textAlign","colCount","RANGES"],"mappings":";;;;;;;AAAA;;AAOA;;;;AAMA;AACA;AACA;AACO,MAAMA,QAAN,CAAe;AAAA;AAAA,wCAIKC,kBAAWC,OAJhB;;AAAA,wCAKKC,kBAAWC,QALhB;;AAAA,uCAMOC,qBAAcC,OANrB;;AAAA,sCAOIC,mBAAYC,IAPhB;;AAAA,oCASF,KATE;;AAAA,0CAUI,KAVJ;;AAAA,4CAWM,KAXN;;AAAA,yCAYG,KAZH;;AAAA,8CAaQ,IAbR;;AAAA,sCAkBD,GAlBC;;AAAA,yCAuBE,CAvBF;;AAAA,2CA4BI,CA5BJ;;AAAA,yCAiCE,CAjCF;;AAAA,wCAsCC,CAtCD;;AAAA,8CA2CQ,CA3CR;AAAA;;AA6CV,SAAHC,GAAG,CAACC,QAAD,EAAmC;AAC3C,UAAMC,aAAa,GAAG,IAAIX,QAAJ,EAAtB;AACA,UAAMY,MAA2B,GAAG,EAApC;AAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYH,aAAZ,EACGI,OADH,CACYC,GAAD,IAAiB;AACxB;AACAJ,MAAAA,MAAM,CAACI,GAAD,CAAN,GAAcN,QAAQ,CAACM,GAAD,CAAR,KAAkBC,SAAlB,GAA8BP,QAAQ,CAACM,GAAD,CAAtC,GAA8CL,aAAa,CAACK,GAAD,CAAzE;AACD,KAJH;AAOAJ,IAAAA,MAAM,CAACM,UAAP,GAAoB,+BAAmBjB,iBAAnB,EAA+BW,MAAM,CAACM,UAAtC,CAApB;AACAN,IAAAA,MAAM,CAACO,UAAP,GAAoB,+BAAmBhB,iBAAnB,EAA+BS,MAAM,CAACO,UAAtC,CAApB;AACAP,IAAAA,MAAM,CAACQ,SAAP,GAAmB,+BAAmBf,oBAAnB,EAAkCO,MAAM,CAACQ,SAAzC,CAAnB;AACAR,IAAAA,MAAM,CAACS,QAAP,GAAkB,+BAAmBd,kBAAnB,EAAgCK,MAAM,CAACS,QAAvC,CAAlB;AAEAR,IAAAA,MAAM,CAACC,IAAP,CAAYQ,aAAZ,EAAoBP,OAApB,CAA6BC,GAAD,IAAiB;AAC3C;AACAJ,MAAAA,MAAM,CAACI,GAAD,CAAN,GAAc,kBAAMJ,MAAM,CAACI,GAAD,CAAZ,EAAmBM,cAAON,GAAP,EAAY,CAAZ,CAAnB,EAAmCM,cAAON,GAAP,EAAY,CAAZ,CAAnC,CAAd;AACD,KAHD;AAKA,WAAOJ,MAAP;AACD;;AAnEmB","sourcesContent":["import {\n Appearance,\n FontFamily,\n TextAlignment,\n ColumnCount,\n} from '../enums';\n\nimport {\n RANGES,\n indexOfObjectValue,\n clamp,\n} from '../utils';\n\n/**\n * A reader settings object with sensible defaults.\n */\nexport class Settings {\n // TODO:\n // - ligatures\n // - paraIndent\n appearance: Appearance = Appearance.DEFAULT;\n fontFamily: FontFamily = FontFamily.ORIGINAL;\n textAlign: TextAlignment = TextAlignment.JUSTIFY;\n colCount: ColumnCount = ColumnCount.AUTO;\n\n scroll: boolean = false;\n fontOverride: boolean = false;\n verticalScroll: boolean = false;\n bodyHyphens: boolean = false;\n advancedSettings: boolean = true;\n\n /**\n * Range: 100.0 - 300.0\n */\n fontSize: number = 100;\n\n /**\n * Range: 0.0 - 0.5\n */\n wordSpacing: number = 0;\n\n /**\n * Range: 0.0 - 0.5\n */\n letterSpacing: number = 0;\n\n /**\n * Range: 0.5 - 4.0\n */\n pageMargins: number = 0;\n\n /**\n * Range: 1.0 - 2.0\n */\n lineHeight: number = 1;\n\n /**\n * Range: 0.0 - 2.0\n */\n paragraphMargins?: number = 0;\n\n static map(settings: Partial<Settings>): any {\n const defaultValues = new Settings();\n const mapped: Record<string, any> = {};\n\n Object.keys(defaultValues)\n .forEach((key: string) => {\n // @ts-ignore\n mapped[key] = settings[key] !== undefined ? settings[key] : defaultValues[key];\n })\n ;\n\n mapped.appearance = indexOfObjectValue(Appearance, mapped.appearance);\n mapped.fontFamily = indexOfObjectValue(FontFamily, mapped.fontFamily);\n mapped.textAlign = indexOfObjectValue(TextAlignment, mapped.textAlign);\n mapped.colCount = indexOfObjectValue(ColumnCount, mapped.colCount);\n\n Object.keys(RANGES).forEach((key: string) => {\n // @ts-ignore\n mapped[key] = clamp(mapped[key], RANGES[key][0], RANGES[key][1]);\n });\n\n return mapped;\n }\n}\n"]}
|