@internetarchive/collection-browser 1.1.0 → 1.1.1-alpha.2
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/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +35 -4
- package/dist/src/collection-browser.js +115 -38
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facets-template.d.ts +1 -1
- package/dist/src/collection-facets/facets-template.js +3 -3
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.d.ts +1 -1
- package/dist/src/collection-facets/more-facets-content.js +3 -3
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +3 -3
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.js +1 -1
- package/dist/src/collection-facets/toggle-switch.js.map +1 -1
- package/dist/src/collection-facets.d.ts +2 -2
- package/dist/src/collection-facets.js +12 -11
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/empty-placeholder.js +2 -2
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/language-code-handler/language-code-handler.js +1 -1
- package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
- package/dist/src/mediatype/mediatype-config.js +13 -13
- package/dist/src/mediatype/mediatype-config.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +1 -1
- package/dist/src/restoration-state-handler.js +18 -2
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +8 -8
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.d.ts +1 -1
- package/dist/src/tiles/grid/account-tile.js +1 -1
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.d.ts +1 -1
- package/dist/src/tiles/grid/collection-tile.js +3 -3
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +1 -1
- package/dist/src/tiles/grid/item-tile.js +3 -3
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +6 -6
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/image-block.d.ts +1 -1
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.d.ts +1 -1
- package/dist/src/tiles/item-image.js +1 -1
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.js +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +4 -4
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +1 -1
- package/dist/src/tiles/list/tile-list.js +6 -6
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/mediatype-icon.js +1 -1
- package/dist/src/tiles/mediatype-icon.js.map +1 -1
- package/dist/src/tiles/overlay/icon-overlay.js +2 -2
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
- package/dist/src/tiles/overlay/icon-text-overlay.js +2 -2
- package/dist/src/tiles/overlay/icon-text-overlay.js.map +1 -1
- package/dist/src/tiles/overlay/text-overlay.js +2 -2
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +4 -3
- package/dist/src/tiles/tile-dispatcher.js +7 -1
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +28 -0
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/index.ts +9 -9
- package/package.json +14 -13
- package/src/app-root.ts +1 -1
- package/src/collection-browser.ts +116 -38
- package/src/collection-facets/facets-template.ts +3 -3
- package/src/collection-facets/more-facets-content.ts +3 -3
- package/src/collection-facets/more-facets-pagination.ts +3 -3
- package/src/collection-facets/toggle-switch.ts +1 -1
- package/src/collection-facets.ts +11 -11
- package/src/empty-placeholder.ts +2 -2
- package/src/language-code-handler/language-code-handler.ts +1 -1
- package/src/mediatype/mediatype-config.ts +13 -13
- package/src/restoration-state-handler.ts +19 -2
- package/src/sort-filter-bar/alpha-bar.ts +2 -2
- package/src/sort-filter-bar/sort-filter-bar.ts +8 -8
- package/src/tiles/grid/account-tile.ts +2 -2
- package/src/tiles/grid/collection-tile.ts +4 -4
- package/src/tiles/grid/item-tile.ts +4 -4
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +1 -1
- package/src/tiles/grid/tile-stats.ts +6 -6
- package/src/tiles/hover/hover-pane-controller.ts +1 -1
- package/src/tiles/hover/tile-hover-pane.ts +1 -1
- package/src/tiles/image-block.ts +1 -1
- package/src/tiles/item-image.ts +2 -2
- package/src/tiles/list/tile-list-compact-header.ts +2 -2
- package/src/tiles/list/tile-list-compact.ts +5 -5
- package/src/tiles/list/tile-list.ts +6 -6
- package/src/tiles/mediatype-icon.ts +1 -1
- package/src/tiles/overlay/icon-overlay.ts +2 -2
- package/src/tiles/overlay/icon-text-overlay.ts +2 -2
- package/src/tiles/overlay/text-overlay.ts +2 -2
- package/src/tiles/tile-dispatcher.ts +6 -3
- package/test/restoration-state-handler.test.ts +44 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css, html, LitElement } from 'lit';
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
import type { SortParam } from '@internetarchive/search-service';
|
|
4
|
-
import { dateLabel } from './date-label';
|
|
5
|
-
import type { TileModel } from '../../models';
|
|
4
|
+
import { dateLabel } from './date-label.js';
|
|
5
|
+
import type { TileModel } from '../../models.js';
|
|
6
6
|
|
|
7
7
|
@customElement('tile-list-compact-header')
|
|
8
8
|
export class TileListCompactHeader extends LitElement {
|
|
@@ -2,12 +2,12 @@ import { css, html, LitElement } from 'lit';
|
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
import DOMPurify from 'dompurify';
|
|
4
4
|
import type { SortParam } from '@internetarchive/search-service';
|
|
5
|
-
import type { TileModel } from '../../models';
|
|
5
|
+
import type { TileModel } from '../../models.js';
|
|
6
6
|
|
|
7
|
-
import { formatCount, NumberFormat } from '../../utils/format-count';
|
|
8
|
-
import { formatDate, DateFormat } from '../../utils/format-date';
|
|
9
|
-
import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
|
|
10
|
-
import { accountLabel } from './account-label';
|
|
7
|
+
import { formatCount, NumberFormat } from '../../utils/format-count.js';
|
|
8
|
+
import { formatDate, DateFormat } from '../../utils/format-date.js';
|
|
9
|
+
import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc.js';
|
|
10
|
+
import { accountLabel } from './account-label.js';
|
|
11
11
|
|
|
12
12
|
import '../image-block';
|
|
13
13
|
import '../mediatype-icon';
|
|
@@ -15,13 +15,13 @@ import DOMPurify from 'dompurify';
|
|
|
15
15
|
|
|
16
16
|
import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
|
|
17
17
|
import type { SortParam } from '@internetarchive/search-service';
|
|
18
|
-
import { suppressedCollections, TileModel } from '../../models';
|
|
18
|
+
import { suppressedCollections, TileModel } from '../../models.js';
|
|
19
19
|
|
|
20
|
-
import { dateLabel } from './date-label';
|
|
21
|
-
import { accountLabel } from './account-label';
|
|
22
|
-
import { formatCount, NumberFormat } from '../../utils/format-count';
|
|
23
|
-
import { formatDate, DateFormat } from '../../utils/format-date';
|
|
24
|
-
import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
|
|
20
|
+
import { dateLabel } from './date-label.js';
|
|
21
|
+
import { accountLabel } from './account-label.js';
|
|
22
|
+
import { formatCount, NumberFormat } from '../../utils/format-count.js';
|
|
23
|
+
import { formatDate, DateFormat } from '../../utils/format-date.js';
|
|
24
|
+
import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc.js';
|
|
25
25
|
|
|
26
26
|
import '../image-block';
|
|
27
27
|
import '../mediatype-icon';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css, CSSResultGroup, html, LitElement } from 'lit';
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
|
|
4
|
-
import { mediatypeConfig } from '../mediatype/mediatype-config';
|
|
4
|
+
import { mediatypeConfig } from '../mediatype/mediatype-config.js';
|
|
5
5
|
|
|
6
6
|
@customElement('mediatype-icon')
|
|
7
7
|
export class MediatypeIcon extends LitElement {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { css, CSSResultGroup, html, LitElement } from 'lit';
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
|
|
4
|
-
import { restrictedIcon } from '../../assets/img/icons/restricted';
|
|
5
|
-
import { loginRequiredIcon } from '../../assets/img/icons/login-required';
|
|
4
|
+
import { restrictedIcon } from '../../assets/img/icons/restricted.js';
|
|
5
|
+
import { loginRequiredIcon } from '../../assets/img/icons/login-required.js';
|
|
6
6
|
|
|
7
7
|
@customElement('icon-overlay')
|
|
8
8
|
export class IconOverlay extends LitElement {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css, CSSResultGroup, html, LitElement } from 'lit';
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { loginRequiredIcon } from '../../assets/img/icons/login-required';
|
|
4
|
-
import { restrictedIcon } from '../../assets/img/icons/restricted';
|
|
3
|
+
import { loginRequiredIcon } from '../../assets/img/icons/login-required.js';
|
|
4
|
+
import { restrictedIcon } from '../../assets/img/icons/restricted.js';
|
|
5
5
|
|
|
6
6
|
@customElement('icon-text-overlay')
|
|
7
7
|
export class IconTextOverlay extends LitElement {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css, CSSResultGroup, html, LitElement } from 'lit';
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { loginRequiredIcon } from '../../assets/img/icons/login-required';
|
|
4
|
-
import { restrictedIcon } from '../../assets/img/icons/restricted';
|
|
3
|
+
import { loginRequiredIcon } from '../../assets/img/icons/login-required.js';
|
|
4
|
+
import { restrictedIcon } from '../../assets/img/icons/restricted.js';
|
|
5
5
|
|
|
6
6
|
@customElement('text-overlay')
|
|
7
7
|
export class TextOverlay extends LitElement {
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from '@internetarchive/shared-resize-observer';
|
|
8
8
|
import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
|
|
9
9
|
import type { SortParam } from '@internetarchive/search-service';
|
|
10
|
-
import type { TileDisplayMode, TileModel } from '../models';
|
|
10
|
+
import type { TileDisplayMode, TileModel } from '../models.js';
|
|
11
11
|
import './grid/collection-tile';
|
|
12
12
|
import './grid/item-tile';
|
|
13
13
|
import './grid/account-tile';
|
|
@@ -15,13 +15,13 @@ import './hover/tile-hover-pane';
|
|
|
15
15
|
import './list/tile-list';
|
|
16
16
|
import './list/tile-list-compact';
|
|
17
17
|
import './list/tile-list-compact-header';
|
|
18
|
-
import type { TileHoverPane } from './hover/tile-hover-pane';
|
|
18
|
+
import type { TileHoverPane } from './hover/tile-hover-pane.js';
|
|
19
19
|
import {
|
|
20
20
|
HoverPaneController,
|
|
21
21
|
HoverPaneControllerInterface,
|
|
22
22
|
HoverPaneProperties,
|
|
23
23
|
HoverPaneProviderInterface,
|
|
24
|
-
} from './hover/hover-pane-controller';
|
|
24
|
+
} from './hover/hover-pane-controller.js';
|
|
25
25
|
|
|
26
26
|
@customElement('tile-dispatcher')
|
|
27
27
|
export class TileDispatcher
|
|
@@ -56,6 +56,8 @@ export class TileDispatcher
|
|
|
56
56
|
/** Whether this tile should include a hover pane at all (for applicable tile modes) */
|
|
57
57
|
@property({ type: Boolean }) enableHoverPane = false;
|
|
58
58
|
|
|
59
|
+
@property({ type: Boolean }) prerender = false;
|
|
60
|
+
|
|
59
61
|
private hoverPaneController?: HoverPaneControllerInterface;
|
|
60
62
|
|
|
61
63
|
@query('#container')
|
|
@@ -158,6 +160,7 @@ export class TileDispatcher
|
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
private get isHoverEnabled(): boolean {
|
|
163
|
+
if (this.prerender) return false;
|
|
161
164
|
return window.matchMedia('(hover: hover)').matches;
|
|
162
165
|
}
|
|
163
166
|
|
|
@@ -183,6 +183,32 @@ describe('Restoration state handler', () => {
|
|
|
183
183
|
);
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
+
it('should restore selected facets with numbers in the square brackets', async () => {
|
|
187
|
+
const handler = new RestorationStateHandler({ context: 'search' });
|
|
188
|
+
|
|
189
|
+
const url = new URL(window.location.href);
|
|
190
|
+
url.search = '?and[12]=subject:"foo"';
|
|
191
|
+
window.history.replaceState({ path: url.href }, '', url.href);
|
|
192
|
+
|
|
193
|
+
const restorationState = handler.getRestorationState();
|
|
194
|
+
expect(restorationState.selectedFacets.subject.foo.state).to.equal(
|
|
195
|
+
'selected'
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('should restore negative facets with numbers in the square brackets', async () => {
|
|
200
|
+
const handler = new RestorationStateHandler({ context: 'search' });
|
|
201
|
+
|
|
202
|
+
const url = new URL(window.location.href);
|
|
203
|
+
url.search = '?not[12]=year:2018';
|
|
204
|
+
window.history.replaceState({ path: url.href }, '', url.href);
|
|
205
|
+
|
|
206
|
+
const restorationState = handler.getRestorationState();
|
|
207
|
+
expect(restorationState.selectedFacets.year['2018'].state).to.equal(
|
|
208
|
+
'hidden'
|
|
209
|
+
);
|
|
210
|
+
});
|
|
211
|
+
|
|
186
212
|
it('should restore sort from URL (space format)', async () => {
|
|
187
213
|
const handler = new RestorationStateHandler({ context: 'search' });
|
|
188
214
|
|
|
@@ -270,4 +296,22 @@ describe('Restoration state handler', () => {
|
|
|
270
296
|
handler.persistState({ selectedFacets: getDefaultSelectedFacets() });
|
|
271
297
|
expect(window.location.search).to.equal('');
|
|
272
298
|
});
|
|
299
|
+
|
|
300
|
+
it('round trip load/persist should erase numbers in square brackets', async () => {
|
|
301
|
+
const handler = new RestorationStateHandler({ context: 'search' });
|
|
302
|
+
|
|
303
|
+
const url = new URL(window.location.href);
|
|
304
|
+
url.search = '?and[0]=subject:"foo"';
|
|
305
|
+
window.history.replaceState({ path: url.href }, '', url.href);
|
|
306
|
+
|
|
307
|
+
// Load state from the URL and immediately persist it back to the URL
|
|
308
|
+
const restorationState = handler.getRestorationState();
|
|
309
|
+
handler.persistState(restorationState);
|
|
310
|
+
|
|
311
|
+
// Ensure the new URL includes the "normalized" facet parameter and not the numbered one
|
|
312
|
+
expect(decodeURIComponent(window.location.search)).to.include(
|
|
313
|
+
'and[]=subject:"foo"'
|
|
314
|
+
);
|
|
315
|
+
expect(new URL(window.location.href).searchParams.get('and[0]')).to.be.null;
|
|
316
|
+
});
|
|
273
317
|
});
|