@kud/gh-ink 0.75.2 → 0.76.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/index.d.ts +4 -3
- package/dist/index.js +38 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -426,9 +426,10 @@ type LayoutInput = Pick<PrRowProps, "item" | "login" | "cols" | "prefix" | "unif
|
|
|
426
426
|
};
|
|
427
427
|
/**
|
|
428
428
|
* Which trailing columns the section has to give up, so that every row gives up
|
|
429
|
-
* the same ones.
|
|
430
|
-
*
|
|
431
|
-
* for all of them
|
|
429
|
+
* the same ones. Drops come from two places: width pressure — each row is laid
|
|
430
|
+
* out alone and the drops are unioned, so if any row needs its size cell gone
|
|
431
|
+
* to keep a readable title, the size column goes for all of them — and
|
|
432
|
+
* emptiness, where no row in the section fills the column at all.
|
|
432
433
|
*
|
|
433
434
|
* Forcing a drop on a row that did not need it only ever hands that row more
|
|
434
435
|
* room, so it can never push the row further down the ladder than it went on
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React5, { createContext, useState, useRef, useContext, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { useWindowSize, useInput, Text, Box } from 'ink';
|
|
3
3
|
import { colors, ScrollView, TextInput, Pill, getIconMode, FooterHints, useAppKeys, LoadingScreen, pillWidth, StatusMessage, useFilterMode, useListCursor, CommandPalette, Tabs, ProgressBar } from '@kud/ink-ui';
|
|
4
4
|
import { isPassCheck, isFailCheck, isInconclusiveCheck, resolveThread, unresolveThread, replyToThread, rerunFailedRun, mergePr, reRequestReviewer, parseRef, formatRef, fetchItemNode } from '@kud/gh';
|
|
@@ -444,7 +444,7 @@ var Summary = ({
|
|
|
444
444
|
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
445
445
|
/* @__PURE__ */ jsx(Text, { bold: true, children: label.padEnd(10) }),
|
|
446
446
|
/* @__PURE__ */ jsx(Text, { children: icon + " " }),
|
|
447
|
-
parts.map(([text, color], i) => /* @__PURE__ */ jsxs(
|
|
447
|
+
parts.map(([text, color], i) => /* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
448
448
|
i > 0 && /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \xB7 " }),
|
|
449
449
|
/* @__PURE__ */ jsx(Text, { color, children: text })
|
|
450
450
|
] }, text + i))
|
|
@@ -857,15 +857,28 @@ var trailingColumnsOf = (items) => items.reduce(
|
|
|
857
857
|
{ author: 0, threads: 0, size: 0, age: 0 }
|
|
858
858
|
);
|
|
859
859
|
var numberColumnsOf = (items) => items.reduce((w, item) => Math.max(w, cellsOf(`#${item.number}`)), 0) + 2;
|
|
860
|
-
var sectionShedOf = (rows, context) =>
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
860
|
+
var sectionShedOf = (rows, context) => {
|
|
861
|
+
const noAuthor = rows.every(
|
|
862
|
+
({ item }) => !item.author || item.author === context.login
|
|
863
|
+
);
|
|
864
|
+
const noThreads = rows.every(({ item }) => !threadsLabelOf(item));
|
|
865
|
+
const empty = {
|
|
866
|
+
...noAuthor ? { author: true } : {},
|
|
867
|
+
...noThreads ? { threads: true } : {}
|
|
867
868
|
};
|
|
868
|
-
|
|
869
|
+
return rows.reduce(
|
|
870
|
+
(shed, row) => {
|
|
871
|
+
const { givingUp } = layoutOf({ ...context, ...row });
|
|
872
|
+
return {
|
|
873
|
+
author: shed.author || givingUp.author,
|
|
874
|
+
threads: shed.threads || givingUp.threads,
|
|
875
|
+
size: shed.size || givingUp.size,
|
|
876
|
+
age: shed.age || givingUp.age
|
|
877
|
+
};
|
|
878
|
+
},
|
|
879
|
+
{ ...empty }
|
|
880
|
+
);
|
|
881
|
+
};
|
|
869
882
|
var layoutOf = ({
|
|
870
883
|
item,
|
|
871
884
|
login,
|
|
@@ -1068,7 +1081,7 @@ var PrRow = ({
|
|
|
1068
1081
|
/* @__PURE__ */ jsx(Text3, { color: colors.secondary, children: agePair.activity }),
|
|
1069
1082
|
/* @__PURE__ */ jsx(Text3, { dimColor: true, children: ` (${agePair.lifetime})` })
|
|
1070
1083
|
] }) : ageLabel2 ? /* @__PURE__ */ jsx(Text3, { color: colors.secondary, children: ageLabel2 }) : null }) : null,
|
|
1071
|
-
backdropped ? null : announcements.map((a) => /* @__PURE__ */ jsxs(
|
|
1084
|
+
backdropped ? null : announcements.map((a) => /* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
1072
1085
|
/* @__PURE__ */ jsx(Text3, { children: " " }),
|
|
1073
1086
|
/* @__PURE__ */ jsx(Pill, { color: a.color, children: a.label })
|
|
1074
1087
|
] }, a.label))
|
|
@@ -1102,12 +1115,14 @@ var ageLabel = (at, now = Date.now()) => {
|
|
|
1102
1115
|
if (m < 60) return `${m}m`;
|
|
1103
1116
|
return `${Math.round(m / 60)}h`;
|
|
1104
1117
|
};
|
|
1105
|
-
var itemText = (item) => `${stripGlyph(item.state)[0]}${item.alarm ? ` ${ALARM}` : ""} ${item.key}`;
|
|
1118
|
+
var itemText = (item) => item.state === "fail" ? `${stripGlyph("fail")[0]} ${item.key}` : `${stripGlyph(item.state)[0]}${item.alarm ? ` ${ALARM}` : ""} ${item.key}`;
|
|
1119
|
+
var itemWidth = (item) => item.state === "fail" ? pillWidth(itemText(item)) : itemText(item).length;
|
|
1106
1120
|
var stripLayout = (strip, width, now = Date.now()) => {
|
|
1107
1121
|
const age = ageLabel(strip.at, now);
|
|
1108
1122
|
const fixed = 2 + strip.title.length + 2 + (age ? age.length + 3 : 0);
|
|
1109
1123
|
const full = strip.items.map(itemText).join(" ");
|
|
1110
|
-
|
|
1124
|
+
const fullWidth = strip.items.reduce((n, item) => n + itemWidth(item), 0) + Math.max(0, strip.items.length - 1) * 2;
|
|
1125
|
+
if (fixed + fullWidth <= width)
|
|
1111
1126
|
return { parts: strip.items, summary: full, age };
|
|
1112
1127
|
const sorted = [...strip.items].sort(
|
|
1113
1128
|
(a, b) => SEVERITY[a.state] - SEVERITY[b.state]
|
|
@@ -1122,13 +1137,13 @@ var stripLayout = (strip, width, now = Date.now()) => {
|
|
|
1122
1137
|
const rest = bad.slice(n);
|
|
1123
1138
|
const counts2 = ["fail", "warn", "unknown"].map((s) => tally(rest.filter((i) => i.state === s).length, s)).filter(Boolean);
|
|
1124
1139
|
text = [tally(ok, "ok"), ...counts2, ...named.map(itemText)].filter(Boolean).join(" \xB7 ");
|
|
1125
|
-
|
|
1140
|
+
const textWidth = text.length + 2 * named.filter((i) => i.state === "fail").length;
|
|
1141
|
+
if (fixed + textWidth <= width) break;
|
|
1126
1142
|
}
|
|
1127
1143
|
return { parts: null, summary: text, age };
|
|
1128
1144
|
};
|
|
1129
1145
|
var nameStyle = (item) => {
|
|
1130
|
-
if (item.
|
|
1131
|
-
return { color: colors.error, bold: true };
|
|
1146
|
+
if (item.alarm) return { color: colors.error, bold: true };
|
|
1132
1147
|
if (item.state === "unknown") return { dimColor: true };
|
|
1133
1148
|
return {};
|
|
1134
1149
|
};
|
|
@@ -1152,9 +1167,14 @@ var StatusStripLine = ({
|
|
|
1152
1167
|
return /* @__PURE__ */ jsxs(Box, { marginBottom: 1, children: [
|
|
1153
1168
|
/* @__PURE__ */ jsx(Text, { dimColor: true, children: ` ${strip.title} ` }),
|
|
1154
1169
|
parts ? parts.map((item, i) => {
|
|
1170
|
+
if (item.state === "fail")
|
|
1171
|
+
return /* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
1172
|
+
i > 0 ? /* @__PURE__ */ jsx(Text, { children: " " }) : null,
|
|
1173
|
+
/* @__PURE__ */ jsx(Pill, { variant: "error", tone: "solid", children: itemText(item) })
|
|
1174
|
+
] }, item.key);
|
|
1155
1175
|
const [glyph, color] = stripGlyph(item.state);
|
|
1156
|
-
const asking = item.state === "
|
|
1157
|
-
return /* @__PURE__ */ jsxs(
|
|
1176
|
+
const asking = item.state === "warn";
|
|
1177
|
+
return /* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
1158
1178
|
i > 0 ? /* @__PURE__ */ jsx(Text, { children: " " }) : null,
|
|
1159
1179
|
/* @__PURE__ */ jsx(
|
|
1160
1180
|
Text,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/gh-ink",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.0",
|
|
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",
|