@kolkrabbi/kol-workshop 0.44.0 → 0.45.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/package.json +8 -8
- package/src/shell/ShellLayout.jsx +20 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-workshop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Docs viewer, shell and tag system",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"d3": "^7.9.0",
|
|
16
|
-
"@kolkrabbi/kol-
|
|
16
|
+
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
17
17
|
"@kolkrabbi/kol-search": "^0.3.0",
|
|
18
|
-
"@kolkrabbi/kol-
|
|
18
|
+
"@kolkrabbi/kol-brand": "^0.2.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@kolkrabbi/kol-component": ">=0.296.0",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@kolkrabbi/kol-
|
|
33
|
-
"@kolkrabbi/kol-
|
|
34
|
-
"@kolkrabbi/kol-
|
|
35
|
-
"@kolkrabbi/kol-
|
|
36
|
-
"@kolkrabbi/kol-
|
|
32
|
+
"@kolkrabbi/kol-icons": "^0.66.0",
|
|
33
|
+
"@kolkrabbi/kol-framework": "^0.70.0",
|
|
34
|
+
"@kolkrabbi/kol-shell": "^0.113.0",
|
|
35
|
+
"@kolkrabbi/kol-theme": "^0.214.0",
|
|
36
|
+
"@kolkrabbi/kol-component": "^0.344.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"src",
|
|
@@ -197,6 +197,25 @@ const writeSettings = (next) => {
|
|
|
197
197
|
/* A search item in either shape — the kol-search item (`title · kind · space ·
|
|
198
198
|
* category · tags · headings · keywords · description · href`) or the search modal's
|
|
199
199
|
* older row (`label · sectionLabel · …`). Both keep working. */
|
|
200
|
+
/* TIES TAKE TURNS (2026-11-05 — "chess" showed one icon row before All results): the engine breaks a tied score
|
|
201
|
+
* alphabetically, so a flat cut of 12 gave six Chess organisms (`Chess …` sorts ahead of `chess-bishop`) every slot
|
|
202
|
+
* the eighteen chess icons tied with. Inside one score the groups now take turns, each keeping its own order; a
|
|
203
|
+
* stronger hit still outranks a weaker one, and the cut is the same 12. */
|
|
204
|
+
const QUICK_MAX = 12
|
|
205
|
+
const quickList = (ranked) => {
|
|
206
|
+
const out = []
|
|
207
|
+
for (let i = 0; i < ranked.length && out.length < QUICK_MAX;) {
|
|
208
|
+
let j = i
|
|
209
|
+
while (j < ranked.length && ranked[j].score === ranked[i].score) j++
|
|
210
|
+
const lanes = new Map()
|
|
211
|
+
ranked.slice(i, j).forEach((r) => { const g = r.item.category ?? ''; lanes.set(g, [...(lanes.get(g) ?? []), r]) })
|
|
212
|
+
const queues = [...lanes.values()]
|
|
213
|
+
for (let k = 0; queues.some((q) => k < q.length); k++) queues.forEach((q) => { if (k < q.length) out.push(q[k]) })
|
|
214
|
+
i = j
|
|
215
|
+
}
|
|
216
|
+
return out.slice(0, QUICK_MAX)
|
|
217
|
+
}
|
|
218
|
+
|
|
200
219
|
const toSearchItem = (item, i) => ({
|
|
201
220
|
...item,
|
|
202
221
|
id: item.id ?? item.href ?? `${item.label ?? item.title}-${i}`,
|
|
@@ -534,7 +553,7 @@ const ShellLayout = ({ routes = [], basePath = '/', brand: brandProp, brandLogoS
|
|
|
534
553
|
const searchIndex = useMemo(() => createIndex((searchItems ?? []).map(toSearchItem)), [searchItems])
|
|
535
554
|
const quickScope = scopedIds ? { space: scopedIds } : {}
|
|
536
555
|
const searchResults = searchQuery
|
|
537
|
-
? search(searchIndex, searchQuery, { scope: quickScope
|
|
556
|
+
? quickList(search(searchIndex, searchQuery, { scope: quickScope }).results).map(({ item, reasons, highlights }) => {
|
|
538
557
|
const titleHit = reasons.some((r) => r.field === 'title')
|
|
539
558
|
const first = reasons.find((r) => r.hit)
|
|
540
559
|
return {
|