dsh-plugin-shop 0.5.4-beta.0 → 0.5.4-beta.1
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/lib/client.js +19 -2
- package/lib/types/client/present.d.ts +15 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -4815,11 +4815,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4815
4815
|
function categoryLocaleKey(category) {
|
|
4816
4816
|
return CATEGORY_KEYS[category];
|
|
4817
4817
|
}
|
|
4818
|
+
/**
|
|
4819
|
+
* One entry's star count from the sidecar, or undefined when it has none.
|
|
4820
|
+
*
|
|
4821
|
+
* The sidecar keys a github entry by its repo full name and an npm entry by
|
|
4822
|
+
* its package name — two disjoint keyspaces (registry `stars-assemble.ts`).
|
|
4823
|
+
* Every reader must go through this one function: the card read the repo key
|
|
4824
|
+
* and the shelf sort read the name, so for 2202 of the live catalog's 2210
|
|
4825
|
+
* github listings the number deciding a row's position was not the number
|
|
4826
|
+
* printed on it. 1590 of them sorted as unstarred — a 4014-star plugin at the
|
|
4827
|
+
* bottom of the shelf — and where an unrelated npm package happened to share
|
|
4828
|
+
* a listed entry's name, its stars ranked that entry instead: a 1-star
|
|
4829
|
+
* plugin held the first page on 13960 stars belonging to another project's
|
|
4830
|
+
* repo, one the catalog never even listed.
|
|
4831
|
+
*/
|
|
4832
|
+
function starsOf(entry, stars) {
|
|
4833
|
+
return stars[entry.repo ?? entry.name];
|
|
4834
|
+
}
|
|
4818
4835
|
/** Sort the shelf: stars descending, un-starred entries last, name ascending
|
|
4819
4836
|
* (case-insensitive) on ties (spec 2026-08-26-github-stars-design.md D1).
|
|
4820
4837
|
* Display-time only — the catalog's own name sort is untouched. */
|
|
4821
4838
|
function sortByStars(entries, stars) {
|
|
4822
|
-
const count = (e) =>
|
|
4839
|
+
const count = (e) => starsOf(e, stars) ?? -1;
|
|
4823
4840
|
return [...entries].sort((a, b) => {
|
|
4824
4841
|
const byStars = count(b) - count(a);
|
|
4825
4842
|
if (byStars !== 0) return byStars;
|
|
@@ -6247,7 +6264,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
6247
6264
|
className: _dsh_plugin_shop_css_e3675a89_default.cards,
|
|
6248
6265
|
children: [visible.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EntryCard, {
|
|
6249
6266
|
entry,
|
|
6250
|
-
stars:
|
|
6267
|
+
stars: starsOf(entry, stars),
|
|
6251
6268
|
installed: installedByName.get(entry.name),
|
|
6252
6269
|
t,
|
|
6253
6270
|
install,
|
|
@@ -130,6 +130,21 @@ export type Category = keyof typeof CATEGORY_KEYS;
|
|
|
130
130
|
export declare const CATEGORY_ORDER: Category[];
|
|
131
131
|
/** The locale key for one bare category value (the filter buttons). */
|
|
132
132
|
export declare function categoryLocaleKey(category: Category): ShopLocaleKey;
|
|
133
|
+
/**
|
|
134
|
+
* One entry's star count from the sidecar, or undefined when it has none.
|
|
135
|
+
*
|
|
136
|
+
* The sidecar keys a github entry by its repo full name and an npm entry by
|
|
137
|
+
* its package name — two disjoint keyspaces (registry `stars-assemble.ts`).
|
|
138
|
+
* Every reader must go through this one function: the card read the repo key
|
|
139
|
+
* and the shelf sort read the name, so for 2202 of the live catalog's 2210
|
|
140
|
+
* github listings the number deciding a row's position was not the number
|
|
141
|
+
* printed on it. 1590 of them sorted as unstarred — a 4014-star plugin at the
|
|
142
|
+
* bottom of the shelf — and where an unrelated npm package happened to share
|
|
143
|
+
* a listed entry's name, its stars ranked that entry instead: a 1-star
|
|
144
|
+
* plugin held the first page on 13960 stars belonging to another project's
|
|
145
|
+
* repo, one the catalog never even listed.
|
|
146
|
+
*/
|
|
147
|
+
export declare function starsOf(entry: CatalogEntry, stars: Record<string, number>): number | undefined;
|
|
133
148
|
/** Sort the shelf: stars descending, un-starred entries last, name ascending
|
|
134
149
|
* (case-insensitive) on ties (spec 2026-08-26-github-stars-design.md D1).
|
|
135
150
|
* Display-time only — the catalog's own name sort is untouched. */
|
package/package.json
CHANGED