@internetarchive/collection-browser 3.3.3 → 3.3.4-alpha-webdev7761.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 (55) hide show
  1. package/dist/src/collection-browser.d.ts +10 -2
  2. package/dist/src/collection-browser.js +112 -10
  3. package/dist/src/collection-browser.js.map +1 -1
  4. package/dist/src/collection-facets/facet-row.js +141 -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.js +12 -0
  8. package/dist/src/collection-facets.js.map +1 -1
  9. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +10 -1
  10. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  11. package/dist/src/data-source/collection-browser-data-source.d.ts +19 -1
  12. package/dist/src/data-source/collection-browser-data-source.js +36 -18
  13. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  14. package/dist/src/data-source/collection-browser-query-state.d.ts +1 -2
  15. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  16. package/dist/src/data-source/models.d.ts +11 -0
  17. package/dist/src/data-source/models.js.map +1 -1
  18. package/dist/src/manage/manage-bar.js +77 -77
  19. package/dist/src/manage/manage-bar.js.map +1 -1
  20. package/dist/src/models.d.ts +2 -6
  21. package/dist/src/models.js +8 -12
  22. package/dist/src/models.js.map +1 -1
  23. package/dist/src/restoration-state-handler.d.ts +1 -2
  24. package/dist/src/restoration-state-handler.js +3 -9
  25. package/dist/src/restoration-state-handler.js.map +1 -1
  26. package/dist/src/tiles/grid/search-tile.js +42 -42
  27. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  28. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
  29. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  30. package/dist/test/collection-browser.test.js +19 -9
  31. package/dist/test/collection-browser.test.js.map +1 -1
  32. package/dist/test/collection-facets/facet-row.test.js +23 -23
  33. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  34. package/dist/test/collection-facets.test.js +20 -20
  35. package/dist/test/collection-facets.test.js.map +1 -1
  36. package/dist/test/restoration-state-handler.test.js +5 -37
  37. package/dist/test/restoration-state-handler.test.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/collection-browser.ts +132 -7
  40. package/src/collection-facets/facet-row.ts +299 -296
  41. package/src/collection-facets/models.ts +10 -10
  42. package/src/collection-facets.ts +11 -0
  43. package/src/data-source/collection-browser-data-source-interface.ts +345 -333
  44. package/src/data-source/collection-browser-data-source.ts +59 -19
  45. package/src/data-source/collection-browser-query-state.ts +1 -7
  46. package/src/data-source/models.ts +13 -0
  47. package/src/manage/manage-bar.ts +247 -247
  48. package/src/models.ts +866 -870
  49. package/src/restoration-state-handler.ts +542 -544
  50. package/src/tiles/grid/search-tile.ts +90 -90
  51. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  52. package/test/collection-browser.test.ts +21 -11
  53. package/test/collection-facets/facet-row.test.ts +375 -375
  54. package/test/collection-facets.test.ts +928 -928
  55. package/test/restoration-state-handler.test.ts +480 -510
@@ -1,90 +1,90 @@
1
- import { css, CSSResultGroup, html, TemplateResult } from 'lit';
2
- import { customElement, property } from 'lit/decorators.js';
3
- import { baseTileStyles } from './styles/tile-grid-shared-styles';
4
- import { BaseTileComponent } from '../base-tile-component';
5
- import '../image-block';
6
-
7
- @customElement('search-tile')
8
- export class SearchTile extends BaseTileComponent {
9
- /*
10
- * Reactive properties inherited from BaseTileComponent:
11
- * - model?: TileModel;
12
- * - currentWidth?: number;
13
- * - currentHeight?: number;
14
- * - baseNavigationUrl?: string;
15
- * - baseImageUrl?: string;
16
- * - collectionPagePath?: string;
17
- * - sortParam: SortParam | null = null;
18
- * - creatorFilter?: string;
19
- * - mobileBreakpoint?: number;
20
- * - loggedIn = false;
21
- * - suppressBlurring = false;
22
- */
23
-
24
- @property({ type: Boolean }) showInfoButton = false;
25
-
26
- render() {
27
- return html`
28
- <div class="container">
29
- <div class="tile-details">
30
- <div class="item-info">
31
- ${this.getImageBlockTemplate} ${this.getTitleTemplate}
32
- </div>
33
- </div>
34
- </div>
35
- `;
36
- }
37
-
38
- private get getImageBlockTemplate(): TemplateResult {
39
- return html`
40
- <image-block
41
- .model=${this.model}
42
- .baseImageUrl=${this.baseImageUrl}
43
- .viewSize=${'grid'}
44
- .suppressBlurring=${this.suppressBlurring}
45
- >
46
- </image-block>
47
- `;
48
- }
49
-
50
- private get getTitleTemplate() {
51
- return html`<div id="title">
52
- <h3 class="truncated">${this.model?.title}</h3>
53
- </div>`;
54
- }
55
-
56
- static get styles(): CSSResultGroup {
57
- const tileBorderColor = css`var(--tileBorderColor, #555555)`;
58
- const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;
59
- const whiteColor = css`#fff`;
60
-
61
- return [
62
- baseTileStyles,
63
- css`
64
- .container {
65
- background-color: ${tileBackgroundColor};
66
- border: 1px solid ${tileBorderColor};
67
- }
68
-
69
- .item-info {
70
- flex-grow: initial;
71
- }
72
-
73
- h4.truncated,
74
- h3.truncated {
75
- color: ${whiteColor};
76
- -webkit-line-clamp: 4;
77
- }
78
-
79
- .container:hover > #title {
80
- text-decoration: underline;
81
- }
82
-
83
- /* this is a workaround for Safari 15 where the hover effects are not working */
84
- image-block:hover > #title {
85
- text-decoration: underline;
86
- }
87
- `,
88
- ];
89
- }
90
- }
1
+ import { css, CSSResultGroup, html, TemplateResult } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { baseTileStyles } from './styles/tile-grid-shared-styles';
4
+ import { BaseTileComponent } from '../base-tile-component';
5
+ import '../image-block';
6
+
7
+ @customElement('search-tile')
8
+ export class SearchTile extends BaseTileComponent {
9
+ /*
10
+ * Reactive properties inherited from BaseTileComponent:
11
+ * - model?: TileModel;
12
+ * - currentWidth?: number;
13
+ * - currentHeight?: number;
14
+ * - baseNavigationUrl?: string;
15
+ * - baseImageUrl?: string;
16
+ * - collectionPagePath?: string;
17
+ * - sortParam: SortParam | null = null;
18
+ * - creatorFilter?: string;
19
+ * - mobileBreakpoint?: number;
20
+ * - loggedIn = false;
21
+ * - suppressBlurring = false;
22
+ */
23
+
24
+ @property({ type: Boolean }) showInfoButton = false;
25
+
26
+ render() {
27
+ return html`
28
+ <div class="container">
29
+ <div class="tile-details">
30
+ <div class="item-info">
31
+ ${this.getImageBlockTemplate} ${this.getTitleTemplate}
32
+ </div>
33
+ </div>
34
+ </div>
35
+ `;
36
+ }
37
+
38
+ private get getImageBlockTemplate(): TemplateResult {
39
+ return html`
40
+ <image-block
41
+ .model=${this.model}
42
+ .baseImageUrl=${this.baseImageUrl}
43
+ .viewSize=${'grid'}
44
+ .suppressBlurring=${this.suppressBlurring}
45
+ >
46
+ </image-block>
47
+ `;
48
+ }
49
+
50
+ private get getTitleTemplate() {
51
+ return html`<div id="title">
52
+ <h3 class="truncated">${this.model?.title}</h3>
53
+ </div>`;
54
+ }
55
+
56
+ static get styles(): CSSResultGroup {
57
+ const tileBorderColor = css`var(--tileBorderColor, #555555)`;
58
+ const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;
59
+ const whiteColor = css`#fff`;
60
+
61
+ return [
62
+ baseTileStyles,
63
+ css`
64
+ .container {
65
+ background-color: ${tileBackgroundColor};
66
+ border: 1px solid ${tileBorderColor};
67
+ }
68
+
69
+ .item-info {
70
+ flex-grow: initial;
71
+ }
72
+
73
+ h4.truncated,
74
+ h3.truncated {
75
+ color: ${whiteColor};
76
+ -webkit-line-clamp: 4;
77
+ }
78
+
79
+ .container:hover > #title {
80
+ text-decoration: underline;
81
+ }
82
+
83
+ /* this is a workaround for Safari 15 where the hover effects are not working */
84
+ image-block:hover > #title {
85
+ text-decoration: underline;
86
+ }
87
+ `,
88
+ ];
89
+ }
90
+ }
@@ -1,130 +1,130 @@
1
- import { css } from 'lit';
2
- import { srOnlyStyle } from '../../../styles/sr-only';
3
-
4
- /**
5
- * Base tile styles
6
- */
7
-
8
- const tileBackgroundColor = css`var(--tileBackgroundColor, #ffffff)`;
9
- const tileCornerRadius = css`var(--tileCornerRadius, 4px)`;
10
-
11
- export const baseTileStyles = css`
12
- /* Include .sr-only styles for all tiles */
13
- ${srOnlyStyle}
14
-
15
- .container {
16
- background-color: ${tileBackgroundColor};
17
- border: 1px #2c2c2c;
18
- border-radius: ${tileCornerRadius};
19
- box-shadow: var(--tileBoxShadow, 1px 1px 2px 0);
20
- box-sizing: border-box;
21
- height: 100%;
22
- display: flex;
23
- flex-direction: column;
24
- width: 100%;
25
- }
26
-
27
- image-block {
28
- display: block;
29
- position: relative;
30
- text-align: center;
31
- }
32
-
33
- .tile-details {
34
- display: flex;
35
- flex-direction: column;
36
- height: 100%;
37
- row-gap: 10px;
38
- font-family: 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;
39
- }
40
-
41
- .item-info {
42
- display: flex;
43
- flex-direction: column;
44
- row-gap: 5px;
45
- flex-grow: 1;
46
- }
47
-
48
- #title {
49
- padding: 0 5px;
50
- }
51
-
52
- .created-by,
53
- .date-sorted-by,
54
- .volume-issue,
55
- .archivist-since {
56
- display: flex;
57
- justify-content: left;
58
- align-items: flex-start;
59
- padding: 0 5px;
60
- }
61
-
62
- .truncated {
63
- flex: 1;
64
- color: #2c2c2c;
65
- min-width: 0; /* Important for long words! */
66
- text-align: left;
67
- line-height: 15px;
68
- text-overflow: ellipsis;
69
- overflow: hidden;
70
- word-wrap: break-word;
71
- -webkit-line-clamp: 3;
72
- -webkit-box-orient: vertical;
73
- }
74
-
75
- h4.truncated,
76
- h3.truncated {
77
- display: -webkit-box;
78
- margin: 0px;
79
- line-height: 15px;
80
- font-size: 14px;
81
- font-weight: 500;
82
- padding-bottom: 1px;
83
- }
84
-
85
- span {
86
- display: -webkit-box;
87
- font-size: 1.4rem;
88
- line-height: 15px;
89
- overflow: hidden;
90
- word-wrap: break-word;
91
- -webkit-line-clamp: 1;
92
- -webkit-box-orient: vertical;
93
- padding-bottom: 1px;
94
- }
95
-
96
- .container:hover > .tile-details > .item-info > #title > .truncated {
97
- text-decoration: underline;
98
- }
99
-
100
- /** this is a workaround for Safari 15 where the hover effects are not working */
101
- #title:hover > .truncated {
102
- text-decoration: underline;
103
- }
104
-
105
- .info-button {
106
- position: absolute;
107
- right: 10px;
108
- top: 10px;
109
- margin: 0;
110
- padding: 0;
111
- border: none;
112
- border-radius: 50%;
113
- display: flex;
114
- justify-content: center;
115
- align-items: center;
116
- background: rgba(220, 220, 220, 0.5);
117
- color: white;
118
- font-size: 2.4rem;
119
- font-weight: bold;
120
- line-height: 1;
121
- text-shadow: black 1px 1px 3px;
122
- overflow: visible;
123
- aspect-ratio: 1 / 1;
124
- z-index: 1;
125
- }
126
-
127
- .hidden {
128
- display: none;
129
- }
130
- `;
1
+ import { css } from 'lit';
2
+ import { srOnlyStyle } from '../../../styles/sr-only';
3
+
4
+ /**
5
+ * Base tile styles
6
+ */
7
+
8
+ const tileBackgroundColor = css`var(--tileBackgroundColor, #ffffff)`;
9
+ const tileCornerRadius = css`var(--tileCornerRadius, 4px)`;
10
+
11
+ export const baseTileStyles = css`
12
+ /* Include .sr-only styles for all tiles */
13
+ ${srOnlyStyle}
14
+
15
+ .container {
16
+ background-color: ${tileBackgroundColor};
17
+ border: 1px #2c2c2c;
18
+ border-radius: ${tileCornerRadius};
19
+ box-shadow: var(--tileBoxShadow, 1px 1px 2px 0);
20
+ box-sizing: border-box;
21
+ height: 100%;
22
+ display: flex;
23
+ flex-direction: column;
24
+ width: 100%;
25
+ }
26
+
27
+ image-block {
28
+ display: block;
29
+ position: relative;
30
+ text-align: center;
31
+ }
32
+
33
+ .tile-details {
34
+ display: flex;
35
+ flex-direction: column;
36
+ height: 100%;
37
+ row-gap: 10px;
38
+ font-family: 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;
39
+ }
40
+
41
+ .item-info {
42
+ display: flex;
43
+ flex-direction: column;
44
+ row-gap: 5px;
45
+ flex-grow: 1;
46
+ }
47
+
48
+ #title {
49
+ padding: 0 5px;
50
+ }
51
+
52
+ .created-by,
53
+ .date-sorted-by,
54
+ .volume-issue,
55
+ .archivist-since {
56
+ display: flex;
57
+ justify-content: left;
58
+ align-items: flex-start;
59
+ padding: 0 5px;
60
+ }
61
+
62
+ .truncated {
63
+ flex: 1;
64
+ color: #2c2c2c;
65
+ min-width: 0; /* Important for long words! */
66
+ text-align: left;
67
+ line-height: 15px;
68
+ text-overflow: ellipsis;
69
+ overflow: hidden;
70
+ word-wrap: break-word;
71
+ -webkit-line-clamp: 3;
72
+ -webkit-box-orient: vertical;
73
+ }
74
+
75
+ h4.truncated,
76
+ h3.truncated {
77
+ display: -webkit-box;
78
+ margin: 0px;
79
+ line-height: 15px;
80
+ font-size: 14px;
81
+ font-weight: 500;
82
+ padding-bottom: 1px;
83
+ }
84
+
85
+ span {
86
+ display: -webkit-box;
87
+ font-size: 1.4rem;
88
+ line-height: 15px;
89
+ overflow: hidden;
90
+ word-wrap: break-word;
91
+ -webkit-line-clamp: 1;
92
+ -webkit-box-orient: vertical;
93
+ padding-bottom: 1px;
94
+ }
95
+
96
+ .container:hover > .tile-details > .item-info > #title > .truncated {
97
+ text-decoration: underline;
98
+ }
99
+
100
+ /** this is a workaround for Safari 15 where the hover effects are not working */
101
+ #title:hover > .truncated {
102
+ text-decoration: underline;
103
+ }
104
+
105
+ .info-button {
106
+ position: absolute;
107
+ right: 10px;
108
+ top: 10px;
109
+ margin: 0;
110
+ padding: 0;
111
+ border: none;
112
+ border-radius: 50%;
113
+ display: flex;
114
+ justify-content: center;
115
+ align-items: center;
116
+ background: rgba(220, 220, 220, 0.5);
117
+ color: white;
118
+ font-size: 2.4rem;
119
+ font-weight: bold;
120
+ line-height: 1;
121
+ text-shadow: black 1px 1px 3px;
122
+ overflow: visible;
123
+ aspect-ratio: 1 / 1;
124
+ z-index: 1;
125
+ }
126
+
127
+ .hidden {
128
+ display: none;
129
+ }
130
+ `;
@@ -1087,7 +1087,7 @@ describe('Collection Browser', () => {
1087
1087
  });
1088
1088
  });
1089
1089
 
1090
- it('applies correct search filter when TV clip filter set to commercials', async () => {
1090
+ it('applies correct TV search filter for commercials', async () => {
1091
1091
  const searchService = new MockSearchService();
1092
1092
  const el = await fixture<CollectionBrowser>(
1093
1093
  html`<collection-browser .searchService=${searchService}>
@@ -1096,16 +1096,20 @@ describe('Collection Browser', () => {
1096
1096
 
1097
1097
  el.baseQuery = 'tv-fields';
1098
1098
  el.searchType = SearchType.TV;
1099
- el.tvClipFilter = 'commercials';
1099
+ el.selectedFacets = {
1100
+ clip_type: {
1101
+ commercial: { key: 'commercial', count: 1, state: 'selected' },
1102
+ },
1103
+ };
1100
1104
  await el.updateComplete;
1101
1105
  await el.initialSearchComplete;
1102
1106
 
1103
- expect(searchService.searchParams?.filters?.ad_id?.['*']).to.equal(
1107
+ expect(searchService.searchParams?.filters?.clip_type?.commercial).to.equal(
1104
1108
  FilterConstraint.INCLUDE,
1105
1109
  );
1106
1110
  });
1107
1111
 
1108
- it('applies correct search filter when TV clip filter set to factchecks', async () => {
1112
+ it('applies correct TV search filter for fact checks', async () => {
1109
1113
  const searchService = new MockSearchService();
1110
1114
  const el = await fixture<CollectionBrowser>(
1111
1115
  html`<collection-browser .searchService=${searchService}>
@@ -1114,16 +1118,20 @@ describe('Collection Browser', () => {
1114
1118
 
1115
1119
  el.baseQuery = 'tv-fields';
1116
1120
  el.searchType = SearchType.TV;
1117
- el.tvClipFilter = 'factchecks';
1121
+ el.selectedFacets = {
1122
+ clip_type: {
1123
+ 'fact check': { key: 'fact check', count: 1, state: 'selected' },
1124
+ },
1125
+ };
1118
1126
  await el.updateComplete;
1119
1127
  await el.initialSearchComplete;
1120
1128
 
1121
- expect(searchService.searchParams?.filters?.factcheck?.['*']).to.equal(
1122
- FilterConstraint.INCLUDE,
1123
- );
1129
+ expect(
1130
+ searchService.searchParams?.filters?.clip_type?.['fact check'],
1131
+ ).to.equal(FilterConstraint.INCLUDE);
1124
1132
  });
1125
1133
 
1126
- it('applies correct search filter when TV clip filter set to quotes', async () => {
1134
+ it('applies correct TV search filter for quotes', async () => {
1127
1135
  const searchService = new MockSearchService();
1128
1136
  const el = await fixture<CollectionBrowser>(
1129
1137
  html`<collection-browser .searchService=${searchService}>
@@ -1132,11 +1140,13 @@ describe('Collection Browser', () => {
1132
1140
 
1133
1141
  el.baseQuery = 'tv-fields';
1134
1142
  el.searchType = SearchType.TV;
1135
- el.tvClipFilter = 'quotes';
1143
+ el.selectedFacets = {
1144
+ clip_type: { quote: { key: 'quote', count: 1, state: 'selected' } },
1145
+ };
1136
1146
  await el.updateComplete;
1137
1147
  await el.initialSearchComplete;
1138
1148
 
1139
- expect(searchService.searchParams?.filters?.clip?.['1']).to.equal(
1149
+ expect(searchService.searchParams?.filters?.clip_type?.quote).to.equal(
1140
1150
  FilterConstraint.INCLUDE,
1141
1151
  );
1142
1152
  });