@internetarchive/collection-browser 1.14.17-alpha.4 → 1.14.17-alpha.40

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 (56) hide show
  1. package/dist/index.d.ts +3 -2
  2. package/dist/index.js +3 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/collection-browser.d.ts +6 -13
  5. package/dist/src/collection-browser.js +56 -30
  6. package/dist/src/collection-browser.js.map +1 -1
  7. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +194 -0
  8. package/dist/src/data-source/collection-browser-data-source-interface.js +2 -0
  9. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -0
  10. package/dist/src/data-source/collection-browser-data-source.d.ts +62 -174
  11. package/dist/src/data-source/collection-browser-data-source.js +185 -64
  12. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  13. package/dist/src/data-source/collection-browser-query-state.d.ts +42 -0
  14. package/dist/src/data-source/collection-browser-query-state.js +2 -0
  15. package/dist/src/data-source/collection-browser-query-state.js.map +1 -0
  16. package/dist/src/data-source/models.d.ts +1 -39
  17. package/dist/src/data-source/models.js.map +1 -1
  18. package/dist/src/models.d.ts +3 -2
  19. package/dist/src/models.js +24 -22
  20. package/dist/src/models.js.map +1 -1
  21. package/dist/src/sort-filter-bar/sort-filter-bar.js +1 -0
  22. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  23. package/dist/src/tiles/grid/item-tile.d.ts +1 -0
  24. package/dist/src/tiles/grid/item-tile.js +28 -1
  25. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  26. package/dist/src/tiles/grid/tile-stats.js +13 -8
  27. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  28. package/dist/src/tiles/item-image.d.ts +3 -0
  29. package/dist/src/tiles/item-image.js +30 -2
  30. package/dist/src/tiles/item-image.js.map +1 -1
  31. package/dist/src/tiles/list/tile-list.d.ts +1 -0
  32. package/dist/src/tiles/list/tile-list.js +30 -1
  33. package/dist/src/tiles/list/tile-list.js.map +1 -1
  34. package/dist/src/tiles/tile-dispatcher.js +3 -2
  35. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  36. package/dist/src/tiles/tile-display-value-provider.d.ts +5 -1
  37. package/dist/src/tiles/tile-display-value-provider.js +15 -1
  38. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  39. package/dist/test/collection-browser.test.js +2 -6
  40. package/dist/test/collection-browser.test.js.map +1 -1
  41. package/index.ts +3 -5
  42. package/package.json +2 -2
  43. package/src/collection-browser.ts +70 -49
  44. package/src/data-source/collection-browser-data-source-interface.ts +245 -0
  45. package/src/data-source/collection-browser-data-source.ts +237 -281
  46. package/src/data-source/collection-browser-query-state.ts +53 -0
  47. package/src/data-source/models.ts +0 -47
  48. package/src/models.ts +7 -3
  49. package/src/sort-filter-bar/sort-filter-bar.ts +1 -0
  50. package/src/tiles/grid/item-tile.ts +36 -1
  51. package/src/tiles/grid/tile-stats.ts +12 -7
  52. package/src/tiles/item-image.ts +28 -0
  53. package/src/tiles/list/tile-list.ts +37 -1
  54. package/src/tiles/tile-dispatcher.ts +2 -1
  55. package/src/tiles/tile-display-value-provider.ts +19 -1
  56. package/test/collection-browser.test.ts +2 -8
@@ -0,0 +1,194 @@
1
+ import type { FilterMap, Aggregation, CollectionExtraInfo, AccountExtraInfo, PageElementMap } from '@internetarchive/search-service';
2
+ import type { ReactiveController } from 'lit';
3
+ import type { PrefixFilterType, PrefixFilterCounts, TileModel } from '../models';
4
+ import type { PageSpecifierParams, CollectionTitles } from './models';
5
+ export interface CollectionBrowserDataSourceInterface extends ReactiveController {
6
+ /**
7
+ * How many tile models are present in this data source
8
+ */
9
+ readonly size: number;
10
+ /**
11
+ * How many results there are in the full result set for the current query
12
+ * (not necessarily all loaded yet).
13
+ */
14
+ readonly totalResults: number;
15
+ /**
16
+ * Whether the host has a valid set of properties for performing a search.
17
+ * For instance, on the search page this requires a valid search service and a
18
+ * non-empty query, while collection pages allow searching with an empty query
19
+ * for MDS but not FTS.
20
+ */
21
+ readonly canPerformSearch: boolean;
22
+ /**
23
+ * Whether the end of the set of results for the current query state has been
24
+ * encountered (i.e., the last page of results).
25
+ */
26
+ readonly endOfDataReached: boolean;
27
+ /**
28
+ * True if the initial work for a new query state has been completed (i.e., firing initial
29
+ * page/facet requests). False otherwise.
30
+ */
31
+ readonly queryInitialized: boolean;
32
+ /**
33
+ * A string key compactly representing the current full search state, which can
34
+ * be used to determine, e.g., when a new search is required or whether an arriving
35
+ * response is outdated.
36
+ */
37
+ readonly pageFetchQueryKey: string;
38
+ /**
39
+ * Similar to `pageFetchQueryKey`, but excluding properties that do not affect
40
+ * the validity of a set of facets (e.g., sort).
41
+ */
42
+ readonly facetFetchQueryKey: string;
43
+ /**
44
+ * An object representing any collection- or profile-specific properties to be passed along
45
+ * to the search service, specifying the exact page/tab to fetch results for.
46
+ */
47
+ readonly pageSpecifierParams: PageSpecifierParams | null;
48
+ /**
49
+ * A FilterMap object representing all filters applied to the current search,
50
+ * including any facets, letter filters, and date ranges.
51
+ */
52
+ readonly filterMap: FilterMap;
53
+ /**
54
+ * The full set of aggregations retrieved for the current search.
55
+ */
56
+ readonly aggregations?: Record<string, Aggregation>;
57
+ /**
58
+ * The `year_histogram` aggregation retrieved for the current search.
59
+ */
60
+ readonly yearHistogramAggregation?: Aggregation;
61
+ /**
62
+ * A map from collection identifiers that appear on hits or aggregations for the
63
+ * current search, to their human-readable collection titles.
64
+ */
65
+ readonly collectionTitles: CollectionTitles;
66
+ /**
67
+ * The "extra info" package provided by the PPS for collection pages, including details
68
+ * used to populate the target collection header & About tab content.
69
+ */
70
+ readonly collectionExtraInfo?: CollectionExtraInfo;
71
+ /**
72
+ * The "extra info" package provided by the PPS for profile pages, including details
73
+ * used to populate the profile header.
74
+ */
75
+ readonly accountExtraInfo?: AccountExtraInfo;
76
+ /**
77
+ * The set of requested page elements for profile pages, if applicable. These represent
78
+ * any content specific to the current profile tab.
79
+ */
80
+ readonly pageElements?: PageElementMap;
81
+ /**
82
+ * An array of the current target collection's parent collections. Should include *all*
83
+ * ancestors in the collection hierarchy, not just the immediate parent.
84
+ */
85
+ readonly parentCollections?: string[];
86
+ /**
87
+ * An object storing result counts for the current search bucketed by letter prefix.
88
+ * Keys are the result field on which the prefixes are considered (e.g., title/creator)
89
+ * and values are a Record mapping letters to their counts.
90
+ */
91
+ readonly prefixFilterCountMap: Partial<Record<PrefixFilterType, PrefixFilterCounts>>;
92
+ /**
93
+ * Any error message from the most recent search results response.
94
+ */
95
+ readonly queryErrorMessage?: string;
96
+ /**
97
+ * An array of all the tile models whose management checkboxes are checked
98
+ */
99
+ readonly checkedTileModels: TileModel[];
100
+ /**
101
+ * An array of all the tile models whose management checkboxes are unchecked
102
+ */
103
+ readonly uncheckedTileModels: TileModel[];
104
+ /**
105
+ * A Promise which, after each query change, resolves once the fetches for the initial
106
+ * search have completed. Waits for *both* the hits and aggregations fetches to finish.
107
+ *
108
+ * Ensure you await this component's `updateComplete` promise before awaiting this
109
+ * one, to ensure you do not await an obsolete promise from the previous update.
110
+ */
111
+ readonly initialSearchComplete: Promise<boolean>;
112
+ /**
113
+ * Resets the data source to its empty state, with no result pages, aggregations, etc.
114
+ */
115
+ reset(): void;
116
+ /**
117
+ * Adds the given page of tile models to the data source.
118
+ * If the given page number already exists, that page will be overwritten.
119
+ * @param pageNum Which page number to add (indexed starting from 1)
120
+ * @param pageTiles The array of tile models for the new page
121
+ */
122
+ addPage(pageNum: number, pageTiles: TileModel[]): void;
123
+ /**
124
+ * Returns the given page of tile models from the data source.
125
+ * @param pageNum Which page number to get (indexed starting from 1)
126
+ */
127
+ getPage(pageNum: number): TileModel[];
128
+ /**
129
+ * Returns the full set of paged tile models stored in this data source.
130
+ */
131
+ getAllPages(): Record<string, TileModel[]>;
132
+ /**
133
+ * Whether the data source contains any tiles for the given page number.
134
+ * @param pageNum Which page number to query (indexed starting from 1)
135
+ */
136
+ hasPage(pageNum: number): boolean;
137
+ /**
138
+ * Returns the single tile model appearing at the given index in the
139
+ * data source, with respect to the current page size. Returns `undefined` if
140
+ * the corresponding page is not present on the data source or if it does not
141
+ * contain a tile model at the corresponding index.
142
+ * @param index The 0-based index (within the full data source) of the tile to get
143
+ */
144
+ getTileModelAt(index: number): TileModel | undefined;
145
+ /**
146
+ * Returns the first numeric tile index corresponding to the given tile model object,
147
+ * or -1 if the given tile model is not present.
148
+ * @param tile The tile model to search for in the data source
149
+ */
150
+ indexOf(tile: TileModel): number;
151
+ /**
152
+ * Requests that the data source fire a backend request for the given page of results.
153
+ * @param pageNum Which page number to fetch results for
154
+ * @param numInitialPages How many pages should be batched together on an initial fetch
155
+ */
156
+ fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;
157
+ /**
158
+ * Requests that the data source update its prefix bucket result counts for the given
159
+ * type of prefix filter.
160
+ * @param filterType Which prefixable field to update the buckets for (e.g., title/creator)
161
+ */
162
+ updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;
163
+ /**
164
+ * Changes the page size used by the data source, discarding any previously-fetched pages.
165
+ *
166
+ * **Note: this operation will reset any data stored in the data source!**
167
+ * @param pageSize
168
+ */
169
+ setPageSize(pageSize: number): void;
170
+ /**
171
+ * Notifies the data source that a query change has occurred, which may trigger a data
172
+ * reset & new fetches.
173
+ */
174
+ handleQueryChange(): void;
175
+ /**
176
+ * Applies the given map function to all of the tile models in every page of the data
177
+ * source.
178
+ * @param callback A callback function to apply on each tile model, as with Array.map
179
+ */
180
+ map(callback: (model: TileModel, index: number, array: TileModel[]) => TileModel): void;
181
+ /**
182
+ * Checks every tile's management checkbox
183
+ */
184
+ checkAllTiles(): void;
185
+ /**
186
+ * Unchecks every tile's management checkbox
187
+ */
188
+ uncheckAllTiles(): void;
189
+ /**
190
+ * Removes all tile models that are currently checked & adjusts the paging
191
+ * of the data source to account for any new gaps in the data.
192
+ */
193
+ removeCheckedTiles(): void;
194
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=collection-browser-data-source-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-browser-data-source-interface.js","sourceRoot":"","sources":["../../../src/data-source/collection-browser-data-source-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n FilterMap,\n Aggregation,\n CollectionExtraInfo,\n AccountExtraInfo,\n PageElementMap,\n} from '@internetarchive/search-service';\nimport type { ReactiveController } from 'lit';\nimport type {\n PrefixFilterType,\n PrefixFilterCounts,\n TileModel,\n} from '../models';\nimport type { PageSpecifierParams, CollectionTitles } from './models';\n\nexport interface CollectionBrowserDataSourceInterface\n extends ReactiveController {\n /**\n * How many tile models are present in this data source\n */\n readonly size: number;\n\n /**\n * How many results there are in the full result set for the current query\n * (not necessarily all loaded yet).\n */\n readonly totalResults: number;\n\n /**\n * Whether the host has a valid set of properties for performing a search.\n * For instance, on the search page this requires a valid search service and a\n * non-empty query, while collection pages allow searching with an empty query\n * for MDS but not FTS.\n */\n readonly canPerformSearch: boolean;\n\n /**\n * Whether the end of the set of results for the current query state has been\n * encountered (i.e., the last page of results).\n */\n readonly endOfDataReached: boolean;\n\n /**\n * True if the initial work for a new query state has been completed (i.e., firing initial\n * page/facet requests). False otherwise.\n */\n readonly queryInitialized: boolean;\n\n /**\n * A string key compactly representing the current full search state, which can\n * be used to determine, e.g., when a new search is required or whether an arriving\n * response is outdated.\n */\n readonly pageFetchQueryKey: string;\n\n /**\n * Similar to `pageFetchQueryKey`, but excluding properties that do not affect\n * the validity of a set of facets (e.g., sort).\n */\n readonly facetFetchQueryKey: string;\n\n /**\n * An object representing any collection- or profile-specific properties to be passed along\n * to the search service, specifying the exact page/tab to fetch results for.\n */\n readonly pageSpecifierParams: PageSpecifierParams | null;\n\n /**\n * A FilterMap object representing all filters applied to the current search,\n * including any facets, letter filters, and date ranges.\n */\n readonly filterMap: FilterMap;\n\n /**\n * The full set of aggregations retrieved for the current search.\n */\n readonly aggregations?: Record<string, Aggregation>;\n\n /**\n * The `year_histogram` aggregation retrieved for the current search.\n */\n readonly yearHistogramAggregation?: Aggregation;\n\n /**\n * A map from collection identifiers that appear on hits or aggregations for the\n * current search, to their human-readable collection titles.\n */\n readonly collectionTitles: CollectionTitles;\n\n /**\n * The \"extra info\" package provided by the PPS for collection pages, including details\n * used to populate the target collection header & About tab content.\n */\n readonly collectionExtraInfo?: CollectionExtraInfo;\n\n /**\n * The \"extra info\" package provided by the PPS for profile pages, including details\n * used to populate the profile header.\n */\n readonly accountExtraInfo?: AccountExtraInfo;\n\n /**\n * The set of requested page elements for profile pages, if applicable. These represent\n * any content specific to the current profile tab.\n */\n readonly pageElements?: PageElementMap;\n\n /**\n * An array of the current target collection's parent collections. Should include *all*\n * ancestors in the collection hierarchy, not just the immediate parent.\n */\n readonly parentCollections?: string[];\n\n /**\n * An object storing result counts for the current search bucketed by letter prefix.\n * Keys are the result field on which the prefixes are considered (e.g., title/creator)\n * and values are a Record mapping letters to their counts.\n */\n readonly prefixFilterCountMap: Partial<\n Record<PrefixFilterType, PrefixFilterCounts>\n >;\n\n /**\n * Any error message from the most recent search results response.\n */\n readonly queryErrorMessage?: string;\n\n /**\n * An array of all the tile models whose management checkboxes are checked\n */\n readonly checkedTileModels: TileModel[];\n\n /**\n * An array of all the tile models whose management checkboxes are unchecked\n */\n readonly uncheckedTileModels: TileModel[];\n\n /**\n * A Promise which, after each query change, resolves once the fetches for the initial\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\n *\n * Ensure you await this component's `updateComplete` promise before awaiting this\n * one, to ensure you do not await an obsolete promise from the previous update.\n */\n readonly initialSearchComplete: Promise<boolean>;\n\n /**\n * Resets the data source to its empty state, with no result pages, aggregations, etc.\n */\n reset(): void;\n\n /**\n * Adds the given page of tile models to the data source.\n * If the given page number already exists, that page will be overwritten.\n * @param pageNum Which page number to add (indexed starting from 1)\n * @param pageTiles The array of tile models for the new page\n */\n addPage(pageNum: number, pageTiles: TileModel[]): void;\n\n /**\n * Returns the given page of tile models from the data source.\n * @param pageNum Which page number to get (indexed starting from 1)\n */\n getPage(pageNum: number): TileModel[];\n\n /**\n * Returns the full set of paged tile models stored in this data source.\n */\n getAllPages(): Record<string, TileModel[]>;\n\n /**\n * Whether the data source contains any tiles for the given page number.\n * @param pageNum Which page number to query (indexed starting from 1)\n */\n hasPage(pageNum: number): boolean;\n\n /**\n * Returns the single tile model appearing at the given index in the\n * data source, with respect to the current page size. Returns `undefined` if\n * the corresponding page is not present on the data source or if it does not\n * contain a tile model at the corresponding index.\n * @param index The 0-based index (within the full data source) of the tile to get\n */\n getTileModelAt(index: number): TileModel | undefined;\n\n /**\n * Returns the first numeric tile index corresponding to the given tile model object,\n * or -1 if the given tile model is not present.\n * @param tile The tile model to search for in the data source\n */\n indexOf(tile: TileModel): number;\n\n /**\n * Requests that the data source fire a backend request for the given page of results.\n * @param pageNum Which page number to fetch results for\n * @param numInitialPages How many pages should be batched together on an initial fetch\n */\n fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;\n\n /**\n * Requests that the data source update its prefix bucket result counts for the given\n * type of prefix filter.\n * @param filterType Which prefixable field to update the buckets for (e.g., title/creator)\n */\n updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;\n\n /**\n * Changes the page size used by the data source, discarding any previously-fetched pages.\n *\n * **Note: this operation will reset any data stored in the data source!**\n * @param pageSize\n */\n setPageSize(pageSize: number): void;\n\n /**\n * Notifies the data source that a query change has occurred, which may trigger a data\n * reset & new fetches.\n */\n handleQueryChange(): void;\n\n /**\n * Applies the given map function to all of the tile models in every page of the data\n * source.\n * @param callback A callback function to apply on each tile model, as with Array.map\n */\n map(\n callback: (model: TileModel, index: number, array: TileModel[]) => TileModel\n ): void;\n\n /**\n * Checks every tile's management checkbox\n */\n checkAllTiles(): void;\n\n /**\n * Unchecks every tile's management checkbox\n */\n uncheckAllTiles(): void;\n\n /**\n * Removes all tile models that are currently checked & adjusts the paging\n * of the data source to account for any new gaps in the data.\n */\n removeCheckedTiles(): void;\n}\n"]}
@@ -1,175 +1,9 @@
1
- import type { ReactiveController, ReactiveControllerHost } from 'lit';
1
+ import type { ReactiveControllerHost } from 'lit';
2
2
  import { AccountExtraInfo, Aggregation, CollectionExtraInfo, FilterMap, PageElementMap, SearchParams } from '@internetarchive/search-service';
3
3
  import { type PrefixFilterType, TileModel, PrefixFilterCounts, RequestKind } from '../models';
4
- import type { CollectionBrowserSearchInterface, CollectionTitles, PageSpecifierParams } from './models';
5
- export interface CollectionBrowserDataSourceInterface extends ReactiveController {
6
- /**
7
- * How many tile models are present in this data source
8
- */
9
- readonly size: number;
10
- /**
11
- * Whether the host has a valid set of properties for performing a search.
12
- * For instance, on the search page this requires a valid search service and a
13
- * non-empty query, while collection pages allow searching with an empty query
14
- * for MDS but not FTS.
15
- */
16
- readonly canPerformSearch: boolean;
17
- /**
18
- * Whether the end of the set of results for the current query state has been
19
- * encountered (i.e., the last page of results).
20
- */
21
- readonly endOfDataReached: boolean;
22
- /**
23
- * A string key compactly representing the current full search state, which can
24
- * be used to determine, e.g., when a new search is required or whether an arriving
25
- * response is outdated.
26
- */
27
- readonly pageFetchQueryKey: string;
28
- /**
29
- * Similar to `pageFetchQueryKey`, but excluding properties that do not affect
30
- * the validity of a set of facets (e.g., sort).
31
- */
32
- readonly facetFetchQueryKey: string;
33
- /**
34
- * An object representing any collection- or profile-specific properties to be passed along
35
- * to the search service, specifying the exact page/tab to fetch results for.
36
- */
37
- readonly pageSpecifierParams: PageSpecifierParams | null;
38
- /**
39
- * A FilterMap object representing all filters applied to the current search,
40
- * including any facets, letter filters, and date ranges.
41
- */
42
- readonly filterMap: FilterMap;
43
- /**
44
- * The full set of aggregations retrieved for the current search.
45
- */
46
- readonly aggregations?: Record<string, Aggregation>;
47
- /**
48
- * The `year_histogram` aggregation retrieved for the current search.
49
- */
50
- readonly yearHistogramAggregation?: Aggregation;
51
- /**
52
- * A map from collection identifiers that appear on hits or aggregations for the
53
- * current search, to their human-readable collection titles.
54
- */
55
- readonly collectionTitles: CollectionTitles;
56
- /**
57
- * The "extra info" package provided by the PPS for collection pages, including details
58
- * used to populate the target collection header & About tab content.
59
- */
60
- readonly collectionExtraInfo?: CollectionExtraInfo;
61
- /**
62
- * The "extra info" package provided by the PPS for profile pages, including details
63
- * used to populate the profile header.
64
- */
65
- readonly accountExtraInfo?: AccountExtraInfo;
66
- /**
67
- * The set of requested page elements for profile pages, if applicable. These represent
68
- * any content specific to the current profile tab.
69
- */
70
- readonly pageElements?: PageElementMap;
71
- /**
72
- * An array of the current target collection's parent collections. Should include *all*
73
- * ancestors in the collection hierarchy, not just the immediate parent.
74
- */
75
- readonly parentCollections?: string[];
76
- /**
77
- * An object storing result counts for the current search bucketed by letter prefix.
78
- * Keys are the result field on which the prefixes are considered (e.g., title/creator)
79
- * and values are a Record mapping letters to their counts.
80
- */
81
- readonly prefixFilterCountMap: Partial<Record<PrefixFilterType, PrefixFilterCounts>>;
82
- /**
83
- * An array of all the tile models whose management checkboxes are checked
84
- */
85
- readonly checkedTileModels: TileModel[];
86
- /**
87
- * An array of all the tile models whose management checkboxes are unchecked
88
- */
89
- readonly uncheckedTileModels: TileModel[];
90
- /**
91
- * Resets the data source to its empty state, with no result pages, aggregations, etc.
92
- */
93
- reset(): void;
94
- /**
95
- * Adds the given page of tile models to the data source.
96
- * If the given page number already exists, that page will be overwritten.
97
- * @param pageNum Which page number to add (indexed starting from 1)
98
- * @param pageTiles The array of tile models for the new page
99
- */
100
- addPage(pageNum: number, pageTiles: TileModel[]): void;
101
- /**
102
- * Returns the given page of tile models from the data source.
103
- * @param pageNum Which page number to get (indexed starting from 1)
104
- */
105
- getPage(pageNum: number): TileModel[];
106
- /**
107
- * Returns the full set of paged tile models stored in this data source.
108
- */
109
- getAllPages(): Record<string, TileModel[]>;
110
- /**
111
- * Whether the data source contains any tiles for the given page number.
112
- * @param pageNum Which page number to query (indexed starting from 1)
113
- */
114
- hasPage(pageNum: number): boolean;
115
- /**
116
- * Returns the single tile model appearing at the given index in the
117
- * data source, with respect to the current page size. Returns `undefined` if
118
- * the corresponding page is not present on the data source or if it does not
119
- * contain a tile model at the corresponding index.
120
- * @param index The 0-based index (within the full data source) of the tile to get
121
- */
122
- getTileModelAt(index: number): TileModel | undefined;
123
- /**
124
- * Returns the first numeric tile index corresponding to the given tile model object,
125
- * or -1 if the given tile model is not present.
126
- * @param tile The tile model to search for in the data source
127
- */
128
- indexOf(tile: TileModel): number;
129
- /**
130
- * Requests that the data source fire a backend request for the given page of results.
131
- * @param pageNum Which page number to fetch results for
132
- * @param numInitialPages How many pages should be batched together on an initial fetch
133
- */
134
- fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;
135
- /**
136
- * Requests that the data source update its prefix bucket result counts for the given
137
- * type of prefix filter.
138
- * @param filterType Which prefixable field to update the buckets for (e.g., title/creator)
139
- */
140
- updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;
141
- /**
142
- * Changes the page size used by the data source, discarding any previously-fetched pages.
143
- *
144
- * **Note: this operation will reset any data stored in the data source!**
145
- * @param pageSize
146
- */
147
- setPageSize(pageSize: number): void;
148
- /**
149
- * Notifies the data source that a query change has occurred, which may trigger a data
150
- * reset & new fetches.
151
- */
152
- handleQueryChange(): void;
153
- /**
154
- * Applies the given map function to all of the tile models in every page of the data
155
- * source.
156
- * @param callback A callback function to apply on each tile model, as with Array.map
157
- */
158
- map(callback: (model: TileModel, index: number, array: TileModel[]) => TileModel): void;
159
- /**
160
- * Checks every tile's management checkbox
161
- */
162
- checkAllTiles(): void;
163
- /**
164
- * Unchecks every tile's management checkbox
165
- */
166
- uncheckAllTiles(): void;
167
- /**
168
- * Removes all tile models that are currently checked & adjusts the paging
169
- * of the data source to account for any new gaps in the data.
170
- */
171
- removeCheckedTiles(): void;
172
- }
4
+ import type { PageSpecifierParams } from './models';
5
+ import type { CollectionBrowserDataSourceInterface } from './collection-browser-data-source-interface';
6
+ import type { CollectionBrowserSearchInterface } from './collection-browser-query-state';
173
7
  export declare class CollectionBrowserDataSource implements CollectionBrowserDataSourceInterface {
174
8
  /** The host element to which this controller should attach listeners */
175
9
  private readonly host;
@@ -179,9 +13,17 @@ export declare class CollectionBrowserDataSource implements CollectionBrowserDat
179
13
  private offset;
180
14
  private numTileModels;
181
15
  /**
182
- * Maps the full query key to the pages being fetched for that query
16
+ * A set of fetch IDs that are valid for the current query state
183
17
  */
184
- private pageFetchesInProgress;
18
+ private fetchesInProgress;
19
+ /**
20
+ * A record of the query key used for the last search.
21
+ * If this changes, we need to load new results.
22
+ */
23
+ private previousQueryKey;
24
+ private searchResultsLoading;
25
+ private facetsLoading;
26
+ private id;
185
27
  /**
186
28
  * @inheritdoc
187
29
  */
@@ -190,6 +32,10 @@ export declare class CollectionBrowserDataSource implements CollectionBrowserDat
190
32
  * @inheritdoc
191
33
  */
192
34
  endOfDataReached: boolean;
35
+ /**
36
+ * @inheritdoc
37
+ */
38
+ queryInitialized: boolean;
193
39
  /**
194
40
  * @inheritdoc
195
41
  */
@@ -222,11 +68,34 @@ export declare class CollectionBrowserDataSource implements CollectionBrowserDat
222
68
  * @inheritdoc
223
69
  */
224
70
  prefixFilterCountMap: Partial<Record<PrefixFilterType, PrefixFilterCounts>>;
71
+ /**
72
+ * @inheritdoc
73
+ */
74
+ queryErrorMessage?: string;
75
+ /**
76
+ * Internal property to store the `resolve` function for the most recent
77
+ * `initialSearchComplete` promise, allowing us to resolve it at the appropriate time.
78
+ */
79
+ private _initialSearchCompleteResolver;
80
+ /**
81
+ * Internal property to store the private value backing the `initialSearchComplete` getter.
82
+ */
83
+ private _initialSearchCompletePromise;
84
+ /**
85
+ * @inheritdoc
86
+ */
87
+ get initialSearchComplete(): Promise<boolean>;
225
88
  constructor(
226
89
  /** The host element to which this controller should attach listeners */
227
90
  host: ReactiveControllerHost & CollectionBrowserSearchInterface,
228
91
  /** Default size of result pages */
229
92
  pageSize: number);
93
+ hostConnected(): void;
94
+ hostUpdate(): void;
95
+ /**
96
+ * Returns whether this data source is the one currently installed on the host component.
97
+ */
98
+ private get activeOnHost();
230
99
  /**
231
100
  * @inheritdoc
232
101
  */
@@ -303,6 +172,25 @@ export declare class CollectionBrowserDataSource implements CollectionBrowserDat
303
172
  * @inheritdoc
304
173
  */
305
174
  get canPerformSearch(): boolean;
175
+ /**
176
+ * Sets the state for whether the initial set of search results for the
177
+ * current query is loading
178
+ */
179
+ private setSearchResultsLoading;
180
+ /**
181
+ * Sets the state for whether the facets for a query is loading
182
+ */
183
+ private setFacetsLoading;
184
+ /**
185
+ * Requests that the host perform an update, provided this data
186
+ * source is actively installed on it.
187
+ */
188
+ private requestHostUpdate;
189
+ /**
190
+ * Requests that the host refresh its visible tiles, provided this
191
+ * data source is actively installed on it.
192
+ */
193
+ private refreshVisibleResults;
306
194
  /**
307
195
  * The query key is a string that uniquely identifies the current search.
308
196
  * It consists of:
@@ -314,8 +202,8 @@ export declare class CollectionBrowserDataSource implements CollectionBrowserDat
314
202
  * - Any currently-applied prefix filters
315
203
  * - The current sort options
316
204
  *
317
- * This lets us keep track of queries so we don't persist data that's
318
- * no longer relevant.
205
+ * This lets us internally keep track of queries so we don't persist data that's
206
+ * no longer relevant. Not meant to be human-readable.
319
207
  */
320
208
  get pageFetchQueryKey(): string;
321
209
  /**