@dacsar/prview 1.1.0 → 1.2.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/cli.js +278 -248
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -28341,109 +28341,6 @@ var require_stack_utils = __commonJS({
28341
28341
  }
28342
28342
  });
28343
28343
 
28344
- // node_modules/deepmerge/dist/cjs.js
28345
- var require_cjs = __commonJS({
28346
- "node_modules/deepmerge/dist/cjs.js"(exports, module2) {
28347
- "use strict";
28348
- var isMergeableObject = function isMergeableObject2(value) {
28349
- return isNonNullObject(value) && !isSpecial(value);
28350
- };
28351
- function isNonNullObject(value) {
28352
- return !!value && typeof value === "object";
28353
- }
28354
- function isSpecial(value) {
28355
- var stringValue = Object.prototype.toString.call(value);
28356
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
28357
- }
28358
- var canUseSymbol = typeof Symbol === "function" && Symbol.for;
28359
- var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
28360
- function isReactElement(value) {
28361
- return value.$$typeof === REACT_ELEMENT_TYPE;
28362
- }
28363
- function emptyTarget(val) {
28364
- return Array.isArray(val) ? [] : {};
28365
- }
28366
- function cloneUnlessOtherwiseSpecified(value, options) {
28367
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
28368
- }
28369
- function defaultArrayMerge(target, source, options) {
28370
- return target.concat(source).map(function(element) {
28371
- return cloneUnlessOtherwiseSpecified(element, options);
28372
- });
28373
- }
28374
- function getMergeFunction(key, options) {
28375
- if (!options.customMerge) {
28376
- return deepmerge2;
28377
- }
28378
- var customMerge = options.customMerge(key);
28379
- return typeof customMerge === "function" ? customMerge : deepmerge2;
28380
- }
28381
- function getEnumerableOwnPropertySymbols(target) {
28382
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
28383
- return Object.propertyIsEnumerable.call(target, symbol);
28384
- }) : [];
28385
- }
28386
- function getKeys(target) {
28387
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
28388
- }
28389
- function propertyIsOnObject(object, property) {
28390
- try {
28391
- return property in object;
28392
- } catch (_) {
28393
- return false;
28394
- }
28395
- }
28396
- function propertyIsUnsafe(target, key) {
28397
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
28398
- }
28399
- function mergeObject(target, source, options) {
28400
- var destination = {};
28401
- if (options.isMergeableObject(target)) {
28402
- getKeys(target).forEach(function(key) {
28403
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
28404
- });
28405
- }
28406
- getKeys(source).forEach(function(key) {
28407
- if (propertyIsUnsafe(target, key)) {
28408
- return;
28409
- }
28410
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
28411
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
28412
- } else {
28413
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
28414
- }
28415
- });
28416
- return destination;
28417
- }
28418
- function deepmerge2(target, source, options) {
28419
- options = options || {};
28420
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
28421
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
28422
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
28423
- var sourceIsArray = Array.isArray(source);
28424
- var targetIsArray = Array.isArray(target);
28425
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
28426
- if (!sourceAndTargetTypesMatch) {
28427
- return cloneUnlessOtherwiseSpecified(source, options);
28428
- } else if (sourceIsArray) {
28429
- return options.arrayMerge(target, source, options);
28430
- } else {
28431
- return mergeObject(target, source, options);
28432
- }
28433
- }
28434
- deepmerge2.all = function deepmergeAll(array, options) {
28435
- if (!Array.isArray(array)) {
28436
- throw new Error("first argument should be an array");
28437
- }
28438
- return array.reduce(function(prev, next) {
28439
- return deepmerge2(prev, next, options);
28440
- }, {});
28441
- };
28442
- var deepmerge_1 = deepmerge2;
28443
- module2.exports = deepmerge_1;
28444
- }
28445
- });
28446
-
28447
28344
  // node_modules/react/cjs/react-jsx-runtime.production.js
28448
28345
  var require_react_jsx_runtime_production = __commonJS({
28449
28346
  "node_modules/react/cjs/react-jsx-runtime.production.js"(exports) {
@@ -28743,6 +28640,109 @@ var require_jsx_runtime = __commonJS({
28743
28640
  }
28744
28641
  });
28745
28642
 
28643
+ // node_modules/deepmerge/dist/cjs.js
28644
+ var require_cjs = __commonJS({
28645
+ "node_modules/deepmerge/dist/cjs.js"(exports, module2) {
28646
+ "use strict";
28647
+ var isMergeableObject = function isMergeableObject2(value) {
28648
+ return isNonNullObject(value) && !isSpecial(value);
28649
+ };
28650
+ function isNonNullObject(value) {
28651
+ return !!value && typeof value === "object";
28652
+ }
28653
+ function isSpecial(value) {
28654
+ var stringValue = Object.prototype.toString.call(value);
28655
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
28656
+ }
28657
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
28658
+ var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
28659
+ function isReactElement(value) {
28660
+ return value.$$typeof === REACT_ELEMENT_TYPE;
28661
+ }
28662
+ function emptyTarget(val) {
28663
+ return Array.isArray(val) ? [] : {};
28664
+ }
28665
+ function cloneUnlessOtherwiseSpecified(value, options) {
28666
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
28667
+ }
28668
+ function defaultArrayMerge(target, source, options) {
28669
+ return target.concat(source).map(function(element) {
28670
+ return cloneUnlessOtherwiseSpecified(element, options);
28671
+ });
28672
+ }
28673
+ function getMergeFunction(key, options) {
28674
+ if (!options.customMerge) {
28675
+ return deepmerge2;
28676
+ }
28677
+ var customMerge = options.customMerge(key);
28678
+ return typeof customMerge === "function" ? customMerge : deepmerge2;
28679
+ }
28680
+ function getEnumerableOwnPropertySymbols(target) {
28681
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
28682
+ return Object.propertyIsEnumerable.call(target, symbol);
28683
+ }) : [];
28684
+ }
28685
+ function getKeys(target) {
28686
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
28687
+ }
28688
+ function propertyIsOnObject(object, property) {
28689
+ try {
28690
+ return property in object;
28691
+ } catch (_) {
28692
+ return false;
28693
+ }
28694
+ }
28695
+ function propertyIsUnsafe(target, key) {
28696
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
28697
+ }
28698
+ function mergeObject(target, source, options) {
28699
+ var destination = {};
28700
+ if (options.isMergeableObject(target)) {
28701
+ getKeys(target).forEach(function(key) {
28702
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
28703
+ });
28704
+ }
28705
+ getKeys(source).forEach(function(key) {
28706
+ if (propertyIsUnsafe(target, key)) {
28707
+ return;
28708
+ }
28709
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
28710
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
28711
+ } else {
28712
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
28713
+ }
28714
+ });
28715
+ return destination;
28716
+ }
28717
+ function deepmerge2(target, source, options) {
28718
+ options = options || {};
28719
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
28720
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
28721
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
28722
+ var sourceIsArray = Array.isArray(source);
28723
+ var targetIsArray = Array.isArray(target);
28724
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
28725
+ if (!sourceAndTargetTypesMatch) {
28726
+ return cloneUnlessOtherwiseSpecified(source, options);
28727
+ } else if (sourceIsArray) {
28728
+ return options.arrayMerge(target, source, options);
28729
+ } else {
28730
+ return mergeObject(target, source, options);
28731
+ }
28732
+ }
28733
+ deepmerge2.all = function deepmergeAll(array, options) {
28734
+ if (!Array.isArray(array)) {
28735
+ throw new Error("first argument should be an array");
28736
+ }
28737
+ return array.reduce(function(prev, next) {
28738
+ return deepmerge2(prev, next, options);
28739
+ }, {});
28740
+ };
28741
+ var deepmerge_1 = deepmerge2;
28742
+ module2.exports = deepmerge_1;
28743
+ }
28744
+ });
28745
+
28746
28746
  // node_modules/ink/build/render.js
28747
28747
  import { Stream } from "node:stream";
28748
28748
  import process13 from "node:process";
@@ -46027,6 +46027,95 @@ var meow = (helpText, options = {}) => {
46027
46027
  // src/app.tsx
46028
46028
  var import_react62 = __toESM(require_react(), 1);
46029
46029
 
46030
+ // src/constants.ts
46031
+ var COMMANDS = [
46032
+ { key: "Tab", label: "Switch tab" },
46033
+ { key: "j / k", label: "Move selection (\u2191 / \u2193)" },
46034
+ { key: "Enter", label: "Open PR in browser" },
46035
+ { key: "y", label: "Copy PR URL" },
46036
+ { key: "Y", label: "Copy branch name" },
46037
+ { key: "/", label: "Filter" },
46038
+ { key: "r", label: "Refresh" },
46039
+ { key: "h", label: "Toggle this help" },
46040
+ { key: "q", label: "Quit" }
46041
+ ];
46042
+ var COL = {
46043
+ icon: 4,
46044
+ repo: 18,
46045
+ status: 12,
46046
+ diff: 12,
46047
+ elapsed: 8,
46048
+ reviewee: 12,
46049
+ reviewer: 12
46050
+ };
46051
+ var BASE_WIDTH = 7;
46052
+ var OPTIONAL_WIDTH = {
46053
+ repo: COL.repo + 1,
46054
+ // 18 + separator
46055
+ status: COL.status + 2,
46056
+ // 12 + separator + marginLeft
46057
+ diff: COL.diff + 2,
46058
+ elapsed: COL.elapsed + 2,
46059
+ author: COL.reviewee + 2,
46060
+ reviewer: COL.reviewer + 2
46061
+ };
46062
+ var DROP_ORDER = [
46063
+ "reviewer",
46064
+ "author",
46065
+ "repo",
46066
+ "diff",
46067
+ "elapsed",
46068
+ "status"
46069
+ ];
46070
+ var MIN_TITLE_WIDTH = 20;
46071
+ function computeColumnLayout(columns) {
46072
+ const visible = new Set(
46073
+ Object.keys(OPTIONAL_WIDTH)
46074
+ );
46075
+ const fixed = () => {
46076
+ let width = BASE_WIDTH;
46077
+ for (const col of visible) width += OPTIONAL_WIDTH[col];
46078
+ return width;
46079
+ };
46080
+ for (const col of DROP_ORDER) {
46081
+ if (columns - fixed() >= MIN_TITLE_WIDTH) break;
46082
+ visible.delete(col);
46083
+ }
46084
+ return {
46085
+ showRepo: visible.has("repo"),
46086
+ showStatus: visible.has("status"),
46087
+ showDiff: visible.has("diff"),
46088
+ showElapsed: visible.has("elapsed"),
46089
+ showAuthor: visible.has("author"),
46090
+ showReviewer: visible.has("reviewer"),
46091
+ titleWidth: Math.max(10, columns - fixed())
46092
+ };
46093
+ }
46094
+
46095
+ // src/components/help-dialog.tsx
46096
+ var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
46097
+ function HelpDialog() {
46098
+ const keyWidth = Math.max(...COMMANDS.map((c) => c.key.length));
46099
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexGrow: 1, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
46100
+ Box_default,
46101
+ {
46102
+ flexDirection: "column",
46103
+ borderStyle: "round",
46104
+ borderColor: "cyan",
46105
+ paddingX: 2,
46106
+ paddingY: 1,
46107
+ children: [
46108
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { marginBottom: 1, justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: "cyan", children: "Keybindings" }) }),
46109
+ COMMANDS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
46110
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { width: keyWidth + 2, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: "white", children: c.key }) }),
46111
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: c.label })
46112
+ ] }, c.key)),
46113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: "Press h or Esc to close" }) })
46114
+ ]
46115
+ }
46116
+ ) });
46117
+ }
46118
+
46030
46119
  // node_modules/@inkjs/ui/build/components/badge/badge.js
46031
46120
  var import_react30 = __toESM(require_react(), 1);
46032
46121
 
@@ -48709,66 +48798,12 @@ var import_react58 = __toESM(require_react(), 1);
48709
48798
  var cursor3 = source_default.inverse(" ");
48710
48799
 
48711
48800
  // src/components/loading.tsx
48712
- var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
48801
+ var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
48713
48802
  function Loading({ error }) {
48714
48803
  if (error) {
48715
48804
  return null;
48716
48805
  }
48717
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { paddingX: 2, paddingY: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { label: "Fetching pull requests..." }) });
48718
- }
48719
-
48720
- // src/constants.ts
48721
- var COL = {
48722
- icon: 4,
48723
- repo: 18,
48724
- status: 12,
48725
- diff: 12,
48726
- elapsed: 8,
48727
- reviewee: 12,
48728
- reviewer: 12
48729
- };
48730
- var BASE_WIDTH = 7;
48731
- var OPTIONAL_WIDTH = {
48732
- repo: COL.repo + 1,
48733
- // 18 + separator
48734
- status: COL.status + 2,
48735
- // 12 + separator + marginLeft
48736
- diff: COL.diff + 2,
48737
- elapsed: COL.elapsed + 2,
48738
- author: COL.reviewee + 2,
48739
- reviewer: COL.reviewer + 2
48740
- };
48741
- var DROP_ORDER = [
48742
- "reviewer",
48743
- "author",
48744
- "repo",
48745
- "diff",
48746
- "elapsed",
48747
- "status"
48748
- ];
48749
- var MIN_TITLE_WIDTH = 20;
48750
- function computeColumnLayout(columns) {
48751
- const visible = new Set(
48752
- Object.keys(OPTIONAL_WIDTH)
48753
- );
48754
- const fixed = () => {
48755
- let width = BASE_WIDTH;
48756
- for (const col of visible) width += OPTIONAL_WIDTH[col];
48757
- return width;
48758
- };
48759
- for (const col of DROP_ORDER) {
48760
- if (columns - fixed() >= MIN_TITLE_WIDTH) break;
48761
- visible.delete(col);
48762
- }
48763
- return {
48764
- showRepo: visible.has("repo"),
48765
- showStatus: visible.has("status"),
48766
- showDiff: visible.has("diff"),
48767
- showElapsed: visible.has("elapsed"),
48768
- showAuthor: visible.has("author"),
48769
- showReviewer: visible.has("reviewer"),
48770
- titleWidth: Math.max(10, columns - fixed())
48771
- };
48806
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Box_default, { paddingX: 2, paddingY: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Spinner, { label: "Fetching pull requests..." }) });
48772
48807
  }
48773
48808
 
48774
48809
  // src/utils/format-time.ts
@@ -48806,29 +48841,29 @@ function getTimeColor(createdAt) {
48806
48841
  }
48807
48842
 
48808
48843
  // src/components/status-badge.tsx
48809
- var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
48844
+ var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
48810
48845
  function StatusBadge({ decision, isDraft }) {
48811
48846
  if (isDraft) {
48812
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { dimColor: true, children: "\u25CC DRAFT" });
48847
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "\u25CC DRAFT" });
48813
48848
  }
48814
48849
  switch (decision) {
48815
48850
  case "APPROVED": {
48816
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "green", children: "\u2713 APPROVED" });
48851
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: "green", children: "\u2713 APPROVED" });
48817
48852
  }
48818
48853
  case "CHANGES_REQUESTED": {
48819
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "red", children: "\u2715 CHANGES" });
48854
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: "red", children: "\u2715 CHANGES" });
48820
48855
  }
48821
48856
  case "REVIEW_REQUIRED": {
48822
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "yellow", children: "\u25CF PENDING" });
48857
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: "yellow", children: "\u25CF PENDING" });
48823
48858
  }
48824
48859
  default: {
48825
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { color: "yellow", children: "\u25CF PENDING" });
48860
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: "yellow", children: "\u25CF PENDING" });
48826
48861
  }
48827
48862
  }
48828
48863
  }
48829
48864
 
48830
48865
  // src/components/pr-row.tsx
48831
- var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
48866
+ var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
48832
48867
  function PrRow({ pr, isSelected }) {
48833
48868
  const { stdout } = use_stdout_default();
48834
48869
  const columns = stdout?.columns ?? 120;
@@ -48852,59 +48887,59 @@ function PrRow({ pr, isSelected }) {
48852
48887
  const firstReviewer = filteredReviewers[0];
48853
48888
  const extraCount = filteredReviewers.length - 1;
48854
48889
  const reviewerText = firstReviewer ? `@${firstReviewer.login}${extraCount > 0 ? ` +${extraCount}` : ""}` : "";
48855
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Box_default, { backgroundColor: isSelected ? "#333333" : void 0, children: [
48856
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: isSelected ? "red" : void 0, children: isSelected ? ">" : " " }),
48857
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { width: COL.icon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: timeColor, wrap: "truncate", children: ` ${icon} ` }) }),
48858
- showRepo && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
48859
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { width: COL.repo, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: !isSelected, color: selColor, wrap: "truncate", children: [
48890
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Box_default, { backgroundColor: isSelected ? "#333333" : void 0, children: [
48891
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: isSelected ? "red" : void 0, children: isSelected ? ">" : " " }),
48892
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { width: COL.icon, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: timeColor, wrap: "truncate", children: ` ${icon} ` }) }),
48893
+ showRepo && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
48894
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { width: COL.repo, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { dimColor: !isSelected, color: selColor, wrap: "truncate", children: [
48860
48895
  repoShort,
48861
48896
  "#",
48862
48897
  pr.number
48863
48898
  ] }) }),
48864
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "|" })
48899
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: "|" })
48865
48900
  ] }),
48866
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { width: titleWidth, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { bold: isSelected, color: selColor, wrap: "truncate", children: pr.title }) }),
48867
- showStatus && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
48868
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "|" }),
48869
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { width: COL.status, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StatusBadge, { decision: pr.reviewDecision, isDraft: pr.isDraft }) })
48901
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { width: titleWidth, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { bold: isSelected, color: selColor, wrap: "truncate", children: pr.title }) }),
48902
+ showStatus && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
48903
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: "|" }),
48904
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { width: COL.status, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StatusBadge, { decision: pr.reviewDecision, isDraft: pr.isDraft }) })
48870
48905
  ] }),
48871
- showDiff && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
48872
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "|" }),
48873
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { width: COL.diff, marginLeft: 1, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { wrap: "truncate", children: [
48874
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: "green", children: [
48906
+ showDiff && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
48907
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: "|" }),
48908
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { width: COL.diff, marginLeft: 1, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { wrap: "truncate", children: [
48909
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: "green", children: [
48875
48910
  "+",
48876
48911
  pr.additions
48877
48912
  ] }),
48878
48913
  " ",
48879
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { color: "red", children: [
48914
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { color: "red", children: [
48880
48915
  "-",
48881
48916
  pr.deletions
48882
48917
  ] })
48883
48918
  ] }) })
48884
48919
  ] }),
48885
- showElapsed && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
48886
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "|" }),
48887
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { width: COL.elapsed, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { color: timeColor, wrap: "truncate", children: elapsed }) })
48920
+ showElapsed && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
48921
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: "|" }),
48922
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { width: COL.elapsed, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { color: timeColor, wrap: "truncate", children: elapsed }) })
48888
48923
  ] }),
48889
- showAuthor && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
48890
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "|" }),
48891
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { width: COL.reviewee, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Text, { dimColor: true, wrap: "truncate", children: [
48924
+ showAuthor && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
48925
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: "|" }),
48926
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { width: COL.reviewee, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Text, { dimColor: true, wrap: "truncate", children: [
48892
48927
  "@",
48893
48928
  pr.author
48894
48929
  ] }) })
48895
48930
  ] }),
48896
- showReviewer && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
48897
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, children: "|" }),
48898
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Box_default, { width: COL.reviewer, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { dimColor: true, wrap: "truncate", children: reviewerText }) })
48931
+ showReviewer && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
48932
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: "|" }),
48933
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { width: COL.reviewer, marginLeft: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, wrap: "truncate", children: reviewerText }) })
48899
48934
  ] })
48900
48935
  ] });
48901
48936
  }
48902
48937
 
48903
48938
  // src/components/pr-table.tsx
48904
- var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
48939
+ var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
48905
48940
  function PrTable({ prs, selectedIndex, maxRows }) {
48906
48941
  if (prs.length === 0) {
48907
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { paddingX: 2, paddingY: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text, { dimColor: true, children: "No pull requests found." }) });
48942
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { paddingX: 2, paddingY: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: "No pull requests found." }) });
48908
48943
  }
48909
48944
  const visibleCount = Math.max(1, maxRows);
48910
48945
  let scrollOffset = 0;
@@ -48915,7 +48950,7 @@ function PrTable({ prs, selectedIndex, maxRows }) {
48915
48950
  scrollOffset = Math.min(scrollOffset, prs.length - visibleCount);
48916
48951
  }
48917
48952
  const visiblePRs = prs.slice(scrollOffset, scrollOffset + visibleCount);
48918
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Box_default, { flexDirection: "column", paddingX: 1, children: visiblePRs.map((pr, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
48953
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexDirection: "column", paddingX: 1, children: visiblePRs.map((pr, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
48919
48954
  PrRow,
48920
48955
  {
48921
48956
  pr,
@@ -48926,29 +48961,7 @@ function PrTable({ prs, selectedIndex, maxRows }) {
48926
48961
  }
48927
48962
 
48928
48963
  // src/components/status-bar.tsx
48929
- var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
48930
- var HINTS = [
48931
- { key: "Tab", label: "switch", keep: 6 },
48932
- { key: "j/k", label: "move", keep: 3 },
48933
- { key: "Enter", label: "open", keep: 2 },
48934
- { key: "y", label: "copy", keep: 4 },
48935
- { key: "/", label: "filter", keep: 5 },
48936
- { key: "r", label: "refresh", keep: 7 },
48937
- { key: "q", label: "quit", keep: 1 }
48938
- ];
48939
- var hintWidth = (h) => h.key.length + 1 + h.label.length;
48940
- function visibleHints(budget) {
48941
- const byPriority = [...HINTS].sort((a, b) => a.keep - b.keep);
48942
- const shown = /* @__PURE__ */ new Set();
48943
- let used = 0;
48944
- for (const h of byPriority) {
48945
- const width = hintWidth(h) + (shown.size > 0 ? 1 : 0);
48946
- if (used + width > budget) break;
48947
- used += width;
48948
- shown.add(h.key);
48949
- }
48950
- return HINTS.filter((h) => shown.has(h.key));
48951
- }
48964
+ var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
48952
48965
  function StatusBar({
48953
48966
  isFilterActive,
48954
48967
  filter,
@@ -48960,13 +48973,9 @@ function StatusBar({
48960
48973
  loading,
48961
48974
  copiedMessage
48962
48975
  }) {
48963
- const { stdout } = use_stdout_default();
48964
- const columns = stdout?.columns ?? 80;
48965
48976
  const isReview = activeTab === "review-requested";
48966
48977
  const tabLabel = isReview ? `To Review (${reviewCount})` : `My PRs (${myCount})`;
48967
- const reserved = 2 + tabLabel.length + (loading ? 13 : 0) + 2;
48968
- const hints = visibleHints(columns - reserved);
48969
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
48978
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
48970
48979
  Box_default,
48971
48980
  {
48972
48981
  borderStyle: "single",
@@ -48978,35 +48987,35 @@ function StatusBar({
48978
48987
  paddingX: 1,
48979
48988
  justifyContent: "space-between",
48980
48989
  children: [
48981
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { children: copiedMessage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: "green", children: [
48990
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { children: copiedMessage ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: "green", children: [
48982
48991
  "\u2713 ",
48983
48992
  copiedMessage
48984
- ] }) : isFilterActive || filter ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
48985
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: "/" }),
48986
- isFilterActive ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
48993
+ ] }) : isFilterActive || filter ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
48994
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "yellow", children: "/" }),
48995
+ isFilterActive ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
48987
48996
  TextInput,
48988
48997
  {
48989
48998
  defaultValue: filter,
48990
48999
  onChange: onFilterChange,
48991
49000
  placeholder: "Filter by title, repo, author, reviewer..."
48992
49001
  }
48993
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { dimColor: true, children: [
49002
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { dimColor: true, children: [
48994
49003
  " ",
48995
49004
  filter
48996
49005
  ] })
48997
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
48998
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, color: isReview ? "cyan" : "magenta", children: tabLabel }),
48999
- loading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: " Refreshing..." })
49006
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
49007
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, color: isReview ? "cyan" : "magenta", children: tabLabel }),
49008
+ loading && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: " Refreshing..." })
49000
49009
  ] }) }),
49001
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { gap: 1, children: isFilterMode ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { dimColor: true, children: [
49002
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "gray", children: "Esc" }),
49010
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { gap: 1, children: isFilterMode ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { dimColor: true, children: [
49011
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "gray", children: "Esc" }),
49003
49012
  " ",
49004
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: "cancel" })
49005
- ] }) : hints.map((h) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
49006
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "white", children: h.key }),
49013
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: "cancel" })
49014
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { children: [
49015
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "white", children: "h" }),
49007
49016
  " ",
49008
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: h.label })
49009
- ] }, h.key)) })
49017
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { dimColor: true, children: "help" })
49018
+ ] }) })
49010
49019
  ]
49011
49020
  }
49012
49021
  );
@@ -49211,7 +49220,7 @@ function openUrl(url2) {
49211
49220
  }
49212
49221
 
49213
49222
  // src/app.tsx
49214
- var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
49223
+ var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
49215
49224
  function App2() {
49216
49225
  const { exit } = use_app_default();
49217
49226
  const { stdout } = use_stdout_default();
@@ -49221,10 +49230,11 @@ function App2() {
49221
49230
  const [selectedIndex, setSelectedIndex] = (0, import_react62.useState)(0);
49222
49231
  const [filter, setFilter] = (0, import_react62.useState)("");
49223
49232
  const [isFilterMode, setIsFilterMode] = (0, import_react62.useState)(false);
49233
+ const [showHelp, setShowHelp] = (0, import_react62.useState)(false);
49224
49234
  const [copiedMessage, setCopiedMessage] = (0, import_react62.useState)("");
49225
49235
  const copiedTimer = (0, import_react62.useRef)(null);
49226
- const notifyCopied = (0, import_react62.useCallback)(() => {
49227
- setCopiedMessage("Copied URL to clipboard");
49236
+ const notifyCopied = (0, import_react62.useCallback)((label) => {
49237
+ setCopiedMessage(`Copied ${label} to clipboard`);
49228
49238
  if (copiedTimer.current) {
49229
49239
  clearTimeout(copiedTimer.current);
49230
49240
  }
@@ -49257,12 +49267,24 @@ function App2() {
49257
49267
  },
49258
49268
  { isActive: isFilterMode }
49259
49269
  );
49270
+ use_input_default(
49271
+ (input, key) => {
49272
+ if (input === "h" || key.escape || input === "q") {
49273
+ setShowHelp(false);
49274
+ }
49275
+ },
49276
+ { isActive: showHelp }
49277
+ );
49260
49278
  use_input_default(
49261
49279
  (input, key) => {
49262
49280
  if (input === "q") {
49263
49281
  exit();
49264
49282
  return;
49265
49283
  }
49284
+ if (input === "h") {
49285
+ setShowHelp(true);
49286
+ return;
49287
+ }
49266
49288
  if (key.tab) {
49267
49289
  setActiveTab(
49268
49290
  (prev) => prev === "review-requested" ? "my-prs" : "review-requested"
@@ -49289,7 +49311,15 @@ function App2() {
49289
49311
  const pr = filteredPRs[selectedIndex];
49290
49312
  if (pr) {
49291
49313
  copyToClipboard(pr.url);
49292
- notifyCopied();
49314
+ notifyCopied("URL");
49315
+ }
49316
+ return;
49317
+ }
49318
+ if (input === "Y") {
49319
+ const pr = filteredPRs[selectedIndex];
49320
+ if (pr) {
49321
+ copyToClipboard(pr.branch);
49322
+ notifyCopied("branch");
49293
49323
  }
49294
49324
  return;
49295
49325
  }
@@ -49307,23 +49337,23 @@ function App2() {
49307
49337
  return;
49308
49338
  }
49309
49339
  },
49310
- { isActive: !isFilterMode }
49340
+ { isActive: !isFilterMode && !showHelp }
49311
49341
  );
49312
49342
  const reservedRows = 2 + (error ? 1 : 0);
49313
49343
  const maxRows = rows - reservedRows;
49314
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", height: rows, justifyContent: "flex-end", children: [
49315
- error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { paddingX: 2, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { color: "red", children: [
49344
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", height: rows, justifyContent: "flex-end", children: [
49345
+ error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { paddingX: 2, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "red", children: [
49316
49346
  "Error: ",
49317
49347
  error
49318
49348
  ] }) }),
49319
- loading && filteredPRs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Loading, { error }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
49349
+ showHelp ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HelpDialog, {}) : loading && filteredPRs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loading, { error }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
49320
49350
  Box_default,
49321
49351
  {
49322
49352
  flexGrow: 1,
49323
49353
  overflow: "hidden",
49324
49354
  flexDirection: "column",
49325
49355
  justifyContent: "flex-end",
49326
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
49356
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
49327
49357
  PrTable,
49328
49358
  {
49329
49359
  prs: filteredPRs,
@@ -49333,7 +49363,7 @@ function App2() {
49333
49363
  )
49334
49364
  }
49335
49365
  ),
49336
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
49366
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
49337
49367
  StatusBar,
49338
49368
  {
49339
49369
  isFilterActive: isFilterMode,
@@ -49351,7 +49381,7 @@ function App2() {
49351
49381
  }
49352
49382
 
49353
49383
  // src/cli.tsx
49354
- var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
49384
+ var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
49355
49385
  meow(
49356
49386
  `
49357
49387
  Usage
@@ -49374,7 +49404,7 @@ meow(
49374
49404
  }
49375
49405
  );
49376
49406
  process.stdout.write("\x1B[?1049h");
49377
- var instance = render_default(/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(App2, {}));
49407
+ var instance = render_default(/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(App2, {}));
49378
49408
  instance.waitUntilExit().then(() => {
49379
49409
  process.stdout.write("\x1B[?1049l");
49380
49410
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dacsar/prview",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "TUI tool to check PRs across repositories",
5
5
  "repository": {
6
6
  "type": "git",