@internetarchive/ia-book-actions 0.0.29-alpha18 → 0.0.29-alpha19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/demo/index.html CHANGED
@@ -15,7 +15,7 @@
15
15
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
16
16
  }
17
17
  #demo {
18
- height: 50px;
18
+ height: 100px;
19
19
  }
20
20
  ia-book-actions {
21
21
  --white: #fff;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-book-actions",
3
- "version": "0.0.29-alpha18",
3
+ "version": "0.0.29-alpha19",
4
4
  "description": "Bookreader actions for borrowable book",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -22,7 +22,7 @@
22
22
  "@internetarchive/local-cache": "^0.2.0",
23
23
  "@internetarchive/modal-manager": "^0.2.1",
24
24
  "@internetarchive/shared-resize-observer": "^0.2.0",
25
- "@internetarchive/toast-manager": "0.0.1-alpha1",
25
+ "@internetarchive/toast-manager": "0.0.1-alpha3",
26
26
  "lit": "^2.2.1"
27
27
  },
28
28
  "devDependencies": {
@@ -3,6 +3,7 @@ import { html, css, LitElement, nothing } from 'lit';
3
3
 
4
4
  import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
5
5
  import { ModalConfig } from '@internetarchive/modal-manager';
6
+ import '@internetarchive/toast-manager';
6
7
  import { ToastConfig } from '@internetarchive/toast-manager';
7
8
  import { LocalCache } from '@internetarchive/local-cache';
8
9
 
@@ -83,6 +84,7 @@ export default class IABookActions extends LitElement {
83
84
  this.consecutiveLoanCounts = 1; // consecutive loan count
84
85
  this.browserTimer = undefined;
85
86
 
87
+ this._shadowRoot = this.attachShadow({ mode: "open" });
86
88
  this.bindLoanRenewEvents();
87
89
  }
88
90
 
@@ -109,10 +111,6 @@ export default class IABookActions extends LitElement {
109
111
  this.disconnectResizeObserver();
110
112
  this.setupResizeObserver();
111
113
  }
112
-
113
- if (changed.has('loanRenewResult')) {
114
- this.showToastMessage();
115
- }
116
114
  }
117
115
 
118
116
  bindLoanRenewEvents() {
@@ -144,6 +142,8 @@ export default class IABookActions extends LitElement {
144
142
 
145
143
  console.log(this.loanRenewResult);
146
144
 
145
+ this.showToastMessage();
146
+
147
147
  if (this.loanRenewResult.renewNow) {
148
148
  this.tokenPoller.disconnectedInterval();
149
149
  await this.browseHasRenew();
@@ -153,11 +153,14 @@ export default class IABookActions extends LitElement {
153
153
  }
154
154
 
155
155
  async showToastMessage() {
156
- let toastManager = document.querySelector('toast-template');
156
+ let toastManager = this.shadowRoot.querySelector('toast-template');
157
157
  if (!toastManager) {
158
158
  toastManager = document.createElement('toast-template');
159
159
  }
160
- await document.body.appendChild(toastManager);
160
+ this.shadowRoot.appendChild(toastManager)
161
+
162
+ // await this.shadowRoot.appendChild(toastManager)
163
+ // await document.body.appendChild(toastManager);
161
164
 
162
165
  toastManager.config = new ToastConfig(this.loanRenewResult);
163
166
  }
@@ -503,7 +506,7 @@ export default class IABookActions extends LitElement {
503
506
  get textGroupTemplate() {
504
507
  return html`<text-group
505
508
  textClass=${this.textClass}
506
- texts=${this.primaryTitle}
509
+ .texts=${this.primaryTitle}
507
510
  >
508
511
  </text-group>`;
509
512
  }
@@ -516,12 +519,13 @@ export default class IABookActions extends LitElement {
516
519
  return css`
517
520
  :host {
518
521
  display: block;
519
- background: var(--primaryBGColor, #000);
520
- color: var(--primaryTextColor, #fff);
521
522
  }
523
+
522
524
  .lending-wrapper {
523
525
  width: 100%;
524
526
  margin: 0 auto;
527
+ background: var(--primaryBGColor, #000);
528
+ color: var(--primaryTextColor, #fff);
525
529
  display: inline-flex;
526
530
  align-items: center;
527
531
  justify-content: center;
@@ -529,9 +533,10 @@ export default class IABookActions extends LitElement {
529
533
  }
530
534
 
531
535
  toast-template {
532
- --toastHeightFromTop: 15%;
536
+ --toastHeightFromTop: 22%;
533
537
  --toastBGColor: #333333;
534
538
  --toastFontColor: #ffffff;
539
+ --toastTopMargin: 80px;
535
540
  }
536
541
  `;
537
542
  }