@internetarchive/collection-browser 4.3.1-alpha-webdev8257.0 → 4.3.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 (41) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/app-root.d.ts +0 -8
  4. package/dist/src/app-root.js +672 -698
  5. package/dist/src/app-root.js.map +1 -1
  6. package/dist/src/collection-browser.d.ts +0 -8
  7. package/dist/src/collection-browser.js +762 -779
  8. package/dist/src/collection-browser.js.map +1 -1
  9. package/dist/src/tiles/base-tile-component.d.ts +1 -17
  10. package/dist/src/tiles/base-tile-component.js +1 -48
  11. package/dist/src/tiles/base-tile-component.js.map +1 -1
  12. package/dist/src/tiles/grid/item-tile.js +138 -139
  13. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  14. package/dist/src/tiles/list/tile-list-compact-header.js +46 -66
  15. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  16. package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
  17. package/dist/src/tiles/list/tile-list-compact.js +100 -132
  18. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  19. package/dist/src/tiles/list/tile-list.d.ts +1 -1
  20. package/dist/src/tiles/list/tile-list.js +298 -316
  21. package/dist/src/tiles/list/tile-list.js.map +1 -1
  22. package/dist/src/tiles/models.d.ts +0 -14
  23. package/dist/src/tiles/models.js.map +1 -1
  24. package/dist/src/tiles/tile-dispatcher.d.ts +0 -14
  25. package/dist/src/tiles/tile-dispatcher.js +216 -319
  26. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  27. package/index.ts +28 -29
  28. package/package.json +2 -2
  29. package/src/app-root.ts +1251 -1281
  30. package/src/collection-browser.ts +3049 -3063
  31. package/src/tiles/base-tile-component.ts +65 -121
  32. package/src/tiles/grid/item-tile.ts +346 -347
  33. package/src/tiles/list/tile-list-compact-header.ts +86 -106
  34. package/src/tiles/list/tile-list-compact.ts +239 -273
  35. package/src/tiles/list/tile-list.ts +700 -718
  36. package/src/tiles/models.ts +8 -24
  37. package/src/tiles/tile-dispatcher.ts +527 -637
  38. package/dist/src/styles/tile-action-styles.d.ts +0 -14
  39. package/dist/src/styles/tile-action-styles.js +0 -52
  40. package/dist/src/styles/tile-action-styles.js.map +0 -1
  41. package/src/styles/tile-action-styles.ts +0 -52
@@ -1,121 +1,65 @@
1
- import { html, LitElement, nothing, PropertyValues, TemplateResult } from 'lit';
2
- import { property } from 'lit/decorators.js';
3
- import type { SortParam } from '@internetarchive/search-service';
4
- import { TileDisplayValueProvider } from './tile-display-value-provider';
5
- import type { TileModel } from '../models';
6
- import { DateFormat, formatDate } from '../utils/format-date';
7
- import type { TileAction } from './models';
8
-
9
- export abstract class BaseTileComponent extends LitElement {
10
- @property({ type: Object }) model?: TileModel;
11
-
12
- /** Action buttons to display on this tile (rendered by subclasses) */
13
- @property({ type: Array }) tileActions: TileAction[] = [];
14
-
15
- @property({ type: Number }) currentWidth?: number;
16
-
17
- @property({ type: Number }) currentHeight?: number;
18
-
19
- @property({ type: String }) baseNavigationUrl?: string;
20
-
21
- @property({ type: String }) baseImageUrl?: string;
22
-
23
- @property({ type: String }) collectionPagePath?: string;
24
-
25
- @property({ type: Object }) sortParam: SortParam | null = null;
26
-
27
- @property({ type: Object }) defaultSortParam: SortParam | null = null;
28
-
29
- @property({ type: String }) creatorFilter?: string;
30
-
31
- @property({ type: Number }) mobileBreakpoint?: number;
32
-
33
- @property({ type: Boolean }) loggedIn = false;
34
-
35
- @property({ type: Boolean }) suppressBlurring = false;
36
-
37
- @property({ type: Boolean }) useLocalTime = false;
38
-
39
- protected displayValueProvider = new TileDisplayValueProvider();
40
-
41
- protected willUpdate(changed: PropertyValues<this>) {
42
- // Ensure the TileDisplayValueProvider stays up-to-date as properties change
43
- if (
44
- changed.has('model') ||
45
- changed.has('baseNavigationUrl') ||
46
- changed.has('collectionPagePath') ||
47
- changed.has('sortParam') ||
48
- changed.has('defaultSortParam') ||
49
- changed.has('creatorFilter')
50
- ) {
51
- this.displayValueProvider = new TileDisplayValueProvider({
52
- model: this.model,
53
- baseNavigationUrl: this.baseNavigationUrl,
54
- collectionPagePath: this.collectionPagePath,
55
- sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
56
- creatorFilter: this.creatorFilter,
57
- });
58
- }
59
- }
60
-
61
- /**
62
- * The formatted date string for given date and format type, taking into
63
- * account whether this tile component should be using local time or UTC.
64
- */
65
- protected getFormattedDate(date?: Date, format?: DateFormat): string {
66
- const { useLocalTime } = this;
67
- return formatDate(date, format, { useLocalTime });
68
- }
69
-
70
- /**
71
- * Renders the action buttons configured for this tile, or `nothing` if
72
- * there are none. Optional `extraClass` is appended to the container's
73
- * class list so subclasses can target their own layout tweaks.
74
- */
75
- protected renderTileActions(
76
- extraClass: string = '',
77
- ): TemplateResult | typeof nothing {
78
- if (!this.tileActions.length) return nothing;
79
-
80
- const containerClass = extraClass
81
- ? `tile-actions ${extraClass}`
82
- : 'tile-actions';
83
- return html`
84
- <div class=${containerClass}>
85
- ${this.tileActions.map(
86
- action => html`
87
- <button
88
- class="tile-action-btn"
89
- @click=${(e: Event) => this.handleTileActionClick(e, action)}
90
- >
91
- ${action.label}
92
- </button>
93
- `,
94
- )}
95
- </div>
96
- `;
97
- }
98
-
99
- /**
100
- * Click handler for tile action buttons. Stops propagation so the click
101
- * doesn't activate a wrapping tile link, and dispatches a
102
- * `tileActionClicked` event (bubbling + composed) carrying the action ID
103
- * and the tile model.
104
- */
105
- protected handleTileActionClick(e: Event, action: TileAction): void {
106
- e.preventDefault();
107
- e.stopPropagation();
108
- // Pre-set the hover pane controller's clicking flag so that focus
109
- // restoration after a consumer-opened modal won't trigger the hover pane.
110
- this.dispatchEvent(
111
- new PointerEvent('pointerdown', { bubbles: true, composed: true }),
112
- );
113
- this.dispatchEvent(
114
- new CustomEvent('tileActionClicked', {
115
- detail: { actionId: action.id, model: this.model },
116
- bubbles: true,
117
- composed: true,
118
- }),
119
- );
120
- }
121
- }
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import type { SortParam } from '@internetarchive/search-service';
4
+ import { TileDisplayValueProvider } from './tile-display-value-provider';
5
+ import type { TileModel } from '../models';
6
+ import { DateFormat, formatDate } from '../utils/format-date';
7
+
8
+ export abstract class BaseTileComponent extends LitElement {
9
+ @property({ type: Object }) model?: TileModel;
10
+
11
+ @property({ type: Number }) currentWidth?: number;
12
+
13
+ @property({ type: Number }) currentHeight?: number;
14
+
15
+ @property({ type: String }) baseNavigationUrl?: string;
16
+
17
+ @property({ type: String }) baseImageUrl?: string;
18
+
19
+ @property({ type: String }) collectionPagePath?: string;
20
+
21
+ @property({ type: Object }) sortParam: SortParam | null = null;
22
+
23
+ @property({ type: Object }) defaultSortParam: SortParam | null = null;
24
+
25
+ @property({ type: String }) creatorFilter?: string;
26
+
27
+ @property({ type: Number }) mobileBreakpoint?: number;
28
+
29
+ @property({ type: Boolean }) loggedIn = false;
30
+
31
+ @property({ type: Boolean }) suppressBlurring = false;
32
+
33
+ @property({ type: Boolean }) useLocalTime = false;
34
+
35
+ protected displayValueProvider = new TileDisplayValueProvider();
36
+
37
+ protected willUpdate(changed: PropertyValues<this>) {
38
+ // Ensure the TileDisplayValueProvider stays up-to-date as properties change
39
+ if (
40
+ changed.has('model') ||
41
+ changed.has('baseNavigationUrl') ||
42
+ changed.has('collectionPagePath') ||
43
+ changed.has('sortParam') ||
44
+ changed.has('defaultSortParam') ||
45
+ changed.has('creatorFilter')
46
+ ) {
47
+ this.displayValueProvider = new TileDisplayValueProvider({
48
+ model: this.model,
49
+ baseNavigationUrl: this.baseNavigationUrl,
50
+ collectionPagePath: this.collectionPagePath,
51
+ sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
52
+ creatorFilter: this.creatorFilter,
53
+ });
54
+ }
55
+ }
56
+
57
+ /**
58
+ * The formatted date string for given date and format type, taking into
59
+ * account whether this tile component should be using local time or UTC.
60
+ */
61
+ protected getFormattedDate(date?: Date, format?: DateFormat): string {
62
+ const { useLocalTime } = this;
63
+ return formatDate(date, format, { useLocalTime });
64
+ }
65
+ }