@internetarchive/collection-browser 4.5.1-alpha-webdev8221.0 → 4.5.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.
Files changed (69) hide show
  1. package/dist/index.js.map +1 -1
  2. package/dist/src/app-root.js +683 -683
  3. package/dist/src/app-root.js.map +1 -1
  4. package/dist/src/collection-browser.js +766 -766
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/facet-row.js +143 -143
  7. package/dist/src/collection-facets/facet-row.js.map +1 -1
  8. package/dist/src/collection-facets/facets-template.js +24 -24
  9. package/dist/src/collection-facets/facets-template.js.map +1 -1
  10. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  11. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  12. package/dist/src/restoration-state-handler.js.map +1 -1
  13. package/dist/src/styles/tile-action-styles.js +43 -43
  14. package/dist/src/styles/tile-action-styles.js.map +1 -1
  15. package/dist/src/tiles/base-tile-component.js +11 -11
  16. package/dist/src/tiles/base-tile-component.js.map +1 -1
  17. package/dist/src/tiles/grid/item-tile.js +138 -138
  18. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  19. package/dist/src/tiles/hover/hover-pane-controller.js +31 -29
  20. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  21. package/dist/src/tiles/list/tile-list-compact-header.js +62 -62
  22. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  23. package/dist/src/tiles/list/tile-list-compact.js +123 -123
  24. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  25. package/dist/src/tiles/list/tile-list.js +310 -310
  26. package/dist/src/tiles/list/tile-list.js.map +1 -1
  27. package/dist/src/tiles/models.js.map +1 -1
  28. package/dist/src/tiles/tile-dispatcher.js +286 -286
  29. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  30. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  31. package/dist/src/utils/date-filter-field.js.map +1 -1
  32. package/dist/test/collection-browser.test.js +203 -203
  33. package/dist/test/collection-browser.test.js.map +1 -1
  34. package/dist/test/collection-facets/facet-row.test.js +31 -31
  35. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  36. package/dist/test/tiles/grid/item-tile.test.js +77 -77
  37. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  38. package/dist/test/tiles/hover/hover-pane-controller.test.js +54 -27
  39. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  40. package/dist/test/tiles/list/tile-list.test.js +134 -134
  41. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  42. package/dist/test/tiles/tile-dispatcher.test.js +92 -92
  43. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  44. package/index.ts +29 -29
  45. package/package.json +1 -1
  46. package/src/app-root.ts +1284 -1284
  47. package/src/collection-browser.ts +3165 -3165
  48. package/src/collection-facets/facet-row.ts +309 -309
  49. package/src/collection-facets/facets-template.ts +85 -85
  50. package/src/data-source/collection-browser-data-source-interface.ts +351 -351
  51. package/src/data-source/collection-browser-data-source.ts +1474 -1474
  52. package/src/restoration-state-handler.ts +550 -550
  53. package/src/styles/tile-action-styles.ts +59 -59
  54. package/src/tiles/base-tile-component.ts +124 -124
  55. package/src/tiles/grid/item-tile.ts +347 -347
  56. package/src/tiles/hover/hover-pane-controller.ts +630 -628
  57. package/src/tiles/list/tile-list-compact-header.ts +112 -112
  58. package/src/tiles/list/tile-list-compact.ts +278 -278
  59. package/src/tiles/list/tile-list.ts +718 -718
  60. package/src/tiles/models.ts +21 -21
  61. package/src/tiles/tile-dispatcher.ts +637 -637
  62. package/src/tiles/tile-display-value-provider.ts +133 -133
  63. package/src/utils/date-filter-field.ts +11 -11
  64. package/test/collection-browser.test.ts +2639 -2639
  65. package/test/collection-facets/facet-row.test.ts +421 -421
  66. package/test/tiles/grid/item-tile.test.ts +520 -520
  67. package/test/tiles/hover/hover-pane-controller.test.ts +454 -418
  68. package/test/tiles/list/tile-list.test.ts +576 -576
  69. package/test/tiles/tile-dispatcher.test.ts +320 -320
@@ -1,59 +1,59 @@
1
- import { css } from 'lit';
2
-
3
- /**
4
- * Shared styles for tile action buttons rendered in grid, list-detail, and
5
- * list-compact display modes. Layout positioning is handled by each tile
6
- * component; these styles cover only the button appearance and the row
7
- * container's default flex behavior.
8
- *
9
- * Customizable via CSS custom properties:
10
- * - `--tileActionColor` (defaults to --primaryErrorCTAFill, then #d9534f)
11
- * - `--tileActionBg` (default: #fff)
12
- * - `--tileActionBorderColor` (defaults to --primaryErrorCTAFill, then #d9534f)
13
- * - `--tileActionHoverBg` (defaults to --primaryErrorCTAFillRGB at 20% alpha)
14
- * - `--tileActionHoverColor` (defaults to --tileActionColor)
15
- */
16
- export const tileActionStyles = css`
17
- .tile-actions {
18
- flex-shrink: 0;
19
- display: flex;
20
- gap: var(--tileActionGap, 0);
21
- }
22
-
23
- .tile-action-btn {
24
- flex: 1;
25
- padding: 6px 5px;
26
- border: 2px solid
27
- var(--tileActionBorderColor, var(--primaryErrorCTAFill, #d9534f));
28
- border-radius: var(--tileActionBorderRadius, 0);
29
- /* Inherit from the surrounding tile rather than the UA default for <button> */
30
- font-family: inherit;
31
- font-size: 1.2rem;
32
- font-weight: bold;
33
- cursor: pointer;
34
- color: var(--tileActionColor, var(--primaryErrorCTAFill, #d9534f));
35
- background: var(--tileActionBg, #fff);
36
- transition:
37
- background 0.15s,
38
- color 0.15s;
39
- }
40
-
41
- /*
42
- * When buttons are flush against each other (no gap), overlap their shared
43
- * edge by 1px so adjacent borders don't double up.
44
- */
45
- .tile-action-btn + .tile-action-btn {
46
- margin-left: -1px;
47
- }
48
-
49
- .tile-action-btn:hover {
50
- background: var(
51
- --tileActionHoverBg,
52
- rgba(var(--primaryErrorCTAFillRGB, 229, 28, 38), 0.2)
53
- );
54
- color: var(
55
- --tileActionHoverColor,
56
- var(--tileActionColor, var(--primaryErrorCTAFill, #d9534f))
57
- );
58
- }
59
- `;
1
+ import { css } from 'lit';
2
+
3
+ /**
4
+ * Shared styles for tile action buttons rendered in grid, list-detail, and
5
+ * list-compact display modes. Layout positioning is handled by each tile
6
+ * component; these styles cover only the button appearance and the row
7
+ * container's default flex behavior.
8
+ *
9
+ * Customizable via CSS custom properties:
10
+ * - `--tileActionColor` (defaults to --primaryErrorCTAFill, then #d9534f)
11
+ * - `--tileActionBg` (default: #fff)
12
+ * - `--tileActionBorderColor` (defaults to --primaryErrorCTAFill, then #d9534f)
13
+ * - `--tileActionHoverBg` (defaults to --primaryErrorCTAFillRGB at 20% alpha)
14
+ * - `--tileActionHoverColor` (defaults to --tileActionColor)
15
+ */
16
+ export const tileActionStyles = css`
17
+ .tile-actions {
18
+ flex-shrink: 0;
19
+ display: flex;
20
+ gap: var(--tileActionGap, 0);
21
+ }
22
+
23
+ .tile-action-btn {
24
+ flex: 1;
25
+ padding: 6px 5px;
26
+ border: 2px solid
27
+ var(--tileActionBorderColor, var(--primaryErrorCTAFill, #d9534f));
28
+ border-radius: var(--tileActionBorderRadius, 0);
29
+ /* Inherit from the surrounding tile rather than the UA default for <button> */
30
+ font-family: inherit;
31
+ font-size: 1.2rem;
32
+ font-weight: bold;
33
+ cursor: pointer;
34
+ color: var(--tileActionColor, var(--primaryErrorCTAFill, #d9534f));
35
+ background: var(--tileActionBg, #fff);
36
+ transition:
37
+ background 0.15s,
38
+ color 0.15s;
39
+ }
40
+
41
+ /*
42
+ * When buttons are flush against each other (no gap), overlap their shared
43
+ * edge by 1px so adjacent borders don't double up.
44
+ */
45
+ .tile-action-btn + .tile-action-btn {
46
+ margin-left: -1px;
47
+ }
48
+
49
+ .tile-action-btn:hover {
50
+ background: var(
51
+ --tileActionHoverBg,
52
+ rgba(var(--primaryErrorCTAFillRGB, 229, 28, 38), 0.2)
53
+ );
54
+ color: var(
55
+ --tileActionHoverColor,
56
+ var(--tileActionColor, var(--primaryErrorCTAFill, #d9534f))
57
+ );
58
+ }
59
+ `;
@@ -1,124 +1,124 @@
1
- import { html, LitElement, nothing, PropertyValues, TemplateResult } from 'lit';
2
- import { property } from 'lit/decorators.js';
3
- import { classMap } from 'lit/directives/class-map.js';
4
- import type { SortParam } from '@internetarchive/search-service';
5
- import { TileDisplayValueProvider } from './tile-display-value-provider';
6
- import type { TileModel } from '../models';
7
- import { DateFormat, formatDate } from '../utils/format-date';
8
- import type { TileAction } from './models';
9
-
10
- export abstract class BaseTileComponent extends LitElement {
11
- @property({ type: Object }) model?: TileModel;
12
-
13
- /** Action buttons to display on this tile (rendered by subclasses) */
14
- @property({ type: Array }) tileActions: TileAction[] = [];
15
-
16
- @property({ type: Number }) currentWidth?: number;
17
-
18
- @property({ type: Number }) currentHeight?: number;
19
-
20
- @property({ type: String }) baseNavigationUrl?: string;
21
-
22
- @property({ type: String }) baseImageUrl?: string;
23
-
24
- @property({ type: String }) collectionPagePath?: string;
25
-
26
- @property({ type: Object }) sortParam: SortParam | null = null;
27
-
28
- @property({ type: Object }) defaultSortParam: SortParam | null = null;
29
-
30
- @property({ type: String }) creatorFilter?: string;
31
-
32
- @property({ type: Number }) mobileBreakpoint?: number;
33
-
34
- @property({ type: Boolean }) loggedIn = false;
35
-
36
- @property({ type: Boolean }) suppressBlurring = false;
37
-
38
- @property({ type: Boolean }) useLocalTime = false;
39
-
40
- protected displayValueProvider = new TileDisplayValueProvider();
41
-
42
- protected willUpdate(changed: PropertyValues<this>) {
43
- // Ensure the TileDisplayValueProvider stays up-to-date as properties change
44
- if (
45
- changed.has('model') ||
46
- changed.has('baseNavigationUrl') ||
47
- changed.has('collectionPagePath') ||
48
- changed.has('sortParam') ||
49
- changed.has('defaultSortParam') ||
50
- changed.has('creatorFilter')
51
- ) {
52
- this.displayValueProvider = new TileDisplayValueProvider({
53
- model: this.model,
54
- baseNavigationUrl: this.baseNavigationUrl,
55
- collectionPagePath: this.collectionPagePath,
56
- sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
57
- creatorFilter: this.creatorFilter,
58
- });
59
- }
60
- }
61
-
62
- /**
63
- * The formatted date string for given date and format type, taking into
64
- * account whether this tile component should be using local time or UTC.
65
- */
66
- protected getFormattedDate(date?: Date, format?: DateFormat): string {
67
- const { useLocalTime } = this;
68
- return formatDate(date, format, { useLocalTime });
69
- }
70
-
71
- /**
72
- * Renders the action buttons configured for this tile, or `nothing` if
73
- * there are none. Optional `extraClass` is appended to the container's
74
- * class list so subclasses can target their own layout tweaks.
75
- */
76
- protected renderTileActions(
77
- extraClass: string = '',
78
- ): TemplateResult | typeof nothing {
79
- if (!this.tileActions.length) return nothing;
80
-
81
- const containerClasses = classMap({
82
- 'tile-actions': true,
83
- ...(extraClass && { [extraClass]: true }),
84
- });
85
-
86
- return html`
87
- <div class=${containerClasses}>
88
- ${this.tileActions.map(
89
- action => html`
90
- <button
91
- class="tile-action-btn"
92
- @click=${(e: Event) => this.handleTileActionClick(e, action)}
93
- >
94
- ${action.label}
95
- </button>
96
- `,
97
- )}
98
- </div>
99
- `;
100
- }
101
-
102
- /**
103
- * Click handler for tile action buttons. Stops propagation so the click
104
- * doesn't activate a wrapping tile link, and dispatches a
105
- * `tileActionClicked` event (bubbling + composed) carrying the action ID
106
- * and the tile model.
107
- */
108
- protected handleTileActionClick(e: Event, action: TileAction): void {
109
- e.preventDefault();
110
- e.stopPropagation();
111
- // Pre-set the hover pane controller's clicking flag so that focus
112
- // restoration after a consumer-opened modal won't trigger the hover pane.
113
- this.dispatchEvent(
114
- new PointerEvent('pointerdown', { bubbles: true, composed: true }),
115
- );
116
- this.dispatchEvent(
117
- new CustomEvent('tileActionClicked', {
118
- detail: { actionId: action.id, model: this.model },
119
- bubbles: true,
120
- composed: true,
121
- }),
122
- );
123
- }
124
- }
1
+ import { html, LitElement, nothing, PropertyValues, TemplateResult } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import type { SortParam } from '@internetarchive/search-service';
5
+ import { TileDisplayValueProvider } from './tile-display-value-provider';
6
+ import type { TileModel } from '../models';
7
+ import { DateFormat, formatDate } from '../utils/format-date';
8
+ import type { TileAction } from './models';
9
+
10
+ export abstract class BaseTileComponent extends LitElement {
11
+ @property({ type: Object }) model?: TileModel;
12
+
13
+ /** Action buttons to display on this tile (rendered by subclasses) */
14
+ @property({ type: Array }) tileActions: TileAction[] = [];
15
+
16
+ @property({ type: Number }) currentWidth?: number;
17
+
18
+ @property({ type: Number }) currentHeight?: number;
19
+
20
+ @property({ type: String }) baseNavigationUrl?: string;
21
+
22
+ @property({ type: String }) baseImageUrl?: string;
23
+
24
+ @property({ type: String }) collectionPagePath?: string;
25
+
26
+ @property({ type: Object }) sortParam: SortParam | null = null;
27
+
28
+ @property({ type: Object }) defaultSortParam: SortParam | null = null;
29
+
30
+ @property({ type: String }) creatorFilter?: string;
31
+
32
+ @property({ type: Number }) mobileBreakpoint?: number;
33
+
34
+ @property({ type: Boolean }) loggedIn = false;
35
+
36
+ @property({ type: Boolean }) suppressBlurring = false;
37
+
38
+ @property({ type: Boolean }) useLocalTime = false;
39
+
40
+ protected displayValueProvider = new TileDisplayValueProvider();
41
+
42
+ protected willUpdate(changed: PropertyValues<this>) {
43
+ // Ensure the TileDisplayValueProvider stays up-to-date as properties change
44
+ if (
45
+ changed.has('model') ||
46
+ changed.has('baseNavigationUrl') ||
47
+ changed.has('collectionPagePath') ||
48
+ changed.has('sortParam') ||
49
+ changed.has('defaultSortParam') ||
50
+ changed.has('creatorFilter')
51
+ ) {
52
+ this.displayValueProvider = new TileDisplayValueProvider({
53
+ model: this.model,
54
+ baseNavigationUrl: this.baseNavigationUrl,
55
+ collectionPagePath: this.collectionPagePath,
56
+ sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
57
+ creatorFilter: this.creatorFilter,
58
+ });
59
+ }
60
+ }
61
+
62
+ /**
63
+ * The formatted date string for given date and format type, taking into
64
+ * account whether this tile component should be using local time or UTC.
65
+ */
66
+ protected getFormattedDate(date?: Date, format?: DateFormat): string {
67
+ const { useLocalTime } = this;
68
+ return formatDate(date, format, { useLocalTime });
69
+ }
70
+
71
+ /**
72
+ * Renders the action buttons configured for this tile, or `nothing` if
73
+ * there are none. Optional `extraClass` is appended to the container's
74
+ * class list so subclasses can target their own layout tweaks.
75
+ */
76
+ protected renderTileActions(
77
+ extraClass: string = '',
78
+ ): TemplateResult | typeof nothing {
79
+ if (!this.tileActions.length) return nothing;
80
+
81
+ const containerClasses = classMap({
82
+ 'tile-actions': true,
83
+ ...(extraClass && { [extraClass]: true }),
84
+ });
85
+
86
+ return html`
87
+ <div class=${containerClasses}>
88
+ ${this.tileActions.map(
89
+ action => html`
90
+ <button
91
+ class="tile-action-btn"
92
+ @click=${(e: Event) => this.handleTileActionClick(e, action)}
93
+ >
94
+ ${action.label}
95
+ </button>
96
+ `,
97
+ )}
98
+ </div>
99
+ `;
100
+ }
101
+
102
+ /**
103
+ * Click handler for tile action buttons. Stops propagation so the click
104
+ * doesn't activate a wrapping tile link, and dispatches a
105
+ * `tileActionClicked` event (bubbling + composed) carrying the action ID
106
+ * and the tile model.
107
+ */
108
+ protected handleTileActionClick(e: Event, action: TileAction): void {
109
+ e.preventDefault();
110
+ e.stopPropagation();
111
+ // Pre-set the hover pane controller's clicking flag so that focus
112
+ // restoration after a consumer-opened modal won't trigger the hover pane.
113
+ this.dispatchEvent(
114
+ new PointerEvent('pointerdown', { bubbles: true, composed: true }),
115
+ );
116
+ this.dispatchEvent(
117
+ new CustomEvent('tileActionClicked', {
118
+ detail: { actionId: action.id, model: this.model },
119
+ bubbles: true,
120
+ composed: true,
121
+ }),
122
+ );
123
+ }
124
+ }