@nypl/web-reader 4.2.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -188
- package/dist/{esm/index.css → index.css} +3 -1
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +532 -0
- package/dist/index.js +9381 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +9378 -0
- package/dist/index.mjs.map +1 -0
- package/dist/injectable-html-styles/ReadiumCSS-after.css +488 -2
- package/dist/injectable-html-styles/ReadiumCSS-after.css.map +1 -7
- package/dist/injectable-html-styles/ReadiumCSS-after.d.ts +2 -0
- package/dist/injectable-html-styles/ReadiumCSS-before.css +648 -2
- package/dist/injectable-html-styles/ReadiumCSS-before.css.map +1 -7
- package/dist/injectable-html-styles/ReadiumCSS-before.d.ts +2 -0
- package/dist/injectable-html-styles/ReadiumCSS-default.css +141 -2
- package/dist/injectable-html-styles/ReadiumCSS-default.css.map +1 -7
- package/dist/injectable-html-styles/ReadiumCSS-default.d.ts +2 -0
- package/package.json +10 -33
- package/dist/cjs/index.css +0 -2
- package/dist/cjs/index.css.map +0 -7
- package/dist/cjs/index.js +0 -340
- package/dist/cjs/index.js.map +0 -7
- package/dist/esm/index.css.map +0 -7
- package/dist/esm/index.js +0 -42090
- package/dist/esm/index.js.map +0 -7
- package/dist/types/HtmlReader/effects.d.ts +0 -22
- package/dist/types/HtmlReader/index.d.ts +0 -15
- package/dist/types/HtmlReader/lib.d.ts +0 -112
- package/dist/types/HtmlReader/reducer.d.ts +0 -8
- package/dist/types/HtmlReader/types.d.ts +0 -116
- package/dist/types/HtmlReader/useIframeLinkClick.d.ts +0 -4
- package/dist/types/HtmlReader/useLocationQuery.d.ts +0 -8
- package/dist/types/HtmlReader/useResource.d.ts +0 -14
- package/dist/types/HtmlReader/useUpdateCSS.d.ts +0 -7
- package/dist/types/HtmlReader/useUpdateScroll.d.ts +0 -6
- package/dist/types/HtmlReader/useWindowResize.d.ts +0 -7
- package/dist/types/PdfReader/ChakraPage.d.ts +0 -3
- package/dist/types/PdfReader/ScrollPage.d.ts +0 -12
- package/dist/types/PdfReader/index.d.ts +0 -13
- package/dist/types/PdfReader/useMeasure.d.ts +0 -7
- package/dist/types/Readium/Injectable.d.ts +0 -11
- package/dist/types/Readium/Locator.d.ts +0 -20
- package/dist/types/WebpubManifestTypes/ConformsTo.d.ts +0 -3
- package/dist/types/WebpubManifestTypes/Contributor.d.ts +0 -17
- package/dist/types/WebpubManifestTypes/EpubExtension.d.ts +0 -47
- package/dist/types/WebpubManifestTypes/LanguageMap.d.ts +0 -3
- package/dist/types/WebpubManifestTypes/Metadata.d.ts +0 -47
- package/dist/types/WebpubManifestTypes/OPDSLink.d.ts +0 -63
- package/dist/types/WebpubManifestTypes/PresentationHints.d.ts +0 -53
- package/dist/types/WebpubManifestTypes/ReadiumLink.d.ts +0 -58
- package/dist/types/WebpubManifestTypes/Subject.d.ts +0 -16
- package/dist/types/WebpubManifestTypes/WebpubManifest.d.ts +0 -14
- package/dist/types/constants.d.ts +0 -37
- package/dist/types/index.d.ts +0 -16
- package/dist/types/types.d.ts +0 -123
- package/dist/types/ui/Button.d.ts +0 -9
- package/dist/types/ui/ErrorBoundary.d.ts +0 -16
- package/dist/types/ui/Footer.d.ts +0 -9
- package/dist/types/ui/Header.d.ts +0 -9
- package/dist/types/ui/HtmlSettings.d.ts +0 -9
- package/dist/types/ui/LoadingSkeleton.d.ts +0 -9
- package/dist/types/ui/PageButton.d.ts +0 -7
- package/dist/types/ui/PdfSettings.d.ts +0 -8
- package/dist/types/ui/SettingsButton.d.ts +0 -5
- package/dist/types/ui/TableOfContent.d.ts +0 -7
- package/dist/types/ui/ToggleButton.d.ts +0 -14
- package/dist/types/ui/ToggleGroup.d.ts +0 -8
- package/dist/types/ui/hooks/useColorModeValue.d.ts +0 -7
- package/dist/types/ui/hooks/useContainerWidth.d.ts +0 -6
- package/dist/types/ui/hooks/useEventListener.d.ts +0 -8
- package/dist/types/ui/hooks/useFullScreen.d.ts +0 -7
- package/dist/types/ui/icons/Continuous.d.ts +0 -4
- package/dist/types/ui/icons/Day.d.ts +0 -4
- package/dist/types/ui/icons/EnlargeFont.d.ts +0 -4
- package/dist/types/ui/icons/Night.d.ts +0 -4
- package/dist/types/ui/icons/Paginated.d.ts +0 -4
- package/dist/types/ui/icons/Previous.d.ts +0 -4
- package/dist/types/ui/icons/ReaderSettings.d.ts +0 -4
- package/dist/types/ui/icons/ReduceFont.d.ts +0 -4
- package/dist/types/ui/icons/Reset.d.ts +0 -4
- package/dist/types/ui/icons/Sepia.d.ts +0 -4
- package/dist/types/ui/icons/TableOfContents.d.ts +0 -4
- package/dist/types/ui/icons/ToggleFullScreen.d.ts +0 -4
- package/dist/types/ui/icons/ToggleFullScreenExit.d.ts +0 -4
- package/dist/types/ui/icons/index.d.ts +0 -14
- package/dist/types/ui/manager.d.ts +0 -9
- package/dist/types/ui/menu/index.d.ts +0 -10
- package/dist/types/ui/menu/menu.d.ts +0 -76
- package/dist/types/ui/menu/use-menu.d.ts +0 -2510
- package/dist/types/ui/nypl-base-theme/components/button.d.ts +0 -94
- package/dist/types/ui/nypl-base-theme/components/checkbox.d.ts +0 -41
- package/dist/types/ui/nypl-base-theme/components/form-error.d.ts +0 -14
- package/dist/types/ui/nypl-base-theme/components/form-label.d.ts +0 -14
- package/dist/types/ui/nypl-base-theme/components/form.d.ts +0 -15
- package/dist/types/ui/nypl-base-theme/components/input.d.ts +0 -107
- package/dist/types/ui/nypl-base-theme/components/text-area.d.ts +0 -34
- package/dist/types/ui/nypl-base-theme/foundations/breakpoints.d.ts +0 -8
- package/dist/types/ui/nypl-base-theme/foundations/colors.d.ts +0 -3
- package/dist/types/ui/nypl-base-theme/foundations/global.d.ts +0 -13
- package/dist/types/ui/nypl-base-theme/foundations/radii.d.ts +0 -12
- package/dist/types/ui/nypl-base-theme/foundations/spacing.d.ts +0 -49
- package/dist/types/ui/nypl-base-theme/foundations/typography.d.ts +0 -10
- package/dist/types/ui/nypl-base-theme/index.d.ts +0 -7
- package/dist/types/ui/nypl-base-theme/types.d.ts +0 -1
- package/dist/types/ui/theme/components/alert.d.ts +0 -24
- package/dist/types/ui/theme/components/button.d.ts +0 -93
- package/dist/types/ui/theme/components/text.d.ts +0 -20
- package/dist/types/ui/theme/foundations/colors.d.ts +0 -3
- package/dist/types/ui/theme/foundations/fonts.d.ts +0 -3
- package/dist/types/ui/theme/foundations/typography.d.ts +0 -6
- package/dist/types/ui/theme/index.d.ts +0 -12
- package/dist/types/ui/theme/types.d.ts +0 -1
- package/dist/types/useWebReader.d.ts +0 -7
- package/dist/types/utils/decryptAxisNow.d.ts +0 -0
- package/dist/types/utils/fetch.d.ts +0 -4
- package/dist/types/utils/getColor.d.ts +0 -2
- package/dist/types/utils/localstorage.d.ts +0 -21
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ReaderSettings, WebpubManifest } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* These are effects that reach in to the iframe element and modify it.
|
|
4
|
-
* They are not part of the reducer, and should only be called from within a
|
|
5
|
-
* useEffect hook.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Scroll the HTML element to a given progression by
|
|
9
|
-
* setting the scrollTop or the scrollLeft.
|
|
10
|
-
*/
|
|
11
|
-
export declare function navigateToProgression(iframe: HTMLIFrameElement, progression: number, isScrolling: boolean): void;
|
|
12
|
-
export declare function navigateToHash(fragment: string, iframe: HTMLIFrameElement, isScrolling: boolean): void;
|
|
13
|
-
/**
|
|
14
|
-
* Takes the HTML element and sets CSS variables on it based on the
|
|
15
|
-
* reader's state
|
|
16
|
-
*/
|
|
17
|
-
export declare function setCss(iframeHtml: Document, settings: ReaderSettings, iframeContainer: HTMLElement | null, manifest: WebpubManifest | undefined): void;
|
|
18
|
-
export declare function setReflowableCss(iframeHtml: HTMLElement, settings: ReaderSettings): void;
|
|
19
|
-
/**
|
|
20
|
-
* Apply the transform property to the iframe document to fit the current screen viewport.
|
|
21
|
-
*/
|
|
22
|
-
export declare function setFixedCss(iframeDocument: Document, iframeContainer: HTMLElement | null): void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReaderReturn, ReaderArguments } from '../types';
|
|
2
|
-
export declare const IFRAME_ID_SELECTOR = "html-reader-iframe";
|
|
3
|
-
/**
|
|
4
|
-
* @TODO :
|
|
5
|
-
*
|
|
6
|
-
* Future:
|
|
7
|
-
* - provide default injectables (Readium CSS)
|
|
8
|
-
* - Find some way to organize effects and actions together so you can navigate, wait for iframe to load,
|
|
9
|
-
* then run some other effect.
|
|
10
|
-
* - goForward and goBackward should return a promise that resolves once isNavigated flips to true.
|
|
11
|
-
* - Sync settings to localStorage or something similar.
|
|
12
|
-
* - Add a way to call a callback when current reading position changes (so OE web can save current position).
|
|
13
|
-
* - Maybe use history.pushState when navigating via nextPage or previousPage or toc.
|
|
14
|
-
*/
|
|
15
|
-
export default function useHtmlReader(args: ReaderArguments): ReaderReturn;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '../Readium/Injectable';
|
|
2
|
-
import { Locator } from '../Readium/Locator';
|
|
3
|
-
import { WebpubManifest, ColorMode, FontFamily } from '../types';
|
|
4
|
-
import { ReadiumLink } from '../WebpubManifestTypes/ReadiumLink';
|
|
5
|
-
import { ActiveState } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Constants
|
|
8
|
-
*/
|
|
9
|
-
export declare const FONT_SIZE_STEP = 4;
|
|
10
|
-
/**
|
|
11
|
-
* If we provide injectables that are not found, the app won't load at all.
|
|
12
|
-
* Therefore we will not provide any default injectables.
|
|
13
|
-
* @todo - this is not true in our custom renderer. We should provide default injectables.
|
|
14
|
-
*/
|
|
15
|
-
export declare const defaultInjectables: Injectable[];
|
|
16
|
-
export declare const defaultInjectablesFixed: Injectable[];
|
|
17
|
-
/**
|
|
18
|
-
* Creates an element for an injectable so it can be injected into the iframe.
|
|
19
|
-
*/
|
|
20
|
-
export declare function makeInjectableElement(document: Document, injectable: Injectable): HTMLElement | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* gets the index of the current location href
|
|
23
|
-
*/
|
|
24
|
-
export declare function getCurrentIndex(manifest: WebpubManifest, state: ActiveState, baseUrl: string): number;
|
|
25
|
-
/**
|
|
26
|
-
* Find a link in the reading order from a passed in href.
|
|
27
|
-
*/
|
|
28
|
-
export declare function getFromReadingOrder(href: string, manifest: WebpubManifest, baseUrl: string): {
|
|
29
|
-
link: ReadiumLink;
|
|
30
|
-
index: number;
|
|
31
|
-
} | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Check if two hrefs share the same pathname. They can be absolute
|
|
34
|
-
* or relative. This will ignore hash and query params.
|
|
35
|
-
*/
|
|
36
|
-
export declare function isSameResource(href1: string, href2: string, baseUrl: string): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Converts a ReadiumLink to a Locator
|
|
39
|
-
*/
|
|
40
|
-
export declare function linkToLocator(link: ReadiumLink, baseUrl: string, locations?: Locator['locations']): Locator;
|
|
41
|
-
declare type CalculatedPosition = {
|
|
42
|
-
isHorizontalPaginated: boolean;
|
|
43
|
-
containerSize: number;
|
|
44
|
-
containerWidth: number;
|
|
45
|
-
containerHeight: number;
|
|
46
|
-
pageSize: number;
|
|
47
|
-
resourceSize: number;
|
|
48
|
-
scrollPosition: number;
|
|
49
|
-
totalPages: number;
|
|
50
|
-
progression: number;
|
|
51
|
-
currentPage: number;
|
|
52
|
-
currentPageFloor: number;
|
|
53
|
-
isAtEnd: boolean;
|
|
54
|
-
isAtStart: boolean;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Calculate current position information
|
|
58
|
-
*/
|
|
59
|
-
export declare function calcPosition(iframe: HTMLIFrameElement, isScrolling: boolean): CalculatedPosition;
|
|
60
|
-
/**
|
|
61
|
-
* Gets scroll position of an element
|
|
62
|
-
*/
|
|
63
|
-
export declare function getScrollPosition(element: HTMLElement | undefined | null): {
|
|
64
|
-
x: number;
|
|
65
|
-
y: number;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Fetches a resource as text
|
|
69
|
-
*/
|
|
70
|
-
export declare function fetchAsTxt(url: string): Promise<string>;
|
|
71
|
-
/**
|
|
72
|
-
* Inject some raw JS into the iframe document
|
|
73
|
-
*/
|
|
74
|
-
export declare function injectJS(document: Document): void;
|
|
75
|
-
export declare function getMaybeIframeHtml(iframe: HTMLIFrameElement): HTMLElement | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* Get the HTML element of the iframe
|
|
78
|
-
*/
|
|
79
|
-
export declare function getIframeHTML(iframe: HTMLIFrameElement): HTMLElement;
|
|
80
|
-
/**
|
|
81
|
-
* Sets a CSS var on the html element in the iframe. Used to set
|
|
82
|
-
* ReadiumCSS settings like scrolling and color mode and font
|
|
83
|
-
* size.
|
|
84
|
-
*/
|
|
85
|
-
export declare function setCSSProperty(html: HTMLElement, name: string, val: string): void;
|
|
86
|
-
/**
|
|
87
|
-
* Translates the readium scroll css var into a boolean
|
|
88
|
-
*/
|
|
89
|
-
export declare function getPagination(isPaginated: boolean): 'readium-scroll-on' | 'readium-scroll-off';
|
|
90
|
-
/**
|
|
91
|
-
* Translates the internal color mode value into a Readium
|
|
92
|
-
* color mode value.
|
|
93
|
-
*/
|
|
94
|
-
export declare function getColorModeValue(mode: ColorMode): 'readium-default-on' | 'readium-night-on' | 'readium-sepia-on';
|
|
95
|
-
/**
|
|
96
|
-
* Translates the readium color mode value into an internal
|
|
97
|
-
* color mode value
|
|
98
|
-
*/
|
|
99
|
-
export declare function getColorMode(d2Mode: string): ColorMode;
|
|
100
|
-
/**
|
|
101
|
-
* Gets the Readium font-override setting based on the given font family.
|
|
102
|
-
*/
|
|
103
|
-
export declare function getFontOverride(fontFamily: FontFamily): 'readium-font-off' | 'readium-font-on';
|
|
104
|
-
/**
|
|
105
|
-
* Translates the internal font family to a readium css font family value.
|
|
106
|
-
*/
|
|
107
|
-
export declare const familyToReadiumFamily: Record<FontFamily, string>;
|
|
108
|
-
/**
|
|
109
|
-
* Translates a readium css font family to an internal font family.
|
|
110
|
-
*/
|
|
111
|
-
export declare const r2FamilyToFamily: Record<string, FontFamily | undefined>;
|
|
112
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ReaderArguments } from '../types';
|
|
2
|
-
import { HtmlAction, HtmlState, InactiveState } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* A higher order function that makes it easy to access arguments in the reducer
|
|
5
|
-
* without passing them in to every `dispatch` call.
|
|
6
|
-
*/
|
|
7
|
-
export default function makeHtmlReducer(args: ReaderArguments): (state: HtmlState, action: HtmlAction) => HtmlState;
|
|
8
|
-
export declare const inactiveState: InactiveState;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Locator } from '../Readium/Locator';
|
|
2
|
-
import { ColorMode, FontFamily, ReaderArguments, ReaderSettings, ReaderState } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Html Reader States
|
|
5
|
-
* - Can be broken into distinct states that we create a union from.
|
|
6
|
-
* This helps us avoid invalid states.
|
|
7
|
-
* - We include a `state` property so that it is easy to narrow the type
|
|
8
|
-
* of a given HtmlState to a specific state in the union.
|
|
9
|
-
*/
|
|
10
|
-
export declare type HtmlState = InactiveState | ActiveState;
|
|
11
|
-
export declare type ActiveState = FetchingResourceState | ResourceFetchErrorState | RenderingIframeState | LoadingIframeState | NavigatingState | ReadyState;
|
|
12
|
-
export declare type InactiveState = ReaderState & {
|
|
13
|
-
state: 'INACTIVE';
|
|
14
|
-
location: undefined;
|
|
15
|
-
iframe: null;
|
|
16
|
-
resource: undefined;
|
|
17
|
-
resourceFetchError: undefined;
|
|
18
|
-
};
|
|
19
|
-
export declare type FetchingResourceState = ReaderState & {
|
|
20
|
-
state: 'FETCHING_RESOURCE';
|
|
21
|
-
location: Locator;
|
|
22
|
-
iframe: null;
|
|
23
|
-
resource: undefined;
|
|
24
|
-
resourceFetchError: undefined;
|
|
25
|
-
settings: ReaderSettings;
|
|
26
|
-
};
|
|
27
|
-
export declare type ResourceFetchErrorState = ReaderState & {
|
|
28
|
-
state: 'RESOURCE_FETCH_ERROR';
|
|
29
|
-
location: Locator;
|
|
30
|
-
iframe: null;
|
|
31
|
-
resource: undefined;
|
|
32
|
-
resourceFetchError: Error;
|
|
33
|
-
settings: ReaderSettings;
|
|
34
|
-
};
|
|
35
|
-
export declare type RenderingIframeState = ReaderState & {
|
|
36
|
-
state: 'RENDERING_IFRAME';
|
|
37
|
-
location: Locator;
|
|
38
|
-
iframe: null;
|
|
39
|
-
resource: string;
|
|
40
|
-
resourceFetchError: undefined;
|
|
41
|
-
settings: ReaderSettings;
|
|
42
|
-
};
|
|
43
|
-
export declare type LoadingIframeState = ReaderState & {
|
|
44
|
-
state: 'LOADING_IFRAME';
|
|
45
|
-
location: Locator;
|
|
46
|
-
iframe: HTMLIFrameElement;
|
|
47
|
-
resource: string;
|
|
48
|
-
resourceFetchError: undefined;
|
|
49
|
-
settings: ReaderSettings;
|
|
50
|
-
};
|
|
51
|
-
export declare type NavigatingState = ReaderState & {
|
|
52
|
-
state: 'NAVIGATING';
|
|
53
|
-
location: Locator;
|
|
54
|
-
iframe: HTMLIFrameElement;
|
|
55
|
-
resource: string;
|
|
56
|
-
resourceFetchError: undefined;
|
|
57
|
-
settings: ReaderSettings;
|
|
58
|
-
};
|
|
59
|
-
export declare type ReadyState = ReaderState & {
|
|
60
|
-
state: 'READY';
|
|
61
|
-
location: Locator;
|
|
62
|
-
iframe: HTMLIFrameElement;
|
|
63
|
-
resource: string;
|
|
64
|
-
resourceFetchError: undefined;
|
|
65
|
-
settings: ReaderSettings;
|
|
66
|
-
};
|
|
67
|
-
export declare type HtmlAction = {
|
|
68
|
-
type: 'ARGS_CHANGED';
|
|
69
|
-
args: ReaderArguments;
|
|
70
|
-
} | {
|
|
71
|
-
type: 'IFRAME_LOADED';
|
|
72
|
-
} | {
|
|
73
|
-
type: 'NAV_PREVIOUS_RESOURCE';
|
|
74
|
-
} | {
|
|
75
|
-
type: 'NAV_NEXT_RESOURCE';
|
|
76
|
-
} | {
|
|
77
|
-
type: 'GO_TO_HREF';
|
|
78
|
-
href: string;
|
|
79
|
-
} | {
|
|
80
|
-
type: 'GO_TO_LOCATION';
|
|
81
|
-
location: Locator;
|
|
82
|
-
} | {
|
|
83
|
-
type: 'GO_FORWARD';
|
|
84
|
-
} | {
|
|
85
|
-
type: 'GO_BACKWARD';
|
|
86
|
-
} | {
|
|
87
|
-
type: 'WINDOW_RESIZED';
|
|
88
|
-
} | {
|
|
89
|
-
type: 'NAV_COMPLETE';
|
|
90
|
-
} | {
|
|
91
|
-
type: 'SET_COLOR_MODE';
|
|
92
|
-
mode: ColorMode;
|
|
93
|
-
} | {
|
|
94
|
-
type: 'SET_SCROLL';
|
|
95
|
-
isScrolling: boolean;
|
|
96
|
-
} | {
|
|
97
|
-
type: 'INCREASE_FONT_SIZE';
|
|
98
|
-
} | {
|
|
99
|
-
type: 'DECREASE_FONT_SIZE';
|
|
100
|
-
} | {
|
|
101
|
-
type: 'RESET_SETTINGS';
|
|
102
|
-
} | {
|
|
103
|
-
type: 'SET_FONT_FAMILY';
|
|
104
|
-
family: FontFamily;
|
|
105
|
-
} | {
|
|
106
|
-
type: 'USER_SCROLLED';
|
|
107
|
-
} | {
|
|
108
|
-
type: 'SET_IFRAME';
|
|
109
|
-
iframe: HTMLIFrameElement | null;
|
|
110
|
-
} | {
|
|
111
|
-
type: 'RESOURCE_FETCH_SUCCESS';
|
|
112
|
-
resource: string;
|
|
113
|
-
} | {
|
|
114
|
-
type: 'RESOURCE_FETCH_ERROR';
|
|
115
|
-
error: Error;
|
|
116
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WebpubManifest } from '../WebpubManifestTypes/WebpubManifest';
|
|
3
|
-
import { HtmlAction } from './types';
|
|
4
|
-
export default function useIframeLinkClick(baseUrl: string | undefined, manifest: WebpubManifest | undefined, dispatch: React.Dispatch<HtmlAction>): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Locator } from '../Readium/Locator';
|
|
2
|
-
import { HtmlState } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Keep the Location state in the browser's url bar.
|
|
5
|
-
* Dispatch location changed when the url changes.
|
|
6
|
-
*/
|
|
7
|
-
export default function useLocationQuery(state: HtmlState): void;
|
|
8
|
-
export declare function getLocationQuery(): Locator | undefined;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Injectable } from '../Readium/Injectable';
|
|
3
|
-
import { WebpubManifest } from '../types';
|
|
4
|
-
import { HtmlState, HtmlAction } from './types';
|
|
5
|
-
/**
|
|
6
|
-
* Fetches a resource whenever the url changes and dispatches
|
|
7
|
-
* actions to keep the reducer up to date. Works similar to
|
|
8
|
-
* useSWR, but storing the resource in the reducer state, not
|
|
9
|
-
* separately.
|
|
10
|
-
*
|
|
11
|
-
* Also performs some modifications on the resource to add initial
|
|
12
|
-
* css variables and injectables.
|
|
13
|
-
*/
|
|
14
|
-
export default function useResource(manifest: WebpubManifest | undefined, state: HtmlState, getContent: (url: string) => Promise<string>, injectables: Injectable[], dispatch: React.Dispatch<HtmlAction>): void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { WebpubManifest } from '../types';
|
|
2
|
-
import { HtmlState } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Set CSS variables when user state changes.
|
|
5
|
-
* @todo - narrow down the dependencies so this doesn't run on _every_ state change.
|
|
6
|
-
*/
|
|
7
|
-
export default function useUpdateCSS(state: HtmlState, manifest: WebpubManifest | undefined): void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WebpubManifest } from '../types';
|
|
3
|
-
import { HtmlAction, HtmlState } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Simply dispatches an action when the window is resized.
|
|
6
|
-
*/
|
|
7
|
-
export default function useWindowResize(manifest: WebpubManifest | undefined, state: HtmlState, dispatch: React.Dispatch<HtmlAction>): void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { PageProps } from 'react-pdf';
|
|
3
|
-
declare type ScrollPageProps = {
|
|
4
|
-
pageNumber: number;
|
|
5
|
-
width: number | undefined;
|
|
6
|
-
scale: number;
|
|
7
|
-
onLoadSuccess: (page: PageProps) => void;
|
|
8
|
-
placeholderHeight: number;
|
|
9
|
-
placeholderWidth: number;
|
|
10
|
-
};
|
|
11
|
-
declare const ScrollPage: FC<ScrollPageProps>;
|
|
12
|
-
export default ScrollPage;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ReaderArguments, ReaderReturn } from '../types';
|
|
2
|
-
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
|
|
3
|
-
export declare const SCALE_STEP = 0.1;
|
|
4
|
-
/**
|
|
5
|
-
* The PDF reader
|
|
6
|
-
*
|
|
7
|
-
* The PDF reader loads resources in two stages: First, it fetches the PDF resource as an Uint8Array
|
|
8
|
-
* Then, it passes this array into the <Document> object, which loads the PDF inside an iframe
|
|
9
|
-
*
|
|
10
|
-
* @param args T
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
export default function usePdfReader(args: ReaderArguments): ReaderReturn;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare type Dimensions = Pick<DOMRectReadOnly, 'x' | 'y' | 'top' | 'left' | 'right' | 'bottom' | 'height' | 'width'>;
|
|
2
|
-
export declare type UseMeasureRef<E extends Element = Element> = (element: E) => void;
|
|
3
|
-
export declare type UseMeasureResult<E extends Element = Element> = [
|
|
4
|
-
UseMeasureRef<E> | null,
|
|
5
|
-
Dimensions
|
|
6
|
-
];
|
|
7
|
-
export default function useMeasure<E extends Element = Element>(): UseMeasureResult<E>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface Locator {
|
|
2
|
-
href: string;
|
|
3
|
-
type?: string;
|
|
4
|
-
title?: string;
|
|
5
|
-
locations: Locations;
|
|
6
|
-
text?: LocatorText;
|
|
7
|
-
}
|
|
8
|
-
export interface LocatorText {
|
|
9
|
-
after?: string;
|
|
10
|
-
before?: string;
|
|
11
|
-
highlight?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface Locations {
|
|
14
|
-
fragment?: string;
|
|
15
|
-
progression?: number;
|
|
16
|
-
position?: number;
|
|
17
|
-
totalProgression?: number;
|
|
18
|
-
remainingPositions?: number;
|
|
19
|
-
totalRemainingPositions?: number;
|
|
20
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ReadiumLink } from './ReadiumLink';
|
|
2
|
-
export interface ContributorObject {
|
|
3
|
-
name: string | {
|
|
4
|
-
/**
|
|
5
|
-
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
6
|
-
* 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})+))$".
|
|
7
|
-
*/
|
|
8
|
-
[k: string]: string;
|
|
9
|
-
};
|
|
10
|
-
identifier?: string;
|
|
11
|
-
sortAs?: string;
|
|
12
|
-
role?: string | string[];
|
|
13
|
-
position?: number;
|
|
14
|
-
links?: ReadiumLink[];
|
|
15
|
-
[k: string]: unknown;
|
|
16
|
-
}
|
|
17
|
-
export declare type Contributor = string | (string | ContributorObject)[] | ContributorObject;
|
|
@@ -1,47 +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
|
-
export interface EPUBExtensionMetadata {
|
|
39
|
-
presentation?: {
|
|
40
|
-
/**
|
|
41
|
-
* Hints how the layout of the resource should be presented
|
|
42
|
-
*/
|
|
43
|
-
layout?: 'fixed' | 'reflowable';
|
|
44
|
-
[k: string]: unknown;
|
|
45
|
-
};
|
|
46
|
-
[k: string]: unknown;
|
|
47
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ConformsTo } from './ConformsTo';
|
|
2
|
-
import { Contributor } from './Contributor';
|
|
3
|
-
import { EPUBExtensionMetadata } from './EpubExtension';
|
|
4
|
-
import { LanguageMap } from './LanguageMap';
|
|
5
|
-
import { Subject } from './Subject';
|
|
6
|
-
export interface Metadata extends Contributors, EPUBExtensionMetadata {
|
|
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
|
-
export interface Contributors {
|
|
34
|
-
author?: Contributor;
|
|
35
|
-
translator?: Contributor;
|
|
36
|
-
editor?: Contributor;
|
|
37
|
-
artist?: Contributor;
|
|
38
|
-
illustrator?: Contributor;
|
|
39
|
-
letterer?: Contributor;
|
|
40
|
-
penciler?: Contributor;
|
|
41
|
-
colorist?: Contributor;
|
|
42
|
-
inker?: Contributor;
|
|
43
|
-
narrator?: Contributor;
|
|
44
|
-
contributor?: Contributor;
|
|
45
|
-
publisher?: Contributor;
|
|
46
|
-
imprint?: Contributor;
|
|
47
|
-
}
|
|
@@ -1,63 +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: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UZS' | 'VEF' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL';
|
|
12
|
-
[k: string]: unknown;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Indirect acquisition provides a hint for the expected media type that will be acquired after additional steps
|
|
16
|
-
*/
|
|
17
|
-
indirectAcquisition?: OPDSAcquisitionObject[];
|
|
18
|
-
/**
|
|
19
|
-
* Library-specific feature for unavailable books that support a hold list
|
|
20
|
-
*/
|
|
21
|
-
holds?: {
|
|
22
|
-
total?: number;
|
|
23
|
-
position?: number;
|
|
24
|
-
[k: string]: unknown;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Library-specific feature that contains information about the copies that a library has acquired
|
|
28
|
-
*/
|
|
29
|
-
copies?: {
|
|
30
|
-
total?: number;
|
|
31
|
-
available?: number;
|
|
32
|
-
[k: string]: unknown;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Indicates the availability of a given resource
|
|
36
|
-
*/
|
|
37
|
-
availability?: {
|
|
38
|
-
state: 'available' | 'unavailable' | 'reserved' | 'ready';
|
|
39
|
-
/**
|
|
40
|
-
* Timestamp for the previous state change
|
|
41
|
-
*/
|
|
42
|
-
since?: ({
|
|
43
|
-
[k: string]: unknown;
|
|
44
|
-
} | {
|
|
45
|
-
[k: string]: unknown;
|
|
46
|
-
}) & string;
|
|
47
|
-
/**
|
|
48
|
-
* Timestamp for the next state change
|
|
49
|
-
*/
|
|
50
|
-
until?: ({
|
|
51
|
-
[k: string]: unknown;
|
|
52
|
-
} | {
|
|
53
|
-
[k: string]: unknown;
|
|
54
|
-
}) & string;
|
|
55
|
-
[k: string]: unknown;
|
|
56
|
-
};
|
|
57
|
-
[k: string]: unknown;
|
|
58
|
-
}
|
|
59
|
-
export interface OPDSAcquisitionObject {
|
|
60
|
-
type: string;
|
|
61
|
-
child?: OPDSAcquisitionObject[];
|
|
62
|
-
[k: string]: unknown;
|
|
63
|
-
}
|
|
@@ -1,53 +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
|
-
export interface PresentationHintsLinkProperties {
|
|
32
|
-
/**
|
|
33
|
-
* Specifies whether or not the parts of a linked resource that flow out of the viewport are clipped.
|
|
34
|
-
*/
|
|
35
|
-
clipped?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Specifies constraints for the presentation of a linked resource within the viewport.
|
|
38
|
-
*/
|
|
39
|
-
fit?: 'contain' | 'cover' | 'width' | 'height';
|
|
40
|
-
/**
|
|
41
|
-
* Suggested orientation for the device when displaying the linked resource.
|
|
42
|
-
*/
|
|
43
|
-
orientation?: 'auto' | 'landscape' | 'portrait';
|
|
44
|
-
/**
|
|
45
|
-
* Indicates how the linked resource should be displayed in a reading environment that displays synthetic spreads.
|
|
46
|
-
*/
|
|
47
|
-
page?: 'left' | 'right' | 'center';
|
|
48
|
-
/**
|
|
49
|
-
* Indicates the condition to be met for the linked resource to be rendered within a synthetic spread.
|
|
50
|
-
*/
|
|
51
|
-
spread?: 'auto' | 'both' | 'none' | 'landscape';
|
|
52
|
-
[k: string]: unknown;
|
|
53
|
-
}
|