@internetarchive/bookreader 5.0.0-29 → 5.0.0-30-c

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 (44) hide show
  1. package/BookReader/BookReader.js +32267 -2
  2. package/BookReader/BookReader.js.map +1 -1
  3. package/BookReader/ia-bookreader-bundle.js +15232 -0
  4. package/BookReader/ia-bookreader-bundle.js.map +1 -0
  5. package/BookReader/jquery-1.10.1.js +108 -2
  6. package/BookReader/plugins/plugin.archive_analytics.js +170 -1
  7. package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
  8. package/BookReader/plugins/plugin.autoplay.js +163 -1
  9. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  10. package/BookReader/plugins/plugin.chapters.js +333 -1
  11. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  12. package/BookReader/plugins/plugin.iframe.js +72 -1
  13. package/BookReader/plugins/plugin.iframe.js.map +1 -1
  14. package/BookReader/plugins/plugin.mobile_nav.js +332 -1
  15. package/BookReader/plugins/plugin.mobile_nav.js.map +1 -1
  16. package/BookReader/plugins/plugin.resume.js +241 -1
  17. package/BookReader/plugins/plugin.resume.js.map +1 -1
  18. package/BookReader/plugins/plugin.search.js +1261 -1
  19. package/BookReader/plugins/plugin.search.js.map +1 -1
  20. package/BookReader/plugins/plugin.text_selection.js +839 -1
  21. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  22. package/BookReader/plugins/plugin.tts.js +9115 -2
  23. package/BookReader/plugins/plugin.tts.js.map +1 -1
  24. package/BookReader/plugins/plugin.url.js +811 -1
  25. package/BookReader/plugins/plugin.url.js.map +1 -1
  26. package/BookReader/plugins/plugin.vendor-fullscreen.js +326 -1
  27. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  28. package/BookReader/webcomponents-bundle.js +411 -2
  29. package/BookReader/webcomponents-bundle.js.map +1 -1
  30. package/BookReaderDemo/IADemoBr.js +3 -0
  31. package/BookReaderDemo/demo-internetarchive.html +6 -8
  32. package/package.json +4 -4
  33. package/src/BookNavigator/book-navigator.js +7 -0
  34. package/src/BookReader/Mode1Up.js +1 -0
  35. package/src/BookReader/Mode1UpLit.js +5 -1
  36. package/src/{BookReaderComponent/BookReaderComponent.js → ia-bookreader/ia-bookreader.js} +93 -17
  37. package/webpack.config.js +2 -2
  38. package/BookReader/BookReader.js.LICENSE.txt +0 -117
  39. package/BookReader/bookreader-component-bundle.js +0 -1464
  40. package/BookReader/bookreader-component-bundle.js.LICENSE.txt +0 -50
  41. package/BookReader/bookreader-component-bundle.js.map +0 -1
  42. package/BookReader/jquery-1.10.1.js.LICENSE.txt +0 -24
  43. package/BookReader/plugins/plugin.tts.js.LICENSE.txt +0 -27
  44. package/BookReader/webcomponents-bundle.js.LICENSE.txt +0 -9
@@ -18,6 +18,9 @@ if (openFullImmersionTheater) {
18
18
  iaBookReader.fullscreen = openFullImmersionTheater;
19
19
  }
20
20
 
21
+ const modal = document.querySelector('modal-manager');
22
+ iaBookReader.modal = modal;
23
+
21
24
  // Override options coming from IA
22
25
  BookReader.optionOverrides.imagesBaseURL = '/BookReader/images/';
23
26
 
@@ -26,7 +26,7 @@
26
26
  <script src="../BookReader/plugins/plugin.archive_analytics.js"></script>
27
27
  <script src="../BookReader/plugins/plugin.text_selection.js"></script>
28
28
 
29
- <script type="module" src="../BookReader/bookreader-component-bundle.js"></script>
29
+ <script type="module" src="../BookReader/ia-bookreader-bundle.js"></script>
30
30
 
31
31
  <link rel="stylesheet" href="BookReaderDemo.css"/>
32
32
 
@@ -88,19 +88,17 @@
88
88
  <h3>Placeholder div to allow scrolling</h3>
89
89
  </div>
90
90
 
91
+ <modal-manager></modal-manager>
91
92
  <script >
92
93
  // Set up demo things
93
94
  const iaBR = document.querySelector('ia-bookreader');
94
95
  const toggleLoginBtn = document.querySelector('#toggle-loggedin');
95
96
  toggleLoginBtn.addEventListener('click', () => {
96
- const itemNav = iaBR.shadowRoot.querySelector('ia-item-navigator');
97
- const bookNav = itemNav.shadowRoot.querySelector('book-navigator');
97
+ const currLoggedIn = iaBR.signedIn;
98
+ iaBR.signedIn = !currLoggedIn;
98
99
 
99
- const currLoggedIn = bookNav.signedIn;
100
- bookNav.signedIn = !currLoggedIn;
101
-
102
- document.querySelector('#logged-in-status').innerText = bookNav.signedIn ? 'Logged In' : 'Logged Out';
103
- console.log("Toggled SignedIn state", bookNav.signedIn, { currLoggedIn })
100
+ document.querySelector('#logged-in-status').innerText = iaBR.signedIn ? 'Logged In' : 'Logged Out';
101
+ console.log("Toggled SignedIn state", iaBR.signedIn, { currLoggedIn })
104
102
  });
105
103
 
106
104
  const startFSBtn = document.querySelector('#start-fs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-29",
3
+ "version": "5.0.0-30-c",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "module": "src/BookNavigator/book-navigator.js",
12
+ "module": "src/ia-bookreader/ia-bookreader.js",
13
13
  "keywords": [
14
14
  "online",
15
15
  "bookreader",
@@ -26,9 +26,9 @@
26
26
  "private": false,
27
27
  "dependencies": {
28
28
  "@internetarchive/ia-activity-indicator": "^0.0.1",
29
- "@internetarchive/ia-item-navigator": "^0.0.2",
29
+ "@internetarchive/ia-item-navigator": "0.0.4-3",
30
30
  "@internetarchive/ia-menu-slider": "^1.1.1",
31
- "@internetarchive/ia-sharing-options": "^0.1.3-3",
31
+ "@internetarchive/ia-sharing-options": "^0.1.4",
32
32
  "@internetarchive/icon-bookmark": "^1.1.3",
33
33
  "@internetarchive/icon-collapse-sidebar": "^1.1.0",
34
34
  "@internetarchive/icon-dl": "^1.1.3",
@@ -511,6 +511,13 @@ export class BookNavigator extends LitElement {
511
511
 
512
512
  static get styles() {
513
513
  return css`
514
+ :host,
515
+ #book-navigator,
516
+ slot,
517
+ slot > * {
518
+ display: block;
519
+ height: inherit;
520
+ }
514
521
  .cover-img {
515
522
  max-height: 300px;
516
523
  }
@@ -44,6 +44,7 @@ export class Mode1Up {
44
44
  // appended the element to the DOM
45
45
  setTimeout(async () => {
46
46
  if (!this.everShown) {
47
+ console.log('!this.everShown', startLeaf);
47
48
  this.mode1UpLit.initFirstRender(startLeaf);
48
49
  this.everShown = true;
49
50
  await this.mode1UpLit.requestUpdate();
@@ -170,6 +170,7 @@ export class Mode1UpLit extends LitElement {
170
170
 
171
171
  /** @override */
172
172
  firstUpdated(changedProps) {
173
+ console.log('firstUpdatedfirstUpdatedfirstUpdated');
173
174
  super.firstUpdated(changedProps);
174
175
  this.htmlDimensionsCacher.updateClientSizes();
175
176
  this.smoothZoomer.attach();
@@ -181,6 +182,7 @@ export class Mode1UpLit extends LitElement {
181
182
  initFirstRender(startIndex) {
182
183
  const page = this.book.getPage(startIndex);
183
184
  this.scale = this.computeDefaultScale(page);
185
+ console.log('1uplit init first render', page, startIndex);
184
186
  }
185
187
 
186
188
  /** @override */
@@ -323,6 +325,8 @@ export class Mode1UpLit extends LitElement {
323
325
  left: vToW(scrollLeft),
324
326
  width: vToW(clientWidth),
325
327
  };
328
+
329
+ console.log('**** updateVisibleRegion this.visibleRegion', this.visibleRegion);
326
330
  }
327
331
 
328
332
  /**
@@ -368,7 +372,7 @@ export class Mode1UpLit extends LitElement {
368
372
  computeDefaultScale(page) {
369
373
  // Default to real size if it fits, otherwise default to full width
370
374
  const containerWidthIn = this.visiblePixelsToWorldUnits(this.htmlDimensionsCacher.clientWidth);
371
- return Math.min(1, containerWidthIn / (page.widthInches + 2 * this.SPACING_IN));
375
+ return Math.min(1, containerWidthIn / (page.widthInches + 2 * this.SPACING_IN)) || 1;
372
376
  }
373
377
 
374
378
  computeWorldDimensions() {
@@ -10,13 +10,19 @@ import '../BookNavigator/book-navigator.js';
10
10
  import { ModalManager } from '@internetarchive/modal-manager';
11
11
  import '@internetarchive/modal-manager';
12
12
  import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
13
- export class BookReader extends LitElement {
13
+
14
+ export class IaBookReader extends LitElement {
14
15
  static get properties() {
15
16
  return {
16
17
  item: { type: Object },
17
18
  baseHost: { type: String },
19
+ signedIn: { type: Boolean },
18
20
  fullscreen: { type: Boolean, reflect: true, attribute: true },
19
- sharedObserver: { type: Object }
21
+ sharedObserver: { type: Object, attribute: false },
22
+ modal: { type: Object, attribute: false },
23
+ loaded: { type: Boolean },
24
+ menuShortcuts: { type: Array },
25
+ menuContents: { type: Array },
20
26
  };
21
27
  }
22
28
 
@@ -26,45 +32,104 @@ export class BookReader extends LitElement {
26
32
  this.bookreader = undefined;
27
33
  this.baseHost = 'https://archive.org';
28
34
  this.fullscreen = false;
35
+ this.signedIn = false;
29
36
  /** @type {ModalManager} */
30
37
  this.modal = undefined;
31
38
  /** @type {SharedResizeObserver} */
32
- this.sharedObserver = new SharedResizeObserver();
39
+ this.sharedObserver = undefined;
40
+ this.loaded = false;
41
+ this.menuShortcuts = [];
42
+ this.menuContents = [];
43
+ console.log("ia-bookreader constructor", this);
33
44
  }
34
45
 
35
- firstUpdated() {
36
- this.createModal();
37
- }
46
+ updated() {
47
+ if (!this.modal) {
48
+ this.modal = new ModalManager();
49
+ }
38
50
 
39
- /** Creates modal DOM & attaches to `<body>` */
40
- createModal() {
41
- this.modal = document.createElement(
42
- 'modal-manager'
43
- );
44
- document.body.appendChild(this.modal);
51
+ if (!this.sharedObserver) {
52
+ this.sharedObserver = new SharedResizeObserver();
53
+ }
45
54
  }
46
- /* End Modal management */
55
+
47
56
 
48
57
  manageFullscreen(e) {
49
58
  const { detail } = e;
50
59
  const fullscreen = !!detail.isFullScreen;
51
60
  this.fullscreen = fullscreen;
61
+ this.dispatchEvent(new CustomEvent('fullscreenStatusUpdated', { detail: { fullscreen }}));
62
+
63
+ }
64
+
65
+ loadingStateUpdated(e) {
66
+ const { loaded } = e.detail;
67
+ this.loaded = loaded || null;
68
+ this.dispatchEvent(new CustomEvent('loadingStateUpdated', { detail: { loaded }}));
52
69
  }
53
70
 
71
+ setMenuShortcuts(e) {
72
+ this.menuShortcuts = [...e.detail];
73
+ }
74
+
75
+ setMenuContents(e) {
76
+ const updatedContents = [...e.detail];
77
+ this.menuContents = updatedContents;
78
+ }
79
+
80
+ manageSideMenuEvents(e) {
81
+ const { menuId, action } = e.detail;
82
+ if (!menuId) {
83
+ return;
84
+ }
85
+
86
+ if (action === 'open') {
87
+ this.itemNav.openShortcut(menuId);
88
+ this.openShortcut(menuId);
89
+ } else if (action === 'toggle') {
90
+ this.itemNav.openMenu(menuId);
91
+ this.itemNav.toggleMenu();
92
+ }
93
+ }
94
+
95
+ // LINER NOTES --- iaux.min.js is loading wayy to late for booknav listener, to br. init
96
+
54
97
  render() {
55
98
  return html`
56
99
  <div class="ia-bookreader">
57
100
  <ia-item-navigator
58
101
  ?viewportInFullscreen=${this.fullscreen}
59
- @fullscreenToggled=${this.manageFullscreen}
60
- .itemType=${'bookreader'}
102
+ .itemType=${'open'}
61
103
  .basehost=${this.baseHost}
62
104
  .item=${this.item}
63
105
  .modal=${this.modal}
106
+ .loaded=${this.loaded}
64
107
  .sharedObserver=${this.sharedObserver}
108
+ ?signedIn=${this.signedIn}
109
+ .menuShortcuts=${this.menuShortcuts}
110
+ .menuContents=${this.menuContents}
65
111
  >
112
+ <div slot="theater-header">
113
+ <slot name="theater-header"></slot>
114
+ </div>
66
115
  <div slot="theater-main">
67
- <slot name="theater-main"></slot>
116
+ <book-navigator
117
+ .modal=${this.modal}
118
+ .baseHost=${this.baseHost}
119
+ .itemMD=${this.item}
120
+ ?signedIn=${this.signedIn}
121
+ ?sideMenuOpen=${this.menuOpened}
122
+ .sharedObserver=${this.sharedObserver}
123
+ @ViewportInFullScreen=${this.manageFullscreen}
124
+ @loadingStateUpdated=${this.loadingStateUpdated}
125
+ @updateSideMenu=${this.manageSideMenuEvents}
126
+ @menuUpdated=${this.setMenuContents}
127
+ @menuShortcutsUpdated=${this.setMenuShortcuts}
128
+ >
129
+ <div slot="theater-main">
130
+ <slot name="theater-main"></slot>
131
+ </div>
132
+ </book-navigator>
68
133
  </div>
69
134
  </ia-item-navigator>
70
135
  </div>
@@ -75,6 +140,8 @@ export class BookReader extends LitElement {
75
140
  return css`
76
141
  :host {
77
142
  display: block;
143
+ height: inherit;
144
+ min-height: inherit;
78
145
  --primaryBGColor: var(--black, #000);
79
146
  --secondaryBGColor: #222;
80
147
  --tertiaryBGColor: #333;
@@ -95,6 +162,15 @@ export class BookReader extends LitElement {
95
162
  min-height: unset;
96
163
  }
97
164
 
165
+ div[slot="theater-main"],
166
+ div[slot="theater-main"] > * {
167
+ height: inherit;
168
+ }
169
+
170
+ slot {
171
+ display: block;
172
+ }
173
+
98
174
  .ia-bookreader {
99
175
  background-color: var(--primaryBGColor);
100
176
  position: relative;
@@ -130,4 +206,4 @@ export class BookReader extends LitElement {
130
206
  }
131
207
  }
132
208
 
133
- window.customElements.define("ia-bookreader", BookReader);
209
+ window.customElements.define("ia-bookreader", IaBookReader);
package/webpack.config.js CHANGED
@@ -4,7 +4,7 @@ const webpack = require('webpack');
4
4
 
5
5
  /** @type {webpack.Configuration} */
6
6
  const shared = {
7
- mode: 'production',
7
+ mode: 'development',
8
8
 
9
9
  watchOptions: {
10
10
  ignored: ['BookReader/**', 'node_modules/**', 'tests/**']
@@ -53,7 +53,7 @@ module.exports = [
53
53
  'plugins/plugin.tts.js': { import: './src/plugins/tts/plugin.tts.js', dependOn: 'BookReader.js' },
54
54
  'plugins/plugin.url.js': { import: './src/plugins/url/plugin.url.js', dependOn: 'BookReader.js' },
55
55
  'plugins/plugin.vendor-fullscreen.js': { import: './src/plugins/plugin.vendor-fullscreen.js', dependOn: 'BookReader.js' },
56
- 'bookreader-component-bundle.js': { import: './src/BookReaderComponent/BookReaderComponent.js', dependOn: 'BookReader.js' }
56
+ 'ia-bookreader-bundle.js': { import: './src/ia-bookreader/ia-bookreader.js', dependOn: 'BookReader.js' }
57
57
  },
58
58
 
59
59
  externals: {
@@ -1,117 +0,0 @@
1
- /*!
2
- Colorbox 1.6.4
3
- license: MIT
4
- http://www.jacklmoore.com/colorbox
5
- */
6
-
7
- /*!
8
- * jQuery Color Animations v2.1.2
9
- * https://github.com/jquery/jquery-color
10
- *
11
- * Copyright 2014 jQuery Foundation and other contributors
12
- * Released under the MIT license.
13
- * http://jquery.org/license
14
- *
15
- * Date: Wed Jan 16 08:47:09 2013 -0600
16
- */
17
-
18
- /*!
19
- * jQuery UI Effects 1.12.1
20
- * http://jqueryui.com
21
- *
22
- * Copyright jQuery Foundation and other contributors
23
- * Released under the MIT license.
24
- * http://jquery.org/license
25
- */
26
-
27
- /*!
28
- * jQuery UI Keycode 1.12.1
29
- * http://jqueryui.com
30
- *
31
- * Copyright jQuery Foundation and other contributors
32
- * Released under the MIT license.
33
- * http://jquery.org/license
34
- */
35
-
36
- /*!
37
- * jQuery UI Mouse 1.12.1
38
- * http://jqueryui.com
39
- *
40
- * Copyright jQuery Foundation and other contributors
41
- * Released under the MIT license.
42
- * http://jquery.org/license
43
- */
44
-
45
- /*!
46
- * jQuery UI Slider 1.12.1
47
- * http://jqueryui.com
48
- *
49
- * Copyright jQuery Foundation and other contributors
50
- * Released under the MIT license.
51
- * http://jquery.org/license
52
- */
53
-
54
- /*!
55
- * jQuery UI Touch Punch 0.2.3
56
- *
57
- * Copyright 2011–2014, Dave Furfero
58
- * Dual licensed under the MIT or GPL Version 2 licenses.
59
- *
60
- * Depends:
61
- * jquery.ui.widget.js
62
- * jquery.ui.mouse.js
63
- */
64
-
65
- /*!
66
- * jQuery UI Widget 1.12.1
67
- * http://jqueryui.com
68
- *
69
- * Copyright jQuery Foundation and other contributors
70
- * Released under the MIT license.
71
- * http://jquery.org/license
72
- */
73
-
74
- /*! Hammer.JS - v2.0.7 - 2016-04-22
75
- * http://hammerjs.github.io/
76
- *
77
- * Copyright (c) 2016 Jorik Tangelder;
78
- * Licensed under the MIT license */
79
-
80
- /**
81
- * @license
82
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
83
- * This code may only be used under the BSD style license found at
84
- * http://polymer.github.io/LICENSE.txt
85
- * The complete set of authors may be found at
86
- * http://polymer.github.io/AUTHORS.txt
87
- * The complete set of contributors may be found at
88
- * http://polymer.github.io/CONTRIBUTORS.txt
89
- * Code distributed by Google as part of the polymer project is also
90
- * subject to an additional IP rights grant found at
91
- * http://polymer.github.io/PATENTS.txt
92
- */
93
-
94
- /**
95
- * @license
96
- * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
97
- * This code may only be used under the BSD style license found at
98
- * http://polymer.github.io/LICENSE.txt
99
- * The complete set of authors may be found at
100
- * http://polymer.github.io/AUTHORS.txt
101
- * The complete set of contributors may be found at
102
- * http://polymer.github.io/CONTRIBUTORS.txt
103
- * Code distributed by Google as part of the polymer project is also
104
- * subject to an additional IP rights grant found at
105
- * http://polymer.github.io/PATENTS.txt
106
- */
107
-
108
- /**
109
- @license
110
- Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
111
- This code may only be used under the BSD style license found at
112
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
113
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
114
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
115
- part of the polymer project is also subject to an additional IP rights grant
116
- found at http://polymer.github.io/PATENTS.txt
117
- */