@nypl/web-reader 3.2.5 → 4.1.0

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 (39) hide show
  1. package/README.md +2 -23
  2. package/dist/cjs/index.js +62 -16
  3. package/dist/cjs/index.js.map +3 -3
  4. package/dist/esm/index.js +1074 -563
  5. package/dist/esm/index.js.map +3 -3
  6. package/dist/types/HtmlReader/types.d.ts +2 -0
  7. package/dist/types/constants.d.ts +26 -0
  8. package/dist/types/index.d.ts +0 -1
  9. package/dist/types/types.d.ts +1 -0
  10. package/dist/types/ui/HtmlSettings.d.ts +1 -0
  11. package/dist/types/ui/ToggleButton.d.ts +5 -2
  12. package/dist/types/ui/icons/Continuous.d.ts +4 -0
  13. package/dist/types/ui/icons/Day.d.ts +4 -0
  14. package/dist/types/ui/icons/EnlargeFont.d.ts +4 -0
  15. package/dist/types/ui/icons/Night.d.ts +4 -0
  16. package/dist/types/ui/icons/Paginated.d.ts +4 -0
  17. package/dist/types/ui/icons/Previous.d.ts +4 -0
  18. package/dist/types/ui/icons/ReaderSettings.d.ts +4 -0
  19. package/dist/types/ui/icons/ReduceFont.d.ts +4 -0
  20. package/dist/types/ui/icons/Reset.d.ts +4 -0
  21. package/dist/types/ui/icons/Sepia.d.ts +4 -0
  22. package/dist/types/ui/icons/TableOfContents.d.ts +4 -0
  23. package/dist/types/ui/icons/ToggleFullScreen.d.ts +4 -0
  24. package/dist/types/ui/icons/ToggleFullScreenExit.d.ts +4 -0
  25. package/dist/types/ui/icons/index.d.ts +14 -0
  26. package/dist/types/ui/menu/use-menu.d.ts +18 -18
  27. package/dist/types/ui/theme/components/button.d.ts +21 -14
  28. package/dist/types/ui/theme/foundations/fonts.d.ts +3 -0
  29. package/dist/types/ui/theme/foundations/typography.d.ts +6 -0
  30. package/package.json +13 -17
  31. package/dist/cjs/ServiceWorker/sw.js +0 -2
  32. package/dist/cjs/ServiceWorker/sw.js.map +0 -7
  33. package/dist/esm/ServiceWorker/sw.js +0 -1749
  34. package/dist/esm/ServiceWorker/sw.js.map +0 -7
  35. package/dist/types/ServiceWorker/client.d.ts +0 -6
  36. package/dist/types/ServiceWorker/constants.d.ts +0 -4
  37. package/dist/types/ServiceWorker/index.d.ts +0 -1
  38. package/dist/types/ServiceWorker/sw.d.ts +0 -19
  39. package/dist/types/ServiceWorker/types.d.ts +0 -13
@@ -97,6 +97,8 @@ export declare type HtmlAction = {
97
97
  type: 'INCREASE_FONT_SIZE';
98
98
  } | {
99
99
  type: 'DECREASE_FONT_SIZE';
100
+ } | {
101
+ type: 'RESET_SETTINGS';
100
102
  } | {
101
103
  type: 'SET_FONT_FAMILY';
102
104
  family: FontFamily;
@@ -7,5 +7,31 @@ export declare const CHROME_HEIGHT: number;
7
7
  export declare const DEFAULT_HEIGHT: string;
8
8
  export declare const DEFAULT_SHOULD_GROW_WHEN_SCROLLING = true;
9
9
  export declare const DEFAULT_SETTINGS: ReaderSettings;
10
+ export declare const FONT_DETAILS: {
11
+ publisher: {
12
+ heading: string;
13
+ body: string;
14
+ token: string;
15
+ fontWeight: string;
16
+ };
17
+ serif: {
18
+ heading: string;
19
+ body: string;
20
+ token: string;
21
+ fontWeight: string;
22
+ };
23
+ 'sans-serif': {
24
+ heading: string;
25
+ body: string;
26
+ token: string;
27
+ fontWeight: string;
28
+ };
29
+ 'open-dyslexic': {
30
+ heading: string;
31
+ body: string;
32
+ token: string;
33
+ fontWeight: string;
34
+ };
35
+ };
10
36
  export declare const LOCAL_STORAGE_SETTINGS_KEY = "web-reader-settings";
11
37
  export declare const LOCAL_STORAGE_LOCATIONS_KEY = "web-reader-locations";
@@ -7,7 +7,6 @@ export declare type WebReaderProps = UseWebReaderArguments & ReaderManagerArgume
7
7
  export declare const WebReaderWithoutBoundary: FC<WebReaderProps>;
8
8
  declare const WebReader: FC<WebReaderProps>;
9
9
  export default WebReader;
10
- export { usePublicationSW } from './ServiceWorker/index';
11
10
  export { default as useWebReader } from './useWebReader';
12
11
  export { default as useHtmlReader } from './HtmlReader';
13
12
  export { default as usePdfReader } from './PdfReader';
@@ -20,6 +20,7 @@ export declare type PdfNavigator = Navigator & {
20
20
  export declare type HtmlNavigator = Navigator & {
21
21
  increaseFontSize: () => Promise<void>;
22
22
  decreaseFontSize: () => Promise<void>;
23
+ resetSettings: () => Promise<void>;
23
24
  setFontFamily: (family: FontFamily) => Promise<void>;
24
25
  setColorMode: (mode: ColorMode) => Promise<void>;
25
26
  };
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { HtmlNavigator, ReaderState } from '../types';
3
3
  export declare type HtmlSettingsProps = {
4
4
  navigator: HtmlNavigator;
5
+ iconFill: string;
5
6
  readerState: ReaderState;
6
7
  paginationValue: string;
7
8
  };
@@ -1,11 +1,14 @@
1
- import React from 'react';
1
+ import React, { ReactElement } from 'react';
2
2
  import { Box as ChakraBox } from '@chakra-ui/react';
3
3
  import { ColorMode } from '../types';
4
4
  export interface ToggleButtonProps extends React.ComponentPropsWithoutRef<typeof ChakraBox> {
5
- isChecked?: false;
6
5
  colorMode?: ColorMode;
6
+ icon?: ReactElement;
7
+ iconFill?: string;
7
8
  label?: string;
8
9
  value: string;
9
10
  }
10
11
  declare function ToggleButton(props: React.PropsWithoutRef<ToggleButtonProps>): React.ReactElement;
12
+ export declare const FontToggleButton: typeof ToggleButton;
13
+ export declare const ColorModeToggleButton: typeof ToggleButton;
11
14
  export default ToggleButton;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const Continuous: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default Continuous;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const Day: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default Day;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const EnlargeFont: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default EnlargeFont;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const Night: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default Night;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const Paginated: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default Paginated;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const Previous: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default Previous;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const ReaderSettings: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default ReaderSettings;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const ReduceFont: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default ReduceFont;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const Reset: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default Reset;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const Sepia: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default Sepia;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const TableOfContents: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default TableOfContents;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const ToggleFullScreen: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default ToggleFullScreen;
@@ -0,0 +1,4 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { Icon } from '@chakra-ui/react';
3
+ declare const ToggleFullScreenExit: (props: React.ComponentProps<typeof Icon>) => ReactElement;
4
+ export default ToggleFullScreenExit;
@@ -0,0 +1,14 @@
1
+ import Continuous from './Continuous';
2
+ import Day from './Day';
3
+ import EnlargeFont from './EnlargeFont';
4
+ import Night from './Night';
5
+ import Paginated from './Paginated';
6
+ import Previous from './Previous';
7
+ import ReaderSettings from './ReaderSettings';
8
+ import ReduceFont from './ReduceFont';
9
+ import Reset from './Reset';
10
+ import Sepia from './Sepia';
11
+ import TableOfContents from './TableOfContents';
12
+ import ToggleFullScreen from './ToggleFullScreen';
13
+ import ToggleFullScreenExit from './ToggleFullScreenExit';
14
+ export { Continuous, Day, EnlargeFont, Night, Paginated, Previous, ReaderSettings, ReduceFont, Reset, Sepia, TableOfContents, ToggleFullScreen, ToggleFullScreenExit, };
@@ -119,7 +119,7 @@ export declare function useMenuButton(props?: UseMenuButtonProps, externalRef?:
119
119
  suppressHydrationWarning?: boolean | undefined;
120
120
  accessKey?: string | undefined;
121
121
  className?: string | undefined;
122
- contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
122
+ contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
123
123
  contextMenu?: string | undefined;
124
124
  dir?: string | undefined;
125
125
  draggable?: (boolean | "true" | "false") | undefined;
@@ -128,7 +128,7 @@ export declare function useMenuButton(props?: UseMenuButtonProps, externalRef?:
128
128
  placeholder?: string | undefined;
129
129
  spellCheck?: (boolean | "true" | "false") | undefined;
130
130
  tabIndex?: number | undefined;
131
- translate?: "yes" | "no" | undefined;
131
+ translate?: "no" | "yes" | undefined;
132
132
  radioGroup?: string | undefined;
133
133
  about?: string | undefined;
134
134
  datatype?: string | undefined;
@@ -148,7 +148,7 @@ export declare function useMenuButton(props?: UseMenuButtonProps, externalRef?:
148
148
  itemRef?: string | undefined;
149
149
  results?: number | undefined;
150
150
  security?: string | undefined;
151
- unselectable?: "on" | "off" | undefined;
151
+ unselectable?: "off" | "on" | undefined;
152
152
  inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
153
153
  is?: string | undefined;
154
154
  'aria-activedescendant'?: string | undefined;
@@ -1170,7 +1170,7 @@ export declare function useMenuList(props?: UseMenuListProps, ref?: React.Ref<an
1170
1170
  suppressHydrationWarning?: boolean | undefined;
1171
1171
  accessKey?: string | undefined;
1172
1172
  className?: string | undefined;
1173
- contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
1173
+ contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
1174
1174
  contextMenu?: string | undefined;
1175
1175
  dir?: string | undefined;
1176
1176
  draggable?: (boolean | "true" | "false") | undefined;
@@ -1178,7 +1178,7 @@ export declare function useMenuList(props?: UseMenuListProps, ref?: React.Ref<an
1178
1178
  lang?: string | undefined;
1179
1179
  placeholder?: string | undefined;
1180
1180
  spellCheck?: (boolean | "true" | "false") | undefined;
1181
- translate?: "yes" | "no" | undefined;
1181
+ translate?: "no" | "yes" | undefined;
1182
1182
  radioGroup?: string | undefined;
1183
1183
  about?: string | undefined;
1184
1184
  datatype?: string | undefined;
@@ -1198,7 +1198,7 @@ export declare function useMenuList(props?: UseMenuListProps, ref?: React.Ref<an
1198
1198
  itemRef?: string | undefined;
1199
1199
  results?: number | undefined;
1200
1200
  security?: string | undefined;
1201
- unselectable?: "on" | "off" | undefined;
1201
+ unselectable?: "off" | "on" | undefined;
1202
1202
  inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
1203
1203
  is?: string | undefined;
1204
1204
  'aria-activedescendant'?: string | undefined;
@@ -1447,7 +1447,7 @@ export declare function useMenuItem(props?: UseMenuItemProps, externalRef?: Reac
1447
1447
  suppressHydrationWarning?: boolean | undefined;
1448
1448
  accessKey?: string | undefined;
1449
1449
  className?: string | undefined;
1450
- contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
1450
+ contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
1451
1451
  contextMenu?: string | undefined;
1452
1452
  dir?: string | undefined;
1453
1453
  draggable?: (boolean | "true" | "false") | undefined;
@@ -1458,7 +1458,7 @@ export declare function useMenuItem(props?: UseMenuItemProps, externalRef?: Reac
1458
1458
  spellCheck?: (boolean | "true" | "false") | undefined;
1459
1459
  style?: React.CSSProperties | undefined;
1460
1460
  title?: string | undefined;
1461
- translate?: "yes" | "no" | undefined;
1461
+ translate?: "no" | "yes" | undefined;
1462
1462
  radioGroup?: string | undefined;
1463
1463
  about?: string | undefined;
1464
1464
  datatype?: string | undefined;
@@ -1479,7 +1479,7 @@ export declare function useMenuItem(props?: UseMenuItemProps, externalRef?: Reac
1479
1479
  itemRef?: string | undefined;
1480
1480
  results?: number | undefined;
1481
1481
  security?: string | undefined;
1482
- unselectable?: "on" | "off" | undefined;
1482
+ unselectable?: "off" | "on" | undefined;
1483
1483
  inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
1484
1484
  is?: string | undefined;
1485
1485
  'aria-activedescendant'?: string | undefined;
@@ -1708,7 +1708,7 @@ export declare function useMenuItem(props?: UseMenuItemProps, externalRef?: Reac
1708
1708
  suppressHydrationWarning?: boolean | undefined;
1709
1709
  accessKey?: string | undefined;
1710
1710
  className?: string | undefined;
1711
- contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
1711
+ contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
1712
1712
  contextMenu?: string | undefined;
1713
1713
  dir?: string | undefined;
1714
1714
  draggable?: (boolean | "true" | "false") | undefined;
@@ -1719,7 +1719,7 @@ export declare function useMenuItem(props?: UseMenuItemProps, externalRef?: Reac
1719
1719
  spellCheck?: (boolean | "true" | "false") | undefined;
1720
1720
  style?: React.CSSProperties | undefined;
1721
1721
  title?: string | undefined;
1722
- translate?: "yes" | "no" | undefined;
1722
+ translate?: "no" | "yes" | undefined;
1723
1723
  radioGroup?: string | undefined;
1724
1724
  about?: string | undefined;
1725
1725
  datatype?: string | undefined;
@@ -1746,7 +1746,7 @@ export declare function useMenuItem(props?: UseMenuItemProps, externalRef?: Reac
1746
1746
  itemRef?: string | undefined;
1747
1747
  results?: number | undefined;
1748
1748
  security?: string | undefined;
1749
- unselectable?: "on" | "off" | undefined;
1749
+ unselectable?: "off" | "on" | undefined;
1750
1750
  inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
1751
1751
  is?: string | undefined;
1752
1752
  'aria-activedescendant'?: string | undefined;
@@ -1986,7 +1986,7 @@ export declare function useMenuOption(props?: UseMenuOptionProps, ref?: React.Re
1986
1986
  suppressHydrationWarning?: boolean | undefined;
1987
1987
  accessKey?: string | undefined;
1988
1988
  className?: string | undefined;
1989
- contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
1989
+ contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
1990
1990
  contextMenu?: string | undefined;
1991
1991
  dir?: string | undefined;
1992
1992
  draggable?: (boolean | "true" | "false") | undefined;
@@ -1997,7 +1997,7 @@ export declare function useMenuOption(props?: UseMenuOptionProps, ref?: React.Re
1997
1997
  spellCheck?: (boolean | "true" | "false") | undefined;
1998
1998
  style?: React.CSSProperties | undefined;
1999
1999
  title?: string | undefined;
2000
- translate?: "yes" | "no" | undefined;
2000
+ translate?: "no" | "yes" | undefined;
2001
2001
  radioGroup?: string | undefined;
2002
2002
  about?: string | undefined;
2003
2003
  datatype?: string | undefined;
@@ -2018,7 +2018,7 @@ export declare function useMenuOption(props?: UseMenuOptionProps, ref?: React.Re
2018
2018
  itemRef?: string | undefined;
2019
2019
  results?: number | undefined;
2020
2020
  security?: string | undefined;
2021
- unselectable?: "on" | "off" | undefined;
2021
+ unselectable?: "off" | "on" | undefined;
2022
2022
  inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
2023
2023
  is?: string | undefined;
2024
2024
  'aria-activedescendant'?: string | undefined;
@@ -2247,7 +2247,7 @@ export declare function useMenuOption(props?: UseMenuOptionProps, ref?: React.Re
2247
2247
  suppressHydrationWarning?: boolean | undefined;
2248
2248
  accessKey?: string | undefined;
2249
2249
  className?: string | undefined;
2250
- contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
2250
+ contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
2251
2251
  contextMenu?: string | undefined;
2252
2252
  dir?: string | undefined;
2253
2253
  draggable?: (boolean | "true" | "false") | undefined;
@@ -2258,7 +2258,7 @@ export declare function useMenuOption(props?: UseMenuOptionProps, ref?: React.Re
2258
2258
  spellCheck?: (boolean | "true" | "false") | undefined;
2259
2259
  style?: React.CSSProperties | undefined;
2260
2260
  title?: string | undefined;
2261
- translate?: "yes" | "no" | undefined;
2261
+ translate?: "no" | "yes" | undefined;
2262
2262
  radioGroup?: string | undefined;
2263
2263
  about?: string | undefined;
2264
2264
  datatype?: string | undefined;
@@ -2285,7 +2285,7 @@ export declare function useMenuOption(props?: UseMenuOptionProps, ref?: React.Re
2285
2285
  itemRef?: string | undefined;
2286
2286
  results?: number | undefined;
2287
2287
  security?: string | undefined;
2288
- unselectable?: "on" | "off" | undefined;
2288
+ unselectable?: "off" | "on" | undefined;
2289
2289
  inputMode?: "none" | "text" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
2290
2290
  is?: string | undefined;
2291
2291
  'aria-activedescendant'?: string | undefined;
@@ -10,10 +10,10 @@ declare const getButtonStyle: (getColor: GetColor) => {
10
10
  readonly solid: (props: React.ComponentProps<typeof Button>) => {
11
11
  border: string;
12
12
  borderColor: string;
13
+ height: string;
13
14
  transition: string;
14
15
  fontSize: number;
15
16
  letterSpacing: number;
16
- textTransform: string;
17
17
  maxWidth: string;
18
18
  cursor: string;
19
19
  bgColor: string;
@@ -41,30 +41,37 @@ declare const getButtonStyle: (getColor: GetColor) => {
41
41
  bgColor: string;
42
42
  };
43
43
  };
44
- readonly toggle: (props: React.ComponentProps<typeof Button>) => {
44
+ readonly settings: (props: React.ComponentProps<typeof Button>) => {
45
45
  bgColor: string;
46
+ border: string;
46
47
  color: string;
47
- px: number;
48
- fontWeight: string;
49
- fontSize: number;
50
- _focus: {
51
- bgColor: string;
52
- };
53
- _hover: {
54
- bgColor: string;
55
- };
48
+ py: number;
49
+ width: number[];
50
+ fontSize: number[];
51
+ whiteSpace: string[];
56
52
  _active: {
57
- bgColor: string;
53
+ bgColor: import("@chakra-ui/react").ResponsiveValue<import("@chakra-ui/styled-system/dist/declarations/src/utils").Union<import("csstype").Property.Color | "current" | "whiteAlpha.50" | "whiteAlpha.100" | "whiteAlpha.200" | "whiteAlpha.300" | "whiteAlpha.400" | "whiteAlpha.500" | "whiteAlpha.600" | "whiteAlpha.700" | "whiteAlpha.800" | "whiteAlpha.900" | "blackAlpha.50" | "blackAlpha.100" | "blackAlpha.200" | "blackAlpha.300" | "blackAlpha.400" | "blackAlpha.500" | "blackAlpha.600" | "blackAlpha.700" | "blackAlpha.800" | "blackAlpha.900" | "gray.50" | "gray.100" | "gray.200" | "gray.300" | "gray.400" | "gray.500" | "gray.600" | "gray.700" | "gray.800" | "gray.900" | "red.50" | "red.100" | "red.200" | "red.300" | "red.400" | "red.500" | "red.600" | "red.700" | "red.800" | "red.900" | "orange.50" | "orange.100" | "orange.200" | "orange.300" | "orange.400" | "orange.500" | "orange.600" | "orange.700" | "orange.800" | "orange.900" | "yellow.50" | "yellow.100" | "yellow.200" | "yellow.300" | "yellow.400" | "yellow.500" | "yellow.600" | "yellow.700" | "yellow.800" | "yellow.900" | "green.50" | "green.100" | "green.200" | "green.300" | "green.400" | "green.500" | "green.600" | "green.700" | "green.800" | "green.900" | "teal.50" | "teal.100" | "teal.200" | "teal.300" | "teal.400" | "teal.500" | "teal.600" | "teal.700" | "teal.800" | "teal.900" | "blue.50" | "blue.100" | "blue.200" | "blue.300" | "blue.400" | "blue.500" | "blue.600" | "blue.700" | "blue.800" | "blue.900" | "cyan.50" | "cyan.100" | "cyan.200" | "cyan.300" | "cyan.400" | "cyan.500" | "cyan.600" | "cyan.700" | "cyan.800" | "cyan.900" | "purple.50" | "purple.100" | "purple.200" | "purple.300" | "purple.400" | "purple.500" | "purple.600" | "purple.700" | "purple.800" | "purple.900" | "pink.50" | "pink.100" | "pink.200" | "pink.300" | "pink.400" | "pink.500" | "pink.600" | "pink.700" | "pink.800" | "pink.900" | "linkedin.50" | "linkedin.100" | "linkedin.200" | "linkedin.300" | "linkedin.400" | "linkedin.500" | "linkedin.600" | "linkedin.700" | "linkedin.800" | "linkedin.900" | "facebook.50" | "facebook.100" | "facebook.200" | "facebook.300" | "facebook.400" | "facebook.500" | "facebook.600" | "facebook.700" | "facebook.800" | "facebook.900" | "messenger.50" | "messenger.100" | "messenger.200" | "messenger.300" | "messenger.400" | "messenger.500" | "messenger.600" | "messenger.700" | "messenger.800" | "messenger.900" | "whatsapp.50" | "whatsapp.100" | "whatsapp.200" | "whatsapp.300" | "whatsapp.400" | "whatsapp.500" | "whatsapp.600" | "whatsapp.700" | "whatsapp.800" | "whatsapp.900" | "twitter.50" | "twitter.100" | "twitter.200" | "twitter.300" | "twitter.400" | "twitter.500" | "twitter.600" | "twitter.700" | "twitter.800" | "twitter.900" | "telegram.50" | "telegram.100" | "telegram.200" | "telegram.300" | "telegram.400" | "telegram.500" | "telegram.600" | "telegram.700" | "telegram.800" | "telegram.900">> | undefined;
58
54
  };
59
55
  _checked: {
60
56
  color: string;
61
57
  bgColor: string;
58
+ borderBottomColor: string;
59
+ p: {
60
+ textDecoration: string;
61
+ };
62
+ };
63
+ _hover: {
64
+ bgColor: import("@chakra-ui/react").ResponsiveValue<import("@chakra-ui/styled-system/dist/declarations/src/utils").Union<import("csstype").Property.Color | "current" | "whiteAlpha.50" | "whiteAlpha.100" | "whiteAlpha.200" | "whiteAlpha.300" | "whiteAlpha.400" | "whiteAlpha.500" | "whiteAlpha.600" | "whiteAlpha.700" | "whiteAlpha.800" | "whiteAlpha.900" | "blackAlpha.50" | "blackAlpha.100" | "blackAlpha.200" | "blackAlpha.300" | "blackAlpha.400" | "blackAlpha.500" | "blackAlpha.600" | "blackAlpha.700" | "blackAlpha.800" | "blackAlpha.900" | "gray.50" | "gray.100" | "gray.200" | "gray.300" | "gray.400" | "gray.500" | "gray.600" | "gray.700" | "gray.800" | "gray.900" | "red.50" | "red.100" | "red.200" | "red.300" | "red.400" | "red.500" | "red.600" | "red.700" | "red.800" | "red.900" | "orange.50" | "orange.100" | "orange.200" | "orange.300" | "orange.400" | "orange.500" | "orange.600" | "orange.700" | "orange.800" | "orange.900" | "yellow.50" | "yellow.100" | "yellow.200" | "yellow.300" | "yellow.400" | "yellow.500" | "yellow.600" | "yellow.700" | "yellow.800" | "yellow.900" | "green.50" | "green.100" | "green.200" | "green.300" | "green.400" | "green.500" | "green.600" | "green.700" | "green.800" | "green.900" | "teal.50" | "teal.100" | "teal.200" | "teal.300" | "teal.400" | "teal.500" | "teal.600" | "teal.700" | "teal.800" | "teal.900" | "blue.50" | "blue.100" | "blue.200" | "blue.300" | "blue.400" | "blue.500" | "blue.600" | "blue.700" | "blue.800" | "blue.900" | "cyan.50" | "cyan.100" | "cyan.200" | "cyan.300" | "cyan.400" | "cyan.500" | "cyan.600" | "cyan.700" | "cyan.800" | "cyan.900" | "purple.50" | "purple.100" | "purple.200" | "purple.300" | "purple.400" | "purple.500" | "purple.600" | "purple.700" | "purple.800" | "purple.900" | "pink.50" | "pink.100" | "pink.200" | "pink.300" | "pink.400" | "pink.500" | "pink.600" | "pink.700" | "pink.800" | "pink.900" | "linkedin.50" | "linkedin.100" | "linkedin.200" | "linkedin.300" | "linkedin.400" | "linkedin.500" | "linkedin.600" | "linkedin.700" | "linkedin.800" | "linkedin.900" | "facebook.50" | "facebook.100" | "facebook.200" | "facebook.300" | "facebook.400" | "facebook.500" | "facebook.600" | "facebook.700" | "facebook.800" | "facebook.900" | "messenger.50" | "messenger.100" | "messenger.200" | "messenger.300" | "messenger.400" | "messenger.500" | "messenger.600" | "messenger.700" | "messenger.800" | "messenger.900" | "whatsapp.50" | "whatsapp.100" | "whatsapp.200" | "whatsapp.300" | "whatsapp.400" | "whatsapp.500" | "whatsapp.600" | "whatsapp.700" | "whatsapp.800" | "whatsapp.900" | "twitter.50" | "twitter.100" | "twitter.200" | "twitter.300" | "twitter.400" | "twitter.500" | "twitter.600" | "twitter.700" | "twitter.800" | "twitter.900" | "telegram.50" | "telegram.100" | "telegram.200" | "telegram.300" | "telegram.400" | "telegram.500" | "telegram.600" | "telegram.700" | "telegram.800" | "telegram.900">> | undefined;
65
+ };
66
+ _focus: {
67
+ bgColor: import("@chakra-ui/react").ResponsiveValue<import("@chakra-ui/styled-system/dist/declarations/src/utils").Union<import("csstype").Property.Color | "current" | "whiteAlpha.50" | "whiteAlpha.100" | "whiteAlpha.200" | "whiteAlpha.300" | "whiteAlpha.400" | "whiteAlpha.500" | "whiteAlpha.600" | "whiteAlpha.700" | "whiteAlpha.800" | "whiteAlpha.900" | "blackAlpha.50" | "blackAlpha.100" | "blackAlpha.200" | "blackAlpha.300" | "blackAlpha.400" | "blackAlpha.500" | "blackAlpha.600" | "blackAlpha.700" | "blackAlpha.800" | "blackAlpha.900" | "gray.50" | "gray.100" | "gray.200" | "gray.300" | "gray.400" | "gray.500" | "gray.600" | "gray.700" | "gray.800" | "gray.900" | "red.50" | "red.100" | "red.200" | "red.300" | "red.400" | "red.500" | "red.600" | "red.700" | "red.800" | "red.900" | "orange.50" | "orange.100" | "orange.200" | "orange.300" | "orange.400" | "orange.500" | "orange.600" | "orange.700" | "orange.800" | "orange.900" | "yellow.50" | "yellow.100" | "yellow.200" | "yellow.300" | "yellow.400" | "yellow.500" | "yellow.600" | "yellow.700" | "yellow.800" | "yellow.900" | "green.50" | "green.100" | "green.200" | "green.300" | "green.400" | "green.500" | "green.600" | "green.700" | "green.800" | "green.900" | "teal.50" | "teal.100" | "teal.200" | "teal.300" | "teal.400" | "teal.500" | "teal.600" | "teal.700" | "teal.800" | "teal.900" | "blue.50" | "blue.100" | "blue.200" | "blue.300" | "blue.400" | "blue.500" | "blue.600" | "blue.700" | "blue.800" | "blue.900" | "cyan.50" | "cyan.100" | "cyan.200" | "cyan.300" | "cyan.400" | "cyan.500" | "cyan.600" | "cyan.700" | "cyan.800" | "cyan.900" | "purple.50" | "purple.100" | "purple.200" | "purple.300" | "purple.400" | "purple.500" | "purple.600" | "purple.700" | "purple.800" | "purple.900" | "pink.50" | "pink.100" | "pink.200" | "pink.300" | "pink.400" | "pink.500" | "pink.600" | "pink.700" | "pink.800" | "pink.900" | "linkedin.50" | "linkedin.100" | "linkedin.200" | "linkedin.300" | "linkedin.400" | "linkedin.500" | "linkedin.600" | "linkedin.700" | "linkedin.800" | "linkedin.900" | "facebook.50" | "facebook.100" | "facebook.200" | "facebook.300" | "facebook.400" | "facebook.500" | "facebook.600" | "facebook.700" | "facebook.800" | "facebook.900" | "messenger.50" | "messenger.100" | "messenger.200" | "messenger.300" | "messenger.400" | "messenger.500" | "messenger.600" | "messenger.700" | "messenger.800" | "messenger.900" | "whatsapp.50" | "whatsapp.100" | "whatsapp.200" | "whatsapp.300" | "whatsapp.400" | "whatsapp.500" | "whatsapp.600" | "whatsapp.700" | "whatsapp.800" | "whatsapp.900" | "twitter.50" | "twitter.100" | "twitter.200" | "twitter.300" | "twitter.400" | "twitter.500" | "twitter.600" | "twitter.700" | "twitter.800" | "twitter.900" | "telegram.50" | "telegram.100" | "telegram.200" | "telegram.300" | "telegram.400" | "telegram.500" | "telegram.600" | "telegram.700" | "telegram.800" | "telegram.900">> | undefined;
68
+ ring: string;
69
+ ringInset: string;
62
70
  };
63
- border: string;
64
71
  borderColor: string;
72
+ height: string;
65
73
  transition: string;
66
74
  letterSpacing: number;
67
- textTransform: string;
68
75
  maxWidth: string;
69
76
  cursor: string;
70
77
  _disabled: {
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Fonts: () => JSX.Element;
3
+ export default Fonts;
@@ -0,0 +1,6 @@
1
+ import { Dict } from '../types';
2
+ declare type Fonts = {
3
+ fonts: Dict;
4
+ };
5
+ declare const typography: Fonts;
6
+ export default typography;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nypl/web-reader",
3
- "version": "3.2.5",
3
+ "version": "4.1.0",
4
4
  "license": "MIT",
5
5
  "repository": "https://github.com/NYPL-Simplified/web-reader",
6
6
  "homepage": "https://github.com/NYPL-Simplified/web-reader",
@@ -84,6 +84,13 @@
84
84
  "@babel/core": "^7.12.10",
85
85
  "@emotion/jest": "^11.8.0",
86
86
  "@parcel/transformer-typescript-tsc": "^2.4.1",
87
+ "@storybook/addon-actions": "^6.5.13",
88
+ "@storybook/addon-essentials": "^6.4.22",
89
+ "@storybook/addon-info": "^3.0.0",
90
+ "@storybook/addon-links": "^6.5.13",
91
+ "@storybook/addon-storyshots": "^6.1.21",
92
+ "@storybook/addons": "^6.5.13",
93
+ "@storybook/react": "^6.1.21",
87
94
  "@testing-library/cypress": "^8.0.2",
88
95
  "@testing-library/jest-dom": "^5.16.3",
89
96
  "@testing-library/react": "^12.0.0",
@@ -119,9 +126,9 @@
119
126
  "jest-axe": "^6.0.0",
120
127
  "jest-watch-typeahead": "^1.0.0",
121
128
  "lint-staged": "^11.1.2",
122
- "parcel": "^2.4.1",
129
+ "parcel": "^2.6.1",
123
130
  "parcel-config-precache-manifest": "^0.0.4",
124
- "parcel-plugin-static-files-copy": "^2.6.0",
131
+ "parcel-plugin-static-files-copy": "^1.2.4",
125
132
  "parcel-reporter-static-files-copy": "^1.3.0",
126
133
  "prettier": "2.2.1",
127
134
  "r2-shared-js": "^1.0.49",
@@ -130,7 +137,7 @@
130
137
  "react-dom": "^17.0.2",
131
138
  "react-is": "^17.0.1",
132
139
  "react-router-dom": "^5.2.0",
133
- "release-it": "^14.11.5",
140
+ "release-it": "^15.5.0",
134
141
  "request": "^2.88.2",
135
142
  "rimraf": "^3.0.2",
136
143
  "size-limit": "^4.9.1",
@@ -138,27 +145,16 @@
138
145
  "ts-jest": "^27.1.4",
139
146
  "ts-node": "^10.1.0",
140
147
  "tslib": "^2.3.1",
141
- "typescript": "^4.3.5"
148
+ "typescript": "4.4.3"
142
149
  },
143
150
  "dependencies": {
144
- "@storybook/addon-actions": "^6.5.13",
145
- "@storybook/addon-essentials": "^6.5.13",
146
- "@storybook/addon-info": "^5.3.21",
147
- "@storybook/addon-links": "^6.5.13",
148
- "@storybook/addon-storyshots": "^6.5.13",
149
- "@storybook/addons": "^6.5.13",
150
- "@storybook/react": "^6.5.13",
151
151
  "comlink": "^4.3.1",
152
152
  "framer-motion": "^4.1.6",
153
153
  "node-fetch": "^2.6.1",
154
154
  "react-icons": "^4.3.1",
155
155
  "react-intersection-observer": "^8.32.2",
156
156
  "react-pdf": "^5.3.2",
157
- "react-resize-observer": "^1.1.1",
158
- "workbox-expiration": "^6.2.4",
159
- "workbox-precaching": "^6.2.4",
160
- "workbox-routing": "^6.3.0",
161
- "workbox-strategies": "^6.3.0"
157
+ "react-resize-observer": "^1.1.1"
162
158
  },
163
159
  "optionalDependencies": {
164
160
  "@nypl-simplified-packages/axisnow-access-control-web": "^1.4.2"
@@ -1,2 +0,0 @@
1
- var $=Object.defineProperty,Ce=Object.defineProperties,Oe=Object.getOwnPropertyDescriptor,Te=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols;var le=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable;var ue=(r,e,t)=>e in r?$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e||(e={}))le.call(e,t)&&ue(r,t,e[t]);if(ce)for(var t of ce(e))$e.call(e,t)&&ue(r,t,e[t]);return r},k=(r,e)=>Ce(r,Te(e)),Ue=r=>$(r,"__esModule",{value:!0});var Ae=(r,e)=>{for(var t in e)$(r,t,{get:e[t],enumerable:!0})},Le=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Se(e))!le.call(r,s)&&(t||s!=="default")&&$(r,s,{get:()=>e[s],enumerable:!(o=Oe(e,s))||o.enumerable});return r};var Pe=(r=>(e,t)=>r&&r.get(e)||(t=Le(Ue({}),e,1),r&&r.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var i=(r,e,t)=>new Promise((o,s)=>{var a=u=>{try{c(t.next(u))}catch(l){s(l)}},n=u=>{try{c(t.throw(u))}catch(l){s(l)}},c=u=>u.done?o(u.value):Promise.resolve(u.value).then(a,n);c((t=t.apply(r,e)).next())});var nt={};Ae(nt,{default:()=>ve});try{self["workbox:core:6.2.4"]&&_()}catch(r){}var qe=(r,...e)=>{let t=r;return e.length>0&&(t+=` :: ${JSON.stringify(e)}`),t};var pe=qe;var p=class extends Error{constructor(e,t){let o=pe(e,t);super(o);this.name=e,this.details=t}};var U=new Set;function Q(r){U.add(r)}var g={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:typeof registration!="undefined"?registration.scope:""},Y=r=>[g.prefix,r,g.suffix].filter(e=>e&&e.length>0).join("-"),We=r=>{for(let e of Object.keys(g))r(e)},x={updateDetails:r=>{We(e=>{typeof r[e]=="string"&&(g[e]=r[e])})},getGoogleAnalyticsName:r=>r||Y(g.googleAnalytics),getPrecacheName:r=>r||Y(g.precache),getPrefix:()=>g.prefix,getRuntimeName:r=>r||Y(g.runtime),getSuffix:()=>g.suffix};function me(r,e){let t=new URL(r);for(let o of e)t.searchParams.delete(o);return t.href}function J(r,e,t,o){return i(this,null,function*(){let s=me(e.url,t);if(e.url===s)return r.match(e,o);let a=Object.assign(Object.assign({},o),{ignoreSearch:!0}),n=yield r.keys(e,a);for(let c of n){let u=me(c.url,t);if(s===u)return r.match(c,o)}})}function v(r){r.then(()=>{})}var A=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};function z(){return i(this,null,function*(){for(let r of U)yield r()})}var L=r=>new URL(String(r),location.href).href.replace(new RegExp(`^${location.origin}`),"");function D(r){return new Promise(e=>setTimeout(e,r))}function X(){self.addEventListener("activate",()=>self.clients.claim())}var Fe=(r,e)=>e.some(t=>r instanceof t),he,de;function He(){return he||(he=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Be(){return de||(de=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var fe=new WeakMap,ee=new WeakMap,ge=new WeakMap,Z=new WeakMap,re=new WeakMap;function je(r){let e=new Promise((t,o)=>{let s=()=>{r.removeEventListener("success",a),r.removeEventListener("error",n)},a=()=>{t(f(r.result)),s()},n=()=>{o(r.error),s()};r.addEventListener("success",a),r.addEventListener("error",n)});return e.then(t=>{t instanceof IDBCursor&&fe.set(t,r)}).catch(()=>{}),re.set(e,r),e}function Ge(r){if(ee.has(r))return;let e=new Promise((t,o)=>{let s=()=>{r.removeEventListener("complete",a),r.removeEventListener("error",n),r.removeEventListener("abort",n)},a=()=>{t(),s()},n=()=>{o(r.error||new DOMException("AbortError","AbortError")),s()};r.addEventListener("complete",a),r.addEventListener("error",n),r.addEventListener("abort",n)});ee.set(r,e)}var te={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return ee.get(r);if(e==="objectStoreNames")return r.objectStoreNames||ge.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return f(r[e])},set(r,e,t){return r[e]=t,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function we(r){te=r(te)}function Ke(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let o=r.call(P(this),e,...t);return ge.set(o,e.sort?e.sort():[e]),f(o)}:Be().includes(r)?function(...e){return r.apply(P(this),e),f(fe.get(this))}:function(...e){return f(r.apply(P(this),e))}}function Qe(r){return typeof r=="function"?Ke(r):(r instanceof IDBTransaction&&Ge(r),Fe(r,He())?new Proxy(r,te):r)}function f(r){if(r instanceof IDBRequest)return je(r);if(Z.has(r))return Z.get(r);let e=Qe(r);return e!==r&&(Z.set(r,e),re.set(e,r)),e}var P=r=>re.get(r);function Ne(r,e,{blocked:t,upgrade:o,blocking:s,terminated:a}={}){let n=indexedDB.open(r,e),c=f(n);return o&&n.addEventListener("upgradeneeded",u=>{o(f(n.result),u.oldVersion,u.newVersion,f(n.transaction))}),t&&n.addEventListener("blocked",()=>t()),c.then(u=>{a&&u.addEventListener("close",()=>a()),s&&u.addEventListener("versionchange",()=>s())}).catch(()=>{}),c}function xe(r,{blocked:e}={}){let t=indexedDB.deleteDatabase(r);return e&&t.addEventListener("blocked",()=>e()),f(t).then(()=>{})}var Ye=["get","getKey","getAll","getAllKeys","count"],Je=["put","add","delete","clear"],oe=new Map;function Ee(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if(oe.get(e))return oe.get(e);let t=e.replace(/FromIndex$/,""),o=e!==t,s=Je.includes(t);if(!(t in(o?IDBIndex:IDBObjectStore).prototype)||!(s||Ye.includes(t)))return;let a=function(n,...c){return i(this,null,function*(){let u=this.transaction(n,s?"readwrite":"readonly"),l=u.store;return o&&(l=l.index(c.shift())),(yield Promise.all([l[t](...c),s&&u.done]))[0]})};return oe.set(e,a),a}we(r=>k(R({},r),{get:(e,t,o)=>Ee(e,t)||r.get(e,t,o),has:(e,t)=>!!Ee(e,t)||r.has(e,t)}));try{self["workbox:expiration:6.2.4"]&&_()}catch(r){}var ze="workbox-expiration",C="cache-entries",ye=r=>{let e=new URL(r,location.href);return e.hash="",e.href},se=class{constructor(e){this._db=null,this._cacheName=e}_upgradeDb(e){let t=e.createObjectStore(C,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&xe(this._cacheName)}setTimestamp(e,t){return i(this,null,function*(){e=ye(e);let o={url:e,timestamp:t,cacheName:this._cacheName,id:this._getId(e)},a=(yield this.getDb()).transaction(C,"readwrite",{durability:"relaxed"});yield a.store.put(o),yield a.done})}getTimestamp(e){return i(this,null,function*(){let o=yield(yield this.getDb()).get(C,this._getId(e));return o==null?void 0:o.timestamp})}expireEntries(e,t){return i(this,null,function*(){let o=yield this.getDb(),s=yield o.transaction(C).store.index("timestamp").openCursor(null,"prev"),a=[],n=0;for(;s;){let u=s.value;u.cacheName===this._cacheName&&(e&&u.timestamp<e||t&&n>=t?a.push(s.value):n++),s=yield s.continue()}let c=[];for(let u of a)yield o.delete(C,u.id),c.push(u.url);return c})}_getId(e){return this._cacheName+"|"+ye(e)}getDb(){return i(this,null,function*(){return this._db||(this._db=yield Ne(ze,1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db})}};var q=class{constructor(e,t={}){this._isRunning=!1,this._rerunRequested=!1,this._maxEntries=t.maxEntries,this._maxAgeSeconds=t.maxAgeSeconds,this._matchOptions=t.matchOptions,this._cacheName=e,this._timestampModel=new se(e)}expireEntries(){return i(this,null,function*(){if(this._isRunning){this._rerunRequested=!0;return}this._isRunning=!0;let e=this._maxAgeSeconds?Date.now()-this._maxAgeSeconds*1e3:0,t=yield this._timestampModel.expireEntries(e,this._maxEntries),o=yield self.caches.open(this._cacheName);for(let s of t)yield o.delete(s,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,v(this.expireEntries()))})}updateTimestamp(e){return i(this,null,function*(){yield this._timestampModel.setTimestamp(e,Date.now())})}isURLExpired(e){return i(this,null,function*(){if(this._maxAgeSeconds){let t=yield this._timestampModel.getTimestamp(e),o=Date.now()-this._maxAgeSeconds*1e3;return t!==void 0?t<o:!0}else return!1})}delete(){return i(this,null,function*(){this._rerunRequested=!1,yield this._timestampModel.expireEntries(1/0)})}};var W=class{constructor(e={}){this.cachedResponseWillBeUsed=n=>i(this,[n],function*({event:t,request:o,cacheName:s,cachedResponse:a}){if(!a)return null;let c=this._isResponseDateFresh(a),u=this._getCacheExpiration(s);v(u.expireEntries());let l=u.updateTimestamp(o.url);if(t)try{t.waitUntil(l)}catch(m){}return c?a:null}),this.cacheDidUpdate=s=>i(this,[s],function*({cacheName:t,request:o}){let a=this._getCacheExpiration(t);yield a.updateTimestamp(o.url),yield a.expireEntries()}),this._config=e,this._maxAgeSeconds=e.maxAgeSeconds,this._cacheExpirations=new Map,e.purgeOnQuotaError&&Q(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(e){if(e===x.getRuntimeName())throw new p("expire-custom-caches-only");let t=this._cacheExpirations.get(e);return t||(t=new q(e,this._config),this._cacheExpirations.set(e,t)),t}_isResponseDateFresh(e){if(!this._maxAgeSeconds)return!0;let t=this._getDateHeaderTimestamp(e);if(t===null)return!0;let o=Date.now();return t>=o-this._maxAgeSeconds*1e3}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;let t=e.headers.get("date"),s=new Date(t).getTime();return isNaN(s)?null:s}deleteCacheAndMetadata(){return i(this,null,function*(){for(let[e,t]of this._cacheExpirations)yield self.caches.delete(e),yield t.delete();this._cacheExpirations=new Map})}};try{self["workbox:strategies:6.2.4"]&&_()}catch(r){}function I(r){return typeof r=="string"?new Request(r):r}var M=class{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new A,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let o of this._plugins)this._pluginStateMap.set(o,{});this.event.waitUntil(this._handlerDeferred.promise)}fetch(e){return i(this,null,function*(){let{event:t}=this,o=I(e);if(o.mode==="navigate"&&t instanceof FetchEvent&&t.preloadResponse){let n=yield t.preloadResponse;if(n)return n}let s=this.hasCallback("fetchDidFail")?o.clone():null;try{for(let n of this.iterateCallbacks("requestWillFetch"))o=yield n({request:o.clone(),event:t})}catch(n){if(n instanceof Error)throw new p("plugin-error-request-will-fetch",{thrownErrorMessage:n.message})}let a=o.clone();try{let n;n=yield fetch(o,o.mode==="navigate"?void 0:this._strategy.fetchOptions);for(let c of this.iterateCallbacks("fetchDidSucceed"))n=yield c({event:t,request:a,response:n});return n}catch(n){throw s&&(yield this.runCallbacks("fetchDidFail",{error:n,event:t,originalRequest:s.clone(),request:a.clone()})),n}})}fetchAndCachePut(e){return i(this,null,function*(){let t=yield this.fetch(e),o=t.clone();return this.waitUntil(this.cachePut(e,o)),t})}cacheMatch(e){return i(this,null,function*(){let t=I(e),o,{cacheName:s,matchOptions:a}=this._strategy,n=yield this.getCacheKey(t,"read"),c=Object.assign(Object.assign({},a),{cacheName:s});o=yield caches.match(n,c);for(let u of this.iterateCallbacks("cachedResponseWillBeUsed"))o=(yield u({cacheName:s,matchOptions:a,cachedResponse:o,request:n,event:this.event}))||void 0;return o})}cachePut(e,t){return i(this,null,function*(){let o=I(e);yield D(0);let s=yield this.getCacheKey(o,"write");if(!t)throw new p("cache-put-with-no-response",{url:L(s.url)});let a=yield this._ensureResponseSafeToCache(t);if(!a)return!1;let{cacheName:n,matchOptions:c}=this._strategy,u=yield self.caches.open(n),l=this.hasCallback("cacheDidUpdate"),m=l?yield J(u,s.clone(),["__WB_REVISION__"],c):null;try{yield u.put(s,l?a.clone():a)}catch(h){if(h instanceof Error)throw h.name==="QuotaExceededError"&&(yield z()),h}for(let h of this.iterateCallbacks("cacheDidUpdate"))yield h({cacheName:n,oldResponse:m,newResponse:a.clone(),request:s,event:this.event});return!0})}getCacheKey(e,t){return i(this,null,function*(){if(!this._cacheKeys[t]){let o=e;for(let s of this.iterateCallbacks("cacheKeyWillBeUsed"))o=I(yield s({mode:t,request:o,event:this.event,params:this.params}));this._cacheKeys[t]=o}return this._cacheKeys[t]})}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}runCallbacks(e,t){return i(this,null,function*(){for(let o of this.iterateCallbacks(e))yield o(t)})}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]=="function"){let o=this._pluginStateMap.get(t);yield a=>{let n=Object.assign(Object.assign({},a),{state:o});return t[e](n)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}doneWaiting(){return i(this,null,function*(){let e;for(;e=this._extendLifetimePromises.shift();)yield e})}destroy(){this._handlerDeferred.resolve(null)}_ensureResponseSafeToCache(e){return i(this,null,function*(){let t=e,o=!1;for(let s of this.iterateCallbacks("cacheWillUpdate"))if(t=(yield s({request:this.request,response:t,event:this.event}))||void 0,o=!0,!t)break;return o||t&&t.status!==200&&(t=void 0),t})}};var w=class{constructor(e={}){this.cacheName=x.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,o=typeof e.request=="string"?new Request(e.request):e.request,s="params"in e?e.params:void 0,a=new M(this,{event:t,request:o,params:s}),n=this._getResponse(a,o,t),c=this._awaitComplete(n,a,o,t);return[n,c]}_getResponse(e,t,o){return i(this,null,function*(){yield e.runCallbacks("handlerWillStart",{event:o,request:t});let s;try{if(s=yield this._handle(t,e),!s||s.type==="error")throw new p("no-response",{url:t.url})}catch(a){if(a instanceof Error){for(let n of e.iterateCallbacks("handlerDidError"))if(s=yield n({error:a,event:o,request:t}),s)break}if(!s)throw a}for(let a of e.iterateCallbacks("handlerWillRespond"))s=yield a({event:o,request:t,response:s});return s})}_awaitComplete(e,t,o,s){return i(this,null,function*(){let a,n;try{a=yield e}catch(c){}try{yield t.runCallbacks("handlerDidRespond",{event:s,request:o,response:a}),yield t.doneWaiting()}catch(c){c instanceof Error&&(n=c)}if(yield t.runCallbacks("handlerDidComplete",{event:s,request:o,response:a,error:n}),t.destroy(),n)throw n})}};var V=class extends w{_handle(e,t){return i(this,null,function*(){let o=[],s=yield t.cacheMatch(e),a;if(!s)try{s=yield t.fetchAndCachePut(e)}catch(n){n instanceof Error&&(a=n)}if(!s)throw new p("no-response",{url:e.url,error:a});return s})}};var ne={cacheWillUpdate:e=>i(void 0,[e],function*({response:r}){return r.status===200||r.status===0?r:null})};var F=class extends w{constructor(e={}){super(e);this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(ne)}_handle(e,t){return i(this,null,function*(){let o=[],s=t.fetchAndCachePut(e).catch(()=>{}),a=yield t.cacheMatch(e),n;if(!a)try{a=yield s}catch(c){c instanceof Error&&(n=c)}if(!a)throw new p("no-response",{url:e.url,error:n});return a})}};var be=!1,Xe=48,Ze=48,et=Xe+Ze,bn=`calc(100vh - ${et}px)`;var H="webpub-cache";var _e="PRECACHE_PUBLICATIONS";try{self["workbox:routing:6.2.4"]&&_()}catch(r){}var B="GET";var y=r=>r&&typeof r=="object"?r:{handle:r};var E=class{constructor(e,t,o=B){this.handler=y(t),this.match=e,this.method=o}setCatchHandler(e){this.catchHandler=y(e)}};var j=class extends E{constructor(e,t,o){let s=({url:a})=>{let n=e.exec(a.href);if(!!n&&!(a.origin!==location.origin&&n.index!==0))return n.slice(1)};super(s,t,o)}};var G=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener("fetch",e=>{let{request:t}=e,o=this.handleRequest({request:t,event:e});o&&e.respondWith(o)})}addCacheListener(){self.addEventListener("message",e=>{if(e.data&&e.data.type==="CACHE_URLS"){let{payload:t}=e.data,o=Promise.all(t.urlsToCache.map(s=>{typeof s=="string"&&(s=[s]);let a=new Request(...s);return this.handleRequest({request:a,event:e})}));e.waitUntil(o),e.ports&&e.ports[0]&&o.then(()=>e.ports[0].postMessage(!0))}})}handleRequest({request:e,event:t}){let o=new URL(e.url,location.href);if(!o.protocol.startsWith("http"))return;let s=o.origin===location.origin,{params:a,route:n}=this.findMatchingRoute({event:t,request:e,sameOrigin:s,url:o}),c=n&&n.handler,u=[],l=e.method;if(!c&&this._defaultHandlerMap.has(l)&&(c=this._defaultHandlerMap.get(l)),!c)return;let m;try{m=c.handle({url:o,request:e,event:t,params:a})}catch(d){m=Promise.reject(d)}let h=n&&n.catchHandler;return m instanceof Promise&&(this._catchHandler||h)&&(m=m.catch(d=>i(this,null,function*(){if(h)try{return yield h.handle({url:o,request:e,event:t,params:a})}catch(N){N instanceof Error&&(d=N)}if(this._catchHandler)return this._catchHandler.handle({url:o,request:e,event:t});throw d}))),m}findMatchingRoute({url:e,sameOrigin:t,request:o,event:s}){let a=this._routes.get(o.method)||[];for(let n of a){let c,u=n.match({url:e,sameOrigin:t,request:o,event:s});if(u)return c=u,(Array.isArray(c)&&c.length===0||u.constructor===Object&&Object.keys(u).length===0||typeof u=="boolean")&&(c=void 0),{route:n,params:c}}return{}}setDefaultHandler(e,t=B){this._defaultHandlerMap.set(t,y(e))}setCatchHandler(e){this._catchHandler=y(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new p("unregister-route-but-not-found-with-method",{method:e.method});let t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new p("unregister-route-route-not-registered")}};var O,K=()=>(O||(O=new G,O.addFetchListener(),O.addCacheListener()),O);function T(r,e,t){let o;if(typeof r=="string"){let a=new URL(r,location.href),n=({url:c})=>c.href===a.href;o=new E(n,e,t)}else if(r instanceof RegExp)o=new j(r,e,t);else if(typeof r=="function")o=new E(r,e,t);else if(r instanceof E)o=r;else throw new p("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});return K().registerRoute(o),o}var rt="v2";X();function ve({cacheExpirationSeconds:r=604800}={}){S("INITIALIZING"),self.addEventListener("install",o=>{S("INSTALLING ");function s(){return i(this,null,function*(){yield self.skipWaiting(),S("INSTALLED")})}o.waitUntil(s())}),self.addEventListener("message",o=>i(this,null,function*(){if(o.data.type===_e){if(S("Precaching publications"),typeof o.data.publications!="object"){console.error("Precache event missing publications");return}yield t(o.data.publications)}}));let e=new V({cacheName:H,plugins:[new W({maxAgeSeconds:r})]});function t(o){return i(this,null,function*(){var u;let s=yield caches.open(H);for(let l of o)for(let m of(u=l.swrUrls)!=null?u:[])S(`Routing ${m}`),T(m,new F({cacheName:H}));let c=(yield Promise.allSettled(o.map(l=>i(this,null,function*(){let m=De(l.manifestUrl,l.proxyUrl);T(m,e);let h=yield s.match(m);if(h)return k(R({},l),{manifest:yield h.json()});let d=yield fetch(m);Re(m,d),yield s.put(m,d.clone());let N=yield d.json();return k(R({},l),{manifest:N})})))).map(l=>l.status==="fulfilled"?l.value:void 0).filter(ot).map(l=>i(this,null,function*(){var N,ae;let m=ke((N=l.manifest.resources)!=null?N:[],l.manifestUrl,l.proxyUrl),h=ke((ae=l.manifest.readingOrder)!=null?ae:[],l.manifestUrl,l.proxyUrl),d=Array.from(new Set([...m,...h]));yield Promise.all(d.map(b=>i(this,null,function*(){if(T(b,e),yield s.match(b))return;let ie=yield fetch(b);return Re(b,ie),yield s.put(b,ie)})))}));return yield Promise.allSettled(c)})}}function ot(r){return!!r}function Re(r,e){if(!e.ok){let t=`Bad response status for: ${r}. Status: ${e.status}`;throw console.warn(t),new Error(t)}}function De(r,e){return e?`${e}${encodeURIComponent(r)}`:r}function st(r,e,t){return De(new URL(r,e).toString(),t)}function ke(r,e,t){return r.map(o=>st(o.href,e,t))}function S(r){be&&console.log(`SW (${rt}) -`,r)}module.exports=Pe(nt);
2
- //# sourceMappingURL=sw.js.map