@internetarchive/elements 1.3.0 → 1.4.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 (88) hide show
  1. package/dist/src/elements/ia-reviews/ia-review-form.d.ts +32 -0
  2. package/dist/src/elements/ia-reviews/ia-review-form.d.ts.map +1 -1
  3. package/dist/src/elements/ia-reviews/ia-review-form.js +59 -4
  4. package/dist/src/elements/ia-reviews/ia-review-form.js.map +1 -1
  5. package/dist/src/elements/ia-reviews/ia-review.d.ts +20 -0
  6. package/dist/src/elements/ia-reviews/ia-review.d.ts.map +1 -1
  7. package/dist/src/elements/ia-reviews/ia-review.js +43 -8
  8. package/dist/src/elements/ia-reviews/ia-review.js.map +1 -1
  9. package/dist/src/elements/ia-reviews/ia-reviews.d.ts +11 -3
  10. package/dist/src/elements/ia-reviews/ia-reviews.d.ts.map +1 -1
  11. package/dist/src/elements/ia-reviews/ia-reviews.js +64 -41
  12. package/dist/src/elements/ia-reviews/ia-reviews.js.map +1 -1
  13. package/dist/src/elements/ia-reviews/legacy-review-service.d.ts.map +1 -1
  14. package/dist/src/elements/ia-reviews/legacy-review-service.js +5 -8
  15. package/dist/src/elements/ia-reviews/legacy-review-service.js.map +1 -1
  16. package/dist/src/elements/ia-topnav/assets/img/icon-audio.d.ts +3 -0
  17. package/dist/src/elements/ia-topnav/assets/img/icon-audio.d.ts.map +1 -0
  18. package/dist/src/elements/ia-topnav/assets/img/icon-audio.js +29 -0
  19. package/dist/src/elements/ia-topnav/assets/img/icon-audio.js.map +1 -0
  20. package/dist/src/elements/ia-topnav/assets/img/icon-close.d.ts +3 -0
  21. package/dist/src/elements/ia-topnav/assets/img/icon-close.d.ts.map +1 -0
  22. package/dist/src/elements/ia-topnav/assets/img/icon-close.js +21 -0
  23. package/dist/src/elements/ia-topnav/assets/img/icon-close.js.map +1 -0
  24. package/dist/src/elements/ia-topnav/assets/img/icon-donate-unpadded.d.ts +3 -0
  25. package/dist/src/elements/ia-topnav/assets/img/icon-donate-unpadded.d.ts.map +1 -0
  26. package/dist/src/elements/ia-topnav/assets/img/icon-donate-unpadded.js +20 -0
  27. package/dist/src/elements/ia-topnav/assets/img/icon-donate-unpadded.js.map +1 -0
  28. package/dist/src/elements/ia-topnav/assets/img/icon-donate.d.ts +3 -0
  29. package/dist/src/elements/ia-topnav/assets/img/icon-donate.d.ts.map +1 -0
  30. package/dist/src/elements/ia-topnav/assets/img/icon-donate.js +19 -0
  31. package/dist/src/elements/ia-topnav/assets/img/icon-donate.js.map +1 -0
  32. package/dist/src/elements/ia-topnav/assets/img/icon-ellipses.d.ts +3 -0
  33. package/dist/src/elements/ia-topnav/assets/img/icon-ellipses.d.ts.map +1 -0
  34. package/dist/src/elements/ia-topnav/assets/img/icon-ellipses.js +20 -0
  35. package/dist/src/elements/ia-topnav/assets/img/icon-ellipses.js.map +1 -0
  36. package/dist/src/elements/ia-topnav/assets/img/icon-ia-logo.d.ts +3 -0
  37. package/dist/src/elements/ia-topnav/assets/img/icon-ia-logo.d.ts.map +1 -0
  38. package/dist/src/elements/ia-topnav/assets/img/icon-ia-logo.js +31 -0
  39. package/dist/src/elements/ia-topnav/assets/img/icon-ia-logo.js.map +1 -0
  40. package/dist/src/elements/ia-topnav/assets/img/icon-images.d.ts +3 -0
  41. package/dist/src/elements/ia-topnav/assets/img/icon-images.d.ts.map +1 -0
  42. package/dist/src/elements/ia-topnav/assets/img/icon-images.js +20 -0
  43. package/dist/src/elements/ia-topnav/assets/img/icon-images.js.map +1 -0
  44. package/dist/src/elements/ia-topnav/assets/img/icon-search.d.ts +3 -0
  45. package/dist/src/elements/ia-topnav/assets/img/icon-search.d.ts.map +1 -0
  46. package/dist/src/elements/ia-topnav/assets/img/icon-search.js +20 -0
  47. package/dist/src/elements/ia-topnav/assets/img/icon-search.js.map +1 -0
  48. package/dist/src/elements/ia-topnav/assets/img/icon-software.d.ts +3 -0
  49. package/dist/src/elements/ia-topnav/assets/img/icon-software.d.ts.map +1 -0
  50. package/dist/src/elements/ia-topnav/assets/img/icon-software.js +19 -0
  51. package/dist/src/elements/ia-topnav/assets/img/icon-software.js.map +1 -0
  52. package/dist/src/elements/ia-topnav/assets/img/icon-texts.d.ts +3 -0
  53. package/dist/src/elements/ia-topnav/assets/img/icon-texts.d.ts.map +1 -0
  54. package/dist/src/elements/ia-topnav/assets/img/icon-texts.js +19 -0
  55. package/dist/src/elements/ia-topnav/assets/img/icon-texts.js.map +1 -0
  56. package/dist/src/elements/ia-topnav/assets/img/icon-upload-unpadded.d.ts +3 -0
  57. package/dist/src/elements/ia-topnav/assets/img/icon-upload-unpadded.d.ts.map +1 -0
  58. package/dist/src/elements/ia-topnav/assets/img/icon-upload-unpadded.js +19 -0
  59. package/dist/src/elements/ia-topnav/assets/img/icon-upload-unpadded.js.map +1 -0
  60. package/dist/src/elements/ia-topnav/assets/img/icon-upload.d.ts +3 -0
  61. package/dist/src/elements/ia-topnav/assets/img/icon-upload.d.ts.map +1 -0
  62. package/dist/src/elements/ia-topnav/assets/img/icon-upload.js +22 -0
  63. package/dist/src/elements/ia-topnav/assets/img/icon-upload.js.map +1 -0
  64. package/dist/src/elements/ia-topnav/assets/img/icon-user.d.ts +3 -0
  65. package/dist/src/elements/ia-topnav/assets/img/icon-user.d.ts.map +1 -0
  66. package/dist/src/elements/ia-topnav/assets/img/icon-user.js +20 -0
  67. package/dist/src/elements/ia-topnav/assets/img/icon-user.js.map +1 -0
  68. package/dist/src/elements/ia-topnav/assets/img/icon-video.d.ts +3 -0
  69. package/dist/src/elements/ia-topnav/assets/img/icon-video.d.ts.map +1 -0
  70. package/dist/src/elements/ia-topnav/assets/img/icon-video.js +20 -0
  71. package/dist/src/elements/ia-topnav/assets/img/icon-video.js.map +1 -0
  72. package/dist/src/elements/ia-topnav/assets/img/icon-web.d.ts +3 -0
  73. package/dist/src/elements/ia-topnav/assets/img/icon-web.d.ts.map +1 -0
  74. package/dist/src/elements/ia-topnav/assets/img/icon-web.js +20 -0
  75. package/dist/src/elements/ia-topnav/assets/img/icon-web.js.map +1 -0
  76. package/dist/src/elements/ia-topnav/assets/img/icons.d.ts +19 -0
  77. package/dist/src/elements/ia-topnav/assets/img/icons.d.ts.map +1 -0
  78. package/dist/src/elements/ia-topnav/assets/img/icons.js +34 -0
  79. package/dist/src/elements/ia-topnav/assets/img/icons.js.map +1 -0
  80. package/dist/src/elements/ia-topnav/assets/img/wayback-logo.d.ts +3 -0
  81. package/dist/src/elements/ia-topnav/assets/img/wayback-logo.d.ts.map +1 -0
  82. package/dist/src/elements/ia-topnav/assets/img/wayback-logo.js +22 -0
  83. package/dist/src/elements/ia-topnav/assets/img/wayback-logo.js.map +1 -0
  84. package/dist/src/elements/ia-topnav/assets/img/wordmark-stacked.d.ts +3 -0
  85. package/dist/src/elements/ia-topnav/assets/img/wordmark-stacked.d.ts.map +1 -0
  86. package/dist/src/elements/ia-topnav/assets/img/wordmark-stacked.js +14 -0
  87. package/dist/src/elements/ia-topnav/assets/img/wordmark-stacked.js.map +1 -0
  88. package/package.json +1 -1
@@ -17,6 +17,7 @@ export declare class IAReviews extends LitElement {
17
17
  reviewsFrozen: boolean;
18
18
  canDelete: boolean;
19
19
  displayReviewsByDefault: boolean;
20
+ maxInitialReviews: number;
20
21
  maxSubjectLength?: number;
21
22
  maxBodyLength?: number;
22
23
  baseHost: string;
@@ -56,13 +57,15 @@ export declare class IAReviews extends LitElement {
56
57
  fetchHandler?: FetchHandlerInterface;
57
58
  private activeReviewService?;
58
59
  displayReviewForm: boolean;
59
- private displayReviews;
60
+ private showAllReviews;
60
61
  private filteredReviews;
61
62
  private currentReview?;
62
63
  private reviewsCount;
63
64
  private recaptchaActivated;
65
+ private listedReviews?;
64
66
  render(): HTMLTemplateResult;
65
67
  protected willUpdate(changed: PropertyValues): void;
68
+ private get visibleReviews();
66
69
  /**
67
70
  * The injected service if there is one. Otherwise one built from the deprecated props if any
68
71
  * were given, and failing that a bare service that renders and opens the form but carries no
@@ -71,17 +74,22 @@ export declare class IAReviews extends LitElement {
71
74
  private buildReviewService;
72
75
  private get reviewsDisabledTemplate();
73
76
  private get noReviewsMsgTemplate();
74
- private get displayReviewsMsgTemplate();
77
+ private get showMoreButtonTemplate();
75
78
  /**
76
79
  * Renders the review form, passing along all necessary properties; this will also render
77
80
  * the patron's own review if applicable and/or following submission.
78
81
  */
79
82
  private get editableCurrentReviewTemplate();
80
- /** Sorts the reviews and splits the patron's own review out of the reviews array */
83
+ /**
84
+ * Sorts the reviews and splits the patron's own review out of the reviews array.
85
+ * Only their first review is kept; any others they have are dropped from the list.
86
+ */
81
87
  private sortFilterReviews;
82
88
  /** Sorts reviews by create date for render */
83
89
  private sortReviews;
84
90
  private renderReview;
91
+ /** Reveals the rest of the reviews */
92
+ private showMoreReviews;
85
93
  /** Prepare the review form for adding or editing */
86
94
  private addEditReview;
87
95
  /** Handles successful review submission */
@@ -1 +1 @@
1
- {"version":3,"file":"ia-reviews.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-reviews/ia-reviews.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEd,kBAAkB,EAClB,UAAU,EAEV,cAAc,EACf,MAAM,KAAK,CAAC;AAKb,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAMvD,OAAO,aAAa,CAAC;AACrB,OAAO,kBAAkB,CAAC;AAE1B;;GAEG;AACH,qBAEa,SAAU,SAAQ,UAAU;IACvC,yCAAyC;IAEb,UAAU,CAAC,EAAE,MAAM,CAAC;IAGrB,OAAO,EAAE,MAAM,EAAE,CAAM;IAGrB,eAAe,UAAS;IAGxB,aAAa,UAAS;IAGtB,SAAS,UA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 'lit/decorators.js';
3
+ import { property, queryAll, state } from 'lit/decorators.js';
4
4
  import { customElement } from '../../util/custom-element.js';
5
5
  import { localized, msg, str } from '@lit/localize';
6
6
  import '../../elements/ia-button/ia-button.js';
@@ -22,8 +22,10 @@ let IAReviews = class IAReviews extends LitElement {
22
22
  this.reviewsFrozen = false;
23
23
  /* Whether the person viewing the reviews section has the power to delete reviews */
24
24
  this.canDelete = false;
25
- /* Whether we should bypass the show/hide and more/less toggles */
25
+ /* Whether we should bypass the show-more and more/less toggles */
26
26
  this.displayReviewsByDefault = false;
27
+ /* How many reviews to show before the rest go behind a "Show more" button */
28
+ this.maxInitialReviews = 5;
27
29
  /* Base for URLs. Also used for the reviewer profile links. */
28
30
  this.baseHost = 'https://archive.org';
29
31
  /* Optionally avoid using recaptcha for the form */
@@ -32,8 +34,8 @@ let IAReviews = class IAReviews extends LitElement {
32
34
  this.reviewAddEditRequested = false;
33
35
  /* Whether to display the review form or the editable review */
34
36
  this.displayReviewForm = false;
35
- /* Whether to display the existing reviews */
36
- this.displayReviews = false;
37
+ /* Whether the patron has asked to see the reviews past the initial few */
38
+ this.showAllReviews = false;
37
39
  /* The sorted and filtered reviews to render */
38
40
  this.filteredReviews = [];
39
41
  /* The number of reviews */
@@ -46,8 +48,6 @@ let IAReviews = class IAReviews extends LitElement {
46
48
  return this.reviewsDisabledTemplate;
47
49
  if (this.reviewsCount === 0 && !this.displayReviewForm)
48
50
  return this.noReviewsMsgTemplate;
49
- if (!this.displayReviews)
50
- return this.displayReviewsMsgTemplate;
51
51
  return html `
52
52
  <div class="reviews-list">
53
53
  ${this.reviewsFrozen
@@ -56,9 +56,8 @@ let IAReviews = class IAReviews extends LitElement {
56
56
  </div>`
57
57
  : nothing}
58
58
  ${this.editableCurrentReviewTemplate}
59
- ${this.filteredReviews.map((review) => review.reviewer_itemname !== this.submitterItemname
60
- ? this.renderReview(review)
61
- : nothing)}
59
+ ${this.visibleReviews.map((review) => this.renderReview(review))}
60
+ ${this.showMoreButtonTemplate}
62
61
  </div>
63
62
  `;
64
63
  }
@@ -78,13 +77,14 @@ let IAReviews = class IAReviews extends LitElement {
78
77
  if (changed.has('displayReviewForm') && this.displayReviewForm === true) {
79
78
  if (!this.bypassRecaptcha && !this.recaptchaActivated)
80
79
  this.recaptchaActivated = true;
81
- this.displayReviews = true;
82
- }
83
- if (changed.has('displayReviewsByDefault') &&
84
- this.displayReviewsByDefault) {
85
- this.displayReviews = true;
86
80
  }
87
81
  }
82
+ /* The reviews to render, capped at maxInitialReviews until the patron asks for more */
83
+ get visibleReviews() {
84
+ if (this.showAllReviews || this.displayReviewsByDefault)
85
+ return this.filteredReviews;
86
+ return this.filteredReviews.slice(0, this.maxInitialReviews);
87
+ }
88
88
  /**
89
89
  * The injected service if there is one. Otherwise one built from the deprecated props if any
90
90
  * were given, and failing that a bare service that renders and opens the form but carries no
@@ -127,24 +127,21 @@ let IAReviews = class IAReviews extends LitElement {
127
127
  </div>
128
128
  `;
129
129
  }
130
- /* Message to display instead of the reviews list if reviews are hidden */
131
- get displayReviewsMsgTemplate() {
132
- const hasOneReview = this.reviewsCount === 1;
130
+ /* Button that reveals the reviews past the initial few */
131
+ get showMoreButtonTemplate() {
132
+ const hiddenCount = this.filteredReviews.length - this.visibleReviews.length;
133
+ if (hiddenCount <= 0)
134
+ return nothing;
133
135
  return html `
134
- <div class="message">
135
- ${hasOneReview
136
- ? msg('There is 1 review for this item.')
137
- : msg(str `There are ${this.reviewsCount} reviews for this item.`)}
138
- <ia-button
139
- mode="link"
140
- class="display-reviews-btn"
141
- @click=${() => (this.displayReviews = true)}
142
- >
143
- ${hasOneReview
144
- ? msg('Display review')
145
- : msg('Display reviews')}</ia-button
146
- >.
147
- </div>
136
+ <ia-button
137
+ mode="link"
138
+ class="show-more-btn"
139
+ @click=${this.showMoreReviews}
140
+ >
141
+ ${hiddenCount === 1
142
+ ? msg('Show 1 more review')
143
+ : msg(str `Show ${hiddenCount} more reviews`)}
144
+ </ia-button>
148
145
  `;
149
146
  }
150
147
  /**
@@ -175,17 +172,20 @@ let IAReviews = class IAReviews extends LitElement {
175
172
  ></ia-review-form>`}
176
173
  </div>`;
177
174
  }
178
- /** Sorts the reviews and splits the patron's own review out of the reviews array */
175
+ /**
176
+ * Sorts the reviews and splits the patron's own review out of the reviews array.
177
+ * Only their first review is kept; any others they have are dropped from the list.
178
+ */
179
179
  sortFilterReviews() {
180
180
  let patronsOwnReview;
181
181
  const filteredReviews = [];
182
182
  this.reviews.forEach((review) => {
183
- if (!patronsOwnReview &&
184
- review.reviewer_itemname === this.submitterItemname) {
183
+ if (review.reviewer_itemname !== this.submitterItemname) {
184
+ filteredReviews.push(review);
185
+ }
186
+ else if (!patronsOwnReview) {
185
187
  patronsOwnReview = review;
186
188
  }
187
- else
188
- filteredReviews.push(review);
189
189
  });
190
190
  this.currentReview = patronsOwnReview;
191
191
  this.filteredReviews = this.sortReviews(filteredReviews);
@@ -210,6 +210,18 @@ let IAReviews = class IAReviews extends LitElement {
210
210
  ?bypassTruncation=${this.displayReviewsByDefault}
211
211
  ></ia-review>`;
212
212
  }
213
+ /** Reveals the rest of the reviews */
214
+ async showMoreReviews() {
215
+ const firstRevealedIndex = this.visibleReviews.length;
216
+ this.showAllReviews = true;
217
+ await this.updateComplete;
218
+ // The button that was clicked is gone, so focus would otherwise fall back to the page.
219
+ // ia-review moves focus inside itself rather than making its host focusable, since a shadow
220
+ // host with a negative tabindex drops everything inside it from the tab order.
221
+ const firstRevealed = this.listedReviews?.[firstRevealedIndex];
222
+ await firstRevealed?.updateComplete;
223
+ firstRevealed?.focus();
224
+ }
213
225
  /** Prepare the review form for adding or editing */
214
226
  addEditReview() {
215
227
  if (!this.bypassRecaptcha)
@@ -228,10 +240,6 @@ let IAReviews = class IAReviews extends LitElement {
228
240
  /** Closes the review form if requested */
229
241
  handleEditCanceled() {
230
242
  this.displayReviewForm = false;
231
- // Display no-reviews message again if no new review was added
232
- if (this.reviewsCount === 0) {
233
- this.displayReviews = false;
234
- }
235
243
  }
236
244
  static get styles() {
237
245
  return [
@@ -286,6 +294,15 @@ let IAReviews = class IAReviews extends LitElement {
286
294
  padding: 0;
287
295
  font-weight: 600;
288
296
  }
297
+
298
+ /* Keeps the click target to the text, rather than the full width of the list */
299
+ .show-more-btn {
300
+ align-self: flex-start;
301
+ }
302
+
303
+ .show-more-btn::part(button) {
304
+ font-weight: 600;
305
+ }
289
306
  `,
290
307
  ];
291
308
  }
@@ -308,6 +325,9 @@ __decorate([
308
325
  __decorate([
309
326
  property({ type: Boolean })
310
327
  ], IAReviews.prototype, "displayReviewsByDefault", void 0);
328
+ __decorate([
329
+ property({ type: Number })
330
+ ], IAReviews.prototype, "maxInitialReviews", void 0);
311
331
  __decorate([
312
332
  property({ type: Number })
313
333
  ], IAReviews.prototype, "maxSubjectLength", void 0);
@@ -355,7 +375,7 @@ __decorate([
355
375
  ], IAReviews.prototype, "displayReviewForm", void 0);
356
376
  __decorate([
357
377
  state()
358
- ], IAReviews.prototype, "displayReviews", void 0);
378
+ ], IAReviews.prototype, "showAllReviews", void 0);
359
379
  __decorate([
360
380
  state()
361
381
  ], IAReviews.prototype, "filteredReviews", void 0);
@@ -368,6 +388,9 @@ __decorate([
368
388
  __decorate([
369
389
  state()
370
390
  ], IAReviews.prototype, "recaptchaActivated", void 0);
391
+ __decorate([
392
+ queryAll('.reviews-list > ia-review')
393
+ ], IAReviews.prototype, "listedReviews", void 0);
371
394
  IAReviews = __decorate([
372
395
  customElement('ia-reviews'),
373
396
  localized()
@@ -1 +1 @@
1
- {"version":3,"file":"ia-reviews.js","sourceRoot":"","sources":["../../../../src/elements/ia-reviews/ia-reviews.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EAEJ,UAAU,EACV,OAAO,GAER,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;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EAAE,MAAM,EAAE,CAAC;mDAA8C;AAG5C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAkC;AAGlC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAgC;AAG9B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yDAAyC;AAQzC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAwC;AAOvC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAgB;AAOf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAuB;AAOtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAsC;AAIzD;IADP,KAAK,EAAE;sDAC6C;AAIrD;IADC,KAAK,EAAE;oDAC2B;AAI3B;IADP,KAAK,EAAE;iDACgC;AAIhC;IADP,KAAK,EAAE;kDAC+B;AAI/B;IADP,KAAK,EAAE;gDACuB;AAIvB;IADP,KAAK,EAAE;+CACyB;AAIzB;IADP,KAAK,EAAE;qDACoC;AAxGjC,SAAS;IAFrB,aAAa,CAAC,YAAY,CAAC;IAC3B,SAAS,EAAE;GACC,SAAS,CAgYrB","sourcesContent":["import {\n css,\n CSSResultGroup,\n html,\n HTMLTemplateResult,\n LitElement,\n nothing,\n PropertyValues,\n} from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { customElement } from '@src/util/custom-element';\nimport { localized, msg, str } from '@lit/localize';\n\nimport type { Review } from '@internetarchive/metadata-service';\nimport type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';\nimport type { FetchHandlerInterface } from '@internetarchive/fetch-handler';\n\nimport '@src/elements/ia-button/ia-button';\n\nimport type { ReviewServiceInterface } from './models';\nimport { ReviewService } from './review-service';\nimport {\n createLegacyReviewService,\n hasLegacyProps,\n} from './legacy-review-service';\nimport './ia-review';\nimport './ia-review-form';\n\n/**\n * Renders the full IA reviews piece\n */\n@customElement('ia-reviews')\n@localized()\nexport class IAReviews extends LitElement {\n /** GLOBAL/REVIEW-RENDERING PROPERTIES */\n /* The identifier for the item being reviewed */\n @property({ type: String }) identifier?: string;\n\n /* The list of reviews to be rendered */\n @property({ type: Array }) reviews: Review[] = [];\n\n /* Whether reviews are disabled for the item */\n @property({ type: Boolean }) reviewsDisabled = false;\n\n /* Whether reviews are frozen for the item */\n @property({ type: Boolean }) reviewsFrozen = false;\n\n /* Whether the person viewing the reviews section has the power to delete reviews */\n @property({ type: Boolean }) canDelete = false;\n\n /* Whether we should bypass the show/hide and more/less toggles */\n @property({ type: Boolean }) displayReviewsByDefault = false;\n\n /* Maximum allowable length for subject */\n @property({ type: Number }) maxSubjectLength?: number;\n\n /* Maximum allowable length for body */\n @property({ type: Number }) maxBodyLength?: number;\n\n /* Base for URLs. Also used for the reviewer profile links. */\n @property({ type: String }) baseHost = 'https://archive.org';\n\n /** REVIEW FORM PROPERTIES */\n\n /** Form submitter's screenname, if applicable. Defaults to \"Anonymous\". */\n @property({ type: String }) submitterScreenname?: string;\n\n /** Form submitter's itemname, if applicable */\n @property({ type: String }) submitterItemname?: string;\n\n /* Service for activating the recaptcha challenge */\n @property({ type: Object }) recaptchaManager?: RecaptchaManagerInterface;\n\n /* Optionally avoid using recaptcha for the form */\n @property({ type: Boolean }) bypassRecaptcha: boolean = false;\n\n /* An optional error message to be displayed instead of the review form */\n @property({ type: String }) reviewSubmissionError?: string;\n\n /* Whether the add/edit button has been clicked */\n @property({ type: Boolean }) reviewAddEditRequested: boolean = false;\n\n /**\n * Handles the review write and delete requests.\n *\n * Writing and deleting need one, since the service is what carries the CSRF token. Left unset,\n * reviews still render and the form still opens, but a submission reports a generic failure.\n */\n @property({ type: Object }) reviewService?: ReviewServiceInterface;\n\n /**\n * The CSRF token for review writes and deletes.\n *\n * @deprecated Supply a `reviewService` instead. Only read when `reviewService` isn't set.\n */\n @property({ type: String }) token?: string;\n\n /**\n * The path review submissions POST to, relative to `baseHost`.\n *\n * @deprecated Supply a `reviewService` instead. Only read when `reviewService` isn't set.\n */\n @property({ type: String }) endpointPath?: string;\n\n /**\n * The handler review writes and deletes go through.\n *\n * @deprecated Supply a `reviewService` instead. Only read when `reviewService` isn't set.\n */\n @property({ type: Object }) fetchHandler?: FetchHandlerInterface;\n\n /* The service the components actually call, whether injected or built here */\n @state()\n private activeReviewService?: ReviewServiceInterface;\n\n /* Whether to display the review form or the editable review */\n @state()\n displayReviewForm: boolean = false;\n\n /* Whether to display the existing reviews */\n @state()\n private displayReviews: boolean = false;\n\n /* The sorted and filtered reviews to render */\n @state()\n private filteredReviews: Review[] = [];\n\n /* The current version of the review */\n @state()\n private currentReview?: Review;\n\n /* The number of reviews */\n @state()\n private reviewsCount: number = 0;\n\n /* Whether recaptcha has been activated (by clicking the add/edit button) */\n @state()\n private recaptchaActivated: boolean = false;\n\n render() {\n if (this.reviewsDisabled) return this.reviewsDisabledTemplate;\n if (this.reviewsCount === 0 && !this.displayReviewForm)\n return this.noReviewsMsgTemplate;\n if (!this.displayReviews) return this.displayReviewsMsgTemplate;\n\n return html`\n <div class=\"reviews-list\">\n ${this.reviewsFrozen\n ? html`<div class=\"message\">\n ${msg('Reviews can no longer be added to this item.')}\n </div>`\n : nothing}\n ${this.editableCurrentReviewTemplate}\n ${this.filteredReviews.map((review) =>\n review.reviewer_itemname !== this.submitterItemname\n ? this.renderReview(review)\n : nothing,\n )}\n </div>\n `;\n }\n\n protected willUpdate(changed: PropertyValues): void {\n if (\n !this.activeReviewService ||\n changed.has('reviewService') ||\n changed.has('baseHost') ||\n changed.has('token') ||\n changed.has('endpointPath') ||\n changed.has('fetchHandler')\n ) {\n this.activeReviewService = this.buildReviewService();\n }\n\n if (changed.has('reviews') || changed.has('submitterItemname')) {\n this.reviewsCount = this.reviews.length;\n this.sortFilterReviews();\n }\n\n if (changed.has('displayReviewForm') && this.displayReviewForm === true) {\n if (!this.bypassRecaptcha && !this.recaptchaActivated)\n this.recaptchaActivated = true;\n this.displayReviews = true;\n }\n\n if (\n changed.has('displayReviewsByDefault') &&\n this.displayReviewsByDefault\n ) {\n this.displayReviews = true;\n }\n }\n\n /**\n * The injected service if there is one. Otherwise one built from the deprecated props if any\n * were given, and failing that a bare service that renders and opens the form but carries no\n * CSRF token, so a submission through it fails.\n */\n private buildReviewService(): ReviewServiceInterface {\n if (this.reviewService) return this.reviewService;\n\n if (hasLegacyProps(this)) return createLegacyReviewService(this);\n\n return new ReviewService({ baseHost: this.baseHost });\n }\n\n /* Message to display if reviews are disabled */\n private get reviewsDisabledTemplate(): HTMLTemplateResult {\n return html`<div class=\"message\">\n ${msg('Reviews have been disabled for this item.')}\n </div>`;\n }\n\n /* Message to display instead of the reviews list if there are no reviews yet */\n private get noReviewsMsgTemplate(): HTMLTemplateResult {\n if (this.reviewsFrozen)\n return html`\n <div class=\"message\">\n ${msg('Reviews cannot be added to this item.')}\n </div>\n `;\n\n return html`\n <div class=\"message\">\n ${msg('There are no reviews yet.')}\n ${msg(html`\n Be the first one to\n <ia-button\n mode=\"link\"\n class=\"no-reviews-btn\"\n @click=${this.addEditReview}\n >\n write a review</ia-button\n >.\n `)}\n </div>\n `;\n }\n\n /* Message to display instead of the reviews list if reviews are hidden */\n private get displayReviewsMsgTemplate(): HTMLTemplateResult {\n const hasOneReview = this.reviewsCount === 1;\n\n return html`\n <div class=\"message\">\n ${hasOneReview\n ? msg('There is 1 review for this item.')\n : msg(str`There are ${this.reviewsCount} reviews for this item.`)}\n <ia-button\n mode=\"link\"\n class=\"display-reviews-btn\"\n @click=${() => (this.displayReviews = true)}\n >\n ${hasOneReview\n ? msg('Display review')\n : msg('Display reviews')}</ia-button\n >.\n </div>\n `;\n }\n\n /**\n * Renders the review form, passing along all necessary properties; this will also render\n * the patron's own review if applicable and/or following submission.\n */\n private get editableCurrentReviewTemplate():\n | HTMLTemplateResult\n | typeof nothing {\n if (!this.displayReviewForm && !this.currentReview) return nothing;\n\n return html`<div class=\"own-review-container\">\n ${!this.displayReviewForm\n ? this.renderReview(this.currentReview)\n : html`<ia-review-form\n .identifier=${this.identifier}\n .oldReview=${this.currentReview}\n .submitterItemname=${this.submitterItemname}\n .submitterScreenname=${this.submitterScreenname}\n .maxSubjectLength=${this.maxSubjectLength}\n .maxBodyLength=${this.maxBodyLength}\n .unrecoverableError=${this.reviewSubmissionError}\n .reviewService=${this.activeReviewService}\n .recaptchaManager=${this.recaptchaActivated\n ? this.recaptchaManager\n : undefined}\n ?bypassRecaptcha=${this.bypassRecaptcha}\n @reviewUpdated=${this.handleReviewUpdate}\n @reviewEditCanceled=${this.handleEditCanceled}\n ></ia-review-form>`}\n </div>`;\n }\n\n /** Sorts the reviews and splits the patron's own review out of the reviews array */\n private sortFilterReviews(): void {\n let patronsOwnReview: Review | undefined;\n const filteredReviews: Review[] = [];\n\n this.reviews.forEach((review) => {\n if (\n !patronsOwnReview &&\n review.reviewer_itemname === this.submitterItemname\n ) {\n patronsOwnReview = review;\n } else filteredReviews.push(review);\n });\n\n this.currentReview = patronsOwnReview;\n this.filteredReviews = this.sortReviews(filteredReviews);\n }\n\n /** Sorts reviews by create date for render */\n private sortReviews(reviews: Review[]): Review[] {\n const sortedReviews = [...reviews].sort((a, b) =>\n a.createdate && b.createdate\n ? new Date(b.createdate).getTime() - new Date(a.createdate).getTime()\n : 0,\n );\n\n return sortedReviews;\n }\n\n /* Renders the given review, using the ia-review component */\n private renderReview(review?: Review): HTMLTemplateResult | typeof nothing {\n if (!review) return nothing;\n\n return html`<ia-review\n .review=${review}\n .identifier=${this.identifier}\n .baseHost=${this.baseHost}\n .reviewService=${this.activeReviewService}\n ?canDelete=${this.canDelete}\n ?bypassTruncation=${this.displayReviewsByDefault}\n ></ia-review>`;\n }\n\n /** Prepare the review form for adding or editing */\n private addEditReview(): void {\n if (!this.bypassRecaptcha) this.recaptchaActivated = true;\n this.displayReviewForm = true;\n }\n\n /** Handles successful review submission */\n private handleReviewUpdate(e: CustomEvent<Review>): void {\n if (!this.currentReview && e.detail) {\n this.dispatchEvent(new CustomEvent<void>('newReviewAdded'));\n this.reviewsCount += 1;\n }\n this.currentReview = e.detail;\n this.displayReviewForm = false;\n }\n\n /** Closes the review form if requested */\n private handleEditCanceled(): void {\n this.displayReviewForm = false;\n\n // Display no-reviews message again if no new review was added\n if (this.reviewsCount === 0) {\n this.displayReviews = false;\n }\n }\n\n static get styles(): CSSResultGroup {\n return [\n css`\n :host {\n font-family: var(\n --ia-font-stack,\n 'Helvetica Neue',\n Helvetica,\n Arial,\n sans-serif\n );\n\n color: var(--ia-text-color, #2c2c2c);\n }\n\n .reviews-list {\n display: flex;\n flex-direction: column;\n gap: 2rem;\n width: 100%;\n }\n\n .own-review-container {\n --error-color: var(--container-error-color, #ea0202);\n --link-color: var(--container-link-color, #4f65f5);\n --container-error-color: #ea0202;\n --container-link-color: #4f65f5;\n --container-bg-color: #fbfbfd;\n --container-border-color: #999999;\n\n border: 2px solid var(--container-border-color, #999999);\n border-radius: 5px;\n background-color: var(--container-bg-color, #fbfbfd);\n padding: 10px;\n }\n\n .message {\n font-weight: 200;\n }\n\n .message ia-button {\n display: inline;\n vertical-align: baseline;\n }\n\n /* The button inside ia-button is a flex box, which would break these\n out of the sentence they sit in. */\n .message ia-button::part(button) {\n display: inline;\n min-height: 0;\n padding: 0;\n font-weight: 600;\n }\n `,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"ia-reviews.js","sourceRoot":"","sources":["../../../../src/elements/ia-reviews/ia-reviews.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EAEJ,UAAU,EACV,OAAO,GAER,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,SAAS,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{ property, queryAll, state } from 'lit/decorators.js';\nimport { customElement } from '@src/util/custom-element';\nimport { localized, msg, str } from '@lit/localize';\n\nimport type { Review } from '@internetarchive/metadata-service';\nimport type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';\nimport type { FetchHandlerInterface } from '@internetarchive/fetch-handler';\n\nimport '@src/elements/ia-button/ia-button';\n\nimport type { ReviewServiceInterface } from './models';\nimport type { IAReview } from './ia-review';\nimport { ReviewService } from './review-service';\nimport {\n createLegacyReviewService,\n hasLegacyProps,\n} from './legacy-review-service';\nimport './ia-review';\nimport './ia-review-form';\n\n/**\n * Renders the full IA reviews piece\n */\n@customElement('ia-reviews')\n@localized()\nexport class IAReviews extends LitElement {\n /** GLOBAL/REVIEW-RENDERING PROPERTIES */\n /* The identifier for the item being reviewed */\n @property({ type: String }) identifier?: string;\n\n /* The list of reviews to be rendered */\n @property({ type: Array }) reviews: Review[] = [];\n\n /* Whether reviews are disabled for the item */\n @property({ type: Boolean }) reviewsDisabled = false;\n\n /* Whether reviews are frozen for the item */\n @property({ type: Boolean }) reviewsFrozen = false;\n\n /* Whether the person viewing the reviews section has the power to delete reviews */\n @property({ type: Boolean }) canDelete = false;\n\n /* Whether we should bypass the show-more and more/less toggles */\n @property({ type: Boolean }) displayReviewsByDefault = false;\n\n /* How many reviews to show before the rest go behind a \"Show more\" button */\n @property({ type: Number }) maxInitialReviews = 5;\n\n /* Maximum allowable length for subject */\n @property({ type: Number }) maxSubjectLength?: number;\n\n /* Maximum allowable length for body */\n @property({ type: Number }) maxBodyLength?: number;\n\n /* Base for URLs. Also used for the reviewer profile links. */\n @property({ type: String }) baseHost = 'https://archive.org';\n\n /** REVIEW FORM PROPERTIES */\n\n /** Form submitter's screenname, if applicable. Defaults to \"Anonymous\". */\n @property({ type: String }) submitterScreenname?: string;\n\n /** Form submitter's itemname, if applicable */\n @property({ type: String }) submitterItemname?: string;\n\n /* Service for activating the recaptcha challenge */\n @property({ type: Object }) recaptchaManager?: RecaptchaManagerInterface;\n\n /* Optionally avoid using recaptcha for the form */\n @property({ type: Boolean }) bypassRecaptcha: boolean = false;\n\n /* An optional error message to be displayed instead of the review form */\n @property({ type: String }) reviewSubmissionError?: string;\n\n /* Whether the add/edit button has been clicked */\n @property({ type: Boolean }) reviewAddEditRequested: boolean = false;\n\n /**\n * Handles the review write and delete requests.\n *\n * Writing and deleting need one, since the service is what carries the CSRF token. Left unset,\n * reviews still render and the form still opens, but a submission reports a generic failure.\n */\n @property({ type: Object }) reviewService?: ReviewServiceInterface;\n\n /**\n * The CSRF token for review writes and deletes.\n *\n * @deprecated Supply a `reviewService` instead. Only read when `reviewService` isn't set.\n */\n @property({ type: String }) token?: string;\n\n /**\n * The path review submissions POST to, relative to `baseHost`.\n *\n * @deprecated Supply a `reviewService` instead. Only read when `reviewService` isn't set.\n */\n @property({ type: String }) endpointPath?: string;\n\n /**\n * The handler review writes and deletes go through.\n *\n * @deprecated Supply a `reviewService` instead. Only read when `reviewService` isn't set.\n */\n @property({ type: Object }) fetchHandler?: FetchHandlerInterface;\n\n /* The service the components actually call, whether injected or built here */\n @state()\n private activeReviewService?: ReviewServiceInterface;\n\n /* Whether to display the review form or the editable review */\n @state()\n displayReviewForm: boolean = false;\n\n /* Whether the patron has asked to see the reviews past the initial few */\n @state()\n private showAllReviews: boolean = false;\n\n /* The sorted and filtered reviews to render */\n @state()\n private filteredReviews: Review[] = [];\n\n /* The current version of the review */\n @state()\n private currentReview?: Review;\n\n /* The number of reviews */\n @state()\n private reviewsCount: number = 0;\n\n /* Whether recaptcha has been activated (by clicking the add/edit button) */\n @state()\n private recaptchaActivated: boolean = false;\n\n /* The reviews in the list, not counting the patron's own */\n @queryAll('.reviews-list > ia-review')\n private listedReviews?: NodeListOf<IAReview>;\n\n render() {\n if (this.reviewsDisabled) return this.reviewsDisabledTemplate;\n if (this.reviewsCount === 0 && !this.displayReviewForm)\n return this.noReviewsMsgTemplate;\n\n return html`\n <div class=\"reviews-list\">\n ${this.reviewsFrozen\n ? html`<div class=\"message\">\n ${msg('Reviews can no longer be added to this item.')}\n </div>`\n : nothing}\n ${this.editableCurrentReviewTemplate}\n ${this.visibleReviews.map((review) => this.renderReview(review))}\n ${this.showMoreButtonTemplate}\n </div>\n `;\n }\n\n protected willUpdate(changed: PropertyValues): void {\n if (\n !this.activeReviewService ||\n changed.has('reviewService') ||\n changed.has('baseHost') ||\n changed.has('token') ||\n changed.has('endpointPath') ||\n changed.has('fetchHandler')\n ) {\n this.activeReviewService = this.buildReviewService();\n }\n\n if (changed.has('reviews') || changed.has('submitterItemname')) {\n this.reviewsCount = this.reviews.length;\n this.sortFilterReviews();\n }\n\n if (changed.has('displayReviewForm') && this.displayReviewForm === true) {\n if (!this.bypassRecaptcha && !this.recaptchaActivated)\n this.recaptchaActivated = true;\n }\n }\n\n /* The reviews to render, capped at maxInitialReviews until the patron asks for more */\n private get visibleReviews(): Review[] {\n if (this.showAllReviews || this.displayReviewsByDefault)\n return this.filteredReviews;\n\n return this.filteredReviews.slice(0, this.maxInitialReviews);\n }\n\n /**\n * The injected service if there is one. Otherwise one built from the deprecated props if any\n * were given, and failing that a bare service that renders and opens the form but carries no\n * CSRF token, so a submission through it fails.\n */\n private buildReviewService(): ReviewServiceInterface {\n if (this.reviewService) return this.reviewService;\n\n if (hasLegacyProps(this)) return createLegacyReviewService(this);\n\n return new ReviewService({ baseHost: this.baseHost });\n }\n\n /* Message to display if reviews are disabled */\n private get reviewsDisabledTemplate(): HTMLTemplateResult {\n return html`<div class=\"message\">\n ${msg('Reviews have been disabled for this item.')}\n </div>`;\n }\n\n /* Message to display instead of the reviews list if there are no reviews yet */\n private get noReviewsMsgTemplate(): HTMLTemplateResult {\n if (this.reviewsFrozen)\n return html`\n <div class=\"message\">\n ${msg('Reviews cannot be added to this item.')}\n </div>\n `;\n\n return html`\n <div class=\"message\">\n ${msg('There are no reviews yet.')}\n ${msg(html`\n Be the first one to\n <ia-button\n mode=\"link\"\n class=\"no-reviews-btn\"\n @click=${this.addEditReview}\n >\n write a review</ia-button\n >.\n `)}\n </div>\n `;\n }\n\n /* Button that reveals the reviews past the initial few */\n private get showMoreButtonTemplate(): HTMLTemplateResult | typeof nothing {\n const hiddenCount =\n this.filteredReviews.length - this.visibleReviews.length;\n if (hiddenCount <= 0) return nothing;\n\n return html`\n <ia-button\n mode=\"link\"\n class=\"show-more-btn\"\n @click=${this.showMoreReviews}\n >\n ${hiddenCount === 1\n ? msg('Show 1 more review')\n : msg(str`Show ${hiddenCount} more reviews`)}\n </ia-button>\n `;\n }\n\n /**\n * Renders the review form, passing along all necessary properties; this will also render\n * the patron's own review if applicable and/or following submission.\n */\n private get editableCurrentReviewTemplate():\n | HTMLTemplateResult\n | typeof nothing {\n if (!this.displayReviewForm && !this.currentReview) return nothing;\n\n return html`<div class=\"own-review-container\">\n ${!this.displayReviewForm\n ? this.renderReview(this.currentReview)\n : html`<ia-review-form\n .identifier=${this.identifier}\n .oldReview=${this.currentReview}\n .submitterItemname=${this.submitterItemname}\n .submitterScreenname=${this.submitterScreenname}\n .maxSubjectLength=${this.maxSubjectLength}\n .maxBodyLength=${this.maxBodyLength}\n .unrecoverableError=${this.reviewSubmissionError}\n .reviewService=${this.activeReviewService}\n .recaptchaManager=${this.recaptchaActivated\n ? this.recaptchaManager\n : undefined}\n ?bypassRecaptcha=${this.bypassRecaptcha}\n @reviewUpdated=${this.handleReviewUpdate}\n @reviewEditCanceled=${this.handleEditCanceled}\n ></ia-review-form>`}\n </div>`;\n }\n\n /**\n * Sorts the reviews and splits the patron's own review out of the reviews array.\n * Only their first review is kept; any others they have are dropped from the list.\n */\n private sortFilterReviews(): void {\n let patronsOwnReview: Review | undefined;\n const filteredReviews: Review[] = [];\n\n this.reviews.forEach((review) => {\n if (review.reviewer_itemname !== this.submitterItemname) {\n filteredReviews.push(review);\n } else if (!patronsOwnReview) {\n patronsOwnReview = review;\n }\n });\n\n this.currentReview = patronsOwnReview;\n this.filteredReviews = this.sortReviews(filteredReviews);\n }\n\n /** Sorts reviews by create date for render */\n private sortReviews(reviews: Review[]): Review[] {\n const sortedReviews = [...reviews].sort((a, b) =>\n a.createdate && b.createdate\n ? new Date(b.createdate).getTime() - new Date(a.createdate).getTime()\n : 0,\n );\n\n return sortedReviews;\n }\n\n /* Renders the given review, using the ia-review component */\n private renderReview(review?: Review): HTMLTemplateResult | typeof nothing {\n if (!review) return nothing;\n\n return html`<ia-review\n .review=${review}\n .identifier=${this.identifier}\n .baseHost=${this.baseHost}\n .reviewService=${this.activeReviewService}\n ?canDelete=${this.canDelete}\n ?bypassTruncation=${this.displayReviewsByDefault}\n ></ia-review>`;\n }\n\n /** Reveals the rest of the reviews */\n private async showMoreReviews(): Promise<void> {\n const firstRevealedIndex = this.visibleReviews.length;\n this.showAllReviews = true;\n await this.updateComplete;\n\n // The button that was clicked is gone, so focus would otherwise fall back to the page.\n // ia-review moves focus inside itself rather than making its host focusable, since a shadow\n // host with a negative tabindex drops everything inside it from the tab order.\n const firstRevealed = this.listedReviews?.[firstRevealedIndex];\n await firstRevealed?.updateComplete;\n firstRevealed?.focus();\n }\n\n /** Prepare the review form for adding or editing */\n private addEditReview(): void {\n if (!this.bypassRecaptcha) this.recaptchaActivated = true;\n this.displayReviewForm = true;\n }\n\n /** Handles successful review submission */\n private handleReviewUpdate(e: CustomEvent<Review>): void {\n if (!this.currentReview && e.detail) {\n this.dispatchEvent(new CustomEvent<void>('newReviewAdded'));\n this.reviewsCount += 1;\n }\n this.currentReview = e.detail;\n this.displayReviewForm = false;\n }\n\n /** Closes the review form if requested */\n private handleEditCanceled(): void {\n this.displayReviewForm = false;\n }\n\n static get styles(): CSSResultGroup {\n return [\n css`\n :host {\n font-family: var(\n --ia-font-stack,\n 'Helvetica Neue',\n Helvetica,\n Arial,\n sans-serif\n );\n\n color: var(--ia-text-color, #2c2c2c);\n }\n\n .reviews-list {\n display: flex;\n flex-direction: column;\n gap: 2rem;\n width: 100%;\n }\n\n .own-review-container {\n --error-color: var(--container-error-color, #ea0202);\n --link-color: var(--container-link-color, #4f65f5);\n --container-error-color: #ea0202;\n --container-link-color: #4f65f5;\n --container-bg-color: #fbfbfd;\n --container-border-color: #999999;\n\n border: 2px solid var(--container-border-color, #999999);\n border-radius: 5px;\n background-color: var(--container-bg-color, #fbfbfd);\n padding: 10px;\n }\n\n .message {\n font-weight: 200;\n }\n\n .message ia-button {\n display: inline;\n vertical-align: baseline;\n }\n\n /* The button inside ia-button is a flex box, which would break these\n out of the sentence they sit in. */\n .message ia-button::part(button) {\n display: inline;\n min-height: 0;\n padding: 0;\n font-weight: 600;\n }\n\n /* Keeps the click target to the text, rather than the full width of the list */\n .show-more-btn {\n align-self: flex-start;\n }\n\n .show-more-btn::part(button) {\n font-weight: 600;\n }\n `,\n ];\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"legacy-review-service.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-reviews/legacy-review-service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,KAAK,EAEV,sBAAsB,EAGvB,MAAM,UAAU,CAAC;AAElB,uFAAuF;AACvF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAEhE;AAqFD,uEAAuE;AACvE,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iBAAiB,GACvB,sBAAsB,CAExB"}
1
+ {"version":3,"file":"legacy-review-service.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-reviews/legacy-review-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,KAAK,EAEV,sBAAsB,EAGvB,MAAM,UAAU,CAAC;AAElB,uFAAuF;AACvF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAEhE;AAiFD,uEAAuE;AACvE,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iBAAiB,GACvB,sBAAsB,CAExB"}
@@ -1,4 +1,3 @@
1
- import { msg } from '@lit/localize';
2
1
  import { IaFetchHandler } from '@internetarchive/fetch-handler';
3
2
  /** Whether any of the deprecated props were given */
4
3
  export function hasLegacyProps(props) {
@@ -29,7 +28,8 @@ class LegacyReviewService {
29
28
  body.append('field_reviewtitle', submission.title);
30
29
  body.append('field_reviewbody', submission.body);
31
30
  body.append('field_reviewtoken', this.token);
32
- body.append('identifier', submission.identifier);
31
+ if (submission.identifier)
32
+ body.append('identifier', submission.identifier);
33
33
  body.append('submitter', 'review-form');
34
34
  try {
35
35
  const result = await this.fetchHandler.fetchApiResponse(this.submitUrl, {
@@ -39,11 +39,11 @@ class LegacyReviewService {
39
39
  });
40
40
  if (result?.success === true)
41
41
  return { success: true };
42
- return { success: false, error: result?.error ?? this.genericError };
42
+ return { success: false, error: result?.error };
43
43
  }
44
44
  catch (e) {
45
45
  console.error('Review request failed', e);
46
- return { success: false, error: this.genericError };
46
+ return { success: false };
47
47
  }
48
48
  }
49
49
  /** @inheritdoc */
@@ -64,12 +64,9 @@ class LegacyReviewService {
64
64
  }
65
65
  catch (e) {
66
66
  console.error('Review request failed', e);
67
- return { success: false, error: this.genericError };
67
+ return { success: false };
68
68
  }
69
69
  }
70
- get genericError() {
71
- return msg('Sorry, something went wrong. Please try again later.');
72
- }
73
70
  }
74
71
  /** Builds the service for a host still passing the deprecated props */
75
72
  export function createLegacyReviewService(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"legacy-review-service.js","sourceRoot":"","sources":["../../../../src/elements/ia-reviews/legacy-review-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAkBhE,qDAAqD;AACrD,MAAM,UAAU,cAAc,CAAC,KAAwB;IACrD,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,mBAAmB;IASvB,YAAY,KAAwB;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,YAAY,IAAI,mBAAmB,EAAE,CAAC;QACjF,IAAI,CAAC,SAAS,GAAG,GAAG,KAAK,CAAC,QAAQ,mBAAmB,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,IAAI,IAAI,cAAc,EAAE,CAAC;IACjE,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,YAAY,CAChB,UAA4B;QAE5B,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC;QACnC,IAAI,UAAU,CAAC,cAAc,EAAE,CAAC;YAC9B,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,CA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S,IAAI,MAAM,EAAE,EAAE;gBAC1D,MAAM,EAAE,MAAM;aACf,CAAC,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YACvE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC;YAC1C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;QACtD,CAAC;IACH,CAAC;IAED,IAAY,YAAY;QACtB,OAAO,GAAG,CAAC,sDAAsD,CAAC,CAAC;IACrE,CAAC;CACF;AAED,uEAAuE;AACvE,MAAM,UAAU,yBAAyB,CACvC,KAAwB;IAExB,OAAO,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { msg } from '@lit/localize';\nimport { IaFetchHandler } from '@internetarchive/fetch-handler';\nimport type { FetchHandlerInterface } from '@internetarchive/fetch-handler';\n\nimport type {\n ReviewDeletion,\n ReviewServiceInterface,\n ReviewServiceResult,\n ReviewSubmission,\n} from './models';\n\n/** The deprecated `token`, `endpointPath` and `fetchHandler` props, plus `baseHost` */\nexport type LegacyReviewProps = {\n token?: string;\n endpointPath?: string;\n fetchHandler?: FetchHandlerInterface;\n baseHost: string;\n};\n\n/** Whether any of the deprecated props were given */\nexport function hasLegacyProps(props: LegacyReviewProps): boolean {\n return !!(props.token || props.endpointPath || props.fetchHandler);\n}\n\n/**\n * Review writes and deletes for a host that passes `token`, `endpointPath` and `fetchHandler`.\n *\n * The requests carry the CSRF token the way the backend's review endpoints read it today: a\n * `field_reviewtoken` form field on a submission and a `csrf_token` query parameter on a\n * delete. No `X-CSRF-Token` header is sent, since a cross-origin `baseHost` would need to\n * allow-list it.\n */\nclass LegacyReviewService implements ReviewServiceInterface {\n private token: string;\n\n private submitUrl: string;\n\n private deleteUrl: string;\n\n private fetchHandler: FetchHandlerInterface;\n\n constructor(props: LegacyReviewProps) {\n this.token = props.token ?? '';\n this.submitUrl = `${props.baseHost}${props.endpointPath ?? '/write-review.php'}`;\n this.deleteUrl = `${props.baseHost}/edit-reviews.php`;\n this.fetchHandler = props.fetchHandler ?? new IaFetchHandler();\n }\n\n /** @inheritdoc */\n async submitReview(\n submission: ReviewSubmission,\n ): Promise<ReviewServiceResult> {\n const body = new URLSearchParams();\n if (submission.recaptchaToken) {\n body.append('g-recaptcha-response', submission.recaptchaToken);\n }\n body.append('field_stars', submission.stars ?? '0');\n body.append('field_reviewtitle', submission.title);\n body.append('field_reviewbody', submission.body);\n body.append('field_reviewtoken', this.token);\n body.append('identifier', submission.identifier);\n body.append('submitter', 'review-form');\n\n try {\n const result = await this.fetchHandler.fetchApiResponse<{\n success?: boolean;\n error?: string;\n }>(this.submitUrl, {\n method: 'POST',\n includeCredentials: true,\n body,\n });\n\n if (result?.success === true) return { success: true };\n return { success: false, error: result?.error ?? this.genericError };\n } catch (e) {\n console.error('Review request failed', e);\n return { success: false, error: this.genericError };\n }\n }\n\n /** @inheritdoc */\n async deleteReview(deletion: ReviewDeletion): Promise<ReviewServiceResult> {\n const params = new URLSearchParams({\n identifier: deletion.identifier,\n deleteReviewer: deletion.reviewer,\n deleteReviewerItemname: deletion.reviewerItemname ?? '',\n csrf_token: this.token,\n });\n\n try {\n const response = await fetch(`${this.deleteUrl}?${params}`, {\n method: 'POST',\n });\n if (!response.ok) throw new Error(`Delete failed: ${response.status}`);\n return { success: true };\n } catch (e) {\n console.error('Review request failed', e);\n return { success: false, error: this.genericError };\n }\n }\n\n private get genericError(): string {\n return msg('Sorry, something went wrong. Please try again later.');\n }\n}\n\n/** Builds the service for a host still passing the deprecated props */\nexport function createLegacyReviewService(\n props: LegacyReviewProps,\n): ReviewServiceInterface {\n return new LegacyReviewService(props);\n}\n"]}
1
+ {"version":3,"file":"legacy-review-service.js","sourceRoot":"","sources":["../../../../src/elements/ia-reviews/legacy-review-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAkBhE,qDAAqD;AACrD,MAAM,UAAU,cAAc,CAAC,KAAwB;IACrD,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,mBAAmB;IASvB,YAAY,KAAwB;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,YAAY,IAAI,mBAAmB,EAAE,CAAC;QACjF,IAAI,CAAC,SAAS,GAAG,GAAG,KAAK,CAAC,QAAQ,mBAAmB,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,IAAI,IAAI,cAAc,EAAE,CAAC;IACjE,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,YAAY,CAChB,UAA4B;QAE5B,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC;QACnC,IAAI,UAAU,CAAC,cAAc,EAAE,CAAC;YAC9B,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,IAA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,kBAAkB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YACvE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC;YAC1C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AAED,uEAAuE;AACvE,MAAM,UAAU,yBAAyB,CACvC,KAAwB;IAExB,OAAO,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { IaFetchHandler } from '@internetarchive/fetch-handler';\nimport type { FetchHandlerInterface } from '@internetarchive/fetch-handler';\n\nimport type {\n ReviewDeletion,\n ReviewServiceInterface,\n ReviewServiceResult,\n ReviewSubmission,\n} from './models';\n\n/** The deprecated `token`, `endpointPath` and `fetchHandler` props, plus `baseHost` */\nexport type LegacyReviewProps = {\n token?: string;\n endpointPath?: string;\n fetchHandler?: FetchHandlerInterface;\n baseHost: string;\n};\n\n/** Whether any of the deprecated props were given */\nexport function hasLegacyProps(props: LegacyReviewProps): boolean {\n return !!(props.token || props.endpointPath || props.fetchHandler);\n}\n\n/**\n * Review writes and deletes for a host that passes `token`, `endpointPath` and `fetchHandler`.\n *\n * The requests carry the CSRF token the way the backend's review endpoints read it today: a\n * `field_reviewtoken` form field on a submission and a `csrf_token` query parameter on a\n * delete. No `X-CSRF-Token` header is sent, since a cross-origin `baseHost` would need to\n * allow-list it.\n */\nclass LegacyReviewService implements ReviewServiceInterface {\n private token: string;\n\n private submitUrl: string;\n\n private deleteUrl: string;\n\n private fetchHandler: FetchHandlerInterface;\n\n constructor(props: LegacyReviewProps) {\n this.token = props.token ?? '';\n this.submitUrl = `${props.baseHost}${props.endpointPath ?? '/write-review.php'}`;\n this.deleteUrl = `${props.baseHost}/edit-reviews.php`;\n this.fetchHandler = props.fetchHandler ?? new IaFetchHandler();\n }\n\n /** @inheritdoc */\n async submitReview(\n submission: ReviewSubmission,\n ): Promise<ReviewServiceResult> {\n const body = new URLSearchParams();\n if (submission.recaptchaToken) {\n body.append('g-recaptcha-response', submission.recaptchaToken);\n }\n body.append('field_stars', submission.stars ?? '0');\n body.append('field_reviewtitle', submission.title);\n body.append('field_reviewbody', submission.body);\n body.append('field_reviewtoken', this.token);\n if (submission.identifier) body.append('identifier', submission.identifier);\n body.append('submitter', 'review-form');\n\n try {\n const result = await this.fetchHandler.fetchApiResponse<{\n success?: boolean;\n error?: string;\n }>(this.submitUrl, {\n method: 'POST',\n includeCredentials: true,\n body,\n });\n\n if (result?.success === true) return { success: true };\n return { success: false, error: result?.error };\n } catch (e) {\n console.error('Review request failed', e);\n return { success: false };\n }\n }\n\n /** @inheritdoc */\n async deleteReview(deletion: ReviewDeletion): Promise<ReviewServiceResult> {\n const params = new URLSearchParams({\n identifier: deletion.identifier,\n deleteReviewer: deletion.reviewer,\n deleteReviewerItemname: deletion.reviewerItemname ?? '',\n csrf_token: this.token,\n });\n\n try {\n const response = await fetch(`${this.deleteUrl}?${params}`, {\n method: 'POST',\n });\n if (!response.ok) throw new Error(`Delete failed: ${response.status}`);\n return { success: true };\n } catch (e) {\n console.error('Review request failed', e);\n return { success: false };\n }\n }\n}\n\n/** Builds the service for a host still passing the deprecated props */\nexport function createLegacyReviewService(\n props: LegacyReviewProps,\n): ReviewServiceInterface {\n return new LegacyReviewService(props);\n}\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("lit").TemplateResult<1>;
2
+ export default _default;
3
+ //# sourceMappingURL=icon-audio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-audio.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/ia-topnav/assets/img/icon-audio.ts"],"names":[],"mappings":";AAIA,wBAyBE"}
@@ -0,0 +1,29 @@
1
+ // @deprecated The topnav draws its icons from `@src/icons/topnav-*`. This module stays so imports of this path keep resolving.
2
+ import { html } from 'lit';
3
+ export default html `
4
+ <svg
5
+ width="40px"
6
+ height="40px"
7
+ viewBox="0 0 40 40"
8
+ version="1.1"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ aria-labelledby="audioTitleID audioDescID"
11
+ >
12
+ <title id="audioTitleID">Audio icon</title>
13
+ <desc id="audioDescID">An illustration of an audio speaker.</desc>
14
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
15
+ <g transform="translate(10, 8)" class="fill-color">
16
+ <path
17
+ d="M19.4264564,11.8585048 L19.4264564,20.7200433 C19.4264564,22.3657576 18.8838179,23.2519114 16.8489237,23.2519114 C12.2364969,23.125318 7.75972977,23.125318 3.14730298,23.2519114 C1.24806842,23.2519114 0.569770368,22.492351 0.569770368,20.7200433 L0.569770368,2.74377955 C0.569770368,1.09806526 1.11240881,0.211911416 3.14730298,0.211911416 C7.75972977,0.338504822 12.2364969,0.338504822 16.8489237,0.211911416 C18.7481583,0.211911416 19.4264564,0.971471855 19.4264564,2.74377955 C19.2907967,5.78202131 19.4264564,8.82026306 19.4264564,11.8585048 L19.4264564,11.8585048 Z M10.0659432,2.74377955 C8.16670861,2.74377955 6.67445288,4.13630702 6.67445288,5.90861471 C6.67445288,7.6809224 8.16670861,9.07344988 10.0659432,9.07344988 C11.9651777,9.07344988 13.4574335,7.6809224 13.4574335,5.90861471 C13.4574335,4.13630702 11.8295181,2.74377955 10.0659432,2.74377955 L10.0659432,2.74377955 Z M10.0659432,11.4787246 C7.21709133,11.4787246 5.04653754,13.6308125 5.04653754,16.1626806 C5.04653754,18.8211422 7.35275094,20.8466367 10.0659432,20.8466367 C12.914795,20.8466367 15.0853488,18.6945488 15.0853488,16.1626806 C15.0853488,13.6308125 12.7791354,11.4787246 10.0659432,11.4787246 L10.0659432,11.4787246 Z"
18
+ ></path>
19
+ <ellipse
20
+ cx="10.2016028"
21
+ cy="16.5690777"
22
+ rx="1.35659611"
23
+ ry="1.34075134"
24
+ ></ellipse>
25
+ </g>
26
+ </g>
27
+ </svg>
28
+ `;
29
+ //# sourceMappingURL=icon-audio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-audio.js","sourceRoot":"","sources":["../../../../../../src/elements/ia-topnav/assets/img/icon-audio.ts"],"names":[],"mappings":"AAAA,+HAA+H;AAE/H,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,eAAe,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBlB,CAAC","sourcesContent":["// @deprecated The topnav draws its icons from `@src/icons/topnav-*`. This module stays so imports of this path keep resolving.\n\nimport { html } from 'lit';\n\nexport default html`\n <svg\n width=\"40px\"\n height=\"40px\"\n viewBox=\"0 0 40 40\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"audioTitleID audioDescID\"\n >\n <title id=\"audioTitleID\">Audio icon</title>\n <desc id=\"audioDescID\">An illustration of an audio speaker.</desc>\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g transform=\"translate(10, 8)\" class=\"fill-color\">\n <path\n d=\"M19.4264564,11.8585048 L19.4264564,20.7200433 C19.4264564,22.3657576 18.8838179,23.2519114 16.8489237,23.2519114 C12.2364969,23.125318 7.75972977,23.125318 3.14730298,23.2519114 C1.24806842,23.2519114 0.569770368,22.492351 0.569770368,20.7200433 L0.569770368,2.74377955 C0.569770368,1.09806526 1.11240881,0.211911416 3.14730298,0.211911416 C7.75972977,0.338504822 12.2364969,0.338504822 16.8489237,0.211911416 C18.7481583,0.211911416 19.4264564,0.971471855 19.4264564,2.74377955 C19.2907967,5.78202131 19.4264564,8.82026306 19.4264564,11.8585048 L19.4264564,11.8585048 Z M10.0659432,2.74377955 C8.16670861,2.74377955 6.67445288,4.13630702 6.67445288,5.90861471 C6.67445288,7.6809224 8.16670861,9.07344988 10.0659432,9.07344988 C11.9651777,9.07344988 13.4574335,7.6809224 13.4574335,5.90861471 C13.4574335,4.13630702 11.8295181,2.74377955 10.0659432,2.74377955 L10.0659432,2.74377955 Z M10.0659432,11.4787246 C7.21709133,11.4787246 5.04653754,13.6308125 5.04653754,16.1626806 C5.04653754,18.8211422 7.35275094,20.8466367 10.0659432,20.8466367 C12.914795,20.8466367 15.0853488,18.6945488 15.0853488,16.1626806 C15.0853488,13.6308125 12.7791354,11.4787246 10.0659432,11.4787246 L10.0659432,11.4787246 Z\"\n ></path>\n <ellipse\n cx=\"10.2016028\"\n cy=\"16.5690777\"\n rx=\"1.35659611\"\n ry=\"1.34075134\"\n ></ellipse>\n </g>\n </g>\n </svg>\n`;\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("lit").TemplateResult<1>;
2
+ export default _default;
3
+ //# sourceMappingURL=icon-close.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-close.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/ia-topnav/assets/img/icon-close.ts"],"names":[],"mappings":";AAIA,wBAiBE"}
@@ -0,0 +1,21 @@
1
+ // @deprecated The topnav draws its icons from `@src/icons/topnav-*`. This module stays so imports of this path keep resolving.
2
+ import { html } from 'lit';
3
+ export default html `
4
+ <svg
5
+ width="40"
6
+ height="40"
7
+ viewBox="0 0 40 40"
8
+ version="1.1"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ aria-labelledby="closeTitleID closeDescID"
11
+ >
12
+ <title id="closeTitleID">Close icon</title>
13
+ <desc id="closeDescID">A line drawing of an X</desc>
14
+ <path
15
+ d="m29.1923882 10.8076118c.5857864.5857865.5857864 1.535534 0 2.1213204l-7.0711162 7.0703398 7.0711162 7.0717958c.5857864.5857864.5857864 1.5355339 0 2.1213204-.5857865.5857864-1.535534.5857864-2.1213204 0l-7.0717958-7.0711162-7.0703398 7.0711162c-.5857864.5857864-1.5355339.5857864-2.1213204 0-.5857864-.5857865-.5857864-1.535534 0-2.1213204l7.0706602-7.0717958-7.0706602-7.0703398c-.5857864-.5857864-.5857864-1.5355339 0-2.1213204.5857865-.5857864 1.535534-.5857864 2.1213204 0l7.0703398 7.0706602 7.0717958-7.0706602c.5857864-.5857864 1.5355339-.5857864 2.1213204 0z"
16
+ class="fill-color"
17
+ fill-rule="evenodd"
18
+ />
19
+ </svg>
20
+ `;
21
+ //# sourceMappingURL=icon-close.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-close.js","sourceRoot":"","sources":["../../../../../../src/elements/ia-topnav/assets/img/icon-close.ts"],"names":[],"mappings":"AAAA,+HAA+H;AAE/H,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,eAAe,IAAI,CAAA;;;;;;;;;;;;;;;;;CAiBlB,CAAC","sourcesContent":["// @deprecated The topnav draws its icons from `@src/icons/topnav-*`. This module stays so imports of this path keep resolving.\n\nimport { html } from 'lit';\n\nexport default html`\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"closeTitleID closeDescID\"\n >\n <title id=\"closeTitleID\">Close icon</title>\n <desc id=\"closeDescID\">A line drawing of an X</desc>\n <path\n d=\"m29.1923882 10.8076118c.5857864.5857865.5857864 1.535534 0 2.1213204l-7.0711162 7.0703398 7.0711162 7.0717958c.5857864.5857864.5857864 1.5355339 0 2.1213204-.5857865.5857864-1.535534.5857864-2.1213204 0l-7.0717958-7.0711162-7.0703398 7.0711162c-.5857864.5857864-1.5355339.5857864-2.1213204 0-.5857864-.5857865-.5857864-1.535534 0-2.1213204l7.0706602-7.0717958-7.0706602-7.0703398c-.5857864-.5857864-.5857864-1.5355339 0-2.1213204.5857865-.5857864 1.535534-.5857864 2.1213204 0l7.0703398 7.0706602 7.0717958-7.0706602c.5857864-.5857864 1.5355339-.5857864 2.1213204 0z\"\n class=\"fill-color\"\n fill-rule=\"evenodd\"\n />\n </svg>\n`;\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("lit").TemplateResult<1>;
2
+ export default _default;
3
+ //# sourceMappingURL=icon-donate-unpadded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-donate-unpadded.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/ia-topnav/assets/img/icon-donate-unpadded.ts"],"names":[],"mappings":";AAIA,wBAgBE"}
@@ -0,0 +1,20 @@
1
+ // @deprecated The topnav draws its icons from `@src/icons/topnav-*`. This module stays so imports of this path keep resolving.
2
+ import { html } from 'lit';
3
+ export default html `
4
+ <svg
5
+ width="40"
6
+ height="40"
7
+ viewBox="0 0 40 40"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ xmlns:svg="http://www.w3.org/2000/svg"
10
+ aria-labelledby="donateTitleID donateDescID"
11
+ >
12
+ <title id="donateTitleID">Donate icon</title>
13
+ <desc id="donateDescID">An illustration of a heart shape</desc>
14
+ <path
15
+ class="fill-color"
16
+ d="m32.6,8.12c-1.57,-1.51 -3.46,-2.21 -5.65,-2.11c-1,0.03 -2.14,0.51 -3.42,1.44c-1.28,0.92 -2.28,2.09 -3.03,3.51c-0.71,-1.41 -1.72,-2.59 -3,-3.51c-1.29,-0.93 -2.43,-1.41 -3.41,-1.44c-1.46,-0.07 -2.8,0.23 -4.02,0.88c-1.23,0.65 -2.21,1.6 -2.94,2.83c-0.74,1.24 -1.11,2.63 -1.12,4.17c-0.05,2.56 0.85,5.01 2.68,7.37c1.46,1.88 3.52,4.21 6.19,7.04c2.66,2.81 4.53,4.71 5.62,5.69c1,-0.88 2.85,-2.75 5.55,-5.6s4.81,-5.23 6.31,-7.13c1.81,-2.36 2.71,-4.81 2.66,-7.37c-0.04,-2.35 -0.83,-4.28 -2.4,-5.77z"
17
+ />
18
+ </svg>
19
+ `;
20
+ //# sourceMappingURL=icon-donate-unpadded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-donate-unpadded.js","sourceRoot":"","sources":["../../../../../../src/elements/ia-topnav/assets/img/icon-donate-unpadded.ts"],"names":[],"mappings":"AAAA,+HAA+H;AAE/H,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,eAAe,IAAI,CAAA;;;;;;;;;;;;;;;;CAgBlB,CAAC","sourcesContent":["// @deprecated The topnav draws its icons from `@src/icons/topnav-*`. This module stays so imports of this path keep resolving.\n\nimport { html } from 'lit';\n\nexport default html`\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:svg=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"donateTitleID donateDescID\"\n >\n <title id=\"donateTitleID\">Donate icon</title>\n <desc id=\"donateDescID\">An illustration of a heart shape</desc>\n <path\n class=\"fill-color\"\n d=\"m32.6,8.12c-1.57,-1.51 -3.46,-2.21 -5.65,-2.11c-1,0.03 -2.14,0.51 -3.42,1.44c-1.28,0.92 -2.28,2.09 -3.03,3.51c-0.71,-1.41 -1.72,-2.59 -3,-3.51c-1.29,-0.93 -2.43,-1.41 -3.41,-1.44c-1.46,-0.07 -2.8,0.23 -4.02,0.88c-1.23,0.65 -2.21,1.6 -2.94,2.83c-0.74,1.24 -1.11,2.63 -1.12,4.17c-0.05,2.56 0.85,5.01 2.68,7.37c1.46,1.88 3.52,4.21 6.19,7.04c2.66,2.81 4.53,4.71 5.62,5.69c1,-0.88 2.85,-2.75 5.55,-5.6s4.81,-5.23 6.31,-7.13c1.81,-2.36 2.71,-4.81 2.66,-7.37c-0.04,-2.35 -0.83,-4.28 -2.4,-5.77z\"\n />\n </svg>\n`;\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("lit").TemplateResult<1>;
2
+ export default _default;
3
+ //# sourceMappingURL=icon-donate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-donate.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/ia-topnav/assets/img/icon-donate.ts"],"names":[],"mappings":";AAIA,wBAeE"}
@@ -0,0 +1,19 @@
1
+ // @deprecated The topnav draws its icons from `@src/icons/topnav-*`. This module stays so imports of this path keep resolving.
2
+ import { html } from 'lit';
3
+ export default html `
4
+ <svg
5
+ width="40"
6
+ height="40"
7
+ viewBox="0 0 40 40"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ aria-labelledby="donateTitleID donateDescID"
10
+ >
11
+ <title id="donateTitleID">Donate icon</title>
12
+ <desc id="donateDescID">An illustration of a heart shape</desc>
13
+ <path
14
+ class="fill-color"
15
+ d="m30.0120362 11.0857287c-1.2990268-1.12627221-2.8599641-1.65258786-4.682812-1.57894699-.8253588.02475323-1.7674318.3849128-2.8262192 1.08047869-1.0587873.6955659-1.89622 1.5724492-2.512298 2.63065-.591311-1.0588196-1.4194561-1.9357029-2.4844351-2.63065-1.0649791-.69494706-2.0039563-1.05510663-2.8169316-1.08047869-1.2067699-.04950647-2.318187.17203498-3.3342513.66462439-1.0160643.4925893-1.82594378 1.2002224-2.42963831 2.1228992-.60369453.9226769-.91173353 1.9629315-.92411701 3.1207641-.03715043 1.9202322.70183359 3.7665141 2.21695202 5.5388457 1.2067699 1.4035084 2.912594 3.1606786 5.1174721 5.2715107 2.2048782 2.1108321 3.7565279 3.5356901 4.6549492 4.2745742.8253588-.6646243 2.355647-2.0647292 4.5908647-4.2003145s3.9747867-3.9171994 5.218707-5.3448422c1.502735-1.7723316 2.2355273-3.6186135 2.1983769-5.5388457-.0256957-1.7608832-.6875926-3.2039968-1.9866194-4.3302689z"
16
+ />
17
+ </svg>
18
+ `;
19
+ //# sourceMappingURL=icon-donate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-donate.js","sourceRoot":"","sources":["../../../../../../src/elements/ia-topnav/assets/img/icon-donate.ts"],"names":[],"mappings":"AAAA,+HAA+H;AAE/H,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,eAAe,IAAI,CAAA;;;;;;;;;;;;;;;CAelB,CAAC","sourcesContent":["// @deprecated The topnav draws its icons from `@src/icons/topnav-*`. This module stays so imports of this path keep resolving.\n\nimport { html } from 'lit';\n\nexport default html`\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"donateTitleID donateDescID\"\n >\n <title id=\"donateTitleID\">Donate icon</title>\n <desc id=\"donateDescID\">An illustration of a heart shape</desc>\n <path\n class=\"fill-color\"\n d=\"m30.0120362 11.0857287c-1.2990268-1.12627221-2.8599641-1.65258786-4.682812-1.57894699-.8253588.02475323-1.7674318.3849128-2.8262192 1.08047869-1.0587873.6955659-1.89622 1.5724492-2.512298 2.63065-.591311-1.0588196-1.4194561-1.9357029-2.4844351-2.63065-1.0649791-.69494706-2.0039563-1.05510663-2.8169316-1.08047869-1.2067699-.04950647-2.318187.17203498-3.3342513.66462439-1.0160643.4925893-1.82594378 1.2002224-2.42963831 2.1228992-.60369453.9226769-.91173353 1.9629315-.92411701 3.1207641-.03715043 1.9202322.70183359 3.7665141 2.21695202 5.5388457 1.2067699 1.4035084 2.912594 3.1606786 5.1174721 5.2715107 2.2048782 2.1108321 3.7565279 3.5356901 4.6549492 4.2745742.8253588-.6646243 2.355647-2.0647292 4.5908647-4.2003145s3.9747867-3.9171994 5.218707-5.3448422c1.502735-1.7723316 2.2355273-3.6186135 2.1983769-5.5388457-.0256957-1.7608832-.6875926-3.2039968-1.9866194-4.3302689z\"\n />\n </svg>\n`;\n"]}