@kud/gh-ink 0.45.5 → 0.45.7
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/index.js +20 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -744,7 +744,7 @@ var invalidateCache = (key) => {
|
|
|
744
744
|
|
|
745
745
|
// src/inbox/diff.ts
|
|
746
746
|
var MARK_SEP = "\0";
|
|
747
|
-
var markKey = (sectionId,
|
|
747
|
+
var markKey = (sectionId, rowKey2) => `${sectionId}${MARK_SEP}${rowKey2}`;
|
|
748
748
|
var rowKeyOfMark = (mark) => mark.slice(mark.indexOf(MARK_SEP) + 1);
|
|
749
749
|
var sectionIdOfMark = (mark) => mark.slice(0, mark.indexOf(MARK_SEP));
|
|
750
750
|
var keyOf = (item) => {
|
|
@@ -1120,6 +1120,7 @@ var maxViewStart = (items, budget) => {
|
|
|
1120
1120
|
start++;
|
|
1121
1121
|
return start;
|
|
1122
1122
|
};
|
|
1123
|
+
var rowKey = (item) => item.kind === "task" ? item.instanceKey ?? item.key : item.kind === "repo-header" ? `header:${item.repo}` : item.kind === "subgroup-header" ? `subgroup:${item.label}` : item.kind === "show-more" ? `show-more:${item.hidden[0]?.repo ?? ""}` : item.kind === "show-less" ? `show-less:${item.toHide[0]?.repo ?? ""}` : `${item.repo}/${item.number}`;
|
|
1123
1124
|
var firstSelectable = (section) => Math.max(
|
|
1124
1125
|
0,
|
|
1125
1126
|
section.items.findIndex(
|
|
@@ -2379,11 +2380,17 @@ var BrowseScreen = ({
|
|
|
2379
2380
|
useEffect(() => {
|
|
2380
2381
|
setLocalSections(applyWork(sections));
|
|
2381
2382
|
}, [sections]);
|
|
2383
|
+
const prevItems = useRef({});
|
|
2382
2384
|
useEffect(() => {
|
|
2385
|
+
const before = prevItems.current;
|
|
2383
2386
|
setTabIdx((prev) => Math.min(prev, Math.max(0, localSections.length - 1)));
|
|
2384
2387
|
setCursors(
|
|
2385
2388
|
(prev) => Object.fromEntries(
|
|
2386
2389
|
localSections.map((s) => {
|
|
2390
|
+
const wasAt = prev[s.id];
|
|
2391
|
+
const anchor = wasAt === void 0 ? void 0 : before[s.id]?.[wasAt];
|
|
2392
|
+
const moved = anchor ? s.items.findIndex((i) => rowKey(i) === rowKey(anchor)) : -1;
|
|
2393
|
+
if (moved >= 0) return [s.id, moved];
|
|
2387
2394
|
const c = Math.min(
|
|
2388
2395
|
prev[s.id] ?? firstSelectable(s),
|
|
2389
2396
|
s.items.length - 1
|
|
@@ -2391,11 +2398,21 @@ var BrowseScreen = ({
|
|
|
2391
2398
|
if (c < 0) return [s.id, 0];
|
|
2392
2399
|
return [
|
|
2393
2400
|
s.id,
|
|
2394
|
-
|
|
2401
|
+
// Only `subgroup-header`, which is the one kind the arrows refuse to
|
|
2402
|
+
// stand on — `moveCursor` skips it and nothing else. A REPO header is
|
|
2403
|
+
// selectable on purpose: it opens the repo and `C` copies the group,
|
|
2404
|
+
// and the footer advertises both. Stepping off it here meant that
|
|
2405
|
+
// standing on a repo and pressing `r` moved you onto an issue, every
|
|
2406
|
+
// single time, and the rule predated repo headers being selectable
|
|
2407
|
+
// at all.
|
|
2408
|
+
s.items[c]?.kind === "subgroup-header" ? moveCursor(s.items, c, 1) : c
|
|
2395
2409
|
];
|
|
2396
2410
|
})
|
|
2397
2411
|
)
|
|
2398
2412
|
);
|
|
2413
|
+
prevItems.current = Object.fromEntries(
|
|
2414
|
+
localSections.map((s) => [s.id, s.items])
|
|
2415
|
+
);
|
|
2399
2416
|
setViewStarts(
|
|
2400
2417
|
(prev) => Object.fromEntries(
|
|
2401
2418
|
localSections.map((s) => [
|
|
@@ -3036,7 +3053,7 @@ var BrowseScreen = ({
|
|
|
3036
3053
|
cols: listCols,
|
|
3037
3054
|
gap: i > 0 && gapsAbove(section.items, viewStart + i)
|
|
3038
3055
|
},
|
|
3039
|
-
`${viewStart + i}:${item
|
|
3056
|
+
`${viewStart + i}:${rowKey(item)}`
|
|
3040
3057
|
)) }),
|
|
3041
3058
|
hasMore && /* @__PURE__ */ jsxs(Text3, { dimColor: true, children: [
|
|
3042
3059
|
" ",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/gh-ink",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.7",
|
|
4
4
|
"description": "Ink components for rendering GitHub PR review comments and health — controlled, presentation-only, built on @kud/ink-ui and fed by @kud/gh.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"react": ">=19"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@kud/gh": "0.12.
|
|
52
|
-
"@kud/gh-workflow": "0.3.
|
|
51
|
+
"@kud/gh": "0.12.2",
|
|
52
|
+
"@kud/gh-workflow": "0.3.2",
|
|
53
53
|
"@kud/ink-ui": "0.23.0",
|
|
54
54
|
"zx": "8.8.5"
|
|
55
55
|
},
|