@kud/gh-ink 0.44.4 → 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.
Files changed (2) hide show
  1. package/dist/index.js +37 -11
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -746,6 +746,7 @@ var invalidateCache = (key) => {
746
746
  var MARK_SEP = "\0";
747
747
  var markKey = (sectionId, rowKey) => `${sectionId}${MARK_SEP}${rowKey}`;
748
748
  var rowKeyOfMark = (mark) => mark.slice(mark.indexOf(MARK_SEP) + 1);
749
+ var sectionIdOfMark = (mark) => mark.slice(0, mark.indexOf(MARK_SEP));
749
750
  var keyOf = (item) => {
750
751
  if (item.kind === "pr" || item.kind === "issue") return item.url;
751
752
  if (item.kind === "task") {
@@ -822,8 +823,12 @@ var diffSections = (prev, next) => {
822
823
  const boardAfter = rowsOf(after);
823
824
  const transients = /* @__PURE__ */ new Map();
824
825
  const leaving = [];
826
+ const sampled = new Set(
827
+ next.concat(prev).filter((s) => s.sampled).map((s) => s.id)
828
+ );
829
+ const isSampled = (mark) => sampled.has(sectionIdOfMark(mark));
825
830
  for (const [mark] of after)
826
- if (!before.has(mark))
831
+ if (!before.has(mark) && !isSampled(mark))
827
832
  transients.set(
828
833
  mark,
829
834
  boardBefore.has(rowKeyOfMark(mark)) ? "moved-in" : "in"
@@ -831,10 +836,11 @@ var diffSections = (prev, next) => {
831
836
  for (const [mark, was] of before) {
832
837
  const now = after.get(mark);
833
838
  if (!now) {
834
- transients.set(
835
- mark,
836
- boardAfter.has(rowKeyOfMark(mark)) ? "moved-out" : "out"
837
- );
839
+ if (!isSampled(mark))
840
+ transients.set(
841
+ mark,
842
+ boardAfter.has(rowKeyOfMark(mark)) ? "moved-out" : "out"
843
+ );
838
844
  leaving.push(was);
839
845
  } else if (renderedState(was.item) !== renderedState(now.item)) {
840
846
  transients.set(mark, "changed");
@@ -845,12 +851,15 @@ var diffSections = (prev, next) => {
845
851
  const changedRows = /* @__PURE__ */ new Set();
846
852
  for (const [mark, kind] of transients)
847
853
  if (kind === "changed") changedRows.add(rowKeyOfMark(mark));
854
+ const onlySampled = (sections) => sections.size > 0 && [...sections].every((id) => sampled.has(id));
848
855
  for (const [key, sections] of boardAfter) {
849
856
  const had = boardBefore.get(key);
850
- if (!had) added += 1;
851
- else if (!sameSections(had, sections)) changedRows.add(key);
857
+ if (!had) {
858
+ if (!onlySampled(sections)) added += 1;
859
+ } else if (!sameSections(had, sections)) changedRows.add(key);
852
860
  }
853
- for (const key of boardBefore.keys()) if (!boardAfter.has(key)) removed += 1;
861
+ for (const [key, sections] of boardBefore)
862
+ if (!boardAfter.has(key) && !onlySampled(sections)) removed += 1;
854
863
  return {
855
864
  transients,
856
865
  union: spliceBack(next, leaving),
@@ -1783,6 +1792,9 @@ var MERGED_FRAMES = ["\u2726", "\u2727", "\u2736", "\u2727"];
1783
1792
  var MERGED_COLOUR = "#A371F7";
1784
1793
  var TRANSIT_HOLD_MS = 7e3;
1785
1794
  var TRANSIT_FRAME_TICKS = 3;
1795
+ var PULSE_SETTLE_MS = 6e4;
1796
+ var PULSE_MAX_FRAMES = Math.ceil(PULSE_SETTLE_MS / MERGED_FRAME_MS);
1797
+ var PULSE_SETTLED_FRAME = 3;
1786
1798
  var NO_TRANSIENTS = /* @__PURE__ */ new Map();
1787
1799
  var NO_HOLDS = /* @__PURE__ */ new Map();
1788
1800
  var TRANSIT_OUT_FRAMES = ["\u25C9", "\u25CE", "\u25CB", "\xB7"];
@@ -2417,11 +2429,25 @@ var BrowseScreen = ({
2417
2429
  // whole case the pulse exists for — a marker inside it cannot be seen at all
2418
2430
  // — and a ticker gated on the visible tab would leave that dot sitting still.
2419
2431
  markedTabs.size > 0 || !!transients?.size && section.items.some((item) => transientOf(transients, item, section.id));
2432
+ const sparkKey = sparkling ? [
2433
+ [...markedTabs].sort().join(","),
2434
+ mergedUrls?.length ?? 0,
2435
+ leavingUrls?.length ?? 0
2436
+ ].join("|") : "";
2420
2437
  useEffect(() => {
2421
- if (!sparkling) return;
2422
- const id = setInterval(() => setSparkFrame((f) => f + 1), MERGED_FRAME_MS);
2438
+ if (!sparkKey) return;
2439
+ let frames = 0;
2440
+ const id = setInterval(() => {
2441
+ frames += 1;
2442
+ if (frames >= PULSE_MAX_FRAMES) {
2443
+ clearInterval(id);
2444
+ setSparkFrame(PULSE_SETTLED_FRAME);
2445
+ return;
2446
+ }
2447
+ setSparkFrame((f) => f + 1);
2448
+ }, MERGED_FRAME_MS);
2423
2449
  return () => clearInterval(id);
2424
- }, [sparkling]);
2450
+ }, [sparkKey]);
2425
2451
  useEffect(() => {
2426
2452
  if (refreshError) showFlash(`\u2717 ${refreshError.message}`);
2427
2453
  }, [refreshError]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/gh-ink",
3
- "version": "0.44.4",
3
+ "version": "0.45.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",
@@ -48,10 +48,10 @@
48
48
  "react": ">=19"
49
49
  },
50
50
  "dependencies": {
51
- "@kud/gh": "0.11.0",
51
+ "@kud/gh": "0.12.0",
52
52
  "@kud/ink-ui": "0.22.0",
53
53
  "zx": "8.8.5",
54
- "@kud/gh-workflow": "0.2.1"
54
+ "@kud/gh-workflow": "0.3.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/node": "22.20.1",