@@ -23,7 +23,6 @@ export type ColumnId =
2323
2424export interface ColumnConfig {
2525 id : ColumnId
26- label : string
2726 visible : boolean
2827 sortable : boolean
2928 width ?: string
@@ -33,54 +32,48 @@ export interface ColumnConfig {
3332
3433// Default column configuration
3534export const DEFAULT_COLUMNS : ColumnConfig [ ] = [
36- { id : 'name' , label : 'Name' , visible : true , sortable : true , width : 'minmax(200px, 1fr)' } ,
37- { id : 'version' , label : 'Version' , visible : true , sortable : false , width : '100px' } ,
35+ { id : 'name' , visible : true , sortable : true , width : 'minmax(200px, 1fr)' } ,
36+ { id : 'version' , visible : true , sortable : false , width : '100px' } ,
3837 {
3938 id : 'description' ,
40- label : 'Description' ,
4139 visible : true ,
4240 sortable : false ,
4341 width : 'minmax(200px, 2fr)' ,
4442 } ,
45- { id : 'downloads' , label : 'Downloads/wk' , visible : true , sortable : true , width : '120px' } ,
46- { id : 'updated' , label : 'Updated' , visible : true , sortable : true , width : '120px' } ,
47- { id : 'maintainers' , label : 'Maintainers' , visible : false , sortable : false , width : '150px' } ,
48- { id : 'keywords' , label : 'Keywords' , visible : false , sortable : false , width : '200px' } ,
43+ { id : 'downloads' , visible : true , sortable : true , width : '120px' } ,
44+ { id : 'updated' , visible : true , sortable : true , width : '120px' } ,
45+ { id : 'maintainers' , visible : false , sortable : false , width : '150px' } ,
46+ { id : 'keywords' , visible : false , sortable : false , width : '200px' } ,
4947 {
5048 id : 'qualityScore' ,
51- label : 'Quality score' ,
5249 visible : false ,
5350 sortable : true ,
5451 width : '100px' ,
5552 disabled : true ,
5653 } ,
5754 {
5855 id : 'popularityScore' ,
59- label : 'Popularity score' ,
6056 visible : false ,
6157 sortable : true ,
6258 width : '100px' ,
6359 disabled : true ,
6460 } ,
6561 {
6662 id : 'maintenanceScore' ,
67- label : 'Maintenance score' ,
6863 visible : false ,
6964 sortable : true ,
7065 width : '100px' ,
7166 disabled : true ,
7267 } ,
7368 {
7469 id : 'combinedScore' ,
75- label : 'Combined score' ,
7670 visible : false ,
7771 sortable : true ,
7872 width : '100px' ,
7973 disabled : true ,
8074 } ,
8175 {
8276 id : 'security' ,
83- label : 'Security' ,
8477 visible : false ,
8578 sortable : false ,
8679 width : '80px' ,
@@ -131,7 +124,6 @@ export type SortOption =
131124
132125export interface SortKeyConfig {
133126 key : SortKey
134- label : string
135127 /** Default direction for this sort key */
136128 defaultDirection : SortDirection
137129 /** Whether the sort option is disabled (not yet available) */
@@ -141,52 +133,17 @@ export interface SortKeyConfig {
141133}
142134
143135export const SORT_KEYS : SortKeyConfig [ ] = [
144- { key : 'relevance' , label : 'Relevance' , defaultDirection : 'desc' , searchOnly : true } ,
145- { key : 'downloads-week' , label : 'Downloads/wk' , defaultDirection : 'desc' } ,
146- {
147- key : 'downloads-day' ,
148- label : 'Downloads/day' ,
149- defaultDirection : 'desc' ,
150- disabled : true ,
151- } ,
152- {
153- key : 'downloads-month' ,
154- label : 'Downloads/mo' ,
155- defaultDirection : 'desc' ,
156- disabled : true ,
157- } ,
158- {
159- key : 'downloads-year' ,
160- label : 'Downloads/yr' ,
161- defaultDirection : 'desc' ,
162- disabled : true ,
163- } ,
164- { key : 'updated' , label : 'Updated' , defaultDirection : 'desc' } ,
165- { key : 'name' , label : 'Name' , defaultDirection : 'asc' } ,
166- {
167- key : 'quality' ,
168- label : 'Quality' ,
169- defaultDirection : 'desc' ,
170- disabled : true ,
171- } ,
172- {
173- key : 'popularity' ,
174- label : 'Popularity' ,
175- defaultDirection : 'desc' ,
176- disabled : true ,
177- } ,
178- {
179- key : 'maintenance' ,
180- label : 'Maintenance' ,
181- defaultDirection : 'desc' ,
182- disabled : true ,
183- } ,
184- {
185- key : 'score' ,
186- label : 'Score' ,
187- defaultDirection : 'desc' ,
188- disabled : true ,
189- } ,
136+ { key : 'relevance' , defaultDirection : 'desc' , searchOnly : true } ,
137+ { key : 'downloads-week' , defaultDirection : 'desc' } ,
138+ { key : 'downloads-day' , defaultDirection : 'desc' , disabled : true } ,
139+ { key : 'downloads-month' , defaultDirection : 'desc' , disabled : true } ,
140+ { key : 'downloads-year' , defaultDirection : 'desc' , disabled : true } ,
141+ { key : 'updated' , defaultDirection : 'desc' } ,
142+ { key : 'name' , defaultDirection : 'asc' } ,
143+ { key : 'quality' , defaultDirection : 'desc' , disabled : true } ,
144+ { key : 'popularity' , defaultDirection : 'desc' , disabled : true } ,
145+ { key : 'maintenance' , defaultDirection : 'desc' , disabled : true } ,
146+ { key : 'score' , defaultDirection : 'desc' , disabled : true } ,
190147]
191148
192149/** All valid sort keys for validation */
@@ -205,7 +162,10 @@ const VALID_SORT_KEYS = new Set<SortKey>([
205162] )
206163
207164/** Parse a SortOption into key and direction */
208- export function parseSortOption ( option : SortOption ) : { key : SortKey ; direction : SortDirection } {
165+ export function parseSortOption ( option : SortOption ) : {
166+ key : SortKey
167+ direction : SortDirection
168+ } {
209169 const match = option . match ( / ^ ( .+ ) - ( a s c | d e s c ) $ / )
210170 if ( match ) {
211171 const key = match [ 1 ]
@@ -234,66 +194,46 @@ export type DownloadRange = 'any' | 'lt100' | '100-1k' | '1k-10k' | '10k-100k' |
234194
235195export interface DownloadRangeConfig {
236196 value : DownloadRange
237- label : string
238197 min ?: number
239198 max ?: number
240199}
241200
242201export const DOWNLOAD_RANGES : DownloadRangeConfig [ ] = [
243- { value : 'any' , label : 'Any' } ,
244- { value : 'lt100' , label : '< 100' , max : 100 } ,
245- { value : '100-1k' , label : '100 - 1K' , min : 100 , max : 1000 } ,
246- { value : '1k-10k' , label : '1K - 10K' , min : 1000 , max : 10000 } ,
247- { value : '10k-100k' , label : '10K - 100K' , min : 10000 , max : 100000 } ,
248- { value : 'gt100k' , label : '> 100K' , min : 100000 } ,
202+ { value : 'any' } ,
203+ { value : 'lt100' , max : 100 } ,
204+ { value : '100-1k' , min : 100 , max : 1000 } ,
205+ { value : '1k-10k' , min : 1000 , max : 10000 } ,
206+ { value : '10k-100k' , min : 10000 , max : 100000 } ,
207+ { value : 'gt100k' , min : 100000 } ,
249208]
250209
251210// Updated within presets
252211export type UpdatedWithin = 'any' | 'week' | 'month' | 'quarter' | 'year'
253212
254213export interface UpdatedWithinConfig {
255214 value : UpdatedWithin
256- label : string
257215 days ?: number
258216}
259217
260218export const UPDATED_WITHIN_OPTIONS : UpdatedWithinConfig [ ] = [
261- { value : 'any' , label : 'Any time' } ,
262- { value : 'week' , label : 'Past week' , days : 7 } ,
263- { value : 'month' , label : 'Past month' , days : 30 } ,
264- { value : 'quarter' , label : 'Past 3 months' , days : 90 } ,
265- { value : 'year' , label : 'Past year' , days : 365 } ,
219+ { value : 'any' } ,
220+ { value : 'week' , days : 7 } ,
221+ { value : 'month' , days : 30 } ,
222+ { value : 'quarter' , days : 90 } ,
223+ { value : 'year' , days : 365 } ,
266224]
267225
268226// Security filter options
269227export type SecurityFilter = 'all' | 'secure' | 'warnings'
270228
271- export interface SecurityFilterConfig {
272- value : SecurityFilter
273- label : string
274- }
275-
276- export const SECURITY_FILTER_OPTIONS : SecurityFilterConfig [ ] = [
277- { value : 'all' , label : 'All packages' } ,
278- { value : 'secure' , label : 'Secure only' } ,
279- { value : 'warnings' , label : 'Insecure only' } ,
280- ]
229+ /** Security filter values - labels are in i18n under filters.security_options */
230+ export const SECURITY_FILTER_VALUES : SecurityFilter [ ] = [ 'all' , 'secure' , 'warnings' ]
281231
282232// Search scope options
283233export type SearchScope = 'name' | 'description' | 'keywords' | 'all'
284234
285- export interface SearchScopeConfig {
286- value : SearchScope
287- label : string
288- description : string
289- }
290-
291- export const SEARCH_SCOPE_OPTIONS : SearchScopeConfig [ ] = [
292- { value : 'name' , label : 'Name' , description : 'Search package names only' } ,
293- { value : 'description' , label : 'Description' , description : 'Search descriptions only' } ,
294- { value : 'keywords' , label : 'Keywords' , description : 'Search keywords only' } ,
295- { value : 'all' , label : 'All' , description : 'Search name, description, and keywords' } ,
296- ]
235+ /** Search scope values - labels are in i18n under filters.scope_* */
236+ export const SEARCH_SCOPE_VALUES : SearchScope [ ] = [ 'name' , 'description' , 'keywords' , 'all' ]
297237
298238// Structured filters state
299239export interface StructuredFilters {
0 commit comments