@internetarchive/collection-browser 1.14.9-alpha.2 → 1.14.9-alpha10
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/.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 +73 -72
- package/dist/src/app-root.js +501 -429
- 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/contract.d.ts +2 -2
- package/dist/src/assets/img/icons/contract.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/expand.d.ts +2 -2
- package/dist/src/assets/img/icons/expand.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/search.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/search.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 +533 -533
- package/dist/src/collection-browser.js +1894 -1893
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.d.ts +30 -0
- package/dist/src/collection-facets/facet-row.js +245 -0
- package/dist/src/collection-facets/facet-row.js.map +1 -0
- 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 +17 -20
- package/dist/src/collection-facets/facets-template.js +122 -264
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.d.ts +77 -77
- package/dist/src/collection-facets/more-facets-content.js +359 -359
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +196 -196
- package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
- package/dist/src/collection-facets/toggle-switch.js +94 -94
- package/dist/src/collection-facets.d.ts +104 -104
- package/dist/src/collection-facets.js +506 -506
- package/dist/src/empty-placeholder.d.ts +23 -23
- package/dist/src/empty-placeholder.js +74 -74
- package/dist/src/expanded-date-picker.d.ts +43 -43
- package/dist/src/expanded-date-picker.js +109 -109
- 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/manage/manage-bar.d.ts +26 -26
- package/dist/src/manage/manage-bar.js +53 -53
- package/dist/src/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +91 -91
- package/dist/src/models.d.ts +180 -164
- package/dist/src/models.js +269 -269
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +70 -70
- package/dist/src/restoration-state-handler.js +355 -355
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
- package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
- 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-toggle-disabled.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-up.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 +208 -208
- package/dist/src/sort-filter-bar/sort-filter-bar.js +637 -637
- package/dist/src/styles/item-image-styles.d.ts +8 -8
- package/dist/src/styles/item-image-styles.js +9 -9
- package/dist/src/styles/sr-only.d.ts +1 -1
- package/dist/src/styles/sr-only.js +2 -2
- package/dist/src/tiles/base-tile-component.d.ts +19 -19
- package/dist/src/tiles/base-tile-component.js +63 -63
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
- package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
- package/dist/src/tiles/grid/account-tile.d.ts +18 -18
- package/dist/src/tiles/grid/account-tile.js +72 -72
- package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
- package/dist/src/tiles/grid/collection-tile.js +80 -80
- package/dist/src/tiles/grid/item-tile.d.ts +27 -27
- package/dist/src/tiles/grid/item-tile.js +134 -134
- package/dist/src/tiles/grid/search-tile.d.ts +10 -10
- package/dist/src/tiles/grid/search-tile.js +51 -51
- 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 +8 -8
- package/dist/src/tiles/grid/tile-stats.d.ts +11 -11
- package/dist/src/tiles/grid/tile-stats.js +48 -48
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
- package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
- package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
- package/dist/src/tiles/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +73 -73
- package/dist/src/tiles/item-image.d.ts +36 -36
- package/dist/src/tiles/item-image.js +127 -127
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -6
- package/dist/src/tiles/list/tile-list-compact-header.js +38 -38
- package/dist/src/tiles/list/tile-list-compact.d.ts +15 -15
- package/dist/src/tiles/list/tile-list-compact.js +114 -114
- package/dist/src/tiles/list/tile-list.d.ts +46 -46
- package/dist/src/tiles/list/tile-list.js +302 -302
- 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 +64 -64
- package/dist/src/tiles/tile-dispatcher.js +231 -231
- package/dist/src/tiles/tile-display-value-provider.d.ts +43 -43
- package/dist/src/tiles/tile-display-value-provider.js +80 -80
- package/dist/src/utils/analytics-events.d.ts +25 -25
- package/dist/src/utils/analytics-events.js +27 -27
- package/dist/src/utils/array-equals.d.ts +4 -4
- package/dist/src/utils/array-equals.js +10 -10
- 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 +25 -25
- package/dist/src/utils/format-unit-size.d.ts +2 -2
- package/dist/src/utils/format-unit-size.js +33 -33
- package/dist/src/utils/local-date-from-utc.d.ts +9 -9
- package/dist/src/utils/local-date-from-utc.js +15 -15
- package/dist/src/utils/sha1.d.ts +2 -2
- package/dist/src/utils/sha1.js +8 -8
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +1130 -1098
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.d.ts +1 -0
- package/dist/test/collection-facets/facet-row.test.js +235 -0
- package/dist/test/collection-facets/facet-row.test.js.map +1 -0
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +110 -141
- package/dist/test/collection-facets/facets-template.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +133 -133
- 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/toggle-switch.test.d.ts +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +73 -73
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +651 -682
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +63 -63
- package/dist/test/expanded-date-picker.test.d.ts +1 -1
- package/dist/test/expanded-date-picker.test.js +95 -95
- 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 +86 -86
- package/dist/test/manage/manage-bar.test.d.ts +1 -1
- package/dist/test/manage/manage-bar.test.js +72 -72
- 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 +9 -9
- package/dist/test/mocks/mock-collection-name-cache.js +17 -17
- package/dist/test/mocks/mock-search-responses.d.ts +21 -21
- package/dist/test/mocks/mock-search-responses.js +709 -709
- package/dist/test/mocks/mock-search-service.d.ts +15 -15
- package/dist/test/mocks/mock-search-service.js +50 -50
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +270 -270
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
- 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 +378 -378
- 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 +76 -76
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +73 -73
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +254 -254
- package/dist/test/tiles/grid/search-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +51 -51
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +258 -258
- package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
- package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +242 -242
- package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +94 -94
- package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -1
- package/dist/test/tiles/tile-display-value-provider.test.js +141 -141
- package/dist/test/utils/array-equals.test.d.ts +1 -1
- package/dist/test/utils/array-equals.test.js +26 -26
- 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 -1
- package/dist/test/utils/format-unit-size.test.js +17 -17
- package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
- package/dist/test/utils/local-date-from-utc.test.js +26 -26
- 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 +159 -82
- package/src/collection-browser.ts +25 -22
- package/src/collection-facets/facet-row.ts +274 -0
- package/src/collection-facets/facets-template.ts +49 -196
- package/src/models.ts +18 -2
- package/test/collection-browser.test.ts +36 -4
- package/test/collection-facets/facet-row.test.ts +328 -0
- package/test/collection-facets/facets-template.test.ts +72 -110
- package/test/collection-facets.test.ts +69 -101
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
- package/dist/src/selected-facets.d.ts +0 -67
- package/dist/src/selected-facets.js +0 -149
- package/dist/src/selected-facets.js.map +0 -1
- package/src/selected-facets.ts +0 -216
package/dist/src/app-root.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
/* eslint-disable no-console */
|
|
3
|
-
import { AnalyticsManager, } from '@internetarchive/analytics-manager';
|
|
4
|
-
import { SearchService, SearchType, StringField, } from '@internetarchive/search-service';
|
|
5
|
-
import { LocalCache } from '@internetarchive/local-cache';
|
|
6
|
-
import { html, css, LitElement } from 'lit';
|
|
7
|
-
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
8
|
-
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
9
|
-
import { CollectionNameCache } from '@internetarchive/collection-name-cache';
|
|
10
|
-
import '../src/collection-browser';
|
|
11
|
-
let AppRoot = class AppRoot extends LitElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.searchService = this.initSearchServiceFromUrlParams();
|
|
15
|
-
this.resizeObserver = new SharedResizeObserver();
|
|
16
|
-
this.localCache = new LocalCache();
|
|
17
|
-
this.collectionNameCache = new CollectionNameCache({
|
|
18
|
-
searchService: this.searchService,
|
|
19
|
-
localCache: this.localCache,
|
|
20
|
-
});
|
|
21
|
-
this.cellWidth = 18;
|
|
22
|
-
this.cellHeight = 29;
|
|
23
|
-
this.rowGap = 1.7;
|
|
24
|
-
this.colGap = 1.7;
|
|
25
|
-
this.loggedIn = false;
|
|
26
|
-
this.searchType = SearchType.METADATA;
|
|
27
|
-
this.analyticsManager = new AnalyticsManager();
|
|
28
|
-
this.analyticsHandler = {
|
|
29
|
-
sendPing: this.sendAnalytics.bind(this),
|
|
30
|
-
sendEvent: this.sendAnalytics.bind(this),
|
|
31
|
-
sendEventNoSampling: this.sendAnalytics.bind(this),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
sendAnalytics(ae) {
|
|
35
|
-
var _a;
|
|
36
|
-
console.log('Analytics Received ----', ae);
|
|
37
|
-
this.latestAction = ae;
|
|
38
|
-
(_a = this.analyticsManager) === null || _a === void 0 ? void 0 : _a.sendEvent(ae);
|
|
39
|
-
}
|
|
40
|
-
initSearchServiceFromUrlParams() {
|
|
41
|
-
var _a, _b, _c;
|
|
42
|
-
const params = new URL(window.location.href).searchParams;
|
|
43
|
-
return new SearchService({
|
|
44
|
-
includeCredentials: false,
|
|
45
|
-
baseUrl: (_a = params.get('search_base_url')) !== null && _a !== void 0 ? _a : undefined,
|
|
46
|
-
servicePath: (_b = params.get('search_service_path')) !== null && _b !== void 0 ? _b : undefined,
|
|
47
|
-
debuggingEnabled: (_c = !!params.get('debugging')) !== null && _c !== void 0 ? _c : undefined,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
searchPressed(e) {
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
this.searchQuery = this.baseQueryField.value;
|
|
53
|
-
this.collectionBrowser.searchType = this.searchType;
|
|
54
|
-
this.goToCurrentPage();
|
|
55
|
-
}
|
|
56
|
-
collectionChanged(e) {
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
this.withinCollection = this.baseCollectionField.value;
|
|
59
|
-
this.collectionBrowser.withinCollection = this.withinCollection;
|
|
60
|
-
this.goToCurrentPage();
|
|
61
|
-
}
|
|
62
|
-
goToCurrentPage() {
|
|
63
|
-
var _a;
|
|
64
|
-
const page = (_a = this.currentPage) !== null && _a !== void 0 ? _a : 1;
|
|
65
|
-
if (page > 1) {
|
|
66
|
-
this.collectionBrowser.goToPage(page);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
changePagePressed(e) {
|
|
70
|
-
e.preventDefault();
|
|
71
|
-
this.currentPage = this.pageNumberInput.valueAsNumber;
|
|
72
|
-
this.collectionBrowser.goToPage(this.currentPage);
|
|
73
|
-
}
|
|
74
|
-
updated(changed) {
|
|
75
|
-
if (changed.has('currentPage') && this.currentPage) {
|
|
76
|
-
this.pageNumberInput.value = this.currentPage.toString();
|
|
77
|
-
}
|
|
78
|
-
if (changed.has('searchQuery')) {
|
|
79
|
-
this.queryUpdated();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
queryUpdated() {
|
|
83
|
-
this.collectionBrowser.baseQuery = this.searchQuery;
|
|
84
|
-
}
|
|
85
|
-
get getClass() {
|
|
86
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
87
|
-
return searchParams.get('hide-dev-tools') ? 'hidden' : '';
|
|
88
|
-
}
|
|
89
|
-
render() {
|
|
90
|
-
var _a, _b;
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
import { AnalyticsManager, } from '@internetarchive/analytics-manager';
|
|
4
|
+
import { SearchService, SearchType, StringField, } from '@internetarchive/search-service';
|
|
5
|
+
import { LocalCache } from '@internetarchive/local-cache';
|
|
6
|
+
import { html, css, LitElement } from 'lit';
|
|
7
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
8
|
+
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
9
|
+
import { CollectionNameCache } from '@internetarchive/collection-name-cache';
|
|
10
|
+
import '../src/collection-browser';
|
|
11
|
+
let AppRoot = class AppRoot extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.searchService = this.initSearchServiceFromUrlParams();
|
|
15
|
+
this.resizeObserver = new SharedResizeObserver();
|
|
16
|
+
this.localCache = new LocalCache();
|
|
17
|
+
this.collectionNameCache = new CollectionNameCache({
|
|
18
|
+
searchService: this.searchService,
|
|
19
|
+
localCache: this.localCache,
|
|
20
|
+
});
|
|
21
|
+
this.cellWidth = 18;
|
|
22
|
+
this.cellHeight = 29;
|
|
23
|
+
this.rowGap = 1.7;
|
|
24
|
+
this.colGap = 1.7;
|
|
25
|
+
this.loggedIn = false;
|
|
26
|
+
this.searchType = SearchType.METADATA;
|
|
27
|
+
this.analyticsManager = new AnalyticsManager();
|
|
28
|
+
this.analyticsHandler = {
|
|
29
|
+
sendPing: this.sendAnalytics.bind(this),
|
|
30
|
+
sendEvent: this.sendAnalytics.bind(this),
|
|
31
|
+
sendEventNoSampling: this.sendAnalytics.bind(this),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
sendAnalytics(ae) {
|
|
35
|
+
var _a;
|
|
36
|
+
console.log('Analytics Received ----', ae);
|
|
37
|
+
this.latestAction = ae;
|
|
38
|
+
(_a = this.analyticsManager) === null || _a === void 0 ? void 0 : _a.sendEvent(ae);
|
|
39
|
+
}
|
|
40
|
+
initSearchServiceFromUrlParams() {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
const params = new URL(window.location.href).searchParams;
|
|
43
|
+
return new SearchService({
|
|
44
|
+
includeCredentials: false,
|
|
45
|
+
baseUrl: (_a = params.get('search_base_url')) !== null && _a !== void 0 ? _a : undefined,
|
|
46
|
+
servicePath: (_b = params.get('search_service_path')) !== null && _b !== void 0 ? _b : undefined,
|
|
47
|
+
debuggingEnabled: (_c = !!params.get('debugging')) !== null && _c !== void 0 ? _c : undefined,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
searchPressed(e) {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
this.searchQuery = this.baseQueryField.value;
|
|
53
|
+
this.collectionBrowser.searchType = this.searchType;
|
|
54
|
+
this.goToCurrentPage();
|
|
55
|
+
}
|
|
56
|
+
collectionChanged(e) {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
this.withinCollection = this.baseCollectionField.value;
|
|
59
|
+
this.collectionBrowser.withinCollection = this.withinCollection;
|
|
60
|
+
this.goToCurrentPage();
|
|
61
|
+
}
|
|
62
|
+
goToCurrentPage() {
|
|
63
|
+
var _a;
|
|
64
|
+
const page = (_a = this.currentPage) !== null && _a !== void 0 ? _a : 1;
|
|
65
|
+
if (page > 1) {
|
|
66
|
+
this.collectionBrowser.goToPage(page);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
changePagePressed(e) {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
this.currentPage = this.pageNumberInput.valueAsNumber;
|
|
72
|
+
this.collectionBrowser.goToPage(this.currentPage);
|
|
73
|
+
}
|
|
74
|
+
updated(changed) {
|
|
75
|
+
if (changed.has('currentPage') && this.currentPage) {
|
|
76
|
+
this.pageNumberInput.value = this.currentPage.toString();
|
|
77
|
+
}
|
|
78
|
+
if (changed.has('searchQuery')) {
|
|
79
|
+
this.queryUpdated();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
queryUpdated() {
|
|
83
|
+
this.collectionBrowser.baseQuery = this.searchQuery;
|
|
84
|
+
}
|
|
85
|
+
get getClass() {
|
|
86
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
87
|
+
return searchParams.get('hide-dev-tools') ? 'hidden' : '';
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
var _a, _b;
|
|
91
91
|
return html `
|
|
92
92
|
<div class="dev-tool-container">
|
|
93
93
|
<div id="dev-tools" class=${this.getClass}>
|
|
@@ -147,21 +147,21 @@ let AppRoot = class AppRoot extends LitElement {
|
|
|
147
147
|
|
|
148
148
|
<div id="toggle-controls">
|
|
149
149
|
<button
|
|
150
|
-
@click=${() => {
|
|
151
|
-
var _a, _b;
|
|
152
|
-
const details = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('cell-size-control');
|
|
153
|
-
details === null || details === void 0 ? void 0 : details.classList.toggle('hidden');
|
|
154
|
-
const rowGapControls = (_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.getElementById('cell-gap-control');
|
|
155
|
-
rowGapControls === null || rowGapControls === void 0 ? void 0 : rowGapControls.classList.toggle('hidden');
|
|
150
|
+
@click=${() => {
|
|
151
|
+
var _a, _b;
|
|
152
|
+
const details = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('cell-size-control');
|
|
153
|
+
details === null || details === void 0 ? void 0 : details.classList.toggle('hidden');
|
|
154
|
+
const rowGapControls = (_b = this.shadowRoot) === null || _b === void 0 ? void 0 : _b.getElementById('cell-gap-control');
|
|
155
|
+
rowGapControls === null || rowGapControls === void 0 ? void 0 : rowGapControls.classList.toggle('hidden');
|
|
156
156
|
}}
|
|
157
157
|
>
|
|
158
158
|
Toggle Cell Controls
|
|
159
159
|
</button>
|
|
160
160
|
<button
|
|
161
|
-
@click=${() => {
|
|
162
|
-
var _a;
|
|
163
|
-
const details = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('latest-event-details');
|
|
164
|
-
details === null || details === void 0 ? void 0 : details.classList.toggle('hidden');
|
|
161
|
+
@click=${() => {
|
|
162
|
+
var _a;
|
|
163
|
+
const details = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('latest-event-details');
|
|
164
|
+
details === null || details === void 0 ? void 0 : details.classList.toggle('hidden');
|
|
165
165
|
}}
|
|
166
166
|
>
|
|
167
167
|
Last Event Captured
|
|
@@ -175,91 +175,93 @@ let AppRoot = class AppRoot extends LitElement {
|
|
|
175
175
|
>
|
|
176
176
|
</div>
|
|
177
177
|
|
|
178
|
-
<
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
</div>
|
|
193
|
-
<div>
|
|
194
|
-
<label for="cell-height-slider">Cell height:</label>
|
|
195
|
-
<input
|
|
196
|
-
type="range"
|
|
197
|
-
min="10"
|
|
198
|
-
max="100"
|
|
199
|
-
value="29"
|
|
200
|
-
step="0.1"
|
|
201
|
-
id="cell-height-slider"
|
|
202
|
-
@input=${this.heightChanged}
|
|
203
|
-
/>
|
|
204
|
-
<span>${this.cellHeight}rem</span>
|
|
205
|
-
</div>
|
|
178
|
+
<fieldset class="cell-controls">
|
|
179
|
+
<legend>Cell Controls</legend>
|
|
180
|
+
<div>
|
|
181
|
+
<label for="cell-width-slider">Cell width:</label>
|
|
182
|
+
<input
|
|
183
|
+
type="range"
|
|
184
|
+
min="10"
|
|
185
|
+
max="100"
|
|
186
|
+
value="18"
|
|
187
|
+
step="0.1"
|
|
188
|
+
id="cell-width-slider"
|
|
189
|
+
@input=${this.widthChanged}
|
|
190
|
+
/>
|
|
191
|
+
<span>${this.cellWidth}rem</span>
|
|
206
192
|
</div>
|
|
207
|
-
<div
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
<span>${this.rowGap}rem</span>
|
|
220
|
-
</div>
|
|
221
|
-
<div>
|
|
222
|
-
<label for="cell-col-gap-slider">Col gap:</label>
|
|
223
|
-
<input
|
|
224
|
-
type="range"
|
|
225
|
-
min="0"
|
|
226
|
-
max="5"
|
|
227
|
-
value="1.7"
|
|
228
|
-
step="0.1"
|
|
229
|
-
id="cell-col-gap-slider"
|
|
230
|
-
@input=${this.colGapChanged}
|
|
231
|
-
/>
|
|
232
|
-
<span>${this.colGap}rem</span>
|
|
233
|
-
</div>
|
|
193
|
+
<div>
|
|
194
|
+
<label for="cell-height-slider">Cell height:</label>
|
|
195
|
+
<input
|
|
196
|
+
type="range"
|
|
197
|
+
min="10"
|
|
198
|
+
max="100"
|
|
199
|
+
value="29"
|
|
200
|
+
step="0.1"
|
|
201
|
+
id="cell-height-slider"
|
|
202
|
+
@input=${this.heightChanged}
|
|
203
|
+
/>
|
|
204
|
+
<span>${this.cellHeight}rem</span>
|
|
234
205
|
</div>
|
|
235
|
-
|
|
236
|
-
|
|
206
|
+
<div>
|
|
207
|
+
<label for="cell-row-gap-slider">Row gap:</label>
|
|
208
|
+
<input
|
|
209
|
+
type="range"
|
|
210
|
+
min="0"
|
|
211
|
+
max="5"
|
|
212
|
+
value="1.7"
|
|
213
|
+
step="0.1"
|
|
214
|
+
id="cell-row-gap-slider"
|
|
215
|
+
@input=${this.rowGapChanged}
|
|
216
|
+
/>
|
|
217
|
+
<span>${this.rowGap}rem</span>
|
|
218
|
+
</div>
|
|
219
|
+
<div>
|
|
220
|
+
<label for="cell-col-gap-slider">Col gap:</label>
|
|
221
|
+
<input
|
|
222
|
+
type="range"
|
|
223
|
+
min="0"
|
|
224
|
+
max="5"
|
|
225
|
+
value="1.7"
|
|
226
|
+
step="0.1"
|
|
227
|
+
id="cell-col-gap-slider"
|
|
228
|
+
@input=${this.colGapChanged}
|
|
229
|
+
/>
|
|
230
|
+
<span>${this.colGap}rem</span>
|
|
231
|
+
</div>
|
|
232
|
+
</fieldset>
|
|
233
|
+
|
|
234
|
+
<fieldset class="other-controls">
|
|
235
|
+
<legend>Other Controls</legend>
|
|
237
236
|
<div class="checkbox-control">
|
|
238
237
|
<input
|
|
239
238
|
type="checkbox"
|
|
240
|
-
id="
|
|
241
|
-
@click=${this.
|
|
239
|
+
id="simulate-login"
|
|
240
|
+
@click=${this.loginChanged}
|
|
242
241
|
/>
|
|
243
|
-
<label for="
|
|
242
|
+
<label for="simulate-login">Simulate login</label>
|
|
244
243
|
</div>
|
|
245
244
|
<div class="checkbox-control">
|
|
246
245
|
<input
|
|
247
246
|
type="checkbox"
|
|
248
|
-
id="
|
|
249
|
-
|
|
247
|
+
id="enable-date-picker"
|
|
248
|
+
checked
|
|
249
|
+
@click=${this.datePickerChanged}
|
|
250
250
|
/>
|
|
251
|
-
<label for="
|
|
252
|
-
Show facet group outlines
|
|
253
|
-
</label>
|
|
251
|
+
<label for="enable-date-picker">Enable date picker</label>
|
|
254
252
|
</div>
|
|
255
253
|
<div class="checkbox-control">
|
|
256
254
|
<input
|
|
257
255
|
type="checkbox"
|
|
258
|
-
id="
|
|
259
|
-
@click=${this.
|
|
256
|
+
id="enable-management"
|
|
257
|
+
@click=${this.manageModeCheckboxChanged}
|
|
260
258
|
/>
|
|
261
|
-
<label for="
|
|
259
|
+
<label for="enable-management">Enable manage mode</label>
|
|
262
260
|
</div>
|
|
261
|
+
</fieldset>
|
|
262
|
+
|
|
263
|
+
<fieldset class="cb-visual-appearance">
|
|
264
|
+
<legend>CB Visual Appearance</legend>
|
|
263
265
|
<div class="checkbox-control">
|
|
264
266
|
<input
|
|
265
267
|
type="checkbox"
|
|
@@ -271,27 +273,34 @@ let AppRoot = class AppRoot extends LitElement {
|
|
|
271
273
|
<div class="checkbox-control">
|
|
272
274
|
<input
|
|
273
275
|
type="checkbox"
|
|
274
|
-
id="
|
|
275
|
-
|
|
276
|
-
@click=${this.datePickerChanged}
|
|
276
|
+
id="show-facet-group-outline-check"
|
|
277
|
+
@click=${this.toggleFacetGroupOutline}
|
|
277
278
|
/>
|
|
278
|
-
<label for="
|
|
279
|
+
<label for="show-facet-group-outline-check">
|
|
280
|
+
Show facet group outlines
|
|
281
|
+
</label>
|
|
279
282
|
</div>
|
|
280
283
|
<div class="checkbox-control">
|
|
281
284
|
<input
|
|
282
285
|
type="checkbox"
|
|
283
|
-
id="
|
|
284
|
-
@click=${this.
|
|
286
|
+
id="show-outline-check"
|
|
287
|
+
@click=${this.outlineChanged}
|
|
285
288
|
/>
|
|
286
|
-
<label for="
|
|
289
|
+
<label for="show-outline-check">Show cell outlines</label>
|
|
287
290
|
</div>
|
|
291
|
+
</fieldset>
|
|
292
|
+
|
|
293
|
+
<fieldset class="user-profile-controls">
|
|
294
|
+
<legend>User Profile Controls</legend>
|
|
288
295
|
<div class="checkbox-control">
|
|
289
296
|
<input
|
|
290
297
|
type="checkbox"
|
|
291
|
-
id="enable-
|
|
292
|
-
@click=${this.
|
|
298
|
+
id="enable-result-last-tile-view"
|
|
299
|
+
@click=${this.resultLastTileViewCheckboxChanged}
|
|
293
300
|
/>
|
|
294
|
-
<label for="enable-
|
|
301
|
+
<label for="enable-result-last-tile-view"
|
|
302
|
+
>Show result last tile view</label
|
|
303
|
+
>
|
|
295
304
|
</div>
|
|
296
305
|
<div class="checkbox-control">
|
|
297
306
|
<input
|
|
@@ -301,7 +310,15 @@ let AppRoot = class AppRoot extends LitElement {
|
|
|
301
310
|
/>
|
|
302
311
|
<label for="enable-cb-top-view">Show CB top view</label>
|
|
303
312
|
</div>
|
|
304
|
-
|
|
313
|
+
<div class="checkbox-control">
|
|
314
|
+
<input
|
|
315
|
+
type="checkbox"
|
|
316
|
+
id="enable-facet-top-view"
|
|
317
|
+
@click=${this.facetTopViewCheckboxChanged}
|
|
318
|
+
/>
|
|
319
|
+
<label for="enable-facet-top-view">Show facet top view</label>
|
|
320
|
+
</div>
|
|
321
|
+
</fieldset>
|
|
305
322
|
</div>
|
|
306
323
|
<button id="toggle-dev-tools-btn" @click=${this.toggleDevTools}>
|
|
307
324
|
Toggle Search Controls
|
|
@@ -326,203 +343,218 @@ let AppRoot = class AppRoot extends LitElement {
|
|
|
326
343
|
</collection-browser>
|
|
327
344
|
</div>
|
|
328
345
|
<modal-manager></modal-manager>
|
|
329
|
-
`;
|
|
330
|
-
}
|
|
331
|
-
baseQueryChanged(e) {
|
|
332
|
-
this.searchQuery = e.detail.baseQuery;
|
|
333
|
-
}
|
|
334
|
-
/** Handler for search type changes coming from collection browser */
|
|
335
|
-
searchTypeChanged(e) {
|
|
336
|
-
this.searchType = e.detail;
|
|
337
|
-
}
|
|
338
|
-
/** Handler for user input selecting a search type */
|
|
339
|
-
searchTypeSelected(e) {
|
|
340
|
-
const target = e.target;
|
|
341
|
-
this.searchType =
|
|
342
|
-
target.value === 'fulltext' ? SearchType.FULLTEXT : SearchType.METADATA;
|
|
343
|
-
}
|
|
344
|
-
loginChanged(e) {
|
|
345
|
-
const target = e.target;
|
|
346
|
-
if (target.checked) {
|
|
347
|
-
this.loggedIn = true;
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
this.loggedIn = false;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
outlineChanged(e) {
|
|
354
|
-
const target = e.target;
|
|
355
|
-
if (target.checked) {
|
|
356
|
-
this.collectionBrowser.style.setProperty('--infiniteScrollerCellOutline', '1px solid #33D1FF');
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
359
|
-
this.collectionBrowser.style.removeProperty('--infiniteScrollerCellOutline');
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
toggleDevTools() {
|
|
363
|
-
var _a, _b;
|
|
364
|
-
const pageUrl = new URL(window.location.href);
|
|
365
|
-
const { searchParams } = pageUrl;
|
|
366
|
-
if (searchParams.get('hide-dev-tools')) {
|
|
367
|
-
searchParams.delete('hide-dev-tools');
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
searchParams.set('hide-dev-tools', 'true');
|
|
371
|
-
}
|
|
372
|
-
(_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dev-tools')) === null || _b === void 0 ? void 0 : _b.classList.toggle('hidden');
|
|
373
|
-
if (window.history.replaceState) {
|
|
374
|
-
window.history.replaceState({
|
|
375
|
-
path: pageUrl.toString(),
|
|
376
|
-
}, '', pageUrl.toString());
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
toggleFacetGroupOutline(e) {
|
|
380
|
-
const target = e.target;
|
|
381
|
-
if (target.checked) {
|
|
382
|
-
this.collectionBrowser.classList.add('showFacetGroupOutlines');
|
|
383
|
-
this.modalManager.classList.add('showFacetGroupOutlines');
|
|
384
|
-
}
|
|
385
|
-
else {
|
|
386
|
-
this.collectionBrowser.classList.remove('showFacetGroupOutlines');
|
|
387
|
-
this.modalManager.classList.remove('showFacetGroupOutlines');
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
async snippetsChanged(e) {
|
|
391
|
-
const target = e.target;
|
|
392
|
-
if (target.checked) {
|
|
393
|
-
// Decorate the default search service with a wrapper that adds
|
|
394
|
-
// dummy snippets to any successful searches
|
|
395
|
-
this.searchService = {
|
|
396
|
-
async search(params, searchType) {
|
|
397
|
-
var _a;
|
|
398
|
-
const searchResponse = await SearchService.default.search(params, searchType);
|
|
399
|
-
(_a = searchResponse.success) === null || _a === void 0 ? void 0 : _a.response.results.forEach(result => {
|
|
400
|
-
Object.defineProperty(result, 'highlight', {
|
|
401
|
-
value: new StringField([
|
|
402
|
-
'this is a text {{{snippet}}} block with potentially',
|
|
403
|
-
'multiple {{{snippets}}} and such',
|
|
404
|
-
'but the {{{snippet}}} block may be quite long perhaps',
|
|
405
|
-
'depending on how many {{{snippet}}} matches there are',
|
|
406
|
-
'there may be multiple lines of {{{snippets}}} to show',
|
|
407
|
-
'but each {{{snippet}}} should be relatively short',
|
|
408
|
-
'and {{{snippets}}} are each a {{{snippet}}} of text',
|
|
409
|
-
'but every {{{snippet}}} might have multiple matches',
|
|
410
|
-
'the {{{snippets}}} should be separated and surrounded by ellipses',
|
|
411
|
-
]),
|
|
412
|
-
});
|
|
413
|
-
});
|
|
414
|
-
return searchResponse;
|
|
415
|
-
},
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
else {
|
|
419
|
-
// Restore the default seach service
|
|
420
|
-
this.searchService = SearchService.default;
|
|
421
|
-
}
|
|
422
|
-
// Re-perform the current search to show/hide the snippets immediately
|
|
423
|
-
this.reperformCurrentSearch();
|
|
424
|
-
}
|
|
425
|
-
async reperformCurrentSearch() {
|
|
426
|
-
const oldQuery = this.searchQuery;
|
|
427
|
-
this.searchQuery = ''; // Should just reset to the placeholder
|
|
428
|
-
await this.updateComplete;
|
|
429
|
-
// For unclear reasons, Safari refuses to re-apply the old query until the next tick, hence:
|
|
430
|
-
await new Promise(res => {
|
|
431
|
-
setTimeout(res, 0);
|
|
432
|
-
});
|
|
433
|
-
this.searchQuery = oldQuery; // Re-apply the original query
|
|
434
|
-
}
|
|
435
|
-
datePickerChanged(e) {
|
|
436
|
-
const target = e.target;
|
|
437
|
-
this.collectionBrowser.showHistogramDatePicker = target.checked;
|
|
438
|
-
// When disabling the date picker from the demo app, also clear any existing date range params
|
|
439
|
-
if (!this.collectionBrowser.showHistogramDatePicker) {
|
|
440
|
-
this.collectionBrowser.minSelectedDate = undefined;
|
|
441
|
-
this.collectionBrowser.maxSelectedDate = undefined;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Handler for when collection browser's manage mode changes.
|
|
446
|
-
* This lets us disable the checkbox in the dev panel when the user cancels out
|
|
447
|
-
* of manage mode from within collection browser.
|
|
448
|
-
*/
|
|
449
|
-
manageModeChanged(e) {
|
|
450
|
-
var _a;
|
|
451
|
-
const manageCheckbox = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#enable-management');
|
|
452
|
-
if (manageCheckbox)
|
|
453
|
-
manageCheckbox.checked = e.detail;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Handler for when the dev panel's "Enable manage mode" checkbox is changed.
|
|
457
|
-
*/
|
|
458
|
-
manageModeCheckboxChanged(e) {
|
|
459
|
-
const target = e.target;
|
|
460
|
-
this.collectionBrowser.isManageView = target.checked;
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Handler for when the dev panel's "Show facet top view" checkbox is changed.
|
|
464
|
-
*/
|
|
465
|
-
facetTopViewCheckboxChanged(e) {
|
|
466
|
-
const target = e.target;
|
|
467
|
-
const p = document.createElement('p');
|
|
468
|
-
p.style.setProperty('border', '1px solid #000');
|
|
469
|
-
p.textContent = 'New stuff as a child.';
|
|
470
|
-
p.style.setProperty('height', '20rem');
|
|
471
|
-
p.style.backgroundColor = '#00000';
|
|
472
|
-
p.setAttribute('slot', 'facet-top-slot');
|
|
473
|
-
if (target.checked) {
|
|
474
|
-
this.collectionBrowser.appendChild(p);
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
477
|
-
this.collectionBrowser.removeChild(this.collectionBrowser.lastElementChild);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
this.collectionBrowser.
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
const input = e.target;
|
|
515
|
-
this.
|
|
516
|
-
this.collectionBrowser.style.setProperty('--
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
346
|
+
`;
|
|
347
|
+
}
|
|
348
|
+
baseQueryChanged(e) {
|
|
349
|
+
this.searchQuery = e.detail.baseQuery;
|
|
350
|
+
}
|
|
351
|
+
/** Handler for search type changes coming from collection browser */
|
|
352
|
+
searchTypeChanged(e) {
|
|
353
|
+
this.searchType = e.detail;
|
|
354
|
+
}
|
|
355
|
+
/** Handler for user input selecting a search type */
|
|
356
|
+
searchTypeSelected(e) {
|
|
357
|
+
const target = e.target;
|
|
358
|
+
this.searchType =
|
|
359
|
+
target.value === 'fulltext' ? SearchType.FULLTEXT : SearchType.METADATA;
|
|
360
|
+
}
|
|
361
|
+
loginChanged(e) {
|
|
362
|
+
const target = e.target;
|
|
363
|
+
if (target.checked) {
|
|
364
|
+
this.loggedIn = true;
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
this.loggedIn = false;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
outlineChanged(e) {
|
|
371
|
+
const target = e.target;
|
|
372
|
+
if (target.checked) {
|
|
373
|
+
this.collectionBrowser.style.setProperty('--infiniteScrollerCellOutline', '1px solid #33D1FF');
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
this.collectionBrowser.style.removeProperty('--infiniteScrollerCellOutline');
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
toggleDevTools() {
|
|
380
|
+
var _a, _b;
|
|
381
|
+
const pageUrl = new URL(window.location.href);
|
|
382
|
+
const { searchParams } = pageUrl;
|
|
383
|
+
if (searchParams.get('hide-dev-tools')) {
|
|
384
|
+
searchParams.delete('hide-dev-tools');
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
searchParams.set('hide-dev-tools', 'true');
|
|
388
|
+
}
|
|
389
|
+
(_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dev-tools')) === null || _b === void 0 ? void 0 : _b.classList.toggle('hidden');
|
|
390
|
+
if (window.history.replaceState) {
|
|
391
|
+
window.history.replaceState({
|
|
392
|
+
path: pageUrl.toString(),
|
|
393
|
+
}, '', pageUrl.toString());
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
toggleFacetGroupOutline(e) {
|
|
397
|
+
const target = e.target;
|
|
398
|
+
if (target.checked) {
|
|
399
|
+
this.collectionBrowser.classList.add('showFacetGroupOutlines');
|
|
400
|
+
this.modalManager.classList.add('showFacetGroupOutlines');
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
this.collectionBrowser.classList.remove('showFacetGroupOutlines');
|
|
404
|
+
this.modalManager.classList.remove('showFacetGroupOutlines');
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
async snippetsChanged(e) {
|
|
408
|
+
const target = e.target;
|
|
409
|
+
if (target.checked) {
|
|
410
|
+
// Decorate the default search service with a wrapper that adds
|
|
411
|
+
// dummy snippets to any successful searches
|
|
412
|
+
this.searchService = {
|
|
413
|
+
async search(params, searchType) {
|
|
414
|
+
var _a;
|
|
415
|
+
const searchResponse = await SearchService.default.search(params, searchType);
|
|
416
|
+
(_a = searchResponse.success) === null || _a === void 0 ? void 0 : _a.response.results.forEach(result => {
|
|
417
|
+
Object.defineProperty(result, 'highlight', {
|
|
418
|
+
value: new StringField([
|
|
419
|
+
'this is a text {{{snippet}}} block with potentially',
|
|
420
|
+
'multiple {{{snippets}}} and such',
|
|
421
|
+
'but the {{{snippet}}} block may be quite long perhaps',
|
|
422
|
+
'depending on how many {{{snippet}}} matches there are',
|
|
423
|
+
'there may be multiple lines of {{{snippets}}} to show',
|
|
424
|
+
'but each {{{snippet}}} should be relatively short',
|
|
425
|
+
'and {{{snippets}}} are each a {{{snippet}}} of text',
|
|
426
|
+
'but every {{{snippet}}} might have multiple matches',
|
|
427
|
+
'the {{{snippets}}} should be separated and surrounded by ellipses',
|
|
428
|
+
]),
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
return searchResponse;
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
// Restore the default seach service
|
|
437
|
+
this.searchService = SearchService.default;
|
|
438
|
+
}
|
|
439
|
+
// Re-perform the current search to show/hide the snippets immediately
|
|
440
|
+
this.reperformCurrentSearch();
|
|
441
|
+
}
|
|
442
|
+
async reperformCurrentSearch() {
|
|
443
|
+
const oldQuery = this.searchQuery;
|
|
444
|
+
this.searchQuery = ''; // Should just reset to the placeholder
|
|
445
|
+
await this.updateComplete;
|
|
446
|
+
// For unclear reasons, Safari refuses to re-apply the old query until the next tick, hence:
|
|
447
|
+
await new Promise(res => {
|
|
448
|
+
setTimeout(res, 0);
|
|
449
|
+
});
|
|
450
|
+
this.searchQuery = oldQuery; // Re-apply the original query
|
|
451
|
+
}
|
|
452
|
+
datePickerChanged(e) {
|
|
453
|
+
const target = e.target;
|
|
454
|
+
this.collectionBrowser.showHistogramDatePicker = target.checked;
|
|
455
|
+
// When disabling the date picker from the demo app, also clear any existing date range params
|
|
456
|
+
if (!this.collectionBrowser.showHistogramDatePicker) {
|
|
457
|
+
this.collectionBrowser.minSelectedDate = undefined;
|
|
458
|
+
this.collectionBrowser.maxSelectedDate = undefined;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Handler for when collection browser's manage mode changes.
|
|
463
|
+
* This lets us disable the checkbox in the dev panel when the user cancels out
|
|
464
|
+
* of manage mode from within collection browser.
|
|
465
|
+
*/
|
|
466
|
+
manageModeChanged(e) {
|
|
467
|
+
var _a;
|
|
468
|
+
const manageCheckbox = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#enable-management');
|
|
469
|
+
if (manageCheckbox)
|
|
470
|
+
manageCheckbox.checked = e.detail;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Handler for when the dev panel's "Enable manage mode" checkbox is changed.
|
|
474
|
+
*/
|
|
475
|
+
manageModeCheckboxChanged(e) {
|
|
476
|
+
const target = e.target;
|
|
477
|
+
this.collectionBrowser.isManageView = target.checked;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Handler for when the dev panel's "Show facet top view" checkbox is changed.
|
|
481
|
+
*/
|
|
482
|
+
facetTopViewCheckboxChanged(e) {
|
|
483
|
+
const target = e.target;
|
|
484
|
+
const p = document.createElement('p');
|
|
485
|
+
p.style.setProperty('border', '1px solid #000');
|
|
486
|
+
p.textContent = 'New stuff as a child.';
|
|
487
|
+
p.style.setProperty('height', '20rem');
|
|
488
|
+
p.style.backgroundColor = '#00000';
|
|
489
|
+
p.setAttribute('slot', 'facet-top-slot');
|
|
490
|
+
if (target.checked) {
|
|
491
|
+
this.collectionBrowser.appendChild(p);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
this.collectionBrowser.removeChild(this.collectionBrowser.lastElementChild);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
resultLastTileViewCheckboxChanged(e) {
|
|
498
|
+
const target = e.target;
|
|
499
|
+
const div = document.createElement('div');
|
|
500
|
+
const title = document.createElement('h3');
|
|
501
|
+
title.textContent = 'Upload';
|
|
502
|
+
div.setAttribute('slot', 'result-last-tile');
|
|
503
|
+
div.setAttribute('class', 'result-last-tile');
|
|
504
|
+
div.appendChild(title);
|
|
505
|
+
if (target.checked) {
|
|
506
|
+
this.collectionBrowser.appendChild(div);
|
|
507
|
+
}
|
|
508
|
+
else {
|
|
509
|
+
this.collectionBrowser.removeChild(this.collectionBrowser.lastElementChild);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Handler for when the dev panel's "Show cb top view" checkbox is changed.
|
|
514
|
+
*/
|
|
515
|
+
cbToViewCheckboxChanged(e) {
|
|
516
|
+
const target = e.target;
|
|
517
|
+
const p = document.createElement('p');
|
|
518
|
+
p.style.setProperty('border', '1px solid #000');
|
|
519
|
+
p.textContent = 'My Favorite list header.';
|
|
520
|
+
p.style.setProperty('height', '10rem');
|
|
521
|
+
p.style.backgroundColor = '#00000';
|
|
522
|
+
p.setAttribute('slot', 'cb-top-slot');
|
|
523
|
+
if (target.checked) {
|
|
524
|
+
this.collectionBrowser.appendChild(p);
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
this.collectionBrowser.removeChild(this.collectionBrowser.lastElementChild);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
rowGapChanged(e) {
|
|
531
|
+
const input = e.target;
|
|
532
|
+
this.rowGap = parseFloat(input.value);
|
|
533
|
+
this.collectionBrowser.style.setProperty('--collectionBrowserRowGap', `${input.value}rem`);
|
|
534
|
+
}
|
|
535
|
+
colGapChanged(e) {
|
|
536
|
+
const input = e.target;
|
|
537
|
+
this.colGap = parseFloat(input.value);
|
|
538
|
+
this.collectionBrowser.style.setProperty('--collectionBrowserColGap', `${input.value}rem`);
|
|
539
|
+
}
|
|
540
|
+
widthChanged(e) {
|
|
541
|
+
const input = e.target;
|
|
542
|
+
this.cellWidth = parseFloat(input.value);
|
|
543
|
+
this.collectionBrowser.style.setProperty('--collectionBrowserCellMinWidth', `${input.value}rem`);
|
|
544
|
+
}
|
|
545
|
+
heightChanged(e) {
|
|
546
|
+
const input = e.target;
|
|
547
|
+
this.cellHeight = parseFloat(input.value);
|
|
548
|
+
this.collectionBrowser.style.setProperty('--collectionBrowserCellMinHeight', `${input.value}rem`);
|
|
549
|
+
this.collectionBrowser.style.setProperty('--collectionBrowserCellMaxHeight', `${input.value}rem`);
|
|
550
|
+
}
|
|
551
|
+
visiblePageChanged(e) {
|
|
552
|
+
const { pageNumber } = e.detail;
|
|
553
|
+
if (pageNumber === this.currentPage)
|
|
554
|
+
return;
|
|
555
|
+
this.currentPage = pageNumber;
|
|
556
|
+
}
|
|
557
|
+
};
|
|
526
558
|
AppRoot.styles = css `
|
|
527
559
|
:host {
|
|
528
560
|
display: block;
|
|
@@ -603,7 +635,6 @@ AppRoot.styles = css `
|
|
|
603
635
|
padding: 0.5rem 1rem;
|
|
604
636
|
border: 1px solid black;
|
|
605
637
|
font-size: 1.4rem;
|
|
606
|
-
width: 75%;
|
|
607
638
|
background: #ffffffb3;
|
|
608
639
|
}
|
|
609
640
|
|
|
@@ -646,11 +677,17 @@ AppRoot.styles = css `
|
|
|
646
677
|
margin-right: 1rem;
|
|
647
678
|
}
|
|
648
679
|
|
|
649
|
-
|
|
680
|
+
.cell-controls {
|
|
650
681
|
display: flex;
|
|
651
682
|
flex-wrap: wrap;
|
|
652
683
|
}
|
|
653
|
-
|
|
684
|
+
.cell-controls div {
|
|
685
|
+
display: flex;
|
|
686
|
+
align-items: center;
|
|
687
|
+
}
|
|
688
|
+
.cell-controls input[type='range'] {
|
|
689
|
+
width: 120px;
|
|
690
|
+
}
|
|
654
691
|
#cell-controls label {
|
|
655
692
|
display: inline-block;
|
|
656
693
|
width: 10rem;
|
|
@@ -674,6 +711,9 @@ AppRoot.styles = css `
|
|
|
674
711
|
.checkbox-control {
|
|
675
712
|
flex-basis: 50%;
|
|
676
713
|
}
|
|
714
|
+
.checkbox-control label {
|
|
715
|
+
user-select: none;
|
|
716
|
+
}
|
|
677
717
|
|
|
678
718
|
#last-event {
|
|
679
719
|
background-color: aliceblue;
|
|
@@ -696,54 +736,86 @@ AppRoot.styles = css `
|
|
|
696
736
|
background-color: aliceblue;
|
|
697
737
|
font-size: 1.6rem;
|
|
698
738
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
739
|
+
|
|
740
|
+
/* user profile controls */
|
|
741
|
+
.user-profile-controls {
|
|
742
|
+
width: fit-content;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
fieldset {
|
|
746
|
+
display: inline-block !important;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
.result-last-tile {
|
|
750
|
+
border-radius: 4px;
|
|
751
|
+
background-color: white;
|
|
752
|
+
border: 3px dashed #555;
|
|
753
|
+
box-shadow: none;
|
|
754
|
+
display: grid;
|
|
755
|
+
align-content: center;
|
|
756
|
+
}
|
|
757
|
+
.result-last-tile:hover {
|
|
758
|
+
box-shadow: rgba(8, 8, 32, 0.8) 0 0 6px 2px;
|
|
759
|
+
transition: box-shadow 0.1s ease 0s;
|
|
760
|
+
cursor: pointer;
|
|
761
|
+
border: 3px dashed #4b64ff;
|
|
762
|
+
}
|
|
763
|
+
.result-last-tile h3 {
|
|
764
|
+
margin-bottom: 4rem;
|
|
765
|
+
margin: 0px auto;
|
|
766
|
+
font-size: 2.8rem;
|
|
767
|
+
color: rgb(44, 44, 44);
|
|
768
|
+
font-weight: 200;
|
|
769
|
+
text-align: center;
|
|
770
|
+
}
|
|
771
|
+
`;
|
|
772
|
+
__decorate([
|
|
773
|
+
state()
|
|
774
|
+
], AppRoot.prototype, "currentPage", void 0);
|
|
775
|
+
__decorate([
|
|
776
|
+
state()
|
|
777
|
+
], AppRoot.prototype, "searchQuery", void 0);
|
|
778
|
+
__decorate([
|
|
779
|
+
state()
|
|
780
|
+
], AppRoot.prototype, "withinCollection", void 0);
|
|
781
|
+
__decorate([
|
|
782
|
+
state()
|
|
783
|
+
], AppRoot.prototype, "cellWidth", void 0);
|
|
784
|
+
__decorate([
|
|
785
|
+
state()
|
|
786
|
+
], AppRoot.prototype, "cellHeight", void 0);
|
|
787
|
+
__decorate([
|
|
788
|
+
state()
|
|
789
|
+
], AppRoot.prototype, "rowGap", void 0);
|
|
790
|
+
__decorate([
|
|
791
|
+
state()
|
|
792
|
+
], AppRoot.prototype, "colGap", void 0);
|
|
793
|
+
__decorate([
|
|
794
|
+
state()
|
|
795
|
+
], AppRoot.prototype, "loggedIn", void 0);
|
|
796
|
+
__decorate([
|
|
797
|
+
state()
|
|
798
|
+
], AppRoot.prototype, "searchType", void 0);
|
|
799
|
+
__decorate([
|
|
800
|
+
property({ type: Object, reflect: false })
|
|
801
|
+
], AppRoot.prototype, "latestAction", void 0);
|
|
802
|
+
__decorate([
|
|
803
|
+
query('#base-query-field')
|
|
804
|
+
], AppRoot.prototype, "baseQueryField", void 0);
|
|
805
|
+
__decorate([
|
|
806
|
+
query('#base-collection-field')
|
|
807
|
+
], AppRoot.prototype, "baseCollectionField", void 0);
|
|
808
|
+
__decorate([
|
|
809
|
+
query('#page-number-input')
|
|
810
|
+
], AppRoot.prototype, "pageNumberInput", void 0);
|
|
811
|
+
__decorate([
|
|
812
|
+
query('collection-browser')
|
|
813
|
+
], AppRoot.prototype, "collectionBrowser", void 0);
|
|
814
|
+
__decorate([
|
|
815
|
+
query('modal-manager')
|
|
816
|
+
], AppRoot.prototype, "modalManager", void 0);
|
|
817
|
+
AppRoot = __decorate([
|
|
818
|
+
customElement('app-root')
|
|
819
|
+
], AppRoot);
|
|
820
|
+
export { AppRoot };
|
|
749
821
|
//# sourceMappingURL=app-root.js.map
|