@internetarchive/collection-browser 0.4.3-alpha.9 → 0.4.4-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +29 -29
- package/.github/workflows/ci.yml +26 -26
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +4 -4
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/src/app-root.d.ts +50 -48
- package/dist/src/app-root.js +449 -412
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-left.js +2 -2
- package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-right.js +2 -2
- package/dist/src/assets/img/icons/chevron.d.ts +2 -2
- package/dist/src/assets/img/icons/chevron.js +2 -2
- package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
- package/dist/src/assets/img/icons/empty-query.js +2 -2
- package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
- package/dist/src/assets/img/icons/eye-closed.js +2 -2
- package/dist/src/assets/img/icons/eye.d.ts +2 -2
- package/dist/src/assets/img/icons/eye.js +2 -2
- package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-filled.js +2 -2
- package/dist/src/assets/img/icons/login-required.d.ts +1 -1
- package/dist/src/assets/img/icons/login-required.js +2 -2
- package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/account.js +2 -2
- package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
- package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/data.js +2 -2
- package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
- package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/film.js +2 -2
- package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/images.js +2 -2
- package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/software.js +2 -2
- package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
- package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
- package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/video.js +2 -2
- package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/web.js +2 -2
- package/dist/src/assets/img/icons/null-result.d.ts +2 -2
- package/dist/src/assets/img/icons/null-result.js +2 -2
- package/dist/src/assets/img/icons/restricted.d.ts +1 -1
- package/dist/src/assets/img/icons/restricted.js +2 -2
- package/dist/src/assets/img/icons/reviews.d.ts +1 -1
- package/dist/src/assets/img/icons/reviews.js +2 -2
- package/dist/src/assets/img/icons/upload.d.ts +1 -1
- package/dist/src/assets/img/icons/upload.js +2 -2
- package/dist/src/assets/img/icons/views.d.ts +1 -1
- package/dist/src/assets/img/icons/views.js +2 -2
- package/dist/src/circular-activity-indicator.d.ts +5 -5
- package/dist/src/circular-activity-indicator.js +17 -17
- package/dist/src/collection-browser.d.ts +315 -276
- package/dist/src/collection-browser.js +1276 -1179
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
- package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
- package/dist/src/collection-facets/facets-template.d.ts +16 -16
- package/dist/src/collection-facets/facets-template.js +125 -125
- package/dist/src/collection-facets/more-facets-content.d.ts +77 -77
- package/dist/src/collection-facets/more-facets-content.js +357 -357
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +192 -192
- package/dist/src/collection-facets.d.ts +78 -78
- package/dist/src/collection-facets.js +391 -391
- package/dist/src/empty-placeholder.d.ts +11 -11
- package/dist/src/empty-placeholder.js +42 -42
- package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
- package/dist/src/language-code-handler/language-code-handler.js +26 -26
- package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
- package/dist/src/language-code-handler/language-code-mapping.js +562 -562
- package/dist/src/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +85 -85
- package/dist/src/models.d.ts +114 -112
- package/dist/src/models.js +125 -125
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +45 -45
- package/dist/src/restoration-state-handler.js +230 -230
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +12 -12
- package/dist/src/sort-filter-bar/alpha-bar.js +52 -52
- package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/compact.js +2 -2
- package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/list.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
- package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/tile.js +2 -2
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +108 -108
- package/dist/src/sort-filter-bar/sort-filter-bar.js +428 -428
- package/dist/src/styles/item-image-styles.d.ts +8 -8
- package/dist/src/styles/item-image-styles.js +22 -12
- package/dist/src/styles/item-image-styles.js.map +1 -1
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
- package/dist/src/tiles/collection-browser-loading-tile.js +16 -16
- package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.d.ts +17 -17
- package/dist/src/tiles/grid/account-tile.js +48 -47
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.d.ts +14 -7
- package/dist/src/tiles/grid/collection-tile.js +112 -146
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +29 -29
- package/dist/src/tiles/grid/item-tile.js +110 -105
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +12 -8
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
- package/dist/src/tiles/grid/tile-stats.js +41 -40
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +76 -72
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.d.ts +35 -35
- package/dist/src/tiles/item-image.js +117 -116
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/account-label.d.ts +1 -1
- package/dist/src/tiles/list/account-label.js +6 -6
- package/dist/src/tiles/list/date-label.d.ts +1 -1
- package/dist/src/tiles/list/date-label.js +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
- package/dist/src/tiles/list/tile-list-compact.d.ts +21 -21
- package/dist/src/tiles/list/tile-list-compact.js +93 -93
- package/dist/src/tiles/list/tile-list.d.ts +53 -53
- package/dist/src/tiles/list/tile-list.js +279 -279
- package/dist/src/tiles/mediatype-icon.d.ts +9 -9
- package/dist/src/tiles/mediatype-icon.js +47 -47
- package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
- package/dist/src/tiles/overlay/icon-overlay.js +40 -40
- package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
- package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
- package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
- package/dist/src/tiles/overlay/text-overlay.js +42 -42
- package/dist/src/tiles/text-snippet-block.d.ts +27 -27
- package/dist/src/tiles/text-snippet-block.js +73 -73
- package/dist/src/tiles/tile-dispatcher.d.ts +36 -36
- package/dist/src/tiles/tile-dispatcher.js +145 -128
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/utils/analytics-events.d.ts +22 -22
- package/dist/src/utils/analytics-events.js +24 -24
- package/dist/src/utils/format-count.d.ts +7 -7
- package/dist/src/utils/format-count.js +76 -76
- package/dist/src/utils/format-date.d.ts +2 -2
- package/dist/src/utils/format-date.js +23 -23
- package/dist/src/utils/format-unit-size.d.ts +2 -0
- package/dist/src/utils/format-unit-size.js +34 -0
- package/dist/src/utils/format-unit-size.js.map +1 -0
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +646 -646
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +62 -62
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +114 -114
- package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +544 -544
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +33 -33
- package/dist/test/icon-overlay.test.d.ts +1 -1
- package/dist/test/icon-overlay.test.js +24 -24
- package/dist/test/image-block.test.d.ts +1 -1
- package/dist/test/image-block.test.js +48 -48
- package/dist/test/item-image.test.d.ts +1 -1
- package/dist/test/item-image.test.js +84 -80
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/mediatype-config.test.d.ts +1 -1
- package/dist/test/mediatype-config.test.js +16 -16
- package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
- package/dist/test/mocks/mock-analytics-handler.js +15 -15
- package/dist/test/mocks/mock-collection-name-cache.d.ts +7 -7
- package/dist/test/mocks/mock-collection-name-cache.js +13 -13
- package/dist/test/mocks/mock-search-responses.d.ts +12 -12
- package/dist/test/mocks/mock-search-responses.js +341 -341
- package/dist/test/mocks/mock-search-service.d.ts +13 -13
- package/dist/test/mocks/mock-search-service.js +40 -40
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +125 -125
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +43 -43
- package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +141 -141
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +48 -48
- package/dist/test/text-snippet-block.test.d.ts +1 -1
- package/dist/test/text-snippet-block.test.js +57 -57
- package/dist/test/tile-stats.test.d.ts +1 -1
- package/dist/test/tile-stats.test.js +33 -33
- package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +60 -60
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -0
- package/dist/test/tiles/grid/collection-tile.test.js +73 -0
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -0
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +142 -129
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +92 -92
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +123 -123
- package/dist/test/utils/format-count.test.d.ts +1 -1
- package/dist/test/utils/format-count.test.js +23 -23
- package/dist/test/utils/format-date.test.d.ts +1 -1
- package/dist/test/utils/format-date.test.js +17 -17
- package/dist/test/utils/format-unit-size.test.d.ts +1 -0
- package/dist/test/utils/format-unit-size.test.js +18 -0
- package/dist/test/utils/format-unit-size.test.js.map +1 -0
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +2 -2
- package/renovate.json +6 -6
- package/src/app-root.ts +214 -169
- package/src/collection-browser.ts +122 -3
- package/src/models.ts +2 -0
- package/src/styles/item-image-styles.ts +13 -3
- package/src/tiles/collection-browser-loading-tile.ts +1 -1
- package/src/tiles/grid/account-tile.ts +4 -2
- package/src/tiles/grid/collection-tile.ts +106 -136
- package/src/tiles/grid/item-tile.ts +8 -2
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +6 -2
- package/src/tiles/grid/tile-stats.ts +1 -0
- package/src/tiles/image-block.ts +5 -2
- package/src/tiles/item-image.ts +4 -3
- package/src/tiles/tile-dispatcher.ts +17 -0
- package/src/utils/format-unit-size.ts +43 -0
- package/test/item-image.test.ts +4 -0
- package/test/tiles/grid/collection-tile.test.ts +85 -0
- package/test/tiles/grid/item-tile.test.ts +30 -4
- package/test/utils/format-unit-size.test.ts +21 -0
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
package/src/app-root.ts
CHANGED
|
@@ -113,188 +113,198 @@ export class AppRoot extends LitElement {
|
|
|
113
113
|
this.collectionBrowser.baseQuery = this.searchQuery;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
private get getClass() {
|
|
117
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
118
|
+
|
|
119
|
+
return searchParams.get('hide-dev-tools') ? 'hidden' : '';
|
|
120
|
+
}
|
|
121
|
+
|
|
116
122
|
render() {
|
|
117
123
|
return html`
|
|
118
|
-
<div
|
|
119
|
-
<div id="
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
124
|
+
<div class="dev-tool-container">
|
|
125
|
+
<div id="dev-tools" class=${this.getClass}>
|
|
126
|
+
<div id="search-and-page-inputs">
|
|
127
|
+
<form @submit=${this.searchPressed}>
|
|
128
|
+
Query:
|
|
129
|
+
<input
|
|
130
|
+
type="text"
|
|
131
|
+
id="base-query-field"
|
|
132
|
+
.value=${this.searchQuery ?? ''}
|
|
133
|
+
/>
|
|
134
|
+
<input type="submit" value="Search" />
|
|
135
|
+
</form>
|
|
136
|
+
<form @submit=${this.changePagePressed}>
|
|
137
|
+
Page: <input type="number" value="1" id="page-number-input" />
|
|
138
|
+
<input type="submit" value="Go" />
|
|
139
|
+
</form>
|
|
140
|
+
</div>
|
|
134
141
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
142
|
+
<div id="search-types">
|
|
143
|
+
Search type:
|
|
144
|
+
<span class="search-type">
|
|
145
|
+
<input
|
|
146
|
+
type="radio"
|
|
147
|
+
id="metadata-search"
|
|
148
|
+
name="search-type"
|
|
149
|
+
value="metadata"
|
|
150
|
+
?checked=${this.searchType === SearchType.METADATA}
|
|
151
|
+
@click=${this.searchTypeSelected}
|
|
152
|
+
/>
|
|
153
|
+
<label for="metadata-search">Metadata</label>
|
|
154
|
+
</span>
|
|
155
|
+
<span class="search-type">
|
|
156
|
+
<input
|
|
157
|
+
type="radio"
|
|
158
|
+
id="fulltext-search"
|
|
159
|
+
name="search-type"
|
|
160
|
+
value="fulltext"
|
|
161
|
+
?checked=${this.searchType === SearchType.FULLTEXT}
|
|
162
|
+
@click=${this.searchTypeSelected}
|
|
163
|
+
/>
|
|
164
|
+
<label for="fulltext-search">Full text</label>
|
|
165
|
+
</span>
|
|
166
|
+
</div>
|
|
160
167
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
168
|
+
<div id="toggle-controls">
|
|
169
|
+
<button
|
|
170
|
+
@click=${() => {
|
|
171
|
+
const details =
|
|
172
|
+
this.shadowRoot?.getElementById('cell-size-control');
|
|
173
|
+
details?.classList.toggle('hidden');
|
|
174
|
+
const rowGapControls =
|
|
175
|
+
this.shadowRoot?.getElementById('cell-gap-control');
|
|
176
|
+
rowGapControls?.classList.toggle('hidden');
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
Toggle Cell Controls
|
|
180
|
+
</button>
|
|
181
|
+
<button
|
|
182
|
+
@click=${() => {
|
|
183
|
+
const details = this.shadowRoot?.getElementById(
|
|
184
|
+
'latest-event-details'
|
|
185
|
+
);
|
|
186
|
+
details?.classList.toggle('hidden');
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
Last Event Captured
|
|
190
|
+
</button>
|
|
191
|
+
</div>
|
|
185
192
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
193
|
+
<div id="last-event">
|
|
194
|
+
<pre id="latest-event-details" class="hidden">
|
|
195
|
+
${JSON.stringify(this.latestAction, null, 2)}
|
|
196
|
+
</pre
|
|
197
|
+
>
|
|
198
|
+
</div>
|
|
192
199
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
200
|
+
<div id="cell-controls" class="hidden">
|
|
201
|
+
<div id="cell-size-control">
|
|
202
|
+
<div>
|
|
203
|
+
<label for="cell-width-slider">Min cell width:</label>
|
|
204
|
+
<input
|
|
205
|
+
type="range"
|
|
206
|
+
min="10"
|
|
207
|
+
max="100"
|
|
208
|
+
value="18"
|
|
209
|
+
step="0.1"
|
|
210
|
+
id="cell-width-slider"
|
|
211
|
+
@input=${this.widthChanged}
|
|
212
|
+
/>
|
|
213
|
+
<span>${this.cellWidth}rem</span>
|
|
214
|
+
</div>
|
|
215
|
+
<div>
|
|
216
|
+
<label for="cell-height-slider">Cell height:</label>
|
|
217
|
+
<input
|
|
218
|
+
type="range"
|
|
219
|
+
min="10"
|
|
220
|
+
max="100"
|
|
221
|
+
value="29"
|
|
222
|
+
step="0.1"
|
|
223
|
+
id="cell-height-slider"
|
|
224
|
+
@input=${this.heightChanged}
|
|
225
|
+
/>
|
|
226
|
+
<span>${this.cellHeight}rem</span>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
<div id="cell-gap-control">
|
|
230
|
+
<div>
|
|
231
|
+
<label for="cell-row-gap-slider">Row gap:</label>
|
|
232
|
+
<input
|
|
233
|
+
type="range"
|
|
234
|
+
min="0"
|
|
235
|
+
max="5"
|
|
236
|
+
value="1.7"
|
|
237
|
+
step="0.1"
|
|
238
|
+
id="cell-row-gap-slider"
|
|
239
|
+
@input=${this.rowGapChanged}
|
|
240
|
+
/>
|
|
241
|
+
<span>${this.rowGap}rem</span>
|
|
242
|
+
</div>
|
|
243
|
+
<div>
|
|
244
|
+
<label for="cell-col-gap-slider">Col gap:</label>
|
|
245
|
+
<input
|
|
246
|
+
type="range"
|
|
247
|
+
min="0"
|
|
248
|
+
max="5"
|
|
249
|
+
value="1.7"
|
|
250
|
+
step="0.1"
|
|
251
|
+
id="cell-col-gap-slider"
|
|
252
|
+
@input=${this.colGapChanged}
|
|
253
|
+
/>
|
|
254
|
+
<span>${this.colGap}rem</span>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
<div id="checkbox-controls">
|
|
259
|
+
<div class="checkbox-control">
|
|
197
260
|
<input
|
|
198
|
-
type="
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
value="18"
|
|
202
|
-
step="0.1"
|
|
203
|
-
id="cell-width-slider"
|
|
204
|
-
@input=${this.widthChanged}
|
|
261
|
+
type="checkbox"
|
|
262
|
+
id="show-outline-check"
|
|
263
|
+
@click=${this.outlineChanged}
|
|
205
264
|
/>
|
|
206
|
-
<
|
|
265
|
+
<label for="show-outline-check">Show cell outlines</label>
|
|
207
266
|
</div>
|
|
208
|
-
<div>
|
|
209
|
-
<label for="cell-height-slider">Cell height:</label>
|
|
267
|
+
<div class="checkbox-control">
|
|
210
268
|
<input
|
|
211
|
-
type="
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
value="29"
|
|
215
|
-
step="0.1"
|
|
216
|
-
id="cell-height-slider"
|
|
217
|
-
@input=${this.heightChanged}
|
|
269
|
+
type="checkbox"
|
|
270
|
+
id="show-facet-group-outline-check"
|
|
271
|
+
@click=${this.toggleFacetGroupOutline}
|
|
218
272
|
/>
|
|
219
|
-
<
|
|
273
|
+
<label for="show-facet-group-outline-check">
|
|
274
|
+
Show facet group outlines
|
|
275
|
+
</label>
|
|
220
276
|
</div>
|
|
221
|
-
|
|
222
|
-
<div id="cell-gap-control">
|
|
223
|
-
<div>
|
|
224
|
-
<label for="cell-row-gap-slider">Row gap:</label>
|
|
277
|
+
<div class="checkbox-control">
|
|
225
278
|
<input
|
|
226
|
-
type="
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
value="1.7"
|
|
230
|
-
step="0.1"
|
|
231
|
-
id="cell-row-gap-slider"
|
|
232
|
-
@input=${this.rowGapChanged}
|
|
279
|
+
type="checkbox"
|
|
280
|
+
id="simulate-login"
|
|
281
|
+
@click=${this.loginChanged}
|
|
233
282
|
/>
|
|
234
|
-
<
|
|
283
|
+
<label for="simulate-login">Simulate login</label>
|
|
235
284
|
</div>
|
|
236
|
-
<div>
|
|
237
|
-
<label for="cell-col-gap-slider">Col gap:</label>
|
|
285
|
+
<div class="checkbox-control">
|
|
238
286
|
<input
|
|
239
|
-
type="
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
value="1.7"
|
|
243
|
-
step="0.1"
|
|
244
|
-
id="cell-col-gap-slider"
|
|
245
|
-
@input=${this.colGapChanged}
|
|
287
|
+
type="checkbox"
|
|
288
|
+
id="show-dummy-snippets"
|
|
289
|
+
@click=${this.snippetsChanged}
|
|
246
290
|
/>
|
|
247
|
-
<
|
|
291
|
+
<label for="show-dummy-snippets">Show dummy snippets</label>
|
|
292
|
+
</div>
|
|
293
|
+
<div class="checkbox-control">
|
|
294
|
+
<input
|
|
295
|
+
type="checkbox"
|
|
296
|
+
id="enable-date-picker"
|
|
297
|
+
checked
|
|
298
|
+
@click=${this.datePickerChanged}
|
|
299
|
+
/>
|
|
300
|
+
<label for="enable-date-picker">Enable date picker</label>
|
|
248
301
|
</div>
|
|
249
302
|
</div>
|
|
250
303
|
</div>
|
|
251
|
-
<
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
type="checkbox"
|
|
255
|
-
id="show-outline-check"
|
|
256
|
-
@click=${this.outlineChanged}
|
|
257
|
-
/>
|
|
258
|
-
<label for="show-outline-check">Show cell outlines</label>
|
|
259
|
-
</div>
|
|
260
|
-
<div class="checkbox-control">
|
|
261
|
-
<input
|
|
262
|
-
type="checkbox"
|
|
263
|
-
id="show-facet-group-outline-check"
|
|
264
|
-
@click=${this.toggleFacetGroupOutline}
|
|
265
|
-
/>
|
|
266
|
-
<label for="show-facet-group-outline-check">
|
|
267
|
-
Show facet group outlines
|
|
268
|
-
</label>
|
|
269
|
-
</div>
|
|
270
|
-
<div class="checkbox-control">
|
|
271
|
-
<input
|
|
272
|
-
type="checkbox"
|
|
273
|
-
id="simulate-login"
|
|
274
|
-
@click=${this.loginChanged}
|
|
275
|
-
/>
|
|
276
|
-
<label for="simulate-login">Simulate login</label>
|
|
277
|
-
</div>
|
|
278
|
-
<div class="checkbox-control">
|
|
279
|
-
<input
|
|
280
|
-
type="checkbox"
|
|
281
|
-
id="show-dummy-snippets"
|
|
282
|
-
@click=${this.snippetsChanged}
|
|
283
|
-
/>
|
|
284
|
-
<label for="show-dummy-snippets">Show dummy snippets</label>
|
|
285
|
-
</div>
|
|
286
|
-
<div class="checkbox-control">
|
|
287
|
-
<input
|
|
288
|
-
type="checkbox"
|
|
289
|
-
id="enable-date-picker"
|
|
290
|
-
checked
|
|
291
|
-
@click=${this.datePickerChanged}
|
|
292
|
-
/>
|
|
293
|
-
<label for="enable-date-picker">Enable date picker</label>
|
|
294
|
-
</div>
|
|
295
|
-
</div>
|
|
304
|
+
<button id="toggle-dev-tools-btn" @click=${this.toggleDevTools}>
|
|
305
|
+
Toggle Search Controls
|
|
306
|
+
</button>
|
|
296
307
|
</div>
|
|
297
|
-
|
|
298
308
|
<div id="collection-browser-container">
|
|
299
309
|
<collection-browser
|
|
300
310
|
.baseNavigationUrl=${'https://archive.org'}
|
|
@@ -319,7 +329,6 @@ export class AppRoot extends LitElement {
|
|
|
319
329
|
|
|
320
330
|
private baseQueryChanged(e: CustomEvent<{ baseQuery?: string }>): void {
|
|
321
331
|
this.searchQuery = e.detail.baseQuery;
|
|
322
|
-
this.collectionBrowser.clearFilters();
|
|
323
332
|
}
|
|
324
333
|
|
|
325
334
|
/** Handler for search type changes coming from collection browser */
|
|
@@ -360,6 +369,29 @@ export class AppRoot extends LitElement {
|
|
|
360
369
|
}
|
|
361
370
|
}
|
|
362
371
|
|
|
372
|
+
private toggleDevTools() {
|
|
373
|
+
const pageUrl = new URL(window.location.href);
|
|
374
|
+
const { searchParams } = pageUrl;
|
|
375
|
+
|
|
376
|
+
if (searchParams.get('hide-dev-tools')) {
|
|
377
|
+
searchParams.delete('hide-dev-tools');
|
|
378
|
+
} else {
|
|
379
|
+
searchParams.set('hide-dev-tools', 'true');
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
this.shadowRoot?.getElementById('dev-tools')?.classList.toggle('hidden');
|
|
383
|
+
|
|
384
|
+
if (window.history.replaceState) {
|
|
385
|
+
window.history.replaceState(
|
|
386
|
+
{
|
|
387
|
+
path: pageUrl.toString(),
|
|
388
|
+
},
|
|
389
|
+
'',
|
|
390
|
+
pageUrl.toString()
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
363
395
|
private toggleFacetGroupOutline(e: Event) {
|
|
364
396
|
const target = e.target as HTMLInputElement;
|
|
365
397
|
if (target.checked) {
|
|
@@ -511,10 +543,6 @@ export class AppRoot extends LitElement {
|
|
|
511
543
|
font-size: 1.6rem;
|
|
512
544
|
}
|
|
513
545
|
|
|
514
|
-
collection-browser {
|
|
515
|
-
margin-top: 20rem;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
546
|
modal-manager.showFacetGroupOutlines,
|
|
519
547
|
collection-browser.showFacetGroupOutlines {
|
|
520
548
|
--facet-row-border-top: 1px solid red;
|
|
@@ -525,8 +553,11 @@ export class AppRoot extends LitElement {
|
|
|
525
553
|
width: 300px;
|
|
526
554
|
}
|
|
527
555
|
|
|
556
|
+
.dev-tool-container {
|
|
557
|
+
position: relative;
|
|
558
|
+
}
|
|
528
559
|
#dev-tools {
|
|
529
|
-
position:
|
|
560
|
+
position: relative;
|
|
530
561
|
top: 0;
|
|
531
562
|
left: 0;
|
|
532
563
|
z-index: 1;
|
|
@@ -535,12 +566,27 @@ export class AppRoot extends LitElement {
|
|
|
535
566
|
padding: 0.5rem 1rem;
|
|
536
567
|
border: 1px solid black;
|
|
537
568
|
font-size: 1.4rem;
|
|
569
|
+
width: 75%;
|
|
570
|
+
background: #ffffffb3;
|
|
538
571
|
}
|
|
539
572
|
|
|
540
573
|
#dev-tools > * {
|
|
541
574
|
display: flex;
|
|
542
575
|
}
|
|
543
576
|
|
|
577
|
+
#toggle-dev-tools-btn {
|
|
578
|
+
position: fixed;
|
|
579
|
+
left: 77.4%;
|
|
580
|
+
top: 0;
|
|
581
|
+
background: red;
|
|
582
|
+
padding: 5px;
|
|
583
|
+
color: white;
|
|
584
|
+
font-size: 1.4rem;
|
|
585
|
+
margin: 0;
|
|
586
|
+
z-index: 1;
|
|
587
|
+
cursor: pointer;
|
|
588
|
+
}
|
|
589
|
+
|
|
544
590
|
#search-and-page-inputs > form {
|
|
545
591
|
margin-right: 1rem;
|
|
546
592
|
}
|
|
@@ -585,8 +631,7 @@ export class AppRoot extends LitElement {
|
|
|
585
631
|
}
|
|
586
632
|
|
|
587
633
|
.hidden {
|
|
588
|
-
|
|
589
|
-
display: none !important;
|
|
634
|
+
display: none;
|
|
590
635
|
}
|
|
591
636
|
|
|
592
637
|
#toggle-controls {
|
|
@@ -514,6 +514,10 @@ export class CollectionBrowser
|
|
|
514
514
|
this.selectedCreatorFilter = e.detail.selectedLetter;
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
+
private get facetDataLoading(): boolean {
|
|
518
|
+
return this.facetsLoading || this.fullYearAggregationLoading;
|
|
519
|
+
}
|
|
520
|
+
|
|
517
521
|
private get mobileFacetsTemplate() {
|
|
518
522
|
return html`
|
|
519
523
|
<div id="mobile-filter-collapse">
|
|
@@ -556,8 +560,8 @@ export class CollectionBrowser
|
|
|
556
560
|
.filterMap=${this.filterMap}
|
|
557
561
|
.modalManager=${this.modalManager}
|
|
558
562
|
?collapsableFacets=${this.mobileView}
|
|
559
|
-
?facetsLoading=${this.
|
|
560
|
-
?fullYearAggregationLoading=${this.
|
|
563
|
+
?facetsLoading=${this.facetDataLoading}
|
|
564
|
+
?fullYearAggregationLoading=${this.fullYearAggregationLoading}
|
|
561
565
|
.onFacetClick=${this.facetClickHandler}
|
|
562
566
|
.analyticsHandler=${this.analyticsHandler}
|
|
563
567
|
>
|
|
@@ -808,7 +812,12 @@ export class CollectionBrowser
|
|
|
808
812
|
this.historyPopOccurred = false;
|
|
809
813
|
}
|
|
810
814
|
|
|
811
|
-
await Promise.all([
|
|
815
|
+
await Promise.all([
|
|
816
|
+
this.doInitialPageFetch(),
|
|
817
|
+
this.fetchFacets(),
|
|
818
|
+
// Only fetch histogram data separately if we need it b/c of date filters
|
|
819
|
+
this.shouldRequestYearHistogram && this.fetchFullYearHistogram(),
|
|
820
|
+
]);
|
|
812
821
|
}
|
|
813
822
|
|
|
814
823
|
private setupStateRestorationObserver() {
|
|
@@ -986,6 +995,22 @@ export class CollectionBrowser
|
|
|
986
995
|
return fullQuery;
|
|
987
996
|
}
|
|
988
997
|
|
|
998
|
+
/** The full query without any year facets or date range clauses */
|
|
999
|
+
private get fullQueryWithoutDates(): string | undefined {
|
|
1000
|
+
if (!this.baseQuery) return undefined;
|
|
1001
|
+
let fullQuery = this.baseQuery;
|
|
1002
|
+
|
|
1003
|
+
const { facetQueryWithoutYear, sortFilterQueries } = this;
|
|
1004
|
+
|
|
1005
|
+
if (facetQueryWithoutYear) {
|
|
1006
|
+
fullQuery += ` AND ${facetQueryWithoutYear}`;
|
|
1007
|
+
}
|
|
1008
|
+
if (sortFilterQueries) {
|
|
1009
|
+
fullQuery += ` AND ${sortFilterQueries}`;
|
|
1010
|
+
}
|
|
1011
|
+
return fullQuery;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
989
1014
|
/**
|
|
990
1015
|
* Generates a query string for the given facets
|
|
991
1016
|
*
|
|
@@ -1002,6 +1027,24 @@ export class CollectionBrowser
|
|
|
1002
1027
|
return this.joinFacetClauses(facetClauses);
|
|
1003
1028
|
}
|
|
1004
1029
|
|
|
1030
|
+
/**
|
|
1031
|
+
* Generates a query string for the currently selected facets, excluding 'year' facets.
|
|
1032
|
+
*
|
|
1033
|
+
* Example: `mediatype:("collection" OR "audio" OR -"etree") AND subject:("foo" OR -"bar")`
|
|
1034
|
+
*/
|
|
1035
|
+
private get facetQueryWithoutYear(): string | undefined {
|
|
1036
|
+
if (!this.selectedFacets) return undefined;
|
|
1037
|
+
const facetClauses = [];
|
|
1038
|
+
for (const [facetName, facetValues] of Object.entries(
|
|
1039
|
+
this.selectedFacets
|
|
1040
|
+
)) {
|
|
1041
|
+
if (facetName !== 'year') {
|
|
1042
|
+
facetClauses.push(this.buildFacetClause(facetName, facetValues));
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
return this.joinFacetClauses(facetClauses);
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1005
1048
|
/**
|
|
1006
1049
|
* Builds an OR-joined facet clause for the given facet name and values.
|
|
1007
1050
|
*
|
|
@@ -1131,11 +1174,83 @@ export class CollectionBrowser
|
|
|
1131
1174
|
|
|
1132
1175
|
this.aggregations = results?.success?.response.aggregations;
|
|
1133
1176
|
|
|
1177
|
+
// If we're not fetching year histogram data separately, set it from the newly-fetched aggregations
|
|
1178
|
+
if (!this.shouldRequestYearHistogram) {
|
|
1179
|
+
this.fullYearsHistogramAggregation =
|
|
1180
|
+
results?.success?.response?.aggregations?.year_histogram ??
|
|
1181
|
+
results?.success?.response?.aggregations?.['year-histogram']; // Temp fix until PPS FTS key is fixed to use underscore
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* If we haven't changed the query, we don't need to fetch the full year histogram
|
|
1187
|
+
*
|
|
1188
|
+
* @private
|
|
1189
|
+
* @type {string}
|
|
1190
|
+
* @memberof CollectionBrowser
|
|
1191
|
+
*/
|
|
1192
|
+
private previousFullQueryNoDate?: string;
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* The query key is a string that uniquely identifies the current query
|
|
1196
|
+
* without the date range.
|
|
1197
|
+
*
|
|
1198
|
+
* If this doesn't change, we don't need to re-fetch the histogram date range
|
|
1199
|
+
*/
|
|
1200
|
+
private get fullQueryNoDateKey() {
|
|
1201
|
+
return `${this.fullQueryWithoutDates}-${this.searchType}-${this.sortParam?.field}-${this.sortParam?.direction}`;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* This method is similar to fetching the facets above,
|
|
1206
|
+
* but only fetching the year histogram. There is a subtle difference
|
|
1207
|
+
* in how you have to fetch the year histogram where you can't use the
|
|
1208
|
+
* advanced JSON syntax like the other aggregations. It's a special
|
|
1209
|
+
* case that @ximm put it place.
|
|
1210
|
+
*/
|
|
1211
|
+
private async fetchFullYearHistogram(): Promise<void> {
|
|
1212
|
+
const { fullQueryNoDateKey } = this;
|
|
1213
|
+
if (
|
|
1214
|
+
!this.fullQueryWithoutDates ||
|
|
1215
|
+
fullQueryNoDateKey === this.previousFullQueryNoDate
|
|
1216
|
+
) {
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
this.previousFullQueryNoDate = fullQueryNoDateKey;
|
|
1220
|
+
|
|
1221
|
+
const aggregations = {
|
|
1222
|
+
simpleParams: ['year'],
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
const params = {
|
|
1226
|
+
query: this.fullQueryWithoutDates,
|
|
1227
|
+
aggregations,
|
|
1228
|
+
rows: 0,
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
this.fullYearAggregationLoading = true;
|
|
1232
|
+
const results = await this.searchService?.search(params, this.searchType);
|
|
1233
|
+
this.fullYearAggregationLoading = false;
|
|
1234
|
+
|
|
1134
1235
|
this.fullYearsHistogramAggregation =
|
|
1135
1236
|
results?.success?.response?.aggregations?.year_histogram ??
|
|
1136
1237
|
results?.success?.response?.aggregations?.['year-histogram']; // Temp fix until PPS FTS key is fixed to use underscore
|
|
1137
1238
|
}
|
|
1138
1239
|
|
|
1240
|
+
/**
|
|
1241
|
+
* We only want to send a separate request for the year_histogram data
|
|
1242
|
+
* if (a) the date picker component is enabled and (b) there is a year facet or date-range filter applied.
|
|
1243
|
+
*
|
|
1244
|
+
* Otherwise, we should just be using the histogram data supplied by the "normal" facet request.
|
|
1245
|
+
*/
|
|
1246
|
+
private get shouldRequestYearHistogram() {
|
|
1247
|
+
const datePickerEnabled = this.showHistogramDatePicker;
|
|
1248
|
+
const hasDateRange = !!this.dateRangeQueryClause;
|
|
1249
|
+
const hasYearFacet =
|
|
1250
|
+
Object.keys(this.selectedFacets?.year ?? {}).length > 0;
|
|
1251
|
+
return datePickerEnabled && (hasDateRange || hasYearFacet);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1139
1254
|
private scrollToPage(pageNumber: number) {
|
|
1140
1255
|
const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
|
|
1141
1256
|
// without this setTimeout, Safari just pauses until the `fetchPage` is complete
|
|
@@ -1315,6 +1430,8 @@ export class CollectionBrowser
|
|
|
1315
1430
|
tiles.push({
|
|
1316
1431
|
averageRating: result.avg_rating?.value,
|
|
1317
1432
|
collections: result.collection?.values ?? [],
|
|
1433
|
+
collectionFilesCount: result.collection_files_count?.value ?? 0,
|
|
1434
|
+
collectionSize: result.collection_size?.value ?? 0,
|
|
1318
1435
|
commentCount: result.num_reviews?.value ?? 0,
|
|
1319
1436
|
creator: result.creator?.value,
|
|
1320
1437
|
creators: result.creator?.values ?? [],
|
|
@@ -1542,11 +1659,13 @@ export class CollectionBrowser
|
|
|
1542
1659
|
position: relative;
|
|
1543
1660
|
border-left: 1px solid rgb(232, 232, 232);
|
|
1544
1661
|
padding-left: 1rem;
|
|
1662
|
+
margin-bottom: 1.5rem; // add space in the bottom of infinite scroller
|
|
1545
1663
|
}
|
|
1546
1664
|
|
|
1547
1665
|
.mobile #right-column {
|
|
1548
1666
|
border-left: none;
|
|
1549
1667
|
padding: 0;
|
|
1668
|
+
margin-bottom: 1.5rem;
|
|
1550
1669
|
}
|
|
1551
1670
|
|
|
1552
1671
|
#left-column {
|
package/src/models.ts
CHANGED
|
@@ -4,7 +4,9 @@ export interface TileModel {
|
|
|
4
4
|
averageRating?: number;
|
|
5
5
|
collectionIdentifier?: string;
|
|
6
6
|
collectionName?: string;
|
|
7
|
+
collectionFilesCount: number;
|
|
7
8
|
collections: string[];
|
|
9
|
+
collectionSize: number;
|
|
8
10
|
commentCount: number;
|
|
9
11
|
creator?: string;
|
|
10
12
|
creators: string[];
|