react-native-readium 1.0.0-alpha.5 → 1.0.0-alpha.8

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.
Files changed (71) hide show
  1. package/android/src/main/java/com/reactnativereadium/ReadiumView.kt +3 -0
  2. package/android/src/main/java/com/reactnativereadium/ReadiumViewManager.kt +39 -6
  3. package/android/src/main/java/com/reactnativereadium/reader/EpubReaderFragment.kt +11 -2
  4. package/android/src/main/java/com/reactnativereadium/utils/File.kt +8 -0
  5. package/lib/commonjs/components/BaseReadiumView.js +16 -0
  6. package/lib/commonjs/components/BaseReadiumView.js.map +1 -0
  7. package/lib/commonjs/components/ReadiumView.js +86 -0
  8. package/lib/commonjs/components/ReadiumView.js.map +1 -0
  9. package/lib/commonjs/index.js +15 -75
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/utils/COMPONENT_NAME.js +9 -0
  12. package/lib/commonjs/utils/COMPONENT_NAME.js.map +1 -0
  13. package/lib/commonjs/utils/LINKING_ERROR.js +15 -0
  14. package/lib/commonjs/utils/LINKING_ERROR.js.map +1 -0
  15. package/lib/commonjs/utils/RANGES.js +16 -0
  16. package/lib/commonjs/utils/RANGES.js.map +1 -0
  17. package/lib/commonjs/utils/clamp.js +15 -0
  18. package/lib/commonjs/utils/clamp.js.map +1 -0
  19. package/lib/commonjs/utils/createFragment.js +21 -0
  20. package/lib/commonjs/utils/createFragment.js.map +1 -0
  21. package/lib/commonjs/utils/getWidthOrHeightValue.js +15 -0
  22. package/lib/commonjs/utils/getWidthOrHeightValue.js.map +1 -0
  23. package/lib/commonjs/utils/index.js +91 -24
  24. package/lib/commonjs/utils/index.js.map +1 -1
  25. package/lib/commonjs/utils/indexOfObjectValue.js +13 -0
  26. package/lib/commonjs/utils/indexOfObjectValue.js.map +1 -0
  27. package/lib/module/components/BaseReadiumView.js +6 -0
  28. package/lib/module/components/BaseReadiumView.js.map +1 -0
  29. package/lib/module/components/ReadiumView.js +67 -0
  30. package/lib/module/components/ReadiumView.js.map +1 -0
  31. package/lib/module/index.js +1 -58
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/utils/COMPONENT_NAME.js +2 -0
  34. package/lib/module/utils/COMPONENT_NAME.js.map +1 -0
  35. package/lib/module/utils/LINKING_ERROR.js +6 -0
  36. package/lib/module/utils/LINKING_ERROR.js.map +1 -0
  37. package/lib/module/utils/RANGES.js +9 -0
  38. package/lib/module/utils/RANGES.js.map +1 -0
  39. package/lib/module/utils/clamp.js +6 -0
  40. package/lib/module/utils/clamp.js.map +1 -0
  41. package/lib/module/utils/createFragment.js +10 -0
  42. package/lib/module/utils/createFragment.js.map +1 -0
  43. package/lib/module/utils/getWidthOrHeightValue.js +5 -0
  44. package/lib/module/utils/getWidthOrHeightValue.js.map +1 -0
  45. package/lib/module/utils/index.js +7 -16
  46. package/lib/module/utils/index.js.map +1 -1
  47. package/lib/module/utils/indexOfObjectValue.js +4 -0
  48. package/lib/module/utils/indexOfObjectValue.js.map +1 -0
  49. package/lib/typescript/components/BaseReadiumView.d.ts +13 -0
  50. package/lib/typescript/components/ReadiumView.d.ts +5 -0
  51. package/lib/typescript/index.d.ts +1 -15
  52. package/lib/typescript/utils/COMPONENT_NAME.d.ts +1 -0
  53. package/lib/typescript/utils/LINKING_ERROR.d.ts +1 -0
  54. package/lib/typescript/utils/RANGES.d.ts +8 -0
  55. package/lib/typescript/utils/clamp.d.ts +1 -0
  56. package/lib/typescript/utils/createFragment.d.ts +1 -0
  57. package/lib/typescript/utils/getWidthOrHeightValue.d.ts +1 -0
  58. package/lib/typescript/utils/index.d.ts +7 -10
  59. package/lib/typescript/utils/indexOfObjectValue.d.ts +1 -0
  60. package/package.json +1 -1
  61. package/src/components/BaseReadiumView.tsx +26 -0
  62. package/src/components/ReadiumView.tsx +62 -0
  63. package/src/index.tsx +1 -76
  64. package/src/utils/COMPONENT_NAME.ts +1 -0
  65. package/src/utils/LINKING_ERROR.ts +7 -0
  66. package/src/utils/RANGES.ts +8 -0
  67. package/src/utils/clamp.ts +5 -0
  68. package/src/utils/createFragment.ts +15 -0
  69. package/src/utils/getWidthOrHeightValue.ts +5 -0
  70. package/src/utils/index.ts +7 -18
  71. package/src/utils/indexOfObjectValue.ts +3 -0
@@ -10,6 +10,7 @@ import com.reactnativereadium.reader.BaseReaderFragment
10
10
  import com.reactnativereadium.reader.EpubReaderFragment
11
11
  import com.reactnativereadium.reader.ReaderViewModel
12
12
  import com.reactnativereadium.utils.Dimensions
13
+ import com.reactnativereadium.utils.File
13
14
  import org.readium.r2.shared.extensions.toMap
14
15
  import org.readium.r2.shared.publication.Locator
15
16
 
@@ -17,7 +18,9 @@ class ReadiumView(
17
18
  val reactContext: ThemedReactContext
18
19
  ) : FrameLayout(reactContext) {
19
20
  var dimensions: Dimensions = Dimensions(0,0)
21
+ var file: File? = null
20
22
  var fragment: BaseReaderFragment? = null
23
+ var isViewInitialized: Boolean = false
21
24
 
22
25
  fun updateLocation(locator: Locator) : Boolean {
23
26
  if (fragment == null) {
@@ -7,6 +7,7 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup
7
7
  import com.facebook.react.uimanager.ThemedReactContext
8
8
  import com.facebook.react.uimanager.ViewGroupManager
9
9
  import com.reactnativereadium.reader.ReaderService
10
+ import com.reactnativereadium.utils.File
10
11
  import kotlinx.coroutines.runBlocking
11
12
  import org.json.JSONObject
12
13
  import org.readium.r2.shared.publication.Locator
@@ -33,9 +34,32 @@ class ReadiumViewManager(
33
34
  ).build()
34
35
  }
35
36
 
37
+ override fun getCommandsMap(): MutableMap<String, Int> {
38
+ return MapBuilder.of("create", COMMAND_CREATE)
39
+ }
40
+
41
+ override fun receiveCommand(view: ReadiumView, commandId: String?, args: ReadableArray?) {
42
+ super.receiveCommand(view, commandId, args)
43
+ val reactNativeViewId = args!!.getInt(0)
44
+ val commandIdInt = commandId!!.toInt()
45
+
46
+ when (commandIdInt) {
47
+ COMMAND_CREATE -> {
48
+ view.isViewInitialized = true
49
+
50
+ if (view.file != null) {
51
+ buildForViewIfReady(view)
52
+ }
53
+ }
54
+ else -> {
55
+ }
56
+ }
57
+ }
58
+
36
59
  @ReactProp(name = "file")
37
60
  fun setFile(view: ReadiumView, file: ReadableMap) {
38
- val path = file.getString("url")
61
+ val path = (file.getString("url") ?: "")
62
+ .replace("^(file:/+)?(/.*)$".toRegex(), "$2")
39
63
  val locatorMap = file.getMap("initialLocation")
40
64
  var initialLocation: Locator? = null
41
65
 
@@ -43,11 +67,8 @@ class ReadiumViewManager(
43
67
  initialLocation = Locator.fromJSON(JSONObject(locatorMap.toHashMap()))
44
68
  }
45
69
 
46
- runBlocking {
47
- svc.openPublication(path!!, initialLocation) { fragment ->
48
- view.addFragment(fragment)
49
- }
50
- }
70
+ view.file = File(path, initialLocation)
71
+ this.buildForViewIfReady(view)
51
72
  }
52
73
 
53
74
  @ReactProp(name = "location")
@@ -74,7 +95,19 @@ class ReadiumViewManager(
74
95
  }
75
96
  }
76
97
 
98
+ private fun buildForViewIfReady(view: ReadiumView) {
99
+ var file = view.file
100
+ if (file != null && view.isViewInitialized) {
101
+ runBlocking {
102
+ svc.openPublication(file.path, file.initialLocation) { fragment ->
103
+ view.addFragment(fragment)
104
+ }
105
+ }
106
+ }
107
+ }
108
+
77
109
  companion object {
78
110
  var ON_LOCATION_CHANGE = "onLocationChange"
111
+ var COMMAND_CREATE = 1
79
112
  }
80
113
  }
@@ -38,6 +38,7 @@ class EpubReaderFragment : VisualReaderFragment(), EpubNavigatorFragment.Listene
38
38
  private lateinit var publication: Publication
39
39
  lateinit var navigatorFragment: EpubNavigatorFragment
40
40
  private lateinit var factory: ReaderViewModel.Factory
41
+ private var initialSettingsMap: Map<String, Any>? = null
41
42
 
42
43
  private lateinit var menuScreenReader: MenuItem
43
44
  private lateinit var menuSearch: MenuItem
@@ -61,8 +62,11 @@ class EpubReaderFragment : VisualReaderFragment(), EpubNavigatorFragment.Listene
61
62
  }
62
63
 
63
64
  fun updateSettingsFromMap(map: Map<String, Any>) {
64
- if (userSettings != null) {
65
+ if (this::userSettings.isInitialized) {
65
66
  userSettings.updateSettingsFromMap(map)
67
+ initialSettingsMap = null
68
+ } else {
69
+ initialSettingsMap = map
66
70
  }
67
71
  }
68
72
 
@@ -122,7 +126,11 @@ class EpubReaderFragment : VisualReaderFragment(), EpubNavigatorFragment.Listene
122
126
  super.onViewCreated(view, savedInstanceState)
123
127
 
124
128
  val activity = requireActivity()
125
- userSettings = UserSettings(navigatorFragment.preferences, activity, publication.userSettingsUIPreset)
129
+ userSettings = UserSettings(
130
+ navigatorFragment.preferences,
131
+ activity,
132
+ publication.userSettingsUIPreset
133
+ )
126
134
 
127
135
  // This is a hack to draw the right background color on top and bottom blank spaces
128
136
  navigatorFragment.lifecycleScope.launchWhenStarted {
@@ -137,6 +145,7 @@ class EpubReaderFragment : VisualReaderFragment(), EpubNavigatorFragment.Listene
137
145
  val activity = requireActivity()
138
146
 
139
147
  userSettings.resourcePager = navigatorFragment.resourcePager
148
+ initialSettingsMap?.let { updateSettingsFromMap(it) }
140
149
 
141
150
  // If TalkBack or any touch exploration service is activated we force scroll mode (and
142
151
  // override user preferences)
@@ -0,0 +1,8 @@
1
+ package com.reactnativereadium.utils
2
+
3
+ import org.readium.r2.shared.publication.Locator
4
+
5
+ class File(
6
+ var path: String,
7
+ var initialLocation: Locator?
8
+ ) {}
@@ -0,0 +1,16 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["BaseReadiumView.tsx"],"names":["BaseReadiumView","UIManager","getViewManagerConfig","COMPONENT_NAME","Error","LINKING_ERROR"],"mappings":";;;;;;;AAAA;;AAOA;;AAaO,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, Locator, File, } from '../interfaces';\nimport { COMPONENT_NAME, LINKING_ERROR } from '../utils';\n\nexport type BaseReadiumViewProps = {\n file: File;\n location?: Locator;\n settings?: Partial<Settings>;\n style?: ViewStyle;\n onLocationChange?: (locator: Locator) => 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"]}
@@ -0,0 +1,86 @@
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
+ settings: unmappedSettings,
28
+ ...props
29
+ } = _ref;
30
+ const ref = (0, _react.useRef)(null);
31
+ const [{
32
+ height,
33
+ width
34
+ }, setDimensions] = (0, _react.useState)({
35
+ width: 0,
36
+ height: 0
37
+ }); // set the view dimensions on layout
38
+
39
+ const onLayout = (0, _react.useCallback)(_ref2 => {
40
+ let {
41
+ nativeEvent: {
42
+ layout: {
43
+ width,
44
+ height
45
+ }
46
+ }
47
+ } = _ref2;
48
+ setDimensions({
49
+ width: (0, _utils.getWidthOrHeightValue)(width),
50
+ height: (0, _utils.getWidthOrHeightValue)(height)
51
+ });
52
+ }, []); // wrap the native onLocationChange and extract the raw event value
53
+
54
+ const onLocationChange = (0, _react.useCallback)(event => {
55
+ if (wrappedOnLocationChange) {
56
+ wrappedOnLocationChange(event.nativeEvent);
57
+ }
58
+ }, [wrappedOnLocationChange]);
59
+ (0, _react.useEffect)(() => {
60
+ if (_reactNative.Platform.OS === 'android') {
61
+ const viewId = (0, _reactNative.findNodeHandle)(ref.current);
62
+ (0, _utils.createFragment)(viewId);
63
+ }
64
+ }, []);
65
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
66
+ style: styles.container,
67
+ onLayout: onLayout
68
+ }, /*#__PURE__*/_react.default.createElement(_BaseReadiumView.BaseReadiumView, _extends({
69
+ height: height,
70
+ width: width
71
+ }, props, {
72
+ onLocationChange: onLocationChange,
73
+ settings: unmappedSettings ? _interfaces.Settings.map(unmappedSettings) : undefined,
74
+ ref: ref
75
+ })));
76
+ };
77
+
78
+ exports.ReadiumView = ReadiumView;
79
+
80
+ const styles = _reactNative.StyleSheet.create({
81
+ container: {
82
+ width: '100%',
83
+ height: '100%'
84
+ }
85
+ });
86
+ //# sourceMappingURL=ReadiumView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ReadiumView.tsx"],"names":["ReadiumView","onLocationChange","wrappedOnLocationChange","settings","unmappedSettings","props","ref","height","width","setDimensions","onLayout","nativeEvent","layout","event","Platform","OS","viewId","current","styles","container","Settings","map","undefined","StyleSheet","create"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;AACA;;AAEA;;;;;;;;AAIO,MAAMA,WAAmC,GAAG,QAI7C;AAAA,MAJ8C;AAClDC,IAAAA,gBAAgB,EAAEC,uBADgC;AAElDC,IAAAA,QAAQ,EAAEC,gBAFwC;AAGlD,OAAGC;AAH+C,GAI9C;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,QAAMN,gBAAgB,GAAG,wBAAaY,KAAD,IAAgB;AACnD,QAAIX,uBAAJ,EAA6B;AAC3BA,MAAAA,uBAAuB,CAACW,KAAK,CAACF,WAAP,CAAvB;AACD;AACF,GAJwB,EAItB,CAACT,uBAAD,CAJsB,CAAzB;AAMA,wBAAU,MAAM;AACd,QAAIY,sBAASC,EAAT,KAAgB,SAApB,EAA+B;AAC7B,YAAMC,MAAM,GAAG,iCAAeV,GAAG,CAACW,OAAnB,CAAf;AACA,iCAAeD,MAAf;AACD;AACF,GALD,EAKG,EALH;AAOA,sBACE,6BAAC,iBAAD;AACE,IAAA,KAAK,EAAEE,MAAM,CAACC,SADhB;AAEE,IAAA,QAAQ,EAAET;AAFZ,kBAIE,6BAAC,gCAAD;AACE,IAAA,MAAM,EAAEH,MADV;AAEE,IAAA,KAAK,EAAEC;AAFT,KAGMH,KAHN;AAIE,IAAA,gBAAgB,EAAEJ,gBAJpB;AAKE,IAAA,QAAQ,EAAEG,gBAAgB,GAAGgB,qBAASC,GAAT,CAAajB,gBAAb,CAAH,GAAoCkB,SALhE;AAME,IAAA,GAAG,EAAEhB;AANP,KAJF,CADF;AAeD,CA9CM;;;;AAgDP,MAAMY,MAAM,GAAGK,wBAAWC,MAAX,CAAkB;AAC/BL,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 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 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 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"]}
@@ -3,20 +3,24 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {
7
- ReadiumView: true
8
- };
9
- exports.ReadiumView = void 0;
10
6
 
11
- var _react = _interopRequireWildcard(require("react"));
7
+ var _enums = require("./enums");
12
8
 
13
- var _reactNative = require("react-native");
9
+ Object.keys(_enums).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _enums[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _enums[key];
16
+ }
17
+ });
18
+ });
14
19
 
15
20
  var _interfaces = require("./interfaces");
16
21
 
17
22
  Object.keys(_interfaces).forEach(function (key) {
18
23
  if (key === "default" || key === "__esModule") return;
19
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
24
  if (key in exports && exports[key] === _interfaces[key]) return;
21
25
  Object.defineProperty(exports, key, {
22
26
  enumerable: true,
@@ -26,80 +30,16 @@ Object.keys(_interfaces).forEach(function (key) {
26
30
  });
27
31
  });
28
32
 
29
- var _enums = require("./enums");
33
+ var _ReadiumView = require("./components/ReadiumView");
30
34
 
31
- Object.keys(_enums).forEach(function (key) {
35
+ Object.keys(_ReadiumView).forEach(function (key) {
32
36
  if (key === "default" || key === "__esModule") return;
33
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
34
- if (key in exports && exports[key] === _enums[key]) return;
37
+ if (key in exports && exports[key] === _ReadiumView[key]) return;
35
38
  Object.defineProperty(exports, key, {
36
39
  enumerable: true,
37
40
  get: function () {
38
- return _enums[key];
41
+ return _ReadiumView[key];
39
42
  }
40
43
  });
41
44
  });
42
-
43
- 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); }
44
-
45
- 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; }
46
-
47
- 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); }
48
-
49
- const LINKING_ERROR = `The package 'react-native-readium' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
50
- ios: "- You have run 'pod install'\n",
51
- default: ''
52
- }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
53
- const ComponentName = 'ReadiumView';
54
- const BaseReadiumView = _reactNative.UIManager.getViewManagerConfig(ComponentName) != null ? (0, _reactNative.requireNativeComponent)(ComponentName) : () => {
55
- throw new Error(LINKING_ERROR);
56
- };
57
-
58
- const ReadiumView = _ref => {
59
- let {
60
- onLocationChange: wrappedOnLocationChange,
61
- settings: unmappedSettings,
62
- ...props
63
- } = _ref;
64
- const [{
65
- height,
66
- width
67
- }, setDimensions] = (0, _react.useState)({
68
- width: 0,
69
- height: 0
70
- });
71
- const onLocationChange = (0, _react.useCallback)(event => {
72
- if (wrappedOnLocationChange) {
73
- wrappedOnLocationChange(event.nativeEvent);
74
- }
75
- }, [wrappedOnLocationChange]);
76
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
77
- style: {
78
- width: '100%',
79
- height: '100%'
80
- },
81
- onLayout: _ref2 => {
82
- let {
83
- nativeEvent: {
84
- layout: {
85
- width,
86
- height
87
- }
88
- }
89
- } = _ref2;
90
- setDimensions({
91
- width: _reactNative.Platform.OS === 'android' ? _reactNative.PixelRatio.getPixelSizeForLayoutSize(width) : width,
92
- height: _reactNative.Platform.OS === 'android' ? _reactNative.PixelRatio.getPixelSizeForLayoutSize(height) : height
93
- });
94
- }
95
- }, /*#__PURE__*/_react.default.createElement(BaseReadiumView, _extends({
96
- height: height,
97
- width: width
98
- }, props, {
99
- onLocationChange: onLocationChange,
100
- settings: unmappedSettings ? _interfaces.Settings.map(unmappedSettings) : undefined
101
- })));
102
- };
103
-
104
- exports.ReadiumView = ReadiumView;
105
45
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["LINKING_ERROR","Platform","select","ios","default","ComponentName","BaseReadiumView","UIManager","getViewManagerConfig","Error","ReadiumView","onLocationChange","wrappedOnLocationChange","settings","unmappedSettings","props","height","width","setDimensions","event","nativeEvent","layout","OS","PixelRatio","getPixelSizeForLayoutSize","Settings","map","undefined"],"mappings":";;;;;;;;;;AAAA;;AACA;;AAUA;;AAGA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AADA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;AAGA,MAAMA,aAAa,GAChB,+EAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAiBA,MAAMC,aAAa,GAAG,aAAtB;AAEA,MAAMC,eAAe,GACnBC,uBAAUC,oBAAV,CAA+BH,aAA/B,KAAiD,IAAjD,GACI,yCAAqCA,aAArC,CADJ,GAEI,MAAM;AACJ,QAAM,IAAII,KAAJ,CAAUT,aAAV,CAAN;AACD,CALP;;AAOO,MAAMU,WAAmC,GAAG,QAI7C;AAAA,MAJ8C;AAClDC,IAAAA,gBAAgB,EAAEC,uBADgC;AAElDC,IAAAA,QAAQ,EAAEC,gBAFwC;AAGlD,OAAGC;AAH+C,GAI9C;AAEJ,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;AAIA,QAAML,gBAAgB,GAAG,wBAAaQ,KAAD,IAAgB;AACnD,QAAIP,uBAAJ,EAA6B;AAC3BA,MAAAA,uBAAuB,CAACO,KAAK,CAACC,WAAP,CAAvB;AACD;AACF,GAJwB,EAItB,CAACR,uBAAD,CAJsB,CAAzB;AAMA,sBACE,6BAAC,iBAAD;AACE,IAAA,KAAK,EAAE;AAAEK,MAAAA,KAAK,EAAE,MAAT;AAAiBD,MAAAA,MAAM,EAAE;AAAzB,KADT;AAEE,IAAA,QAAQ,EAAE,SAAmD;AAAA,UAAlD;AAAEI,QAAAA,WAAW,EAAE;AAAEC,UAAAA,MAAM,EAAE;AAAEJ,YAAAA,KAAF;AAASD,YAAAA;AAAT;AAAV;AAAf,OAAkD;AAC3DE,MAAAA,aAAa,CAAC;AACZD,QAAAA,KAAK,EAAEhB,sBAASqB,EAAT,KAAgB,SAAhB,GAA4BC,wBAAWC,yBAAX,CAAqCP,KAArC,CAA5B,GAA0EA,KADrE;AAEZD,QAAAA,MAAM,EAAEf,sBAASqB,EAAT,KAAgB,SAAhB,GAA4BC,wBAAWC,yBAAX,CAAqCR,MAArC,CAA5B,GAA2EA;AAFvE,OAAD,CAAb;AAID;AAPH,kBASE,6BAAC,eAAD;AACE,IAAA,MAAM,EAAEA,MADV;AAEE,IAAA,KAAK,EAAEC;AAFT,KAGMF,KAHN;AAIE,IAAA,gBAAgB,EAAEJ,gBAJpB;AAKE,IAAA,QAAQ,EAAEG,gBAAgB,GAAGW,qBAASC,GAAT,CAAaZ,gBAAb,CAAH,GAAoCa;AALhE,KATF,CADF;AAmBD,CAnCM","sourcesContent":["import React, { useCallback, useState } from 'react';\nimport {\n requireNativeComponent,\n UIManager,\n Platform,\n ViewStyle,\n View,\n PixelRatio,\n} from 'react-native';\n\nimport type { Locator, File, Dimensions } from './interfaces';\nimport { Settings } from './interfaces';\n\nexport * from './enums';\nexport * from './interfaces';\n\nconst 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\ntype ReadiumProps = {\n file: File;\n location?: Locator;\n settings?: Partial<Settings>;\n style?: ViewStyle;\n onLocationChange?: (locator: Locator) => void;\n ref?: any;\n height?: number;\n width?: number;\n};\n\nconst ComponentName = 'ReadiumView';\n\nconst BaseReadiumView =\n UIManager.getViewManagerConfig(ComponentName) != null\n ? requireNativeComponent<ReadiumProps>(ComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\n\nexport const ReadiumView: React.FC<ReadiumProps> = ({\n onLocationChange: wrappedOnLocationChange,\n settings: unmappedSettings,\n ...props\n}) => {\n\n const [{ height, width }, setDimensions] = useState<Dimensions>({\n width: 0,\n height: 0,\n });\n const onLocationChange = useCallback((event: any) => {\n if (wrappedOnLocationChange) {\n wrappedOnLocationChange(event.nativeEvent);\n }\n }, [wrappedOnLocationChange]);\n\n return (\n <View\n style={{ width: '100%', height: '100%' }}\n onLayout={({ nativeEvent: { layout: { width, height } }}) => {\n setDimensions({\n width: Platform.OS === 'android' ? PixelRatio.getPixelSizeForLayoutSize(width) : width,\n height: Platform.OS === 'android' ? PixelRatio.getPixelSizeForLayoutSize(height) : height,\n })\n }}\n >\n <BaseReadiumView\n height={height}\n width={width}\n {...props}\n onLocationChange={onLocationChange}\n settings={unmappedSettings ? Settings.map(unmappedSettings) : undefined}\n />\n </View>\n );\n};\n"]}
1
+ {"version":3,"sources":["index.tsx"],"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","sourcesContent":["export * from './enums';\nexport * from './interfaces';\nexport * from './components/ReadiumView';\n"]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.COMPONENT_NAME = void 0;
7
+ const COMPONENT_NAME = 'ReadiumView';
8
+ exports.COMPONENT_NAME = COMPONENT_NAME;
9
+ //# sourceMappingURL=COMPONENT_NAME.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["COMPONENT_NAME.ts"],"names":["COMPONENT_NAME"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAG,aAAvB","sourcesContent":["export const COMPONENT_NAME = 'ReadiumView';\n"]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.LINKING_ERROR = void 0;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ const LINKING_ERROR = `The package 'react-native-readium' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
11
+ ios: "- You have run 'pod install'\n",
12
+ default: ''
13
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
14
+ exports.LINKING_ERROR = LINKING_ERROR;
15
+ //# sourceMappingURL=LINKING_ERROR.js.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RANGES = void 0;
7
+ const RANGES = {
8
+ fontSize: [100.0, 300.0],
9
+ wordSpacing: [0.0, 0.5],
10
+ letterSpacing: [0.0, 0.5],
11
+ pageMargins: [0.5, 4.0],
12
+ lineHeight: [1.0, 2.0],
13
+ paragraphMargins: [0.0, 2.0]
14
+ };
15
+ exports.RANGES = RANGES;
16
+ //# sourceMappingURL=RANGES.js.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clamp = void 0;
7
+
8
+ const clamp = (val, lower, upper) => {
9
+ if (val < lower) return lower;
10
+ if (val > upper) return upper;
11
+ return val;
12
+ };
13
+
14
+ exports.clamp = clamp;
15
+ //# sourceMappingURL=clamp.js.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createFragment = void 0;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ var _COMPONENT_NAME = require("./COMPONENT_NAME");
11
+
12
+ const createFragment = viewId => {
13
+ if (viewId !== null) {
14
+ _reactNative.UIManager.dispatchViewManagerCommand(viewId, // we are calling the 'create' command
15
+ // @ts-ignore
16
+ _reactNative.UIManager.getViewManagerConfig(_COMPONENT_NAME.COMPONENT_NAME).Commands.create.toString(), [viewId]);
17
+ }
18
+ };
19
+
20
+ exports.createFragment = createFragment;
21
+ //# sourceMappingURL=createFragment.js.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getWidthOrHeightValue = void 0;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ const getWidthOrHeightValue = val => {
11
+ return _reactNative.Platform.OS === 'android' ? _reactNative.PixelRatio.getPixelSizeForLayoutSize(val) : val;
12
+ };
13
+
14
+ exports.getWidthOrHeightValue = getWidthOrHeightValue;
15
+ //# sourceMappingURL=getWidthOrHeightValue.js.map
@@ -0,0 +1 @@
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"]}
@@ -3,28 +3,95 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.indexOfObjectValue = exports.clamp = exports.RANGES = void 0;
7
- const RANGES = {
8
- fontSize: [100.0, 300.0],
9
- wordSpacing: [0.0, 0.5],
10
- letterSpacing: [0.0, 0.5],
11
- pageMargins: [0.5, 4.0],
12
- lineHeight: [1.0, 2.0],
13
- paragraphMargins: [0.0, 2.0]
14
- };
15
- exports.RANGES = RANGES;
16
-
17
- const indexOfObjectValue = (obj, val) => {
18
- return Object.values(obj).indexOf(val);
19
- };
20
-
21
- exports.indexOfObjectValue = indexOfObjectValue;
22
-
23
- const clamp = (val, lower, upper) => {
24
- if (val < lower) return lower;
25
- if (val > upper) return upper;
26
- return val;
27
- };
28
-
29
- exports.clamp = clamp;
6
+
7
+ var _clamp = require("./clamp");
8
+
9
+ Object.keys(_clamp).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _clamp[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _clamp[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _COMPONENT_NAME = require("./COMPONENT_NAME");
21
+
22
+ Object.keys(_COMPONENT_NAME).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _COMPONENT_NAME[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _COMPONENT_NAME[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _createFragment = require("./createFragment");
34
+
35
+ Object.keys(_createFragment).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _createFragment[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _createFragment[key];
42
+ }
43
+ });
44
+ });
45
+
46
+ var _getWidthOrHeightValue = require("./getWidthOrHeightValue");
47
+
48
+ Object.keys(_getWidthOrHeightValue).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _getWidthOrHeightValue[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function () {
54
+ return _getWidthOrHeightValue[key];
55
+ }
56
+ });
57
+ });
58
+
59
+ var _indexOfObjectValue = require("./indexOfObjectValue");
60
+
61
+ Object.keys(_indexOfObjectValue).forEach(function (key) {
62
+ if (key === "default" || key === "__esModule") return;
63
+ if (key in exports && exports[key] === _indexOfObjectValue[key]) return;
64
+ Object.defineProperty(exports, key, {
65
+ enumerable: true,
66
+ get: function () {
67
+ return _indexOfObjectValue[key];
68
+ }
69
+ });
70
+ });
71
+
72
+ var _LINKING_ERROR = require("./LINKING_ERROR");
73
+
74
+ Object.keys(_LINKING_ERROR).forEach(function (key) {
75
+ if (key === "default" || key === "__esModule") return;
76
+ if (key in exports && exports[key] === _LINKING_ERROR[key]) return;
77
+ Object.defineProperty(exports, key, {
78
+ enumerable: true,
79
+ get: function () {
80
+ return _LINKING_ERROR[key];
81
+ }
82
+ });
83
+ });
84
+
85
+ var _RANGES = require("./RANGES");
86
+
87
+ Object.keys(_RANGES).forEach(function (key) {
88
+ if (key === "default" || key === "__esModule") return;
89
+ if (key in exports && exports[key] === _RANGES[key]) return;
90
+ Object.defineProperty(exports, key, {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _RANGES[key];
94
+ }
95
+ });
96
+ });
30
97
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["RANGES","fontSize","wordSpacing","letterSpacing","pageMargins","lineHeight","paragraphMargins","indexOfObjectValue","obj","val","Object","values","indexOf","clamp","lower","upper"],"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;;;AASA,MAAMC,kBAAkB,GAAG,CAACC,GAAD,EAAWC,GAAX,KAAgC;AAChE,SAAOC,MAAM,CAACC,MAAP,CAAcH,GAAd,EAAmBI,OAAnB,CAA2BH,GAA3B,CAAP;AACD,CAFM;;;;AAIA,MAAMI,KAAK,GAAG,CAACJ,GAAD,EAAcK,KAAd,EAA6BC,KAA7B,KAAuD;AAC1E,MAAIN,GAAG,GAAGK,KAAV,EAAiB,OAAOA,KAAP;AACjB,MAAIL,GAAG,GAAGM,KAAV,EAAiB,OAAOA,KAAP;AACjB,SAAON,GAAP;AACD,CAJM","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\nexport const indexOfObjectValue = (obj: any, val: any): number => {\n return Object.values(obj).indexOf(val);\n}\n\nexport 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
+ {"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"]}