@internetarchive/collection-browser 3.5.2-alpha-webdev8160.0 → 3.5.2-alpha-webdev8093.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 (58) hide show
  1. package/dist/src/app-root.js +606 -606
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.js +764 -764
  4. package/dist/src/collection-browser.js.map +1 -1
  5. package/dist/src/collection-facets/facet-row.js +140 -140
  6. package/dist/src/collection-facets/facet-row.js.map +1 -1
  7. package/dist/src/collection-facets/facets-template.js +23 -23
  8. package/dist/src/collection-facets/facets-template.js.map +1 -1
  9. package/dist/src/collection-facets/more-facets-content.d.ts +1 -0
  10. package/dist/src/collection-facets/more-facets-content.js +126 -127
  11. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  12. package/dist/src/collection-facets.js +267 -267
  13. package/dist/src/collection-facets.js.map +1 -1
  14. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  15. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  16. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  17. package/dist/src/data-source/models.js.map +1 -1
  18. package/dist/src/models.d.ts +0 -4
  19. package/dist/src/models.js +0 -8
  20. package/dist/src/models.js.map +1 -1
  21. package/dist/src/restoration-state-handler.js.map +1 -1
  22. package/dist/src/tiles/grid/collection-tile.js +77 -77
  23. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  24. package/dist/src/tiles/grid/item-tile.js +137 -137
  25. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  26. package/dist/src/tiles/hover/hover-pane-controller.d.ts +8 -0
  27. package/dist/src/tiles/hover/hover-pane-controller.js +13 -1
  28. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  29. package/dist/src/tiles/models.js.map +1 -1
  30. package/dist/src/tiles/tile-dispatcher.js +215 -215
  31. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  32. package/dist/test/collection-browser.test.js +189 -189
  33. package/dist/test/collection-browser.test.js.map +1 -1
  34. package/dist/test/collection-facets/more-facets-content.test.js +28 -28
  35. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  36. package/dist/test/restoration-state-handler.test.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/app-root.ts +1140 -1140
  39. package/src/collection-browser.ts +3075 -3075
  40. package/src/collection-facets/facet-row.ts +299 -299
  41. package/src/collection-facets/facets-template.ts +83 -83
  42. package/src/collection-facets/more-facets-content.ts +642 -644
  43. package/src/collection-facets.ts +1010 -1010
  44. package/src/data-source/collection-browser-data-source-interface.ts +345 -345
  45. package/src/data-source/collection-browser-data-source.ts +1441 -1441
  46. package/src/data-source/collection-browser-query-state.ts +59 -59
  47. package/src/data-source/models.ts +56 -56
  48. package/src/models.ts +0 -9
  49. package/src/restoration-state-handler.ts +546 -546
  50. package/src/tiles/grid/collection-tile.ts +163 -163
  51. package/src/tiles/grid/item-tile.ts +340 -340
  52. package/src/tiles/hover/hover-pane-controller.ts +15 -1
  53. package/src/tiles/models.ts +1 -1
  54. package/src/tiles/tile-dispatcher.ts +517 -517
  55. package/test/collection-browser.test.ts +2413 -2413
  56. package/test/collection-facets/more-facets-content.test.ts +231 -231
  57. package/test/restoration-state-handler.test.ts +480 -480
  58. package/vite.config.ts +29 -29
@@ -157,6 +157,14 @@ export class HoverPaneController implements HoverPaneControllerInterface {
157
157
  /** A record of the last mouse position on the host element, for positioning the hover pane */
158
158
  private lastPointerClientPos = { x: 0, y: 0 };
159
159
 
160
+ /**
161
+ * A flag to track whether the host element is being clicked by a pointer device, so that we
162
+ * don't trigger unnecessary keyboard focus behaviors on click. This is needed, e.g., to prevent
163
+ * the hover pane from appearing immediately at its `host` positioning on click, which can
164
+ * obstruct the host element itself (due to the ordering of events fired).
165
+ */
166
+ private clicking = false;
167
+
160
168
  constructor(
161
169
  /** The host element to which this controller should attach listeners */
162
170
  private readonly host: ReactiveControllerHost &
@@ -352,6 +360,7 @@ export class HoverPaneController implements HoverPaneControllerInterface {
352
360
  // keyboard navigation listeners
353
361
  this.host.addEventListener('focus', this.handleFocus);
354
362
  this.host.addEventListener('blur', this.handleBlur);
363
+ this.host.addEventListener('pointerdown', this.handlePointerDown);
355
364
  this.host.addEventListener('keyup', this.handleKeyUp);
356
365
  this.host.addEventListener('keydown', this.handleKeyDown);
357
366
 
@@ -391,11 +400,12 @@ export class HoverPaneController implements HoverPaneControllerInterface {
391
400
  }
392
401
 
393
402
  private handleFocus = (): void => {
394
- if (this.hoverPaneState === 'hidden') {
403
+ if (!this.clicking && this.hoverPaneState === 'hidden') {
395
404
  this.showHoverPane({
396
405
  anchor: 'host',
397
406
  });
398
407
  }
408
+ this.clicking = false;
399
409
  };
400
410
 
401
411
  private handleBlur = (): void => {
@@ -404,6 +414,10 @@ export class HoverPaneController implements HoverPaneControllerInterface {
404
414
  }
405
415
  };
406
416
 
417
+ private handlePointerDown = (): void => {
418
+ this.clicking = true;
419
+ };
420
+
407
421
  private handleKeyDown = (e: KeyboardEvent): void => {
408
422
  if (
409
423
  (e.key === 'ArrowDown' || e.key === 'ArrowUp') &&
@@ -1 +1 @@
1
- export type SimpleLayoutType = 'none' | 'stats-only' | 'snippets-only';
1
+ export type SimpleLayoutType = 'none' | 'stats-only' | 'snippets-only';