@internetarchive/collection-browser 4.1.0-alpha-webdev8186.5 → 4.1.1-alpha-webdev8185.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.
package/.husky/pre-commit CHANGED
@@ -1,4 +1 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
1
  npx lint-staged
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { CollectionBrowserDataSource } from './src/data-source/collection-browse
3
3
  export { CollectionBrowserDataSourceInterface } from './src/data-source/collection-browser-data-source-interface';
4
4
  export { CollectionBrowserQueryState } from './src/data-source/collection-browser-query-state';
5
5
  export { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';
6
- export { CollectionDisplayMode, SortField, TileModel, FacetOption, SelectedFacets, getDefaultSelectedFacets, } from './src/models';
6
+ export { CollectionDisplayMode, SortField, ExplicitSortField, TileModel, FacetOption, SelectedFacets, getDefaultSelectedFacets, sortOptionFromAPIString, resolveCollectionDefaultSort, SORT_OPTIONS, defaultProfileElementSorts, } from './src/models';
7
7
  export { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';
8
8
  export { CollectionTile } from './src/tiles/grid/collection-tile';
9
9
  export { AccountTile } from './src/tiles/grid/account-tile';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CollectionBrowser } from './src/collection-browser';
2
2
  export { CollectionBrowserDataSource } from './src/data-source/collection-browser-data-source';
3
3
  export { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';
4
- export { SortField, TileModel, getDefaultSelectedFacets, } from './src/models';
4
+ export { SortField, TileModel, getDefaultSelectedFacets, sortOptionFromAPIString, resolveCollectionDefaultSort, SORT_OPTIONS, defaultProfileElementSorts, } from './src/models';
5
5
  export { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';
6
6
  export { CollectionTile } from './src/tiles/grid/collection-tile';
7
7
  export { AccountTile } from './src/tiles/grid/account-tile';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAG/F,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAEL,SAAS,EACT,SAAS,EAGT,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAO7D,cAAc,uDAAuD,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6DAA6D,CAAC","sourcesContent":["export { CollectionBrowser } from './src/collection-browser';\nexport { CollectionBrowserDataSource } from './src/data-source/collection-browser-data-source';\nexport { CollectionBrowserDataSourceInterface } from './src/data-source/collection-browser-data-source-interface';\nexport { CollectionBrowserQueryState } from './src/data-source/collection-browser-query-state';\nexport { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';\nexport {\n CollectionDisplayMode,\n SortField,\n TileModel,\n FacetOption,\n SelectedFacets,\n getDefaultSelectedFacets,\n} from './src/models';\nexport { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';\nexport { CollectionTile } from './src/tiles/grid/collection-tile';\nexport { AccountTile } from './src/tiles/grid/account-tile';\nexport { ItemTile } from './src/tiles/grid/item-tile';\nexport { TileList } from './src/tiles/list/tile-list';\nexport { TileListCompact } from './src/tiles/list/tile-list-compact';\nexport { TileDispatcher } from './src/tiles/tile-dispatcher';\nexport { LayoutType } from './src/tiles/models';\nexport {\n SmartQueryHeuristic,\n KeywordFacetMap,\n SmartFacet,\n} from './src/collection-facets/smart-facets/models';\nexport * from './src/collection-facets/smart-facets/heuristics/index';\nexport { SmartQueryHeuristicGroup } from './src/collection-facets/smart-facets/smart-facet-heuristics';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAG/F,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAEL,SAAS,EAET,SAAS,EAGT,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,YAAY,EACZ,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAO7D,cAAc,uDAAuD,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6DAA6D,CAAC","sourcesContent":["export { CollectionBrowser } from './src/collection-browser';\nexport { CollectionBrowserDataSource } from './src/data-source/collection-browser-data-source';\nexport { CollectionBrowserDataSourceInterface } from './src/data-source/collection-browser-data-source-interface';\nexport { CollectionBrowserQueryState } from './src/data-source/collection-browser-query-state';\nexport { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';\nexport {\n CollectionDisplayMode,\n SortField,\n ExplicitSortField,\n TileModel,\n FacetOption,\n SelectedFacets,\n getDefaultSelectedFacets,\n sortOptionFromAPIString,\n resolveCollectionDefaultSort,\n SORT_OPTIONS,\n defaultProfileElementSorts,\n} from './src/models';\nexport { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';\nexport { CollectionTile } from './src/tiles/grid/collection-tile';\nexport { AccountTile } from './src/tiles/grid/account-tile';\nexport { ItemTile } from './src/tiles/grid/item-tile';\nexport { TileList } from './src/tiles/list/tile-list';\nexport { TileListCompact } from './src/tiles/list/tile-list-compact';\nexport { TileDispatcher } from './src/tiles/tile-dispatcher';\nexport { LayoutType } from './src/tiles/models';\nexport {\n SmartQueryHeuristic,\n KeywordFacetMap,\n SmartFacet,\n} from './src/collection-facets/smart-facets/models';\nexport * from './src/collection-facets/smart-facets/heuristics/index';\nexport { SmartQueryHeuristicGroup } from './src/collection-facets/smart-facets/smart-facet-heuristics';\n"]}
@@ -7,7 +7,7 @@ import '@internetarchive/infinite-scroller';
7
7
  import type { ModalManagerInterface } from '@internetarchive/modal-manager';
8
8
  import type { FeatureFeedbackServiceInterface } from '@internetarchive/feature-feedback';
9
9
  import type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';
10
- import { SelectedFacets, SortField, CollectionBrowserContext, TileModel, CollectionDisplayMode, FacetEventDetails, FacetLoadStrategy } from './models';
10
+ import { SelectedFacets, SortField, type ExplicitSortField, CollectionBrowserContext, TileModel, CollectionDisplayMode, FacetEventDetails, FacetLoadStrategy } from './models';
11
11
  import { RestorationStateHandlerInterface } from './restoration-state-handler';
12
12
  import type { CollectionBrowserQueryState, CollectionBrowserSearchInterface } from './data-source/collection-browser-query-state';
13
13
  import type { CollectionBrowserDataSourceInterface } from './data-source/collection-browser-data-source-interface';
@@ -61,7 +61,7 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
61
61
  selectedTitleFilter: string | null;
62
62
  selectedCreatorFilter: string | null;
63
63
  sortDirection: SortDirection | null;
64
- defaultSortField: Exclude<SortField, SortField.default>;
64
+ defaultSortField: ExplicitSortField;
65
65
  defaultSortDirection: SortDirection | null;
66
66
  pageSize: number;
67
67
  currentPage?: number;
@@ -587,6 +587,13 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
587
587
  * an error from the backend.
588
588
  */
589
589
  emitSearchError(): void;
590
+ /**
591
+ * Emits a `collectionExtraInfoLoaded` event when the data source has received
592
+ * collection metadata from the backend. This allows parent components to react
593
+ * to the metadata (e.g., to update their default sort based on the collection's
594
+ * `sort-by` metadata field).
595
+ */
596
+ emitCollectionExtraInfoLoaded(collectionExtraInfo?: CollectionExtraInfo): void;
590
597
  /**
591
598
  * Emits a `queryStateChanged` event indicating that one or more of this component's
592
599
  * properties have changed in a way that could affect the set of search results.
@@ -1274,6 +1274,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1274
1274
  this.maxSelectedDate = queryState.maxSelectedDate;
1275
1275
  this.selectedSort = queryState.selectedSort ?? SortField.default;
1276
1276
  this.sortDirection = queryState.sortDirection;
1277
+ if (queryState.defaultSortField) {
1278
+ this.defaultSortField = queryState.defaultSortField;
1279
+ }
1280
+ if (queryState.defaultSortDirection !== undefined) {
1281
+ this.defaultSortDirection = queryState.defaultSortDirection;
1282
+ }
1277
1283
  this.selectedTitleFilter = queryState.selectedTitleFilter;
1278
1284
  this.selectedCreatorFilter = queryState.selectedCreatorFilter;
1279
1285
  this.pagesToRender = this.initialPageNumber;
@@ -1589,6 +1595,17 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1589
1595
  detail: this.dataSource.queryErrorMessage,
1590
1596
  }));
1591
1597
  }
1598
+ /**
1599
+ * Emits a `collectionExtraInfoLoaded` event when the data source has received
1600
+ * collection metadata from the backend. This allows parent components to react
1601
+ * to the metadata (e.g., to update their default sort based on the collection's
1602
+ * `sort-by` metadata field).
1603
+ */
1604
+ emitCollectionExtraInfoLoaded(collectionExtraInfo) {
1605
+ this.dispatchEvent(new CustomEvent('collectionExtraInfoLoaded', {
1606
+ detail: collectionExtraInfo,
1607
+ }));
1608
+ }
1592
1609
  /**
1593
1610
  * Emits a `queryStateChanged` event indicating that one or more of this component's
1594
1611
  * properties have changed in a way that could affect the set of search results.