@internetarchive/collection-browser 3.1.1-alpha-webdev6778.6 → 3.1.1-alpha-webdev6778.8

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 (73) 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.js.map +1 -1
  4. package/dist/src/collection-facets/facet-row.js +140 -140
  5. package/dist/src/collection-facets/facet-row.js.map +1 -1
  6. package/dist/src/collection-facets/models.js.map +1 -1
  7. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
  8. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  9. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
  10. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  11. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  12. package/dist/src/data-source/collection-browser-data-source.js +1 -3
  13. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  14. package/dist/src/data-source/models.js.map +1 -1
  15. package/dist/src/expanded-date-picker.js +52 -52
  16. package/dist/src/expanded-date-picker.js.map +1 -1
  17. package/dist/src/manage/manage-bar.js +77 -77
  18. package/dist/src/manage/manage-bar.js.map +1 -1
  19. package/dist/src/models.js.map +1 -1
  20. package/dist/src/sort-filter-bar/sort-filter-bar.js +376 -376
  21. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  22. package/dist/src/tiles/base-tile-component.js.map +1 -1
  23. package/dist/src/tiles/grid/account-tile.js +36 -36
  24. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  25. package/dist/src/tiles/grid/search-tile.js +42 -42
  26. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  27. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
  28. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  29. package/dist/src/tiles/list/tile-list-compact.js +97 -97
  30. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  31. package/dist/src/utils/analytics-events.js.map +1 -1
  32. package/dist/src/utils/format-date.js.map +1 -1
  33. package/dist/test/collection-browser.test.js +187 -187
  34. package/dist/test/collection-browser.test.js.map +1 -1
  35. package/dist/test/collection-facets/facet-row.test.js +23 -23
  36. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  37. package/dist/test/collection-facets.test.js +20 -20
  38. package/dist/test/collection-facets.test.js.map +1 -1
  39. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +37 -37
  40. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  41. package/dist/test/tiles/grid/item-tile.test.js +64 -64
  42. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  43. package/dist/test/tiles/list/tile-list-compact.test.js +57 -57
  44. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
  45. package/dist/test/utils/format-date.test.js.map +1 -1
  46. package/package.json +2 -2
  47. package/src/app-root.ts +1140 -1140
  48. package/src/collection-browser.ts +1 -1
  49. package/src/collection-facets/facet-row.ts +296 -296
  50. package/src/collection-facets/models.ts +10 -10
  51. package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
  52. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
  53. package/src/data-source/collection-browser-data-source-interface.ts +333 -333
  54. package/src/data-source/collection-browser-data-source.ts +2 -4
  55. package/src/data-source/models.ts +43 -43
  56. package/src/expanded-date-picker.ts +191 -191
  57. package/src/manage/manage-bar.ts +247 -247
  58. package/src/models.ts +870 -870
  59. package/src/sort-filter-bar/sort-filter-bar.ts +1283 -1283
  60. package/src/tiles/base-tile-component.ts +53 -53
  61. package/src/tiles/grid/account-tile.ts +112 -112
  62. package/src/tiles/grid/search-tile.ts +90 -90
  63. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  64. package/src/tiles/list/tile-list-compact.ts +236 -236
  65. package/src/utils/analytics-events.ts +29 -29
  66. package/src/utils/format-date.ts +42 -42
  67. package/test/collection-browser.test.ts +2359 -2359
  68. package/test/collection-facets/facet-row.test.ts +375 -375
  69. package/test/collection-facets.test.ts +928 -928
  70. package/test/sort-filter-bar/sort-filter-bar.test.ts +885 -885
  71. package/test/tiles/grid/item-tile.test.ts +464 -464
  72. package/test/tiles/list/tile-list-compact.test.ts +228 -228
  73. package/test/utils/format-date.test.ts +39 -39
@@ -410,7 +410,6 @@ export class CollectionBrowserDataSource
410
410
  * @inheritdoc
411
411
  */
412
412
  async handleQueryChange(): Promise<void> {
413
- console.log('handleQueryChange');
414
413
  // Don't react to the change if fetches are suppressed for this data source
415
414
  if (this.suppressFetches) return;
416
415
 
@@ -859,7 +858,7 @@ export class CollectionBrowserDataSource
859
858
  const parts = [];
860
859
  const trimmedQuery = this.host.baseQuery?.trim();
861
860
  if (trimmedQuery) parts.push(trimmedQuery);
862
-
861
+
863
862
  if (this.host.identifiers) {
864
863
  parts.push(`identifier:(${this.host.identifiers.join(' OR ')})`);
865
864
  }
@@ -1094,7 +1093,6 @@ export class CollectionBrowserDataSource
1094
1093
  * if `pageNumber != 1`, defaulting to a single page.
1095
1094
  */
1096
1095
  async fetchPage(pageNumber: number, numInitialPages = 1): Promise<void> {
1097
- console.log('fetchPage', this.host.baseQuery, this.host.identifiers);
1098
1096
  const trimmedQuery = this.host.baseQuery?.trim();
1099
1097
  // reset loading status
1100
1098
  if (!this.canPerformSearch) {
@@ -1152,7 +1150,7 @@ export class CollectionBrowserDataSource
1152
1150
  };
1153
1151
  params.uid = await this.requestUID(params, 'hits');
1154
1152
 
1155
- console.log('=== FIRING PAGE REQUEST ===', params);
1153
+ // log('=== FIRING PAGE REQUEST ===', params);
1156
1154
  const searchResponse = await this.host.searchService?.search(
1157
1155
  params,
1158
1156
  this.host.searchType,
@@ -1,43 +1,43 @@
1
- import type {
2
- PageElementName,
3
- PageType,
4
- } from '@internetarchive/search-service';
5
-
6
- /**
7
- * A Map from collection identifiers to their corresponding collection titles.
8
- */
9
- export type CollectionTitles = Map<string, string>;
10
-
11
- /**
12
- * A Map from channel names to their corresponding, more human-readable network name.
13
- */
14
- export type TVChannelAliases = Map<string, string>;
15
-
16
- /**
17
- * The subset of search service params that uniquely specify the type of results
18
- * that are sought by an instance of collection browser.
19
- */
20
- export type PageSpecifierParams = {
21
- /**
22
- * What high-level type of page is being fetched for (search results, collection, or profile)
23
- */
24
- pageType: PageType;
25
- /**
26
- * The target identifier for collection or profile pages (e.g., "prelinger", "@brewster", ...)
27
- */
28
- pageTarget?: string;
29
- /**
30
- * Which specific elements of a profile page to fetch. Corresponds to individual tab data
31
- * (e.g., "uploads", "reviews", ...)
32
- */
33
- pageElements?: PageElementName[];
34
- };
35
-
36
- /**
37
- * List of profile page elements that do not currently allow faceting
38
- */
39
- export const FACETLESS_PAGE_ELEMENTS: PageElementName[] = [
40
- 'forum_posts',
41
- 'lending',
42
- 'web_archives',
43
- ];
1
+ import type {
2
+ PageElementName,
3
+ PageType,
4
+ } from '@internetarchive/search-service';
5
+
6
+ /**
7
+ * A Map from collection identifiers to their corresponding collection titles.
8
+ */
9
+ export type CollectionTitles = Map<string, string>;
10
+
11
+ /**
12
+ * A Map from channel names to their corresponding, more human-readable network name.
13
+ */
14
+ export type TVChannelAliases = Map<string, string>;
15
+
16
+ /**
17
+ * The subset of search service params that uniquely specify the type of results
18
+ * that are sought by an instance of collection browser.
19
+ */
20
+ export type PageSpecifierParams = {
21
+ /**
22
+ * What high-level type of page is being fetched for (search results, collection, or profile)
23
+ */
24
+ pageType: PageType;
25
+ /**
26
+ * The target identifier for collection or profile pages (e.g., "prelinger", "@brewster", ...)
27
+ */
28
+ pageTarget?: string;
29
+ /**
30
+ * Which specific elements of a profile page to fetch. Corresponds to individual tab data
31
+ * (e.g., "uploads", "reviews", ...)
32
+ */
33
+ pageElements?: PageElementName[];
34
+ };
35
+
36
+ /**
37
+ * List of profile page elements that do not currently allow faceting
38
+ */
39
+ export const FACETLESS_PAGE_ELEMENTS: PageElementName[] = [
40
+ 'forum_posts',
41
+ 'lending',
42
+ 'web_archives',
43
+ ];
@@ -1,191 +1,191 @@
1
- import {
2
- css,
3
- html,
4
- LitElement,
5
- CSSResultGroup,
6
- TemplateResult,
7
- nothing,
8
- } from 'lit';
9
- import { customElement, property } from 'lit/decorators.js';
10
- import { ifDefined } from 'lit/directives/if-defined.js';
11
- import { msg } from '@lit/localize';
12
- import type { ModalManagerInterface } from '@internetarchive/modal-manager';
13
- import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';
14
- import {
15
- BarScalingOption,
16
- BinSnappingInterval,
17
- } from '@internetarchive/histogram-date-range';
18
- import {
19
- analyticsActions,
20
- analyticsCategories,
21
- } from './utils/analytics-events';
22
-
23
- import '@internetarchive/histogram-date-range';
24
-
25
- @customElement('expanded-date-picker')
26
- export class ExpandedDatePicker extends LitElement {
27
- @property({ type: String }) minDate?: string;
28
-
29
- @property({ type: String }) maxDate?: string;
30
-
31
- @property({ type: String }) minSelectedDate?: string;
32
-
33
- @property({ type: String }) maxSelectedDate?: string;
34
-
35
- @property({ type: Array }) buckets?: number[];
36
-
37
- @property({ type: String }) customDateFormat?: string;
38
-
39
- @property({ type: String }) customTooltipDateFormat?: string;
40
-
41
- @property({ type: String }) customTooltipLabel?: string;
42
-
43
- @property({ type: String }) binSnapping: BinSnappingInterval = 'none';
44
-
45
- @property({ type: String }) barScaling: BarScalingOption = 'logarithmic';
46
-
47
- @property({ type: Object, attribute: false })
48
- modalManager?: ModalManagerInterface;
49
-
50
- @property({ type: Object, attribute: false })
51
- analyticsHandler?: AnalyticsManagerInterface;
52
-
53
- render(): TemplateResult {
54
- return html`
55
- <div id="container">
56
- <histogram-date-range
57
- id="date-picker"
58
- .minDate=${this.minDate}
59
- .maxDate=${this.maxDate}
60
- .minSelectedDate=${this.minSelectedDate ?? this.minDate}
61
- .maxSelectedDate=${this.maxSelectedDate ?? this.maxDate}
62
- dateFormat=${ifDefined(this.customDateFormat)}
63
- tooltipDateFormat=${ifDefined(this.customTooltipDateFormat)}
64
- tooltipLabel=${ifDefined(this.customTooltipLabel)}
65
- .binSnapping=${this.binSnapping}
66
- .barScaling=${this.barScaling ?? nothing}
67
- .updateDelay=${0}
68
- updateWhileFocused
69
- missingDataMessage="..."
70
- .width=${560}
71
- .height=${120}
72
- .bins=${this.buckets}
73
- @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
74
- >
75
- <button
76
- id="apply-btn"
77
- slot="inputs-right-side"
78
- @click=${this.applyBtnClicked}
79
- >
80
- ${msg('Apply date range')}
81
- </button>
82
- </histogram-date-range>
83
- </div>
84
- `;
85
- }
86
-
87
- connectedCallback(): void {
88
- super.connectedCallback?.();
89
- this.setupEscapeListener();
90
- }
91
-
92
- disconnectedCallback(): void {
93
- super.disconnectedCallback?.();
94
- this.removeEscapeListener();
95
- }
96
-
97
- /**
98
- * Add an event listener to close the date picker modal when the Esc key is pressed
99
- */
100
- private setupEscapeListener() {
101
- document.addEventListener('keydown', this.boundEscapeListener);
102
- }
103
-
104
- /**
105
- * Remove the Esc key listener that was previously added
106
- */
107
- private removeEscapeListener() {
108
- document.removeEventListener('keydown', this.boundEscapeListener);
109
- }
110
-
111
- /**
112
- * Closes the modal dialog if the given event is pressing the Esc key.
113
- * Arrow function to ensure `this` remains bound to the current component.
114
- */
115
- private boundEscapeListener = (e: KeyboardEvent) => {
116
- if (e.key === 'Escape') {
117
- this.closeModal();
118
- }
119
- };
120
-
121
- /**
122
- * When the histogram is updated, keep track of the newly selected date range.
123
- * We don't commit to the new range until the apply button is clicked.
124
- */
125
- private histogramDateRangeUpdated(
126
- e: CustomEvent<{
127
- minDate: string;
128
- maxDate: string;
129
- }>,
130
- ): void {
131
- this.minSelectedDate = e.detail.minDate;
132
- this.maxSelectedDate = e.detail.maxDate;
133
- }
134
-
135
- /**
136
- * When the Apply button is clicked, emit the current date range and close the modal.
137
- */
138
- private applyBtnClicked(): void {
139
- const event = new CustomEvent('histogramDateRangeApplied', {
140
- detail: {
141
- minDate: this.minSelectedDate,
142
- maxDate: this.maxSelectedDate,
143
- },
144
- });
145
- this.dispatchEvent(event);
146
- this.closeModal();
147
-
148
- this.analyticsHandler?.sendEvent({
149
- category: analyticsCategories.default,
150
- action: analyticsActions.histogramChangedFromModal,
151
- label: window.location.href,
152
- });
153
- }
154
-
155
- /**
156
- * Closes the modal associated with this component (if it exists) and dispatches a
157
- * modalClosed event.
158
- */
159
- private closeModal(): void {
160
- if (this.modalManager) {
161
- this.modalManager.closeModal();
162
- this.dispatchEvent(new CustomEvent('modalClosed'));
163
- }
164
- }
165
-
166
- static get styles(): CSSResultGroup {
167
- return css`
168
- #container {
169
- display: flex;
170
- justify-content: center;
171
- padding: 40px 10px 10px;
172
- overflow: hidden;
173
- }
174
-
175
- #date-picker {
176
- --histogramDateRangeInputWidth: 50px;
177
- --histogramDateRangeInputRowMargin: 5px 0 0 0;
178
- }
179
-
180
- #apply-btn {
181
- margin: 0 0 0 5px;
182
- padding: 8px 10px;
183
- border: 0;
184
- border-radius: 4px;
185
- background: var(--primaryButtonBGColor, #194880);
186
- color: white;
187
- cursor: pointer;
188
- }
189
- `;
190
- }
191
- }
1
+ import {
2
+ css,
3
+ html,
4
+ LitElement,
5
+ CSSResultGroup,
6
+ TemplateResult,
7
+ nothing,
8
+ } from 'lit';
9
+ import { customElement, property } from 'lit/decorators.js';
10
+ import { ifDefined } from 'lit/directives/if-defined.js';
11
+ import { msg } from '@lit/localize';
12
+ import type { ModalManagerInterface } from '@internetarchive/modal-manager';
13
+ import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';
14
+ import {
15
+ BarScalingOption,
16
+ BinSnappingInterval,
17
+ } from '@internetarchive/histogram-date-range';
18
+ import {
19
+ analyticsActions,
20
+ analyticsCategories,
21
+ } from './utils/analytics-events';
22
+
23
+ import '@internetarchive/histogram-date-range';
24
+
25
+ @customElement('expanded-date-picker')
26
+ export class ExpandedDatePicker extends LitElement {
27
+ @property({ type: String }) minDate?: string;
28
+
29
+ @property({ type: String }) maxDate?: string;
30
+
31
+ @property({ type: String }) minSelectedDate?: string;
32
+
33
+ @property({ type: String }) maxSelectedDate?: string;
34
+
35
+ @property({ type: Array }) buckets?: number[];
36
+
37
+ @property({ type: String }) customDateFormat?: string;
38
+
39
+ @property({ type: String }) customTooltipDateFormat?: string;
40
+
41
+ @property({ type: String }) customTooltipLabel?: string;
42
+
43
+ @property({ type: String }) binSnapping: BinSnappingInterval = 'none';
44
+
45
+ @property({ type: String }) barScaling: BarScalingOption = 'logarithmic';
46
+
47
+ @property({ type: Object, attribute: false })
48
+ modalManager?: ModalManagerInterface;
49
+
50
+ @property({ type: Object, attribute: false })
51
+ analyticsHandler?: AnalyticsManagerInterface;
52
+
53
+ render(): TemplateResult {
54
+ return html`
55
+ <div id="container">
56
+ <histogram-date-range
57
+ id="date-picker"
58
+ .minDate=${this.minDate}
59
+ .maxDate=${this.maxDate}
60
+ .minSelectedDate=${this.minSelectedDate ?? this.minDate}
61
+ .maxSelectedDate=${this.maxSelectedDate ?? this.maxDate}
62
+ dateFormat=${ifDefined(this.customDateFormat)}
63
+ tooltipDateFormat=${ifDefined(this.customTooltipDateFormat)}
64
+ tooltipLabel=${ifDefined(this.customTooltipLabel)}
65
+ .binSnapping=${this.binSnapping}
66
+ .barScaling=${this.barScaling ?? nothing}
67
+ .updateDelay=${0}
68
+ updateWhileFocused
69
+ missingDataMessage="..."
70
+ .width=${560}
71
+ .height=${120}
72
+ .bins=${this.buckets}
73
+ @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
74
+ >
75
+ <button
76
+ id="apply-btn"
77
+ slot="inputs-right-side"
78
+ @click=${this.applyBtnClicked}
79
+ >
80
+ ${msg('Apply date range')}
81
+ </button>
82
+ </histogram-date-range>
83
+ </div>
84
+ `;
85
+ }
86
+
87
+ connectedCallback(): void {
88
+ super.connectedCallback?.();
89
+ this.setupEscapeListener();
90
+ }
91
+
92
+ disconnectedCallback(): void {
93
+ super.disconnectedCallback?.();
94
+ this.removeEscapeListener();
95
+ }
96
+
97
+ /**
98
+ * Add an event listener to close the date picker modal when the Esc key is pressed
99
+ */
100
+ private setupEscapeListener() {
101
+ document.addEventListener('keydown', this.boundEscapeListener);
102
+ }
103
+
104
+ /**
105
+ * Remove the Esc key listener that was previously added
106
+ */
107
+ private removeEscapeListener() {
108
+ document.removeEventListener('keydown', this.boundEscapeListener);
109
+ }
110
+
111
+ /**
112
+ * Closes the modal dialog if the given event is pressing the Esc key.
113
+ * Arrow function to ensure `this` remains bound to the current component.
114
+ */
115
+ private boundEscapeListener = (e: KeyboardEvent) => {
116
+ if (e.key === 'Escape') {
117
+ this.closeModal();
118
+ }
119
+ };
120
+
121
+ /**
122
+ * When the histogram is updated, keep track of the newly selected date range.
123
+ * We don't commit to the new range until the apply button is clicked.
124
+ */
125
+ private histogramDateRangeUpdated(
126
+ e: CustomEvent<{
127
+ minDate: string;
128
+ maxDate: string;
129
+ }>,
130
+ ): void {
131
+ this.minSelectedDate = e.detail.minDate;
132
+ this.maxSelectedDate = e.detail.maxDate;
133
+ }
134
+
135
+ /**
136
+ * When the Apply button is clicked, emit the current date range and close the modal.
137
+ */
138
+ private applyBtnClicked(): void {
139
+ const event = new CustomEvent('histogramDateRangeApplied', {
140
+ detail: {
141
+ minDate: this.minSelectedDate,
142
+ maxDate: this.maxSelectedDate,
143
+ },
144
+ });
145
+ this.dispatchEvent(event);
146
+ this.closeModal();
147
+
148
+ this.analyticsHandler?.sendEvent({
149
+ category: analyticsCategories.default,
150
+ action: analyticsActions.histogramChangedFromModal,
151
+ label: window.location.href,
152
+ });
153
+ }
154
+
155
+ /**
156
+ * Closes the modal associated with this component (if it exists) and dispatches a
157
+ * modalClosed event.
158
+ */
159
+ private closeModal(): void {
160
+ if (this.modalManager) {
161
+ this.modalManager.closeModal();
162
+ this.dispatchEvent(new CustomEvent('modalClosed'));
163
+ }
164
+ }
165
+
166
+ static get styles(): CSSResultGroup {
167
+ return css`
168
+ #container {
169
+ display: flex;
170
+ justify-content: center;
171
+ padding: 40px 10px 10px;
172
+ overflow: hidden;
173
+ }
174
+
175
+ #date-picker {
176
+ --histogramDateRangeInputWidth: 50px;
177
+ --histogramDateRangeInputRowMargin: 5px 0 0 0;
178
+ }
179
+
180
+ #apply-btn {
181
+ margin: 0 0 0 5px;
182
+ padding: 8px 10px;
183
+ border: 0;
184
+ border-radius: 4px;
185
+ background: var(--primaryButtonBGColor, #194880);
186
+ color: white;
187
+ cursor: pointer;
188
+ }
189
+ `;
190
+ }
191
+ }