@internetarchive/bookreader 5.0.0-35 → 5.0.0-38

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 (80) hide show
  1. package/.eslintrc.js +1 -11
  2. package/.github/workflows/node.js.yml +69 -7
  3. package/.github/workflows/npm-publish.yml +2 -16
  4. package/BookReader/BookReader.js +1 -1
  5. package/BookReader/BookReader.js.LICENSE.txt +8 -29
  6. package/BookReader/BookReader.js.map +1 -1
  7. package/BookReader/ia-bookreader-bundle.js +100 -99
  8. package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +15 -12
  9. package/BookReader/ia-bookreader-bundle.js.map +1 -1
  10. package/BookReader/plugins/plugin.chapters.js +1 -1
  11. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  12. package/BookReader/plugins/plugin.search.js +1 -1
  13. package/BookReader/plugins/plugin.search.js.map +1 -1
  14. package/BookReader/plugins/plugin.text_selection.js +1 -1
  15. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  16. package/BookReader/plugins/plugin.tts.js +1 -1
  17. package/BookReader/plugins/plugin.tts.js.map +1 -1
  18. package/CHANGELOG.md +28 -0
  19. package/README.md +1 -1
  20. package/codecov.yml +6 -0
  21. package/package.json +18 -21
  22. package/renovate.json +43 -0
  23. package/src/BookNavigator/assets/bookmark-colors.js +1 -1
  24. package/src/BookNavigator/assets/button-base.js +1 -1
  25. package/src/BookNavigator/assets/ia-logo.js +1 -1
  26. package/src/BookNavigator/assets/icon_checkmark.js +1 -1
  27. package/src/BookNavigator/assets/icon_close.js +1 -1
  28. package/src/BookNavigator/assets/icon_sort_asc.js +1 -1
  29. package/src/BookNavigator/assets/icon_sort_desc.js +1 -1
  30. package/src/BookNavigator/assets/icon_sort_neutral.js +1 -1
  31. package/src/BookNavigator/assets/icon_volumes.js +1 -1
  32. package/src/BookNavigator/book-navigator.js +8 -3
  33. package/src/BookNavigator/bookmarks/bookmark-button.js +1 -1
  34. package/src/BookNavigator/bookmarks/bookmark-edit.js +2 -3
  35. package/src/BookNavigator/bookmarks/bookmarks-list.js +2 -3
  36. package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +1 -1
  37. package/src/BookNavigator/bookmarks/bookmarks-provider.js +1 -1
  38. package/src/BookNavigator/bookmarks/ia-bookmarks.js +30 -34
  39. package/src/BookNavigator/delete-modal-actions.js +1 -1
  40. package/src/BookNavigator/downloads/downloads-provider.js +1 -1
  41. package/src/BookNavigator/downloads/downloads.js +1 -2
  42. package/src/BookNavigator/search/a-search-result.js +2 -3
  43. package/src/BookNavigator/search/search-provider.js +3 -4
  44. package/src/BookNavigator/search/search-results.js +1 -2
  45. package/src/BookNavigator/sharing.js +1 -1
  46. package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +1 -1
  47. package/src/BookNavigator/visual-adjustments/visual-adjustments.js +3 -3
  48. package/src/BookNavigator/volumes/volumes-provider.js +1 -1
  49. package/src/BookNavigator/volumes/volumes.js +2 -3
  50. package/src/BookReader/Mode1Up.js +2 -1
  51. package/src/BookReader/Mode1UpLit.js +3 -2
  52. package/src/BookReader.js +59 -57
  53. package/src/ia-bookreader/ia-bookreader.js +5 -2
  54. package/src/plugins/plugin.chapters.js +11 -15
  55. package/src/plugins/plugin.text_selection.js +9 -10
  56. package/src/plugins/search/plugin.search.js +8 -18
  57. package/src/plugins/search/view.js +2 -0
  58. package/src/plugins/tts/AbstractTTSEngine.js +40 -38
  59. package/src/plugins/tts/FestivalTTSEngine.js +10 -11
  60. package/src/plugins/tts/PageChunk.js +11 -20
  61. package/src/plugins/tts/PageChunkIterator.js +8 -12
  62. package/src/plugins/tts/WebTTSEngine.js +59 -68
  63. package/src/plugins/tts/plugin.tts.js +16 -10
  64. package/stat/BookNavigator/BookNavigator.js +42 -0
  65. package/tests/e2e/base.test.js +2 -0
  66. package/tests/e2e/helpers/desktopSearch.js +13 -12
  67. package/tests/e2e/helpers/params.js +1 -1
  68. package/tests/e2e/models/Navigation.js +12 -3
  69. package/tests/e2e/rightToLeft.test.js +1 -1
  70. package/tests/e2e/viewmode.test.js +42 -36
  71. package/tests/jest/BookReader/Mode1UpLit.test.js +2 -1
  72. package/tests/jest/plugins/plugin.text_selection.test.js +25 -23
  73. package/tests/jest/plugins/search/plugin.search.test.js +12 -20
  74. package/tests/jest/plugins/tts/AbstractTTSEngine.test.js +3 -3
  75. package/tests/karma/BookNavigator/bookmarks/bookmarks-list.test.js +2 -2
  76. package/tests/karma/BookNavigator/downloads/downloads.test.js +1 -1
  77. package/tests/karma/BookNavigator/volumes/volumes-provider.test.js +3 -3
  78. package/webpack.config.js +1 -1
  79. package/.github/dependabot.yml +0 -8
  80. package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ # 5.0.0-38
2
+ Dev: Add Renovate Bot @cdrini
3
+ Dev: Update node-fetch @cdrini
4
+ Fix: Search request promise err & fix tests @cdrini
5
+ Dev: Split node workflow into different jobs @cdrini
6
+ Dev: Give cache steps better names in GHA @cdrini
7
+ Dev: Update concurrently + Small speedup to build & test @cdrini
8
+ Dev: Renovate - Auto-update dev dependencies for minor/patch @cdrini
9
+ Fix: Better MS Edge voice selection @cdrini
10
+ Dev: Allow small drops in codecov coverage (< 0.5%) @cdrini
11
+ Dev: Renovate - add `^@internetarchive/icon-` @cdrini
12
+
13
+ # 5.0.0-37
14
+ Fix: Update all `.then()` to async/await @sancodes
15
+ Fix: Upgrade to Lit 2 @Aadilhassan
16
+ Dev: Update to Node v16.x @duggiefresh
17
+ Dev: Remove unused demo bundle @cdrini
18
+ Dev: Fix README broken link for plugin directory @duggiefresh
19
+ Dev: Update sharing options menu to lit2 @iisa
20
+ Dev: Remove package publishing from GHA @cdrini
21
+
22
+ # 5.0.0-36
23
+ Fix: Readaloud scrolls along with dext @cdrini
24
+ Dev: ES6 var to let/const updates @sancodes
25
+ Dev: ES6 async/await updates @sancodes
26
+ Dev: Re-enable testcafe tests in GH action @iisa
27
+ Fix: Search results bar clears and closes properly @iisa
28
+
1
29
  # 5.0.0-35
2
30
  Fix: global syle leak specify colorbox styles @iisa
3
31
  Fix: br menu reinits with shared ro load @iisa
package/README.md CHANGED
@@ -123,7 +123,7 @@ A peek in how to use/extend core functionality:
123
123
  - plugin.url.js - automatically updates the browser url
124
124
  - plugin.resume.js - uses cookies to remember the current page
125
125
  - plugin.vendor-fullscreen.js - replaces fullscreen mode with vendor native fullscreen
126
- - see plugin directory for current plugin files ()[https://github.com/internetarchive/bookreader/tree/master/src/plugins]
126
+ - see [plugin directory for current plugin files](https://github.com/internetarchive/bookreader/tree/master/src/plugins)
127
127
 
128
128
  ### Embedding BookReader in an iFrame
129
129
 
package/codecov.yml CHANGED
@@ -1,6 +1,12 @@
1
1
  codecov:
2
2
  notify:
3
3
  require_ci_to_pass: yes
4
+ status:
5
+ project:
6
+ default:
7
+ # Allow small drops in coverage
8
+ threshold: 0.005 # .5 %
9
+ if_not_found: failure
4
10
 
5
11
  coverage:
6
12
  precision: 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-35",
3
+ "version": "5.0.0-38",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,13 +26,11 @@
26
26
  "private": false,
27
27
  "dependencies": {
28
28
  "@internetarchive/ia-activity-indicator": "^0.0.1",
29
- "@internetarchive/ia-item-navigator": "0.0.5",
30
- "@internetarchive/ia-menu-slider": "^1.1.1",
31
- "@internetarchive/ia-sharing-options": "^0.1.4",
29
+ "@internetarchive/ia-item-navigator": "^1.0.0",
30
+ "@internetarchive/ia-sharing-options": "^1.0.1",
32
31
  "@internetarchive/icon-bookmark": "^1.1.3",
33
- "@internetarchive/icon-collapse-sidebar": "^1.1.0",
34
32
  "@internetarchive/icon-dl": "^1.1.3",
35
- "@internetarchive/icon-edit-pencil": "1.1.5",
33
+ "@internetarchive/icon-edit-pencil": "1.3.2",
36
34
  "@internetarchive/icon-magnify-minus": "^1.2.3",
37
35
  "@internetarchive/icon-magnify-plus": "^1.2.3",
38
36
  "@internetarchive/icon-search": "^1.2.3",
@@ -40,29 +38,28 @@
40
38
  "@internetarchive/icon-visual-adjustment": "^1.1.3",
41
39
  "@internetarchive/modal-manager": "^0.1.0",
42
40
  "@internetarchive/shared-resize-observer": "^0.0.1",
43
- "lit-element": "^2.4.0",
44
- "lit-html": "^1.3.0"
41
+ "lit": "^2.1.3"
45
42
  },
46
43
  "devDependencies": {
47
- "@babel/core": "7.15.0",
48
- "@babel/eslint-parser": "^7.16.5",
49
- "@babel/plugin-proposal-class-properties": "^7.14.5",
50
- "@babel/plugin-proposal-decorators": "^7.14.5",
51
- "@babel/preset-env": "7.15.0",
52
- "@open-wc/testing": "^2.5.33",
44
+ "@babel/core": "7.17.5",
45
+ "@babel/eslint-parser": "7.17.0",
46
+ "@babel/plugin-proposal-class-properties": "7.16.7",
47
+ "@babel/plugin-proposal-decorators": "7.17.2",
48
+ "@babel/preset-env": "7.16.11",
49
+ "@open-wc/testing": "^3.0.4",
53
50
  "@open-wc/testing-karma": "^4.0.9",
54
51
  "@types/jest": "^27.4.0",
55
52
  "@webcomponents/webcomponentsjs": "^2.6.0",
56
- "babel-loader": "8.2.2",
53
+ "babel-loader": "8.2.3",
57
54
  "codecov": "^3.8.3",
58
- "concurrently": "6.0.2",
55
+ "concurrently": "7.0.0",
59
56
  "core-js": "3.16.2",
60
57
  "cpx2": "3.0.0",
61
58
  "eslint": "^7.32.0",
62
59
  "eslint-plugin-no-jquery": "^2.7.0",
63
60
  "eslint-plugin-testcafe": "^0.2.1",
64
61
  "hammerjs": "^2.0.8",
65
- "http-server": "0.12.3",
62
+ "http-server": "14.1.0",
66
63
  "iso-language-codes": "1.1.0",
67
64
  "jest": "^27.4.7",
68
65
  "jquery": "1.11.3",
@@ -73,7 +70,7 @@
73
70
  "jquery.mmenu": "5.6.5",
74
71
  "karma-coverage": "^2.1.0",
75
72
  "live-server": "1.2.1",
76
- "node-fetch": "2.6.1",
73
+ "node-fetch": "2.6.7",
77
74
  "regenerator-runtime": "0.13.9",
78
75
  "sass": "1.38.2",
79
76
  "sinon": "^12.0.1",
@@ -87,7 +84,7 @@
87
84
  "jest": {
88
85
  "testEnvironment": "jsdom",
89
86
  "transformIgnorePatterns": [
90
- "node_modules/(?!(lit-html|lit-element|lit)/)"
87
+ "node_modules/(?!(lit-html|lit-element|lit|@lit|@internetarchive)/)"
91
88
  ],
92
89
  "moduleNameMapper": {
93
90
  "^@/(.*)$": "<rootDir>/$1"
@@ -105,7 +102,7 @@
105
102
  "preversion": "npm run test && node scripts/preversion.js",
106
103
  "version": "node scripts/version.js",
107
104
  "postversion": "node scripts/postversion.js",
108
- "build": "npm run clean && npm run build-js && npm run build-css && npm run build-assets",
105
+ "build": "npm run clean && npx concurrently --group npm:build-js npm:build-css npm:build-assets",
109
106
  "build-assets": "npx cpx \"src/assets/**/*\" BookReader && npx svgo -f BookReader/icons && npx svgo -f BookReader/images",
110
107
  "build-assets:watch": "npx cpx --watch --verbose \"src/assets/**/*\" BookReader",
111
108
  "build-js": "npx webpack",
@@ -118,7 +115,7 @@
118
115
  "serve": "npx http-server . --port 8000",
119
116
  "serve-live": "npx live-server . --port 8000 --watch=index.html,BookReader,BookReaderDemo",
120
117
  "serve-dev": "npm run build-css && npx concurrently --kill-others npm:serve-live npm:build-*:watch",
121
- "test": "npm run test-jest && npm run test-karma",
118
+ "test": "npx concurrently --group npm:test-jest npm:test-karma",
122
119
  "test:e2e": "npm run build && npx testcafe",
123
120
  "test:e2e:dev": "npx testcafe --live --dev",
124
121
  "test-jest:watch": "npx jest --watch",
package/renovate.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "extends": [
3
+ "config:base"
4
+ ],
5
+ "packageRules": [
6
+ {
7
+ "matchPackageNames": [
8
+ "@babel/eslint-parser",
9
+ "@open-wc/testing",
10
+ "@open-wc/testing-karma",
11
+ "@types/jest",
12
+ "codecov",
13
+ "eslint",
14
+ "eslint-plugin-no-jquery",
15
+ "eslint-plugin-testcafe",
16
+ "jest",
17
+ "karma-coverage",
18
+ "sinon",
19
+ "testcafe"
20
+ ],
21
+ "automerge": true
22
+ },
23
+ {
24
+ "matchPackageNames": [
25
+ "concurrently",
26
+ "http-server",
27
+ "live-server",
28
+ "node-fetch"
29
+ ],
30
+ "matchUpdateTypes": ["minor", "patch"],
31
+ "automerge": true
32
+ },
33
+ {
34
+ "matchPackagePatterns": ["^@internetarchive/icon-"],
35
+ "groupName": "@internetarchive icons",
36
+ "rangeStrategy": "bump"
37
+ },
38
+ {
39
+ "matchPackagePatterns": ["^@internetarchive"],
40
+ "rangeStrategy": "bump"
41
+ }
42
+ ]
43
+ }
@@ -1,4 +1,4 @@
1
- import { css } from 'lit-element';
1
+ import { css } from 'lit';
2
2
 
3
3
  export default css`
4
4
  .blue {
@@ -1,4 +1,4 @@
1
- import { css } from 'lit-element';
1
+ import { css } from 'lit';
2
2
 
3
3
  export default css`
4
4
  .ia-button {
@@ -1,4 +1,4 @@
1
- import { svg } from 'lit-element';
1
+ import { svg } from 'lit';
2
2
 
3
3
  export default svg`
4
4
  <svg class="ia-logo" width="27" height="30" viewBox="0 0 27 30" xmlns="http://www.w3.org/2000/svg" aria-labelledby="logoTitleID logoDescID">
@@ -1,4 +1,4 @@
1
- import { css } from 'lit-element';
1
+ import { css } from 'lit';
2
2
 
3
3
  // Original SVG object for reference
4
4
  // <svg height="10" viewBox="0 0 13 10" width="13" xmlns="http://www.w3.org/2000/svg"><path d="m4.33333333 10-4.33333333-4.16666667 1.73333333-1.66666666 2.6 2.5 6.93333337-6.66666667 1.7333333 1.66666667z" fill="#fff" fill-rule="evenodd"/></svg>
@@ -1,3 +1,3 @@
1
- import { css } from 'lit-element';
1
+ import { css } from 'lit';
2
2
 
3
3
  export default css`data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgYXJpYS1sYWJlbGxlZGJ5PSJjbG9zZVRpdGxlSUQgY2xvc2VEZXNjSUQiPjxwYXRoIGQ9Ik0yOS4xOTIgMTAuODA4YTEuNSAxLjUgMCAwMTAgMi4xMkwyMi4xMjIgMjBsNy4wNyA3LjA3MmExLjUgMS41IDAgMDEtMi4xMiAyLjEyMWwtNy4wNzMtNy4wNy03LjA3IDcuMDdhMS41IDEuNSAwIDAxLTIuMTIxLTIuMTJsNy4wNy03LjA3My03LjA3LTcuMDdhMS41IDEuNSAwIDAxMi4xMi0yLjEyMUwyMCAxNy44NzhsNy4wNzItNy4wN2ExLjUgMS41IDAgMDEyLjEyMSAweiIgY2xhc3M9ImZpbGwtY29sb3IiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==`;
@@ -1,4 +1,4 @@
1
- import { html } from 'lit-html';
1
+ import { html } from 'lit';
2
2
 
3
3
  export default html`
4
4
  <svg name="sort-asc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538" transform="matrix(1 0 0 -1 0 18.692308)"/></g></svg>
@@ -1,4 +1,4 @@
1
- import { html } from 'lit-html';
1
+ import { html } from 'lit';
2
2
 
3
3
  export default html`
4
4
  <svg name="sort-desc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538"/></g></svg>
@@ -1,4 +1,4 @@
1
- import { html } from 'lit-html';
1
+ import { html } from 'lit';
2
2
 
3
3
  export default html`
4
4
  <svg name="sort-neutral" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="#fff" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill-rule="nonzero"/><circle cx="13" cy="9" r="2"/></g></svg>
@@ -1,4 +1,4 @@
1
- import { html } from 'lit-html';
1
+ import { html } from 'lit';
2
2
 
3
3
  export default html`
4
4
  <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" aria-labelledby="volumesTitleID volumesDescID">
@@ -2,8 +2,7 @@
2
2
  import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
3
3
  // eslint-disable-next-line no-unused-vars
4
4
  import { ModalManager } from '@internetarchive/modal-manager';
5
- import { css, html, LitElement } from 'lit-element';
6
- import { nothing } from 'lit-html';
5
+ import { css, html, LitElement, nothing } from 'lit';
7
6
  import SearchProvider from './search/search-provider.js';
8
7
  import DownloadProvider from './downloads/downloads-provider.js';
9
8
  import VisualAdjustmentProvider from './visual-adjustments/visual-adjustments-provider.js';
@@ -185,13 +184,19 @@ export class BookNavigator extends LitElement {
185
184
  /* refresh br instance reference */
186
185
  this.bookreader = brInstance;
187
186
  }
187
+
188
+ this.updateMenuContents();
189
+
190
+ if (searchUpdates.openMenu === false) {
191
+ return;
192
+ }
193
+
188
194
  if (this.isWideEnoughToOpenMenu && !searchUpdates?.searchCanceled) {
189
195
  /* open side search menu */
190
196
  setTimeout(() => {
191
197
  this.updateSideMenu('search', 'open');
192
198
  }, 0);
193
199
  }
194
- this.updateMenuContents();
195
200
  },
196
201
  });
197
202
  }
@@ -1,4 +1,4 @@
1
- import { LitElement, html, css } from 'lit-element';
1
+ import { LitElement, html, css } from 'lit';
2
2
 
3
3
  export default class BookmarkButton extends LitElement {
4
4
  static get styles() {
@@ -1,6 +1,5 @@
1
- import { nothing } from 'lit-html';
2
- import { repeat } from 'lit-html/directives/repeat.js';
3
- import { css, html, LitElement } from 'lit-element';
1
+ import { repeat } from 'lit/directives/repeat.js';
2
+ import { css, html, LitElement, nothing } from 'lit';
4
3
  import bookmarkColorsCSS from '../assets/bookmark-colors.js';
5
4
  import buttonCSS from '../assets/button-base.js';
6
5
 
@@ -1,6 +1,5 @@
1
- import { nothing } from 'lit-html';
2
- import { repeat } from 'lit-html/directives/repeat.js';
3
- import { css, html, LitElement } from 'lit-element';
1
+ import { repeat } from 'lit/directives/repeat.js';
2
+ import { css, html, LitElement, nothing } from 'lit';
4
3
  import './bookmark-edit.js';
5
4
  import '@internetarchive/icon-edit-pencil/icon-edit-pencil.js';
6
5
  import bookmarkColorsCSS from '../assets/bookmark-colors.js';
@@ -1,4 +1,4 @@
1
- import { LitElement, html } from 'lit-element';
1
+ import { LitElement, html } from 'lit';
2
2
  import buttonStyles from '../assets/button-base.js';
3
3
 
4
4
  class BookmarksLogin extends LitElement {
@@ -1,4 +1,4 @@
1
- import { html } from 'lit-element';
1
+ import { html } from 'lit';
2
2
  import '../delete-modal-actions.js';
3
3
  import './bookmark-button.js';
4
4
  import './ia-bookmarks.js';
@@ -1,5 +1,4 @@
1
- import { render } from 'lit-html';
2
- import { LitElement, html, css } from 'lit-element';
1
+ import { LitElement, html, css, render } from 'lit';
3
2
  // eslint-disable-next-line no-unused-vars
4
3
  import { ModalConfig, ModalManager } from '@internetarchive/modal-manager';
5
4
  import buttonStyles from '../assets/button-base.js';
@@ -152,14 +151,12 @@ class IABookmarks extends LitElement {
152
151
  }
153
152
  }
154
153
 
155
- fetchUserBookmarks() {
154
+ async fetchUserBookmarks() {
156
155
  if (!this.api.identifier) {
157
156
  return;
158
157
  }
159
- this.fetchBookmarks()
160
- .then(() => {
161
- this.initializeBookmarks();
162
- });
158
+ await this.fetchBookmarks();
159
+ this.initializeBookmarks();
163
160
  }
164
161
 
165
162
  setBREventListeners() {
@@ -229,36 +226,35 @@ class IABookmarks extends LitElement {
229
226
  return bookmark;
230
227
  }
231
228
 
232
- fetchBookmarks() {
233
- return this.api.getAll().then(res => res.text()).then((res) => {
234
- let response;
235
- try {
236
- response = JSON.parse(res);
237
- } catch (e) {
238
- response = { error: e.message };
239
- }
240
- return response;
241
- }).then((response) => {
242
- const {
243
- success,
244
- error = 'Something happened while fetching bookmarks.',
245
- value: bkmrks = [],
246
- } = response;
247
- if (!success) {
248
- console?.warn('Error fetching bookmarks', error);
249
- }
229
+ async fetchBookmarks() {
230
+ const resText = await this.api.getAll().then(r=> r.text());
231
+ let parsedResponse;
232
+ try {
233
+ parsedResponse = JSON.parse(resText);
234
+ } catch (e) {
235
+ parsedResponse = {error : e.message};
236
+ }
250
237
 
251
- const bookmarks = {};
252
- Object.keys(bkmrks).forEach((leafNum) => {
253
- const bookmark = bkmrks[leafNum];
254
- const formattedLeafNum = parseInt(leafNum, 10);
255
- const formattedBookmark = this.formatBookmark({ ...bookmark, leafNum: formattedLeafNum });
256
- bookmarks[leafNum] = formattedBookmark;
257
- });
238
+ const {
239
+ success,
240
+ error = 'Something happened while fetching bookmarks.',
241
+ value: bkmrks = [],
242
+ } = parsedResponse;
243
+
244
+ if (!success) {
245
+ console?.warn('Error fetching bookmarks', error);
246
+ }
258
247
 
259
- this.bookmarks = bookmarks;
260
- return bookmarks;
248
+ const bookmarks = {};
249
+ Object.keys(bkmrks).forEach((leafNum) => {
250
+ const bookmark = bkmrks[leafNum];
251
+ const formattedLeafNum = parseInt(leafNum, 10);
252
+ const formattedBookmark = this.formatBookmark({ ...bookmark, leafNum: formattedLeafNum });
253
+ bookmarks[leafNum] = formattedBookmark;
261
254
  });
255
+
256
+ this.bookmarks = bookmarks;
257
+ return bookmarks;
262
258
  }
263
259
 
264
260
  emitBookmarksChanged() {
@@ -1,4 +1,4 @@
1
- import { LitElement, html, css } from 'lit-element';
1
+ import { LitElement, html, css } from 'lit';
2
2
 
3
3
  export default class DeleteModalActions extends LitElement {
4
4
  static get styles() {
@@ -1,4 +1,4 @@
1
- import { html } from 'lit-element';
1
+ import { html } from 'lit';
2
2
  import '@internetarchive/icon-dl/icon-dl';
3
3
  import './downloads';
4
4
 
@@ -1,5 +1,4 @@
1
- import { css, html, LitElement } from 'lit-element';
2
- import { nothing } from 'lit-html';
1
+ import { css, html, LitElement, nothing } from 'lit';
3
2
  import buttonStyles from '../assets/button-base.js';
4
3
  export class IABookDownloads extends LitElement {
5
4
  static get properties() {
@@ -1,6 +1,5 @@
1
- import { nothing } from 'lit-html';
2
- import { html, LitElement } from 'lit-element';
3
- import { unsafeHTML } from 'lit-html/directives/unsafe-html';
1
+ import { html, LitElement, nothing } from 'lit';
2
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
4
3
 
5
4
  export class BookSearchResult extends LitElement {
6
5
  static get properties() {
@@ -1,5 +1,4 @@
1
- import { html } from 'lit-element';
2
- import { nothing } from 'lit-html';
1
+ import { html, nothing } from 'lit';
3
2
  import '@internetarchive/icon-search/icon-search';
4
3
  import './search-results';
5
4
 
@@ -144,8 +143,8 @@ export default class SearchProvider {
144
143
  queryInProgress: false,
145
144
  errorMessage: '',
146
145
  };
147
- this.updateMenu();
148
- this.bookreader?.searchView?.clearSearchFieldAndResults();
146
+ this.updateMenu({ openMenu: false });
147
+ this.bookreader?.searchView?.clearSearchFieldAndResults(false);
149
148
  }
150
149
 
151
150
  /**
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable class-methods-use-this */
2
- import { nothing } from 'lit-html';
3
- import { css, html, LitElement } from 'lit-element';
2
+ import { css, html, LitElement, nothing } from 'lit';
4
3
  import '@internetarchive/ia-activity-indicator/ia-activity-indicator';
5
4
  import './a-search-result.js';
6
5
  import checkmarkIcon from '../assets/icon_checkmark.js';
@@ -1,4 +1,4 @@
1
- import { html } from 'lit-element';
1
+ import { html } from 'lit';
2
2
  import '@internetarchive/icon-share/icon-share';
3
3
  import '@internetarchive/ia-sharing-options';
4
4
 
@@ -1,4 +1,4 @@
1
- import { html } from 'lit-element';
1
+ import { html } from 'lit';
2
2
  import '@internetarchive/icon-visual-adjustment/icon-visual-adjustment';
3
3
  import './visual-adjustments';
4
4
 
@@ -1,6 +1,6 @@
1
- import { css, html, LitElement } from "lit-element";
2
- import { repeat } from "lit-html/directives/repeat.js";
3
- import { nothing } from "lit-html";
1
+ import { css, html, LitElement } from "lit";
2
+ import { repeat } from "lit/directives/repeat.js";
3
+ import { nothing } from "lit";
4
4
  import checkmarkIcon from '../assets/icon_checkmark.js';
5
5
  import "@internetarchive/icon-magnify-minus/icon-magnify-minus";
6
6
  import "@internetarchive/icon-magnify-plus/icon-magnify-plus";
@@ -1,4 +1,4 @@
1
- import { html } from 'lit-element';
1
+ import { html } from 'lit';
2
2
 
3
3
  import sortDescIcon from '../assets/icon_sort_desc.js';
4
4
  import sortAscIcon from '../assets/icon_sort_asc.js';
@@ -1,6 +1,5 @@
1
- import { css, html, LitElement } from 'lit-element';
2
- import { nothing } from 'lit-html';
3
- import { repeat } from 'lit-html/directives/repeat';
1
+ import { css, html, LitElement, nothing } from 'lit';
2
+ import { repeat } from 'lit/directives/repeat.js';
4
3
 
5
4
  export class Volumes extends LitElement {
6
5
  static get properties() {
@@ -46,7 +46,8 @@ export class Mode1Up {
46
46
  if (!this.everShown) {
47
47
  this.mode1UpLit.initFirstRender(startLeaf);
48
48
  this.everShown = true;
49
- await this.mode1UpLit.requestUpdate();
49
+ this.mode1UpLit.requestUpdate();
50
+ await this.mode1UpLit.updateComplete;
50
51
  new DragScrollable(this.mode1UpLit, {
51
52
  preventDefault: true,
52
53
  dragSelector: '.br-mode-1up__visible-world',
@@ -1,6 +1,7 @@
1
1
  // @ts-check
2
- import { customElement, html, LitElement, property, query } from 'lit-element';
3
- import { styleMap } from 'lit-html/directives/style-map';
2
+ import { customElement, property, query } from 'lit/decorators.js';
3
+ import {LitElement, html} from 'lit';
4
+ import { styleMap } from 'lit/directives/style-map.js';
4
5
  import { ModeSmoothZoom } from './ModeSmoothZoom';
5
6
  import { arrChanged, calcScreenDPI, genToArray, sum, throttle } from './utils';
6
7
  import { HTMLDimensionsCacher } from "./utils/HTMLDimensionsCacher";