react-native-readium 1.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/README.md +23 -2
  2. package/lib/src/components/BaseReadiumView.d.ts +2 -0
  3. package/lib/src/components/BaseReadiumView.js +7 -0
  4. package/lib/src/components/BaseReadiumView.web.d.ts +1 -0
  5. package/lib/src/components/BaseReadiumView.web.js +1 -0
  6. package/lib/{typescript → src}/components/ReadiumView.d.ts +1 -1
  7. package/lib/src/components/ReadiumView.js +43 -0
  8. package/lib/src/components/ReadiumView.web.d.ts +5 -0
  9. package/lib/src/components/ReadiumView.web.js +67 -0
  10. package/lib/src/enums/Appearance.js +13 -0
  11. package/lib/src/enums/ColumnCount.js +7 -0
  12. package/lib/src/enums/FontFamily.js +12 -0
  13. package/lib/src/enums/TextAlignment.js +6 -0
  14. package/lib/{module → src}/enums/index.js +0 -1
  15. package/lib/{module → src}/index.js +0 -1
  16. package/lib/{typescript/components/BaseReadiumView.d.ts → src/interfaces/BaseReadiumViewProps.d.ts} +5 -3
  17. package/lib/src/interfaces/BaseReadiumViewProps.js +1 -0
  18. package/lib/src/interfaces/Dimensions.js +1 -0
  19. package/lib/src/interfaces/File.js +1 -0
  20. package/lib/src/interfaces/Link.js +1 -0
  21. package/lib/src/interfaces/Locator.js +1 -0
  22. package/lib/src/interfaces/Settings.js +61 -0
  23. package/lib/{typescript → src}/interfaces/index.d.ts +1 -0
  24. package/lib/{module → src}/interfaces/index.js +1 -1
  25. package/lib/{module → src}/utils/COMPONENT_NAME.js +0 -1
  26. package/lib/src/utils/LINKING_ERROR.js +5 -0
  27. package/lib/src/utils/RANGES.js +8 -0
  28. package/lib/src/utils/clamp.js +7 -0
  29. package/lib/src/utils/createFragment.js +10 -0
  30. package/lib/src/utils/getWidthOrHeightValue.js +4 -0
  31. package/lib/{module → src}/utils/index.js +0 -1
  32. package/lib/src/utils/indexOfObjectValue.js +3 -0
  33. package/lib/web/hooks/useLocationObserver.d.ts +2 -0
  34. package/lib/web/hooks/useLocationObserver.js +13 -0
  35. package/lib/web/hooks/useReaderRef.d.ts +3 -0
  36. package/lib/web/hooks/useReaderRef.js +48 -0
  37. package/lib/web/hooks/useSettingsObserver.d.ts +2 -0
  38. package/lib/web/hooks/useSettingsObserver.js +13 -0
  39. package/package.json +8 -23
  40. package/src/components/BaseReadiumView.tsx +1 -14
  41. package/src/components/BaseReadiumView.web.tsx +1 -0
  42. package/src/components/ReadiumView.tsx +1 -2
  43. package/src/{web/ReadiumView.tsx → components/ReadiumView.web.tsx} +31 -9
  44. package/src/interfaces/BaseReadiumViewProps.ts +18 -0
  45. package/src/interfaces/index.ts +1 -0
  46. package/{lib/module/web/hooks/index.js → web/hooks/index.ts} +0 -1
  47. package/{src/web → web}/hooks/useLocationObserver.ts +1 -3
  48. package/{src/web → web}/hooks/useReaderRef.ts +20 -16
  49. package/{src/web → web}/hooks/useSettingsObserver.ts +2 -4
  50. package/lib/commonjs/components/BaseReadiumView.js +0 -16
  51. package/lib/commonjs/components/BaseReadiumView.js.map +0 -1
  52. package/lib/commonjs/components/ReadiumView.js +0 -94
  53. package/lib/commonjs/components/ReadiumView.js.map +0 -1
  54. package/lib/commonjs/enums/Appearance.js +0 -16
  55. package/lib/commonjs/enums/Appearance.js.map +0 -1
  56. package/lib/commonjs/enums/ColumnCount.js +0 -16
  57. package/lib/commonjs/enums/ColumnCount.js.map +0 -1
  58. package/lib/commonjs/enums/FontFamily.js +0 -21
  59. package/lib/commonjs/enums/FontFamily.js.map +0 -1
  60. package/lib/commonjs/enums/TextAlignment.js +0 -15
  61. package/lib/commonjs/enums/TextAlignment.js.map +0 -1
  62. package/lib/commonjs/enums/index.js +0 -58
  63. package/lib/commonjs/enums/index.js.map +0 -1
  64. package/lib/commonjs/index.js +0 -59
  65. package/lib/commonjs/index.js.map +0 -1
  66. package/lib/commonjs/index.web.js +0 -54
  67. package/lib/commonjs/index.web.js.map +0 -1
  68. package/lib/commonjs/interfaces/Dimensions.js +0 -2
  69. package/lib/commonjs/interfaces/Dimensions.js.map +0 -1
  70. package/lib/commonjs/interfaces/File.js +0 -6
  71. package/lib/commonjs/interfaces/File.js.map +0 -1
  72. package/lib/commonjs/interfaces/Link.js +0 -2
  73. package/lib/commonjs/interfaces/Link.js.map +0 -1
  74. package/lib/commonjs/interfaces/Locator.js +0 -2
  75. package/lib/commonjs/interfaces/Locator.js.map +0 -1
  76. package/lib/commonjs/interfaces/Settings.js +0 -71
  77. package/lib/commonjs/interfaces/Settings.js.map +0 -1
  78. package/lib/commonjs/interfaces/index.js +0 -71
  79. package/lib/commonjs/interfaces/index.js.map +0 -1
  80. package/lib/commonjs/utils/COMPONENT_NAME.js +0 -9
  81. package/lib/commonjs/utils/COMPONENT_NAME.js.map +0 -1
  82. package/lib/commonjs/utils/LINKING_ERROR.js +0 -15
  83. package/lib/commonjs/utils/LINKING_ERROR.js.map +0 -1
  84. package/lib/commonjs/utils/RANGES.js +0 -16
  85. package/lib/commonjs/utils/RANGES.js.map +0 -1
  86. package/lib/commonjs/utils/clamp.js +0 -15
  87. package/lib/commonjs/utils/clamp.js.map +0 -1
  88. package/lib/commonjs/utils/createFragment.js +0 -21
  89. package/lib/commonjs/utils/createFragment.js.map +0 -1
  90. package/lib/commonjs/utils/getWidthOrHeightValue.js +0 -15
  91. package/lib/commonjs/utils/getWidthOrHeightValue.js.map +0 -1
  92. package/lib/commonjs/utils/index.js +0 -97
  93. package/lib/commonjs/utils/index.js.map +0 -1
  94. package/lib/commonjs/utils/indexOfObjectValue.js +0 -13
  95. package/lib/commonjs/utils/indexOfObjectValue.js.map +0 -1
  96. package/lib/commonjs/web/ReadiumView.js +0 -90
  97. package/lib/commonjs/web/ReadiumView.js.map +0 -1
  98. package/lib/commonjs/web/hooks/index.js +0 -45
  99. package/lib/commonjs/web/hooks/index.js.map +0 -1
  100. package/lib/commonjs/web/hooks/useLocationObserver.js +0 -21
  101. package/lib/commonjs/web/hooks/useLocationObserver.js.map +0 -1
  102. package/lib/commonjs/web/hooks/useReaderRef.js +0 -60
  103. package/lib/commonjs/web/hooks/useReaderRef.js.map +0 -1
  104. package/lib/commonjs/web/hooks/useSettingsObserver.js +0 -21
  105. package/lib/commonjs/web/hooks/useSettingsObserver.js.map +0 -1
  106. package/lib/module/components/BaseReadiumView.js +0 -6
  107. package/lib/module/components/BaseReadiumView.js.map +0 -1
  108. package/lib/module/components/ReadiumView.js +0 -75
  109. package/lib/module/components/ReadiumView.js.map +0 -1
  110. package/lib/module/enums/Appearance.js +0 -9
  111. package/lib/module/enums/Appearance.js.map +0 -1
  112. package/lib/module/enums/ColumnCount.js +0 -9
  113. package/lib/module/enums/ColumnCount.js.map +0 -1
  114. package/lib/module/enums/FontFamily.js +0 -14
  115. package/lib/module/enums/FontFamily.js.map +0 -1
  116. package/lib/module/enums/TextAlignment.js +0 -8
  117. package/lib/module/enums/TextAlignment.js.map +0 -1
  118. package/lib/module/enums/index.js.map +0 -1
  119. package/lib/module/index.js.map +0 -1
  120. package/lib/module/index.web.js +0 -5
  121. package/lib/module/index.web.js.map +0 -1
  122. package/lib/module/interfaces/Dimensions.js +0 -2
  123. package/lib/module/interfaces/Dimensions.js.map +0 -1
  124. package/lib/module/interfaces/File.js +0 -2
  125. package/lib/module/interfaces/File.js.map +0 -1
  126. package/lib/module/interfaces/Link.js +0 -2
  127. package/lib/module/interfaces/Link.js.map +0 -1
  128. package/lib/module/interfaces/Locator.js +0 -2
  129. package/lib/module/interfaces/Locator.js.map +0 -1
  130. package/lib/module/interfaces/Settings.js +0 -61
  131. package/lib/module/interfaces/Settings.js.map +0 -1
  132. package/lib/module/interfaces/index.js.map +0 -1
  133. package/lib/module/utils/COMPONENT_NAME.js.map +0 -1
  134. package/lib/module/utils/LINKING_ERROR.js +0 -6
  135. package/lib/module/utils/LINKING_ERROR.js.map +0 -1
  136. package/lib/module/utils/RANGES.js +0 -9
  137. package/lib/module/utils/RANGES.js.map +0 -1
  138. package/lib/module/utils/clamp.js +0 -6
  139. package/lib/module/utils/clamp.js.map +0 -1
  140. package/lib/module/utils/createFragment.js +0 -10
  141. package/lib/module/utils/createFragment.js.map +0 -1
  142. package/lib/module/utils/getWidthOrHeightValue.js +0 -5
  143. package/lib/module/utils/getWidthOrHeightValue.js.map +0 -1
  144. package/lib/module/utils/index.js.map +0 -1
  145. package/lib/module/utils/indexOfObjectValue.js +0 -4
  146. package/lib/module/utils/indexOfObjectValue.js.map +0 -1
  147. package/lib/module/web/ReadiumView.js +0 -75
  148. package/lib/module/web/ReadiumView.js.map +0 -1
  149. package/lib/module/web/hooks/index.js.map +0 -1
  150. package/lib/module/web/hooks/useLocationObserver.js +0 -11
  151. package/lib/module/web/hooks/useLocationObserver.js.map +0 -1
  152. package/lib/module/web/hooks/useReaderRef.js +0 -47
  153. package/lib/module/web/hooks/useReaderRef.js.map +0 -1
  154. package/lib/module/web/hooks/useSettingsObserver.js +0 -11
  155. package/lib/module/web/hooks/useSettingsObserver.js.map +0 -1
  156. package/lib/typescript/index.web.d.ts +0 -4
  157. package/lib/typescript/web/ReadiumView.d.ts +0 -3
  158. package/lib/typescript/web/hooks/useLocationObserver.d.ts +0 -3
  159. package/lib/typescript/web/hooks/useReaderRef.d.ts +0 -4
  160. package/lib/typescript/web/hooks/useSettingsObserver.d.ts +0 -3
  161. package/src/index.web.tsx +0 -5
  162. /package/lib/{typescript → src}/enums/Appearance.d.ts +0 -0
  163. /package/lib/{typescript → src}/enums/ColumnCount.d.ts +0 -0
  164. /package/lib/{typescript → src}/enums/FontFamily.d.ts +0 -0
  165. /package/lib/{typescript → src}/enums/TextAlignment.d.ts +0 -0
  166. /package/lib/{typescript → src}/enums/index.d.ts +0 -0
  167. /package/lib/{typescript → src}/index.d.ts +0 -0
  168. /package/lib/{typescript → src}/interfaces/Dimensions.d.ts +0 -0
  169. /package/lib/{typescript → src}/interfaces/File.d.ts +0 -0
  170. /package/lib/{typescript → src}/interfaces/Link.d.ts +0 -0
  171. /package/lib/{typescript → src}/interfaces/Locator.d.ts +0 -0
  172. /package/lib/{typescript → src}/interfaces/Settings.d.ts +0 -0
  173. /package/lib/{typescript → src}/utils/COMPONENT_NAME.d.ts +0 -0
  174. /package/lib/{typescript → src}/utils/LINKING_ERROR.d.ts +0 -0
  175. /package/lib/{typescript → src}/utils/RANGES.d.ts +0 -0
  176. /package/lib/{typescript → src}/utils/clamp.d.ts +0 -0
  177. /package/lib/{typescript → src}/utils/createFragment.d.ts +0 -0
  178. /package/lib/{typescript → src}/utils/getWidthOrHeightValue.d.ts +0 -0
  179. /package/lib/{typescript → src}/utils/index.d.ts +0 -0
  180. /package/lib/{typescript → src}/utils/indexOfObjectValue.d.ts +0 -0
  181. /package/lib/{typescript/web → web}/hooks/index.d.ts +0 -0
  182. /package/{src/web/hooks/index.ts → lib/web/hooks/index.js} +0 -0
@@ -1,71 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Settings = void 0;
7
-
8
- var _enums = require("../enums");
9
-
10
- var _utils = require("../utils");
11
-
12
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
-
14
- /**
15
- * A reader settings object with sensible defaults.
16
- */
17
- class Settings {
18
- constructor() {
19
- _defineProperty(this, "appearance", _enums.Appearance.DEFAULT);
20
-
21
- _defineProperty(this, "fontFamily", _enums.FontFamily.ORIGINAL);
22
-
23
- _defineProperty(this, "textAlign", _enums.TextAlignment.JUSTIFY);
24
-
25
- _defineProperty(this, "colCount", _enums.ColumnCount.AUTO);
26
-
27
- _defineProperty(this, "scroll", false);
28
-
29
- _defineProperty(this, "fontOverride", false);
30
-
31
- _defineProperty(this, "verticalScroll", false);
32
-
33
- _defineProperty(this, "bodyHyphens", false);
34
-
35
- _defineProperty(this, "advancedSettings", true);
36
-
37
- _defineProperty(this, "fontSize", 100);
38
-
39
- _defineProperty(this, "wordSpacing", 0);
40
-
41
- _defineProperty(this, "letterSpacing", 0);
42
-
43
- _defineProperty(this, "pageMargins", 0);
44
-
45
- _defineProperty(this, "lineHeight", 1);
46
-
47
- _defineProperty(this, "paragraphMargins", 0);
48
- }
49
-
50
- static map(settings) {
51
- const defaultValues = new Settings();
52
- const mapped = {};
53
- Object.keys(defaultValues).forEach(key => {
54
- // @ts-ignore
55
- mapped[key] = settings[key] !== undefined ? settings[key] : defaultValues[key];
56
- });
57
- mapped.appearance = (0, _utils.indexOfObjectValue)(_enums.Appearance, mapped.appearance);
58
- mapped.fontFamily = (0, _utils.indexOfObjectValue)(_enums.FontFamily, mapped.fontFamily);
59
- mapped.textAlign = (0, _utils.indexOfObjectValue)(_enums.TextAlignment, mapped.textAlign);
60
- mapped.colCount = (0, _utils.indexOfObjectValue)(_enums.ColumnCount, mapped.colCount);
61
- Object.keys(_utils.RANGES).forEach(key => {
62
- // @ts-ignore
63
- mapped[key] = (0, _utils.clamp)(mapped[key], _utils.RANGES[key][0], _utils.RANGES[key][1]);
64
- });
65
- return mapped;
66
- }
67
-
68
- }
69
-
70
- exports.Settings = Settings;
71
- //# sourceMappingURL=Settings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["Settings.ts"],"names":["Settings","Appearance","DEFAULT","FontFamily","ORIGINAL","TextAlignment","JUSTIFY","ColumnCount","AUTO","map","settings","defaultValues","mapped","Object","keys","forEach","key","undefined","appearance","fontFamily","textAlign","colCount","RANGES"],"mappings":";;;;;;;AAAA;;AAOA;;;;AAMA;AACA;AACA;AACO,MAAMA,QAAN,CAAe;AAAA;AAAA,wCAIKC,kBAAWC,OAJhB;;AAAA,wCAKKC,kBAAWC,QALhB;;AAAA,uCAMOC,qBAAcC,OANrB;;AAAA,sCAOIC,mBAAYC,IAPhB;;AAAA,oCASF,KATE;;AAAA,0CAUI,KAVJ;;AAAA,4CAWM,KAXN;;AAAA,yCAYG,KAZH;;AAAA,8CAaQ,IAbR;;AAAA,sCAkBD,GAlBC;;AAAA,yCAuBE,CAvBF;;AAAA,2CA4BI,CA5BJ;;AAAA,yCAiCE,CAjCF;;AAAA,wCAsCC,CAtCD;;AAAA,8CA2CQ,CA3CR;AAAA;;AA6CV,SAAHC,GAAG,CAACC,QAAD,EAAmC;AAC3C,UAAMC,aAAa,GAAG,IAAIX,QAAJ,EAAtB;AACA,UAAMY,MAA2B,GAAG,EAApC;AAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYH,aAAZ,EACGI,OADH,CACYC,GAAD,IAAiB;AACxB;AACAJ,MAAAA,MAAM,CAACI,GAAD,CAAN,GAAcN,QAAQ,CAACM,GAAD,CAAR,KAAkBC,SAAlB,GAA8BP,QAAQ,CAACM,GAAD,CAAtC,GAA8CL,aAAa,CAACK,GAAD,CAAzE;AACD,KAJH;AAOAJ,IAAAA,MAAM,CAACM,UAAP,GAAoB,+BAAmBjB,iBAAnB,EAA+BW,MAAM,CAACM,UAAtC,CAApB;AACAN,IAAAA,MAAM,CAACO,UAAP,GAAoB,+BAAmBhB,iBAAnB,EAA+BS,MAAM,CAACO,UAAtC,CAApB;AACAP,IAAAA,MAAM,CAACQ,SAAP,GAAmB,+BAAmBf,oBAAnB,EAAkCO,MAAM,CAACQ,SAAzC,CAAnB;AACAR,IAAAA,MAAM,CAACS,QAAP,GAAkB,+BAAmBd,kBAAnB,EAAgCK,MAAM,CAACS,QAAvC,CAAlB;AAEAR,IAAAA,MAAM,CAACC,IAAP,CAAYQ,aAAZ,EAAoBP,OAApB,CAA6BC,GAAD,IAAiB;AAC3C;AACAJ,MAAAA,MAAM,CAACI,GAAD,CAAN,GAAc,kBAAMJ,MAAM,CAACI,GAAD,CAAZ,EAAmBM,cAAON,GAAP,EAAY,CAAZ,CAAnB,EAAmCM,cAAON,GAAP,EAAY,CAAZ,CAAnC,CAAd;AACD,KAHD;AAKA,WAAOJ,MAAP;AACD;;AAnEmB","sourcesContent":["import {\n Appearance,\n FontFamily,\n TextAlignment,\n ColumnCount,\n} from '../enums';\n\nimport {\n RANGES,\n indexOfObjectValue,\n clamp,\n} from '../utils';\n\n/**\n * A reader settings object with sensible defaults.\n */\nexport class Settings {\n // TODO:\n // - ligatures\n // - paraIndent\n appearance: Appearance = Appearance.DEFAULT;\n fontFamily: FontFamily = FontFamily.ORIGINAL;\n textAlign: TextAlignment = TextAlignment.JUSTIFY;\n colCount: ColumnCount = ColumnCount.AUTO;\n\n scroll: boolean = false;\n fontOverride: boolean = false;\n verticalScroll: boolean = false;\n bodyHyphens: boolean = false;\n advancedSettings: boolean = true;\n\n /**\n * Range: 100.0 - 300.0\n */\n fontSize: number = 100;\n\n /**\n * Range: 0.0 - 0.5\n */\n wordSpacing: number = 0;\n\n /**\n * Range: 0.0 - 0.5\n */\n letterSpacing: number = 0;\n\n /**\n * Range: 0.5 - 4.0\n */\n pageMargins: number = 0;\n\n /**\n * Range: 1.0 - 2.0\n */\n lineHeight: number = 1;\n\n /**\n * Range: 0.0 - 2.0\n */\n paragraphMargins?: number = 0;\n\n static map(settings: Partial<Settings>): any {\n const defaultValues = new Settings();\n const mapped: Record<string, any> = {};\n\n Object.keys(defaultValues)\n .forEach((key: string) => {\n // @ts-ignore\n mapped[key] = settings[key] !== undefined ? settings[key] : defaultValues[key];\n })\n ;\n\n mapped.appearance = indexOfObjectValue(Appearance, mapped.appearance);\n mapped.fontFamily = indexOfObjectValue(FontFamily, mapped.fontFamily);\n mapped.textAlign = indexOfObjectValue(TextAlignment, mapped.textAlign);\n mapped.colCount = indexOfObjectValue(ColumnCount, mapped.colCount);\n\n Object.keys(RANGES).forEach((key: string) => {\n // @ts-ignore\n mapped[key] = clamp(mapped[key], RANGES[key][0], RANGES[key][1]);\n });\n\n return mapped;\n }\n}\n"]}
@@ -1,71 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _Dimensions = require("./Dimensions");
8
-
9
- Object.keys(_Dimensions).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _Dimensions[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function () {
15
- return _Dimensions[key];
16
- }
17
- });
18
- });
19
-
20
- var _File = require("./File");
21
-
22
- Object.keys(_File).forEach(function (key) {
23
- if (key === "default" || key === "__esModule") return;
24
- if (key in exports && exports[key] === _File[key]) return;
25
- Object.defineProperty(exports, key, {
26
- enumerable: true,
27
- get: function () {
28
- return _File[key];
29
- }
30
- });
31
- });
32
-
33
- var _Link = require("./Link");
34
-
35
- Object.keys(_Link).forEach(function (key) {
36
- if (key === "default" || key === "__esModule") return;
37
- if (key in exports && exports[key] === _Link[key]) return;
38
- Object.defineProperty(exports, key, {
39
- enumerable: true,
40
- get: function () {
41
- return _Link[key];
42
- }
43
- });
44
- });
45
-
46
- var _Locator = require("./Locator");
47
-
48
- Object.keys(_Locator).forEach(function (key) {
49
- if (key === "default" || key === "__esModule") return;
50
- if (key in exports && exports[key] === _Locator[key]) return;
51
- Object.defineProperty(exports, key, {
52
- enumerable: true,
53
- get: function () {
54
- return _Locator[key];
55
- }
56
- });
57
- });
58
-
59
- var _Settings = require("./Settings");
60
-
61
- Object.keys(_Settings).forEach(function (key) {
62
- if (key === "default" || key === "__esModule") return;
63
- if (key in exports && exports[key] === _Settings[key]) return;
64
- Object.defineProperty(exports, key, {
65
- enumerable: true,
66
- get: function () {
67
- return _Settings[key];
68
- }
69
- });
70
- });
71
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;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,9 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"sources":["COMPONENT_NAME.ts"],"names":["COMPONENT_NAME"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAG,aAAvB","sourcesContent":["export const COMPONENT_NAME = 'ReadiumView';\n"]}
@@ -1,15 +0,0 @@
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
@@ -1 +0,0 @@
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,16 +0,0 @@
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
@@ -1 +0,0 @@
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,15 +0,0 @@
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
@@ -1 +0,0 @@
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,21 +0,0 @@
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
@@ -1 +0,0 @@
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,15 +0,0 @@
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
@@ -1 +0,0 @@
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,97 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
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
- });
97
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;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,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.indexOfObjectValue = void 0;
7
-
8
- const indexOfObjectValue = (obj, val) => {
9
- return Object.values(obj).indexOf(val);
10
- };
11
-
12
- exports.indexOfObjectValue = indexOfObjectValue;
13
- //# sourceMappingURL=indexOfObjectValue.js.map
@@ -1 +0,0 @@
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,90 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ReadiumView = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _reactNative = require("react-native");
11
-
12
- var _hooks = require("./hooks");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- const ReadiumView = _ref => {
17
- let {
18
- file,
19
- settings,
20
- location,
21
- onLocationChange,
22
- onTableOfContents
23
- } = _ref;
24
- const readerRef = (0, _hooks.useReaderRef)({
25
- file,
26
- onLocationChange,
27
- onTableOfContents
28
- });
29
- const reader = readerRef.current;
30
- (0, _hooks.useSettingsObserver)(reader, settings);
31
- (0, _hooks.useLocationObserver)(reader, location);
32
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
33
- style: styles.container
34
- }, !reader && /*#__PURE__*/_react.default.createElement("div", {
35
- style: styles.loader
36
- }, "Loading reader..."), /*#__PURE__*/_react.default.createElement("div", {
37
- id: "D2Reader-Container",
38
- style: styles.d2Container
39
- }, reader && /*#__PURE__*/_react.default.createElement("button", {
40
- onClick: reader.previousPage,
41
- style: styles.button
42
- }, "\u2039"), /*#__PURE__*/_react.default.createElement("main", {
43
- style: styles.maximize,
44
- tabIndex: -1,
45
- id: "iframe-wrapper"
46
- }, /*#__PURE__*/_react.default.createElement("div", {
47
- id: "reader-loading",
48
- className: "loading",
49
- style: styles.loader
50
- }), /*#__PURE__*/_react.default.createElement("div", {
51
- id: "reader-error",
52
- className: "error"
53
- })), reader && /*#__PURE__*/_react.default.createElement("button", {
54
- onClick: reader.nextPage,
55
- style: styles.button
56
- }, "\u203A")));
57
- };
58
-
59
- exports.ReadiumView = ReadiumView;
60
-
61
- const styles = _reactNative.StyleSheet.create({
62
- container: {
63
- width: '100%',
64
- height: '100%'
65
- },
66
- d2Container: {
67
- width: '100%',
68
- height: '100%',
69
- display: 'flex'
70
- },
71
- maximize: {
72
- width: 'calc(100% - 100px)',
73
- height: '100%',
74
- display: 'flex'
75
- },
76
- button: {
77
- width: 50,
78
- fontSize: 100,
79
- backgroundColor: 'transparent',
80
- border: 'none'
81
- },
82
- loader: {
83
- width: '100%',
84
- height: '100%',
85
- textAlign: 'center',
86
- position: 'relative',
87
- top: 'calc(50% - 10px)'
88
- }
89
- });
90
- //# sourceMappingURL=ReadiumView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["ReadiumView.tsx"],"names":["ReadiumView","file","settings","location","onLocationChange","onTableOfContents","readerRef","reader","current","styles","container","loader","d2Container","previousPage","button","maximize","nextPage","StyleSheet","create","width","height","display","fontSize","backgroundColor","border","textAlign","position","top"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;;;AAMO,MAAMA,WAAmC,GAAG,QAM7C;AAAA,MAN8C;AAClDC,IAAAA,IADkD;AAElDC,IAAAA,QAFkD;AAGlDC,IAAAA,QAHkD;AAIlDC,IAAAA,gBAJkD;AAKlDC,IAAAA;AALkD,GAM9C;AACJ,QAAMC,SAAS,GAAG,yBAAa;AAC7BL,IAAAA,IAD6B;AAE7BG,IAAAA,gBAF6B;AAG7BC,IAAAA;AAH6B,GAAb,CAAlB;AAKA,QAAME,MAAM,GAAGD,SAAS,CAACE,OAAzB;AAEA,kCAAoBD,MAApB,EAA4BL,QAA5B;AACA,kCAAoBK,MAApB,EAA4BJ,QAA5B;AAEA,sBACE,6BAAC,iBAAD;AAAM,IAAA,KAAK,EAAEM,MAAM,CAACC;AAApB,KACG,CAACH,MAAD,iBAAW;AAAK,IAAA,KAAK,EAAEE,MAAM,CAACE;AAAnB,yBADd,eAEE;AAAK,IAAA,EAAE,EAAC,oBAAR;AAA6B,IAAA,KAAK,EAAEF,MAAM,CAACG;AAA3C,KACGL,MAAM,iBAAI;AAAQ,IAAA,OAAO,EAAEA,MAAM,CAACM,YAAxB;AAAsC,IAAA,KAAK,EAAEJ,MAAM,CAACK;AAApD,cADb,eAEE;AACE,IAAA,KAAK,EAAEL,MAAM,CAACM,QADhB;AAEE,IAAA,QAAQ,EAAE,CAAC,CAFb;AAGE,IAAA,EAAE,EAAC;AAHL,kBAKE;AAAK,IAAA,EAAE,EAAC,gBAAR;AAAyB,IAAA,SAAS,EAAC,SAAnC;AAA6C,IAAA,KAAK,EAAEN,MAAM,CAACE;AAA3D,IALF,eAME;AAAK,IAAA,EAAE,EAAC,cAAR;AAAuB,IAAA,SAAS,EAAC;AAAjC,IANF,CAFF,EAUGJ,MAAM,iBAAI;AAAQ,IAAA,OAAO,EAAEA,MAAM,CAACS,QAAxB;AAAkC,IAAA,KAAK,EAAEP,MAAM,CAACK;AAAhD,cAVb,CAFF,CADF;AAiBD,CAlCM;;;;AAoCP,MAAML,MAAM,GAAGQ,wBAAWC,MAAX,CAAkB;AAC/BR,EAAAA,SAAS,EAAE;AACTS,IAAAA,KAAK,EAAE,MADE;AAETC,IAAAA,MAAM,EAAE;AAFC,GADoB;AAK/BR,EAAAA,WAAW,EAAE;AACXO,IAAAA,KAAK,EAAE,MADI;AAEXC,IAAAA,MAAM,EAAE,MAFG;AAGXC,IAAAA,OAAO,EAAE;AAHE,GALkB;AAU/BN,EAAAA,QAAQ,EAAE;AACRI,IAAAA,KAAK,EAAE,oBADC;AAERC,IAAAA,MAAM,EAAE,MAFA;AAGRC,IAAAA,OAAO,EAAE;AAHD,GAVqB;AAe/BP,EAAAA,MAAM,EAAE;AACNK,IAAAA,KAAK,EAAE,EADD;AAENG,IAAAA,QAAQ,EAAE,GAFJ;AAGNC,IAAAA,eAAe,EAAE,aAHX;AAINC,IAAAA,MAAM,EAAE;AAJF,GAfuB;AAqB/Bb,EAAAA,MAAM,EAAE;AACNQ,IAAAA,KAAK,EAAE,MADD;AAENC,IAAAA,MAAM,EAAE,MAFF;AAGNK,IAAAA,SAAS,EAAE,QAHL;AAINC,IAAAA,QAAQ,EAAE,UAJJ;AAKNC,IAAAA,GAAG,EAAE;AALC;AArBuB,CAAlB,CAAf","sourcesContent":["import React from 'react';\nimport { View, StyleSheet } from 'react-native';\n\nimport type { ReadiumProps } from '../components/ReadiumView';\nimport {\n useReaderRef,\n useSettingsObserver,\n useLocationObserver,\n} from './hooks';\n\nexport const ReadiumView: React.FC<ReadiumProps> = ({\n file,\n settings,\n location,\n onLocationChange,\n onTableOfContents,\n}) => {\n const readerRef = useReaderRef({\n file,\n onLocationChange,\n onTableOfContents,\n });\n const reader = readerRef.current;\n\n useSettingsObserver(reader, settings);\n useLocationObserver(reader, location);\n\n return (\n <View style={styles.container}>\n {!reader && <div style={styles.loader}>Loading reader...</div>}\n <div id=\"D2Reader-Container\" style={styles.d2Container}>\n {reader && <button onClick={reader.previousPage} style={styles.button}>&lsaquo;</button>}\n <main\n style={styles.maximize}\n tabIndex={-1}\n id=\"iframe-wrapper\"\n >\n <div id=\"reader-loading\" className=\"loading\" style={styles.loader}></div>\n <div id=\"reader-error\" className=\"error\"></div>\n </main>\n {reader && <button onClick={reader.nextPage} style={styles.button}>&rsaquo;</button>}\n </div>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n width: '100%',\n height: '100%',\n },\n d2Container: {\n width: '100%',\n height: '100%',\n display: 'flex',\n },\n maximize: {\n width: 'calc(100% - 100px)',\n height: '100%',\n display: 'flex',\n },\n button: {\n width: 50,\n fontSize: 100,\n backgroundColor: 'transparent',\n border: 'none',\n },\n loader: {\n width: '100%',\n height: '100%',\n textAlign: 'center',\n position: 'relative',\n top: 'calc(50% - 10px)',\n },\n});\n"]}
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _useReaderRef = require("./useReaderRef");
8
-
9
- Object.keys(_useReaderRef).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _useReaderRef[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function () {
15
- return _useReaderRef[key];
16
- }
17
- });
18
- });
19
-
20
- var _useSettingsObserver = require("./useSettingsObserver");
21
-
22
- Object.keys(_useSettingsObserver).forEach(function (key) {
23
- if (key === "default" || key === "__esModule") return;
24
- if (key in exports && exports[key] === _useSettingsObserver[key]) return;
25
- Object.defineProperty(exports, key, {
26
- enumerable: true,
27
- get: function () {
28
- return _useSettingsObserver[key];
29
- }
30
- });
31
- });
32
-
33
- var _useLocationObserver = require("./useLocationObserver");
34
-
35
- Object.keys(_useLocationObserver).forEach(function (key) {
36
- if (key === "default" || key === "__esModule") return;
37
- if (key in exports && exports[key] === _useLocationObserver[key]) return;
38
- Object.defineProperty(exports, key, {
39
- enumerable: true,
40
- get: function () {
41
- return _useLocationObserver[key];
42
- }
43
- });
44
- });
45
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './useReaderRef';\nexport * from './useSettingsObserver';\nexport * from './useLocationObserver';\n"]}
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useLocationObserver = void 0;
7
-
8
- var _useDeepCompare = require("use-deep-compare");
9
-
10
- const useLocationObserver = (reader, location) => {
11
- (0, _useDeepCompare.useDeepCompareEffect)(() => {
12
- if (reader && location) {
13
- // NOTE: technically this is a Link | Locator. However, under the hood the
14
- // R2D2BC is converting Links to locators, so just force the type here.
15
- reader.goTo(location);
16
- }
17
- }, [location, !!reader]);
18
- };
19
-
20
- exports.useLocationObserver = useLocationObserver;
21
- //# sourceMappingURL=useLocationObserver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["useLocationObserver.ts"],"names":["useLocationObserver","reader","location","goTo"],"mappings":";;;;;;;AAAA;;AAMO,MAAMA,mBAAmB,GAAG,CACjCC,MADiC,EAEjCC,QAFiC,KAG9B;AACH,4CAAqB,MAAM;AACzB,QAAID,MAAM,IAAIC,QAAd,EAAwB;AACtB;AACA;AACAD,MAAAA,MAAM,CAACE,IAAP,CAAYD,QAAZ;AACD;AACF,GAND,EAMG,CACDA,QADC,EAED,CAAC,CAACD,MAFD,CANH;AAUD,CAdM","sourcesContent":["import { useDeepCompareEffect } from 'use-deep-compare';\nimport type D2Reader from '@d-i-t-a/reader';\nimport type { Locator as R2Locator } from '@d-i-t-a/reader';\n\nimport type { Link, Locator } from '../../interfaces';\n\nexport const useLocationObserver = (\n reader?: D2Reader | null,\n location?: Link | Locator | null,\n) => {\n useDeepCompareEffect(() => {\n if (reader && location) {\n // NOTE: technically this is a Link | Locator. However, under the hood the\n // R2D2BC is converting Links to locators, so just force the type here.\n reader.goTo(location as R2Locator);\n }\n }, [\n location,\n !!reader,\n ]);\n};\n"]}
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useReaderRef = void 0;
7
-
8
- var _react = require("react");
9
-
10
- var _reader = _interopRequireDefault(require("@d-i-t-a/reader"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- const useReaderRef = _ref => {
15
- let {
16
- file,
17
- onLocationChange,
18
- onTableOfContents
19
- } = _ref;
20
- const readerRef = (0, _react.useRef)(null);
21
- (0, _react.useEffect)(() => {
22
- _reader.default.load({
23
- url: new URL(file.url),
24
- lastReadingPosition: file.initialLocation,
25
- api: {
26
- updateCurrentLocation: async location => {
27
- if (onLocationChange) onLocationChange(location);
28
- return location;
29
- }
30
- },
31
- injectables: injectables
32
- }).then(r => {
33
- if (onTableOfContents) {
34
- onTableOfContents(r.tableOfContents);
35
- }
36
-
37
- readerRef.current = r;
38
- });
39
- }, []);
40
- return readerRef;
41
- }; // NOTE: right now we're serving these through statically.io, which is just
42
- // pulling them from Github... Might not be the best way and maybe we should
43
- // consider bundling them with the library.
44
-
45
-
46
- exports.useReaderRef = useReaderRef;
47
- const injectables = [{
48
- type: "style",
49
- url: "https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-before.css",
50
- r2before: true
51
- }, {
52
- type: "style",
53
- url: "https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-default.css",
54
- r2default: true
55
- }, {
56
- type: "style",
57
- url: "https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-after.css",
58
- r2after: true
59
- }];
60
- //# sourceMappingURL=useReaderRef.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["useReaderRef.ts"],"names":["useReaderRef","file","onLocationChange","onTableOfContents","readerRef","D2Reader","load","url","URL","lastReadingPosition","initialLocation","api","updateCurrentLocation","location","injectables","then","r","tableOfContents","current","type","r2before","r2default","r2after"],"mappings":";;;;;;;AAAA;;AACA;;;;AAKO,MAAMA,YAAY,GAAG,QAIkD;AAAA,MAJjD;AAC3BC,IAAAA,IAD2B;AAE3BC,IAAAA,gBAF2B;AAG3BC,IAAAA;AAH2B,GAIiD;AAC5E,QAAMC,SAAS,GAAG,mBAAwB,IAAxB,CAAlB;AAEA,wBAAU,MAAM;AACdC,oBAASC,IAAT,CAAc;AACZC,MAAAA,GAAG,EAAE,IAAIC,GAAJ,CAAQP,IAAI,CAACM,GAAb,CADO;AAEZE,MAAAA,mBAAmB,EAAER,IAAI,CAACS,eAFd;AAGZC,MAAAA,GAAG,EAAE;AACHC,QAAAA,qBAAqB,EAAE,MAAOC,QAAP,IAA6B;AAClD,cAAIX,gBAAJ,EAAsBA,gBAAgB,CAACW,QAAD,CAAhB;AACtB,iBAAOA,QAAP;AACD;AAJE,OAHO;AASZC,MAAAA,WAAW,EAAEA;AATD,KAAd,EAUGC,IAVH,CAUSC,CAAD,IAAO;AACb,UAAIb,iBAAJ,EAAuB;AACrBA,QAAAA,iBAAiB,CAACa,CAAC,CAACC,eAAH,CAAjB;AACD;;AACDb,MAAAA,SAAS,CAACc,OAAV,GAAoBF,CAApB;AACD,KAfD;AAgBD,GAjBD,EAiBG,EAjBH;AAmBA,SAAOZ,SAAP;AACD,CA3BM,C,CA6BP;AACA;AACA;;;;AACA,MAAMU,WAAkB,GAAG,CACzB;AACEK,EAAAA,IAAI,EAAE,OADR;AAEEZ,EAAAA,GAAG,EAAE,iGAFP;AAGEa,EAAAA,QAAQ,EAAE;AAHZ,CADyB,EAMzB;AACED,EAAAA,IAAI,EAAE,OADR;AAEEZ,EAAAA,GAAG,EAAE,kGAFP;AAGEc,EAAAA,SAAS,EAAE;AAHb,CANyB,EAWzB;AACEF,EAAAA,IAAI,EAAE,OADR;AAEEZ,EAAAA,GAAG,EAAE,gGAFP;AAGEe,EAAAA,OAAO,EAAE;AAHX,CAXyB,CAA3B","sourcesContent":["import { useEffect, useRef } from 'react';\nimport D2Reader from '@d-i-t-a/reader';\n\nimport type { ReadiumProps } from '../../components/ReadiumView';\nimport type { Locator } from '../../interfaces';\n\nexport const useReaderRef = ({\n file,\n onLocationChange,\n onTableOfContents,\n}: Pick<ReadiumProps, 'file' | 'onLocationChange' | 'onTableOfContents' >) => {\n const readerRef = useRef<D2Reader | null>(null);\n\n useEffect(() => {\n D2Reader.load({\n url: new URL(file.url),\n lastReadingPosition: file.initialLocation,\n api: {\n updateCurrentLocation: async (location: Locator) => {\n if (onLocationChange) onLocationChange(location);\n return location;\n },\n },\n injectables: injectables,\n }).then((r) => {\n if (onTableOfContents) {\n onTableOfContents(r.tableOfContents);\n }\n readerRef.current = r;\n });\n }, []);\n\n return readerRef\n};\n\n// NOTE: right now we're serving these through statically.io, which is just\n// pulling them from Github... Might not be the best way and maybe we should\n// consider bundling them with the library.\nconst injectables: any[] = [\n {\n type: \"style\",\n url: \"https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-before.css\",\n r2before: true,\n },\n {\n type: \"style\",\n url: \"https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-default.css\",\n r2default: true,\n },\n {\n type: \"style\",\n url: \"https://cdn.statically.io/gh/d-i-t-a/R2D2BC/production/viewer/readium-css/ReadiumCSS-after.css\",\n r2after: true,\n },\n];\n\n"]}