@nkzw/codiff-core 1.11.0 → 1.12.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/SharedWalkthroughApp.d.ts +1 -0
- package/dist/app/components/Panels.d.ts +2 -1
- package/dist/lib/narrative-walkthrough-diff.d.ts +2 -0
- package/dist/lib/narrative-walkthrough-diff.mjs +3 -1
- package/dist/lib/review-comments.d.ts +1 -1
- package/dist/react.mjs +158 -26
- package/dist/style.css +1 -2
- package/dist/types.d.ts +2 -0
- package/package.json +3 -3
|
@@ -14,6 +14,7 @@ export type ReviewSurfaceProps = {
|
|
|
14
14
|
onClosePullRequest?: () => Promise<void> | void;
|
|
15
15
|
onGenerateWalkthrough: () => Promise<void> | void;
|
|
16
16
|
onHome: () => void;
|
|
17
|
+
onMarkPullRequestReady?: () => Promise<void> | void;
|
|
17
18
|
onMergePullRequest?: (options: PullRequestMergeOptions & {
|
|
18
19
|
autoMerge: boolean;
|
|
19
20
|
}) => Promise<void> | void;
|
|
@@ -53,11 +53,12 @@ export declare function CopyCommentsButton({ comments, files, reviewCommentsPref
|
|
|
53
53
|
showWhitespace: boolean;
|
|
54
54
|
}): import("react").JSX.Element;
|
|
55
55
|
export declare const isPullRequestReviewActionDisabled: (reviewStatus: PullRequestReviewStatus | undefined, event: PullRequestReviewEvent) => boolean;
|
|
56
|
-
export declare function PullRequestReviewButtons({ children, disabled, hasPendingComments, onClosePullRequest, onSubmitReview, reviewStatus, showCommentReview, }: {
|
|
56
|
+
export declare function PullRequestReviewButtons({ children, disabled, hasPendingComments, onClosePullRequest, onMarkPullRequestReady, onSubmitReview, reviewStatus, showCommentReview, }: {
|
|
57
57
|
children?: ReactNode;
|
|
58
58
|
disabled: boolean;
|
|
59
59
|
hasPendingComments: boolean;
|
|
60
60
|
onClosePullRequest?: () => void;
|
|
61
|
+
onMarkPullRequestReady?: () => void;
|
|
61
62
|
onSubmitReview: (event: PullRequestReviewEvent, body?: string) => Promise<void> | void;
|
|
62
63
|
reviewStatus?: PullRequestReviewStatus;
|
|
63
64
|
showCommentReview?: boolean;
|
|
@@ -26,6 +26,7 @@ declare const extractPatchHunks: (patch: string) => {
|
|
|
26
26
|
added: number;
|
|
27
27
|
deleted: number;
|
|
28
28
|
header: string;
|
|
29
|
+
patch: string;
|
|
29
30
|
}[];
|
|
30
31
|
/** @param {ReadonlyArray<{added: number; deleted: number}>} hunks */
|
|
31
32
|
declare const sumHunkLineCounts: (hunks: ReadonlyArray<{
|
|
@@ -95,6 +96,7 @@ declare const getSectionWalkthroughHunks: (file: {
|
|
|
95
96
|
added: number;
|
|
96
97
|
deleted: number;
|
|
97
98
|
header: string;
|
|
99
|
+
patch: string;
|
|
98
100
|
id: string;
|
|
99
101
|
index: number;
|
|
100
102
|
kind: string;
|
|
@@ -102,6 +102,7 @@ const extractPatchHunks = (patch) => {
|
|
|
102
102
|
index += 1;
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
|
+
const hunkStart = index;
|
|
105
106
|
let additions = 0;
|
|
106
107
|
let deletions = 0;
|
|
107
108
|
index += 1;
|
|
@@ -115,7 +116,8 @@ const extractPatchHunks = (patch) => {
|
|
|
115
116
|
...parsed,
|
|
116
117
|
added: additions,
|
|
117
118
|
deleted: deletions,
|
|
118
|
-
header
|
|
119
|
+
header,
|
|
120
|
+
patch: lines.slice(hunkStart, index).join("\n")
|
|
119
121
|
});
|
|
120
122
|
}
|
|
121
123
|
return hunks;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChangedFile, PullRequestExistingReviewComment, PullRequestReviewComment, RepositoryState } from '../types.ts';
|
|
2
2
|
import type { CodeViewInstance, ReviewComment } from './app-types.ts';
|
|
3
3
|
export declare const isInteractiveReviewEvent: (event: PointerEvent) => boolean;
|
|
4
|
-
export declare const hasActiveTextSelection: () => boolean;
|
|
4
|
+
export declare const hasActiveTextSelection: (target?: Node | null) => boolean;
|
|
5
5
|
export declare const isFileReviewComment: (comment: Pick<ReviewComment, 'anchor' | 'lineNumber' | 'side'>) => boolean;
|
|
6
6
|
export declare const isLineReviewComment: (comment: ReviewComment) => comment is ReviewComment & {
|
|
7
7
|
lineNumber: number;
|
package/dist/react.mjs
CHANGED
|
@@ -44,7 +44,6 @@ import { ArrowRightIcon } from "@phosphor-icons/react/ArrowRight";
|
|
|
44
44
|
import { CaretLeftIcon } from "@phosphor-icons/react/CaretLeft";
|
|
45
45
|
import { CaretRightIcon } from "@phosphor-icons/react/CaretRight";
|
|
46
46
|
import { ArrowsClockwiseIcon } from "@phosphor-icons/react/ArrowsClockwise";
|
|
47
|
-
import { Terminal, init } from "ghostty-web";
|
|
48
47
|
//#region app/components/Button.tsx
|
|
49
48
|
const buttonVariants = cva("codiff-button", {
|
|
50
49
|
defaultVariants: {
|
|
@@ -2380,9 +2379,31 @@ function MergeRequestCommentsView({ canComment, commenting, draft, editDraft, ed
|
|
|
2380
2379
|
//#endregion
|
|
2381
2380
|
//#region lib/review-comments.ts
|
|
2382
2381
|
const isInteractiveReviewEvent = (event) => event.composedPath().some((target) => target instanceof HTMLElement && (target.closest("button, textarea, input, select, a") || target.closest(".review-comment-thread")));
|
|
2383
|
-
const
|
|
2382
|
+
const rangeIntersectsTarget = (range, target) => {
|
|
2383
|
+
const targetRoot = target.getRootNode();
|
|
2384
|
+
if (range.startContainer.getRootNode() !== targetRoot || range.endContainer.getRootNode() !== targetRoot) return false;
|
|
2385
|
+
const selectionRange = (target.ownerDocument ?? document).createRange();
|
|
2386
|
+
selectionRange.setStart(range.startContainer, range.startOffset);
|
|
2387
|
+
selectionRange.setEnd(range.endContainer, range.endOffset);
|
|
2388
|
+
return selectionRange.intersectsNode(target);
|
|
2389
|
+
};
|
|
2390
|
+
const isExpandedSelection = (selection, target) => {
|
|
2391
|
+
if (selection == null || selection.rangeCount === 0) return false;
|
|
2392
|
+
const range = selection.getRangeAt(0);
|
|
2393
|
+
return (!selection.isCollapsed || selection.toString().length > 0 || !range.collapsed) && (!target || rangeIntersectsTarget(range, target));
|
|
2394
|
+
};
|
|
2395
|
+
const isExpandedRange = (range, target) => range != null && !range.collapsed && (!target || rangeIntersectsTarget(range, target));
|
|
2396
|
+
const hasActiveTextSelection = (target) => {
|
|
2384
2397
|
const selection = window.getSelection();
|
|
2385
|
-
|
|
2398
|
+
const root = target?.getRootNode();
|
|
2399
|
+
const shadowRoot = root && "host" in root ? root : null;
|
|
2400
|
+
if (shadowRoot) {
|
|
2401
|
+
const composedRange = selection?.getComposedRanges?.({ shadowRoots: [shadowRoot] })[0];
|
|
2402
|
+
if (isExpandedRange(composedRange, target)) return true;
|
|
2403
|
+
const shadowSelection = shadowRoot.getSelection?.();
|
|
2404
|
+
if (isExpandedSelection(shadowSelection, target)) return true;
|
|
2405
|
+
}
|
|
2406
|
+
return isExpandedSelection(selection, target);
|
|
2386
2407
|
};
|
|
2387
2408
|
const isFileReviewComment = (comment) => comment.anchor === "file" || comment.lineNumber == null || comment.side == null;
|
|
2388
2409
|
const isLineReviewComment = (comment) => !isFileReviewComment(comment);
|
|
@@ -2633,14 +2654,16 @@ function PullRequestReviewAction({ disabled, event, hasPendingComments = false,
|
|
|
2633
2654
|
}) : null]
|
|
2634
2655
|
});
|
|
2635
2656
|
}
|
|
2636
|
-
function PullRequestReviewButtons({ children, disabled, hasPendingComments, onClosePullRequest, onSubmitReview, reviewStatus, showCommentReview = false }) {
|
|
2657
|
+
function PullRequestReviewButtons({ children, disabled, hasPendingComments, onClosePullRequest, onMarkPullRequestReady, onSubmitReview, reviewStatus, showCommentReview = false }) {
|
|
2637
2658
|
const approveBlocked = isPullRequestReviewActionDisabled(reviewStatus, "APPROVE");
|
|
2638
2659
|
const commentBlocked = isPullRequestReviewActionDisabled(reviewStatus, "COMMENT");
|
|
2639
2660
|
const requestChangesBlocked = isPullRequestReviewActionDisabled(reviewStatus, "REQUEST_CHANGES");
|
|
2640
2661
|
const closeStatus = reviewStatus?.close;
|
|
2641
2662
|
const closeVisible = onClosePullRequest && closeStatus && closeStatus.disabled !== true;
|
|
2663
|
+
const markReadyStatus = reviewStatus?.markReady;
|
|
2664
|
+
const markReadyVisible = onMarkPullRequestReady && markReadyStatus && markReadyStatus.disabled !== true;
|
|
2642
2665
|
const commentVisible = showCommentReview && !commentBlocked;
|
|
2643
|
-
const hasReviewActions = commentVisible || !approveBlocked || !requestChangesBlocked || closeVisible;
|
|
2666
|
+
const hasReviewActions = commentVisible || !approveBlocked || !requestChangesBlocked || markReadyVisible || closeVisible;
|
|
2644
2667
|
if (!hasReviewActions && !children) return null;
|
|
2645
2668
|
return /* @__PURE__ */ jsxs("div", {
|
|
2646
2669
|
"aria-label": hasReviewActions ? "Pull request review actions" : "Pull request status",
|
|
@@ -2687,6 +2710,21 @@ function PullRequestReviewButtons({ children, disabled, hasPendingComments, onCl
|
|
|
2687
2710
|
onSubmitReview,
|
|
2688
2711
|
title: getPullRequestReviewActionTitle(reviewStatus, "REQUEST_CHANGES", "Request changes")
|
|
2689
2712
|
}) : null,
|
|
2713
|
+
markReadyVisible ? /* @__PURE__ */ jsxs(Button, {
|
|
2714
|
+
action: onMarkPullRequestReady,
|
|
2715
|
+
"aria-label": "Mark merge request as ready",
|
|
2716
|
+
className: "review-submit-button ready",
|
|
2717
|
+
disabled,
|
|
2718
|
+
pendingPlaceholder: "Marking ready…",
|
|
2719
|
+
title: markReadyStatus.reason ?? "Mark merge request as ready",
|
|
2720
|
+
type: "button",
|
|
2721
|
+
children: [/* @__PURE__ */ jsx(CheckCircleIcon, {
|
|
2722
|
+
"aria-hidden": true,
|
|
2723
|
+
className: "review-submit-icon ready",
|
|
2724
|
+
size: 15,
|
|
2725
|
+
weight: "bold"
|
|
2726
|
+
}), /* @__PURE__ */ jsx("span", { children: "Mark ready" })]
|
|
2727
|
+
}) : null,
|
|
2690
2728
|
closeVisible ? /* @__PURE__ */ jsxs(Button, {
|
|
2691
2729
|
action: onClosePullRequest,
|
|
2692
2730
|
"aria-label": "Close merge request",
|
|
@@ -5940,8 +5978,9 @@ function ReviewCommentEditor({ agentId, agentLabel, comment, displayName, focusC
|
|
|
5940
5978
|
onSaveCommentEdit
|
|
5941
5979
|
]);
|
|
5942
5980
|
const handleBlur = useCallback(() => {
|
|
5943
|
-
onCommentBlur(
|
|
5981
|
+
onCommentBlur(comment, draft, flushDraft);
|
|
5944
5982
|
}, [
|
|
5983
|
+
comment,
|
|
5945
5984
|
draft,
|
|
5946
5985
|
flushDraft,
|
|
5947
5986
|
onCommentBlur
|
|
@@ -6573,6 +6612,10 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
|
|
|
6573
6612
|
const handledScrollRequestRef = useRef(null);
|
|
6574
6613
|
const handledHunkNavRef = useRef(hunkNavigation?.request ?? null);
|
|
6575
6614
|
const emptyCommentDeleteTimersRef = useRef(/* @__PURE__ */ new Map());
|
|
6615
|
+
const activePointerIdsRef = useRef(/* @__PURE__ */ new Set());
|
|
6616
|
+
const pendingCommentBlursRef = useRef(/* @__PURE__ */ new Map());
|
|
6617
|
+
const pendingCommentBlurTimerRef = useRef(null);
|
|
6618
|
+
const focusedCommentEditorIdRef = useRef(null);
|
|
6576
6619
|
const definitionHighlightFrameRef = useRef(null);
|
|
6577
6620
|
const highlightFrameRef = useRef(null);
|
|
6578
6621
|
const ignoreNextLineSelectionEndRef = useRef(false);
|
|
@@ -6922,6 +6965,66 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
|
|
|
6922
6965
|
}
|
|
6923
6966
|
emptyCommentDeleteTimersRef.current.clear();
|
|
6924
6967
|
}, []);
|
|
6968
|
+
const flushPendingCommentBlurs = useCallback(() => {
|
|
6969
|
+
if (activePointerIdsRef.current.size > 0) return;
|
|
6970
|
+
const callbacks = [...pendingCommentBlursRef.current.values()];
|
|
6971
|
+
pendingCommentBlursRef.current.clear();
|
|
6972
|
+
for (const callback of callbacks) callback();
|
|
6973
|
+
}, []);
|
|
6974
|
+
const schedulePendingCommentBlurFlush = useCallback(() => {
|
|
6975
|
+
if (activePointerIdsRef.current.size > 0 || pendingCommentBlursRef.current.size === 0 || pendingCommentBlurTimerRef.current != null) return;
|
|
6976
|
+
const timer = window.setTimeout(() => {
|
|
6977
|
+
deferredTimersRef.current.delete(timer);
|
|
6978
|
+
pendingCommentBlurTimerRef.current = null;
|
|
6979
|
+
flushPendingCommentBlurs();
|
|
6980
|
+
}, 0);
|
|
6981
|
+
pendingCommentBlurTimerRef.current = timer;
|
|
6982
|
+
deferredTimersRef.current.add(timer);
|
|
6983
|
+
}, [flushPendingCommentBlurs]);
|
|
6984
|
+
useEffect(() => {
|
|
6985
|
+
const activePointerIds = activePointerIdsRef.current;
|
|
6986
|
+
const deferredTimers = deferredTimersRef.current;
|
|
6987
|
+
const pendingCommentBlurs = pendingCommentBlursRef.current;
|
|
6988
|
+
const handlePointerDown = (event) => {
|
|
6989
|
+
const timer = pendingCommentBlurTimerRef.current;
|
|
6990
|
+
if (timer != null) {
|
|
6991
|
+
window.clearTimeout(timer);
|
|
6992
|
+
deferredTimers.delete(timer);
|
|
6993
|
+
pendingCommentBlurTimerRef.current = null;
|
|
6994
|
+
}
|
|
6995
|
+
activePointerIds.add(event.pointerId);
|
|
6996
|
+
};
|
|
6997
|
+
const handlePointerEnd = (event) => {
|
|
6998
|
+
activePointerIds.delete(event.pointerId);
|
|
6999
|
+
schedulePendingCommentBlurFlush();
|
|
7000
|
+
};
|
|
7001
|
+
const handleWindowBlur = () => {
|
|
7002
|
+
activePointerIds.clear();
|
|
7003
|
+
schedulePendingCommentBlurFlush();
|
|
7004
|
+
};
|
|
7005
|
+
window.addEventListener("pointerdown", handlePointerDown, true);
|
|
7006
|
+
window.addEventListener("pointercancel", handlePointerEnd, true);
|
|
7007
|
+
window.addEventListener("pointerup", handlePointerEnd, true);
|
|
7008
|
+
window.addEventListener("blur", handleWindowBlur);
|
|
7009
|
+
return () => {
|
|
7010
|
+
window.removeEventListener("pointerdown", handlePointerDown, true);
|
|
7011
|
+
window.removeEventListener("pointercancel", handlePointerEnd, true);
|
|
7012
|
+
window.removeEventListener("pointerup", handlePointerEnd, true);
|
|
7013
|
+
window.removeEventListener("blur", handleWindowBlur);
|
|
7014
|
+
activePointerIds.clear();
|
|
7015
|
+
pendingCommentBlurs.clear();
|
|
7016
|
+
const timer = pendingCommentBlurTimerRef.current;
|
|
7017
|
+
if (timer != null) {
|
|
7018
|
+
window.clearTimeout(timer);
|
|
7019
|
+
deferredTimers.delete(timer);
|
|
7020
|
+
pendingCommentBlurTimerRef.current = null;
|
|
7021
|
+
}
|
|
7022
|
+
};
|
|
7023
|
+
}, [schedulePendingCommentBlurFlush]);
|
|
7024
|
+
const deferCommentBlurUntilPointerEnd = useCallback((commentId, callback) => {
|
|
7025
|
+
if (activePointerIdsRef.current.size > 0 || pendingCommentBlurTimerRef.current != null) pendingCommentBlursRef.current.set(commentId, callback);
|
|
7026
|
+
else callback();
|
|
7027
|
+
}, []);
|
|
6925
7028
|
const scrollFileItemToTop = useCallback((itemId) => {
|
|
6926
7029
|
const handle = codeViewRef.current;
|
|
6927
7030
|
const viewer = handle?.getInstance();
|
|
@@ -7017,10 +7120,10 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
|
|
|
7017
7120
|
createCommentForRange(range, context);
|
|
7018
7121
|
},
|
|
7019
7122
|
onLineClick: (line, context) => {
|
|
7123
|
+
const lineElement = "lineElement" in line ? line.lineElement : null;
|
|
7020
7124
|
if (isPrimaryModifier(line.event) && onFindDefinitions) {
|
|
7021
7125
|
line.event.preventDefault();
|
|
7022
7126
|
line.event.stopPropagation();
|
|
7023
|
-
const lineElement = "lineElement" in line ? line.lineElement : null;
|
|
7024
7127
|
const identifier = lineElement ? getIdentifierFromPointerEvent(line.event, lineElement) : null;
|
|
7025
7128
|
const meta = itemMetadata.get(context.item.id);
|
|
7026
7129
|
const side = "annotationSide" in line ? line.annotationSide : null;
|
|
@@ -7069,7 +7172,7 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
|
|
|
7069
7172
|
onLoadSection(meta.file, meta.section);
|
|
7070
7173
|
return;
|
|
7071
7174
|
}
|
|
7072
|
-
if (hasActiveTextSelection()) return;
|
|
7175
|
+
if (hasActiveTextSelection(lineElement)) return;
|
|
7073
7176
|
const side = "annotationSide" in line ? line.annotationSide : null;
|
|
7074
7177
|
if (!side) return;
|
|
7075
7178
|
cancelPendingEmptyCommentDeletes();
|
|
@@ -7130,6 +7233,8 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
|
|
|
7130
7233
|
wordWrap
|
|
7131
7234
|
]);
|
|
7132
7235
|
const focusComment = useCallback((comment) => {
|
|
7236
|
+
focusedCommentEditorIdRef.current = comment.id;
|
|
7237
|
+
pendingCommentBlursRef.current.delete(comment.id);
|
|
7133
7238
|
onCommentDraftChange?.({
|
|
7134
7239
|
body: comment.body,
|
|
7135
7240
|
id: comment.id
|
|
@@ -7140,25 +7245,32 @@ function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedTog
|
|
|
7140
7245
|
deferredTimersRef.current.delete(timer);
|
|
7141
7246
|
emptyCommentDeleteTimersRef.current.delete(comment.id);
|
|
7142
7247
|
}, [onCommentDraftChange]);
|
|
7143
|
-
const blurComment = useCallback((comment, body) => {
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
if (existingTimer != null) {
|
|
7149
|
-
window.clearTimeout(existingTimer);
|
|
7150
|
-
deferredTimersRef.current.delete(existingTimer);
|
|
7248
|
+
const blurComment = useCallback((comment, body, flushDraft) => {
|
|
7249
|
+
deferCommentBlurUntilPointerEnd(comment.id, () => {
|
|
7250
|
+
if (focusedCommentEditorIdRef.current === comment.id) {
|
|
7251
|
+
focusedCommentEditorIdRef.current = null;
|
|
7252
|
+
onCommentDraftChange?.(null);
|
|
7151
7253
|
}
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7254
|
+
flushDraft();
|
|
7255
|
+
clearCommentLineHighlight();
|
|
7256
|
+
if (!comment.isReadOnly && body.trim().length === 0) {
|
|
7257
|
+
const existingTimer = emptyCommentDeleteTimersRef.current.get(comment.id);
|
|
7258
|
+
if (existingTimer != null) {
|
|
7259
|
+
window.clearTimeout(existingTimer);
|
|
7260
|
+
deferredTimersRef.current.delete(existingTimer);
|
|
7261
|
+
}
|
|
7262
|
+
const timer = window.setTimeout(() => {
|
|
7263
|
+
deferredTimersRef.current.delete(timer);
|
|
7264
|
+
emptyCommentDeleteTimersRef.current.delete(comment.id);
|
|
7265
|
+
onDeleteComment(comment.id);
|
|
7266
|
+
}, 120);
|
|
7267
|
+
deferredTimersRef.current.add(timer);
|
|
7268
|
+
emptyCommentDeleteTimersRef.current.set(comment.id, timer);
|
|
7269
|
+
}
|
|
7270
|
+
});
|
|
7160
7271
|
}, [
|
|
7161
7272
|
clearCommentLineHighlight,
|
|
7273
|
+
deferCommentBlurUntilPointerEnd,
|
|
7162
7274
|
onCommentDraftChange,
|
|
7163
7275
|
onDeleteComment
|
|
7164
7276
|
]);
|
|
@@ -7866,6 +7978,12 @@ function resolveBackdrop(element) {
|
|
|
7866
7978
|
}
|
|
7867
7979
|
return "#00000000";
|
|
7868
7980
|
}
|
|
7981
|
+
let ghosttyModule = null;
|
|
7982
|
+
const loadGhostty = async () => {
|
|
7983
|
+
const ghostty = await (ghosttyModule ??= import("ghostty-web"));
|
|
7984
|
+
await ghostty.init();
|
|
7985
|
+
return ghostty;
|
|
7986
|
+
};
|
|
7869
7987
|
/**
|
|
7870
7988
|
* Read-only ghostty-web terminal that replays the streamed commit output, so
|
|
7871
7989
|
* ANSI colors and cursor movement from pre-commit hooks render as they would
|
|
@@ -7880,7 +7998,7 @@ function CommitLogTerminal({ output }) {
|
|
|
7880
7998
|
if (!container) return;
|
|
7881
7999
|
let disposed = false;
|
|
7882
8000
|
let instance = null;
|
|
7883
|
-
|
|
8001
|
+
loadGhostty().then(({ Terminal }) => {
|
|
7884
8002
|
if (disposed) return;
|
|
7885
8003
|
const style = getComputedStyle(container);
|
|
7886
8004
|
instance = new Terminal({
|
|
@@ -9654,6 +9772,7 @@ function ReviewSurface({ commenting, externalUrl, gitIdentity = null, initialMod
|
|
|
9654
9772
|
const [generalCommentSubmitting, setGeneralCommentSubmitting] = useState(false);
|
|
9655
9773
|
const [pullRequestReviewSubmitting, setPullRequestReviewSubmitting] = useState(null);
|
|
9656
9774
|
const [pullRequestCloseSubmitting, setPullRequestCloseSubmitting] = useState(false);
|
|
9775
|
+
const [pullRequestReadySubmitting, setPullRequestReadySubmitting] = useState(false);
|
|
9657
9776
|
const [pullRequestMergeSubmitting, setPullRequestMergeSubmitting] = useState(false);
|
|
9658
9777
|
const [walkthroughRequestPending, setWalkthroughRequestPending] = useState(false);
|
|
9659
9778
|
const walkthroughRequestPendingRef = useRef(false);
|
|
@@ -9797,6 +9916,18 @@ function ReviewSurface({ commenting, externalUrl, gitIdentity = null, initialMod
|
|
|
9797
9916
|
pullRequestCloseSubmitting,
|
|
9798
9917
|
snapshot.repository.source
|
|
9799
9918
|
]);
|
|
9919
|
+
const markPullRequestReady = useCallback(() => {
|
|
9920
|
+
const source = snapshot.repository.source;
|
|
9921
|
+
if (!interactive?.onMarkPullRequestReady || pullRequestReadySubmitting || source.type !== "pull-request" || source.reviewStatus?.markReady?.disabled === true || !source.reviewStatus?.markReady) return;
|
|
9922
|
+
setPullRequestReadySubmitting(true);
|
|
9923
|
+
return Promise.resolve(interactive.onMarkPullRequestReady()).catch((error) => {
|
|
9924
|
+
window.alert(error instanceof Error ? error.message : String(error));
|
|
9925
|
+
}).finally(() => setPullRequestReadySubmitting(false));
|
|
9926
|
+
}, [
|
|
9927
|
+
interactive,
|
|
9928
|
+
pullRequestReadySubmitting,
|
|
9929
|
+
snapshot.repository.source
|
|
9930
|
+
]);
|
|
9800
9931
|
const mergePullRequest = useCallback((options) => {
|
|
9801
9932
|
if (!interactive?.onMergePullRequest || pullRequestMergeSubmitting) return;
|
|
9802
9933
|
setPullRequestMergeSubmitting(true);
|
|
@@ -10013,9 +10144,10 @@ function ReviewSurface({ commenting, externalUrl, gitIdentity = null, initialMod
|
|
|
10013
10144
|
const isTerminalMergeState = sourceMergeState ? isTerminalPullRequestMergeState(sourceMergeState) : false;
|
|
10014
10145
|
const sourceMergeStatusBadge = sourceMergeState && isTerminalMergeState ? /* @__PURE__ */ jsx(PullRequestMergeStatusBadge, { mergeState: sourceMergeState }) : null;
|
|
10015
10146
|
const sourceDescriptionActions = interactive && source.type === "pull-request" ? /* @__PURE__ */ jsx(PullRequestReviewButtons, {
|
|
10016
|
-
disabled: pullRequestReviewSubmitting != null || pullRequestCloseSubmitting,
|
|
10147
|
+
disabled: pullRequestReviewSubmitting != null || pullRequestCloseSubmitting || pullRequestReadySubmitting,
|
|
10017
10148
|
hasPendingComments: getPendingPullRequestReviewComments(localReviewComments, activeReviewCommentDraftState).length > 0,
|
|
10018
10149
|
onClosePullRequest: closePullRequest,
|
|
10150
|
+
onMarkPullRequestReady: markPullRequestReady,
|
|
10019
10151
|
onSubmitReview: submitReview,
|
|
10020
10152
|
reviewStatus: source.reviewStatus,
|
|
10021
10153
|
showCommentReview: source.provider === "github" || source.host === "github.com",
|
package/dist/style.css
CHANGED
|
@@ -5453,7 +5453,6 @@ a.review-top-bar-repository:focus-visible, a.review-top-bar-source:focus-visible
|
|
|
5453
5453
|
.review-mode-control button[aria-selected="true"] {
|
|
5454
5454
|
background: var(--hover-wash);
|
|
5455
5455
|
color: var(--sidebar-text);
|
|
5456
|
-
box-shadow: 0 1px 2px #00000014;
|
|
5457
5456
|
}
|
|
5458
5457
|
|
|
5459
5458
|
.review-mode-label {
|
|
@@ -8194,7 +8193,7 @@ diffs-container .review-comment-thread {
|
|
|
8194
8193
|
position: relative;
|
|
8195
8194
|
}
|
|
8196
8195
|
|
|
8197
|
-
.review-submit-button:
|
|
8196
|
+
.review-submit-button:is(.approve, .comment, .request-changes) {
|
|
8198
8197
|
cursor: default;
|
|
8199
8198
|
gap: 0;
|
|
8200
8199
|
padding: 0;
|
package/dist/types.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export type PullRequestReviewStatus = {
|
|
|
52
52
|
approve?: PullRequestReviewActionStatus;
|
|
53
53
|
close?: PullRequestReviewActionStatus;
|
|
54
54
|
comment?: PullRequestReviewActionStatus;
|
|
55
|
+
markReady?: PullRequestReviewActionStatus;
|
|
55
56
|
requestChanges?: PullRequestReviewActionStatus;
|
|
56
57
|
};
|
|
57
58
|
export type PullRequestMergeCheckStatus = 'failed' | 'neutral' | 'pending' | 'success';
|
|
@@ -133,6 +134,7 @@ export type ReviewSource = {
|
|
|
133
134
|
canEditReviewers?: boolean;
|
|
134
135
|
canEditTitle?: boolean;
|
|
135
136
|
description?: string;
|
|
137
|
+
draft?: boolean;
|
|
136
138
|
headSha?: string;
|
|
137
139
|
host?: string;
|
|
138
140
|
mergeState?: PullRequestMergeState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkzw/codiff-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "A fast diff viewer.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@nkzw/mdx-editor": "^0.
|
|
54
|
+
"@nkzw/mdx-editor": "^1.0.1",
|
|
55
55
|
"@nkzw/use-relative-time": "^1.2.3",
|
|
56
56
|
"@phosphor-icons/react": "^2.1.10",
|
|
57
57
|
"@pierre/diffs": "1.3.6",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@radix-ui/react-slot": "^1.3.3",
|
|
60
60
|
"class-variance-authority": "^0.7.1",
|
|
61
61
|
"ghostty-web": "^0.4.0",
|
|
62
|
-
"lucide-react": "^1.
|
|
62
|
+
"lucide-react": "^1.39.0",
|
|
63
63
|
"valibot": "^1.4.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|