@nypl/web-reader 0.1.4 → 0.2.0-alpha.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.
Files changed (144) hide show
  1. package/dist/cjs/ServiceWorker/sw.js +2 -0
  2. package/dist/cjs/ServiceWorker/sw.js.map +7 -0
  3. package/dist/cjs/index.js +683 -0
  4. package/dist/cjs/index.js.map +7 -0
  5. package/dist/esm/ServiceWorker/sw.js +1263 -0
  6. package/dist/esm/ServiceWorker/sw.js.map +7 -0
  7. package/dist/esm/index.js +88803 -0
  8. package/dist/esm/index.js.map +7 -0
  9. package/dist/html-styles.css +2 -0
  10. package/dist/html-styles.css.map +7 -0
  11. package/dist/pdf-styles.css +2 -0
  12. package/dist/pdf-styles.css.map +7 -0
  13. package/dist/{HtmlReader → types/HtmlReader}/HtmlReaderContent.d.ts +3 -3
  14. package/dist/{HtmlReader → types/HtmlReader}/index.d.ts +22 -22
  15. package/dist/{HtmlReader → types/HtmlReader}/injectables.d.ts +30 -30
  16. package/dist/{PdfReader → types/PdfReader}/index.d.ts +11 -12
  17. package/dist/{PdfReader → types/PdfReader}/useMeasure.d.ts +7 -4
  18. package/dist/{ServiceWorker → types/ServiceWorker}/client.d.ts +9 -9
  19. package/dist/{ServiceWorker → types/ServiceWorker}/constants.d.ts +3 -3
  20. package/{src/ServiceWorker/index.ts → dist/types/ServiceWorker/index.d.ts} +0 -0
  21. package/dist/{ServiceWorker → types/ServiceWorker}/sw.d.ts +7 -7
  22. package/dist/{ServiceWorker → types/ServiceWorker}/types.d.ts +3 -3
  23. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/ConformsTo.d.ts +3 -3
  24. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/Contributor.d.ts +17 -17
  25. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/EpubExtension.d.ts +47 -47
  26. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/LanguageMap.d.ts +3 -3
  27. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/Metadata.d.ts +46 -46
  28. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/OPDSLink.d.ts +63 -63
  29. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/PresentationHints.d.ts +53 -53
  30. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/ReadiumLink.d.ts +58 -58
  31. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/Subject.d.ts +16 -16
  32. package/dist/{WebpubManifestTypes → types/WebpubManifestTypes}/WebpubManifest.d.ts +14 -14
  33. package/dist/{constants.d.ts → types/constants.d.ts} +2 -2
  34. package/dist/{index.d.ts → types/index.d.ts} +7 -7
  35. package/dist/{types.d.ts → types/types.d.ts} +66 -66
  36. package/dist/{ui → types/ui}/Button.d.ts +9 -7
  37. package/dist/{ui → types/ui}/Header.d.ts +6 -6
  38. package/dist/{ui → types/ui}/HtmlSettings.d.ts +9 -9
  39. package/dist/{ui → types/ui}/PageButton.d.ts +7 -7
  40. package/dist/{ui → types/ui}/PdfSettings.d.ts +9 -9
  41. package/dist/{ui → types/ui}/SettingsButton.d.ts +5 -5
  42. package/dist/{ui → types/ui}/TableOfContent.d.ts +7 -7
  43. package/dist/{ui → types/ui}/ToggleButton.d.ts +10 -10
  44. package/dist/{ui → types/ui}/ToggleGroup.d.ts +8 -8
  45. package/dist/{ui → types/ui}/constants.d.ts +1 -1
  46. package/dist/{ui → types/ui}/hooks/useColorModeValue.d.ts +7 -7
  47. package/dist/{ui → types/ui}/hooks/useContainerWidth.d.ts +6 -6
  48. package/dist/{ui → types/ui}/hooks/useEventListener.d.ts +8 -8
  49. package/dist/{ui → types/ui}/manager.d.ts +9 -9
  50. package/dist/{ui → types/ui}/nypl-base-theme/components/button.d.ts +94 -94
  51. package/dist/{ui → types/ui}/nypl-base-theme/components/checkbox.d.ts +41 -41
  52. package/dist/{ui → types/ui}/nypl-base-theme/components/form-error.d.ts +14 -14
  53. package/dist/{ui → types/ui}/nypl-base-theme/components/form-label.d.ts +14 -14
  54. package/dist/{ui → types/ui}/nypl-base-theme/components/form.d.ts +15 -15
  55. package/dist/{ui → types/ui}/nypl-base-theme/components/input.d.ts +107 -107
  56. package/dist/{ui → types/ui}/nypl-base-theme/components/text-area.d.ts +34 -34
  57. package/dist/{ui → types/ui}/nypl-base-theme/foundations/breakpoints.d.ts +8 -8
  58. package/dist/{ui → types/ui}/nypl-base-theme/foundations/colors.d.ts +3 -3
  59. package/dist/{ui → types/ui}/nypl-base-theme/foundations/global.d.ts +13 -13
  60. package/dist/{ui → types/ui}/nypl-base-theme/foundations/radii.d.ts +12 -12
  61. package/dist/{ui → types/ui}/nypl-base-theme/foundations/spacing.d.ts +49 -49
  62. package/dist/{ui → types/ui}/nypl-base-theme/foundations/typography.d.ts +10 -10
  63. package/dist/{ui → types/ui}/nypl-base-theme/index.d.ts +6 -6
  64. package/dist/{ui → types/ui}/nypl-base-theme/types.d.ts +1 -1
  65. package/dist/{ui → types/ui}/theme/components/button.d.ts +78 -78
  66. package/dist/{ui → types/ui}/theme/components/text.d.ts +20 -20
  67. package/dist/{ui → types/ui}/theme/foundations/colors.d.ts +3 -3
  68. package/dist/{ui → types/ui}/theme/index.d.ts +11 -11
  69. package/dist/{ui → types/ui}/theme/types.d.ts +1 -1
  70. package/dist/{useWebReader.d.ts → types/useWebReader.d.ts} +7 -7
  71. package/dist/{utils → types/utils}/decryptAxisNow.d.ts +0 -0
  72. package/dist/{utils → types/utils}/fetch.d.ts +4 -4
  73. package/dist/{utils → types/utils}/getColor.d.ts +2 -2
  74. package/dist/{utils → types/utils}/toggleFullScreen.d.ts +5 -5
  75. package/package.json +21 -33
  76. package/dist/ServiceWorker/index.d.ts +0 -1
  77. package/dist/index.js +0 -8
  78. package/dist/web-reader.cjs.development.js +0 -3363
  79. package/dist/web-reader.cjs.development.js.map +0 -1
  80. package/dist/web-reader.cjs.production.min.js +0 -2
  81. package/dist/web-reader.cjs.production.min.js.map +0 -1
  82. package/dist/web-reader.esm.js +0 -3356
  83. package/dist/web-reader.esm.js.map +0 -1
  84. package/src/HtmlReader/HtmlReaderContent.tsx +0 -19
  85. package/src/HtmlReader/index.tsx +0 -262
  86. package/src/HtmlReader/injectables.ts +0 -26
  87. package/src/PdfReader/index.tsx +0 -492
  88. package/src/PdfReader/useMeasure.tsx +0 -68
  89. package/src/ServiceWorker/client.ts +0 -106
  90. package/src/ServiceWorker/constants.ts +0 -4
  91. package/src/ServiceWorker/sw.ts +0 -84
  92. package/src/ServiceWorker/types.ts +0 -3
  93. package/src/WebpubManifestTypes/ConformsTo.ts +0 -9
  94. package/src/WebpubManifestTypes/Contributor.ts +0 -24
  95. package/src/WebpubManifestTypes/EpubExtension.ts +0 -48
  96. package/src/WebpubManifestTypes/LanguageMap.ts +0 -5
  97. package/src/WebpubManifestTypes/Metadata.ts +0 -48
  98. package/src/WebpubManifestTypes/OPDSLink.ts +0 -251
  99. package/src/WebpubManifestTypes/PresentationHints.ts +0 -54
  100. package/src/WebpubManifestTypes/ReadiumLink.ts +0 -61
  101. package/src/WebpubManifestTypes/Subject.ts +0 -20
  102. package/src/WebpubManifestTypes/WebpubManifest.ts +0 -15
  103. package/src/constants.ts +0 -3
  104. package/src/index.tsx +0 -25
  105. package/src/types.ts +0 -94
  106. package/src/ui/Button.tsx +0 -12
  107. package/src/ui/Header.tsx +0 -89
  108. package/src/ui/HtmlSettings.tsx +0 -97
  109. package/src/ui/PageButton.tsx +0 -39
  110. package/src/ui/PdfSettings.tsx +0 -85
  111. package/src/ui/SettingsButton.tsx +0 -71
  112. package/src/ui/TableOfContent.tsx +0 -144
  113. package/src/ui/ToggleButton.tsx +0 -60
  114. package/src/ui/ToggleGroup.tsx +0 -41
  115. package/src/ui/constants.ts +0 -2
  116. package/src/ui/hooks/useColorModeValue.tsx +0 -19
  117. package/src/ui/hooks/useContainerWidth.ts +0 -24
  118. package/src/ui/hooks/useEventListener.ts +0 -26
  119. package/src/ui/manager.tsx +0 -73
  120. package/src/ui/nypl-base-theme/components/button.ts +0 -117
  121. package/src/ui/nypl-base-theme/components/checkbox.ts +0 -45
  122. package/src/ui/nypl-base-theme/components/form-error.ts +0 -15
  123. package/src/ui/nypl-base-theme/components/form-label.ts +0 -15
  124. package/src/ui/nypl-base-theme/components/form.ts +0 -16
  125. package/src/ui/nypl-base-theme/components/input.ts +0 -101
  126. package/src/ui/nypl-base-theme/components/text-area.ts +0 -17
  127. package/src/ui/nypl-base-theme/foundations/breakpoints.ts +0 -10
  128. package/src/ui/nypl-base-theme/foundations/colors.ts +0 -136
  129. package/src/ui/nypl-base-theme/foundations/global.ts +0 -16
  130. package/src/ui/nypl-base-theme/foundations/radii.ts +0 -13
  131. package/src/ui/nypl-base-theme/foundations/spacing.ts +0 -58
  132. package/src/ui/nypl-base-theme/foundations/typography.ts +0 -43
  133. package/src/ui/nypl-base-theme/index.ts +0 -42
  134. package/src/ui/nypl-base-theme/types.ts +0 -1
  135. package/src/ui/theme/components/button.ts +0 -85
  136. package/src/ui/theme/components/text.ts +0 -24
  137. package/src/ui/theme/foundations/colors.ts +0 -10
  138. package/src/ui/theme/index.ts +0 -34
  139. package/src/ui/theme/types.ts +0 -1
  140. package/src/useWebReader.tsx +0 -105
  141. package/src/utils/decryptAxisNow.ts +0 -45
  142. package/src/utils/fetch.ts +0 -13
  143. package/src/utils/getColor.ts +0 -14
  144. package/src/utils/toggleFullScreen.ts +0 -71
@@ -1,84 +0,0 @@
1
- import { clientsClaim } from 'workbox-core';
2
- import { ExpirationPlugin } from 'workbox-expiration';
3
- import { CacheFirst } from 'workbox-strategies';
4
- import { IS_DEV } from '../constants';
5
- import { CACHE_EXPIRATION_SECONDS, WEBPUB_CACHE_NAME } from './constants';
6
- import { WebReaderSWConfig } from './types';
7
-
8
- declare let self: ServiceWorkerGlobalScope;
9
-
10
- const VERSION = 'v1';
11
-
12
- /**
13
- * We claim the clients immediately and skip waiting because we don't care if
14
- * half the page resources come from the SW and half from the network. We use
15
- * content hashes for this to work
16
- */
17
- clientsClaim();
18
-
19
- /**
20
- * Sets up the event listeners to:
21
- * - On Fetch
22
- * - Serve cached responses if they exist and are less than a week old.
23
- */
24
- export default function initWebReaderSW({
25
- cacheExpirationSeconds = CACHE_EXPIRATION_SECONDS,
26
- }: WebReaderSWConfig | undefined = {}): void {
27
- log('INITIALIZING');
28
- self.addEventListener('install', (event) => {
29
- log('INSTALLING ');
30
- async function installSW() {
31
- // perform any install tasks
32
- // skip the waiting phase and activate immediately
33
- self.skipWaiting();
34
- log('INSTALLED');
35
- }
36
- event.waitUntil(installSW);
37
- });
38
-
39
- /**
40
- * On a fetch event, respond with an item from the cache, if
41
- * it exists. We don't ever add things to the cache here,
42
- * because the fetch event is called for _all_ network requests,
43
- * and we can't tell if any given request is for app resources or
44
- * publication resources. Thus publication resources are added
45
- * to the cache separately, and then just returned if found here.
46
- *
47
- * This event listener MUST be run as the last fetch event listener
48
- * of all in the host app because it always responds to the event
49
- * in order to be able to use async functionality.
50
- */
51
- self.addEventListener('fetch', (event) => {
52
- if (event.request.method !== 'GET') {
53
- return;
54
- }
55
-
56
- async function matchOrFetch() {
57
- const pubCache = await caches.open(WEBPUB_CACHE_NAME);
58
- const match = await pubCache.match(event.request);
59
-
60
- // check if there is a match
61
- if (match) {
62
- return new CacheFirst({
63
- cacheName: WEBPUB_CACHE_NAME,
64
- plugins: [
65
- new ExpirationPlugin({
66
- // Only cache requests for a week
67
- maxAgeSeconds: cacheExpirationSeconds,
68
- }),
69
- ],
70
- }).handle(event);
71
- }
72
- // otherwise go to network
73
- return fetch(event.request);
74
- }
75
-
76
- // we have to make the event wait if we want to use async work
77
- event.respondWith(matchOrFetch());
78
- });
79
- }
80
-
81
- // each logging line will be prepended with the service worker version
82
- function log(message: string) {
83
- if (IS_DEV) console.log(`SW (${VERSION}) -`, message);
84
- }
@@ -1,3 +0,0 @@
1
- export type WebReaderSWConfig = {
2
- cacheExpirationSeconds?: number;
3
- };
@@ -1,9 +0,0 @@
1
- // a webpub pdf collection
2
- export const WebpubPdfConformsTo =
3
- 'https://librarysimplified.org/terms/profiles/pdf';
4
- // a webpub of axisnow content
5
- export const AxisNowEpubConformsTo = 'stub/webpub+axisnow';
6
-
7
- export type ConformsTo =
8
- | typeof WebpubPdfConformsTo
9
- | typeof AxisNowEpubConformsTo;
@@ -1,24 +0,0 @@
1
- import { ReadiumLink } from './ReadiumLink';
2
-
3
- export interface ContributorObject {
4
- name:
5
- | string
6
- | {
7
- /**
8
- * This interface was referenced by `undefined`'s JSON-Schema definition
9
- * via the `patternProperty` "^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUse>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUse2>x(-[A-Za-z0-9]{1,8})+))$".
10
- */
11
- [k: string]: string;
12
- };
13
- identifier?: string;
14
- sortAs?: string;
15
- role?: string | string[];
16
- position?: number;
17
- links?: ReadiumLink[];
18
- [k: string]: unknown;
19
- }
20
-
21
- export type Contributor =
22
- | string
23
- | (string | ContributorObject)[]
24
- | ContributorObject;
@@ -1,48 +0,0 @@
1
- export interface EPUBExtensionLinkProperties {
2
- /**
3
- * Identifies content contained in the linked resource, that cannot be strictly identified using a media type.
4
- */
5
- contains?: ('mathml' | 'onix' | 'remote-resources' | 'js' | 'svg' | 'xmp')[];
6
- /**
7
- * Hints how the layout of the resource should be presented
8
- */
9
- layout?: 'fixed' | 'reflowable';
10
- /**
11
- * Indicates that a resource is encrypted/obfuscated and provides relevant information for decryption
12
- */
13
- encrypted?: {
14
- /**
15
- * Identifies the algorithm used to encrypt the resource
16
- */
17
- algorithm: string;
18
- /**
19
- * Compression method used on the resource
20
- */
21
- compression?: string;
22
- /**
23
- * Original length of the resource in bytes before compression and/or encryption
24
- */
25
- originalLength?: number;
26
- /**
27
- * Identifies the encryption profile used to encrypt the resource
28
- */
29
- profile?: string;
30
- /**
31
- * Identifies the encryption scheme used to encrypt the resource
32
- */
33
- scheme?: string;
34
- [k: string]: unknown;
35
- };
36
- [k: string]: unknown;
37
- }
38
-
39
- export interface EPUBExtensionMetadata {
40
- presentation?: {
41
- /**
42
- * Hints how the layout of the resource should be presented
43
- */
44
- layout?: 'fixed' | 'reflowable';
45
- [k: string]: unknown;
46
- };
47
- [k: string]: unknown;
48
- }
@@ -1,5 +0,0 @@
1
- export type LanguageMap =
2
- | string
3
- | {
4
- [k: string]: string;
5
- };
@@ -1,48 +0,0 @@
1
- import { ConformsTo } from './ConformsTo';
2
- import { Contributor } from './Contributor';
3
- import { LanguageMap } from './LanguageMap';
4
- import { Subject } from './Subject';
5
-
6
- export interface Metadata extends Contributors {
7
- identifier?: string;
8
- '@type'?: string;
9
- conformsTo?: ConformsTo;
10
- title: LanguageMap;
11
- subtitle?: LanguageMap;
12
- modified?: string;
13
- published?: {
14
- [k: string]: unknown;
15
- } & string;
16
- /**
17
- * The language must be a valid BCP 47 tag.
18
- */
19
- language?: string | string[];
20
- sortAs?: LanguageMap;
21
- subject?: Subject;
22
- readingProgression?: 'rtl' | 'ltr' | 'ttb' | 'btt' | 'auto';
23
- description?: string;
24
- duration?: number;
25
- numberOfPages?: number;
26
- belongsTo?: {
27
- collection?: Contributor;
28
- series?: Contributor;
29
- [k: string]: unknown;
30
- };
31
- [k: string]: unknown;
32
- }
33
-
34
- export interface Contributors {
35
- author?: Contributor;
36
- translator?: Contributor;
37
- editor?: Contributor;
38
- artist?: Contributor;
39
- illustrator?: Contributor;
40
- letterer?: Contributor;
41
- penciler?: Contributor;
42
- colorist?: Contributor;
43
- inker?: Contributor;
44
- narrator?: Contributor;
45
- contributor?: Contributor;
46
- publisher?: Contributor;
47
- imprint?: Contributor;
48
- }
@@ -1,251 +0,0 @@
1
- export interface OPDSLinkProperties {
2
- /**
3
- * Provide a hint about the expected number of items returned
4
- */
5
- numberOfItems?: number;
6
- /**
7
- * The price of a publication is tied to its acquisition link
8
- */
9
- price?: {
10
- value: number;
11
- currency:
12
- | 'AED'
13
- | 'AFN'
14
- | 'ALL'
15
- | 'AMD'
16
- | 'ANG'
17
- | 'AOA'
18
- | 'ARS'
19
- | 'AUD'
20
- | 'AWG'
21
- | 'AZN'
22
- | 'BAM'
23
- | 'BBD'
24
- | 'BDT'
25
- | 'BGN'
26
- | 'BHD'
27
- | 'BIF'
28
- | 'BMD'
29
- | 'BND'
30
- | 'BOB'
31
- | 'BOV'
32
- | 'BRL'
33
- | 'BSD'
34
- | 'BTN'
35
- | 'BWP'
36
- | 'BYN'
37
- | 'BZD'
38
- | 'CAD'
39
- | 'CDF'
40
- | 'CHE'
41
- | 'CHF'
42
- | 'CHW'
43
- | 'CLF'
44
- | 'CLP'
45
- | 'CNY'
46
- | 'COP'
47
- | 'COU'
48
- | 'CRC'
49
- | 'CUC'
50
- | 'CUP'
51
- | 'CVE'
52
- | 'CZK'
53
- | 'DJF'
54
- | 'DKK'
55
- | 'DOP'
56
- | 'DZD'
57
- | 'EGP'
58
- | 'ERN'
59
- | 'ETB'
60
- | 'EUR'
61
- | 'FJD'
62
- | 'FKP'
63
- | 'GBP'
64
- | 'GEL'
65
- | 'GHS'
66
- | 'GIP'
67
- | 'GMD'
68
- | 'GNF'
69
- | 'GTQ'
70
- | 'GYD'
71
- | 'HKD'
72
- | 'HNL'
73
- | 'HRK'
74
- | 'HTG'
75
- | 'HUF'
76
- | 'IDR'
77
- | 'ILS'
78
- | 'INR'
79
- | 'IQD'
80
- | 'IRR'
81
- | 'ISK'
82
- | 'JMD'
83
- | 'JOD'
84
- | 'JPY'
85
- | 'KES'
86
- | 'KGS'
87
- | 'KHR'
88
- | 'KMF'
89
- | 'KPW'
90
- | 'KRW'
91
- | 'KWD'
92
- | 'KYD'
93
- | 'KZT'
94
- | 'LAK'
95
- | 'LBP'
96
- | 'LKR'
97
- | 'LRD'
98
- | 'LSL'
99
- | 'LYD'
100
- | 'MAD'
101
- | 'MDL'
102
- | 'MGA'
103
- | 'MKD'
104
- | 'MMK'
105
- | 'MNT'
106
- | 'MOP'
107
- | 'MRU'
108
- | 'MUR'
109
- | 'MVR'
110
- | 'MWK'
111
- | 'MXN'
112
- | 'MXV'
113
- | 'MYR'
114
- | 'MZN'
115
- | 'NAD'
116
- | 'NGN'
117
- | 'NIO'
118
- | 'NOK'
119
- | 'NPR'
120
- | 'NZD'
121
- | 'OMR'
122
- | 'PAB'
123
- | 'PEN'
124
- | 'PGK'
125
- | 'PHP'
126
- | 'PKR'
127
- | 'PLN'
128
- | 'PYG'
129
- | 'QAR'
130
- | 'RON'
131
- | 'RSD'
132
- | 'RUB'
133
- | 'RWF'
134
- | 'SAR'
135
- | 'SBD'
136
- | 'SCR'
137
- | 'SDG'
138
- | 'SEK'
139
- | 'SGD'
140
- | 'SHP'
141
- | 'SLL'
142
- | 'SOS'
143
- | 'SRD'
144
- | 'SSP'
145
- | 'STN'
146
- | 'SVC'
147
- | 'SYP'
148
- | 'SZL'
149
- | 'THB'
150
- | 'TJS'
151
- | 'TMT'
152
- | 'TND'
153
- | 'TOP'
154
- | 'TRY'
155
- | 'TTD'
156
- | 'TWD'
157
- | 'TZS'
158
- | 'UAH'
159
- | 'UGX'
160
- | 'USD'
161
- | 'USN'
162
- | 'UYI'
163
- | 'UYU'
164
- | 'UZS'
165
- | 'VEF'
166
- | 'VES'
167
- | 'VND'
168
- | 'VUV'
169
- | 'WST'
170
- | 'XAF'
171
- | 'XAG'
172
- | 'XAU'
173
- | 'XBA'
174
- | 'XBB'
175
- | 'XBC'
176
- | 'XBD'
177
- | 'XCD'
178
- | 'XDR'
179
- | 'XOF'
180
- | 'XPD'
181
- | 'XPF'
182
- | 'XPT'
183
- | 'XSU'
184
- | 'XTS'
185
- | 'XUA'
186
- | 'XXX'
187
- | 'YER'
188
- | 'ZAR'
189
- | 'ZMW'
190
- | 'ZWL';
191
- [k: string]: unknown;
192
- };
193
- /**
194
- * Indirect acquisition provides a hint for the expected media type that will be acquired after additional steps
195
- */
196
- indirectAcquisition?: OPDSAcquisitionObject[];
197
- /**
198
- * Library-specific feature for unavailable books that support a hold list
199
- */
200
- holds?: {
201
- total?: number;
202
- position?: number;
203
- [k: string]: unknown;
204
- };
205
- /**
206
- * Library-specific feature that contains information about the copies that a library has acquired
207
- */
208
- copies?: {
209
- total?: number;
210
- available?: number;
211
- [k: string]: unknown;
212
- };
213
- /**
214
- * Indicates the availability of a given resource
215
- */
216
- availability?: {
217
- state: 'available' | 'unavailable' | 'reserved' | 'ready';
218
- /**
219
- * Timestamp for the previous state change
220
- */
221
- since?: (
222
- | {
223
- [k: string]: unknown;
224
- }
225
- | {
226
- [k: string]: unknown;
227
- }
228
- ) &
229
- string;
230
- /**
231
- * Timestamp for the next state change
232
- */
233
- until?: (
234
- | {
235
- [k: string]: unknown;
236
- }
237
- | {
238
- [k: string]: unknown;
239
- }
240
- ) &
241
- string;
242
- [k: string]: unknown;
243
- };
244
- [k: string]: unknown;
245
- }
246
-
247
- export interface OPDSAcquisitionObject {
248
- type: string;
249
- child?: OPDSAcquisitionObject[];
250
- [k: string]: unknown;
251
- }
@@ -1,54 +0,0 @@
1
- export interface PresentationHintsMetadata {
2
- presentation?: {
3
- /**
4
- * Specifies whether or not the parts of a linked resource that flow out of the viewport are clipped.
5
- */
6
- clipped?: boolean;
7
- /**
8
- * Indicates if consecutive linked resources from the `reading order` should be handled in a continuous or discontinuous way.
9
- */
10
- continuous?: boolean;
11
- /**
12
- * Specifies constraints for the presentation of a linked resource within the viewport.
13
- */
14
- fit?: 'width' | 'height' | 'contain' | 'cover';
15
- /**
16
- * Suggested orientation for the device when displaying the linked resource.
17
- */
18
- orientation?: 'auto' | 'landscape' | 'portrait';
19
- /**
20
- * Indicates if the overflow of linked resources from the `readingOrder` or `resources` should be handled using dynamic pagination or scrolling.
21
- */
22
- overflow?: 'auto' | 'paginated' | 'scrolled' | 'scrolled-continuous';
23
- /**
24
- * Indicates the condition to be met for the linked resource to be rendered within a synthetic spread.
25
- */
26
- spread?: 'auto' | 'both' | 'none' | 'landscape';
27
- [k: string]: unknown;
28
- };
29
- [k: string]: unknown;
30
- }
31
-
32
- export interface PresentationHintsLinkProperties {
33
- /**
34
- * Specifies whether or not the parts of a linked resource that flow out of the viewport are clipped.
35
- */
36
- clipped?: boolean;
37
- /**
38
- * Specifies constraints for the presentation of a linked resource within the viewport.
39
- */
40
- fit?: 'contain' | 'cover' | 'width' | 'height';
41
- /**
42
- * Suggested orientation for the device when displaying the linked resource.
43
- */
44
- orientation?: 'auto' | 'landscape' | 'portrait';
45
- /**
46
- * Indicates how the linked resource should be displayed in a reading environment that displays synthetic spreads.
47
- */
48
- page?: 'left' | 'right' | 'center';
49
- /**
50
- * Indicates the condition to be met for the linked resource to be rendered within a synthetic spread.
51
- */
52
- spread?: 'auto' | 'both' | 'none' | 'landscape';
53
- [k: string]: unknown;
54
- }
@@ -1,61 +0,0 @@
1
- import { EPUBExtensionLinkProperties } from './EpubExtension';
2
- import { OPDSLinkProperties } from './OPDSLink';
3
- import { PresentationHintsLinkProperties } from './PresentationHints';
4
-
5
- export interface ReadiumLink {
6
- /**
7
- * URI or URI template of the linked resource
8
- */
9
- href: string;
10
- /**
11
- * MIME type of the linked resource
12
- */
13
- type?: string;
14
- /**
15
- * Indicates that a URI template is used in href
16
- */
17
- templated?: boolean;
18
- /**
19
- * Title of the linked resource
20
- */
21
- title?: string;
22
- /**
23
- * Relation between the linked resource and its containing collection
24
- */
25
- rel?: string | string[];
26
- /**
27
- * Properties associated to the linked resource
28
- */
29
- properties?: OPDSLinkProperties &
30
- EPUBExtensionLinkProperties &
31
- PresentationHintsLinkProperties;
32
- /**
33
- * Height of the linked resource in pixels
34
- */
35
- height?: number;
36
- /**
37
- * Width of the linked resource in pixels
38
- */
39
- width?: number;
40
- /**
41
- * Bitrate of the linked resource in kbps
42
- */
43
- bitrate?: number;
44
- /**
45
- * Length of the linked resource in seconds
46
- */
47
- duration?: number;
48
- /**
49
- * Expected language of the linked resource
50
- */
51
- language?: string | string[];
52
- /**
53
- * Alternate resources for the linked resource
54
- */
55
- alternate?: ReadiumLink[];
56
- /**
57
- * Resources that are children of the linked resource, in the context of a given collection role
58
- */
59
- children?: ReadiumLink[];
60
- [k: string]: unknown;
61
- }
@@ -1,20 +0,0 @@
1
- import { ReadiumLink } from './ReadiumLink';
2
-
3
- export interface SubjectObject {
4
- name:
5
- | string
6
- | {
7
- /**
8
- * This interface was referenced by `undefined`'s JSON-Schema definition
9
- * via the `patternProperty` "^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUse>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUse2>x(-[A-Za-z0-9]{1,8})+))$".
10
- */
11
- [k: string]: string;
12
- };
13
- sortAs?: string;
14
- code?: string;
15
- scheme?: string;
16
- links?: ReadiumLink[];
17
- [k: string]: unknown;
18
- }
19
-
20
- export type Subject = string | (string | SubjectObject)[] | SubjectObject;
@@ -1,15 +0,0 @@
1
- /**
2
- * Type definitions for a manifest
3
- */
4
- import { ReadiumWebpubContext } from '../constants';
5
- import { Metadata } from './Metadata';
6
- import { ReadiumLink } from './ReadiumLink';
7
-
8
- export interface WebpubManifest {
9
- '@context'?: typeof ReadiumWebpubContext;
10
- metadata: Metadata;
11
- links: ReadiumLink[];
12
- readingOrder: ReadiumLink[];
13
- resources?: ReadiumLink[];
14
- toc?: ReadiumLink[];
15
- }
package/src/constants.ts DELETED
@@ -1,3 +0,0 @@
1
- export const ReadiumWebpubContext = 'http://readium.org/webpub/default.jsonld';
2
-
3
- export const IS_DEV = process.env.NODE_ENV === 'development';
package/src/index.tsx DELETED
@@ -1,25 +0,0 @@
1
- import React, { FC } from 'react';
2
- import { UseWebReaderArguments } from './types';
3
- import ManagerUI from './ui/manager';
4
- import useWebReader from './useWebReader';
5
-
6
- /**
7
- * The main React component export.
8
- */
9
-
10
- const WebReader: FC<UseWebReaderArguments> = ({
11
- webpubManifestUrl,
12
- proxyUrl,
13
- getContent,
14
- }) => {
15
- const webReader = useWebReader({
16
- webpubManifestUrl,
17
- proxyUrl,
18
- getContent,
19
- });
20
- const { content } = webReader;
21
-
22
- return <ManagerUI {...webReader}>{content}</ManagerUI>;
23
- };
24
-
25
- export default WebReader;