@kud/gh-ink 0.40.0 → 0.41.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.
Files changed (2) hide show
  1. package/dist/index.js +46 -16
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2004,8 +2004,8 @@ var ItemRow = ({
2004
2004
  const transitIcon = !transient ? " " : isDeparture(transient) ? TRANSIT_OUT_FRAMES[sparkFrame % TRANSIT_OUT_FRAMES.length] : isArrival(transient) ? TRANSIT_IN_FRAMES[sparkFrame % TRANSIT_IN_FRAMES.length] : "\u25C9";
2005
2005
  const transitLabel2 = transient ? TRANSIT_LABEL[transient] : "";
2006
2006
  const titleMax2 = Math.max(
2007
- 20,
2008
- cols - item.key.length - note.length - (item.pill ? pillWidth(item.pill) + 1 : 0) - transitLabel2.length - prefix.length - 12
2007
+ 1,
2008
+ cols - item.key.length - note.length - (item.pill ? pillWidth(item.pill) + 1 : 0) - (transitLabel2 ? pillWidth(transitLabel2) : 0) - prefix.length - 12
2009
2009
  );
2010
2010
  return /* @__PURE__ */ jsxs(Box, { marginTop: gap ? 1 : 0, children: [
2011
2011
  /* @__PURE__ */ jsx(Text3, { color: "cyan", children: active ? "\u276F " : " " }),
@@ -2027,7 +2027,10 @@ var ItemRow = ({
2027
2027
  /* @__PURE__ */ jsx(Pill, { variant: item.pillVariant ?? "muted", children: item.pill })
2028
2028
  ] }) : null,
2029
2029
  note ? /* @__PURE__ */ jsx(Text3, { dimColor: true, children: ` ${note}` }) : null,
2030
- transitLabel2 ? /* @__PURE__ */ jsx(Text3, { bold: true, color: TRANSIT_COLOUR[transient], children: " " + transitLabel2 }) : null
2030
+ transitLabel2 ? /* @__PURE__ */ jsxs(Fragment, { children: [
2031
+ /* @__PURE__ */ jsx(Text3, { children: " " }),
2032
+ /* @__PURE__ */ jsx(Pill, { color: TRANSIT_COLOUR[transient], children: transitLabel2 })
2033
+ ] }) : null
2031
2034
  ] });
2032
2035
  }
2033
2036
  const { glyph: healthIcon, color: healthColor2 } = healthDisplay[item.health];
@@ -2041,16 +2044,37 @@ var ItemRow = ({
2041
2044
  const ageLabel = item.activityAge && item.activityAge !== item.age ? `${item.activityAge} \xB7 ${item.age}` : item.age;
2042
2045
  const mergedLabel = merged ? "MERGED" : "";
2043
2046
  const transitLabel = merged || !transient ? "" : TRANSIT_LABEL[transient];
2044
- const suffix = [
2045
- ageLabel || "",
2046
- unresolvedLabel,
2047
- showAuthor ? `by ${item.author}` : "",
2047
+ const pillCaps = [mergedLabel, transitLabel].filter(Boolean).length * 2;
2048
+ const repoLabel = depthOf(item) > 0 ? item.repo : "";
2049
+ const givingUp = { author: false, threads: false, age: false, repo: false };
2050
+ const widthOf2 = () => {
2051
+ const suffix2 = [
2052
+ givingUp.age ? "" : ageLabel || "",
2053
+ givingUp.threads ? "" : unresolvedLabel,
2054
+ showAuthor && !givingUp.author ? `by ${item.author}` : "",
2055
+ mergedLabel,
2056
+ transitLabel
2057
+ ].filter(Boolean).join(" ");
2058
+ return 2 + prefix.length + 2 + 2 + 7 + (givingUp.repo ? 0 : repoLabel.length) + suffix2.length + pillCaps + 6;
2059
+ };
2060
+ const MIN_TITLE = 24;
2061
+ for (const give of [
2062
+ () => givingUp.author = true,
2063
+ () => givingUp.threads = true,
2064
+ () => givingUp.repo = true,
2065
+ () => givingUp.age = true
2066
+ ]) {
2067
+ if (cols - widthOf2() >= MIN_TITLE) break;
2068
+ give();
2069
+ }
2070
+ [
2071
+ givingUp.age ? "" : ageLabel || "",
2072
+ givingUp.threads ? "" : unresolvedLabel,
2073
+ showAuthor && !givingUp.author ? `by ${item.author}` : "",
2048
2074
  mergedLabel,
2049
2075
  transitLabel
2050
2076
  ].filter(Boolean).join(" ");
2051
- const repoLabel = depthOf(item) > 0 ? item.repo : "";
2052
- const fixedWidth = 2 + prefix.length + 2 + 2 + 7 + repoLabel.length + suffix.length + 6;
2053
- const titleMax = Math.max(20, cols - fixedWidth);
2077
+ const titleMax = Math.max(1, cols - widthOf2());
2054
2078
  return /* @__PURE__ */ jsxs(Box, { children: [
2055
2079
  /* @__PURE__ */ jsx(Text3, { color: "cyan", children: active ? "\u276F " : " " }),
2056
2080
  /* @__PURE__ */ jsx(Text3, { dimColor: true, children: prefix }),
@@ -2066,12 +2090,18 @@ var ItemRow = ({
2066
2090
  children: truncate2(item.title, titleMax) + " "
2067
2091
  }
2068
2092
  ),
2069
- repoLabel ? /* @__PURE__ */ jsx(Text3, { dimColor: true, children: repoLabel }) : null,
2070
- unresolvedLabel ? /* @__PURE__ */ jsx(Text3, { bold: !spokeLast, color: spokeLast ? "#888888" : "#FF8700", children: " " + unresolvedLabel }) : null,
2071
- showAuthor ? /* @__PURE__ */ jsx(Text3, { dimColor: true, italic: true, children: " by " + item.author }) : null,
2072
- ageLabel ? /* @__PURE__ */ jsx(Text3, { dimColor: true, children: " " + ageLabel }) : null,
2073
- mergedLabel ? /* @__PURE__ */ jsx(Text3, { bold: true, color: MERGED_COLOUR, children: " " + mergedLabel }) : null,
2074
- transitLabel ? /* @__PURE__ */ jsx(Text3, { bold: true, color: TRANSIT_COLOUR[transient], children: " " + transitLabel }) : null
2093
+ repoLabel && !givingUp.repo ? /* @__PURE__ */ jsx(Text3, { dimColor: true, children: repoLabel }) : null,
2094
+ unresolvedLabel && !givingUp.threads ? /* @__PURE__ */ jsx(Text3, { bold: !spokeLast, color: spokeLast ? "#888888" : "#FF8700", children: " " + unresolvedLabel }) : null,
2095
+ showAuthor && !givingUp.author ? /* @__PURE__ */ jsx(Text3, { dimColor: true, italic: true, children: " by " + item.author }) : null,
2096
+ ageLabel && !givingUp.age ? /* @__PURE__ */ jsx(Text3, { dimColor: true, children: " " + ageLabel }) : null,
2097
+ mergedLabel ? /* @__PURE__ */ jsxs(Fragment, { children: [
2098
+ /* @__PURE__ */ jsx(Text3, { children: " " }),
2099
+ /* @__PURE__ */ jsx(Pill, { color: MERGED_COLOUR, children: mergedLabel })
2100
+ ] }) : null,
2101
+ transitLabel ? /* @__PURE__ */ jsxs(Fragment, { children: [
2102
+ /* @__PURE__ */ jsx(Text3, { children: " " }),
2103
+ /* @__PURE__ */ jsx(Pill, { color: TRANSIT_COLOUR[transient], children: transitLabel })
2104
+ ] }) : null
2075
2105
  ] });
2076
2106
  };
2077
2107
  var useActionMenu = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/gh-ink",
3
- "version": "0.40.0",
3
+ "version": "0.41.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",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@kud/gh": "0.9.0",
52
- "@kud/ink-ui": "0.17.0",
52
+ "@kud/ink-ui": "0.18.0",
53
53
  "zx": "8.8.5"
54
54
  },
55
55
  "devDependencies": {