@internetarchive/collection-browser 3.0.7-alpha-webdev7989.0 → 3.1.1-alpha-webdev6778.1

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 (75) hide show
  1. package/dist/src/app-root.js +606 -606
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.d.ts +9 -0
  4. package/dist/src/collection-browser.js +689 -682
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/models.js.map +1 -1
  7. package/dist/src/collection-facets/more-facets-content.d.ts +1 -0
  8. package/dist/src/collection-facets/more-facets-content.js +122 -118
  9. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  10. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
  11. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  12. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
  13. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  14. package/dist/src/collection-facets.d.ts +1 -0
  15. package/dist/src/collection-facets.js +269 -265
  16. package/dist/src/collection-facets.js.map +1 -1
  17. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  18. package/dist/src/data-source/collection-browser-data-source.js +27 -13
  19. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  20. package/dist/src/data-source/collection-browser-query-state.d.ts +1 -0
  21. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  22. package/dist/src/data-source/models.d.ts +1 -1
  23. package/dist/src/data-source/models.js.map +1 -1
  24. package/dist/src/expanded-date-picker.js +52 -52
  25. package/dist/src/expanded-date-picker.js.map +1 -1
  26. package/dist/src/manage/manage-bar.js +77 -77
  27. package/dist/src/manage/manage-bar.js.map +1 -1
  28. package/dist/src/models.js.map +1 -1
  29. package/dist/src/sort-filter-bar/sort-filter-bar.js +376 -376
  30. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  31. package/dist/src/tiles/grid/collection-tile.js +77 -77
  32. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  33. package/dist/src/tiles/grid/item-tile.js +139 -139
  34. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  35. package/dist/src/tiles/grid/search-tile.js +42 -42
  36. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  37. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
  38. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  39. package/dist/src/tiles/list/tile-list.js +297 -297
  40. package/dist/src/tiles/list/tile-list.js.map +1 -1
  41. package/dist/src/tiles/tile-dispatcher.js +200 -200
  42. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  43. package/dist/src/utils/analytics-events.js.map +1 -1
  44. package/dist/test/collection-browser.test.js +196 -183
  45. package/dist/test/collection-browser.test.js.map +1 -1
  46. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +37 -37
  47. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  48. package/dist/test/tiles/list/tile-list.test.js +113 -113
  49. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  50. package/package.json +2 -2
  51. package/src/app-root.ts +1140 -1140
  52. package/src/collection-browser.ts +2802 -2788
  53. package/src/collection-facets/models.ts +10 -10
  54. package/src/collection-facets/more-facets-content.ts +639 -636
  55. package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
  56. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
  57. package/src/collection-facets.ts +995 -992
  58. package/src/data-source/collection-browser-data-source-interface.ts +333 -333
  59. package/src/data-source/collection-browser-data-source.ts +1401 -1391
  60. package/src/data-source/collection-browser-query-state.ts +65 -64
  61. package/src/data-source/models.ts +1 -1
  62. package/src/expanded-date-picker.ts +191 -191
  63. package/src/manage/manage-bar.ts +247 -247
  64. package/src/models.ts +870 -870
  65. package/src/sort-filter-bar/sort-filter-bar.ts +1283 -1283
  66. package/src/tiles/grid/collection-tile.ts +162 -162
  67. package/src/tiles/grid/item-tile.ts +339 -339
  68. package/src/tiles/grid/search-tile.ts +90 -90
  69. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  70. package/src/tiles/list/tile-list.ts +696 -696
  71. package/src/tiles/tile-dispatcher.ts +486 -486
  72. package/src/utils/analytics-events.ts +29 -29
  73. package/test/collection-browser.test.ts +2359 -2340
  74. package/test/sort-filter-bar/sort-filter-bar.test.ts +885 -885
  75. package/test/tiles/list/tile-list.test.ts +497 -497
@@ -1,162 +1,162 @@
1
- import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';
2
- import { customElement, property } from 'lit/decorators.js';
3
- import { msg } from '@lit/localize';
4
- import { collectionIcon } from '../../assets/img/icons/mediatype/collection';
5
- import { formatUnitSize } from '../../utils/format-unit-size';
6
- import { baseTileStyles } from './styles/tile-grid-shared-styles';
7
- import { BaseTileComponent } from '../base-tile-component';
8
- import '../image-block';
9
-
10
- @customElement('collection-tile')
11
- export class CollectionTile extends BaseTileComponent {
12
- /*
13
- * Reactive properties inherited from BaseTileComponent:
14
- * - model?: TileModel;
15
- * - currentWidth?: number;
16
- * - currentHeight?: number;
17
- * - baseNavigationUrl?: string;
18
- * - baseImageUrl?: string;
19
- * - collectionPagePath?: string;
20
- * - sortParam: SortParam | null = null;
21
- * - creatorFilter?: string;
22
- * - mobileBreakpoint?: number;
23
- * - loggedIn = false;
24
- * - suppressBlurring = false;
25
- */
26
-
27
- @property({ type: Boolean }) showInfoButton = false;
28
-
29
- render() {
30
- return html`
31
- <div class="container">
32
- ${this.infoButtonTemplate}
33
- <div class="tile-details">
34
- <div class="item-info">
35
- ${this.getImageBlockTemplate} ${this.getTitleTemplate}
36
- </div>
37
- </div>
38
-
39
- ${this.getTileStatsTemplate}
40
- </div>
41
- `;
42
- }
43
-
44
- private get getImageBlockTemplate(): TemplateResult {
45
- return html`
46
- <image-block
47
- .model=${this.model}
48
- .baseImageUrl=${this.baseImageUrl}
49
- .viewSize=${'grid'}
50
- .suppressBlurring=${this.suppressBlurring}
51
- >
52
- </image-block>
53
- `;
54
- }
55
-
56
- private get getTitleTemplate() {
57
- return html`<div id="title">
58
- <h3 class="truncated">${this.model?.title}</h3>
59
- </div>`;
60
- }
61
-
62
- private get getTileStatsTemplate() {
63
- return html`
64
- <div id="item-stats">
65
- <div id="item-mediatype">${collectionIcon}</div>
66
-
67
- <div id="stats-row">
68
- ${this.getItemsTemplate} ${this.getSizeTemplate}
69
- </div>
70
- </div>
71
- `;
72
- }
73
-
74
- private get getItemsTemplate() {
75
- const collectionItems = this.model?.itemCount?.toLocaleString();
76
-
77
- return html`<span id="item-count"
78
- >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span
79
- >`;
80
- }
81
-
82
- private get getSizeTemplate() {
83
- const collectionSize = this.model?.collectionSize ?? 0;
84
-
85
- return collectionSize
86
- ? html`<span id="item-size">${formatUnitSize(collectionSize, 1)}</span>`
87
- : ``;
88
- }
89
-
90
- private get infoButtonTemplate(): TemplateResult | typeof nothing {
91
- // &#9432; is an information icon
92
- return this.showInfoButton
93
- ? html`<button class="info-button" @click=${this.infoButtonPressed}>
94
- &#9432;
95
- <span class="sr-only">${msg('More info')}</span>
96
- </button>`
97
- : nothing;
98
- }
99
-
100
- private infoButtonPressed(e: PointerEvent) {
101
- e.preventDefault();
102
- const event = new CustomEvent<{ x: number; y: number }>(
103
- 'infoButtonPressed',
104
- { detail: { x: e.clientX, y: e.clientY } },
105
- );
106
- this.dispatchEvent(event);
107
- }
108
-
109
- static get styles(): CSSResultGroup {
110
- const tileBorderColor = css`var(--tileBorderColor, #555555)`;
111
- const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;
112
- const whiteColor = css`#fff`;
113
-
114
- return [
115
- baseTileStyles,
116
- css`
117
- .container {
118
- background-color: ${tileBackgroundColor};
119
- border: 1px solid ${tileBorderColor};
120
- }
121
-
122
- .item-info {
123
- flex-grow: initial;
124
- }
125
-
126
- h4.truncated,
127
- h3.truncated {
128
- color: ${whiteColor};
129
- }
130
-
131
- #item-mediatype svg {
132
- filter: invert(100%);
133
- height: 2.5rem;
134
- align-items: baseline;
135
- }
136
-
137
- .container:hover > #title {
138
- text-decoration: underline;
139
- }
140
-
141
- /* this is a workaround for Safari 15 where the hover effects are not working */
142
- image-block:hover > #title {
143
- text-decoration: underline;
144
- }
145
-
146
- #item-stats {
147
- display: flex;
148
- padding: 0 5px 5px;
149
- align-items: center;
150
- }
151
-
152
- #stats-row {
153
- display: flex;
154
- align-items: baseline;
155
- color: ${whiteColor};
156
- flex-direction: column;
157
- margin-left: 10px;
158
- }
159
- `,
160
- ];
161
- }
162
- }
1
+ import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { msg } from '@lit/localize';
4
+ import { collectionIcon } from '../../assets/img/icons/mediatype/collection';
5
+ import { formatUnitSize } from '../../utils/format-unit-size';
6
+ import { baseTileStyles } from './styles/tile-grid-shared-styles';
7
+ import { BaseTileComponent } from '../base-tile-component';
8
+ import '../image-block';
9
+
10
+ @customElement('collection-tile')
11
+ export class CollectionTile extends BaseTileComponent {
12
+ /*
13
+ * Reactive properties inherited from BaseTileComponent:
14
+ * - model?: TileModel;
15
+ * - currentWidth?: number;
16
+ * - currentHeight?: number;
17
+ * - baseNavigationUrl?: string;
18
+ * - baseImageUrl?: string;
19
+ * - collectionPagePath?: string;
20
+ * - sortParam: SortParam | null = null;
21
+ * - creatorFilter?: string;
22
+ * - mobileBreakpoint?: number;
23
+ * - loggedIn = false;
24
+ * - suppressBlurring = false;
25
+ */
26
+
27
+ @property({ type: Boolean }) showInfoButton = false;
28
+
29
+ render() {
30
+ return html`
31
+ <div class="container">
32
+ ${this.infoButtonTemplate}
33
+ <div class="tile-details">
34
+ <div class="item-info">
35
+ ${this.getImageBlockTemplate} ${this.getTitleTemplate}
36
+ </div>
37
+ </div>
38
+
39
+ ${this.getTileStatsTemplate}
40
+ </div>
41
+ `;
42
+ }
43
+
44
+ private get getImageBlockTemplate(): TemplateResult {
45
+ return html`
46
+ <image-block
47
+ .model=${this.model}
48
+ .baseImageUrl=${this.baseImageUrl}
49
+ .viewSize=${'grid'}
50
+ .suppressBlurring=${this.suppressBlurring}
51
+ >
52
+ </image-block>
53
+ `;
54
+ }
55
+
56
+ private get getTitleTemplate() {
57
+ return html`<div id="title">
58
+ <h3 class="truncated">${this.model?.title}</h3>
59
+ </div>`;
60
+ }
61
+
62
+ private get getTileStatsTemplate() {
63
+ return html`
64
+ <div id="item-stats">
65
+ <div id="item-mediatype">${collectionIcon}</div>
66
+
67
+ <div id="stats-row">
68
+ ${this.getItemsTemplate} ${this.getSizeTemplate}
69
+ </div>
70
+ </div>
71
+ `;
72
+ }
73
+
74
+ private get getItemsTemplate() {
75
+ const collectionItems = this.model?.itemCount?.toLocaleString();
76
+
77
+ return html`<span id="item-count"
78
+ >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span
79
+ >`;
80
+ }
81
+
82
+ private get getSizeTemplate() {
83
+ const collectionSize = this.model?.collectionSize ?? 0;
84
+
85
+ return collectionSize
86
+ ? html`<span id="item-size">${formatUnitSize(collectionSize, 1)}</span>`
87
+ : ``;
88
+ }
89
+
90
+ private get infoButtonTemplate(): TemplateResult | typeof nothing {
91
+ // &#9432; is an information icon
92
+ return this.showInfoButton
93
+ ? html`<button class="info-button" @click=${this.infoButtonPressed}>
94
+ &#9432;
95
+ <span class="sr-only">${msg('More info')}</span>
96
+ </button>`
97
+ : nothing;
98
+ }
99
+
100
+ private infoButtonPressed(e: PointerEvent) {
101
+ e.preventDefault();
102
+ const event = new CustomEvent<{ x: number; y: number }>(
103
+ 'infoButtonPressed',
104
+ { detail: { x: e.clientX, y: e.clientY } },
105
+ );
106
+ this.dispatchEvent(event);
107
+ }
108
+
109
+ static get styles(): CSSResultGroup {
110
+ const tileBorderColor = css`var(--tileBorderColor, #555555)`;
111
+ const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;
112
+ const whiteColor = css`#fff`;
113
+
114
+ return [
115
+ baseTileStyles,
116
+ css`
117
+ .container {
118
+ background-color: ${tileBackgroundColor};
119
+ border: 1px solid ${tileBorderColor};
120
+ }
121
+
122
+ .item-info {
123
+ flex-grow: initial;
124
+ }
125
+
126
+ h4.truncated,
127
+ h3.truncated {
128
+ color: ${whiteColor};
129
+ }
130
+
131
+ #item-mediatype svg {
132
+ filter: invert(100%);
133
+ height: 2.5rem;
134
+ align-items: baseline;
135
+ }
136
+
137
+ .container:hover > #title {
138
+ text-decoration: underline;
139
+ }
140
+
141
+ /* this is a workaround for Safari 15 where the hover effects are not working */
142
+ image-block:hover > #title {
143
+ text-decoration: underline;
144
+ }
145
+
146
+ #item-stats {
147
+ display: flex;
148
+ padding: 0 5px 5px;
149
+ align-items: center;
150
+ }
151
+
152
+ #stats-row {
153
+ display: flex;
154
+ align-items: baseline;
155
+ color: ${whiteColor};
156
+ flex-direction: column;
157
+ margin-left: 10px;
158
+ }
159
+ `,
160
+ ];
161
+ }
162
+ }