react-native-readium 1.0.1 → 1.0.3
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 +1 -1
- package/android/src/main/AndroidManifest.xml +4 -2
- package/android/src/main/java/com/reactnativereadium/ReadiumView.kt +3 -3
- package/android/src/main/java/com/reactnativereadium/ReadiumViewManager.kt +31 -8
- package/android/src/main/java/com/reactnativereadium/reader/BaseReaderFragment.kt +16 -2
- package/android/src/main/java/com/reactnativereadium/reader/ReaderService.kt +23 -2
- package/android/src/main/java/com/reactnativereadium/utils/File.kt +1 -3
- package/android/src/main/java/com/reactnativereadium/utils/LinkOrLocator.kt +9 -0
- package/android/src/main/res/xml/network_security_config.xml +11 -0
- package/ios/Reader/ReaderService.swift +31 -1
- package/ios/ReadiumView.swift +9 -13
- package/lib/commonjs/components/BaseReadiumView.js.map +1 -1
- package/lib/commonjs/components/ReadiumView.js +1 -1
- package/lib/commonjs/components/ReadiumView.js.map +1 -1
- package/lib/commonjs/enums/Appearance.js.map +1 -1
- package/lib/commonjs/enums/ColumnCount.js.map +1 -1
- package/lib/commonjs/enums/FontFamily.js.map +1 -1
- package/lib/commonjs/enums/TextAlignment.js.map +1 -1
- package/lib/commonjs/enums/index.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/Dimensions.js.map +1 -1
- package/lib/commonjs/interfaces/File.js.map +1 -1
- package/lib/commonjs/interfaces/Link.js.map +1 -1
- package/lib/commonjs/interfaces/Locator.js.map +1 -1
- package/lib/commonjs/interfaces/Settings.js.map +1 -1
- package/lib/commonjs/interfaces/index.js.map +1 -1
- package/lib/commonjs/utils/COMPONENT_NAME.js.map +1 -1
- package/lib/commonjs/utils/LINKING_ERROR.js.map +1 -1
- package/lib/commonjs/utils/RANGES.js.map +1 -1
- package/lib/commonjs/utils/clamp.js.map +1 -1
- package/lib/commonjs/utils/createFragment.js.map +1 -1
- package/lib/commonjs/utils/getWidthOrHeightValue.js.map +1 -1
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/indexOfObjectValue.js.map +1 -1
- package/lib/module/components/BaseReadiumView.js.map +1 -1
- package/lib/module/components/ReadiumView.js +1 -1
- package/lib/module/components/ReadiumView.js.map +1 -1
- package/lib/module/enums/Appearance.js.map +1 -1
- package/lib/module/enums/ColumnCount.js.map +1 -1
- package/lib/module/enums/FontFamily.js.map +1 -1
- package/lib/module/enums/TextAlignment.js.map +1 -1
- package/lib/module/enums/index.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/Dimensions.js.map +1 -1
- package/lib/module/interfaces/File.js.map +1 -1
- package/lib/module/interfaces/Link.js.map +1 -1
- package/lib/module/interfaces/Locator.js.map +1 -1
- package/lib/module/interfaces/Settings.js.map +1 -1
- package/lib/module/interfaces/index.js.map +1 -1
- package/lib/module/utils/COMPONENT_NAME.js.map +1 -1
- package/lib/module/utils/LINKING_ERROR.js.map +1 -1
- package/lib/module/utils/RANGES.js.map +1 -1
- package/lib/module/utils/clamp.js.map +1 -1
- package/lib/module/utils/createFragment.js.map +1 -1
- package/lib/module/utils/getWidthOrHeightValue.js.map +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/indexOfObjectValue.js.map +1 -1
- package/lib/typescript/components/BaseReadiumView.d.ts +1 -1
- package/lib/typescript/interfaces/File.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/BaseReadiumView.tsx +1 -1
- package/src/interfaces/File.ts +2 -1
package/README.md
CHANGED
|
@@ -154,7 +154,7 @@ DRM is not supported at this time. However, there is a clear path to [support it
|
|
|
154
154
|
| Name | Type | Optional | Description |
|
|
155
155
|
|------|------|----------|-------------|
|
|
156
156
|
| `file` | [`File`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/File.ts) | :x: | A file object containing the path to the eBook file on disk. |
|
|
157
|
-
| `location` | [`Locator`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/Locator.ts)
|
|
157
|
+
| `location` | [`Locator`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/Locator.ts) | [`Link`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/Link.ts) | :white_check_mark: | A locator prop that allows you to externally control the location of the reader (e.g. Chapters or Bookmarks)|
|
|
158
158
|
| `settings` | [`Partial<Settings>`](https://github.com/5-stones/react-native-readium/blob/main/src/interfaces/Settings.ts) | :white_check_mark: | An object that allows you to control various aspects of the reader's UI (epub only) |
|
|
159
159
|
| `style` | `ViewStyle` | :white_check_mark: | A traditional style object. |
|
|
160
160
|
| `onLocationChange` | `(locator: Locator) => void` | :white_check_mark: | A callback that fires whenever the location is changed (e.g. the user transitions to a new page)|
|
|
@@ -11,8 +11,8 @@ import com.reactnativereadium.reader.EpubReaderFragment
|
|
|
11
11
|
import com.reactnativereadium.reader.ReaderViewModel
|
|
12
12
|
import com.reactnativereadium.utils.Dimensions
|
|
13
13
|
import com.reactnativereadium.utils.File
|
|
14
|
+
import com.reactnativereadium.utils.LinkOrLocator
|
|
14
15
|
import org.readium.r2.shared.extensions.toMap
|
|
15
|
-
import org.readium.r2.shared.publication.Locator
|
|
16
16
|
|
|
17
17
|
class ReadiumView(
|
|
18
18
|
val reactContext: ThemedReactContext
|
|
@@ -22,11 +22,11 @@ class ReadiumView(
|
|
|
22
22
|
var fragment: BaseReaderFragment? = null
|
|
23
23
|
var isViewInitialized: Boolean = false
|
|
24
24
|
|
|
25
|
-
fun updateLocation(
|
|
25
|
+
fun updateLocation(location: LinkOrLocator) : Boolean {
|
|
26
26
|
if (fragment == null) {
|
|
27
27
|
return false
|
|
28
28
|
} else {
|
|
29
|
-
return this.fragment!!.go(
|
|
29
|
+
return this.fragment!!.go(location, true)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -8,11 +8,12 @@ import com.facebook.react.uimanager.ThemedReactContext
|
|
|
8
8
|
import com.facebook.react.uimanager.ViewGroupManager
|
|
9
9
|
import com.reactnativereadium.reader.ReaderService
|
|
10
10
|
import com.reactnativereadium.utils.File
|
|
11
|
+
import com.reactnativereadium.utils.LinkOrLocator
|
|
11
12
|
import kotlinx.coroutines.runBlocking
|
|
12
13
|
import org.json.JSONObject
|
|
14
|
+
import org.readium.r2.shared.publication.Link
|
|
13
15
|
import org.readium.r2.shared.publication.Locator
|
|
14
16
|
|
|
15
|
-
|
|
16
17
|
class ReadiumViewManager(
|
|
17
18
|
val reactContext: ReactApplicationContext
|
|
18
19
|
) : ViewGroupManager<ReadiumView>() {
|
|
@@ -69,23 +70,45 @@ class ReadiumViewManager(
|
|
|
69
70
|
fun setFile(view: ReadiumView, file: ReadableMap) {
|
|
70
71
|
val path = (file.getString("url") ?: "")
|
|
71
72
|
.replace("^(file:/+)?(/.*)$".toRegex(), "$2")
|
|
72
|
-
val
|
|
73
|
-
var initialLocation:
|
|
73
|
+
val location = file.getMap("initialLocation")
|
|
74
|
+
var initialLocation: LinkOrLocator? = null
|
|
74
75
|
|
|
75
|
-
if (
|
|
76
|
-
initialLocation =
|
|
76
|
+
if (location != null) {
|
|
77
|
+
initialLocation = locationToLinkOrLocator(location)
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
view.file = File(path, initialLocation)
|
|
80
81
|
this.buildForViewIfReady(view)
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
fun locationToLinkOrLocator(location: ReadableMap): LinkOrLocator? {
|
|
85
|
+
val json = JSONObject(location.toHashMap())
|
|
86
|
+
val hasLocations = json.has("locations")
|
|
87
|
+
val hasChildren = json.has("children")
|
|
88
|
+
val hasHashHref = (json.get("href") as String).contains("#")
|
|
89
|
+
var linkOrLocator: LinkOrLocator? = null
|
|
90
|
+
|
|
91
|
+
if ((hasChildren || hasHashHref) && !hasLocations) {
|
|
92
|
+
val link = Link.fromJSON(json)
|
|
93
|
+
if (link != null) {
|
|
94
|
+
linkOrLocator = LinkOrLocator.Link(link)
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
val locator = Locator.fromJSON(json)
|
|
98
|
+
if (locator != null) {
|
|
99
|
+
linkOrLocator = LinkOrLocator.Locator(locator)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return linkOrLocator;
|
|
104
|
+
}
|
|
105
|
+
|
|
83
106
|
@ReactProp(name = "location")
|
|
84
107
|
fun setLocation(view: ReadiumView, location: ReadableMap) {
|
|
85
|
-
|
|
108
|
+
var linkOrLocator: LinkOrLocator? = locationToLinkOrLocator(location)
|
|
86
109
|
|
|
87
|
-
if (
|
|
88
|
-
view.updateLocation(
|
|
110
|
+
if (linkOrLocator != null) {
|
|
111
|
+
view.updateLocation(linkOrLocator)
|
|
89
112
|
}
|
|
90
113
|
}
|
|
91
114
|
|
|
@@ -4,13 +4,13 @@ import android.os.Bundle
|
|
|
4
4
|
import android.view.*
|
|
5
5
|
import androidx.fragment.app.Fragment
|
|
6
6
|
import androidx.lifecycle.lifecycleScope
|
|
7
|
+
import com.reactnativereadium.utils.LinkOrLocator
|
|
7
8
|
import kotlinx.coroutines.flow.launchIn
|
|
8
9
|
import kotlinx.coroutines.flow.onEach
|
|
9
10
|
import org.readium.r2.navigator.*
|
|
10
11
|
import org.readium.r2.shared.publication.Locator
|
|
11
12
|
import com.reactnativereadium.utils.EventChannel
|
|
12
13
|
import kotlinx.coroutines.channels.Channel
|
|
13
|
-
import org.readium.r2.shared.publication.Link
|
|
14
14
|
|
|
15
15
|
/*
|
|
16
16
|
* Base reader fragment class
|
|
@@ -49,7 +49,21 @@ abstract class BaseReaderFragment : Fragment() {
|
|
|
49
49
|
requireActivity().invalidateOptionsMenu()
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
fun go(
|
|
52
|
+
fun go(location: LinkOrLocator, animated: Boolean): Boolean {
|
|
53
|
+
var locator: Locator? = null
|
|
54
|
+
when (location) {
|
|
55
|
+
is LinkOrLocator.Link -> {
|
|
56
|
+
locator = navigator.publication.locatorFromLink(location.link)
|
|
57
|
+
}
|
|
58
|
+
is LinkOrLocator.Locator -> {
|
|
59
|
+
locator = location.locator
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (locator == null) {
|
|
64
|
+
return false
|
|
65
|
+
}
|
|
66
|
+
|
|
53
67
|
// don't attempt to navigate if we're already there
|
|
54
68
|
val currentLocator = navigator.currentLocator.value
|
|
55
69
|
if (locator.hashCode() == currentLocator.hashCode()) {
|
|
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
|
|
4
4
|
import androidx.lifecycle.ViewModelStore
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.util.RNLog
|
|
7
|
+
import com.reactnativereadium.utils.LinkOrLocator
|
|
7
8
|
import java.io.File
|
|
8
9
|
import java.io.IOException
|
|
9
10
|
import java.net.ServerSocket
|
|
@@ -46,9 +47,28 @@ class ReaderService(
|
|
|
46
47
|
this.startServer()
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
fun locatorFromLinkOrLocator(
|
|
51
|
+
location: LinkOrLocator?,
|
|
52
|
+
publication: Publication,
|
|
53
|
+
): Locator? {
|
|
54
|
+
|
|
55
|
+
if (location == null) return null
|
|
56
|
+
|
|
57
|
+
when (location) {
|
|
58
|
+
is LinkOrLocator.Link -> {
|
|
59
|
+
return publication.locatorFromLink(location.link)
|
|
60
|
+
}
|
|
61
|
+
is LinkOrLocator.Locator -> {
|
|
62
|
+
return location.locator
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return null
|
|
67
|
+
}
|
|
68
|
+
|
|
49
69
|
suspend fun openPublication(
|
|
50
70
|
fileName: String,
|
|
51
|
-
initialLocation:
|
|
71
|
+
initialLocation: LinkOrLocator?,
|
|
52
72
|
callback: suspend (fragment: BaseReaderFragment) -> Unit
|
|
53
73
|
) {
|
|
54
74
|
val file = File(fileName)
|
|
@@ -62,8 +82,9 @@ class ReaderService(
|
|
|
62
82
|
.onSuccess {
|
|
63
83
|
val url = prepareToServe(it)
|
|
64
84
|
if (url != null) {
|
|
85
|
+
val locator = locatorFromLinkOrLocator(initialLocation, it)
|
|
65
86
|
val readerFragment = EpubReaderFragment.newInstance(url)
|
|
66
|
-
readerFragment.initFactory(it,
|
|
87
|
+
readerFragment.initFactory(it, locator)
|
|
67
88
|
callback.invoke(readerFragment)
|
|
68
89
|
}
|
|
69
90
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
package com.reactnativereadium.utils
|
|
2
|
+
|
|
3
|
+
import org.readium.r2.shared.publication.Link as BaseLink
|
|
4
|
+
import org.readium.r2.shared.publication.Locator as BaseLocator
|
|
5
|
+
|
|
6
|
+
sealed class LinkOrLocator {
|
|
7
|
+
class Link(val link: BaseLink): LinkOrLocator()
|
|
8
|
+
class Locator(val locator: BaseLocator): LinkOrLocator()
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<network-security-config>
|
|
3
|
+
<domain-config cleartextTrafficPermitted="true">
|
|
4
|
+
<!--
|
|
5
|
+
Required with r2-navigator-kotlin
|
|
6
|
+
Used to serve a publication's resources from the local HTTP server
|
|
7
|
+
-->
|
|
8
|
+
<domain includeSubdomains="false">127.0.0.1</domain>
|
|
9
|
+
<domain includeSubdomains="false">localhost</domain>
|
|
10
|
+
</domain-config>
|
|
11
|
+
</network-security-config>
|
|
@@ -19,11 +19,40 @@ final class ReaderService: Loggable {
|
|
|
19
19
|
print(error)
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
static func locatorFromLocation(
|
|
24
|
+
_ location: NSDictionary?,
|
|
25
|
+
_ publication: Publication?
|
|
26
|
+
) -> Locator? {
|
|
27
|
+
guard location != nil else {
|
|
28
|
+
return nil
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let hasLocations = location?["locations"] != nil
|
|
32
|
+
let hasChildren = location?["children"] != nil
|
|
33
|
+
let hasHashHref = (location!["href"] as! String).contains("#")
|
|
34
|
+
|
|
35
|
+
// check that we're not dealing with a Link
|
|
36
|
+
if ((hasChildren || hasHashHref) && !hasLocations) {
|
|
37
|
+
guard let publication = publication else {
|
|
38
|
+
return nil
|
|
39
|
+
}
|
|
40
|
+
guard let link = try? Link(json: location) else {
|
|
41
|
+
return nil
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return publication.locate(link)
|
|
45
|
+
} else {
|
|
46
|
+
return try? Locator(json: location)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return nil
|
|
50
|
+
}
|
|
22
51
|
|
|
23
52
|
func buildViewController(
|
|
24
53
|
url: String,
|
|
25
54
|
bookId: String,
|
|
26
|
-
|
|
55
|
+
location: NSDictionary?,
|
|
27
56
|
sender: UIViewController?,
|
|
28
57
|
completion: @escaping (ReaderViewController) -> Void
|
|
29
58
|
) {
|
|
@@ -37,6 +66,7 @@ final class ReaderService: Loggable {
|
|
|
37
66
|
},
|
|
38
67
|
receiveValue: { pub in
|
|
39
68
|
self.preparePresentation(of: pub)
|
|
69
|
+
let locator: Locator? = ReaderService.locatorFromLocation(location, pub)
|
|
40
70
|
let vc = reader.getViewController(
|
|
41
71
|
for: pub,
|
|
42
72
|
bookId: bookId,
|
package/ios/ReadiumView.swift
CHANGED
|
@@ -17,12 +17,9 @@ class ReadiumView : UIView, Loggable {
|
|
|
17
17
|
|
|
18
18
|
@objc var file: NSDictionary? = nil {
|
|
19
19
|
didSet {
|
|
20
|
-
|
|
21
|
-
location = initialLocation
|
|
22
|
-
}
|
|
23
|
-
|
|
20
|
+
let initialLocation = file?["initialLocation"] as? NSDictionary
|
|
24
21
|
if let url = file?["url"] as? String {
|
|
25
|
-
self.loadBook(url: url)
|
|
22
|
+
self.loadBook(url: url, location: initialLocation)
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
}
|
|
@@ -39,27 +36,26 @@ class ReadiumView : UIView, Loggable {
|
|
|
39
36
|
@objc var onLocationChange: RCTDirectEventBlock?
|
|
40
37
|
@objc var onTableOfContents: RCTDirectEventBlock?
|
|
41
38
|
|
|
42
|
-
func loadBook(
|
|
39
|
+
func loadBook(
|
|
40
|
+
url: String,
|
|
41
|
+
location: NSDictionary?
|
|
42
|
+
) {
|
|
43
43
|
guard let rootViewController = UIApplication.shared.delegate?.window??.rootViewController else { return }
|
|
44
|
-
let locator: Locator? = self.getLocator()
|
|
45
44
|
|
|
46
45
|
self.readerService.buildViewController(
|
|
47
46
|
url: url,
|
|
48
47
|
bookId: url,
|
|
49
|
-
|
|
48
|
+
location: location,
|
|
50
49
|
sender: rootViewController,
|
|
51
50
|
completion: { vc in
|
|
52
51
|
self.addViewControllerAsSubview(vc)
|
|
52
|
+
self.location = location
|
|
53
53
|
}
|
|
54
54
|
)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
func getLocator() -> Locator? {
|
|
58
|
-
|
|
59
|
-
return try? Locator(json: location)
|
|
60
|
-
} else {
|
|
61
|
-
return nil
|
|
62
|
-
}
|
|
58
|
+
return ReaderService.locatorFromLocation(location, readerViewController?.publication)
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
func updateLocation() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseReadiumView","UIManager","getViewManagerConfig","COMPONENT_NAME","
|
|
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"]}
|
|
@@ -19,7 +19,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
19
19
|
|
|
20
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
21
|
|
|
22
|
-
function _extends() { _extends = Object.assign
|
|
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
23
|
|
|
24
24
|
const ReadiumView = _ref => {
|
|
25
25
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReadiumView","onLocationChange","wrappedOnLocationChange","onTableOfContents","wrappedOnTableOfContents","settings","unmappedSettings","props","ref","
|
|
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,SAAmD;AAAA,QAAlD;AAAEC,MAAAA,WAAW,EAAE;AAAEC,QAAAA,MAAM,EAAE;AAAEJ,UAAAA,KAAF;AAASD,UAAAA;AAAT;AAAV;AAAf,KAAkD;AAC9EE,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\ntype 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 } }}) => {\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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Settings","Appearance","DEFAULT","FontFamily","ORIGINAL","TextAlignment","JUSTIFY","ColumnCount","AUTO","map","settings","defaultValues","mapped","Object","keys","forEach","key","undefined","appearance","
|
|
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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './Dimensions';\nexport * from './File';\nexport * from './Link';\nexport * from './Locator';\nexport * from './Settings';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["COMPONENT_NAME.ts"],"names":["COMPONENT_NAME"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAG,aAAvB","sourcesContent":["export const COMPONENT_NAME = 'ReadiumView';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default"],"
|
|
1
|
+
{"version":3,"sources":["LINKING_ERROR.ts"],"names":["LINKING_ERROR","Platform","select","ios","default"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,aAAa,GACvB,+EAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJK","sourcesContent":["import { Platform } from 'react-native';\n\nexport const LINKING_ERROR =\n `The package 'react-native-readium' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RANGES","fontSize","wordSpacing","letterSpacing","pageMargins","lineHeight","paragraphMargins"],"
|
|
1
|
+
{"version":3,"sources":["RANGES.ts"],"names":["RANGES","fontSize","wordSpacing","letterSpacing","pageMargins","lineHeight","paragraphMargins"],"mappings":";;;;;;AAAO,MAAMA,MAAM,GAAG;AACpBC,EAAAA,QAAQ,EAAU,CAAC,KAAD,EAAQ,KAAR,CADE;AAEpBC,EAAAA,WAAW,EAAO,CAAC,GAAD,EAAM,GAAN,CAFE;AAGpBC,EAAAA,aAAa,EAAK,CAAC,GAAD,EAAM,GAAN,CAHE;AAIpBC,EAAAA,WAAW,EAAO,CAAC,GAAD,EAAM,GAAN,CAJE;AAKpBC,EAAAA,UAAU,EAAQ,CAAC,GAAD,EAAM,GAAN,CALE;AAMpBC,EAAAA,gBAAgB,EAAE,CAAC,GAAD,EAAM,GAAN;AANE,CAAf","sourcesContent":["export const RANGES = {\n fontSize: [100.0, 300.0],\n wordSpacing: [0.0, 0.5],\n letterSpacing: [0.0, 0.5],\n pageMargins: [0.5, 4.0],\n lineHeight: [1.0, 2.0],\n paragraphMargins: [0.0, 2.0],\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clamp","val","lower","upper"],"
|
|
1
|
+
{"version":3,"sources":["clamp.ts"],"names":["clamp","val","lower","upper"],"mappings":";;;;;;;AAAO,MAAMA,KAAK,GAAG,CAACC,GAAD,EAAcC,KAAd,EAA6BC,KAA7B,KAAuD;AAC1E,MAAIF,GAAG,GAAGC,KAAV,EAAiB,OAAOA,KAAP;AACjB,MAAID,GAAG,GAAGE,KAAV,EAAiB,OAAOA,KAAP;AACjB,SAAOF,GAAP;AACD,CAJM","sourcesContent":["export const clamp = (val: number, lower: number, upper: number): number => {\n if (val < lower) return lower;\n if (val > upper) return upper;\n return val;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createFragment","viewId","UIManager","dispatchViewManagerCommand","getViewManagerConfig","COMPONENT_NAME","Commands","create","toString"],"
|
|
1
|
+
{"version":3,"sources":["createFragment.ts"],"names":["createFragment","viewId","UIManager","dispatchViewManagerCommand","getViewManagerConfig","COMPONENT_NAME","Commands","create","toString"],"mappings":";;;;;;;AAAA;;AAEA;;AAEO,MAAMA,cAAc,GAAIC,MAAD,IAA2B;AACvD,MAAIA,MAAM,KAAK,IAAf,EAAqB;AACnBC,2BAAUC,0BAAV,CACEF,MADF,EAEE;AACA;AACAC,2BAAUE,oBAAV,CAA+BC,8BAA/B,EAA+CC,QAA/C,CAAwDC,MAAxD,CAA+DC,QAA/D,EAJF,EAKE,CAACP,MAAD,CALF;AAOD;AACF,CAVM","sourcesContent":["import { UIManager } from 'react-native';\n\nimport { COMPONENT_NAME } from './COMPONENT_NAME';\n\nexport const createFragment = (viewId: number | null) => {\n if (viewId !== null) {\n UIManager.dispatchViewManagerCommand(\n viewId,\n // we are calling the 'create' command\n // @ts-ignore\n UIManager.getViewManagerConfig(COMPONENT_NAME).Commands.create.toString(),\n [viewId],\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getWidthOrHeightValue","val","Platform","OS","PixelRatio","getPixelSizeForLayoutSize"],"
|
|
1
|
+
{"version":3,"sources":["getWidthOrHeightValue.ts"],"names":["getWidthOrHeightValue","val","Platform","OS","PixelRatio","getPixelSizeForLayoutSize"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,qBAAqB,GAAIC,GAAD,IAAiB;AACpD,SAAOC,sBAASC,EAAT,KAAgB,SAAhB,GAA4BC,wBAAWC,yBAAX,CAAqCJ,GAArC,CAA5B,GAAwEA,GAA/E;AACD,CAFM","sourcesContent":["import { Platform, PixelRatio } from 'react-native';\n\nexport const getWidthOrHeightValue = (val: number) => {\n return Platform.OS === 'android' ? PixelRatio.getPixelSizeForLayoutSize(val) : val;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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;;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 './clamp';\nexport * from './COMPONENT_NAME';\nexport * from './createFragment';\nexport * from './getWidthOrHeightValue';\nexport * from './indexOfObjectValue';\nexport * from './LINKING_ERROR';\nexport * from './RANGES';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["indexOfObjectValue","obj","val","Object","values","indexOf"],"
|
|
1
|
+
{"version":3,"sources":["indexOfObjectValue.ts"],"names":["indexOfObjectValue","obj","val","Object","values","indexOf"],"mappings":";;;;;;;AAAO,MAAMA,kBAAkB,GAAG,CAACC,GAAD,EAAWC,GAAX,KAAgC;AAChE,SAAOC,MAAM,CAACC,MAAP,CAAcH,GAAd,EAAmBI,OAAnB,CAA2BH,GAA3B,CAAP;AACD,CAFM","sourcesContent":["export const indexOfObjectValue = (obj: any, val: any): number => {\n return Object.values(obj).indexOf(val);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["requireNativeComponent","UIManager","COMPONENT_NAME","LINKING_ERROR","BaseReadiumView","getViewManagerConfig","Error"],"
|
|
1
|
+
{"version":3,"sources":["BaseReadiumView.tsx"],"names":["requireNativeComponent","UIManager","COMPONENT_NAME","LINKING_ERROR","BaseReadiumView","getViewManagerConfig","Error"],"mappings":"AAAA,SACEA,sBADF,EAEEC,SAFF,QAIO,cAJP;AAOA,SAASC,cAAT,EAAyBC,aAAzB,QAA8C,UAA9C;AAcA,OAAO,MAAMC,eAAe,GAC1BH,SAAS,CAACI,oBAAV,CAA+BH,cAA/B,KAAkD,IAAlD,GACIF,sBAAsB,CAAuBE,cAAvB,CAD1B,GAEI,MAAM;AACJ,QAAM,IAAII,KAAJ,CAAUH,aAAV,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,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
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); }
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useState, useRef, useEffect } from 'react';
|
|
4
4
|
import { View, Platform, findNodeHandle, StyleSheet } from 'react-native';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useState","useRef","useEffect","View","Platform","findNodeHandle","StyleSheet","Settings","createFragment","getWidthOrHeightValue","dimension","BaseReadiumView","ReadiumView","onLocationChange","wrappedOnLocationChange","onTableOfContents","wrappedOnTableOfContents","settings","unmappedSettings","props","ref","height","width","setDimensions","onLayout","nativeEvent","layout","event","toc","OS","viewId","current","styles","container","map","undefined","create"],"
|
|
1
|
+
{"version":3,"sources":["ReadiumView.tsx"],"names":["React","useCallback","useState","useRef","useEffect","View","Platform","findNodeHandle","StyleSheet","Settings","createFragment","getWidthOrHeightValue","dimension","BaseReadiumView","ReadiumView","onLocationChange","wrappedOnLocationChange","onTableOfContents","wrappedOnTableOfContents","settings","unmappedSettings","props","ref","height","width","setDimensions","onLayout","nativeEvent","layout","event","toc","OS","viewId","current","styles","container","map","undefined","create"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,QAA7B,EAAuCC,MAAvC,EAA+CC,SAA/C,QAAgE,OAAhE;AACA,SAASC,IAAT,EAAeC,QAAf,EAAyBC,cAAzB,EAAyCC,UAAzC,QAA2D,cAA3D;AAGA,SAASC,QAAT,QAAyB,eAAzB;AACA,SAASC,cAAT,EAAyBC,qBAAqB,IAAIC,SAAlD,QAAmE,UAAnE;AAEA,SAASC,eAAT,QAAgC,mBAAhC;AAIA,OAAO,MAAMC,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,GAAGnB,MAAM,CAAC,IAAD,CAAlB;AACA,QAAM,CAAC;AAAEoB,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAD,EAAoBC,aAApB,IAAqCvB,QAAQ,CAAa;AAC9DsB,IAAAA,KAAK,EAAE,CADuD;AAE9DD,IAAAA,MAAM,EAAE;AAFsD,GAAb,CAAnD,CAFI,CAMJ;;AACA,QAAMG,QAAQ,GAAGzB,WAAW,CAAC,SAAmD;AAAA,QAAlD;AAAE0B,MAAAA,WAAW,EAAE;AAAEC,QAAAA,MAAM,EAAE;AAAEJ,UAAAA,KAAF;AAASD,UAAAA;AAAT;AAAV;AAAf,KAAkD;AAC9EE,IAAAA,aAAa,CAAC;AACZD,MAAAA,KAAK,EAAEZ,SAAS,CAACY,KAAD,CADJ;AAEZD,MAAAA,MAAM,EAAEX,SAAS,CAACW,MAAD;AAFL,KAAD,CAAb;AAID,GAL2B,EAKzB,EALyB,CAA5B,CAPI,CAaJ;;AACA,QAAMR,gBAAgB,GAAGd,WAAW,CAAE4B,KAAD,IAAgB;AACnD,QAAIb,uBAAJ,EAA6B;AAC3BA,MAAAA,uBAAuB,CAACa,KAAK,CAACF,WAAP,CAAvB;AACD;AACF,GAJmC,EAIjC,CAACX,uBAAD,CAJiC,CAApC;AAMA,QAAMC,iBAAiB,GAAGhB,WAAW,CAAE4B,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,GALoC,EAKlC,CAACZ,wBAAD,CALkC,CAArC;AAOAd,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIE,QAAQ,CAACyB,EAAT,KAAgB,SAApB,EAA+B;AAC7B,YAAMC,MAAM,GAAGzB,cAAc,CAACe,GAAG,CAACW,OAAL,CAA7B;AACAvB,MAAAA,cAAc,CAACsB,MAAD,CAAd;AACD;AACF,GALQ,EAKN,EALM,CAAT;AAOA,sBACE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAEE,MAAM,CAACC,SADhB;AAEE,IAAA,QAAQ,EAAET;AAFZ,kBAIE,oBAAC,eAAD;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,GAAGX,QAAQ,CAAC2B,GAAT,CAAahB,gBAAb,CAAH,GAAoCiB,SANhE;AAOE,IAAA,GAAG,EAAEf;AAPP,KAJF,CADF;AAgBD,CAvDM;AAyDP,MAAMY,MAAM,GAAG1B,UAAU,CAAC8B,MAAX,CAAkB;AAC/BH,EAAAA,SAAS,EAAE;AAAEX,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\ntype 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 } }}) => {\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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["Appearance.ts"],"names":["Appearance"],"mappings":"AAAA;AACA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;AAAAA,EAAAA,U;GAAAA,U,KAAAA,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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["ColumnCount.ts"],"names":["ColumnCount"],"mappings":"AAAA;AACA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,KAAAA,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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["FontFamily.ts"],"names":["FontFamily"],"mappings":"AAAA;AACA,WAAYA,UAAZ;;WAAYA,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,KAAAA,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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["TextAlignment.ts"],"names":["TextAlignment"],"mappings":"AAAA;AACA,WAAYA,aAAZ;;WAAYA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,KAAAA,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 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAd;AACA,cAAc,eAAd;AACA,cAAc,cAAd;AACA,cAAc,iBAAd","sourcesContent":["export * from './Appearance';\nexport * from './ColumnCount';\nexport * from './FontFamily';\nexport * from './TextAlignment';\n"]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["RANGES"],"mappings":"AAAA,cAAc,SAAd;AACA,cAAc,cAAd;AACA,SAASA,MAAT,QAAuB,SAAvB;AACA,cAAc,0BAAd","sourcesContent":["export * from './enums';\nexport * from './interfaces';\nexport { RANGES } from './utils';\nexport * from './components/ReadiumView';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Appearance","FontFamily","TextAlignment","ColumnCount","RANGES","indexOfObjectValue","clamp","Settings","DEFAULT","ORIGINAL","JUSTIFY","AUTO","map","settings","defaultValues","mapped","Object","keys","forEach","key","undefined","appearance","fontFamily","textAlign","colCount"],"
|
|
1
|
+
{"version":3,"sources":["Settings.ts"],"names":["Appearance","FontFamily","TextAlignment","ColumnCount","RANGES","indexOfObjectValue","clamp","Settings","DEFAULT","ORIGINAL","JUSTIFY","AUTO","map","settings","defaultValues","mapped","Object","keys","forEach","key","undefined","appearance","fontFamily","textAlign","colCount"],"mappings":";;AAAA,SACEA,UADF,EAEEC,UAFF,EAGEC,aAHF,EAIEC,WAJF,QAKO,UALP;AAOA,SACEC,MADF,EAEEC,kBAFF,EAGEC,KAHF,QAIO,UAJP;AAMA;AACA;AACA;;AACA,OAAO,MAAMC,QAAN,CAAe;AAAA;AAAA,wCAIKP,UAAU,CAACQ,OAJhB;;AAAA,wCAKKP,UAAU,CAACQ,QALhB;;AAAA,uCAMOP,aAAa,CAACQ,OANrB;;AAAA,sCAOIP,WAAW,CAACQ,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,IAAIP,QAAJ,EAAtB;AACA,UAAMQ,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,GAAoBhB,kBAAkB,CAACL,UAAD,EAAae,MAAM,CAACM,UAApB,CAAtC;AACAN,IAAAA,MAAM,CAACO,UAAP,GAAoBjB,kBAAkB,CAACJ,UAAD,EAAac,MAAM,CAACO,UAApB,CAAtC;AACAP,IAAAA,MAAM,CAACQ,SAAP,GAAmBlB,kBAAkB,CAACH,aAAD,EAAgBa,MAAM,CAACQ,SAAvB,CAArC;AACAR,IAAAA,MAAM,CAACS,QAAP,GAAkBnB,kBAAkB,CAACF,WAAD,EAAcY,MAAM,CAACS,QAArB,CAApC;AAEAR,IAAAA,MAAM,CAACC,IAAP,CAAYb,MAAZ,EAAoBc,OAApB,CAA6BC,GAAD,IAAiB;AAC3C;AACAJ,MAAAA,MAAM,CAACI,GAAD,CAAN,GAAcb,KAAK,CAACS,MAAM,CAACI,GAAD,CAAP,EAAcf,MAAM,CAACe,GAAD,CAAN,CAAY,CAAZ,CAAd,EAA8Bf,MAAM,CAACe,GAAD,CAAN,CAAY,CAAZ,CAA9B,CAAnB;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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAd;AACA,cAAc,QAAd;AACA,cAAc,QAAd;AACA,cAAc,WAAd;AACA,cAAc,YAAd","sourcesContent":["export * from './Dimensions';\nexport * from './File';\nexport * from './Link';\nexport * from './Locator';\nexport * from './Settings';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["COMPONENT_NAME.ts"],"names":["COMPONENT_NAME"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG,aAAvB","sourcesContent":["export const COMPONENT_NAME = 'ReadiumView';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","LINKING_ERROR","select","ios","default"],"
|
|
1
|
+
{"version":3,"sources":["LINKING_ERROR.ts"],"names":["Platform","LINKING_ERROR","select","ios","default"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;AAEA,OAAO,MAAMC,aAAa,GACvB,+EAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJK","sourcesContent":["import { Platform } from 'react-native';\n\nexport const LINKING_ERROR =\n `The package 'react-native-readium' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RANGES","fontSize","wordSpacing","letterSpacing","pageMargins","lineHeight","paragraphMargins"],"
|
|
1
|
+
{"version":3,"sources":["RANGES.ts"],"names":["RANGES","fontSize","wordSpacing","letterSpacing","pageMargins","lineHeight","paragraphMargins"],"mappings":"AAAA,OAAO,MAAMA,MAAM,GAAG;AACpBC,EAAAA,QAAQ,EAAU,CAAC,KAAD,EAAQ,KAAR,CADE;AAEpBC,EAAAA,WAAW,EAAO,CAAC,GAAD,EAAM,GAAN,CAFE;AAGpBC,EAAAA,aAAa,EAAK,CAAC,GAAD,EAAM,GAAN,CAHE;AAIpBC,EAAAA,WAAW,EAAO,CAAC,GAAD,EAAM,GAAN,CAJE;AAKpBC,EAAAA,UAAU,EAAQ,CAAC,GAAD,EAAM,GAAN,CALE;AAMpBC,EAAAA,gBAAgB,EAAE,CAAC,GAAD,EAAM,GAAN;AANE,CAAf","sourcesContent":["export const RANGES = {\n fontSize: [100.0, 300.0],\n wordSpacing: [0.0, 0.5],\n letterSpacing: [0.0, 0.5],\n pageMargins: [0.5, 4.0],\n lineHeight: [1.0, 2.0],\n paragraphMargins: [0.0, 2.0],\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clamp","val","lower","upper"],"
|
|
1
|
+
{"version":3,"sources":["clamp.ts"],"names":["clamp","val","lower","upper"],"mappings":"AAAA,OAAO,MAAMA,KAAK,GAAG,CAACC,GAAD,EAAcC,KAAd,EAA6BC,KAA7B,KAAuD;AAC1E,MAAIF,GAAG,GAAGC,KAAV,EAAiB,OAAOA,KAAP;AACjB,MAAID,GAAG,GAAGE,KAAV,EAAiB,OAAOA,KAAP;AACjB,SAAOF,GAAP;AACD,CAJM","sourcesContent":["export const clamp = (val: number, lower: number, upper: number): number => {\n if (val < lower) return lower;\n if (val > upper) return upper;\n return val;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["UIManager","COMPONENT_NAME","createFragment","viewId","dispatchViewManagerCommand","getViewManagerConfig","Commands","create","toString"],"
|
|
1
|
+
{"version":3,"sources":["createFragment.ts"],"names":["UIManager","COMPONENT_NAME","createFragment","viewId","dispatchViewManagerCommand","getViewManagerConfig","Commands","create","toString"],"mappings":"AAAA,SAASA,SAAT,QAA0B,cAA1B;AAEA,SAASC,cAAT,QAA+B,kBAA/B;AAEA,OAAO,MAAMC,cAAc,GAAIC,MAAD,IAA2B;AACvD,MAAIA,MAAM,KAAK,IAAf,EAAqB;AACnBH,IAAAA,SAAS,CAACI,0BAAV,CACED,MADF,EAEE;AACA;AACAH,IAAAA,SAAS,CAACK,oBAAV,CAA+BJ,cAA/B,EAA+CK,QAA/C,CAAwDC,MAAxD,CAA+DC,QAA/D,EAJF,EAKE,CAACL,MAAD,CALF;AAOD;AACF,CAVM","sourcesContent":["import { UIManager } from 'react-native';\n\nimport { COMPONENT_NAME } from './COMPONENT_NAME';\n\nexport const createFragment = (viewId: number | null) => {\n if (viewId !== null) {\n UIManager.dispatchViewManagerCommand(\n viewId,\n // we are calling the 'create' command\n // @ts-ignore\n UIManager.getViewManagerConfig(COMPONENT_NAME).Commands.create.toString(),\n [viewId],\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","PixelRatio","getWidthOrHeightValue","val","OS","getPixelSizeForLayoutSize"],"
|
|
1
|
+
{"version":3,"sources":["getWidthOrHeightValue.ts"],"names":["Platform","PixelRatio","getWidthOrHeightValue","val","OS","getPixelSizeForLayoutSize"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,UAAnB,QAAqC,cAArC;AAEA,OAAO,MAAMC,qBAAqB,GAAIC,GAAD,IAAiB;AACpD,SAAOH,QAAQ,CAACI,EAAT,KAAgB,SAAhB,GAA4BH,UAAU,CAACI,yBAAX,CAAqCF,GAArC,CAA5B,GAAwEA,GAA/E;AACD,CAFM","sourcesContent":["import { Platform, PixelRatio } from 'react-native';\n\nexport const getWidthOrHeightValue = (val: number) => {\n return Platform.OS === 'android' ? PixelRatio.getPixelSizeForLayoutSize(val) : val;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAd;AACA,cAAc,kBAAd;AACA,cAAc,kBAAd;AACA,cAAc,yBAAd;AACA,cAAc,sBAAd;AACA,cAAc,iBAAd;AACA,cAAc,UAAd","sourcesContent":["export * from './clamp';\nexport * from './COMPONENT_NAME';\nexport * from './createFragment';\nexport * from './getWidthOrHeightValue';\nexport * from './indexOfObjectValue';\nexport * from './LINKING_ERROR';\nexport * from './RANGES';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["indexOfObjectValue","obj","val","Object","values","indexOf"],"
|
|
1
|
+
{"version":3,"sources":["indexOfObjectValue.ts"],"names":["indexOfObjectValue","obj","val","Object","values","indexOf"],"mappings":"AAAA,OAAO,MAAMA,kBAAkB,GAAG,CAACC,GAAD,EAAWC,GAAX,KAAgC;AAChE,SAAOC,MAAM,CAACC,MAAP,CAAcH,GAAd,EAAmBI,OAAnB,CAA2BH,GAA3B,CAAP;AACD,CAFM","sourcesContent":["export const indexOfObjectValue = (obj: any, val: any): number => {\n return Object.values(obj).indexOf(val);\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { ViewStyle } from 'react-native';
|
|
|
2
2
|
import type { Settings, Link, Locator, File } from '../interfaces';
|
|
3
3
|
export declare type BaseReadiumViewProps = {
|
|
4
4
|
file: File;
|
|
5
|
-
location?: Locator;
|
|
5
|
+
location?: Locator | Link;
|
|
6
6
|
settings?: Partial<Settings>;
|
|
7
7
|
style?: ViewStyle;
|
|
8
8
|
onLocationChange?: (locator: Locator) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Link } from './Link';
|
|
1
2
|
import type { Locator } from './Locator';
|
|
2
3
|
export interface File {
|
|
3
4
|
/**
|
|
@@ -7,5 +8,5 @@ export interface File {
|
|
|
7
8
|
/**
|
|
8
9
|
* An optional location that the eBook will be opened at.
|
|
9
10
|
*/
|
|
10
|
-
initialLocation?: Locator;
|
|
11
|
+
initialLocation?: Locator | Link;
|
|
11
12
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ import { COMPONENT_NAME, LINKING_ERROR } from '../utils';
|
|
|
9
9
|
|
|
10
10
|
export type BaseReadiumViewProps = {
|
|
11
11
|
file: File;
|
|
12
|
-
location?: Locator;
|
|
12
|
+
location?: Locator | Link;
|
|
13
13
|
settings?: Partial<Settings>;
|
|
14
14
|
style?: ViewStyle;
|
|
15
15
|
onLocationChange?: (locator: Locator) => void;
|
package/src/interfaces/File.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Link } from './Link';
|
|
1
2
|
import type { Locator } from './Locator';
|
|
2
3
|
|
|
3
4
|
|
|
@@ -10,5 +11,5 @@ export interface File {
|
|
|
10
11
|
/**
|
|
11
12
|
* An optional location that the eBook will be opened at.
|
|
12
13
|
*/
|
|
13
|
-
initialLocation?: Locator;
|
|
14
|
+
initialLocation?: Locator | Link;
|
|
14
15
|
}
|