@internetarchive/collection-browser 4.4.1 → 4.5.1-alpha-webdev8221.0

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 (85) 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 +1 -1
  7. package/.prettierignore +1 -1
  8. package/LICENSE +661 -661
  9. package/README.md +83 -83
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/src/app-root.d.ts +8 -0
  13. package/dist/src/app-root.js +26 -0
  14. package/dist/src/app-root.js.map +1 -1
  15. package/dist/src/collection-browser.d.ts +8 -4
  16. package/dist/src/collection-browser.js +20 -11
  17. package/dist/src/collection-browser.js.map +1 -1
  18. package/dist/src/collection-facets/facet-row.d.ts +6 -0
  19. package/dist/src/collection-facets/facet-row.js +19 -1
  20. package/dist/src/collection-facets/facet-row.js.map +1 -1
  21. package/dist/src/collection-facets/facets-template.js +2 -0
  22. package/dist/src/collection-facets/facets-template.js.map +1 -1
  23. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +5 -0
  24. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  25. package/dist/src/data-source/collection-browser-data-source.d.ts +1 -1
  26. package/dist/src/data-source/collection-browser-data-source.js +8 -6
  27. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  28. package/dist/src/restoration-state-handler.js +2 -4
  29. package/dist/src/restoration-state-handler.js.map +1 -1
  30. package/dist/src/styles/tile-action-styles.d.ts +14 -0
  31. package/dist/src/styles/tile-action-styles.js +59 -0
  32. package/dist/src/styles/tile-action-styles.js.map +1 -0
  33. package/dist/src/tiles/base-tile-component.d.ts +17 -1
  34. package/dist/src/tiles/base-tile-component.js +50 -1
  35. package/dist/src/tiles/base-tile-component.js.map +1 -1
  36. package/dist/src/tiles/grid/item-tile.js +1 -0
  37. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  38. package/dist/src/tiles/list/tile-list-compact-header.js +27 -2
  39. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  40. package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
  41. package/dist/src/tiles/list/tile-list-compact.js +113 -75
  42. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  43. package/dist/src/tiles/list/tile-list.d.ts +1 -1
  44. package/dist/src/tiles/list/tile-list.js +164 -146
  45. package/dist/src/tiles/list/tile-list.js.map +1 -1
  46. package/dist/src/tiles/models.d.ts +11 -0
  47. package/dist/src/tiles/models.js.map +1 -1
  48. package/dist/src/tiles/tile-dispatcher.d.ts +14 -0
  49. package/dist/src/tiles/tile-dispatcher.js +107 -4
  50. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  51. package/dist/src/utils/date-filter-field.d.ts +6 -0
  52. package/dist/src/utils/date-filter-field.js +9 -0
  53. package/dist/src/utils/date-filter-field.js.map +1 -0
  54. package/dist/test/collection-browser.test.js +81 -0
  55. package/dist/test/collection-browser.test.js.map +1 -1
  56. package/dist/test/collection-facets/facet-row.test.js +32 -0
  57. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  58. package/eslint.config.mjs +53 -53
  59. package/index.html +24 -24
  60. package/index.ts +1 -0
  61. package/local.archive.org.cert +86 -86
  62. package/local.archive.org.key +27 -27
  63. package/package.json +120 -120
  64. package/renovate.json +6 -6
  65. package/src/app-root.ts +30 -0
  66. package/src/collection-browser.ts +17 -13
  67. package/src/collection-facets/facet-row.ts +11 -1
  68. package/src/collection-facets/facets-template.ts +2 -0
  69. package/src/data-source/collection-browser-data-source-interface.ts +6 -0
  70. package/src/data-source/collection-browser-data-source.ts +16 -7
  71. package/src/restoration-state-handler.ts +5 -5
  72. package/src/styles/tile-action-styles.ts +59 -0
  73. package/src/tiles/base-tile-component.ts +60 -1
  74. package/src/tiles/grid/item-tile.ts +1 -0
  75. package/src/tiles/list/tile-list-compact-header.ts +28 -2
  76. package/src/tiles/list/tile-list-compact.ts +114 -75
  77. package/src/tiles/list/tile-list.ts +190 -172
  78. package/src/tiles/models.ts +13 -0
  79. package/src/tiles/tile-dispatcher.ts +114 -4
  80. package/src/utils/date-filter-field.ts +11 -0
  81. package/test/collection-browser.test.ts +132 -0
  82. package/test/collection-facets/facet-row.test.ts +46 -0
  83. package/tsconfig.json +25 -25
  84. package/web-dev-server.config.mjs +30 -30
  85. package/web-test-runner.config.mjs +52 -52
@@ -0,0 +1,59 @@
1
+ import { css } from 'lit';
2
+ /**
3
+ * Shared styles for tile action buttons rendered in grid, list-detail, and
4
+ * list-compact display modes. Layout positioning is handled by each tile
5
+ * component; these styles cover only the button appearance and the row
6
+ * container's default flex behavior.
7
+ *
8
+ * Customizable via CSS custom properties:
9
+ * - `--tileActionColor` (defaults to --primaryErrorCTAFill, then #d9534f)
10
+ * - `--tileActionBg` (default: #fff)
11
+ * - `--tileActionBorderColor` (defaults to --primaryErrorCTAFill, then #d9534f)
12
+ * - `--tileActionHoverBg` (defaults to --primaryErrorCTAFillRGB at 20% alpha)
13
+ * - `--tileActionHoverColor` (defaults to --tileActionColor)
14
+ */
15
+ export const tileActionStyles = css `
16
+ .tile-actions {
17
+ flex-shrink: 0;
18
+ display: flex;
19
+ gap: var(--tileActionGap, 0);
20
+ }
21
+
22
+ .tile-action-btn {
23
+ flex: 1;
24
+ padding: 6px 5px;
25
+ border: 2px solid
26
+ var(--tileActionBorderColor, var(--primaryErrorCTAFill, #d9534f));
27
+ border-radius: var(--tileActionBorderRadius, 0);
28
+ /* Inherit from the surrounding tile rather than the UA default for <button> */
29
+ font-family: inherit;
30
+ font-size: 1.2rem;
31
+ font-weight: bold;
32
+ cursor: pointer;
33
+ color: var(--tileActionColor, var(--primaryErrorCTAFill, #d9534f));
34
+ background: var(--tileActionBg, #fff);
35
+ transition:
36
+ background 0.15s,
37
+ color 0.15s;
38
+ }
39
+
40
+ /*
41
+ * When buttons are flush against each other (no gap), overlap their shared
42
+ * edge by 1px so adjacent borders don't double up.
43
+ */
44
+ .tile-action-btn + .tile-action-btn {
45
+ margin-left: -1px;
46
+ }
47
+
48
+ .tile-action-btn:hover {
49
+ background: var(
50
+ --tileActionHoverBg,
51
+ rgba(var(--primaryErrorCTAFillRGB, 229, 28, 38), 0.2)
52
+ );
53
+ color: var(
54
+ --tileActionHoverColor,
55
+ var(--tileActionColor, var(--primaryErrorCTAFill, #d9534f))
56
+ );
57
+ }
58
+ `;
59
+ //# sourceMappingURL=tile-action-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile-action-styles.js","sourceRoot":"","sources":["../../../src/styles/tile-action-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ClC,CAAC","sourcesContent":["import { css } from 'lit';\n\n/**\n * Shared styles for tile action buttons rendered in grid, list-detail, and\n * list-compact display modes. Layout positioning is handled by each tile\n * component; these styles cover only the button appearance and the row\n * container's default flex behavior.\n *\n * Customizable via CSS custom properties:\n * - `--tileActionColor` (defaults to --primaryErrorCTAFill, then #d9534f)\n * - `--tileActionBg` (default: #fff)\n * - `--tileActionBorderColor` (defaults to --primaryErrorCTAFill, then #d9534f)\n * - `--tileActionHoverBg` (defaults to --primaryErrorCTAFillRGB at 20% alpha)\n * - `--tileActionHoverColor` (defaults to --tileActionColor)\n */\nexport const tileActionStyles = css`\n .tile-actions {\n flex-shrink: 0;\n display: flex;\n gap: var(--tileActionGap, 0);\n }\n\n .tile-action-btn {\n flex: 1;\n padding: 6px 5px;\n border: 2px solid\n var(--tileActionBorderColor, var(--primaryErrorCTAFill, #d9534f));\n border-radius: var(--tileActionBorderRadius, 0);\n /* Inherit from the surrounding tile rather than the UA default for <button> */\n font-family: inherit;\n font-size: 1.2rem;\n font-weight: bold;\n cursor: pointer;\n color: var(--tileActionColor, var(--primaryErrorCTAFill, #d9534f));\n background: var(--tileActionBg, #fff);\n transition:\n background 0.15s,\n color 0.15s;\n }\n\n /*\n * When buttons are flush against each other (no gap), overlap their shared\n * edge by 1px so adjacent borders don't double up.\n */\n .tile-action-btn + .tile-action-btn {\n margin-left: -1px;\n }\n\n .tile-action-btn:hover {\n background: var(\n --tileActionHoverBg,\n rgba(var(--primaryErrorCTAFillRGB, 229, 28, 38), 0.2)\n );\n color: var(\n --tileActionHoverColor,\n var(--tileActionColor, var(--primaryErrorCTAFill, #d9534f))\n );\n }\n`;\n"]}
@@ -1,10 +1,13 @@
1
- import { LitElement, PropertyValues } from 'lit';
1
+ import { LitElement, nothing, PropertyValues, TemplateResult } from 'lit';
2
2
  import type { SortParam } from '@internetarchive/search-service';
3
3
  import { TileDisplayValueProvider } from './tile-display-value-provider';
4
4
  import type { TileModel } from '../models';
5
5
  import { DateFormat } from '../utils/format-date';
6
+ import type { TileAction } from './models';
6
7
  export declare abstract class BaseTileComponent extends LitElement {
7
8
  model?: TileModel;
9
+ /** Action buttons to display on this tile (rendered by subclasses) */
10
+ tileActions: TileAction[];
8
11
  currentWidth?: number;
9
12
  currentHeight?: number;
10
13
  baseNavigationUrl?: string;
@@ -24,4 +27,17 @@ export declare abstract class BaseTileComponent extends LitElement {
24
27
  * account whether this tile component should be using local time or UTC.
25
28
  */
26
29
  protected getFormattedDate(date?: Date, format?: DateFormat): string;
30
+ /**
31
+ * Renders the action buttons configured for this tile, or `nothing` if
32
+ * there are none. Optional `extraClass` is appended to the container's
33
+ * class list so subclasses can target their own layout tweaks.
34
+ */
35
+ protected renderTileActions(extraClass?: string): TemplateResult | typeof nothing;
36
+ /**
37
+ * Click handler for tile action buttons. Stops propagation so the click
38
+ * doesn't activate a wrapping tile link, and dispatches a
39
+ * `tileActionClicked` event (bubbling + composed) carrying the action ID
40
+ * and the tile model.
41
+ */
42
+ protected handleTileActionClick(e: Event, action: TileAction): void;
27
43
  }
@@ -1,11 +1,14 @@
1
1
  import { __decorate } from "tslib";
2
- import { LitElement } from 'lit';
2
+ import { html, LitElement, nothing } from 'lit';
3
3
  import { property } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
4
5
  import { TileDisplayValueProvider } from './tile-display-value-provider';
5
6
  import { formatDate } from '../utils/format-date';
6
7
  export class BaseTileComponent extends LitElement {
7
8
  constructor() {
8
9
  super(...arguments);
10
+ /** Action buttons to display on this tile (rendered by subclasses) */
11
+ this.tileActions = [];
9
12
  this.sortParam = null;
10
13
  this.defaultSortParam = null;
11
14
  this.loggedIn = false;
@@ -38,10 +41,56 @@ export class BaseTileComponent extends LitElement {
38
41
  const { useLocalTime } = this;
39
42
  return formatDate(date, format, { useLocalTime });
40
43
  }
44
+ /**
45
+ * Renders the action buttons configured for this tile, or `nothing` if
46
+ * there are none. Optional `extraClass` is appended to the container's
47
+ * class list so subclasses can target their own layout tweaks.
48
+ */
49
+ renderTileActions(extraClass = '') {
50
+ if (!this.tileActions.length)
51
+ return nothing;
52
+ const containerClasses = classMap({
53
+ 'tile-actions': true,
54
+ ...(extraClass && { [extraClass]: true }),
55
+ });
56
+ return html `
57
+ <div class=${containerClasses}>
58
+ ${this.tileActions.map(action => html `
59
+ <button
60
+ class="tile-action-btn"
61
+ @click=${(e) => this.handleTileActionClick(e, action)}
62
+ >
63
+ ${action.label}
64
+ </button>
65
+ `)}
66
+ </div>
67
+ `;
68
+ }
69
+ /**
70
+ * Click handler for tile action buttons. Stops propagation so the click
71
+ * doesn't activate a wrapping tile link, and dispatches a
72
+ * `tileActionClicked` event (bubbling + composed) carrying the action ID
73
+ * and the tile model.
74
+ */
75
+ handleTileActionClick(e, action) {
76
+ e.preventDefault();
77
+ e.stopPropagation();
78
+ // Pre-set the hover pane controller's clicking flag so that focus
79
+ // restoration after a consumer-opened modal won't trigger the hover pane.
80
+ this.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, composed: true }));
81
+ this.dispatchEvent(new CustomEvent('tileActionClicked', {
82
+ detail: { actionId: action.id, model: this.model },
83
+ bubbles: true,
84
+ composed: true,
85
+ }));
86
+ }
41
87
  }
42
88
  __decorate([
43
89
  property({ type: Object })
44
90
  ], BaseTileComponent.prototype, "model", void 0);
91
+ __decorate([
92
+ property({ type: Array })
93
+ ], BaseTileComponent.prototype, "tileActions", void 0);
45
94
  __decorate([
46
95
  property({ type: Number })
47
96
  ], BaseTileComponent.prototype, "currentWidth", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"base-tile-component.js","sourceRoot":"","sources":["../../../src/tiles/base-tile-component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAc,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,OAAgB,iBAAkB,SAAQ,UAAU;IAA1D;;QAa8B,cAAS,GAAqB,IAAI,CAAC;QAEnC,qBAAgB,GAAqB,IAAI,CAAC;QAMzC,aAAQ,GAAG,KAAK,CAAC;QAEjB,qBAAgB,GAAG,KAAK,CAAC;QAEzB,iBAAY,GAAG,KAAK,CAAC;QAExC,yBAAoB,GAAG,IAAI,wBAAwB,EAAE,CAAC;IA8BlE,CAAC;IA5BW,UAAU,CAAC,OAA6B;QAChD,4EAA4E;QAC5E,IACE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;YAC/B,O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A3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAA2B;AAEzB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DAA0B;AAEzB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAsB","sourcesContent":["import { LitElement, PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { SortParam } from '@internetarchive/search-service';\nimport { TileDisplayValueProvider } from './tile-display-value-provider';\nimport type { TileModel } from '../models';\nimport { DateFormat, formatDate } from '../utils/format-date';\n\nexport abstract class BaseTileComponent extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: String }) collectionPagePath?: string;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @property({ type: Object }) defaultSortParam: SortParam | null = null;\n\n @property({ type: String }) creatorFilter?: string;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Boolean }) suppressBlurring = false;\n\n @property({ type: Boolean }) useLocalTime = false;\n\n protected displayValueProvider = new TileDisplayValueProvider();\n\n protected willUpdate(changed: PropertyValues<this>) {\n // Ensure the TileDisplayValueProvider stays up-to-date as properties change\n if (\n changed.has('model') ||\n changed.has('baseNavigationUrl') ||\n changed.has('collectionPagePath') ||\n changed.has('sortParam') ||\n changed.has('defaultSortParam') ||\n changed.has('creatorFilter')\n ) {\n this.displayValueProvider = new TileDisplayValueProvider({\n model: this.model,\n baseNavigationUrl: this.baseNavigationUrl,\n collectionPagePath: this.collectionPagePath,\n sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,\n creatorFilter: this.creatorFilter,\n });\n }\n }\n\n /**\n * The formatted date string for given date and format type, taking into\n * account whether this tile component should be using local time or UTC.\n */\n protected getFormattedDate(date?: Date, format?: DateFormat): string {\n const { useLocalTime } = this;\n return formatDate(date, format, { useLocalTime });\n }\n}\n"]}
1
+ {"version":3,"file":"base-tile-component.js","sourceRoot":"","sources":["../../../src/tiles/base-tile-component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAc,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAG9D,MAAM,OAAgB,iBAAkB,SAAQ,UAAU;IAA1D;;QAGE,sEAAsE;QAC3C,gBAAW,GAAiB,EAAE,CAAC;QAY9B,cAAS,GAAqB,IAAI,CAAC;QAEnC,qBAAgB,GAAqB,IAAI,CAAC;QAMzC,aAAQ,GAAG,KAAK,CAAC;QAEjB,qBAAgB,GAAG,KAAK,CAAC;QAEzB,iBAAY,GAAG,KAAK,CAAC;QAExC,yBAAoB,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAoFlE,CAAC;IAlFW,UAAU,CAAC,OAA6B;QAChD,4EAA4E;QAC5E,IACE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAC5B,CAAC;YACD,IAAI,CAAC,oBAAoB,GAAG,IAAI,wBAAwB,CAA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AE,IAAI,EAAE,OAAO,EAAE,CAAC;2DAA0B;AAEzB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAsB","sourcesContent":["import { html, LitElement, nothing, PropertyValues, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport type { SortParam } from '@internetarchive/search-service';\nimport { TileDisplayValueProvider } from './tile-display-value-provider';\nimport type { TileModel } from '../models';\nimport { DateFormat, formatDate } from '../utils/format-date';\nimport type { TileAction } from './models';\n\nexport abstract class BaseTileComponent extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n /** Action buttons to display on this tile (rendered by subclasses) */\n @property({ type: Array }) tileActions: TileAction[] = [];\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: String }) collectionPagePath?: string;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @property({ type: Object }) defaultSortParam: SortParam | null = null;\n\n @property({ type: String }) creatorFilter?: string;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Boolean }) suppressBlurring = false;\n\n @property({ type: Boolean }) useLocalTime = false;\n\n protected displayValueProvider = new TileDisplayValueProvider();\n\n protected willUpdate(changed: PropertyValues<this>) {\n // Ensure the TileDisplayValueProvider stays up-to-date as properties change\n if (\n changed.has('model') ||\n changed.has('baseNavigationUrl') ||\n changed.has('collectionPagePath') ||\n changed.has('sortParam') ||\n changed.has('defaultSortParam') ||\n changed.has('creatorFilter')\n ) {\n this.displayValueProvider = new TileDisplayValueProvider({\n model: this.model,\n baseNavigationUrl: this.baseNavigationUrl,\n collectionPagePath: this.collectionPagePath,\n sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,\n creatorFilter: this.creatorFilter,\n });\n }\n }\n\n /**\n * The formatted date string for given date and format type, taking into\n * account whether this tile component should be using local time or UTC.\n */\n protected getFormattedDate(date?: Date, format?: DateFormat): string {\n const { useLocalTime } = this;\n return formatDate(date, format, { useLocalTime });\n }\n\n /**\n * Renders the action buttons configured for this tile, or `nothing` if\n * there are none. Optional `extraClass` is appended to the container's\n * class list so subclasses can target their own layout tweaks.\n */\n protected renderTileActions(\n extraClass: string = '',\n ): TemplateResult | typeof nothing {\n if (!this.tileActions.length) return nothing;\n\n const containerClasses = classMap({\n 'tile-actions': true,\n ...(extraClass && { [extraClass]: true }),\n });\n\n return html`\n <div class=${containerClasses}>\n ${this.tileActions.map(\n action => html`\n <button\n class=\"tile-action-btn\"\n @click=${(e: Event) => this.handleTileActionClick(e, action)}\n >\n ${action.label}\n </button>\n `,\n )}\n </div>\n `;\n }\n\n /**\n * Click handler for tile action buttons. Stops propagation so the click\n * doesn't activate a wrapping tile link, and dispatches a\n * `tileActionClicked` event (bubbling + composed) carrying the action ID\n * and the tile model.\n */\n protected handleTileActionClick(e: Event, action: TileAction): void {\n e.preventDefault();\n e.stopPropagation();\n // Pre-set the hover pane controller's clicking flag so that focus\n // restoration after a consumer-opened modal won't trigger the hover pane.\n this.dispatchEvent(\n new PointerEvent('pointerdown', { bubbles: true, composed: true }),\n );\n this.dispatchEvent(\n new CustomEvent('tileActionClicked', {\n detail: { actionId: action.id, model: this.model },\n bubbles: true,\n composed: true,\n }),\n );\n }\n}\n"]}
@@ -19,6 +19,7 @@ let ItemTile = class ItemTile extends BaseTileComponent {
19
19
  /*
20
20
  * Reactive properties inherited from BaseTileComponent:
21
21
  * - model?: TileModel;
22
+ * - tileActions: TileAction[] = [];
22
23
  * - currentWidth?: number;
23
24
  * - currentHeight?: number;
24
25
  * - baseNavigationUrl?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAA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AA;;;;;;;;;;8BAUqB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+CtC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAjT8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAwB;AAEvB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAqB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoC;AAtBpD,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAmUpB","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { map } from 'lit/directives/map.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { msg } from '@lit/localize';\n\nimport type { SortParam } from '@internetarchive/search-service';\nimport type { DateFormat } from '../../utils/format-date';\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\nimport { BaseTileComponent } from '../base-tile-component';\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\nimport { LayoutType } from '../models';\n\nimport '../image-block';\nimport '../review-block';\nimport '../text-snippet-block';\nimport '../item-image';\nimport '../tile-mediatype-icon';\nimport './tile-stats';\n\n@customElement('item-tile')\nexport class ItemTile extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n * - useLocalTime = false;\n */\n\n @property({ type: Boolean }) showInfoButton = false;\n\n @property({ type: Boolean }) showTvClips = false;\n\n @property({ type: String }) layoutType: LayoutType = 'default';\n\n render() {\n const itemTitle = this.model?.title;\n const containerClasses = classMap({\n container: true,\n simple: this.layoutType !== 'default',\n 'stats-only': this.layoutType === 'stats-only',\n 'snippets-only': this.layoutType === 'snippets-only',\n minimal: this.layoutType === 'minimal',\n });\n\n return html`\n <div class=${containerClasses}>\n ${this.infoButtonTemplate}\n <div class=\"tile-details\">\n <div class=\"item-info\">\n ${this.imageBlockTemplate}\n\n <div id=\"title\">\n <h3 class=\"truncated\" title=${ifDefined(itemTitle)}>\n ${itemTitle}\n </h3>\n </div>\n\n ${this.volumeIssueTemplate}\n ${this.isSortedByDate\n ? this.sortedDateInfoTemplate\n : this.creatorTemplate}\n ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}\n ${this.reviewBlockTemplate}\n </div>\n\n ${this.tileStatsTemplate}\n </div>\n </div>\n `;\n }\n\n /**\n * Templates\n */\n private get creatorTemplate(): TemplateResult | typeof nothing {\n const displayedCreator =\n this.displayValueProvider.firstCreatorMatchingFilter;\n if (!displayedCreator) return nothing;\n\n return html`\n <div class=\"created-by\">\n <span class=\"truncated\" title=${displayedCreator}>\n by&nbsp;${displayedCreator}\n </span>\n </div>\n `;\n }\n\n private get imageBlockTemplate(): TemplateResult {\n return html`\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .isCompactTile=${false}\n .isListTile=${false}\n .viewSize=${'grid'}\n >\n </image-block>\n `;\n }\n\n private get sortedDateInfoTemplate() {\n let sortedValue;\n let format: DateFormat = 'long';\n switch (this.effectiveSort?.field) {\n case 'date': {\n const datePublished = this.model?.datePublished;\n sortedValue = { field: 'published', value: datePublished };\n if (isFirstMillisecondOfUTCYear(datePublished)) {\n format = 'year-only';\n }\n break;\n }\n case 'reviewdate':\n sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };\n break;\n case 'addeddate':\n sortedValue = { field: 'added', value: this.model?.dateAdded };\n break;\n case 'publicdate':\n sortedValue = { field: 'archived', value: this.model?.dateArchived };\n break;\n default:\n break;\n }\n\n if (!sortedValue?.value) {\n return nothing;\n }\n\n const formattedDate = this.getFormattedDate(sortedValue.value, format);\n return html`\n <div class=\"date-sorted-by truncated\">\n <span>${sortedValue.field} ${formattedDate}</span>\n </div>\n `;\n }\n\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\n // &#9432; is an information icon\n return this.showInfoButton\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\n &#9432;\n <span class=\"sr-only\">${msg('More info')}</span>\n </button>`\n : nothing;\n }\n\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.review) return nothing;\n\n const { reviewtitle, reviewbody, stars } = this.model.review;\n return html`\n <review-block\n viewsize=\"grid\"\n title=${ifDefined(reviewtitle)}\n body=${ifDefined(reviewbody)}\n starRating=${ifDefined(stars)}\n >\n </review-block>\n `;\n }\n\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\n if (!this.hasSnippets) return nothing;\n if (['stats-only', 'minimal'].includes(this.layoutType)) {\n return nothing;\n }\n\n return html`\n <text-snippet-block viewsize=\"grid\" .snippets=${this.model?.snippets}>\n </text-snippet-block>\n `;\n }\n\n private get volumeIssueTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.volume || !this.model?.issue) return nothing;\n\n return html`\n <div class=\"volume-issue\">\n <span class=\"truncated\" title=\"volume|issue\">\n Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}\n </span>\n </div>\n `;\n }\n\n private get webArchivesCaptureDatesTemplate():\n | TemplateResult\n | typeof nothing {\n if (!this.model?.captureDates || !this.model.title) return nothing;\n\n return html`\n <ul class=\"capture-dates\">\n ${map(\n this.model.captureDates,\n date =>\n html`<li>\n ${this.displayValueProvider.webArchivesCaptureLink(\n this.model!.title,\n date,\n )}\n </li>`,\n )}\n </ul>\n `;\n }\n\n /**\n * Template for the stats row along the bottom of the tile.\n */\n private get tileStatsTemplate(): TemplateResult | typeof nothing {\n if (['snippets-only', 'minimal'].includes(this.layoutType)) {\n return nothing;\n }\n\n const effectiveSort = this.sortParam ?? this.defaultSortParam;\n const [viewCount, viewLabel] =\n effectiveSort?.field === 'week'\n ? [this.model?.weeklyViewCount, 'weekly views']\n : [this.model?.viewCount, 'all-time views'];\n\n return html`\n <tile-stats\n .model=${this.model}\n .mediatype=${this.model?.mediatype}\n .viewCount=${viewCount}\n .viewLabel=${viewLabel}\n .favCount=${this.model?.favCount}\n .commentCount=${this.model?.commentCount}\n .tvClipCount=${this.model?.tvClipCount}\n .showTvClips=${this.showTvClips}\n >\n </tile-stats>\n `;\n }\n\n private get isSortedByDate(): boolean {\n return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(\n this.effectiveSort?.field as string,\n );\n }\n\n /**\n * Returns the active sort param if one is set, or the default sort param otherwise.\n */\n private get effectiveSort(): SortParam | null {\n return this.sortParam ?? this.defaultSortParam;\n }\n\n private get hasSnippets(): boolean {\n return !!this.model?.snippets?.length;\n }\n\n private infoButtonPressed(e: PointerEvent): void {\n e.preventDefault();\n const event = new CustomEvent<{ x: number; y: number }>(\n 'infoButtonPressed',\n { detail: { x: e.clientX, y: e.clientY } },\n );\n this.dispatchEvent(event);\n }\n\n /**\n * CSS\n */\n static get styles(): CSSResultGroup {\n const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;\n\n return [\n baseTileStyles,\n css`\n a:link {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n a:hover {\n text-decoration: underline;\n }\n\n .container {\n border: 1px solid ${tileBorderColor};\n }\n\n .simple #title > .truncated {\n -webkit-line-clamp: 2;\n }\n\n .simple .created-by > .truncated,\n .simple .date-sorted-by > .truncated,\n .simple .volume-issue > .truncated {\n -webkit-line-clamp: 1;\n }\n\n .simple.snippets-only .item-info,\n .simple.minimal .item-info {\n padding-bottom: 5px;\n }\n\n .simple.snippets-only text-snippet-block {\n margin-top: auto; /* Force the snippets to the bottom of the tile */\n }\n\n .capture-dates {\n margin: 0;\n padding: 0 5px;\n list-style-type: none;\n }\n\n review-block,\n text-snippet-block {\n --containerLeftMargin: 5px;\n --containerTopMargin: 5px;\n }\n\n /**\n * iOS Safari long-press on tiles (to bring up hover pane)\n * gets messy without this\n */\n @media screen and (pointer: coarse) and (hover: none) {\n .container {\n -webkit-touch-callout: none;\n }\n\n .truncated {\n -webkit-touch-callout: default;\n }\n }\n `,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,gBAAgB,CAAC;AACxB,OAAO,iBAAiB,CAAC;AACzB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,eAAe,CAAC;AACvB,OAAO,wBAAwB,CAAC;AAChC,OAAO,cAAc,CAAC;AAGf,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,iBAAiB;IAAxC;QACL;;;;;;;;;;;;;;;;WAgBG;;QAE0B,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG,KAAK,CAAC;QAErB,eAAU,GAA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Q,EAAE,MAAM,CAAC;IACxC,CAAC;IAEO,iBAAiB,CAAC,CAAe;QACvC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,IAAI,WAAW,CAC3B,mBAAmB,EACnB,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAC3C,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,MAAM;QACf,MAAM,eAAe,GAAG,GAAG,CAAA,iCAAiC,CAAC;QAE7D,OAAO;YACL,cAAc;YACd,GAAG,CAAA;;;;;;;;;;8BAUqB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+CtC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAjT8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAwB;AAEvB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAqB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoC;AAvBpD,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAoUpB","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { map } from 'lit/directives/map.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { msg } from '@lit/localize';\n\nimport type { SortParam } from '@internetarchive/search-service';\nimport type { DateFormat } from '../../utils/format-date';\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\nimport { BaseTileComponent } from '../base-tile-component';\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\nimport { LayoutType } from '../models';\n\nimport '../image-block';\nimport '../review-block';\nimport '../text-snippet-block';\nimport '../item-image';\nimport '../tile-mediatype-icon';\nimport './tile-stats';\n\n@customElement('item-tile')\nexport class ItemTile extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - tileActions: TileAction[] = [];\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n * - useLocalTime = false;\n */\n\n @property({ type: Boolean }) showInfoButton = false;\n\n @property({ type: Boolean }) showTvClips = false;\n\n @property({ type: String }) layoutType: LayoutType = 'default';\n\n render() {\n const itemTitle = this.model?.title;\n const containerClasses = classMap({\n container: true,\n simple: this.layoutType !== 'default',\n 'stats-only': this.layoutType === 'stats-only',\n 'snippets-only': this.layoutType === 'snippets-only',\n minimal: this.layoutType === 'minimal',\n });\n\n return html`\n <div class=${containerClasses}>\n ${this.infoButtonTemplate}\n <div class=\"tile-details\">\n <div class=\"item-info\">\n ${this.imageBlockTemplate}\n\n <div id=\"title\">\n <h3 class=\"truncated\" title=${ifDefined(itemTitle)}>\n ${itemTitle}\n </h3>\n </div>\n\n ${this.volumeIssueTemplate}\n ${this.isSortedByDate\n ? this.sortedDateInfoTemplate\n : this.creatorTemplate}\n ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}\n ${this.reviewBlockTemplate}\n </div>\n\n ${this.tileStatsTemplate}\n </div>\n </div>\n `;\n }\n\n /**\n * Templates\n */\n private get creatorTemplate(): TemplateResult | typeof nothing {\n const displayedCreator =\n this.displayValueProvider.firstCreatorMatchingFilter;\n if (!displayedCreator) return nothing;\n\n return html`\n <div class=\"created-by\">\n <span class=\"truncated\" title=${displayedCreator}>\n by&nbsp;${displayedCreator}\n </span>\n </div>\n `;\n }\n\n private get imageBlockTemplate(): TemplateResult {\n return html`\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .isCompactTile=${false}\n .isListTile=${false}\n .viewSize=${'grid'}\n >\n </image-block>\n `;\n }\n\n private get sortedDateInfoTemplate() {\n let sortedValue;\n let format: DateFormat = 'long';\n switch (this.effectiveSort?.field) {\n case 'date': {\n const datePublished = this.model?.datePublished;\n sortedValue = { field: 'published', value: datePublished };\n if (isFirstMillisecondOfUTCYear(datePublished)) {\n format = 'year-only';\n }\n break;\n }\n case 'reviewdate':\n sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };\n break;\n case 'addeddate':\n sortedValue = { field: 'added', value: this.model?.dateAdded };\n break;\n case 'publicdate':\n sortedValue = { field: 'archived', value: this.model?.dateArchived };\n break;\n default:\n break;\n }\n\n if (!sortedValue?.value) {\n return nothing;\n }\n\n const formattedDate = this.getFormattedDate(sortedValue.value, format);\n return html`\n <div class=\"date-sorted-by truncated\">\n <span>${sortedValue.field} ${formattedDate}</span>\n </div>\n `;\n }\n\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\n // &#9432; is an information icon\n return this.showInfoButton\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\n &#9432;\n <span class=\"sr-only\">${msg('More info')}</span>\n </button>`\n : nothing;\n }\n\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.review) return nothing;\n\n const { reviewtitle, reviewbody, stars } = this.model.review;\n return html`\n <review-block\n viewsize=\"grid\"\n title=${ifDefined(reviewtitle)}\n body=${ifDefined(reviewbody)}\n starRating=${ifDefined(stars)}\n >\n </review-block>\n `;\n }\n\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\n if (!this.hasSnippets) return nothing;\n if (['stats-only', 'minimal'].includes(this.layoutType)) {\n return nothing;\n }\n\n return html`\n <text-snippet-block viewsize=\"grid\" .snippets=${this.model?.snippets}>\n </text-snippet-block>\n `;\n }\n\n private get volumeIssueTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.volume || !this.model?.issue) return nothing;\n\n return html`\n <div class=\"volume-issue\">\n <span class=\"truncated\" title=\"volume|issue\">\n Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}\n </span>\n </div>\n `;\n }\n\n private get webArchivesCaptureDatesTemplate():\n | TemplateResult\n | typeof nothing {\n if (!this.model?.captureDates || !this.model.title) return nothing;\n\n return html`\n <ul class=\"capture-dates\">\n ${map(\n this.model.captureDates,\n date =>\n html`<li>\n ${this.displayValueProvider.webArchivesCaptureLink(\n this.model!.title,\n date,\n )}\n </li>`,\n )}\n </ul>\n `;\n }\n\n /**\n * Template for the stats row along the bottom of the tile.\n */\n private get tileStatsTemplate(): TemplateResult | typeof nothing {\n if (['snippets-only', 'minimal'].includes(this.layoutType)) {\n return nothing;\n }\n\n const effectiveSort = this.sortParam ?? this.defaultSortParam;\n const [viewCount, viewLabel] =\n effectiveSort?.field === 'week'\n ? [this.model?.weeklyViewCount, 'weekly views']\n : [this.model?.viewCount, 'all-time views'];\n\n return html`\n <tile-stats\n .model=${this.model}\n .mediatype=${this.model?.mediatype}\n .viewCount=${viewCount}\n .viewLabel=${viewLabel}\n .favCount=${this.model?.favCount}\n .commentCount=${this.model?.commentCount}\n .tvClipCount=${this.model?.tvClipCount}\n .showTvClips=${this.showTvClips}\n >\n </tile-stats>\n `;\n }\n\n private get isSortedByDate(): boolean {\n return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(\n this.effectiveSort?.field as string,\n );\n }\n\n /**\n * Returns the active sort param if one is set, or the default sort param otherwise.\n */\n private get effectiveSort(): SortParam | null {\n return this.sortParam ?? this.defaultSortParam;\n }\n\n private get hasSnippets(): boolean {\n return !!this.model?.snippets?.length;\n }\n\n private infoButtonPressed(e: PointerEvent): void {\n e.preventDefault();\n const event = new CustomEvent<{ x: number; y: number }>(\n 'infoButtonPressed',\n { detail: { x: e.clientX, y: e.clientY } },\n );\n this.dispatchEvent(event);\n }\n\n /**\n * CSS\n */\n static get styles(): CSSResultGroup {\n const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;\n\n return [\n baseTileStyles,\n css`\n a:link {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n a:hover {\n text-decoration: underline;\n }\n\n .container {\n border: 1px solid ${tileBorderColor};\n }\n\n .simple #title > .truncated {\n -webkit-line-clamp: 2;\n }\n\n .simple .created-by > .truncated,\n .simple .date-sorted-by > .truncated,\n .simple .volume-issue > .truncated {\n -webkit-line-clamp: 1;\n }\n\n .simple.snippets-only .item-info,\n .simple.minimal .item-info {\n padding-bottom: 5px;\n }\n\n .simple.snippets-only text-snippet-block {\n margin-top: auto; /* Force the snippets to the bottom of the tile */\n }\n\n .capture-dates {\n margin: 0;\n padding: 0 5px;\n list-style-type: none;\n }\n\n review-block,\n text-snippet-block {\n --containerLeftMargin: 5px;\n --containerTopMargin: 5px;\n }\n\n /**\n * iOS Safari long-press on tiles (to bring up hover pane)\n * gets messy without this\n */\n @media screen and (pointer: coarse) and (hover: none) {\n .container {\n -webkit-touch-callout: none;\n }\n\n .truncated {\n -webkit-touch-callout: default;\n }\n }\n `,\n ];\n }\n}\n"]}
@@ -1,12 +1,14 @@
1
1
  import { __decorate } from "tslib";
2
- import { css, html } from 'lit';
2
+ import { css, html, nothing } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
4
5
  import { msg } from '@lit/localize';
5
6
  import { BaseTileComponent } from '../base-tile-component';
6
7
  let TileListCompactHeader = class TileListCompactHeader extends BaseTileComponent {
7
8
  /*
8
9
  * Reactive properties inherited from BaseTileComponent:
9
10
  * - model?: TileModel;
11
+ * - tileActions: TileAction[] = [];
10
12
  * - currentWidth?: number;
11
13
  * - currentHeight?: number;
12
14
  * - baseNavigationUrl?: string;
@@ -19,9 +21,16 @@ let TileListCompactHeader = class TileListCompactHeader extends BaseTileComponen
19
21
  * - suppressBlurring = false;
20
22
  */
21
23
  render() {
24
+ const hasActions = this.tileActions.length > 0;
25
+ const headerClasses = classMap({
26
+ mobile: this.classSize === 'mobile',
27
+ desktop: this.classSize === 'desktop',
28
+ 'has-actions': hasActions,
29
+ });
22
30
  return html `
23
- <div id="list-line-header" class="${this.classSize}">
31
+ <div id="list-line-header" class=${headerClasses}>
24
32
  <div id="thumb"></div>
33
+ ${hasActions ? html `<div id="actions-header"></div>` : nothing}
25
34
  <div id="title">${msg('Title')}</div>
26
35
  <div id="creator">${msg('Creator')}</div>
27
36
  <div id="date">
@@ -75,6 +84,22 @@ let TileListCompactHeader = class TileListCompactHeader extends BaseTileComponen
75
84
  #list-line-header.desktop {
76
85
  grid-template-columns: 51px 3fr 2fr 95px 30px 115px;
77
86
  }
87
+
88
+ /*
89
+ * When tile actions are present in the rows below, reserve a matching
90
+ * column here so the columns stay aligned with each row.
91
+ */
92
+ #list-line-header.mobile.has-actions {
93
+ grid-template-columns:
94
+ 36px var(--tileActionColumnWidth, 90px) 3fr 2fr
95
+ 68px 35px;
96
+ }
97
+
98
+ #list-line-header.desktop.has-actions {
99
+ grid-template-columns:
100
+ 51px var(--tileActionColumnWidth, 100px) 3fr 2fr
101
+ 95px 30px 115px;
102
+ }
78
103
  `;
79
104
  }
80
105
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tile-list-compact-header.js","sourceRoot":"","sources":["../../../../src/tiles/list/tile-list-compact-header.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGpD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,iBAAiB;IAC1D;;;;;;;;;;;;;OAaG;IAEH,MAAM;QACJ,OAAO,IAAI,CAAA;0CAC2B,IAAI,CAAC,SAAS;;0BAE9B,GAAG,CAAC,OAAO,CAAC;4BACV,GAAG,CAAC,SAAS,CAAC;;YAE9B,IAAI,CAAC,oBAAoB,CAAC,SAAS,IAAI,GAAG,CAAC,WAAW,CAAC;;yBAE1C,GAAG,CAAC,MAAM,CAAC;0BACV,IAAI,CAAC,oBAAoB,CAAC,UAAU;;KAEzD,CAAC;IACJ,CAAC;IAED,IAAY,SAAS;QACnB,IACE,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,YAAY;YACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,gBAAgB,EACzC,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCT,CAAC;IACJ,CAAC;CACF,CAAA;AA/EY,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CA+EjC","sourcesContent":["import { css, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { msg } from '@lit/localize';\nimport { BaseTileComponent } from '../base-tile-component';\n\n@customElement('tile-list-compact-header')\nexport class TileListCompactHeader extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n */\n\n render() {\n return html`\n <div id=\"list-line-header\" class=\"${this.classSize}\">\n <div id=\"thumb\"></div>\n <div id=\"title\">${msg('Title')}</div>\n <div id=\"creator\">${msg('Creator')}</div>\n <div id=\"date\">\n ${this.displayValueProvider.dateLabel || msg('Published')}\n </div>\n <div id=\"icon\">${msg('Type')}</div>\n <div id=\"views\">${this.displayValueProvider.viewsLabel}</div>\n </div>\n `;\n }\n\n private get classSize(): string {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'mobile';\n }\n return 'desktop';\n }\n\n static get styles() {\n return css`\n html {\n font-size: unset;\n }\n\n div {\n font-size: 14px;\n font-weight: bold;\n line-height: 20px;\n }\n\n .mobile #views {\n display: none;\n }\n\n #views {\n text-align: right;\n padding-right: 8px;\n }\n\n #list-line-header {\n display: grid;\n column-gap: 10px;\n align-items: flex-end;\n padding-bottom: 2px;\n }\n\n #list-line-header.mobile {\n grid-template-columns: 36px 3fr 2fr 68px 35px;\n }\n\n #list-line-header.desktop {\n grid-template-columns: 51px 3fr 2fr 95px 30px 115px;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"tile-list-compact-header.js","sourceRoot":"","sources":["../../../../src/tiles/list/tile-list-compact-header.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGpD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,iBAAiB;IAC1D;;;;;;;;;;;;;;OAcG;IAEH,MAAM;QACJ,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/C,MAAM,aAAa,GAAG,QAAQ,CAAC;YAC7B,MAAM,EAAE,IAAI,CAAC,SAAS,KAAK,QAAQ;YACnC,OAAO,EAAE,IAAI,CAAC,SAAS,KAAK,SAAS;YACrC,aAAa,EAAE,UAAU;SAC1B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAA;yCAC0B,aAAa;;UAE5C,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA,iCAAiC,CAAC,CAAC,CAAC,OAAO;0BAC5C,GAAG,CAAC,OAAO,CAAC;4BACV,GAAG,CAAC,SAAS,CAAC;;YAE9B,IAAI,CAAC,oBAAoB,CAAC,SAAS,IAAI,GAAG,CAAC,WAAW,CAAC;;yBAE1C,GAAG,CAAC,MAAM,CAAC;0BACV,IAAI,CAAC,oBAAoB,CAAC,UAAU;;KAEzD,CAAC;IACJ,CAAC;IAED,IAAY,SAAS;QACnB,IACE,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,YAAY;YACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,gBAAgB,EACzC,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkDT,CAAC;IACJ,CAAC;CACF,CAAA;AAxGY,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAwGjC","sourcesContent":["import { css, html, nothing } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { msg } from '@lit/localize';\nimport { BaseTileComponent } from '../base-tile-component';\n\n@customElement('tile-list-compact-header')\nexport class TileListCompactHeader extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - tileActions: TileAction[] = [];\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n */\n\n render() {\n const hasActions = this.tileActions.length > 0;\n const headerClasses = classMap({\n mobile: this.classSize === 'mobile',\n desktop: this.classSize === 'desktop',\n 'has-actions': hasActions,\n });\n\n return html`\n <div id=\"list-line-header\" class=${headerClasses}>\n <div id=\"thumb\"></div>\n ${hasActions ? html`<div id=\"actions-header\"></div>` : nothing}\n <div id=\"title\">${msg('Title')}</div>\n <div id=\"creator\">${msg('Creator')}</div>\n <div id=\"date\">\n ${this.displayValueProvider.dateLabel || msg('Published')}\n </div>\n <div id=\"icon\">${msg('Type')}</div>\n <div id=\"views\">${this.displayValueProvider.viewsLabel}</div>\n </div>\n `;\n }\n\n private get classSize(): string {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'mobile';\n }\n return 'desktop';\n }\n\n static get styles() {\n return css`\n html {\n font-size: unset;\n }\n\n div {\n font-size: 14px;\n font-weight: bold;\n line-height: 20px;\n }\n\n .mobile #views {\n display: none;\n }\n\n #views {\n text-align: right;\n padding-right: 8px;\n }\n\n #list-line-header {\n display: grid;\n column-gap: 10px;\n align-items: flex-end;\n padding-bottom: 2px;\n }\n\n #list-line-header.mobile {\n grid-template-columns: 36px 3fr 2fr 68px 35px;\n }\n\n #list-line-header.desktop {\n grid-template-columns: 51px 3fr 2fr 95px 30px 115px;\n }\n\n /*\n * When tile actions are present in the rows below, reserve a matching\n * column here so the columns stay aligned with each row.\n */\n #list-line-header.mobile.has-actions {\n grid-template-columns:\n 36px var(--tileActionColumnWidth, 90px) 3fr 2fr\n 68px 35px;\n }\n\n #list-line-header.desktop.has-actions {\n grid-template-columns:\n 51px var(--tileActionColumnWidth, 100px) 3fr 2fr\n 95px 30px 115px;\n }\n `;\n }\n}\n"]}
@@ -15,5 +15,5 @@ export declare class TileListCompact extends BaseTileComponent {
15
15
  private get dateFormatSize();
16
16
  private get formatSize();
17
17
  private get isSortedByDate();
18
- static get styles(): import("lit").CSSResult;
18
+ static get styles(): import("lit").CSSResult[];
19
19
  }
@@ -1,16 +1,19 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html, nothing } from 'lit';
3
3
  import { customElement } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
4
5
  import DOMPurify from 'dompurify';
5
6
  import { BaseTileComponent } from '../base-tile-component';
6
7
  import { formatCount } from '../../utils/format-count';
7
8
  import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
9
+ import { tileActionStyles } from '../../styles/tile-action-styles';
8
10
  import '../image-block';
9
11
  import '../tile-mediatype-icon';
10
12
  let TileListCompact = class TileListCompact extends BaseTileComponent {
11
13
  /*
12
14
  * Reactive properties inherited from BaseTileComponent:
13
15
  * - model?: TileModel;
16
+ * - tileActions: TileAction[] = [];
14
17
  * - currentWidth?: number;
15
18
  * - currentHeight?: number;
16
19
  * - baseNavigationUrl?: string;
@@ -25,8 +28,14 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
25
28
  * - useLocalTime = false;
26
29
  */
27
30
  render() {
31
+ const hasActions = this.tileActions.length > 0;
32
+ const lineClasses = classMap({
33
+ mobile: this.classSize === 'mobile',
34
+ desktop: this.classSize === 'desktop',
35
+ 'has-actions': hasActions,
36
+ });
28
37
  return html `
29
- <div id="list-line" class="${this.classSize}">
38
+ <div id="list-line" class=${lineClasses}>
30
39
  <image-block
31
40
  .model=${this.model}
32
41
  .baseImageUrl=${this.baseImageUrl}
@@ -37,6 +46,11 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
37
46
  .suppressBlurring=${this.suppressBlurring}
38
47
  >
39
48
  </image-block>
49
+ ${hasActions
50
+ ? html `<div id="actions">
51
+ ${this.renderTileActions('list-compact')}
52
+ </div>`
53
+ : nothing}
40
54
  <a href=${this.href} id="title"
41
55
  >${DOMPurify.sanitize(this.model?.title ?? '')}</a
42
56
  >
@@ -132,80 +146,104 @@ let TileListCompact = class TileListCompact extends BaseTileComponent {
132
146
  return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(this.effectiveSort?.field);
133
147
  }
134
148
  static get styles() {
135
- return css `
136
- html {
137
- font-size: unset;
138
- }
139
-
140
- div {
141
- font-size: 14px;
142
- }
143
-
144
- #list-line {
145
- display: grid;
146
- column-gap: 10px;
147
- border-top: 1px solid #ddd;
148
- align-items: center;
149
- line-height: 20px;
150
- padding-top: 5px;
151
- margin-bottom: -5px;
152
- }
153
-
154
- #list-line.mobile {
155
- grid-template-columns: 36px 3fr 2fr 68px 35px;
156
- }
157
-
158
- #list-line.desktop {
159
- grid-template-columns: 51px 3fr 2fr 95px 30px 115px;
160
- }
161
-
162
- #list-line:hover #title {
163
- text-decoration: underline;
164
- }
165
-
166
- #title {
167
- text-decoration: none;
168
- }
169
-
170
- #title:link {
171
- color: var(--ia-theme-link-color, #4b64ff);
172
- }
173
-
174
- #title,
175
- #creator {
176
- text-overflow: ellipsis;
177
- overflow: hidden;
178
- white-space: nowrap;
179
- }
180
-
181
- #icon {
182
- margin-left: 2px;
183
- }
184
-
185
- #views {
186
- text-align: right;
187
- padding-right: 8px;
188
- }
189
-
190
- .mobile #views {
191
- display: none;
192
- }
193
-
194
- .mobile tile-mediatype-icon {
195
- --iconHeight: 14px;
196
- --iconWidth: 14px;
197
- }
198
-
199
- .desktop #icon {
200
- --iconHeight: 20px;
201
- --iconWidth: 20px;
202
- }
203
-
204
- item-image {
205
- --imgHeight: 100%;
206
- --imgWidth: 100%;
207
- }
208
- `;
149
+ return [
150
+ tileActionStyles,
151
+ css `
152
+ html {
153
+ font-size: unset;
154
+ }
155
+
156
+ div {
157
+ font-size: 14px;
158
+ }
159
+
160
+ #list-line {
161
+ display: grid;
162
+ column-gap: 10px;
163
+ border-top: 1px solid #ddd;
164
+ align-items: center;
165
+ line-height: 20px;
166
+ padding-top: 5px;
167
+ margin-bottom: -5px;
168
+ }
169
+
170
+ #list-line.mobile {
171
+ grid-template-columns: 36px 3fr 2fr 68px 35px;
172
+ }
173
+
174
+ #list-line.desktop {
175
+ grid-template-columns: 51px 3fr 2fr 95px 30px 115px;
176
+ }
177
+
178
+ /*
179
+ * When tile actions are present, insert an extra column for them
180
+ * between the thumbnail and the title.
181
+ */
182
+ #list-line.mobile.has-actions {
183
+ grid-template-columns:
184
+ 36px var(--tileActionColumnWidth, 90px)
185
+ 3fr 2fr 68px 35px;
186
+ }
187
+
188
+ #list-line.desktop.has-actions {
189
+ grid-template-columns:
190
+ 51px var(--tileActionColumnWidth, 100px)
191
+ 3fr 2fr 95px 30px 115px;
192
+ }
193
+
194
+ #actions {
195
+ /* The flex container inside is what holds the action buttons */
196
+ display: flex;
197
+ }
198
+
199
+ #list-line:hover #title {
200
+ text-decoration: underline;
201
+ }
202
+
203
+ #title {
204
+ text-decoration: none;
205
+ }
206
+
207
+ #title:link {
208
+ color: var(--ia-theme-link-color, #4b64ff);
209
+ }
210
+
211
+ #title,
212
+ #creator {
213
+ text-overflow: ellipsis;
214
+ overflow: hidden;
215
+ white-space: nowrap;
216
+ }
217
+
218
+ #icon {
219
+ margin-left: 2px;
220
+ }
221
+
222
+ #views {
223
+ text-align: right;
224
+ padding-right: 8px;
225
+ }
226
+
227
+ .mobile #views {
228
+ display: none;
229
+ }
230
+
231
+ .mobile tile-mediatype-icon {
232
+ --iconHeight: 14px;
233
+ --iconWidth: 14px;
234
+ }
235
+
236
+ .desktop #icon {
237
+ --iconHeight: 20px;
238
+ --iconWidth: 20px;
239
+ }
240
+
241
+ item-image {
242
+ --imgHeight: 100%;
243
+ --imgWidth: 100%;
244
+ }
245
+ `,
246
+ ];
209
247
  }
210
248
  };
211
249
  TileListCompact = __decorate([