@grove-dev/core 0.5.0-next.0 → 0.5.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/dist/build-data.d.ts.map +1 -1
- package/dist/build-data.js +20 -2
- package/dist/build-data.js.map +1 -1
- package/dist/collections.d.ts +10 -0
- package/dist/collections.d.ts.map +1 -1
- package/dist/collections.js +19 -2
- package/dist/collections.js.map +1 -1
- package/dist/content-body.d.ts +21 -0
- package/dist/content-body.d.ts.map +1 -1
- package/dist/content-body.js +25 -1
- package/dist/content-body.js.map +1 -1
- package/dist/contributors.d.ts.map +1 -1
- package/dist/contributors.js +9 -0
- package/dist/contributors.js.map +1 -1
- package/dist/directory-client.d.ts +1 -0
- package/dist/directory-client.d.ts.map +1 -1
- package/dist/directory-client.js +1 -0
- package/dist/directory-client.js.map +1 -1
- package/dist/directory-display.d.ts +16 -1
- package/dist/directory-display.d.ts.map +1 -1
- package/dist/directory-display.js +126 -90
- package/dist/directory-display.js.map +1 -1
- package/dist/directory-facets.d.ts +44 -0
- package/dist/directory-facets.d.ts.map +1 -0
- package/dist/directory-facets.js +61 -0
- package/dist/directory-facets.js.map +1 -0
- package/dist/directory-format.d.ts +16 -0
- package/dist/directory-format.d.ts.map +1 -1
- package/dist/directory-format.js +17 -0
- package/dist/directory-format.js.map +1 -1
- package/dist/directory-search.d.ts +30 -1
- package/dist/directory-search.d.ts.map +1 -1
- package/dist/directory-search.js +135 -15
- package/dist/directory-search.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +51 -41
- package/dist/markdown.js.map +1 -1
- package/dist/page-document.d.ts +3 -2
- package/dist/page-document.d.ts.map +1 -1
- package/dist/page-document.js +3 -2
- package/dist/page-document.js.map +1 -1
- package/dist/robots.d.ts.map +1 -1
- package/dist/robots.js +13 -13
- package/dist/robots.js.map +1 -1
- package/dist/schema.d.ts +74 -19
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +104 -19
- package/dist/schema.js.map +1 -1
- package/dist/site-artifacts.d.ts +1 -1
- package/dist/site-artifacts.d.ts.map +1 -1
- package/dist/site-artifacts.js +25 -23
- package/dist/site-artifacts.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* server-rendered Astro components and any client-side script.
|
|
9
9
|
*/
|
|
10
10
|
export const LABEL_DISPLAY = {
|
|
11
|
-
new:
|
|
12
|
-
hot:
|
|
13
|
-
mature:
|
|
14
|
-
featured:
|
|
11
|
+
new: 'Recently added',
|
|
12
|
+
hot: 'Trending',
|
|
13
|
+
mature: 'Established',
|
|
14
|
+
featured: 'Featured',
|
|
15
15
|
};
|
|
16
16
|
/** Returns a human-readable name for a label id, or null if unknown. */
|
|
17
17
|
export function labelDisplay(id) {
|
|
@@ -26,80 +26,94 @@ export function labelDisplay(id) {
|
|
|
26
26
|
* to "stale,quiet" in URL state but presents as one chip).
|
|
27
27
|
*/
|
|
28
28
|
export const STATUS_DISPLAY = {
|
|
29
|
-
active:
|
|
30
|
-
mature:
|
|
31
|
-
quiet:
|
|
32
|
-
stale:
|
|
33
|
-
inactive:
|
|
34
|
-
|
|
35
|
-
archived:
|
|
36
|
-
historical:
|
|
37
|
-
needs_review:
|
|
38
|
-
unavailable:
|
|
39
|
-
unknown:
|
|
29
|
+
active: 'Active',
|
|
30
|
+
mature: 'Mature',
|
|
31
|
+
quiet: 'Quiet',
|
|
32
|
+
stale: 'Not recently active',
|
|
33
|
+
inactive: 'Inactive',
|
|
34
|
+
'needs-maintainer': 'Needs maintainer',
|
|
35
|
+
archived: 'Archived',
|
|
36
|
+
historical: 'Historical',
|
|
37
|
+
needs_review: 'Needs review',
|
|
38
|
+
unavailable: 'Unavailable',
|
|
39
|
+
unknown: 'Unknown',
|
|
40
40
|
};
|
|
41
41
|
export function statusDisplay(s) {
|
|
42
42
|
if (!s)
|
|
43
|
-
return STATUS_DISPLAY.unknown ??
|
|
44
|
-
return STATUS_DISPLAY[s] ?? STATUS_DISPLAY.unknown ??
|
|
43
|
+
return STATUS_DISPLAY.unknown ?? '';
|
|
44
|
+
return STATUS_DISPLAY[s] ?? STATUS_DISPLAY.unknown ?? '';
|
|
45
45
|
}
|
|
46
46
|
// ── Lens ids (the curated tabs on /items) ────────────────────────────
|
|
47
47
|
export const LENS_DISPLAY = {
|
|
48
|
-
all:
|
|
49
|
-
new:
|
|
50
|
-
hot:
|
|
51
|
-
mature:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
launches:
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
all: 'All items',
|
|
49
|
+
new: 'Recently added',
|
|
50
|
+
hot: 'Trending',
|
|
51
|
+
mature: 'Established',
|
|
52
|
+
'good-to-learn': 'Good to learn',
|
|
53
|
+
'production-like': 'Production-like',
|
|
54
|
+
'beginner-friendly': 'Beginner friendly',
|
|
55
|
+
'contribution-ready': 'Contribution ready',
|
|
56
|
+
launches: 'Launches',
|
|
57
|
+
'actively-developed': 'Active',
|
|
58
|
+
'needs-maintainer': 'Needs maintainer',
|
|
59
59
|
};
|
|
60
60
|
export function lensDisplay(id) {
|
|
61
61
|
if (!id)
|
|
62
|
-
return LENS_DISPLAY.all ??
|
|
62
|
+
return LENS_DISPLAY.all ?? 'All';
|
|
63
63
|
return LENS_DISPLAY[id] ?? id;
|
|
64
64
|
}
|
|
65
65
|
// ── Sort ids (the /items sort dropdown) ──────────────────────────────
|
|
66
66
|
export const SORT_DISPLAY = {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
alphabetical:
|
|
67
|
+
'recently-updated': 'Recently updated',
|
|
68
|
+
'most-starred': 'Most starred',
|
|
69
|
+
'recently-added': 'Recently added',
|
|
70
|
+
'best-overall': 'Best overall',
|
|
71
|
+
alphabetical: 'Alphabetical',
|
|
72
72
|
};
|
|
73
73
|
export function sortDisplay(id) {
|
|
74
74
|
if (!id)
|
|
75
|
-
return SORT_DISPLAY[
|
|
75
|
+
return SORT_DISPLAY['recently-updated'] ?? '';
|
|
76
76
|
return SORT_DISPLAY[id] ?? id;
|
|
77
77
|
}
|
|
78
78
|
export function prettySlug(value) {
|
|
79
79
|
if (!value)
|
|
80
|
-
return
|
|
80
|
+
return '';
|
|
81
81
|
return value
|
|
82
82
|
.split(/[-_]+/)
|
|
83
83
|
.filter(Boolean)
|
|
84
84
|
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
85
|
-
.join(
|
|
85
|
+
.join(' ');
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Up-to-two-letter initials for avatar placeholders (e.g. "Open WebUI"
|
|
89
|
+
* → "OW"). Shared by every card component so the fallback treatment
|
|
90
|
+
* stays identical across the directory.
|
|
91
|
+
*/
|
|
92
|
+
export function nameInitials(name) {
|
|
93
|
+
return (name ?? '')
|
|
94
|
+
.split(/\s+/)
|
|
95
|
+
.map((word) => word[0])
|
|
96
|
+
.filter(Boolean)
|
|
97
|
+
.slice(0, 2)
|
|
98
|
+
.join('')
|
|
99
|
+
.toUpperCase();
|
|
86
100
|
}
|
|
87
101
|
// ── Status option list (used by filter dropdowns) ───────────────────
|
|
88
102
|
// "needs-maintainer" is included even though it's a derived/composite
|
|
89
103
|
// status — filter dropdowns and chip rendering need to offer it
|
|
90
104
|
// alongside the raw AppStatus values.
|
|
91
105
|
export const STATUS_OPTIONS = [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
'active',
|
|
107
|
+
'mature',
|
|
108
|
+
'quiet',
|
|
109
|
+
'stale',
|
|
110
|
+
'inactive',
|
|
111
|
+
'needs-maintainer',
|
|
112
|
+
'archived',
|
|
113
|
+
'historical',
|
|
114
|
+
'needs_review',
|
|
115
|
+
'unavailable',
|
|
116
|
+
'unknown',
|
|
103
117
|
];
|
|
104
118
|
// ── GitHub linguist palette ─────────────────────────────────────────
|
|
105
119
|
// Color hex values mirror the GitHub Linguist language palette so a
|
|
@@ -107,46 +121,46 @@ export const STATUS_OPTIONS = [
|
|
|
107
121
|
// project's GitHub page. Anything not in the map falls back to a
|
|
108
122
|
// neutral ink grey. Used by the record-detail sidebar.
|
|
109
123
|
export const LANG_COLORS = {
|
|
110
|
-
TypeScript:
|
|
111
|
-
JavaScript:
|
|
112
|
-
Python:
|
|
113
|
-
Go:
|
|
114
|
-
Rust:
|
|
115
|
-
Ruby:
|
|
116
|
-
Java:
|
|
117
|
-
Kotlin:
|
|
118
|
-
Swift:
|
|
119
|
-
C:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
PHP:
|
|
123
|
-
Shell:
|
|
124
|
-
Bash:
|
|
125
|
-
HTML:
|
|
126
|
-
CSS:
|
|
127
|
-
SCSS:
|
|
128
|
-
Sass:
|
|
129
|
-
Less:
|
|
130
|
-
Vue:
|
|
131
|
-
Svelte:
|
|
132
|
-
Dart:
|
|
133
|
-
Lua:
|
|
134
|
-
Elixir:
|
|
135
|
-
Haskell:
|
|
136
|
-
Scala:
|
|
137
|
-
R:
|
|
138
|
-
MATLAB:
|
|
139
|
-
|
|
140
|
-
MDX:
|
|
141
|
-
Dockerfile:
|
|
142
|
-
Makefile:
|
|
143
|
-
Perl:
|
|
144
|
-
Zig:
|
|
145
|
-
Nim:
|
|
146
|
-
Erlang:
|
|
147
|
-
Elm:
|
|
148
|
-
OCaml:
|
|
149
|
-
|
|
124
|
+
TypeScript: '#3178c6',
|
|
125
|
+
JavaScript: '#f1e05a',
|
|
126
|
+
Python: '#3572A5',
|
|
127
|
+
Go: '#00ADD8',
|
|
128
|
+
Rust: '#dea584',
|
|
129
|
+
Ruby: '#701516',
|
|
130
|
+
Java: '#b07219',
|
|
131
|
+
Kotlin: '#A97BFF',
|
|
132
|
+
Swift: '#F05138',
|
|
133
|
+
C: '#555555',
|
|
134
|
+
'C++': '#f34b7d',
|
|
135
|
+
'C#': '#178600',
|
|
136
|
+
PHP: '#4F5D95',
|
|
137
|
+
Shell: '#89e051',
|
|
138
|
+
Bash: '#89e051',
|
|
139
|
+
HTML: '#e34c26',
|
|
140
|
+
CSS: '#563d7c',
|
|
141
|
+
SCSS: '#c6538c',
|
|
142
|
+
Sass: '#a53b88',
|
|
143
|
+
Less: '#1d365d',
|
|
144
|
+
Vue: '#41b883',
|
|
145
|
+
Svelte: '#ff3e00',
|
|
146
|
+
Dart: '#00B4AB',
|
|
147
|
+
Lua: '#000080',
|
|
148
|
+
Elixir: '#6e4a7e',
|
|
149
|
+
Haskell: '#5e5086',
|
|
150
|
+
Scala: '#c22d40',
|
|
151
|
+
R: '#198CE7',
|
|
152
|
+
MATLAB: '#e16737',
|
|
153
|
+
'Jupyter Notebook': '#DA5B0B',
|
|
154
|
+
MDX: '#fcb32c',
|
|
155
|
+
Dockerfile: '#384d54',
|
|
156
|
+
Makefile: '#427819',
|
|
157
|
+
Perl: '#0298c3',
|
|
158
|
+
Zig: '#ec915c',
|
|
159
|
+
Nim: '#ffc200',
|
|
160
|
+
Erlang: '#B83998',
|
|
161
|
+
Elm: '#60B5CC',
|
|
162
|
+
OCaml: '#3be133',
|
|
163
|
+
'F#': '#b845fc',
|
|
150
164
|
};
|
|
151
165
|
/**
|
|
152
166
|
* Resolve a GitHub Linguist color for a language name. Returns a
|
|
@@ -155,7 +169,29 @@ export const LANG_COLORS = {
|
|
|
155
169
|
*/
|
|
156
170
|
export function langColor(name) {
|
|
157
171
|
if (!name)
|
|
158
|
-
return
|
|
159
|
-
return LANG_COLORS[name] ??
|
|
172
|
+
return '#9ca3af';
|
|
173
|
+
return LANG_COLORS[name] ?? '#9ca3af';
|
|
174
|
+
}
|
|
175
|
+
// ── SPDX license id → human-readable label ──────────────────────────
|
|
176
|
+
// GitHub emits a literal `NOASSERTION` (and the related `OTHER`
|
|
177
|
+
// placeholder) on repositories where the license couldn't be
|
|
178
|
+
// auto-detected. Surfacing the API enum to readers looks like a
|
|
179
|
+
// bug; this helper swaps the placeholder for a plain-English string.
|
|
180
|
+
const LICENSE_PLACEHOLDER_IDS = new Set(['NOASSERTION', 'OTHER', 'NONE', 'UNLICENSED', '']);
|
|
181
|
+
export const LICENSE_NOT_DETECTED = 'License not detected';
|
|
182
|
+
export const LICENSE_OTHER = 'Other';
|
|
183
|
+
/**
|
|
184
|
+
* Resolve a SPDX id (or GitHub-flavored placeholder) to a
|
|
185
|
+
* user-facing string. The placeholder ids are collapsed to a
|
|
186
|
+
* short, neutral phrase; known SPDX ids pass through untouched so
|
|
187
|
+
* downstream consumers can still match on them.
|
|
188
|
+
*/
|
|
189
|
+
export function licenseDisplay(spdxId) {
|
|
190
|
+
if (!spdxId)
|
|
191
|
+
return LICENSE_NOT_DETECTED;
|
|
192
|
+
if (LICENSE_PLACEHOLDER_IDS.has(spdxId.toUpperCase())) {
|
|
193
|
+
return spdxId.toUpperCase() === 'OTHER' ? LICENSE_OTHER : LICENSE_NOT_DETECTED;
|
|
194
|
+
}
|
|
195
|
+
return spdxId;
|
|
160
196
|
}
|
|
161
197
|
//# sourceMappingURL=directory-display.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-display.js","sourceRoot":"","sources":["../src/directory-display.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,CAAC,MAAM,aAAa,GAA4B;IACpD,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,UAAU;IACf,MAAM,EAAE,aAAa;IACrB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,EAA6B;IACxD,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IACrB,OAAO,aAAa,CAAC,EAAa,CAAC,IAA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AI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,CAAC,EAAE,SAAS;IACZ,MAAM,EAAE,SAAS;IACjB,kBAAkB,EAAE,SAAS;IAC7B,GAAG,EAAE,SAAS;IACd,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,SAAS;IACnB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAA+B;IACvD,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;AACxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"directory-display.js","sourceRoot":"","sources":["../src/directory-display.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,CAAC,MAAM,aAAa,GAA4B;IACpD,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,UAAU;IACf,MAAM,EAAE,aAAa;IACrB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,EAA6B;IACxD,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IACrB,OAAO,aAAa,CAAC,EAAa,C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,6DAA6D;AAC7D,gEAAgE;AAChE,qEAAqE;AACrE,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAE5F,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAC3D,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAErC;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAiC;IAC9D,IAAI,CAAC,MAAM;QAAE,OAAO,oBAAoB,CAAC;IACzC,IAAI,uBAAuB,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACtD,OAAO,MAAM,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACjF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single facet registry.
|
|
3
|
+
*
|
|
4
|
+
* `browse.facets` in grove.config.ts decides WHICH browse dimensions a
|
|
5
|
+
* site exposes and in WHAT ORDER; this module owns everything else a
|
|
6
|
+
* facet id means — its filter dimension, display label, URL parameter,
|
|
7
|
+
* and selection mode. Consumers (schema validation, view models, the
|
|
8
|
+
* filter UI, the submission form) all read from here so the id list
|
|
9
|
+
* can't drift into parallel alias tables.
|
|
10
|
+
*/
|
|
11
|
+
/** Canonical facet ids accepted by `browse.facets` (validated by zod). */
|
|
12
|
+
export declare const FACET_IDS: readonly ["category", "stack", "platform", "tags", "license"];
|
|
13
|
+
export type FacetId = (typeof FACET_IDS)[number];
|
|
14
|
+
/** Keys of the `buildFacets()` result / `IndexFilters` dimensions. */
|
|
15
|
+
export type FacetDimension = "categories" | "stacks" | "platforms" | "tags" | "licenses";
|
|
16
|
+
export interface FacetDef {
|
|
17
|
+
id: FacetId;
|
|
18
|
+
/** Key into `buildFacets()` output and `IndexFilters`. */
|
|
19
|
+
dimension: FacetDimension;
|
|
20
|
+
/** Filter-group display label. */
|
|
21
|
+
label: string;
|
|
22
|
+
/** Query parameter (mirrors `KEYS` in directory-search). */
|
|
23
|
+
urlParam: string;
|
|
24
|
+
/** Single-select facets render radios and navigate on change. */
|
|
25
|
+
single: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const FACET_DEFS: Record<FacetId, FacetDef>;
|
|
28
|
+
/** Default facet set when `browse.facets` is not configured. */
|
|
29
|
+
export declare const DEFAULT_FACETS: readonly FacetId[];
|
|
30
|
+
/**
|
|
31
|
+
* Normalize a facet spelling to its canonical id. The config schema
|
|
32
|
+
* only accepts canonical ids; this alias map keeps runtime consumers
|
|
33
|
+
* tolerant of the historical singular/plural spellings that may still
|
|
34
|
+
* exist in generated artifacts.
|
|
35
|
+
*/
|
|
36
|
+
export declare function canonicalFacetId(value: string): FacetId | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a configured facet list into ordered, deduped definitions.
|
|
39
|
+
* ORDER IS THE CONTRACT: the array order in `browse.facets` is the
|
|
40
|
+
* order filter groups render in. Unknown ids resolve to nothing here —
|
|
41
|
+
* the config schema already rejects them at parse time.
|
|
42
|
+
*/
|
|
43
|
+
export declare function configuredFacetDefs(facets?: readonly string[]): FacetDef[];
|
|
44
|
+
//# sourceMappingURL=directory-facets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-facets.d.ts","sourceRoot":"","sources":["../src/directory-facets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,SAAS,+DAAgE,CAAC;AACvF,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD,sEAAsE;AACtE,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;AAEzF,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,OAAO,CAAC;IACZ,0DAA0D;IAC1D,SAAS,EAAE,cAAc,CAAC;IAC1B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,OAAO,EAAE,QAAQ,CAMhD,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,cAAc,EAAE,SAAS,OAAO,EAAyB,CAAC;AAevE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,QAAQ,EAAE,CAW1E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single facet registry.
|
|
3
|
+
*
|
|
4
|
+
* `browse.facets` in grove.config.ts decides WHICH browse dimensions a
|
|
5
|
+
* site exposes and in WHAT ORDER; this module owns everything else a
|
|
6
|
+
* facet id means — its filter dimension, display label, URL parameter,
|
|
7
|
+
* and selection mode. Consumers (schema validation, view models, the
|
|
8
|
+
* filter UI, the submission form) all read from here so the id list
|
|
9
|
+
* can't drift into parallel alias tables.
|
|
10
|
+
*/
|
|
11
|
+
/** Canonical facet ids accepted by `browse.facets` (validated by zod). */
|
|
12
|
+
export const FACET_IDS = ["category", "stack", "platform", "tags", "license"];
|
|
13
|
+
export const FACET_DEFS = {
|
|
14
|
+
category: { id: "category", dimension: "categories", label: "Category", urlParam: "category", single: false },
|
|
15
|
+
stack: { id: "stack", dimension: "stacks", label: "Stack", urlParam: "stack", single: false },
|
|
16
|
+
platform: { id: "platform", dimension: "platforms", label: "Platform", urlParam: "platform", single: false },
|
|
17
|
+
tags: { id: "tags", dimension: "tags", label: "Tag", urlParam: "tag", single: false },
|
|
18
|
+
license: { id: "license", dimension: "licenses", label: "License", urlParam: "license", single: true },
|
|
19
|
+
};
|
|
20
|
+
/** Default facet set when `browse.facets` is not configured. */
|
|
21
|
+
export const DEFAULT_FACETS = ["category", "tags"];
|
|
22
|
+
const FACET_ALIASES = {
|
|
23
|
+
category: "category",
|
|
24
|
+
categories: "category",
|
|
25
|
+
stack: "stack",
|
|
26
|
+
stacks: "stack",
|
|
27
|
+
platform: "platform",
|
|
28
|
+
platforms: "platform",
|
|
29
|
+
tag: "tags",
|
|
30
|
+
tags: "tags",
|
|
31
|
+
license: "license",
|
|
32
|
+
licenses: "license",
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Normalize a facet spelling to its canonical id. The config schema
|
|
36
|
+
* only accepts canonical ids; this alias map keeps runtime consumers
|
|
37
|
+
* tolerant of the historical singular/plural spellings that may still
|
|
38
|
+
* exist in generated artifacts.
|
|
39
|
+
*/
|
|
40
|
+
export function canonicalFacetId(value) {
|
|
41
|
+
return FACET_ALIASES[value];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resolve a configured facet list into ordered, deduped definitions.
|
|
45
|
+
* ORDER IS THE CONTRACT: the array order in `browse.facets` is the
|
|
46
|
+
* order filter groups render in. Unknown ids resolve to nothing here —
|
|
47
|
+
* the config schema already rejects them at parse time.
|
|
48
|
+
*/
|
|
49
|
+
export function configuredFacetDefs(facets) {
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
const defs = [];
|
|
52
|
+
for (const raw of facets ?? DEFAULT_FACETS) {
|
|
53
|
+
const id = canonicalFacetId(raw);
|
|
54
|
+
if (id && !seen.has(id)) {
|
|
55
|
+
seen.add(id);
|
|
56
|
+
defs.push(FACET_DEFS[id]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return defs;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL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AO;IACd,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,UAAU;IACrB,GAAG,EAAE,MAAM;IACX,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA0B;IAC5D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAW,CAAC;IAChC,MAAM,IAAI,GAAe,EAAE,CAAC;IAC5B,KAAK,MAAM,GAAG,IAAI,MAAM,IAAI,cAAc,EAAE,CAAC;QAC3C,MAAM,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -20,6 +20,22 @@ export declare function formatStars(n: number | null | undefined): string | null
|
|
|
20
20
|
* dates (which can happen with bad upstream timestamps).
|
|
21
21
|
*/
|
|
22
22
|
export declare function formatRelative(iso: string | null | undefined): string;
|
|
23
|
+
/**
|
|
24
|
+
* Pick the singular or plural noun for a count. The plural form is
|
|
25
|
+
* explicit — never derived with a naive `+"s"` — so blueprint labels
|
|
26
|
+
* with irregular plurals ("entity"/"entities") render correctly.
|
|
27
|
+
*/
|
|
28
|
+
export declare function pluralize(count: number, singular: string, plural: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Format a count with its noun: `formatCount(1, {singular: "project",
|
|
31
|
+
* plural: "projects"})` → "1 project". The noun pair typically comes
|
|
32
|
+
* from the blueprint labels, so every surface (grids, collection
|
|
33
|
+
* cards, browse results) counts with the same vocabulary.
|
|
34
|
+
*/
|
|
35
|
+
export declare function formatCount(count: number, noun: {
|
|
36
|
+
singular: string;
|
|
37
|
+
plural: string;
|
|
38
|
+
}): string;
|
|
23
39
|
/**
|
|
24
40
|
* Format an ISO date as a localized short date (e.g. "Jan 5, 2026").
|
|
25
41
|
* Returns the original string for unparseable input, or "—" when
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-format.d.ts","sourceRoot":"","sources":["../src/directory-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGvE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAcrE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CASjE"}
|
|
1
|
+
{"version":3,"file":"directory-format.d.ts","sourceRoot":"","sources":["../src/directory-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAMzC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGvE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAcrE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzC,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CASjE"}
|
package/dist/directory-format.js
CHANGED
|
@@ -52,6 +52,23 @@ export function formatRelative(iso) {
|
|
|
52
52
|
return "1y ago";
|
|
53
53
|
return `${years}y ago`;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Pick the singular or plural noun for a count. The plural form is
|
|
57
|
+
* explicit — never derived with a naive `+"s"` — so blueprint labels
|
|
58
|
+
* with irregular plurals ("entity"/"entities") render correctly.
|
|
59
|
+
*/
|
|
60
|
+
export function pluralize(count, singular, plural) {
|
|
61
|
+
return count === 1 ? singular : plural;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Format a count with its noun: `formatCount(1, {singular: "project",
|
|
65
|
+
* plural: "projects"})` → "1 project". The noun pair typically comes
|
|
66
|
+
* from the blueprint labels, so every surface (grids, collection
|
|
67
|
+
* cards, browse results) counts with the same vocabulary.
|
|
68
|
+
*/
|
|
69
|
+
export function formatCount(count, noun) {
|
|
70
|
+
return `${count} ${pluralize(count, noun.singular, noun.plural)}`;
|
|
71
|
+
}
|
|
55
72
|
/**
|
|
56
73
|
* Format an ISO date as a localized short date (e.g. "Jan 5, 2026").
|
|
57
74
|
* Returns the original string for unparseable input, or "—" when
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-format.js","sourceRoot":"","sources":["../src/directory-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM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G;AACH,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,QAAgB,EAAE,MAAc;IACvE,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,KAAa,EACb,IAA0C;IAE1C,OAAO,GAAG,KAAK,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,GAA8B;IACvD,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAC;IACrB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,GAAG,CAAC;IAC1C,OAAO,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE;QACnC,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -59,6 +59,14 @@ export declare function applySort(items: IndexRecord[], sort: IndexSort): IndexR
|
|
|
59
59
|
export declare function paginate<T>(items: T[], page: number, pageSize?: number): T[];
|
|
60
60
|
/** Total number of pages given an item count. Always >= 1. */
|
|
61
61
|
export declare function totalPages(itemCount: number, pageSize?: number): number;
|
|
62
|
+
/**
|
|
63
|
+
* Windowed page list for pagination controls: all pages when 7 or
|
|
64
|
+
* fewer, otherwise `1 … active−1 active active+1 … count` with
|
|
65
|
+
* "ellipsis" markers. Shared by the server-rendered `Pagination`
|
|
66
|
+
* component and the client-side rebuild in `DirectoryIndexClient`
|
|
67
|
+
* so the two never drift.
|
|
68
|
+
*/
|
|
69
|
+
export declare function paginationPageList(active: number, count: number): Array<number | "ellipsis">;
|
|
62
70
|
/** Resolve the effective sort from a filters object, applying default. */
|
|
63
71
|
export declare function effectiveSort(f: IndexFilters): IndexSort;
|
|
64
72
|
/** Resolve the effective page from a filters object, applying default. */
|
|
@@ -90,7 +98,28 @@ export declare function removeFilter(f: IndexFilters, key: keyof IndexFilters, v
|
|
|
90
98
|
* Build the full list of facet values from the items array, preserving
|
|
91
99
|
* a sensible order (frequency desc, then alphabetical for ties).
|
|
92
100
|
*/
|
|
93
|
-
export declare function buildFacets(items: IndexRecord[]
|
|
101
|
+
export declare function buildFacets(items: IndexRecord[], options?: {
|
|
102
|
+
curatedTagIds?: string[];
|
|
103
|
+
/**
|
|
104
|
+
* When set, facet counts reflect records that satisfy all
|
|
105
|
+
* current filters *except* the facet being computed. This is the
|
|
106
|
+
* "intersection count" UX — Platform after Flutter should show
|
|
107
|
+
* Flutter+Platform counts, not the global Platform count.
|
|
108
|
+
*
|
|
109
|
+
* Set to `null` (or omit) to keep the legacy global-count
|
|
110
|
+
* behavior. The browse page opts in by passing the current
|
|
111
|
+
* `IndexFilters` minus each facet's filter.
|
|
112
|
+
*/
|
|
113
|
+
filters?: IndexFilters | null;
|
|
114
|
+
/**
|
|
115
|
+
* Taxonomy-owned display order per dimension: an array of ids in
|
|
116
|
+
* the order the taxonomy YAML declares them. Known ids sort by
|
|
117
|
+
* that position; ids that exist only in record data append after,
|
|
118
|
+
* in the default count-desc-then-alpha order. Curated tag ids
|
|
119
|
+
* (topics.yml) flow through the `tags` key the same way.
|
|
120
|
+
*/
|
|
121
|
+
order?: Partial<Record<"stacks" | "platforms" | "categories" | "tags" | "licenses", string[]>>;
|
|
122
|
+
}): {
|
|
94
123
|
stacks: {
|
|
95
124
|
value: string;
|
|
96
125
|
count: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory-search.d.ts","sourceRoot":"","sources":["../src/directory-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/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