@internetarchive/collection-browser 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +27 -27
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.husky/pre-commit +4 -4
  7. package/.prettierignore +1 -1
  8. package/LICENSE +661 -661
  9. package/README.md +83 -83
  10. package/dist/src/app-root.js +614 -614
  11. package/dist/src/app-root.js.map +1 -1
  12. package/dist/src/collection-browser.js +764 -764
  13. package/dist/src/collection-browser.js.map +1 -1
  14. package/dist/src/collection-facets/more-facets-content.js +121 -121
  15. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  16. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  17. package/dist/src/models.js.map +1 -1
  18. package/dist/src/tiles/grid/collection-tile.js +89 -89
  19. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  20. package/dist/src/tiles/grid/item-tile.js +138 -138
  21. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  22. package/dist/src/tiles/hover/hover-pane-controller.js +28 -28
  23. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  24. package/dist/src/tiles/models.js.map +1 -1
  25. package/dist/src/tiles/tile-dispatcher.js +216 -216
  26. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  27. package/dist/test/collection-browser.test.js +1 -1
  28. package/dist/test/collection-browser.test.js.map +1 -1
  29. package/eslint.config.mjs +53 -53
  30. package/index.html +24 -24
  31. package/local.archive.org.cert +86 -86
  32. package/local.archive.org.key +27 -27
  33. package/package.json +121 -119
  34. package/renovate.json +6 -6
  35. package/src/app-root.ts +1166 -1166
  36. package/src/collection-browser.ts +3075 -3075
  37. package/src/collection-facets/more-facets-content.ts +644 -644
  38. package/src/data-source/collection-browser-query-state.ts +59 -59
  39. package/src/models.ts +873 -873
  40. package/src/tiles/grid/collection-tile.ts +184 -184
  41. package/src/tiles/grid/item-tile.ts +346 -346
  42. package/src/tiles/hover/hover-pane-controller.ts +627 -627
  43. package/src/tiles/models.ts +8 -8
  44. package/src/tiles/tile-dispatcher.ts +518 -518
  45. package/test/collection-browser.test.ts +1 -1
  46. package/tsconfig.json +25 -25
  47. package/web-dev-server.config.mjs +30 -30
  48. package/web-test-runner.config.mjs +52 -41
@@ -1,184 +1,184 @@
1
- import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';
2
- import { customElement, property } from 'lit/decorators.js';
3
- import { classMap } from 'lit/directives/class-map.js';
4
- import { msg } from '@lit/localize';
5
- import { collectionIcon } from '../../assets/img/icons/mediatype/collection';
6
- import { formatUnitSize } from '../../utils/format-unit-size';
7
- import { baseTileStyles } from './styles/tile-grid-shared-styles';
8
- import { BaseTileComponent } from '../base-tile-component';
9
- import { LayoutType } from '../models';
10
- import '../image-block';
11
-
12
- @customElement('collection-tile')
13
- export class CollectionTile extends BaseTileComponent {
14
- /*
15
- * Reactive properties inherited from BaseTileComponent:
16
- * - model?: TileModel;
17
- * - currentWidth?: number;
18
- * - currentHeight?: number;
19
- * - baseNavigationUrl?: string;
20
- * - baseImageUrl?: string;
21
- * - collectionPagePath?: string;
22
- * - sortParam: SortParam | null = null;
23
- * - creatorFilter?: string;
24
- * - mobileBreakpoint?: number;
25
- * - loggedIn = false;
26
- * - suppressBlurring = false;
27
- * - useLocalTime = false;
28
- */
29
-
30
- @property({ type: Boolean }) showInfoButton = false;
31
-
32
- @property({ type: String }) layoutType: LayoutType = 'default';
33
-
34
- render() {
35
- const containerClasses = classMap({
36
- container: true,
37
- minimal: this.layoutType === 'minimal',
38
- });
39
-
40
- return html`
41
- <div class=${containerClasses}>
42
- ${this.infoButtonTemplate}
43
- <div class="tile-details">
44
- <div class="item-info">
45
- ${this.getImageBlockTemplate} ${this.getTitleTemplate}
46
- </div>
47
- </div>
48
-
49
- ${this.getTileStatsTemplate}
50
- </div>
51
- `;
52
- }
53
-
54
- private get getImageBlockTemplate(): TemplateResult {
55
- return html`
56
- <image-block
57
- .model=${this.model}
58
- .baseImageUrl=${this.baseImageUrl}
59
- .viewSize=${'grid'}
60
- .suppressBlurring=${this.suppressBlurring}
61
- >
62
- </image-block>
63
- `;
64
- }
65
-
66
- private get getTitleTemplate() {
67
- return html`<div id="title">
68
- <h3 class="truncated">${this.model?.title}</h3>
69
- </div>`;
70
- }
71
-
72
- private get getTileStatsTemplate() {
73
- return html`
74
- <div id="item-stats">
75
- <div id="item-mediatype">${collectionIcon}</div>
76
-
77
- <div id="stats-row">
78
- ${this.getItemsTemplate} ${this.getSizeTemplate}
79
- </div>
80
- </div>
81
- `;
82
- }
83
-
84
- private get getItemsTemplate() {
85
- const collectionItems = this.model?.itemCount?.toLocaleString();
86
-
87
- return html`<span id="item-count"
88
- >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span
89
- >`;
90
- }
91
-
92
- private get getSizeTemplate() {
93
- const collectionSize = this.model?.collectionSize ?? 0;
94
-
95
- return collectionSize
96
- ? html`<span id="item-size">${formatUnitSize(collectionSize, 1)}</span>`
97
- : ``;
98
- }
99
-
100
- private get infoButtonTemplate(): TemplateResult | typeof nothing {
101
- // &#9432; is an information icon
102
- return this.showInfoButton
103
- ? html`<button class="info-button" @click=${this.infoButtonPressed}>
104
- &#9432;
105
- <span class="sr-only">${msg('More info')}</span>
106
- </button>`
107
- : nothing;
108
- }
109
-
110
- private infoButtonPressed(e: PointerEvent) {
111
- e.preventDefault();
112
- const event = new CustomEvent<{ x: number; y: number }>(
113
- 'infoButtonPressed',
114
- { detail: { x: e.clientX, y: e.clientY } },
115
- );
116
- this.dispatchEvent(event);
117
- }
118
-
119
- static get styles(): CSSResultGroup {
120
- const tileBorderColor = css`var(--tileBorderColor, #555555)`;
121
- const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;
122
- const whiteColor = css`#fff`;
123
-
124
- return [
125
- baseTileStyles,
126
- css`
127
- .container {
128
- background-color: ${tileBackgroundColor};
129
- border: 1px solid ${tileBorderColor};
130
- }
131
-
132
- .item-info {
133
- flex-grow: initial;
134
- }
135
-
136
- h4.truncated,
137
- h3.truncated {
138
- color: ${whiteColor};
139
- }
140
-
141
- #item-mediatype svg {
142
- filter: invert(100%);
143
- height: 2.5rem;
144
- align-items: baseline;
145
- }
146
-
147
- .container:hover > #title {
148
- text-decoration: underline;
149
- }
150
-
151
- /* this is a workaround for Safari 15 where the hover effects are not working */
152
- image-block:hover > #title {
153
- text-decoration: underline;
154
- }
155
-
156
- #item-stats {
157
- display: flex;
158
- padding: 0 5px 5px;
159
- align-items: center;
160
- }
161
-
162
- #stats-row {
163
- display: flex;
164
- align-items: baseline;
165
- color: ${whiteColor};
166
- flex-direction: column;
167
- margin-left: 10px;
168
- }
169
-
170
- .minimal #item-stats {
171
- display: none;
172
- }
173
-
174
- .minimal .truncated {
175
- -webkit-line-clamp: initial;
176
- }
177
-
178
- .minimal .item-info {
179
- padding-bottom: 5px;
180
- }
181
- `,
182
- ];
183
- }
184
- }
1
+ import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import { msg } from '@lit/localize';
5
+ import { collectionIcon } from '../../assets/img/icons/mediatype/collection';
6
+ import { formatUnitSize } from '../../utils/format-unit-size';
7
+ import { baseTileStyles } from './styles/tile-grid-shared-styles';
8
+ import { BaseTileComponent } from '../base-tile-component';
9
+ import { LayoutType } from '../models';
10
+ import '../image-block';
11
+
12
+ @customElement('collection-tile')
13
+ export class CollectionTile extends BaseTileComponent {
14
+ /*
15
+ * Reactive properties inherited from BaseTileComponent:
16
+ * - model?: TileModel;
17
+ * - currentWidth?: number;
18
+ * - currentHeight?: number;
19
+ * - baseNavigationUrl?: string;
20
+ * - baseImageUrl?: string;
21
+ * - collectionPagePath?: string;
22
+ * - sortParam: SortParam | null = null;
23
+ * - creatorFilter?: string;
24
+ * - mobileBreakpoint?: number;
25
+ * - loggedIn = false;
26
+ * - suppressBlurring = false;
27
+ * - useLocalTime = false;
28
+ */
29
+
30
+ @property({ type: Boolean }) showInfoButton = false;
31
+
32
+ @property({ type: String }) layoutType: LayoutType = 'default';
33
+
34
+ render() {
35
+ const containerClasses = classMap({
36
+ container: true,
37
+ minimal: this.layoutType === 'minimal',
38
+ });
39
+
40
+ return html`
41
+ <div class=${containerClasses}>
42
+ ${this.infoButtonTemplate}
43
+ <div class="tile-details">
44
+ <div class="item-info">
45
+ ${this.getImageBlockTemplate} ${this.getTitleTemplate}
46
+ </div>
47
+ </div>
48
+
49
+ ${this.getTileStatsTemplate}
50
+ </div>
51
+ `;
52
+ }
53
+
54
+ private get getImageBlockTemplate(): TemplateResult {
55
+ return html`
56
+ <image-block
57
+ .model=${this.model}
58
+ .baseImageUrl=${this.baseImageUrl}
59
+ .viewSize=${'grid'}
60
+ .suppressBlurring=${this.suppressBlurring}
61
+ >
62
+ </image-block>
63
+ `;
64
+ }
65
+
66
+ private get getTitleTemplate() {
67
+ return html`<div id="title">
68
+ <h3 class="truncated">${this.model?.title}</h3>
69
+ </div>`;
70
+ }
71
+
72
+ private get getTileStatsTemplate() {
73
+ return html`
74
+ <div id="item-stats">
75
+ <div id="item-mediatype">${collectionIcon}</div>
76
+
77
+ <div id="stats-row">
78
+ ${this.getItemsTemplate} ${this.getSizeTemplate}
79
+ </div>
80
+ </div>
81
+ `;
82
+ }
83
+
84
+ private get getItemsTemplate() {
85
+ const collectionItems = this.model?.itemCount?.toLocaleString();
86
+
87
+ return html`<span id="item-count"
88
+ >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span
89
+ >`;
90
+ }
91
+
92
+ private get getSizeTemplate() {
93
+ const collectionSize = this.model?.collectionSize ?? 0;
94
+
95
+ return collectionSize
96
+ ? html`<span id="item-size">${formatUnitSize(collectionSize, 1)}</span>`
97
+ : ``;
98
+ }
99
+
100
+ private get infoButtonTemplate(): TemplateResult | typeof nothing {
101
+ // &#9432; is an information icon
102
+ return this.showInfoButton
103
+ ? html`<button class="info-button" @click=${this.infoButtonPressed}>
104
+ &#9432;
105
+ <span class="sr-only">${msg('More info')}</span>
106
+ </button>`
107
+ : nothing;
108
+ }
109
+
110
+ private infoButtonPressed(e: PointerEvent) {
111
+ e.preventDefault();
112
+ const event = new CustomEvent<{ x: number; y: number }>(
113
+ 'infoButtonPressed',
114
+ { detail: { x: e.clientX, y: e.clientY } },
115
+ );
116
+ this.dispatchEvent(event);
117
+ }
118
+
119
+ static get styles(): CSSResultGroup {
120
+ const tileBorderColor = css`var(--tileBorderColor, #555555)`;
121
+ const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;
122
+ const whiteColor = css`#fff`;
123
+
124
+ return [
125
+ baseTileStyles,
126
+ css`
127
+ .container {
128
+ background-color: ${tileBackgroundColor};
129
+ border: 1px solid ${tileBorderColor};
130
+ }
131
+
132
+ .item-info {
133
+ flex-grow: initial;
134
+ }
135
+
136
+ h4.truncated,
137
+ h3.truncated {
138
+ color: ${whiteColor};
139
+ }
140
+
141
+ #item-mediatype svg {
142
+ filter: invert(100%);
143
+ height: 2.5rem;
144
+ align-items: baseline;
145
+ }
146
+
147
+ .container:hover > #title {
148
+ text-decoration: underline;
149
+ }
150
+
151
+ /* this is a workaround for Safari 15 where the hover effects are not working */
152
+ image-block:hover > #title {
153
+ text-decoration: underline;
154
+ }
155
+
156
+ #item-stats {
157
+ display: flex;
158
+ padding: 0 5px 5px;
159
+ align-items: center;
160
+ }
161
+
162
+ #stats-row {
163
+ display: flex;
164
+ align-items: baseline;
165
+ color: ${whiteColor};
166
+ flex-direction: column;
167
+ margin-left: 10px;
168
+ }
169
+
170
+ .minimal #item-stats {
171
+ display: none;
172
+ }
173
+
174
+ .minimal .truncated {
175
+ -webkit-line-clamp: initial;
176
+ }
177
+
178
+ .minimal .item-info {
179
+ padding-bottom: 5px;
180
+ }
181
+ `,
182
+ ];
183
+ }
184
+ }