@p4code/cli 0.1.46 → 0.1.47
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/bin.mjs +22 -8
- package/dist/client/assets/DiffPanel-CZ1s-Iug.js +98 -0
- package/dist/client/assets/{FilePreviewPanel-DFsoFXYz.js → FilePreviewPanel-3mponsnf.js} +4 -4
- package/dist/client/assets/PreviewPanel-CWZwRMlA.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-C7nXySfj.js +251 -0
- package/dist/client/assets/arrow-right-ErO11CiL.js +2 -0
- package/dist/client/assets/{fileCommentAnnotations-Dy17abwC.js → fileCommentAnnotations-D1IJuyQs.js} +2 -2
- package/dist/client/assets/index-CEYXdFfh.js +1058 -0
- package/dist/client/assets/index-DY3A41T_.css +1 -0
- package/dist/client/assets/{renderFileChildren-uPwkTxXP.js → renderFileChildren-BgE2D-9e.js} +2 -2
- package/dist/client/assets/terminal-links-DFgxYsvC.js +46 -0
- package/dist/client/assets/{toggle-group-DSjkAIxH.js → toggle-group-D0YAb1xh.js} +2 -2
- package/dist/client/index.html +3 -3
- package/package.json +1 -1
- package/dist/client/assets/DiffPanel-CPaFbotP.js +0 -98
- package/dist/client/assets/PreviewPanel-DeS97XYl.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-CgTgedYJ.js +0 -251
- package/dist/client/assets/arrow-right-04_CsPkt.js +0 -2
- package/dist/client/assets/index-C4Mhhj24.js +0 -1053
- package/dist/client/assets/index-Fl1HKL6P.css +0 -1
- package/dist/client/assets/terminal-links-FRGOm6CP.js +0 -46
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{As as i,Js as a,Ms as o,Ns as s,Os as c,S as l,Xr as u,ai as d,b as f,c as p,ei as m,fc as h,ii as g,j as _,js as ee,mi as v,on as y,pi as b,u as x,w as S,y as C,yn as w}from"./terminal-links-DFgxYsvC.js";import{a as T,n as E,o as D,r as O,s as k,t as A}from"./toggle-group-D0YAb1xh.js";import{Ar as j,B as M,Br as te,G as ne,H as re,Hr as ie,Jn as ae,K as oe,U as se,Ur as ce,V as N,Vr as le,W as ue,Xr as de,Y as P,Yn as fe,_ as pe,at as me,ct as he,di as ge,dt as F,ei as _e,fi as ve,fr as ye,ft as be,ii as xe,it as Se,lt as Ce,ot as we,pi as Te,q as Ee,qn as De,ti as Oe,ui as ke,ut as Ae,z as I,zr as je}from"./index-CEYXdFfh.js";var Me=s(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ne=s(`message-square-off`,[[`path`,{d:`M19 19H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.7.7 0 0 1 2 21.286V5a2 2 0 0 1 1.184-1.826`,key:`1wyg69`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v11.344`,key:`mhl4k6`}]]),L=e(n(),1),Pe=new Set([`pnpm-lock.yaml`,`yarn.lock`,`package-lock.json`,`bun.lockb`,`Cargo.lock`,`go.sum`,`composer.lock`,`Gemfile.lock`]),R=new Set([`__snapshots__`,`__generated__`,`dist`,`build`,`vendor`]),z=new Set([`__tests__`,`tests`,`test`]),B=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`];function Fe(e){let t=e.split(`/`),n=t.at(-1)??``;return Pe.has(n)||n.endsWith(`.snap`)||n.endsWith(`.min.js`)||n.endsWith(`.min.css`)||/\.generated\./.test(n)||t.slice(0,-1).some(e=>R.has(e))?`generated`:/\.(?:test|spec)\./.test(n)||t.slice(0,-1).some(e=>z.has(e))?`test`:`source`}function Ie(e){let t=e.lastIndexOf(`.`);return t>e.lastIndexOf(`/`)?e.slice(0,t):e}function Le(e){return Ie(e.split(`/`).at(-1)??``)}function Re(e,t){let n=e.split(`/`).slice(0,-1);for(let e of t.split(`/`))e===`.`||e===``||(e===`..`?n.pop():n.push(e));return n.join(`/`)}var ze=/(?:\bfrom|\bimport|\brequire\s*\()\s*\(?\s*["']([^"']+)["']/g;function Be(e,t,n,r){let i=new Set;for(let a of t){ze.lastIndex=0;let t=ze.exec(a);for(;t!==null;){let o=t[1]??``,s=o.startsWith(`.`)?Re(e,o):o,c=B.find(e=>s.endsWith(e)),l=c===void 0?s:s.slice(0,-c.length),u=n.get(l)??n.get(`${l}/index`)??r.get(Le(l));u!==void 0&&u!==e&&i.add(u),t=ze.exec(a)}}return i}function Ve(e,t){let n=new Set(e),r=[],i=[...e].sort((e,t)=>e.localeCompare(t));for(;n.size>0;){let e=i.filter(e=>n.has(e)),a=e.find(e=>[...t.get(e)??[]].every(e=>!n.has(e)))??e[0];n.delete(a),r.push(a)}return r}function V(e){return(e.split(`/`).at(-1)??``).replace(/\.(?:test|spec)\..*$/,``).replace(/\.[^.]+$/,``)}function He(e){let t=new Map;for(let n of e)t.set(F(n),n);let n=new Map;for(let e of t.keys())n.set(e,Fe(e));let r=[...t.keys()].filter(e=>n.get(e)===`source`),i=new Map,a=new Set,o=new Map;for(let e of r){i.set(Ie(e),e);let t=Le(e);o.has(t)&&a.add(t),o.set(t,e)}for(let e of a)o.delete(e);let s=new Map;for(let e of r){let n=t.get(e);s.set(e,Be(e,[...n.additionLines,...n.deletionLines],i,o))}let c=Ve(r,s),l=new Map;c.forEach((e,t)=>{let n=Le(e);l.has(n)||l.set(n,t)});let u=[...t.keys()].filter(e=>n.get(e)===`test`).sort((e,t)=>(l.get(V(e))??2**53-1)-(l.get(V(t))??2**53-1)||e.localeCompare(t)),d=[...t.keys()].filter(e=>n.get(e)===`generated`).sort((e,t)=>e.localeCompare(t));return[...c,...u,...d].map(e=>t.get(e))}function Ue(e,t){return async n=>{let r=F(n),i=n.prevName?F({...n,name:n.prevName}):r,a=await e({changeType:n.type,oldPath:i,newPath:r}),o={name:r,contents:a.newContents,cacheKey:`${t}:new:${r}`};return n.type===`rename-pure`?{oldFile:null,newFile:o}:{oldFile:{name:i,contents:a.oldContents,cacheKey:`${t}:old:${i}`},newFile:o}}}function We(e,t){return Ue(async({changeType:n,oldPath:r,newPath:i})=>{let a=await e({environmentId:t.environmentId,input:{...t.reference,...t.commit===null?{}:{commit:t.commit},changeType:n,oldPath:r,newPath:i}});if(a._tag!==`Success`)throw h(a);return a.value},t.cacheKey)}var H=r();function U(e,t,n){return!n&&(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&t.trim().length>0}var W=t();function Ge(e){let t=(0,H.c)(43),{kind:n,rangeLabel:r,text:i,onTextChange:a,onCancel:o,onComment:s,onDelete:c,placeholder:l,submitLabel:d,pending:f,secondaryAction:m}=e,h=l===void 0?`Add a comment…`:l,g=d===void 0?`Comment`:d,_=f===void 0?!1:f,[ee,v]=(0,L.useState)(``),y=n===`draft`&&!a?ee:i,b;t[0]===y?b=t[1]:(b=y.trim(),t[0]=y,t[1]=b);let x=b;if(n===`comment`){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(Oe,{className:`mt-0.5 size-3.5 shrink-0 text-primary/70`,"aria-hidden":`true`}),t[2]=e):e=t[2];let n;t[3]===y?n=t[4]:(n=(0,W.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-[13px] leading-5`,children:y}),t[3]=y,t[4]=n);let r;t[5]===c?r=t[6]:(r=c?(0,W.jsx)(u,{className:`-my-1 -mr-1 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/comment:opacity-100 focus-visible:opacity-100 max-sm:opacity-100`,variant:`ghost`,size:`icon-xs`,"aria-label":`Delete comment`,onClick:c,children:(0,W.jsx)(le,{className:`size-3`})}):null,t[5]=c,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,W.jsxs)(`div`,{"data-diff-comment-annotation":!0,className:`group/comment flex min-w-0 items-start gap-2.5 border-s-2 border-primary/55 bg-primary/[0.045] px-3 py-2.5 font-sans text-foreground`,contentEditable:!1,onPointerDown:q,children:[e,n,r]}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}let S=`Comment on lines ${r}`,C;t[10]===a?C=t[11]:(C=e=>(a??v)(e.target.value),t[10]=a,t[11]=C);let w;t[12]!==o||t[13]!==s||t[14]!==_||t[15]!==x?(w=e=>{e.key===`Escape`&&(e.preventDefault(),o()),U(e,x,_)&&(e.preventDefault(),s(x))},t[12]=o,t[13]=s,t[14]=_,t[15]=x,t[16]=w):w=t[16];let T;t[17]!==y||t[18]!==h||t[19]!==S||t[20]!==C||t[21]!==w?(T=(0,W.jsx)(p,{autoFocus:!0,unstyled:!0,className:`relative inline-flex w-full rounded-md border border-border/50 bg-background/20 font-sans text-foreground transition-colors focus-within:border-border/70 [&_[data-slot=textarea]]:min-h-12 [&_[data-slot=textarea]]:cursor-text [&_[data-slot=textarea]]:px-2.5 [&_[data-slot=textarea]]:py-1.5 [&_[data-slot=textarea]]:font-sans [&_[data-slot=textarea]]:text-xs [&_[data-slot=textarea]]:leading-5 max-sm:[&_[data-slot=textarea]]:min-h-12`,size:`sm`,value:y,placeholder:h,"aria-label":S,onChange:C,onFocus:G,onKeyDown:w}),t[17]=y,t[18]=h,t[19]=S,t[20]=C,t[21]=w,t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,W.jsx)(`span`,{className:`mr-auto text-[10px] text-muted-foreground/70`,children:`⌘/Ctrl Enter to send`}),t[23]=E):E=t[23];let D;t[24]===o?D=t[25]:(D=(0,W.jsx)(u,{className:`text-muted-foreground hover:text-foreground`,variant:`ghost`,size:`xs`,onClick:o,children:`Cancel`}),t[24]=o,t[25]=D);let O;t[26]!==m||t[27]!==x?(O=m?(0,W.jsxs)(u,{size:`xs`,variant:`outline`,disabled:!m.allowEmpty&&!x,onClick:()=>m.onAction(x),children:[m.icon,m.label]}):null,t[26]=m,t[27]=x,t[28]=O):O=t[28];let k=_||!x,A;t[29]!==s||t[30]!==x?(A=()=>s(x),t[29]=s,t[30]=x,t[31]=A):A=t[31];let j;t[32]!==g||t[33]!==k||t[34]!==A?(j=(0,W.jsx)(u,{size:`xs`,disabled:k,onClick:A,children:g}),t[32]=g,t[33]=k,t[34]=A,t[35]=j):j=t[35];let M;t[36]!==D||t[37]!==O||t[38]!==j?(M=(0,W.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1`,children:[E,D,O,j]}),t[36]=D,t[37]=O,t[38]=j,t[39]=M):M=t[39];let te;return t[40]!==M||t[41]!==T?(te=(0,W.jsxs)(`div`,{"data-diff-comment-annotation":!0,className:`px-3 py-2 font-sans text-foreground`,contentEditable:!1,onPointerDown:K,children:[T,M]}),t[40]=M,t[41]=T,t[42]=te):te=t[42],te}function G(e){let t=e.currentTarget.value.length;e.currentTarget.setSelectionRange(t,t)}function K(e){return e.stopPropagation()}function q(e){return e.stopPropagation()}var J=`${Se}
|
|
2
|
+
:is(
|
|
3
|
+
[data-line],
|
|
4
|
+
[data-line-annotation],
|
|
5
|
+
[data-merge-conflict],
|
|
6
|
+
[data-merge-conflict-actions],
|
|
7
|
+
[data-no-newline]
|
|
8
|
+
)[data-selected-line] {
|
|
9
|
+
--diffs-line-bg: light-dark(
|
|
10
|
+
color-mix(
|
|
11
|
+
in lab,
|
|
12
|
+
var(--code-background) 88%,
|
|
13
|
+
color-mix(in srgb, var(--code-background) 50%, var(--diffs-modified-base))
|
|
14
|
+
),
|
|
15
|
+
color-mix(
|
|
16
|
+
in lab,
|
|
17
|
+
var(--code-background) 80%,
|
|
18
|
+
color-mix(in srgb, var(--code-background) 70%, var(--diffs-modified-base))
|
|
19
|
+
)
|
|
20
|
+
) !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:is([data-gutter-buffer], [data-column-number])[data-selected-line] {
|
|
24
|
+
--diffs-line-bg: light-dark(
|
|
25
|
+
color-mix(
|
|
26
|
+
in lab,
|
|
27
|
+
var(--code-background) 91%,
|
|
28
|
+
color-mix(in srgb, var(--code-background) 35%, var(--diffs-modified-base))
|
|
29
|
+
),
|
|
30
|
+
color-mix(
|
|
31
|
+
in lab,
|
|
32
|
+
var(--code-background) 85%,
|
|
33
|
+
color-mix(in srgb, var(--code-background) 60%, var(--diffs-modified-base))
|
|
34
|
+
)
|
|
35
|
+
) !important;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[data-indicators="bars"]
|
|
39
|
+
:is([data-column-number], [data-gutter-buffer="annotation"])[data-selected-line] {
|
|
40
|
+
position: relative;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-indicators="bars"]
|
|
44
|
+
:is([data-column-number], [data-gutter-buffer="annotation"])[data-selected-line]::before {
|
|
45
|
+
position: absolute !important;
|
|
46
|
+
inset-block: 0 !important;
|
|
47
|
+
inset-inline-start: 0 !important;
|
|
48
|
+
display: block !important;
|
|
49
|
+
width: 4px !important;
|
|
50
|
+
min-width: 4px !important;
|
|
51
|
+
max-width: 4px !important;
|
|
52
|
+
height: auto !important;
|
|
53
|
+
padding: 0 !important;
|
|
54
|
+
content: "" !important;
|
|
55
|
+
background-color: var(--diffs-modified-base) !important;
|
|
56
|
+
background-image: none !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[data-file-info] {
|
|
60
|
+
background-color: var(--code-background) !important;
|
|
61
|
+
border-block-color: transparent !important;
|
|
62
|
+
color: var(--code-foreground) !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-diffs-header] {
|
|
66
|
+
position: sticky !important;
|
|
67
|
+
top: 0;
|
|
68
|
+
z-index: 4;
|
|
69
|
+
background-color: var(--code-background) !important;
|
|
70
|
+
border-bottom-color: transparent !important;
|
|
71
|
+
align-items: center !important;
|
|
72
|
+
font-family: var(--font-sans) !important;
|
|
73
|
+
font-size: 12px !important;
|
|
74
|
+
line-height: 1 !important;
|
|
75
|
+
min-height: 32px !important;
|
|
76
|
+
padding-block: 6px !important;
|
|
77
|
+
padding-inline: 8px 12px !important;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[data-diffs-header]:hover {
|
|
81
|
+
/* A native scrollbar gutter cannot be painted by descendants. Use an inset edge cue instead
|
|
82
|
+
of a full-width band that would look accidentally clipped at the gutter. */
|
|
83
|
+
background-color: var(--code-background) !important;
|
|
84
|
+
box-shadow: inset 3px 0 color-mix(in srgb, var(--code-foreground) 24%, transparent);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"]) {
|
|
88
|
+
height: 24px !important;
|
|
89
|
+
margin-block: 0 !important;
|
|
90
|
+
background-color: var(--code-background) !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
94
|
+
[data-separator-wrapper] {
|
|
95
|
+
padding-inline: 8px 12px !important;
|
|
96
|
+
background-color: transparent !important;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
100
|
+
[data-separator-content] {
|
|
101
|
+
gap: 8px;
|
|
102
|
+
padding-inline: 0 !important;
|
|
103
|
+
background-color: transparent !important;
|
|
104
|
+
color: color-mix(in srgb, var(--code-foreground) 52%, var(--code-background)) !important;
|
|
105
|
+
font-family: var(--font-sans) !important;
|
|
106
|
+
font-size: 11px !important;
|
|
107
|
+
text-decoration: none !important;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
111
|
+
[data-unmodified-lines] {
|
|
112
|
+
display: flex !important;
|
|
113
|
+
min-width: 0;
|
|
114
|
+
flex: 1 1 auto;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: 8px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
|
|
120
|
+
[data-unmodified-lines] {
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
125
|
+
[data-unmodified-lines]::before,
|
|
126
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
127
|
+
[data-unmodified-lines]::after {
|
|
128
|
+
width: auto;
|
|
129
|
+
height: 1px;
|
|
130
|
+
flex: 1 1 auto;
|
|
131
|
+
content: "";
|
|
132
|
+
background-color: color-mix(in srgb, var(--code-background) 92%, var(--code-foreground));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
|
|
136
|
+
[data-separator-wrapper] {
|
|
137
|
+
grid-template-columns: 0 minmax(0, 1fr) !important;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
|
|
141
|
+
[data-separator-content] {
|
|
142
|
+
grid-column: 2 !important;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Visually hidden rather than display: none so the expand action stays keyboard-reachable. */
|
|
146
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
147
|
+
[data-expand-button] {
|
|
148
|
+
position: absolute !important;
|
|
149
|
+
width: 1px !important;
|
|
150
|
+
height: 1px !important;
|
|
151
|
+
margin: -1px !important;
|
|
152
|
+
padding: 0 !important;
|
|
153
|
+
overflow: hidden !important;
|
|
154
|
+
clip-path: inset(50%) !important;
|
|
155
|
+
border: 0 !important;
|
|
156
|
+
white-space: nowrap !important;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
|
|
160
|
+
[data-expand-button]
|
|
161
|
+
)
|
|
162
|
+
[data-separator-content] {
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
|
|
167
|
+
[data-expand-button]
|
|
168
|
+
):is(:hover, :focus-within)
|
|
169
|
+
[data-separator-content] {
|
|
170
|
+
color: color-mix(in srgb, var(--code-foreground) 76%, var(--code-background)) !important;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
|
|
174
|
+
[data-expand-button]
|
|
175
|
+
):is(:hover, :focus-within)
|
|
176
|
+
[data-unmodified-lines]::before,
|
|
177
|
+
:is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
|
|
178
|
+
[data-expand-button]
|
|
179
|
+
):is(:hover, :focus-within)
|
|
180
|
+
[data-unmodified-lines]::after {
|
|
181
|
+
background-color: color-mix(in srgb, var(--code-background) 84%, var(--code-foreground));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
[data-diffs-header] [data-header-content] {
|
|
185
|
+
align-items: center !important;
|
|
186
|
+
line-height: 1 !important;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
[data-diffs-header] [data-metadata] {
|
|
190
|
+
align-items: center !important;
|
|
191
|
+
line-height: 1 !important;
|
|
192
|
+
font-variant-numeric: tabular-nums;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
[data-diffs-header] [data-additions-count],
|
|
196
|
+
[data-diffs-header] [data-deletions-count] {
|
|
197
|
+
font-family: var(--font-mono) !important;
|
|
198
|
+
font-size: 11px !important;
|
|
199
|
+
font-variant-numeric: tabular-nums;
|
|
200
|
+
line-height: 1 !important;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
[data-diffs-header] [data-change-icon],
|
|
204
|
+
[data-diffs-header] [data-rename-icon] {
|
|
205
|
+
display: block;
|
|
206
|
+
flex-shrink: 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
[data-title] {
|
|
210
|
+
cursor: pointer;
|
|
211
|
+
transition:
|
|
212
|
+
color 120ms ease,
|
|
213
|
+
text-decoration-color 120ms ease;
|
|
214
|
+
text-decoration: underline;
|
|
215
|
+
text-decoration-color: transparent;
|
|
216
|
+
text-underline-offset: 2px;
|
|
217
|
+
font-family: var(--font-sans) !important;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
[data-title]:hover {
|
|
221
|
+
color: color-mix(in srgb, var(--code-foreground) 84%, var(--primary)) !important;
|
|
222
|
+
text-decoration-color: currentColor;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* Expanding a file mounts its body all at once; easing it in matches the 200ms the app's
|
|
226
|
+
collapsibles take. Appearance only — the viewer owns geometry, so height cannot animate.
|
|
227
|
+
Departing content cuts, the same one-way rule the pull request chrome fold follows. */
|
|
228
|
+
[data-diff],
|
|
229
|
+
[data-file] {
|
|
230
|
+
transition: opacity 200ms ease-out;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@starting-style {
|
|
234
|
+
[data-diff],
|
|
235
|
+
[data-file] {
|
|
236
|
+
opacity: 0;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
@media (prefers-reduced-motion: reduce) {
|
|
241
|
+
[data-diff],
|
|
242
|
+
[data-file] {
|
|
243
|
+
transition: none;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
`;function Ke(e){let t=(0,H.c)(18),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({options:r,viewerRef:o,className:n,unsafeCSSExtra:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=o?{ref:o}:{},t[6]=o,t[7]=s);let c=n?`diff-render-surface outline-none ${n}`:`diff-render-surface outline-none`,l=a?`${J}\n${a}`:J,u,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u={diffHeaderHeight:32,hunkSeparatorHeight:24,spacing:0,paddingTop:0,paddingBottom:0},d={paddingTop:0,paddingBottom:0,gap:0},t[8]=u,t[9]=d):(u=t[8],d=t[9]);let f;t[10]!==r||t[11]!==l?(f={...r,unsafeCSS:l,itemMetrics:u,layout:d},t[10]=r,t[11]=l,t[12]=f):f=t[12];let p;return t[13]!==i||t[14]!==s||t[15]!==c||t[16]!==f?(p=(0,W.jsx)(T,{...i,...s,className:c,options:f}),t[13]=i,t[14]=s,t[15]=c,t[16]=f,t[17]=p):p=t[17],p}var qe=`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm`;function Je(e){return t=>{t.key===`Escape`&&e.onCancel&&(t.preventDefault(),e.onCancel()),U(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function Ye(e){let t=(0,H.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=v(qe,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsx)(_e,{className:`size-3.5`}),o=(0,W.jsx)(`span`,{children:`Pending — sent when you submit the review`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(le,{className:`size-3.5`}),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a,o,(0,W.jsx)(u,{size:`icon-xs`,variant:`ghost`,className:`ml-auto`,"aria-label":`Discard this comment`,onClick:r,children:s})]}),t[4]=r,t[5]=c);let l;t[6]===n.body?l=t[7]:(l=(0,W.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap leading-relaxed`,children:n.body}),t[6]=n.body,t[7]=l);let d;return t[8]!==c||t[9]!==l?(d=(0,W.jsxs)(`div`,{className:i,contentEditable:!1,onPointerDown:Xe,children:[c,l]}),t[8]=c,t[9]=l,t[10]=d):d=t[10],d}function Xe(e){return e.stopPropagation()}function Ze({thread:e,workspaceRoot:t,canReply:n,canResolve:r,canReact:i,environmentId:a,reference:o,pending:s,fixPending:c,fixLabel:l=`Fix in a thread`,onFix:d,onReply:f,canEditComment:m,onEditComment:h,onToggleResolved:g,onReacted:_}){let[ee,v]=(0,L.useState)(!e.isResolved),[y,b]=(0,L.useState)(!1),[x,S]=(0,L.useState)(``),[C,w]=(0,L.useState)(null),[T,E]=(0,L.useState)(!1),D=(0,L.useRef)(!1),O=async(e,t)=>{if(T)return;E(!0);let n=await h(e,t);E(!1),n&&w(null)},k=async()=>{let e=x.trim();if(!(e.length===0||s||D.current)){D.current=!0;try{await f(e)&&(S(``),b(!1))}finally{D.current=!1}}};return(0,W.jsxs)(`div`,{className:qe,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.isResolved?(0,W.jsx)(ge,{className:`size-3.5 text-emerald-600 dark:text-emerald-500`}):(0,W.jsx)(Me,{className:`size-3.5`}),(0,W.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":ee,onClick:()=>v(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,e.comments.length,` `,e.comments.length===1?`comment`:`comments`]}),e.isOutdated?(0,W.jsx)(`span`,{children:`outdated`}):null,d?(0,W.jsxs)(u,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:s||c,onClick:d,children:[(0,W.jsx)(xe,{className:`size-3`}),c?`Preparing...`:l]}):null,r?(0,W.jsx)(u,{size:`xs`,variant:`ghost`,className:d?void 0:`ml-auto`,disabled:s,onClick:g,children:e.isResolved?`Unresolve`:`Resolve`}):null]}),ee?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`mt-2 space-y-3`,children:e.comments.map(e=>(0,W.jsxs)(`article`,{className:`group min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,W.jsx)(ue,{actor:e.author,className:`text-foreground`}),(0,W.jsx)(`span`,{children:ye(e.createdAt)})]}),C===e.id?(0,W.jsx)(M,{className:`mt-1`,value:e.body,cwd:t,label:`Edit comment`,saving:T,onSave:t=>void O(e.id,t),onCancel:()=>w(null)}):(0,W.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,W.jsx)(N,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t}),m(e)?(0,W.jsx)(u,{size:`icon-xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100`,"aria-label":`Edit comment`,onClick:()=>w(e.id),children:(0,W.jsx)(de,{className:`size-3`})}):null]}),(0,W.jsx)(I,{className:`mt-1.5`,reactions:e.reactions??[],canReact:i,subjectId:e.id,environmentId:a,reference:o,onRefresh:_})]},e.id))}),n?y?(0,W.jsxs)(`div`,{className:`mt-2`,children:[(0,W.jsx)(p,{autoFocus:!0,size:`sm`,value:x,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>S(e.target.value),onKeyDown:Je({value:x,pending:s,onSubmit:()=>void k(),onCancel:()=>b(!1)})}),(0,W.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,W.jsx)(u,{size:`xs`,variant:`ghost`,onClick:()=>b(!1),children:`Cancel`}),(0,W.jsx)(u,{size:`xs`,disabled:s||x.trim().length===0,onClick:()=>void k(),children:`Reply`})]})]}):(0,W.jsx)(u,{size:`xs`,variant:`ghost`,className:`mt-2 px-1`,onClick:()=>b(!0),children:`Reply`}):null]}):null]})}var Qe=0;function $e(){return Qe+=1,`pending-review-comment-${Qe}`}function et(e){return`${e.projectId}/${e.repository}#${e.number}`}var tt=[],Y=w()(e=>({drafts:{},summaries:{},addComment:(t,n)=>e(e=>({drafts:{...e.drafts,[t]:[...e.drafts[t]??tt,n]}})),removeComment:(t,n)=>e(e=>{let r=(e.drafts[t]??tt).filter(e=>e.id!==n);if(r.length>0)return{drafts:{...e.drafts,[t]:r}};let{[t]:i,...a}=e.drafts;return{drafts:a}}),removeComments:(t,n)=>e(e=>{let r=new Set(n),i=(e.drafts[t]??tt).filter(e=>!r.has(e.id));if(i.length>0)return{drafts:{...e.drafts,[t]:i}};let{[t]:a,...o}=e.drafts;return{drafts:o}}),clear:t=>e(e=>{let{[t]:n,...r}=e.drafts;return{drafts:r}}),setSummary:(t,n)=>e(e=>({summaries:{...e.summaries,[t]:n}})),clearSummary:(t,n)=>e(e=>{if(e.summaries[t]!==n)return e;let{[t]:r,...i}=e.summaries;return{summaries:i}})}));function nt(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=t=>t.drafts[et(e)]??tt,t[0]=e,t[1]=n),Y(n)}var rt=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,W.jsx)(_e,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,W.jsx)(o,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,W.jsx)(ke,{className:`size-3`})}];function it(e){let t=(0,H.c)(13),{environmentId:n,reference:r,verdicts:i,onSubmitted:a}=e,[o,s]=(0,L.useState)(!1),c=nt(r),l=et(r),d=Y(e=>e.summaries[l]??``),f=Y(lt),m=Y(ct),h=Y(st),g=Y(ot),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_={reportFailure:!1},t[0]=_):_=t[0];let ee=S(P.submitReview,_),v;t[1]===i?v=t[2]:(v=e=>i.includes(e.value),t[1]=i,t[2]=v);let y=rt.filter(v);if(y.length===0)return null;let b=async e=>{if(o)return;let t=d,i=c;s(!0);let u=await ee({environmentId:n,input:{...r,verdict:e.value,body:t,comments:i}});if(s(!1),u._tag===`Failure`){j.add({type:`error`,title:`The review could not be submitted`});return}m(l,i.map(at)),g(l,t),j.add({type:`success`,title:e.sent}),a()},x;t[3]!==d||t[4]!==c.length?(x=e=>e===`approve`||d.trim().length>0||c.length>0,t[3]=d,t[4]=c.length,t[5]=x):x=t[5];let C=x,w=c.length===0?`No line comments yet`:`${c.length} ${c.length===1?`comment`:`comments`} pending`,T;t[6]===w?T=t[7]:(T=(0,W.jsx)(`span`,{children:w}),t[6]=w,t[7]=T);let E=c.length>0?(0,W.jsx)(u,{size:`xs`,variant:`ghost`,disabled:o,onClick:()=>f(l),children:`Discard`}):null,D;t[8]!==T||t[9]!==E?(D=(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[T,E]}),t[8]=T,t[9]=E,t[10]=D):D=t[10];let O=y.map(e=>(0,W.jsx)(u,{size:`xs`,variant:e.value===`comment`?`outline`:`default`,disabled:o||!C(e.value),onClick:()=>void b(e),children:(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)),k;return t[11]===O?k=t[12]:(k=(0,W.jsx)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:O}),t[11]=O,t[12]=k),(0,W.jsxs)(`div`,{className:`px-4 py-3`,children:[D,(0,W.jsx)(p,{size:`sm`,className:`mt-2`,value:d,placeholder:`Summarize your review (optional)`,"aria-label":`Review summary`,onChange:e=>h(l,e.target.value)}),k]})}function at(e){return e.id}function ot(e){return e.clearSummary}function st(e){return e.setSummary}function ct(e){return e.removeComments}function lt(e){return e.clear}function ut(e,t,n){return e.hunks.some(e=>t===`left`?n>=e.deletionStart&&n<e.deletionStart+e.deletionCount:n>=e.additionStart&&n<e.additionStart+e.additionCount)}function dt(e,t,n){let r=t!==`expanded`;return n.has(e)?!r:r}var ft=10,pt=`
|
|
247
|
+
[data-diffs-header] [data-additions-count],
|
|
248
|
+
[data-diffs-header] [data-deletions-count] {
|
|
249
|
+
display: none !important;
|
|
250
|
+
}`,mt=[];function ht(e){return e===`left`?`deletions`:`additions`}function gt(e){return e===`deletions`?`left`:`right`}function X({environmentId:e,reference:t,detail:n,selectedCommitOid:r,onSelectedCommitChange:o,pendingFinding:s,fixFindingLabel:p=`Fix in a thread`,onFixFinding:h,onAskAboutSelection:w,onRefresh:T,refreshToken:M=0}){let{resolvedTheme:N}=x(),le=je(),[ue,de]=(0,L.useState)(()=>new Set),[ge,ye]=(0,L.useState)(ft),[xe,Se]=(0,L.useState)(null),[Oe,ke]=(0,L.useState)(`stacked`),[I,Me]=(0,L.useState)(le.wordWrap),[Pe,R]=(0,L.useState)(null),[z,B]=(0,L.useState)(null),[Fe,Ie]=(0,L.useState)(!1),[Le,Re]=(0,L.useState)(!1),[ze,Be]=(0,L.useState)(!1),[Ve,V]=(0,L.useState)({key:``,cursor:null,slices:mt}),Ue=(0,L.useRef)(new Map),H=et(t),U=r,G=U===null?H:`${H}@${U}`;(0,L.useEffect)(()=>{B(null),R(null),de(new Set),Se(null),ye(ft),Re(!1),V({key:G,cursor:null,slices:mt}),Ue.current.clear()},[G]);let K=Ve.key===G?Ve.slices:mt,q=Ve.key===G?Ve.cursor:null,J=_(P.diff({environmentId:e,input:{...t,...q===null?{}:{cursor:q},...U===null?{}:{commit:U}}}));(0,L.useEffect)(()=>{let e=J.data;e!==null&&V(t=>{let n=t.key===G?t.slices:mt,r={cursor:q,patch:e.patch,truncated:e.truncated,nextCursor:e.nextCursor,omittedFileStats:e.omittedFileStats??[]},i=n.findIndex(e=>e.cursor===q);if(i===-1)return{key:G,cursor:q,slices:[...n,r]};let a=n[i];return a!==void 0&&a.patch===r.patch&&a.truncated===r.truncated&&a.nextCursor===r.nextCursor&&a.omittedFileStats.length===r.omittedFileStats.length&&a.omittedFileStats.every((e,t)=>{let n=r.omittedFileStats[t];return n!==void 0&&n.path===e.path&&n.additions===e.additions&&n.deletions===e.deletions})?t:{key:G,cursor:q,slices:[...n.slice(0,i),r]}})},[q,J.data,G]);let qe=a(P.diff({environmentId:e,input:{...t,...U===null?{}:{commit:U}}})),Je=(0,L.useRef)(M);(0,L.useEffect)(()=>{Je.current!==M&&(Je.current=M,V({key:G,cursor:null,slices:mt}),qe())},[M,G,qe]);let Xe=H,Qe=nt(t),tt=Y(e=>e.addComment),rt=Y(e=>e.removeComment),at=S(P.replyToThread,{reportFailure:!1}),ot=S(P.setThreadResolution,{reportFailure:!1}),st=S(P.updateComment,{reportFailure:!1}),ct=S(P.diffFileContents),lt=(0,L.useMemo)(()=>We(ct,{environmentId:e,reference:t,commit:U,cacheKey:`pull-request:${H}:${n.updatedAt}:${U??`all`}`}),[U,n.updatedAt,e,ct,t,H]),X=(0,L.useMemo)(()=>{let e=n.capabilities.review,t=n.viewerPermissions;return{inlineComment:e.inlineComment&&t.comment,reply:e.reply&&t.comment,resolve:e.resolve&&t.resolve,verdicts:e.verdicts.filter(e=>t.verdicts.includes(e))}},[n.capabilities.review,n.viewerPermissions]),_t=X.inlineComment&&U===null,vt=(0,L.useMemo)(()=>K.map(e=>{let t=`pull-request:${G}:${N}:${e.cursor??`first`}:${we(e.patch)}`,n=Ue.current.get(t);if(n)return n;let r=Ce(e.patch,t,{compactPartialHunkOffsets:!0});return r&&Ue.current.set(t,r),r}),[K,N,G]),Z=(0,L.useMemo)(()=>vt.flatMap(e=>e?.kind===`files`?He(e.files):[]),[vt]),Q=K.at(-1)?.nextCursor??null,yt=K.some(e=>e.truncated)||vt.some(e=>e?.kind===`raw`),bt=(0,L.useMemo)(()=>{let e=new Set;if(U!==null)return e;for(let t of Z){let r=F(t);for(let i of n.reviewThreads)i.path===r&&i.line!==null&&ut(t,i.side,i.line)&&e.add(i.id)}return e},[U,n.reviewThreads,Z]),$=(0,L.useMemo)(()=>Z.map(e=>{let t=me(e),r=F(e),i=new Map,a=(e,t)=>{let n=`${e}:${t}`,r=i.get(n);if(r)return r;let a={side:e,line:t,threads:[],pending:[],draft:!1};return i.set(n,a),a};for(let e of n.reviewThreads)e.path!==r||e.line===null||bt.has(e.id)&&a(e.side,e.line).threads.push(e);if(U===null)for(let e of Qe)e.path===r&&a(e.side,e.line).pending.push(e);z?.fileKey===t&&(a(z.side,z.line).draft=!0);let o=dt(t,xe,ue),s=[...i.values()].map(e=>({side:ht(e.side),lineNumber:e.line,metadata:{threads:e.threads,pending:e.pending,draft:e.draft}}));return{id:t,type:`diff`,fileDiff:e,annotations:s,collapsed:o,version:we(`${o?`1`:`0`}:${s.map(({side:e,lineNumber:t,metadata:n})=>`${e}:${t}:${n.draft?`d`:``}:${n.pending.map(e=>`${e.id}:${e.body}`).join(`,`)}:${n.threads.map(e=>`${e.id}:${e.isResolved?`r`:``}:${e.isOutdated?`o`:``}:${e.comments.map(e=>`${e.id}:${e.author?.login??``}:${e.createdAt}:${e.body}:${(e.reactions??[]).map(e=>`${e.content}:${e.count}:${e.viewerHasReacted?`v`:``}`).join(`,`)}`).join(`;`)}`).join(`,`)}`).join(`|`)}`)}}),[U,n.reviewThreads,z,Z,xe,Qe,bt,ue]),xt=(0,L.useMemo)(()=>he(Z),[Z]),St=(0,L.useMemo)(()=>new Map(K.flatMap(e=>e.omittedFileStats.map(e=>[e.path,e]))),[K]),Ct=(0,L.useMemo)(()=>$.map(e=>e.id),[$]),wt=(0,L.useMemo)(()=>new Set($.filter(e=>e.collapsed===!0).map(e=>e.id)),[$]),Tt=O(Ct,wt),[Et,Dt]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(Et===null||Q===null||Q===q||J.isPending||J.error!==null)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&V(e=>({...e,cursor:Q}))},{rootMargin:`240px`});return e.observe(Et),()=>e.disconnect()},[q,J.error,J.isPending,Q,Et]);let Ot=(0,L.useCallback)(e=>de(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),kt=()=>{Se(O(Ct,wt)?`expanded`:`folded`),de(new Set)},At=(0,L.useMemo)(()=>n.commits.toSorted((e,t)=>Date.parse(t.committedDate)-Date.parse(e.committedDate)),[n.commits]),jt=(0,L.useCallback)((e,t)=>{if(!e||!_t)return;let n=t.item;if(n.type!==`diff`)return;let r=Z.find(e=>me(e)===n.id);if(!r)return;let i=F(r),a=be(r);B({fileKey:n.id,path:i,oldPath:a===i?null:a,line:e.end,side:gt(e.endSide??e.side),range:e})},[_t,Z]),Mt=(0,L.useCallback)((e,t)=>{let r=Z.find(t=>me(t)===e.fileKey),i=r===void 0?null:y({id:`pull-request-selection:${e.fileKey}:${e.range.start}:${e.range.end}`,sectionId:`pull-request:${n.number}`,sectionTitle:`PR #${n.number} review`,filePath:e.path,fileDiff:r,range:e.range,text:t});B(null),R(null),!(i===null||!w)&&w({comment:i,question:t})},[n.number,Z,w]),Nt=(0,L.useCallback)(()=>Q===null?null:(0,W.jsx)(`div`,{ref:Dt,className:`flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground`,children:J.error===null?J.isPending?`Loading more files...`:null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{children:`The rest of this diff could not be loaded.`}),(0,W.jsx)(u,{size:`xs`,variant:`outline`,onClick:()=>J.refresh(),children:`Retry`})]})}),[Q,J.error,J.isPending,J.refresh]),Pt=(0,L.useCallback)(e=>{let t=e.collapsed===!0;return(0,W.jsx)(`button`,{type:`button`,"aria-expanded":!t,"aria-label":t?`Expand diff`:`Collapse diff`,className:v(`mr-1 inline-flex size-5 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground`),onClick:t=>{t.stopPropagation(),Ot(e.id)},children:t?(0,W.jsx)(i,{className:`size-4`}):(0,W.jsx)(ee,{className:`size-4`})})},[Ot]),Ft=(0,L.useCallback)(e=>{if(e.type!==`diff`)return null;let t=0,n=0;for(let r of e.fileDiff.hunks)t+=r.additionLines,n+=r.deletionLines;if(t===0&&n===0){let r=St.get(F(e.fileDiff));r&&({additions:t,deletions:n}=r)}return(0,W.jsx)(ne,{additions:t,deletions:n,className:`font-mono text-[11px]`})},[St]),It=(0,L.useMemo)(()=>({diffStyle:Oe===`split`?`split`:`unified`,lineDiffType:`none`,overflow:I?`wrap`:`scroll`,theme:Ae(N),themeType:N,stickyHeaders:!0,loadDiffFiles:lt,enableGutterUtility:_t&&z===null,enableLineSelection:_t&&z===null,onGutterUtilityClick:jt,onLineSelectionEnd:jt}),[Oe,I,N,lt,_t,z,jt]),Lt=(0,L.useCallback)(async(e,t)=>{if(Fe)return!1;Ie(!0);let n=await t();return Ie(!1),n._tag===`Failure`?(j.add({type:`error`,title:e}),!1):(T(),!0)},[T,Fe]),Rt=(0,L.useCallback)(r=>(0,W.jsx)(Ze,{thread:r,workspaceRoot:n.workspaceRoot,canReply:X.reply,canResolve:X.resolve,canReact:n.capabilities.reactions===!0,environmentId:e,reference:t,pending:Fe,fixPending:s===se({kind:`thread`,thread:r}),fixLabel:p,...h?{onFix:()=>h({kind:`thread`,thread:r})}:{},onReply:n=>Lt(`Reply could not be posted`,()=>at({environmentId:e,input:{...t,threadId:r.id,body:n}})),canEditComment:e=>re(n,{author:e.author,kind:`review-comment`}),onEditComment:(n,r)=>Lt(`The comment could not be saved`,()=>st({environmentId:e,input:{...t,commentId:n,kind:`review-comment`,body:r}})),onToggleResolved:()=>void Lt(`The conversation could not be updated`,()=>ot({environmentId:e,input:{...t,threadId:r.id,resolved:!r.isResolved}})),onReacted:T},`${t.projectId}#${t.number}:${r.id}`),[n,e,p,T,h,s,t,at,X.reply,X.resolve,Lt,ot,Fe,st]),zt=(0,L.useCallback)(e=>(0,W.jsxs)(`div`,{className:`py-1 font-sans text-foreground`,children:[e.metadata.threads.map(Rt),e.metadata.pending.map(e=>(0,W.jsx)(Ye,{comment:e,onRemove:()=>rt(Xe,e.id)},e.id)),e.metadata.draft&&z?(0,W.jsx)(Ge,{kind:`draft`,rangeLabel:`${z.path}:${z.line}`,text:``,submitLabel:`Add to review`,...w?{secondaryAction:{label:`Ask`,icon:(0,W.jsx)(ce,{className:`size-3`}),allowEmpty:!0,onAction:e=>Mt(z,e)}}:{},onCancel:()=>{B(null),R(null)},onComment:e=>{tt(Xe,{id:$e(),path:z.path,...z.oldPath===null?{}:{oldPath:z.oldPath},line:z.line,side:z.side,body:e}),B(null),R(null)}}):null]}),[tt,Mt,z,w,rt,Rt,Xe]),Bt=X.verdicts.length===0?null:(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10`,children:ze?(0,W.jsxs)(`div`,{className:`chat-composer-glass pointer-events-auto absolute inset-x-3 bottom-3 rounded-xl border border-border/60 shadow-lg`,children:[(0,W.jsx)(u,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Close review`,className:`absolute right-2 top-2`,onClick:()=>Be(!1),children:(0,W.jsx)(c,{className:`size-3.5`})}),(0,W.jsx)(it,{environmentId:e,reference:t,verdicts:X.verdicts,onSubmitted:()=>{T(),Be(!1)}})]}):(0,W.jsxs)(`button`,{type:`button`,className:`chat-composer-glass pointer-events-auto absolute bottom-3 right-4 flex items-center gap-1.5 rounded-full border border-border/60 px-3 py-1.5 text-xs font-medium shadow-lg`,onClick:()=>Be(!0),children:[(0,W.jsx)(_e,{className:`size-3.5`}),`Review`,Qe.length>0?(0,W.jsx)(`span`,{className:`flex size-4 items-center justify-center rounded-full bg-accent text-[10px] tabular-nums text-accent-foreground`,children:Qe.length}):null]})}),Vt=At.find(e=>e.oid===U);(0,L.useEffect)(()=>{U!==null&&Vt===void 0&&o(null)},[U,o,Vt]);let Ht=Vt?Vt.messageHeadline:`All commits`,Ut=(0,W.jsxs)(`div`,{className:`surface-subheader justify-between gap-2 px-4 text-xs text-muted-foreground`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[At.length>0?(0,W.jsxs)(m,{children:[(0,W.jsxs)(b,{className:`inline-flex h-6 max-w-64 items-center gap-1 rounded-md bg-accent px-2 text-xs font-medium text-accent-foreground outline-none transition-colors hover:bg-accent/80 focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${Ht}`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:Ht}),(0,W.jsx)(ee,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,W.jsxs)(d,{align:`start`,className:`w-80`,children:[(0,W.jsx)(g,{className:U===null?`bg-foreground/[0.08]`:void 0,onClick:()=>o(null),children:(0,W.jsx)(`span`,{children:`All commits`})}),At.slice(0,ge).map(e=>(0,W.jsxs)(g,{className:e.oid===U?`bg-foreground/[0.08]`:void 0,onClick:()=>o(e.oid),children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,title:e.messageHeadline,children:e.messageHeadline}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-xs text-muted-foreground`,children:e.oid.slice(0,7)})]},e.oid)),At.length>ge?(0,W.jsx)(g,{closeOnClick:!1,onClick:()=>ye(e=>e+ft),children:(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Show more (`,At.length-ge,` left)`]})}):null]})]}):null,(0,W.jsxs)(oe,{children:[(0,W.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[Z.length,` `,Z.length===1?`file`:`files`,Q===null?``:`+`]}),yt?(0,W.jsxs)(C,{children:[(0,W.jsx)(l,{render:(0,W.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,W.jsx)(te,{"aria-label":`Some of this diff was not shown`,className:`size-3.5 text-amber-600 dark:text-amber-500`})}),(0,W.jsx)(f,{side:`bottom`,children:`The host withheld part of this diff — a binary file, or a change too large to inline.`})]}):null,U!==null&&X.inlineComment?(0,W.jsxs)(C,{children:[(0,W.jsx)(l,{render:(0,W.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,W.jsx)(Ne,{"aria-label":`Line comments are written from the whole change`,className:`size-3.5`})}),(0,W.jsx)(f,{side:`bottom`,children:`A comment is anchored to the whole change, so switch to All commits to write one.`})]}):null]})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,W.jsx)(ne,{additions:xt.additions,deletions:xt.deletions,className:`mr-1`}),Ct.length>0?(0,W.jsxs)(C,{children:[(0,W.jsx)(l,{render:(0,W.jsx)(u,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":Tt?`Expand all files`:`Collapse all files`,onClick:kt}),children:Tt?(0,W.jsx)(ve,{className:`size-3.5`}):(0,W.jsx)(Te,{className:`size-3.5`})}),(0,W.jsx)(f,{side:`top`,children:Tt?`Expand all files`:`Collapse all files`})]}):null,(0,W.jsxs)(E,{className:`shrink-0 gap-1`,size:`sm`,value:[Oe],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&ke(t)},children:[(0,W.jsx)(A,{"aria-label":`Stacked diff view`,value:`stacked`,variant:`ghost`,children:(0,W.jsx)(D,{className:`size-3.5`})}),(0,W.jsx)(A,{"aria-label":`Split diff view`,value:`split`,variant:`ghost`,children:(0,W.jsx)(k,{className:`size-3.5`})})]}),(0,W.jsxs)(C,{children:[(0,W.jsx)(l,{render:(0,W.jsx)(A,{"aria-label":I?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:I,onPressedChange:e=>{Me(!!e)}}),children:(0,W.jsx)(ie,{className:`size-3.5`})}),(0,W.jsx)(f,{side:`top`,children:I?`Disable line wrapping`:`Enable line wrapping`})]})]})]}),Wt=e=>(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ut,(0,W.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`h-full overflow-auto`,children:e}),Bt]})]});if(J.isPending&&K.length===0)return Wt((0,W.jsx)(Ee,{label:`Loading pull request diff...`}));if(J.error&&K.length===0)return Wt((0,W.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:J.error}));let Gt=Q===null?vt.flatMap(e=>e?.kind===`raw`?[e]:[]):[];if(Z.length===0&&Gt.length>0)return Wt((0,W.jsx)(`div`,{className:`space-y-4 px-4 py-5`,children:Gt.map(e=>(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,W.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))}));if($.length===0&&Q===null)return Wt((0,W.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:U===null?`This pull request has no file changes.`:`This commit has no file changes.`}));let Kt=n.reviewThreads.filter(e=>!bt.has(e.id)),qt=new Map;for(let e of Kt){let t=qt.get(e.path);t?t.push(e):qt.set(e.path,[e])}let Jt=Gt.length===0?null:(0,W.jsx)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-5`,children:Gt.map(e=>(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,W.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))});return(0,W.jsx)(pe,{children:(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ut,qt.size>0?(0,W.jsxs)(De,{className:`shrink-0 border-b border-border/60`,open:Le,onOpenChange:Re,children:[(0,W.jsx)(`h2`,{children:(0,W.jsxs)(fe,{className:`flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground`,children:[(0,W.jsx)(`span`,{children:Q===null?`Conversations not on the current diff`:`Conversations not on the diff loaded so far`}),(0,W.jsx)(i,{"aria-hidden":!0,className:v(`size-3.5 transition-transform`,Le&&`rotate-90`)}),(0,W.jsx)(`span`,{"aria-hidden":!0,className:`tabular-nums`,children:Kt.length}),(0,W.jsx)(`span`,{className:`sr-only`,children:Kt.length===1?`1 conversation`:`${Kt.length} conversations`})]})}),(0,W.jsx)(ae,{children:(0,W.jsx)(`div`,{className:`max-h-64 space-y-3 overflow-auto px-4 pb-3`,children:[...qt].map(([e,t])=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`truncate px-3 text-xs text-muted-foreground`,title:e,children:e}),(0,W.jsx)(`div`,{className:`mt-1 space-y-2`,children:t.map(e=>(0,W.jsxs)(`div`,{children:[e.line===null?null:(0,W.jsxs)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:[`Line `,e.line]}),Rt(e)]},e.id))})]},e))})})]}):null,(0,W.jsxs)(`div`,{className:`relative min-h-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement){if(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement)return;if(e.hasAttribute(`data-diffs-header`)){let t=e.querySelector(`[data-title]`)?.textContent?.trim();if(t===void 0||t===``)return;let n=$.find(e=>F(e.fileDiff)===t);n!==void 0&&Ot(n.id);return}}},children:[(0,W.jsx)(Ke,{className:`h-full overflow-auto [scrollbar-gutter:stable]`,items:$,selectedLines:Pe,onSelectedLinesChange:R,options:It,renderCodeViewFooter:Nt,renderHeaderPrefix:Pt,renderHeaderMetadata:Ft,renderAnnotation:zt,unsafeCSSExtra:pt}),Bt]}),Jt]})})}export{X as PullRequestCodeTab,X as default};
|
|
251
|
+
//# sourceMappingURL=PullRequestCodeTab-C7nXySfj.js.map
|
package/dist/client/assets/{fileCommentAnnotations-Dy17abwC.js → fileCommentAnnotations-D1IJuyQs.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{
|
|
2
|
-
//# sourceMappingURL=fileCommentAnnotations-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{Xr as i,c as a}from"./terminal-links-DFgxYsvC.js";import{Vr as o,ti as s}from"./index-CEYXdFfh.js";var c=r(),l=e(n(),1),u=t();function d(e){let t=(0,c.c)(44),{kind:n,rangeLabel:r,text:d,onCancel:m,onComment:h,onDelete:g}=e,[_,v]=(0,l.useState)(``);if(n===`comment`){let e,n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,u.jsx)(s,{className:`size-4 text-muted-foreground`}),n=(0,u.jsx)(`span`,{className:`text-xs font-medium`,children:`Local comment`}),t[0]=e,t[1]=n):(e=t[0],n=t[1]);let a;t[2]===r?a=t[3]:(a=(0,u.jsx)(`span`,{className:`ml-auto text-[11px] text-muted-foreground`,children:r}),t[2]=r,t[3]=a);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,u.jsx)(o,{className:`size-3.5`}),t[4]=c):c=t[4];let l;t[5]===g?l=t[6]:(l=(0,u.jsx)(i,{variant:`ghost`,size:`icon-xs`,"aria-label":`Delete comment`,onClick:g,children:c}),t[5]=g,t[6]=l);let f;t[7]!==a||t[8]!==l?(f=(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e,n,a,l]}),t[7]=a,t[8]=l,t[9]=f):f=t[9];let m;t[10]===d?m=t[11]:(m=(0,u.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-foreground`,children:d}),t[10]=d,t[11]=m);let h;return t[12]!==f||t[13]!==m?(h=(0,u.jsxs)(`div`,{"data-file-comment-annotation":!0,className:`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 shadow-sm`,contentEditable:!1,onPointerDown:p,children:[f,m]}),t[12]=f,t[13]=m,t[14]=h):h=t[14],h}let y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,u.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,u.jsx)(s,{className:`size-4 text-muted-foreground`}),(0,u.jsx)(`span`,{className:`text-sm font-medium`,children:`Local comment`})]}),t[15]=y):y=t[15];let b;t[16]===r?b=t[17]:(b=(0,u.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Comment on lines `,r]}),t[16]=r,t[17]=b);let x=`Comment on lines ${r}`,S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>v(e.target.value),t[18]=S):S=t[18];let C;t[19]!==m||t[20]!==h||t[21]!==_?(C=e=>{e.key===`Escape`&&(e.preventDefault(),m()),(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&_.trim()&&(e.preventDefault(),h(_.trim()))},t[19]=m,t[20]=h,t[21]=_,t[22]=C):C=t[22];let w;t[23]!==x||t[24]!==C||t[25]!==_?(w=(0,u.jsx)(a,{autoFocus:!0,className:`mt-3`,size:`sm`,value:_,placeholder:`Request change`,"aria-label":x,onChange:S,onKeyDown:C}),t[23]=x,t[24]=C,t[25]=_,t[26]=w):w=t[26];let T;t[27]===m?T=t[28]:(T=(0,u.jsx)(i,{variant:`ghost`,size:`sm`,onClick:m,children:`Cancel`}),t[27]=m,t[28]=T);let E;t[29]===_?E=t[30]:(E=_.trim(),t[29]=_,t[30]=E);let D=!E,O;t[31]!==h||t[32]!==_?(O=()=>h(_.trim()),t[31]=h,t[32]=_,t[33]=O):O=t[33];let k;t[34]!==O||t[35]!==D?(k=(0,u.jsx)(i,{size:`sm`,disabled:D,onClick:O,children:`Comment`}),t[34]=O,t[35]=D,t[36]=k):k=t[36];let A;t[37]!==k||t[38]!==T?(A=(0,u.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[T,k]}),t[37]=k,t[38]=T,t[39]=A):A=t[39];let j;return t[40]!==A||t[41]!==b||t[42]!==w?(j=(0,u.jsxs)(`div`,{"data-file-comment-annotation":!0,className:`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 shadow-lg`,contentEditable:!1,onPointerDown:f,children:[y,b,w,A]}),t[40]=A,t[41]=b,t[42]=w,t[43]=j):j=t[43],j}function f(e){return e.stopPropagation()}function p(e){return e.stopPropagation()}var m=0;function h(){return m+=1,`file-comment-${Date.now()}-${m}`}function g(e){return{startLine:Math.min(e.start,e.end),endLine:Math.max(e.start,e.end)}}function _(e,t){return e===t?`L${e}`:`L${e} to L${t}`}function v(e){return e.map(e=>({...e,metadata:{entries:e.metadata.entries.map(t=>{let n=t.endLine-t.startLine;return{...t,endLine:e.lineNumber,startLine:Math.max(1,e.lineNumber-n)}})}}))}export{d as a,v as i,h as n,g as r,_ as t};
|
|
2
|
+
//# sourceMappingURL=fileCommentAnnotations-D1IJuyQs.js.map
|