@opentig/cli 0.1.2 → 0.1.4
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 +58 -7
- package/dist/chunks/{cli-bEPXlEpH.mjs → cli-B3AR8LUd.mjs} +234 -170
- package/dist/chunks/cli-service-B939lTxw.mjs +237 -0
- package/dist/client/assets/App-BWpP-n84.js +118 -0
- package/dist/client/assets/{CreatePullRequestDialog-NPqtWmYL.js → CreatePullRequestDialog-CQKBUxKz.js} +2 -2
- package/dist/client/assets/{DiffWorkspace-CZH8jCtn.js → DiffWorkspace-Dg7YI5fJ.js} +6 -6
- package/dist/client/assets/EditableFileViewer-CmxzBnAY.js +1 -0
- package/dist/client/assets/{File-C25AAfq1.js → File-CYcpdoXz.js} +1 -1
- package/dist/client/assets/{FilesView-C6qX7ixR.js → FilesView-BFCwGLC2.js} +1 -1
- package/dist/client/assets/{GitHubAvatar-DV6lI4Jh.js → GitHubAvatar-BcncAgKT.js} +1 -1
- package/dist/client/assets/HistoryView-Dev4CVOY.js +1 -0
- package/dist/client/assets/{HtmlFileViewer-CiPZFmIx.js → HtmlFileViewer-jdBVtlNv.js} +1 -1
- package/dist/client/assets/{IconEdit-DZPhGn6H.js → IconEdit-DQZu_Rpb.js} +1 -1
- package/dist/client/assets/{IconFolderPlus-CE1ATVt-.js → IconFolderPlus-DvEWPQIQ.js} +1 -1
- package/dist/client/assets/ImageFileViewer-BW1MbklH.js +1 -0
- package/dist/client/assets/{LocalRefsDialog-DIFaZUiQ.js → LocalRefsDialog-9ggtgVW_.js} +1 -1
- package/dist/client/assets/{MarkdownFileViewer-Y9tvTC3N.js → MarkdownFileViewer-Bhrr1l2Q.js} +2 -2
- package/dist/client/assets/{PairingPage-rJKAimg3.js → PairingPage-CkRMPzli.js} +1 -1
- package/dist/client/assets/{PierreDiffViewer-BRQK_cuH.js → PierreDiffViewer-CYdNkBG9.js} +1 -1
- package/dist/client/assets/PierreEditBoundary-Cu19fc5Z.js +2 -0
- package/dist/client/assets/{PierreWorkerPool-CRVJ90kq.js → PierreWorkerPool-B2iHe3DC.js} +1 -1
- package/dist/client/assets/PullRequestDiff-DZRDxOx9.js +1 -0
- package/dist/client/assets/PullRequestViewer-Bsh-F3-d.js +2 -0
- package/dist/client/assets/PullRequestsView-Brg-sbGb.js +1 -0
- package/dist/client/assets/{QuickOpenDialog-CciIWIcs.js → QuickOpenDialog-CtJqcFuk.js} +1 -1
- package/dist/client/assets/RepositoryProjectsDialog-BIUnKMb-.js +1 -0
- package/dist/client/assets/SearchView-C5_R_0ZU.js +1 -0
- package/dist/client/assets/{SettingsDialog-B0XwVWYT.js → SettingsDialog-CyJA7ajO.js} +2 -2
- package/dist/client/assets/Viewer-xMTNRGDO.js +3 -0
- package/dist/client/assets/{abnfDiagram-N423BO3Z-DRTxjQR7.js → abnfDiagram-N423BO3Z-DYcwdF-j.js} +1 -1
- package/dist/client/assets/{arc-DlZI_By6.js → arc-CZ6a8_6G.js} +1 -1
- package/dist/client/assets/{architectureDiagram-T3A2C74G-BpcQblyb.js → architectureDiagram-T3A2C74G-CViM1eoQ.js} +1 -1
- package/dist/client/assets/base-ui-D4MeJpa3.js +1 -0
- package/dist/client/assets/{blockDiagram-VBNYF7ZC-BF55JK7V.js → blockDiagram-VBNYF7ZC-BzRc4Zb8.js} +1 -1
- package/dist/client/assets/{c4Diagram-5PPSVZJV-CkQ8c1Fd.js → c4Diagram-5PPSVZJV-BZsdylz9.js} +1 -1
- package/dist/client/assets/channel-DUwjky93.js +1 -0
- package/dist/client/assets/checkbox-iSOOddl1.js +1 -0
- package/dist/client/assets/{chunk-2GRJ4B5K-BsVfgXSJ.js → chunk-2GRJ4B5K-CsL1szop.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-hYvR7LDf.js → chunk-2Q5K7J3B-Dpm-BZHi.js} +1 -1
- package/dist/client/assets/{chunk-5RXB4S5H-B2TcxiXR.js → chunk-5RXB4S5H-BNNb0lga.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-TDJFncVJ.js → chunk-5VM5RSS4-CcXWQAK-.js} +1 -1
- package/dist/client/assets/{chunk-6Q2QTUOP-BDdSa8Zj.js → chunk-6Q2QTUOP-BIpZKHoj.js} +1 -1
- package/dist/client/assets/{chunk-GF5L2VYU-CUHPmM86.js → chunk-GF5L2VYU-CXSHzIYB.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-Pq05eTDs.js → chunk-JWPE2WC7-DxFk0X7_.js} +1 -1
- package/dist/client/assets/{chunk-KBJHAD2P-QSlaIrVy.js → chunk-KBJHAD2P-WRKVeb4h.js} +1 -1
- package/dist/client/assets/{chunk-RYQCIY6F-C0P7HEQg.js → chunk-RYQCIY6F-Br5DeHdX.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-C_oHIOR7.js → chunk-XXDRQBXY-DFCzSljb.js} +1 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-BtqFLKHp.js +1 -0
- package/dist/client/assets/classDiagram-v2-OCEON4UE-BtqFLKHp.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-Du6jXfCO.js → cose-bilkent-JH36ORCC-CE8E-qIe.js} +1 -1
- package/dist/client/assets/{cynefin-VYW2F7L2-CTUvB8CJ.js → cynefin-VYW2F7L2-CHf3vLku.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-MW4NZA55-BLRqmW6C.js → cynefinDiagram-MW4NZA55-90txNnhw.js} +1 -1
- package/dist/client/assets/{dagre-VZM6K2ZE-DTAlXx2k.js → dagre-VZM6K2ZE-6somveWH.js} +1 -1
- package/dist/client/assets/{diagram-7IWD3JNH-Coh1c4kx.js → diagram-7IWD3JNH-D4GP5bhO.js} +1 -1
- package/dist/client/assets/{diagram-B4RE2ZJO-TahBzLDX.js → diagram-B4RE2ZJO-Cz4bx70D.js} +1 -1
- package/dist/client/assets/{diagram-LBJQPF4R-2uwXPdqa.js → diagram-LBJQPF4R-BXjlhC7t.js} +1 -1
- package/dist/client/assets/{diagram-Q27KOJAE-Bm4UNuoF.js → diagram-Q27KOJAE-B_dDT61b.js} +1 -1
- package/dist/client/assets/{diagram-UB23O5K3-dWga-ccy.js → diagram-UB23O5K3-BotmyDTm.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-BXEA7PRR-D0IK6JUi.js → ebnfDiagram-BXEA7PRR-CBey4stz.js} +1 -1
- package/dist/client/assets/edit-ready-context-D77R8XU8.js +1 -0
- package/dist/client/assets/{erDiagram-JOGREHBK-DouKd_mX.js → erDiagram-JOGREHBK-B2g7aHUP.js} +1 -1
- package/dist/client/assets/{flowDiagram-UKHOOZJN-DQQX82AJ.js → flowDiagram-UKHOOZJN-B181B3KJ.js} +1 -1
- package/dist/client/assets/{ganttDiagram-PKOTCBZU-CbvAYRQc.js → ganttDiagram-PKOTCBZU-BFslA07w.js} +1 -1
- package/dist/client/assets/{gh-utils-XOjL-WGw.js → gh-utils-rGdT2YZN.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-D7cqbpF-.js → gitGraphDiagram-DS77QQ5N-B_uJt_Hp.js} +1 -1
- package/dist/client/assets/{index-Bm8fY0Qs.css → index-DXR6FOp1.css} +1 -1
- package/dist/client/assets/index-DaaX_e8C.js +3 -0
- package/dist/client/assets/{infoDiagram-6WML65LV-C0NfpA-J.js → infoDiagram-6WML65LV-BuajoWMd.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-DhIW58so.js → ishikawaDiagram-WSZJBQD7-CGRAyQ-L.js} +1 -1
- package/dist/client/assets/{journeyDiagram-NVQOT4AX-DqZZm_oH.js → journeyDiagram-NVQOT4AX-D8bgj_4i.js} +1 -1
- package/dist/client/assets/{kanban-definition-27J2QSJJ-DpSYxBwt.js → kanban-definition-27J2QSJJ-QrwKHnlk.js} +1 -1
- package/dist/client/assets/{linear-DRxvRS4v.js → linear-BSIPbUpM.js} +1 -1
- package/dist/client/assets/{markdown-ChhkSSkz.css → markdown-BpzjXclZ.css} +1 -1
- package/dist/client/assets/{mermaid.core-Bz1ouG4e.js → mermaid.core-D4_R4ZQ7.js} +4 -4
- package/dist/client/assets/{mindmap-definition-FAOFIHXS-ohtsO4nF.js → mindmap-definition-FAOFIHXS-DTiuF5JK.js} +1 -1
- package/dist/client/assets/{pegDiagram-VL7TDLO6-BmDfUXjC.js → pegDiagram-VL7TDLO6-yCIq1xSC.js} +1 -1
- package/dist/client/assets/{pieDiagram-7S7Q4E2Y-CUADuvir.js → pieDiagram-7S7Q4E2Y-B_Vgs3pz.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-BGGXYgGq.js → quadrantDiagram-CIZ2JOQS-5Ne6-Suh.js} +1 -1
- package/dist/client/assets/{railroadDiagram-AXF67PYL-CuQocJeb.js → railroadDiagram-AXF67PYL-CRQ23Ne5.js} +1 -1
- package/dist/client/assets/{render-markdown-BnNqckxy.js → render-markdown-D7BGt-zy.js} +6 -6
- package/dist/client/assets/{requirementDiagram-LRYGKXZP-7w9ufPrL.js → requirementDiagram-LRYGKXZP-Ctks1nFE.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-W5VNT64P-DWDWhnZJ.js → sankeyDiagram-W5VNT64P-D127Ar8U.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-SI44F4Z6-BQAnExHF.js → sequenceDiagram-SI44F4Z6-6hK5AS2n.js} +1 -1
- package/dist/client/assets/{sizeCapture-X5ZJPWSS-BC2GpN9p.js → sizeCapture-X5ZJPWSS-GhdZlEoa.js} +1 -1
- package/dist/client/assets/{stateDiagram-OKZ733FA-vXwPDk5C.js → stateDiagram-OKZ733FA-u3G3OuQX.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-BSIBplQO.js +1 -0
- package/dist/client/assets/{swimlanes-SLNWSIFB-DdBBGgwS.js → swimlanes-SLNWSIFB-BIfNt9T9.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DGRBYdxa.js +8 -0
- package/dist/client/assets/{tanstack-BEeM5REq.js → tanstack-Bsd5UOY4.js} +1 -1
- package/dist/client/assets/{timeline-definition-Z64GVDOM-CcXzq7ZH.js → timeline-definition-Z64GVDOM-CXwiFUZq.js} +1 -1
- package/dist/client/assets/{vennDiagram-T6HMQDX7-PiBQGztV.js → vennDiagram-T6HMQDX7-D9Rhew2E.js} +1 -1
- package/dist/client/assets/viewer-tabs-BW5-uV6M.js +1 -0
- package/dist/client/assets/{wardleyDiagram-T6FBY63Y-R9-CuOPS.js → wardleyDiagram-T6FBY63Y-CzCcAcBb.js} +1 -1
- package/dist/client/assets/{xychartDiagram-ELKLHX3M-CrK1rvFm.js → xychartDiagram-ELKLHX3M-BfXVbrBJ.js} +1 -1
- package/dist/client/index.html +4 -4
- package/dist/dev.mjs +4 -3
- package/dist/manifest.json +1 -1
- package/dist/server.mjs +59 -3
- package/dist/service-update.mjs +77 -0
- package/package.json +1 -1
- package/dist/client/assets/App-1nMyZ0Eq.js +0 -118
- package/dist/client/assets/EditableFileViewer-4ap_dRdR.js +0 -1
- package/dist/client/assets/HistoryView-CgKY4Sjl.js +0 -1
- package/dist/client/assets/ImageFileViewer-RAXxHOBt.js +0 -1
- package/dist/client/assets/PierreEditBoundary-YYf1awXS.js +0 -2
- package/dist/client/assets/PullRequestDiff-BWdKV4LM.js +0 -1
- package/dist/client/assets/PullRequestViewer-6MhtdrJc.js +0 -2
- package/dist/client/assets/PullRequestsView-CJy2RRm7.js +0 -1
- package/dist/client/assets/RepositoryProjectsDialog-c_ZJ0g3C.js +0 -1
- package/dist/client/assets/SearchView-D5NpA3kT.js +0 -1
- package/dist/client/assets/Viewer-u1esMhLs.js +0 -3
- package/dist/client/assets/base-ui-BxmCGIFY.js +0 -1
- package/dist/client/assets/channel-D-dDbEF9.js +0 -1
- package/dist/client/assets/checkbox-vpy6b6Uq.js +0 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-DHG_NsyB.js +0 -1
- package/dist/client/assets/classDiagram-v2-OCEON4UE-DHG_NsyB.js +0 -1
- package/dist/client/assets/index-DwuduZw_.js +0 -3
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-BA-7Q81g.js +0 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-BSDBQ9JF.js +0 -8
- package/dist/client/assets/viewer-tabs-B_boC13j.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,j as l}from"./react-rd22PHbN.js";import{V as w,O as j,P as k,a as N,u as A}from"./PierreWorkerPool-CRVJ90kq.js";import{F as O}from"./File-C25AAfq1.js";import{a5 as M,a6 as C,C as x,a7 as I,T as V,o as z,q as K}from"./App-1nMyZ0Eq.js";import{EditReadyContext as P}from"./PierreEditBoundary-YYf1awXS.js";import{c as D}from"./index-DwuduZw_.js";const U=[["path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M10 14a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M14 4l0 4l-6 0l0 -4",key:"svg-2"}]],q=D("outline","device-floppy","DeviceFloppy",U),b={stableFrames:3,maxFrames:60,userScrollTolerance:2};function B(e,t,r={}){const s=r.stableFrames??b.stableFrames,n=r.maxFrames??b.maxFrames,p=r.userScrollTolerance??b.userScrollTolerance,E=r.requestFrame??(i=>requestAnimationFrame(i)),T=r.cancelFrame??(i=>cancelAnimationFrame(i)),S=Number.isFinite(t)?Math.min(1,Math.max(0,t)):0;let f=null,F=0,m=0,c=null,a=null,y=!1;const R=()=>{y=!0,f!==null&&T(f),f=null},v=()=>{if(f=null,y)return;F+=1;const i=e.getContentHeight();if(a!==null&&c===i&&Math.abs(e.getScrollTop()-a)>p){R();return}const u=e.getScrollRange(),h=u>0?S*u:0;if(e.scrollTo(h),a=h,m=i>0&&c===i?m+1:0,c=i,m>=s||F>=n){R();return}f=E(v)};return v(),R}function G(e){const t=e.split("+"),r=t.pop().toLowerCase();return[...t.map(n=>n==="Ctrl"?"cmdOrCtrl":n.toLowerCase()),r].join("+")}function H(e){return[{bindings:{[G(e)]:"openSearchReplacePanel"}}]}H(M.editorSearch);const W=2e3;function $(e,t=W){let r=1;for(let s=0;s<e.length;s+=1)if(e.charCodeAt(s)===10&&(r+=1,r>t))return!0;return!1}function Y(e,t,r=M.saveFile){return I({key:e.key,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey??!1,altKey:e.altKey??!1},r)?(e.preventDefault(),t(),!0):!1}async function Z(e){if(!e.dirty||e.readOnly||!e.claim())return"skipped";try{return(await e.persist()).status==="conflict"?(e.onConflict(),"conflict"):(e.onSuccess(),"saved")}catch(t){return e.onError(t),"error"}finally{e.release()}}function J({file:e,initialContent:t,readOnly:r,messages:s,onDirtyChange:n,onDraftChange:p,onSave:E}){const T=C(),[S,f]=o.useState(t),[F,m]=o.useState(!1),c=o.useRef(!1),a=S!==e.content,y=o.useRef(e.content);o.useLayoutEffect(()=>{S===y.current&&e.content!==y.current&&f(e.content),y.current=e.content},[e.content,S]),o.useEffect(()=>{n(a)},[a,n]),o.useEffect(()=>()=>n(!1),[n]);const R=o.useCallback(u=>{f(u),n(u!==e.content),p(u)},[e.content,n,p]),v=o.useCallback(async()=>{await Z({dirty:a,readOnly:r,claim:()=>c.current?!1:(c.current=!0,m(!0),!0),release:()=>{c.current=!1,m(!1)},persist:()=>E(e.path,S,e.content),onConflict:()=>x.error({title:s.conflictTitle,description:"Your draft is still open. Copy it or reload the file before saving again.",duration:1e4}),onSuccess:()=>x.success({title:s.successTitle,description:e.path}),onError:u=>x.error({title:s.errorTitle,description:u instanceof Error?u.message:"Unknown error",duration:1e4})})},[a,S,e.content,e.path,s,E,r]),i=o.useRef(v);return o.useEffect(()=>{i.current=v},[v]),o.useEffect(()=>{const u=h=>{Y(h,()=>{i.current()},T.saveFile)};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[T.saveFile]),{draft:S,updateDraft:R,dirty:a,saving:F,save:v}}function L({dirty:e,saving:t,readOnly:r,onSave:s}){const n=C();if(!e&&!t)return null;const p=r?"Read only":t?"Saving…":`Save file (${n.saveFile})`;return l.jsxs(V,{children:[l.jsx(z,{render:l.jsx("button",{type:"button",className:"file-save-button","data-state":r?"readonly":t?"saving":"dirty",disabled:t||r,onClick:s,"aria-label":p}),children:l.jsx(q,{"aria-hidden":"true"})}),l.jsx(K,{children:p})]})}function Q({handleRef:e}){const t=A();return o.useLayoutEffect(()=>{e.current=t},[t,e]),null}function _({path:e,cacheKey:t,value:r,themeType:s,wrapLines:n,readOnly:p,onChange:E,ref:T}){const S=o.useContext(P),f=C(),[F]=o.useState(()=>$(r)),m=o.useRef(E);o.useEffect(()=>{m.current=E},[E]);const c=o.useRef(void 0),a=o.useRef(null),y=o.useMemo(()=>({name:e,contents:r,cacheKey:t}),[t,e,r]),R=o.useMemo(()=>({disableFileHeader:!0,themeType:s,theme:j,overflow:n?"wrap":"scroll",unsafeCSS:w}),[s,n]),v=o.useMemo(()=>({historyMaxEntries:500,keymap:H(f.editorSearch),onChange(h){m.current(h.contents)}}),[f.editorSearch]),i=o.useRef(null);o.useEffect(()=>()=>i.current?.(),[]),o.useImperativeHandle(T,()=>({getScrollFraction(){const h=c.current?.getRoot()??a.current;if(!(h instanceof HTMLElement))return 0;const d=h.scrollHeight-h.clientHeight;return d>0?h.scrollTop/d:0},scrollToFraction(h){i.current?.(),i.current=B({getScrollRange(){const d=c.current?.getRoot()??a.current;return d instanceof HTMLElement?Math.max(0,d.scrollHeight-d.clientHeight):0},getScrollTop(){const d=c.current?.getRoot()??a.current;return d instanceof HTMLElement?d.scrollTop:0},getContentHeight(){const d=c.current?.getRoot()??a.current;return d instanceof HTMLElement?d.scrollHeight:0},scrollTo(d){const g=c.current;g&&g.getRoot()instanceof HTMLElement?g.scrollTo({top:d}):a.current?.scrollTo({top:d})}},h)}}),[]);const u=l.jsx(O,{file:y,options:R,editorOptions:v,edit:S&&!p});return l.jsx(k,{theme:j,children:F?l.jsxs(N,{className:"source-code-editor",contentClassName:"source-code-editor-content",children:[l.jsx(Q,{handleRef:c}),u]}):l.jsx("div",{ref:a,className:"source-code-editor",children:l.jsx("div",{className:"source-code-editor-content",children:u})})})}const X={conflictTitle:"File was changed outside OpenTig",successTitle:"File saved",errorTitle:"Could not save file"};function ee({file:e,initialContent:t,themeType:r,wrapLines:s,readOnly:n,onDirtyChange:p,onDraftChange:E,onSave:T}){const{draft:S,updateDraft:f,dirty:F,saving:m,save:c}=J({file:e,initialContent:t,readOnly:n,messages:X,onDirtyChange:p,onDraftChange:E,onSave:T});return l.jsxs("div",{className:"source-file-viewer",children:[(F||m)&&l.jsx("div",{className:"source-file-toolbar",children:l.jsx(L,{dirty:F,saving:m,readOnly:n,onSave:()=>{c()}})}),l.jsx("div",{className:"source-editor-scroll",children:l.jsx(_,{path:e.path,cacheKey:e.path,value:S,themeType:r,wrapLines:s,readOnly:n||m,onChange:f})})]})}const ae=Object.freeze(Object.defineProperty({__proto__:null,EditableFileViewer:ee,FileSaveControls:L,SourceCodeEditor:_},Symbol.toStringTag,{value:"Module"}));export{ae as E,L as F,_ as S,B as s,J as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as w,j as e}from"./react-rd22PHbN.js";import{a as M}from"./tanstack-BEeM5REq.js";import{k as O,J as D,O as P,P as _,Q as G,T as y,o as v,q as $,R as z,C as F,U,V as Y}from"./App-1nMyZ0Eq.js";import{B as I,o as B,w as W}from"./index-DwuduZw_.js";import"./base-ui-BxmCGIFY.js";function X(s){let n=[],t=0,l=1;const a=new Map,i=[];for(const m of s){let d=n.indexOf(m.oid);const j=d>=0;d<0&&(d=n.length,n=[...n,m.oid]);const p=n,g=K(a,m.oid,()=>t++),u=p.filter((r,h)=>h!==d);let c=Math.min(d,u.length);m.parentOids.forEach((r,h)=>{a.has(r)||a.set(r,h===0?g:t++),!u.includes(r)&&(u.splice(c,0,r),c+=1)});const N=[];p.forEach((r,h)=>{if(h===d){j&&N.push({fromLane:h,from:"top",toLane:d,to:"node",color:a.get(r)??g});return}const C=u.indexOf(r);C>=0&&N.push({fromLane:h,from:"top",toLane:C,to:"bottom",color:a.get(r)??0})}),m.parentOids.forEach(r=>{const h=u.indexOf(r);h>=0&&N.push({fromLane:d,from:"node",toLane:h,to:"bottom",color:a.get(r)??g})}),l=Math.max(l,p.length,u.length),i.push({lane:d,color:g,segments:N,continuations:u.map((r,h)=>({lane:h,color:a.get(r)??0}))}),n=u}return{rows:i,laneCount:l}}function K(s,n,t){const l=s.get(n);if(l!==void 0)return l;const a=t();return s.set(n,a),a}function ue({repositoryId:s,upstream:n,readOnly:t,operation:l,commits:a,nextCursor:i,loading:m,undoing:d,onSelectCommit:j,onSelectFile:p,onUndo:g,onMore:u}){const c=w.useRef(null),[N,r]=w.useState(new Set),h=w.useMemo(()=>X(a??[]),[a]),C=J(h.laneCount),E=M({count:a?.length??0,getScrollElement:()=>c.current,estimateSize:()=>52,getItemKey:x=>a?.[x]?.oid??x,overscan:8});return a===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(O,{className:"spinner"})," ",e.jsx(D,{text:"Loading history…"})]}):e.jsxs("div",{className:"history-list",children:[!n&&a.length>0&&e.jsx("div",{className:"history-upstream-notice",role:"status",children:"Configure an upstream to distinguish local from published commits."}),e.jsx("div",{ref:c,className:"history-scroll",role:"list","aria-label":"Commit history",children:a.length===0?e.jsx("p",{className:"empty-list",children:"This repository has no commits yet."}):e.jsxs("div",{className:"virtual-list",style:{height:E.getTotalSize()+(i?52:0)},children:[E.getVirtualItems().map(x=>{const f=a[x.index];return e.jsx("div",{ref:E.measureElement,"data-index":x.index,className:"virtual-row",style:{transform:`translateY(${x.start}px)`},children:e.jsx(q,{repositoryId:s,upstream:n,commit:f,graphRow:h.rows[x.index],graphWidth:C,expanded:N.has(f.oid),onExpandedChange:T=>r(R=>{const o=new Set(R);return T?o.add(f.oid):o.delete(f.oid),o}),canUndo:!t&&!l&&!d&&f.upstreamState==="local-only"&&f.isHead&&f.parentCount===1,onSelectCommit:j,onSelectFile:p,onUndo:g})},x.key)}),i&&e.jsx(I,{variant:"ghost",className:"history-more",style:{top:E.getTotalSize()},disabled:m,onClick:u,children:m?"Loading…":"Load more"})]})})]})}function q({repositoryId:s,upstream:n,commit:t,graphRow:l,graphWidth:a,expanded:i,onExpandedChange:m,canUndo:d,onSelectCommit:j,onSelectFile:p,onUndo:g}){const u=`${s}:${t.oid}`,[c,N]=w.useState(()=>P(u)??null),[r,h]=w.useState(null);w.useEffect(()=>{if(!i||c||r)return;let o=!0;return B.commits.files(s,t.oid).then(b=>{o&&(_(u,b),N(b))}).catch(b=>{o&&h(re(b))}),()=>{o=!1}},[u,t.oid,i,c,r,s]);const C=se(t.decorations),E=C.slice(0,3),x=C.slice(3),f=c?.reduce((o,b)=>o+b.additions,0)??0,T=c?.reduce((o,b)=>o+b.deletions,0)??0,R=async()=>{try{await W(t.oid),F.success({title:"Hash copied",description:t.oid})}catch{F.error({title:"Could not copy hash"})}};return e.jsxs("div",{className:"commit-item",role:"listitem",children:[e.jsxs("div",{className:"commit-header",children:[e.jsx(Q,{graph:l,width:a}),e.jsx("button",{className:"commit-expand","aria-expanded":i,"aria-label":i?"Collapse commit":"Expand commit",onClick:()=>m(!i),children:e.jsx(G,{className:`folder-chevron ${i?"open":""}`})}),e.jsxs("div",{className:"commit-main",children:[e.jsxs("span",{className:"commit-title-row",children:[e.jsxs(y,{children:[e.jsx(v,{render:e.jsx("button",{className:"commit-subject",onClick:()=>j(t)}),children:t.subject||"(no subject)"}),e.jsx($,{side:"right",children:"View the full commit diff"})]}),e.jsxs(y,{children:[e.jsx(v,{render:e.jsx("span",{className:"commit-date"}),children:ae(t.date)}),e.jsx($,{children:oe(t.date)})]})]}),e.jsxs("span",{className:"commit-meta",children:[e.jsxs(y,{children:[e.jsx(v,{render:e.jsx("button",{className:"commit-oid",onClick:()=>{R()},"aria-label":`Copiar hash ${t.shortOid}`}),children:t.shortOid}),e.jsx($,{children:"Copy full hash"})]}),e.jsx("span",{className:"commit-author",children:t.author}),(C.length>0||t.parentCount>1||t.upstreamState==="local-only")&&e.jsxs("span",{className:"commit-refs",children:[t.upstreamState==="local-only"&&e.jsxs(y,{children:[e.jsx(v,{render:e.jsx("span",{className:"ref-chip local-only"}),children:"Local"}),e.jsx($,{children:t.isHead?`Not in ${n??"the upstream"} according to the latest known remote state.`:"Not published. To avoid rewriting multiple commits, only the latest can be undone."})]}),t.parentCount>1&&e.jsx("span",{className:"ref-chip merge",children:"merge"}),E.map(o=>e.jsx("span",{className:`ref-chip ${o.kind}`,children:o.label},`${o.kind}:${o.label}`)),x.length>0&&e.jsxs(y,{children:[e.jsxs(v,{render:e.jsx("span",{className:"ref-chip more"}),children:["+",x.length]}),e.jsx($,{children:x.map(o=>o.label).join(" · ")})]})]})]})]}),d&&e.jsxs(y,{children:[e.jsx(v,{render:e.jsx(I,{variant:"ghost",size:"icon-xs",className:"change-action-button commit-undo",onClick:o=>{o.stopPropagation(),g(t)},"aria-label":`Undo commit ${t.shortOid}`}),children:e.jsx(z,{})}),e.jsx($,{children:"Undo commit and keep its changes staged"})]})]}),i&&l.continuations.length>0&&e.jsx(Z,{graph:l,width:a}),i&&e.jsxs("div",{className:"commit-files",style:{paddingLeft:a+31},children:[t.body&&e.jsx("p",{className:"commit-description",children:t.body}),r&&e.jsx("div",{className:"commit-files-message error",children:r}),!c&&!r&&e.jsxs("div",{className:"commit-files-message",children:[e.jsx(O,{className:"spinner"})," ",e.jsx(D,{text:"Loading files…"})]}),c&&c.length===0&&e.jsx("div",{className:"commit-files-message",children:"This commit does not modify its own files (merge)."}),c&&c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"commit-files-summary",children:[c.length," ",c.length===1?"file":"files",(f>0||T>0)&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{className:"add",children:["+",f]})," ",e.jsxs("span",{className:"del",children:["−",T]})]})]}),c.map(o=>e.jsx(ee,{file:o,onSelect:()=>p(t.oid,o)},o.path))]})]})]})}const V=10,S=26,A=52,H=["var(--primary)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"];function J(s){return 14+Math.max(0,s-1)*V}function k(s){return 7+s*V}function L(s){return H[s%H.length]}function Q({graph:s,width:n}){return e.jsxs("svg",{className:"commit-graph",width:n,height:A,viewBox:`0 0 ${n} ${A}`,"aria-hidden":"true",children:[s.segments.map((t,l)=>{const a=k(t.fromLane),i=k(t.toLane),m=t.from==="top"?0:S,d=t.to==="node"?S:A,j=(m+d)/2,p=a===i?`M ${a} ${m} L ${i} ${d}`:`M ${a} ${m} C ${a} ${j}, ${i} ${j}, ${i} ${d}`;return e.jsx("path",{d:p,stroke:L(t.color)},`${l}:${p}`)}),e.jsx("circle",{cx:k(s.lane),cy:S,r:"4",fill:"var(--sidebar)",stroke:L(s.color)}),e.jsx("circle",{cx:k(s.lane),cy:S,r:"1.5",fill:L(s.color)})]})}function Z({graph:s,width:n}){return e.jsx("svg",{className:"commit-graph-continuation",width:n,viewBox:`0 0 ${n} 100`,preserveAspectRatio:"none","aria-hidden":"true",children:s.continuations.map(t=>e.jsx("line",{x1:k(t.lane),y1:"0",x2:k(t.lane),y2:"100",stroke:L(t.color)},t.lane))})}function ee({file:s,onSelect:n}){const t=w.useRef(null),l=s.path.lastIndexOf("/"),a=l<0?s.path:s.path.slice(l+1),i=s.oldPath?.split("/").pop();return e.jsxs("div",{ref:t,className:"commit-file-row",children:[e.jsxs(y,{children:[e.jsxs(v,{render:e.jsx("button",{className:"commit-file-label",onClick:n,"aria-label":`Ver el diff de ${s.path}`}),children:[e.jsx(ie,{path:s.path,type:"file"}),e.jsxs("span",{className:"commit-file-text",children:[e.jsx("span",{children:a}),i&&e.jsxs("small",{className:"commit-file-rename",children:[i," →"]})]})]}),e.jsx($,{anchor:t,side:"right",sideOffset:10,children:s.oldPath?`${s.oldPath} → ${s.path}`:s.path})]}),e.jsx("span",{className:"commit-file-stats",children:s.binary?e.jsx("span",{className:"binary",children:"bin"}):e.jsxs(e.Fragment,{children:[s.additions>0&&e.jsxs("span",{className:"add",children:["+",s.additions]}),s.deletions>0&&e.jsxs("span",{className:"del",children:["−",s.deletions]})]})}),e.jsx("span",{className:"status-code","data-kind":s.kind,children:U(s.kind)})]})}function se(s){return s.map(n=>n.startsWith("tag: ")?{label:n.slice(5),kind:"tag"}:n.startsWith("HEAD -> ")?{label:n.slice(8),kind:"head"}:n==="HEAD"?{label:"HEAD",kind:"head"}:{label:n,kind:n.includes("/")?"remote":"branch"})}const te=new Intl.RelativeTimeFormat("en",{numeric:"auto"}),ne=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function ae(s){const n=new Date(s);if(Number.isNaN(n.getTime()))return s;const t=Math.round((n.getTime()-Date.now())/1e3);for(const[l,a]of ne)if(Math.abs(t)>=a)return te.format(Math.trunc(t/a),l);return"right now"}function oe(s){const n=new Date(s);return Number.isNaN(n.getTime())?s:new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"}).format(n)}function ie({path:s}){return e.jsx("img",{className:"vscode-tree-icon",src:Y(s),alt:"","aria-hidden":"true",draggable:!1})}function re(s){return s instanceof Error?s.message:"An unexpected error occurred."}export{ue as HistoryView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,r}from"./react-rd22PHbN.js";import{c as V,B as x}from"./index-DwuduZw_.js";import{T as k,o as T,q as O}from"./App-1nMyZ0Eq.js";import{V as U,b as C,a as B}from"./viewer-tabs-B_boC13j.js";import{u as W,S as P,F as H}from"./EditableFileViewer-4ap_dRdR.js";import"./tanstack-BEeM5REq.js";import"./base-ui-BxmCGIFY.js";import"./PierreWorkerPool-CRVJ90kq.js";import"./platform-BMNQ8V5r.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";import"./index-CtEztN1P.js";import"./File-C25AAfq1.js";import"./EditContext-CvJWfVl1.js";import"./PierreEditBoundary-YYf1awXS.js";const K=[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M7 10l6 0",key:"svg-1"}],["path",{d:"M10 7l0 6",key:"svg-2"}],["path",{d:"M21 21l-6 -6",key:"svg-3"}]],q=V("outline","zoom-in","ZoomIn",K);const X=[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M7 10l6 0",key:"svg-1"}],["path",{d:"M21 21l-6 -6",key:"svg-2"}]],Y=V("outline","zoom-out","ZoomOut",X),Z=.25,S=8,D=[.25,.5,.75,1,1.25,1.5,2,3,4,6,8];function $(e){return Number.isFinite(e)?Math.min(S,Math.max(Z,e)):1}function L(e){const s=$(e);return D.find(n=>n>s+Number.EPSILON)??S}function _(e){const s=$(e);return[...D].reverse().find(n=>n<s-Number.EPSILON)??Z}const J={conflictTitle:"SVG was changed outside OpenTig",successTitle:"SVG saved",errorTitle:"Could not save SVG"};function ve({image:e}){return e.status==="unsupported"?t.jsx(y,{title:"Image format is not supported",detail:`${e.path} · ${M(e.size)}`}):e.status==="too-large"?t.jsx(y,{title:"Image is too large to preview",detail:`${e.path} · ${M(e.size)} · limit ${M(e.limit)}`}):t.jsx(Q,{path:e.path,mimeType:e.mimeType,size:e.size,data:e.data})}function Q({path:e,mimeType:s,size:n,data:d}){const c=F(d,s);return t.jsx(R,{objectUrl:c,path:e,size:n})}function fe({file:e,initialContent:s,themeType:n,wrapLines:d,readOnly:c,onDirtyChange:i,onDraftChange:o,onSave:u}){const[m,l]=r.useState("preview"),{draft:g,updateDraft:N,dirty:v,saving:f,save:j}=W({file:e,initialContent:s,readOnly:c,messages:J,onDirtyChange:i,onDraftChange:o,onSave:u}),w=F(g,"image/svg+xml");r.useEffect(()=>{l("preview")},[e.path]);const b=t.jsx(B,{label:"SVG view",className:"file-viewer-tabs image-viewer-tabs",items:[{value:"preview",label:"Preview"},{value:"code",label:t.jsxs(t.Fragment,{children:["Code ",v&&t.jsx("span",{className:"image-unsaved-dot","aria-label":"Unsaved changes"})]})}]}),p=t.jsx(H,{dirty:v,saving:f,readOnly:c,onSave:()=>{j()}});return t.jsxs(U,{value:m,onValueChange:a=>l(a),className:"svg-file-viewer",children:[t.jsx(C,{value:"preview",className:"svg-file-panel",children:t.jsx(R,{objectUrl:w,path:e.path,size:new TextEncoder().encode(g).byteLength,toolbarStart:b,toolbarEnd:p})}),t.jsxs(C,{value:"code",className:"svg-file-panel",children:[t.jsxs("div",{className:"file-viewer-pill svg-file-toolbar",children:[b,p]}),t.jsx("div",{className:"svg-code-view",children:t.jsx(P,{path:e.path,cacheKey:e.path,value:g,themeType:n,wrapLines:d,readOnly:c||f,onChange:N})})]})]})}function R({objectUrl:e,path:s,size:n,toolbarStart:d,toolbarEnd:c}){const[i,o]=r.useState("fit"),[u,m]=r.useState(1),[l,g]=r.useState(null),[N,v]=r.useState(!1),f=r.useRef(null);r.useEffect(()=>{g(null),v(!1)},[e]),r.useEffect(()=>{const a=f.current;if(!a)return;let h=0;const z=E=>{E.preventDefault();const A=E.deltaMode===WheelEvent.DOM_DELTA_LINE?16:E.deltaMode===WheelEvent.DOM_DELTA_PAGE?100:1;if(h+=E.deltaY*A,Math.abs(h)<24)return;const G=h<0;h=0,o("actual"),m(I=>G?L(I):_(I))};return a.addEventListener("wheel",z,{passive:!1}),()=>a.removeEventListener("wheel",z)},[]);const j=l?l.width*u:void 0,w=l?l.height*u:void 0,b=[M(n),l?`${l.width} × ${l.height}`:null].filter(Boolean).join(" · "),p=a=>{o("actual"),m(h=>a==="in"?L(h):_(h))};return t.jsxs("div",{className:"image-preview-workspace",children:[t.jsxs("div",{className:"file-viewer-pill image-preview-toolbar",children:[d,t.jsx("span",{className:"image-file-details",children:b}),t.jsxs("div",{className:"image-sizing-toggle",role:"group","aria-label":"Image size",children:[t.jsx(x,{type:"button",size:"xs",variant:i==="fit"?"secondary":"ghost","aria-pressed":i==="fit",onClick:()=>o("fit"),children:"Fit"}),t.jsx(x,{type:"button",size:"xs",variant:i==="actual"&&u===1?"secondary":"ghost","aria-pressed":i==="actual"&&u===1,onClick:()=>{o("actual"),m(1)},children:"1:1"})]}),t.jsxs("div",{className:"image-zoom-controls",children:[t.jsxs(k,{children:[t.jsx(T,{render:t.jsx(x,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Zoom out",onClick:()=>p("out")}),children:t.jsx(Y,{})}),t.jsx(O,{children:"Zoom out"})]}),t.jsxs(x,{type:"button",variant:"ghost",size:"xs",className:"image-zoom-value","aria-label":"Reset zoom to 100%",onClick:()=>{o("actual"),m(1)},children:[Math.round(u*100),"%"]}),t.jsxs(k,{children:[t.jsx(T,{render:t.jsx(x,{type:"button",variant:"ghost",size:"icon-xs","aria-label":"Zoom in",onClick:()=>p("in")}),children:t.jsx(q,{})}),t.jsx(O,{children:"Zoom in"})]})]}),c]}),t.jsx("div",{ref:f,className:"image-preview-canvas","data-sizing":i,"data-zoom-limit":u>=S?"max":"normal",tabIndex:0,"aria-label":`Image preview for ${s}`,onKeyDown:a=>{if(a.key==="+"||a.key==="=")p("in");else if(a.key==="-")p("out");else if(a.key==="0")o("actual"),m(1);else if(a.key.toLowerCase()==="f")o("fit");else return;a.preventDefault()},children:e?N?t.jsx(y,{title:"Could not decode this image",detail:s}):t.jsx("img",{src:e,alt:ee(s),draggable:!1,style:i==="actual"&&j&&w?{width:j,height:w,maxWidth:"none",maxHeight:"none"}:void 0,onLoad:a=>{v(!1),g({width:a.currentTarget.naturalWidth,height:a.currentTarget.naturalHeight})},onError:()=>v(!0)}):t.jsx("span",{className:"image-preview-loading",children:"Loading image…"})})]})}function y({title:e,detail:s}){return t.jsxs("div",{className:"image-viewer-message",children:[t.jsx("strong",{children:e}),t.jsx("span",{children:s})]})}function F(e,s){const[n,d]=r.useState(null);return r.useEffect(()=>{const c=typeof e=="string"?e:new Uint8Array(e),i=URL.createObjectURL(new Blob([c],{type:s}));return d(i),()=>{URL.revokeObjectURL(i),d(o=>o===i?null:o)}},[s,e]),n}function ee(e){return e.replace(/\\/g,"/").split("/").pop()||e}function M(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}export{ve as ImageFileViewer,fe as SvgFileViewer};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DDbUjVD9.js","assets/platform-BMNQ8V5r.js","assets/index-BgLrS_2D.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as u,r as c}from"./index-DwuduZw_.js";import{r as o,j as i}from"./react-rd22PHbN.js";import{E as f}from"./EditContext-CvJWfVl1.js";import{C as E}from"./App-1nMyZ0Eq.js";import"./tanstack-BEeM5REq.js";import"./base-ui-BxmCGIFY.js";const d=o.createContext(!1);function P({enabled:a,children:s}){const[r,n]=o.useState(null);o.useEffect(()=>{if(!a||r)return;let e=!0;return u(()=>import("./index-DDbUjVD9.js"),__vite__mapDeps([0,1,2])).then(t=>{e&&n(()=>t.Editor)}).catch(t=>{e&&E.error({title:"Could not load the code editor",description:t instanceof Error?t.message:"Unknown error"})}),()=>{e=!1}},[r,a]);const l=o.useCallback(e=>{if(!r)throw new Error("Pierre edit mode has not loaded.");return new r({clipboard:{readText:()=>c()},...e})},[r]);return r?i.jsx(f,{createEditor:l,children:i.jsx(d.Provider,{value:!0,children:s})}):i.jsx(d.Provider,{value:!1,children:s})}export{d as EditReadyContext,P as PierreEditBoundary};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,j as e}from"./react-rd22PHbN.js";import{u as S}from"./tanstack-BEeM5REq.js";import{q as b,B as m,o as q}from"./index-DwuduZw_.js";import{S as T,T as w,o as D,E as P,F as E,q as H,G as R,H as $,l as z,k as B,J as I}from"./App-1nMyZ0Eq.js";import{D as K}from"./DiffWorkspace-CZH8jCtn.js";import{P as L}from"./PierreWorkerPool-CRVJ90kq.js";import"./base-ui-BxmCGIFY.js";import"./platform-BMNQ8V5r.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";import"./EditContext-CvJWfVl1.js";import"./index-CtEztN1P.js";function Z({diff:n,prNumber:a,repositoryId:u,commits:l,diffView:g,themeType:j,wrapLines:v,onDiffViewChange:y,onWrapLinesChange:C,onClose:N}){const[o,p]=d.useState("all"),[x,k]=d.useState(l[0]?.oid??""),i=d.useMemo(()=>l.find(s=>s.oid===x)??l[0]??null,[l,x]),r=S({queryKey:b.pullRequestCommitDiff(u,i?.oid??""),queryFn:()=>q.github.getPullRequestCommitDiff(u,i.oid),enabled:o==="commit"&&i!==null}),h=r.error instanceof Error?r.error.message:r.error?"Could not load the commit diff.":null,t=e.jsxs("div",{className:"pr-code-scope",children:[e.jsxs("div",{className:"pr-code-mode",role:"group","aria-label":"Pull request code grouping",children:[e.jsx(m,{type:"button",variant:o==="all"?"secondary":"ghost",size:"xs","aria-pressed":o==="all",onClick:()=>p("all"),children:"All changes"}),e.jsx(m,{type:"button",variant:o==="commit"?"secondary":"ghost",size:"xs","aria-pressed":o==="commit",disabled:l.length===0,onClick:()=>p("commit"),children:"By commit"})]}),o==="commit"&&i&&e.jsxs(T,{value:i.oid,onValueChange:s=>{s&&k(s)},children:[e.jsxs(w,{children:[e.jsx(D,{render:e.jsx(E,{className:"pr-commit-select",size:"sm","aria-label":"Commit"}),children:e.jsxs(P,{children:[i.oid.slice(0,7)," · ",i.messageHeadline||"(no commit message)"]})}),e.jsxs(H,{children:[i.oid.slice(0,7)," · ",i.messageHeadline||"(no commit message)"]})]}),e.jsx(R,{align:"start",alignItemWithTrigger:!1,className:"pr-commit-menu",children:l.map(s=>e.jsxs($,{value:s.oid,label:`${s.oid.slice(0,7)} ${s.messageHeadline||"(no commit message)"}`,children:[e.jsx("span",{className:"shrink-0 self-start font-mono text-xs text-muted-foreground",children:s.oid.slice(0,7)}),e.jsx("span",{className:"min-w-0 whitespace-normal break-words",children:s.messageHeadline||"(no commit message)"})]},s.oid))})]})]}),c=o==="all"?n:r.data??null;return o==="commit"&&h?e.jsxs(f,{scopeControl:t,children:[e.jsx("p",{className:"text-destructive",children:h}),e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>{r.refetch()},children:[e.jsx(z,{})," Try again"]})]}):c?c.patch?e.jsx(L,{children:e.jsx(K,{contentKey:o==="all"?`pull:${a}:all`:`pull:${a}:commit:${i?.oid??""}`,diff:c,diffView:g,themeType:j,wrapLines:v,initiallyCollapsed:!0,scopeControl:t,onDiffViewChange:y,onWrapLinesChange:C,onClose:N})}):e.jsx(f,{scopeControl:t,children:"No differences to show."}):e.jsxs(f,{scopeControl:t,children:[e.jsx(B,{className:"spinner"})," ",e.jsx(I,{text:"Loading commit diff…"})]})}function f({scopeControl:n,children:a}){return e.jsxs("div",{className:"diff-workspace",children:[e.jsx("div",{className:"diff-workspace-toolbar",children:e.jsx("div",{className:"diff-workspace-scope",children:n})}),e.jsx("div",{className:"viewer-message flex-col gap-3",children:a})]})}export{Z as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestDiff-BWdKV4LM.js","assets/react-rd22PHbN.js","assets/tanstack-BEeM5REq.js","assets/base-ui-BxmCGIFY.js","assets/index-DwuduZw_.js","assets/index-Bm8fY0Qs.css","assets/App-1nMyZ0Eq.js","assets/DiffWorkspace-CZH8jCtn.js","assets/PierreWorkerPool-CRVJ90kq.js","assets/platform-BMNQ8V5r.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-CtEztN1P.js","assets/EditContext-CvJWfVl1.js","assets/render-markdown-BnNqckxy.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as G,B as C,_ as R,o as k,q}from"./index-DwuduZw_.js";import{r as j,j as e}from"./react-rd22PHbN.js";import{u as T}from"./tanstack-BEeM5REq.js";import{l as S,k as h,J as p,B as I,h as H,v as F,A as V,T as M,o as $,q as O}from"./App-1nMyZ0Eq.js";import{V as B,a as z,b as x}from"./viewer-tabs-B_boC13j.js";import{p as K,r as Q,o as U}from"./gh-utils-XOjL-WGw.js";import{G as _,I as J,a as X,b as W}from"./GitHubAvatar-DV6lI4Jh.js";/* empty css */import"./base-ui-BxmCGIFY.js";const Y=[["path",{d:"M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3",key:"svg-1"}]],Z=G("outline","tag","Tag",Y),ee=j.lazy(()=>R(()=>import("./PullRequestDiff-BWdKV4LM.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function me({repositoryId:r,prNumber:i,diffView:n,themeType:d,wrapLines:l,onDiffViewChange:m,onWrapLinesChange:o,onClose:P}){const[v,A]=j.useState("summary"),t=T({queryKey:q.pullRequest(r,i),queryFn:async()=>{const a=await k.github.getPullRequest(r,i),E=a.body.trim()?await R(async()=>{const{renderMarkdown:u}=await import("./render-markdown-BnNqckxy.js").then(D=>D.a);return{renderMarkdown:u}},__vite__mapDeps([14,6,4,1,2,3,5,10,11])).then(({renderMarkdown:u})=>u(a.body)).catch(()=>"<p>Could not render the description.</p>"):"";return{details:a,bodyHtml:E}}}),s=t.data?.details??null,f=t.data?.bodyHtml??"",N=t.error instanceof Error?t.error.message:t.error?"Could not load the pull request.":null,c=T({queryKey:q.pullRequestDiff(r,i),queryFn:()=>k.github.getPullRequestDiff(r,i),enabled:v==="diff"&&s!==null}),b=c.data??null,g=c.error instanceof Error?c.error.message:c.error?"Could not load the diff.":null;if(N)return e.jsxs("div",{className:"viewer-message flex-col gap-3",children:[e.jsx("p",{className:"text-destructive",children:N}),e.jsxs(C,{variant:"outline",size:"sm",onClick:()=>{t.refetch()},children:[e.jsx(S,{})," Try again"]})]});if(!s)return e.jsxs("div",{className:"viewer-message",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(p,{text:`Loading pull request #${i}…`})]});const w=K(s),y=Q(s.reviewDecision);return e.jsxs(B,{value:v,onValueChange:a=>A(a),className:"pr-viewer",children:[e.jsxs("header",{className:"pr-viewer-header",children:[e.jsxs("div",{className:"pr-viewer-overview",children:[e.jsxs("div",{className:"pr-viewer-title",children:[e.jsx(I,{variant:s.state==="OPEN"&&!s.isDraft?"default":"secondary",className:`pr-state-badge ${w.toLowerCase().replace(/\s+/g,"-")}`,children:w}),e.jsxs("h2",{children:[s.title||"(no title)"," ",e.jsxs("span",{className:"pr-number",children:["#",s.number]})]})]}),e.jsxs("div",{className:"pr-viewer-meta",children:[e.jsxs("span",{className:"pr-author-with-avatar",children:[e.jsx(_,{src:s.authorAvatarUrl,className:"pr-author-avatar"},s.authorAvatarUrl),e.jsx("span",{className:"pr-author",children:s.author})]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{children:["updated ",L(s.updatedAt)]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-branches",children:[e.jsx(H,{"aria-hidden":"true"})," ",s.headRefName," → ",s.baseRefName]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-counters",children:[s.changedFiles," ",s.changedFiles===1?"file":"files"," ",e.jsxs("span",{className:"add",children:["+",s.additions]})," ",e.jsxs("span",{className:"del",children:["−",s.deletions]})]}),e.jsx(se,{state:s.checksState}),y&&e.jsx(I,{variant:"outline",className:"pr-review-badge",children:y}),e.jsx("span",{className:"pr-viewer-actions",children:e.jsxs(C,{variant:"outline",size:"xs",onClick:()=>U(s.url),children:[e.jsx(F,{})," Open on GitHub"]})})]}),s.labels.length>0&&e.jsxs("div",{className:"pr-labels","aria-label":"Pull request labels",children:[e.jsx(Z,{"aria-hidden":"true"}),s.labels.map(a=>e.jsx("span",{className:"pr-label",style:{borderColor:`#${a.color}`,backgroundColor:`#${a.color}22`},children:a.name},`${a.name}-${a.color}`))]})]}),e.jsx(z,{label:"Pull request view",className:"markdown-viewer-tabs pr-viewer-tabs",items:[{value:"summary",label:"Summary"},{value:"timeline",label:"Timeline"},{value:"diff",label:"Code"}]})]}),e.jsx(x,{value:"summary",className:"markdown-preview-scroll pr-description-scroll",children:e.jsx("section",{className:"pr-summary-section",children:f?e.jsx("div",{className:"markdown-prose",dangerouslySetInnerHTML:{__html:f}}):e.jsx("p",{className:"pr-empty-description",children:"This pull request has no description."})})}),e.jsx(x,{value:"timeline",className:"markdown-preview-scroll pr-description-scroll",children:e.jsxs("section",{className:"pr-timeline standalone","aria-label":"Commit timeline",children:[e.jsxs("h3",{children:[e.jsx(V,{"aria-hidden":"true"})," Commits ",e.jsx("span",{children:s.commits.length})]}),s.commits.length?s.commits.map(a=>e.jsxs("article",{className:"pr-timeline-item",children:[e.jsx("span",{className:"pr-timeline-rail",children:e.jsx("span",{})}),e.jsx(_,{src:a.authorAvatarUrl,className:"pr-commit-avatar"}),e.jsxs("span",{className:"pr-commit-content",children:[e.jsx("strong",{children:a.messageHeadline||"(no commit message)"}),e.jsxs("span",{children:[e.jsx("b",{children:a.author})," committed ",L(a.authoredAt)]})]}),e.jsxs(M,{children:[e.jsx($,{render:e.jsx("code",{}),children:a.oid.slice(0,7)}),e.jsx(O,{children:a.oid})]})]},a.oid)):e.jsx("p",{className:"pr-empty-description",children:"No commits were returned by GitHub."})]})}),e.jsx(x,{value:"diff",className:"pr-diff-panel",children:g?e.jsx("div",{className:"viewer-message text-destructive",children:g}):b?e.jsx(j.Suspense,{fallback:e.jsxs("div",{className:"viewer-message",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(p,{text:"Loading diff viewer…"})]}),children:e.jsx(ee,{diff:b,prNumber:s.number,repositoryId:r,commits:s.commits,diffView:n,themeType:d,wrapLines:l,onDiffViewChange:m,onWrapLinesChange:o,onClose:P})}):e.jsxs("div",{className:"viewer-message",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(p,{text:"Loading diff…"})]})})]})}function se({state:r}){if(r==="NONE")return null;const i=r==="PASSING"?J:r==="FAILING"?X:W,n=r==="PASSING"?"Checks passing":r==="FAILING"?"Checks failing":"Checks pending";return e.jsxs("span",{className:`pr-checks ${r.toLowerCase()}`,children:[e.jsx(i,{"aria-hidden":"true"})," ",n]})}function L(r){const i=Date.parse(r);if(!Number.isFinite(i))return r;const n=Math.round((i-Date.now())/1e3),d=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]],l=new Intl.RelativeTimeFormat(void 0,{numeric:"auto"});for(const[m,o]of d)if(Math.abs(n)>=o)return l.format(Math.round(n/o),m);return l.format(n,"second")}export{me as PullRequestViewer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as b}from"./react-rd22PHbN.js";import{a as p}from"./tanstack-BEeM5REq.js";import{c as N,B as t,a as f}from"./index-DwuduZw_.js";import{C as k}from"./checkbox-vpy6b6Uq.js";import{k as h,J as x,l as j,T as c,o,q as u,a4 as I,W as y,v as S}from"./App-1nMyZ0Eq.js";import{o as w}from"./gh-utils-XOjL-WGw.js";import{G as P,I as R,a as E,b as G}from"./GitHubAvatar-DV6lI4Jh.js";import{P as L,i as O,j as D,k as T,l as M}from"./base-ui-BxmCGIFY.js";const q=[["path",{d:"M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5",key:"svg-0"}]],d=N("outline","brand-github","BrandGithub",q);const z=[["path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227",key:"svg-0"}]],$=N("outline","filter","Filter",z);const A=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M7 8a4 4 0 0 0 4 4h4",key:"svg-4"}]],H=N("outline","git-merge","GitMerge",A);function ae(s){return s.info===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Checking repository…"})]}):s.info.isGitHub?s.ghStatus===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Checking GitHub CLI…"})]}):s.ghStatus.installed?s.ghStatus.authStatus==="unauthenticated"?e.jsxs(m,{icon:e.jsx(d,{}),title:"Sign in to GitHub CLI",children:["Run ",e.jsx("code",{children:"gh auth login"})," in a terminal to authenticate, then check again.",e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsxs(t,{variant:"outline",size:"sm",onClick:()=>s.onCopyCommand("gh auth login"),children:[e.jsx(f,{})," Copy command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]})]}):e.jsx(F,{...s,nameWithOwner:s.info.nameWithOwner??""}):e.jsxs(m,{icon:e.jsx(d,{}),title:"GitHub CLI is required",children:["OpenTig uses your local ",e.jsx("code",{children:"gh"})," session to read and create pull requests. It does not copy or store credentials.",e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsxs(t,{variant:"outline",size:"sm",onClick:()=>s.onCopyCommand("winget install GitHub.cli"),children:[e.jsx(f,{})," Copy install command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]}),e.jsx("small",{children:"Download from cli.github.com, then check again."})]}):e.jsxs(m,{icon:e.jsx(d,{}),title:"Not a GitHub repository",children:["The ",e.jsx("code",{children:"origin"})," remote does not point to github.com, so pull requests are unavailable here."]})}function F(s){const l=b.useRef(null),n=s.pulls,i=p({count:n?.length??0,getScrollElement:()=>l.current,estimateSize:()=>68,getItemKey:a=>n?.[a]?.number??a,overscan:8});return e.jsxs("div",{className:"pulls-view",children:[e.jsxs("div",{className:"pulls-toolbar",children:[e.jsxs(c,{children:[e.jsxs(o,{render:e.jsx("span",{className:"pulls-repo"}),children:[e.jsx(d,{"aria-hidden":"true"})," ",s.nameWithOwner]}),e.jsx(u,{children:s.nameWithOwner})]}),e.jsxs(c,{children:[e.jsx(o,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button",disabled:s.loading,onClick:s.onRefresh,"aria-label":"Refresh pull requests"}),children:s.loading?e.jsx(h,{className:"animate-spin"}):e.jsx(j,{})}),e.jsx(u,{children:"Refresh pull requests"})]}),e.jsxs(L,{children:[e.jsx(O,{render:e.jsx(t,{variant:v(s.states)?"ghost":"secondary",size:"icon-xs",className:"change-action-button","aria-label":"Filter pull requests","aria-pressed":!v(s.states)}),children:e.jsx($,{})}),e.jsx(D,{children:e.jsx(T,{side:"bottom",align:"end",sideOffset:4,className:"isolate z-50 outline-none",children:e.jsxs(M,{className:"pulls-filter-popup",children:[e.jsx("span",{className:"pulls-filter-title",children:"State"}),["OPEN","CLOSED","MERGED"].map(a=>e.jsxs("label",{htmlFor:`pulls-state-${a.toLowerCase()}`,className:"pulls-filter-option",children:[e.jsx(k,{id:`pulls-state-${a.toLowerCase()}`,checked:s.states.includes(a),onCheckedChange:r=>s.onStateChange(a,r===!0)}),e.jsx(C,{state:a,className:a.toLowerCase()}),e.jsx("span",{children:a==="OPEN"?"Open":a==="CLOSED"?"Closed":"Merged"})]},a))]})})})]}),e.jsxs(c,{children:[e.jsxs(o,{render:e.jsx(t,{variant:"outline",size:"xs",disabled:!!s.createDisabledReason||s.loading,onClick:s.onCreate,"aria-label":"Create pull request"}),children:[e.jsx(I,{})," New"]}),e.jsx(u,{children:s.createDisabledReason??"Create a pull request from the current branch"})]})]}),s.error&&e.jsxs("div",{className:"pulls-error",role:"alert",children:[e.jsx("span",{children:s.error}),e.jsx(t,{variant:"ghost",size:"xs",onClick:s.onRefresh,children:"Retry"})]}),e.jsx("div",{ref:l,className:"pulls-scroll",role:"list","aria-label":`${s.states.map(g).join(", ")||"No"} pull requests`,children:n===null&&!s.error?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Loading pull requests…"})]}):n!==null&&n.length===0?e.jsx("p",{className:"empty-list",children:s.states.length?`No ${s.states.map(a=>g(a).toLowerCase()).join(", ")} pull requests.`:"Select at least one PR state."}):n!==null&&e.jsx("div",{className:"virtual-list",style:{height:i.getTotalSize()},children:i.getVirtualItems().map(a=>{const r=n[a.index];return e.jsx("div",{ref:i.measureElement,"data-index":a.index,className:"virtual-row",style:{transform:`translateY(${a.start}px)`},children:e.jsx(_,{pr:r,active:s.activeNumber===r.number,onSelect:s.onSelect})},a.key)})})})]})}function _({pr:s,active:l,onSelect:n}){const i=s.state.toLowerCase(),a=U(s.updatedAt);return e.jsxs("div",{className:`pull-item ${l?"active":""}`,role:"listitem",children:[e.jsxs("button",{className:"pull-main",onClick:()=>n(s),"aria-label":`View pull request #${s.number}`,children:[e.jsx("span",{className:`pull-state-icon ${i}${s.isDraft?" draft":""}`,"aria-label":s.isDraft?"Draft":g(s.state),children:e.jsx(C,{state:s.state})}),e.jsxs("span",{className:"pull-content",children:[e.jsx("span",{className:"pull-title",children:s.title||"(no title)"}),e.jsxs("span",{className:"pull-meta",children:[e.jsxs("span",{className:"pull-number",children:["#",s.number]}),e.jsx(P,{src:s.authorAvatarUrl,className:"pull-avatar"}),e.jsx("span",{className:"pull-author",children:s.author}),e.jsx(V,{state:s.checksState}),s.isDraft&&e.jsx("span",{className:"pull-draft-label",children:"Draft"})]})]}),e.jsxs("span",{className:"pull-row-aside",children:[a&&e.jsx("span",{children:a}),e.jsxs("span",{className:"pull-line-stats",children:[e.jsxs("span",{className:"add",children:["+",s.additions]})," ",e.jsxs("span",{className:"del",children:["−",s.deletions]})]})]})]}),e.jsxs(c,{children:[e.jsx(o,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button pull-open-external",onClick:()=>w(s.url),"aria-label":`Open #${s.number} on GitHub`}),children:e.jsx(S,{})}),e.jsx(u,{children:"Open on GitHub"})]})]})}function C({state:s,className:l}){return s==="MERGED"?e.jsx(H,{"aria-hidden":"true",className:l}):e.jsx(y,{"aria-hidden":"true",className:l})}function V({state:s}){if(s==="NONE")return null;const l=s==="PASSING"?"Checks passing":s==="FAILING"?"Checks failing":"Checks pending",n=s==="PASSING"?R:s==="FAILING"?E:G;return e.jsx("span",{className:`pull-checks ${s.toLowerCase()}`,"aria-label":l,children:e.jsx(n,{"aria-hidden":"true"})})}function g(s){return s==="OPEN"?"Open":s==="CLOSED"?"Closed":"Merged"}function v(s){return s.length===1&&s[0]==="OPEN"}function m({icon:s,title:l,children:n}){return e.jsxs("div",{className:"pulls-notice",children:[e.jsx("span",{className:"pulls-notice-icon","aria-hidden":"true",children:s}),e.jsx("strong",{children:l}),e.jsx("p",{children:n})]})}const B=new Intl.RelativeTimeFormat("en",{numeric:"auto"}),W=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function U(s){const l=new Date(s);if(Number.isNaN(l.getTime()))return null;const n=Math.round((l.getTime()-Date.now())/1e3);for(const[i,a]of W)if(Math.abs(n)>=a)return B.format(Math.trunc(n/a),i);return"right now"}export{ae as PullRequestsView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,j as e}from"./react-rd22PHbN.js";import{D as Y,c as Q,d as Z,e as ee,g as I,I as se,m as k,a0 as z,k as P,a1 as _,z as E,T as w,o as C,a2 as ne,q as R,S as ae,F as ie,E as oe,G as re,H as O,a3 as te}from"./App-1nMyZ0Eq.js";import{c as M,B as o,o as h}from"./index-DwuduZw_.js";import{I as le}from"./IconFolderPlus-CE1ATVt-.js";import"./tanstack-BEeM5REq.js";import"./base-ui-BxmCGIFY.js";const ce=[["path",{d:"M3 21v-4a3 3 0 0 1 3 -3h5",key:"svg-0"}],["path",{d:"M8 17l3 -3l-3 -3",key:"svg-1"}],["path",{d:"M3 11v-5a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8",key:"svg-2"}]],de=M("outline","folder-symlink","FolderSymlink",ce);const me=[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]],he=M("outline","pencil","Pencil",me),B="__opentig_no_project__";function ve({open:l,projects:c,repositories:v,onOpenChange:L,onOrganizationChange:A,onForgetRepository:G,onRelocateRepository:S}){const[H,u]=r.useState(null),[x,f]=r.useState(null),[N,D]=r.useState(""),[g,d]=r.useState(null),[b,T]=r.useState(""),[J,p]=r.useState(null),[n,y]=r.useState(null),[$,m]=r.useState(null),K=r.useMemo(()=>new Map(c.flatMap(s=>s.repositoryKeys.map(a=>[a,s.id]))),[c]);r.useEffect(()=>{l||(u(null),f(null),d(null),p(null),m(null))},[l]);const j=async(s,a)=>{y(s),m(null);try{const t=await a();return A(t),!0}catch(t){return m(F(t)),!1}finally{y(null)}},V=async s=>{s.preventDefault();const a=N.trim();!a||n||await j("create",()=>h.projects.create(a))&&D("")},W=async s=>{s.preventDefault();const a=b.trim();!g||!a||n||await j(`rename:${g}`,()=>h.projects.rename(g,a))&&d(null)},X=async s=>{n||await j(`remove:${s}`,()=>h.projects.remove(s))&&p(null)},q=async(s,a)=>{n||await j(`assign:${s}`,()=>h.projects.assign(s,a))},U=async s=>{if(!n){if(m(null),!window.opentigDesktop){f(s);return}y(`relocate:${s.key}`);try{const a=await h.repository.select(`Relocate ${s.name}`);a&&await S(s,a)}catch(a){m(F(a))}finally{y(null)}}};return e.jsxs(Y,{open:l,onOpenChange:s=>{n||L(s)},children:[e.jsxs(Q,{className:"repository-projects-dialog w-[min(660px,calc(100vw-2.5rem))]",children:[e.jsxs("header",{className:"repository-projects-header",children:[e.jsxs("div",{children:[e.jsx(Z,{children:"Manage projects"}),e.jsx(ee,{children:"Group repositories, update their locations, or remove them from OpenTig. Files stay on disk."})]}),e.jsx(I,{render:e.jsx(o,{variant:"ghost",size:"icon-sm","aria-label":"Close project management",disabled:!!n}),children:e.jsx(se,{})})]}),e.jsxs("div",{className:"repository-projects-body",children:[$&&e.jsxs("div",{className:"repository-projects-error",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsx("span",{children:$})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"projects-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"projects-heading",children:["Projects ",e.jsx("span",{children:c.length})]}),e.jsxs("form",{className:"repository-project-create",onSubmit:s=>{V(s)},children:[e.jsx("label",{className:"sr-only",htmlFor:"new-project-name",children:"Project name"}),e.jsx("input",{id:"new-project-name",value:N,maxLength:z,onChange:s=>D(s.target.value),placeholder:"New project name",disabled:!!n}),e.jsxs(o,{type:"submit",size:"sm",disabled:!N.trim()||!!n,children:[n==="create"?e.jsx(P,{className:"animate-spin"}):e.jsx(le,{})," Create"]})]})]}),e.jsxs("div",{className:"repository-project-list",children:[c.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No projects yet. Create one to group related repositories."}),c.map(s=>{const a=s.repositoryKeys.length,t=n===`rename:${s.id}`||n===`remove:${s.id}`;return e.jsx("div",{className:"repository-project-row","aria-busy":t||void 0,children:g===s.id?e.jsxs("form",{className:"repository-inline-form",onSubmit:i=>{W(i)},onKeyDown:i=>{i.key==="Escape"&&d(null)},children:[e.jsxs("label",{className:"sr-only",htmlFor:`rename-project-${s.id}`,children:["Rename ",s.name]}),e.jsx("input",{id:`rename-project-${s.id}`,autoFocus:!0,value:b,maxLength:z,onChange:i=>T(i.target.value),disabled:!!n}),e.jsx(o,{type:"submit",size:"xs",disabled:!b.trim()||!!n,children:"Save"}),e.jsx(o,{type:"button",variant:"ghost",size:"xs",onClick:()=>d(null),disabled:!!n,children:"Cancel"})]}):J===s.id?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsxs("span",{children:["Delete ",e.jsx("strong",{children:s.name}),"? Its repositories stay available, just ungrouped."]}),e.jsx(o,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{X(s.id)},children:"Delete"}),e.jsx(o,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>p(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"repository-project-icon","aria-hidden":"true",children:e.jsx(_,{})}),e.jsxs("span",{className:"repository-project-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs("small",{children:[a," ",a===1?"repository":"repositories"]})]}),e.jsxs("span",{className:"repository-row-actions",children:[e.jsx(o,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${s.name}`,disabled:!!n,onClick:()=>{d(s.id),T(s.name),p(null)},children:e.jsx(he,{})}),e.jsx(o,{variant:"ghost",size:"icon-sm",className:"repository-row-delete","aria-label":`Delete ${s.name}`,disabled:!!n,onClick:()=>{p(s.id),d(null)},children:e.jsx(E,{})})]})]})},s.id)})]})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"repository-assignments-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"repository-assignments-heading",children:["Repositories ",e.jsx("span",{children:v.length})]}),e.jsx("p",{children:"One project per repository"})]}),e.jsxs("div",{className:"repository-assignment-list",children:[v.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No recent repositories to assign yet."}),v.map(s=>{const a=K.get(s.key)??B,t=n?.endsWith(`:${s.key}`);return e.jsx("div",{className:"repository-assignment-row","aria-busy":t||void 0,children:H===s.key?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsxs("span",{children:["Remove ",e.jsx("strong",{children:s.name})," and its worktrees from OpenTig? Their folders and files stay on disk. You can open them again later."]}),e.jsx(o,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{j(`forget:${s.key}`,()=>G(s)).then(i=>{i&&u(null)})},children:"Remove"}),e.jsx(o,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>u(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx(_,{"aria-hidden":"true"}),e.jsxs("span",{className:"repository-assignment-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs(w,{children:[e.jsx(C,{render:e.jsx("small",{}),children:ne(s.rootPath,4)}),e.jsx(R,{children:s.rootPath})]})]}),t&&e.jsx(P,{className:"repository-assignment-busy animate-spin","aria-hidden":"true"}),e.jsxs(ae,{value:a,onValueChange:i=>{q(s.key,i===B?null:i)},disabled:!!n,children:[e.jsx(ie,{size:"sm","aria-label":`Project for ${s.name}`,children:e.jsx(oe,{children:c.find(i=>i.id===a)?.name??"No project"})}),e.jsxs(re,{align:"end",alignItemWithTrigger:!1,children:[e.jsx(O,{value:B,children:"No project"}),c.map(i=>e.jsx(O,{value:i.id,children:i.name},i.id))]})]}),e.jsxs("span",{className:"repository-management-actions",children:[e.jsxs(w,{children:[e.jsx(C,{render:e.jsx(o,{variant:"ghost",size:"icon-sm","aria-label":`Relocate ${s.name}`,disabled:!!n,onClick:()=>{U(s)}}),children:e.jsx(de,{})}),e.jsx(R,{children:"Relocate repository"})]}),e.jsxs(w,{children:[e.jsx(C,{render:e.jsx(o,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.name} from OpenTig`,disabled:!!n,onClick:()=>{u(s.key),m(null)}}),children:e.jsx(E,{})}),e.jsx(R,{children:"Remove from OpenTig"})]})]})]})},s.key)})]})]})]}),e.jsx("footer",{className:"repository-projects-footer",children:e.jsx(I,{render:e.jsx(o,{variant:"outline",size:"sm",disabled:!!n}),children:"Done"})})]}),e.jsx(te,{open:x!==null,onOpenChange:s=>{s||f(null)},title:"Relocate repository",description:`Choose the existing server folder for ${x?.name??"this repository"}. This updates its saved location; it does not move files.`,confirmLabel:"Use this folder",onBrowse:h.repository.browseDirectories,onOpen:async s=>{x&&await S(x,s)}})]})}function F(l){return l instanceof Error?l.message:String(l)}export{ve as RepositoryProjectsDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,j as e}from"./react-rd22PHbN.js";import{a8 as pe,a9 as A,Q as J,j as fe,T as W,o as D,q as O,J as P,k as me,C as m}from"./App-1nMyZ0Eq.js";import{u as xe,a as ve}from"./tanstack-BEeM5REq.js";import{c as x,B as k,o as Y,q as je}from"./index-DwuduZw_.js";import"./base-ui-BxmCGIFY.js";const ye=[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]],X=x("outline","eye-off","EyeOff",ye);const ke=[["path",{d:"M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0",key:"svg-0"}],["path",{d:"M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5",key:"svg-1"}],["path",{d:"M3 13h7",key:"svg-2"}],["path",{d:"M21 12v7",key:"svg-3"}]],Me=x("outline","letter-case","LetterCase",ke);const Ne=[["path",{d:"M6.5 15a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0 -5",key:"svg-0"}],["path",{d:"M17 7.875l3 -1.687",key:"svg-1"}],["path",{d:"M17 7.875v3.375",key:"svg-2"}],["path",{d:"M17 7.875l-3 -1.687",key:"svg-3"}],["path",{d:"M17 7.875l3 1.688",key:"svg-4"}],["path",{d:"M17 4.5v3.375",key:"svg-5"}],["path",{d:"M17 7.875l-3 1.688",key:"svg-6"}]],be=x("outline","regex","Regex",Ne);const we=[["path",{d:"M3 4a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M15 16a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-1"}],["path",{d:"M21 11v-3a2 2 0 0 0 -2 -2h-6l3 3m0 -6l-3 3",key:"svg-2"}],["path",{d:"M3 13v3a2 2 0 0 0 2 2h6l-3 -3m0 6l3 -3",key:"svg-3"}]],Z=x("outline","replace","Replace",we);const Se=[["path",{d:"M4 6l10 0",key:"svg-0"}],["path",{d:"M4 18l10 0",key:"svg-1"}],["path",{d:"M4 12h17l-3 -3m0 6l3 -3",key:"svg-2"}]],$e=x("outline","text-wrap-disabled","TextWrapDisabled",Se);const Re=[["path",{d:"M8 2h-4a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2z",key:"svg-0"}],["path",{d:"M20 14h-4a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2z",key:"svg-1"}],["path",{d:"M16.707 2.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.293 1.293h3.586a3 3 0 0 1 2.995 2.824l.005 .176v3a1 1 0 0 1 -1.993 .117l-.007 -.117v-3a1 1 0 0 0 -.883 -.993l-.117 -.007h-3.585l1.292 1.293a1 1 0 0 1 -1.32 1.497l-.094 -.083l-3 -3a.98 .98 0 0 1 -.28 -.872l.036 -.146l.04 -.104c.058 -.126 .14 -.24 .245 -.334l2.959 -2.958a1 1 0 0 1 1.414 0z",key:"svg-2"}],["path",{d:"M3 12a1 1 0 0 1 .993 .883l.007 .117v3a1 1 0 0 0 .883 .993l.117 .007h3.585l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083l.094 .083l3 3a.98 .98 0 0 1 .28 .872l-.036 .146l-.04 .104a1.02 1.02 0 0 1 -.245 .334l-2.959 2.958a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.291 -1.293h-3.584a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-3a1 1 0 0 1 1 -1z",key:"svg-3"}]],ee=x("filled","replace-filled","ReplaceFilled",Re);function Ce(l){return l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ie(l){if(!l.query)return null;const c=l.regex?l.query:Ce(l.query),i=l.wholeWord?`\\b(?:${c})\\b`:c;try{return new RegExp(i,l.matchCase?"g":"gi")}catch{return null}}const Te=250,Ee=28,_e=24;function He({repositoryId:l,active:c,revision:i,onOpenFile:h,unsavedPathsAmong:g,onReplaced:o}){const B=pe(),[f,ae]=t.useState(""),[M,se]=t.useState(!1),[N,te]=t.useState(!1),[b,le]=t.useState(!1),[p,ne]=t.useState(!1),[H,re]=t.useState(""),[w,ce]=t.useState(!1),[S,ie]=t.useState(!1),[$,Q]=t.useState(!1),[oe,he]=t.useState(0),[L,G]=t.useState(()=>new Set),K=t.useRef(null),V=t.useRef(null),R=t.useMemo(()=>({query:f,matchCase:M,wholeWord:N,regex:b,includeIgnored:w}),[f,M,N,b,w]),de=t.useMemo(()=>Ie(R),[R]),v=f.trim(),C=qe(v,Te),d=xe({queryKey:je.search(l,{query:C,matchCase:M,wholeWord:N,regex:b,includeIgnored:w,revision:i,replaceRevision:oe}),queryFn:()=>Y.repository.search(l,{...R,query:C}),enabled:c&&C.length>0,placeholderData:(a,s)=>s?.queryKey[1]===l?a:void 0}),n=v?d.data??null:null,q=!!v&&(C!==v||d.isFetching),U=v&&d.error?d.error instanceof Error?d.error.message:"The search failed.":null;t.useEffect(()=>{c&&K.current?.focus()},[c]),t.useEffect(()=>{d.data&&G(new Set(d.data.files.filter(a=>a.ignored).map(a=>a.path)))},[d.data]);const I=t.useMemo(()=>{if(!n)return[];const a=[];for(const s of n.files){const u=!L.has(s.path);if(a.push({kind:"file",file:s,open:u}),u)for(const E of s.matches)a.push({kind:"match",file:s,match:E})}return a},[L,n]),T=ve({count:I.length,getScrollElement:()=>V.current,estimateSize:a=>B?44:I[a]?.kind==="file"?Ee:_e,getItemKey:a=>{const s=I[a];return s?s.kind==="file"?`file:${s.file.path}`:`match:${s.file.path}:${s.match.line}:${s.match.column??1}`:a},overscan:12});t.useEffect(()=>{T.measure()},[T,B]);const ue=a=>G(s=>{const u=new Set(s);return u.delete(a)||u.add(a),u}),j=n?.files.filter(a=>a.ignored).length??0,y=n?.files.filter(a=>!!a.revision&&(S||!a.ignored))??[],z=async a=>{if(!n||$)return;const s=a==="all"?{kind:"all",files:y.map(r=>({path:r.path,revision:r.revision}))}:"match"in a?{kind:"match",path:a.file.path,revision:a.file.revision,line:a.match.line,column:a.match.column}:{kind:"file",path:a.path,revision:a.revision};if(s.kind==="all"){if(n.truncated){m.info({title:"Narrow the search before replacing all",description:"The current result set is truncated."});return}const r=y.reduce((F,ge)=>F+ge.matches.length,0);if(!r||!window.confirm(`Replace ${r} ${r===1?"occurrence":"occurrences"} in ${y.length} ${y.length===1?"file":"files"}?`))return}else if(s.kind==="file"&&a!=="all"&&!("match"in a)&&a.truncatedMatches&&!window.confirm(`${a.path} has more matches than the ${a.matches.length} listed. Replace every occurrence in the file?`))return;const u=s.kind==="all"?s.files.map(r=>r.path):[s.path],E=g(u);if(E.length>0){m.error({title:"Save open files before replacing in them",description:E.join(", "),duration:1e4});return}Q(!0);try{const r=await Y.repository.replaceSearch(l,{options:{...R,query:f.trim()},replacement:H,scope:s});r.status==="stale"?m.error({title:"Files changed before replacement",description:"Search results were refreshed without overwriting anything."}):r.status==="no-match"?m.info({title:"No matching text to replace"}):(m.success({title:`Replaced ${r.replacements} ${r.replacements===1?"occurrence":"occurrences"}`,description:`${r.files.length} ${r.files.length===1?"file":"files"} changed`}),o(r.files)),he(F=>F+1)}catch(r){m.error({title:"Could not replace search results",description:r instanceof Error?r.message:"Unknown error",duration:1e4})}finally{Q(!1)}};return e.jsxs("div",{className:"search-view",children:[e.jsxs("div",{className:"search-controls",children:[e.jsxs("div",{className:"search-query-row",children:[e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-toggle","aria-label":p?"Hide replace":"Show replace","aria-expanded":p,onClick:()=>ne(a=>!a),children:p?e.jsx(A,{}):e.jsx(J,{})}),e.jsxs("div",{className:"search-input",children:[e.jsx(fe,{"aria-hidden":"true"}),e.jsx("input",{ref:K,type:"text",value:f,spellCheck:!1,placeholder:"Search in repository","aria-label":"Search in repository",onChange:a=>ae(a.target.value)}),e.jsxs("span",{className:"search-toggles",children:[e.jsx(_,{label:"Match case",active:M,onToggle:()=>se(a=>!a),children:e.jsx(Me,{})}),e.jsx(_,{label:"Match whole word",active:N,onToggle:()=>te(a=>!a),children:e.jsx($e,{})}),e.jsx(_,{label:"Use regular expression",active:b,onToggle:()=>le(a=>!a),children:e.jsx(be,{})}),e.jsx(_,{label:"Search Git-ignored files",active:w,onToggle:()=>ce(a=>!a),children:e.jsx(X,{})})]})]})]}),p&&e.jsxs("div",{className:"search-replace-row",children:[e.jsx(Z,{"aria-hidden":"true"}),e.jsx("input",{value:H,spellCheck:!1,placeholder:"Replace","aria-label":"Replace with",onChange:a=>re(a.target.value)}),e.jsxs(W,{children:[e.jsx(D,{render:e.jsx(k,{variant:"ghost",size:"icon-xs",disabled:$||y.length===0||!!n?.truncated,"aria-label":"Replace all search results",onClick:()=>{z("all")}}),children:e.jsx(ee,{})}),e.jsx(O,{children:n?.truncated?"Narrow the search to replace all":"Replace all"})]})]}),p&&j>0&&e.jsxs("label",{className:"search-include-ignored",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:a=>ie(a.target.checked)})," Include ignored files when replacing"]}),f.trim()!==""&&(n!==null||!q)&&e.jsx("div",{className:"search-summary",children:q?e.jsx(P,{text:"Searching…"}):U?e.jsx("span",{className:"search-error",children:U}):n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:n.totalMatches===0?"No results":`${n.totalMatches-n.ignoredMatches}${n.truncated?"+":""} ${n.totalMatches-n.ignoredMatches===1?"result":"results"} in ${n.files.length-j} ${n.files.length-j===1?"file":"files"}`}),n.ignoredMatches>0&&e.jsxs("span",{className:"search-summary-ignored",children:["· ",n.ignoredMatches," in ",j," ignored ",j===1?"file":"files"]})]})})]}),e.jsxs("div",{ref:V,className:"search-results",children:[q&&!n&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(me,{className:"spinner"})," ",e.jsx(P,{text:"Searching…"})]}),e.jsx("div",{className:"search-rows virtual-list",style:{height:T.getTotalSize()},children:T.getVirtualItems().map(a=>{const s=I[a.index];return s?e.jsx("div",{className:"virtual-row",style:{height:a.size,transform:`translateY(${a.start}px)`},children:s.kind==="file"?e.jsxs("div",{className:`search-file-heading ${s.file.ignored?"ignored":""}`,children:[e.jsxs("button",{className:"search-file-toggle",onClick:()=>ue(s.file.path),"aria-expanded":s.open,children:[s.open?e.jsx(A,{}):e.jsx(J,{}),e.jsx("span",{className:"search-file-name",children:s.file.path}),s.file.ignored&&e.jsxs(W,{children:[e.jsx(D,{render:e.jsx("span",{className:"search-file-ignored-badge"}),children:e.jsx(X,{})}),e.jsx(O,{children:"Ignored by Git"})]}),e.jsx("span",{className:"search-file-count",children:s.file.matches.length})]}),p&&s.file.revision&&(!s.file.ignored||S)&&e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-action",disabled:$,"aria-label":`Replace all in ${s.file.path}`,onClick:()=>{z(s.file)},children:e.jsx(ee,{})})]}):e.jsxs("div",{className:"search-match",children:[e.jsxs("button",{className:"search-match-open",onClick:()=>h(s.file.path),children:[e.jsxs("span",{className:"search-match-line",children:[s.match.line,":",s.match.column??1]}),e.jsx("span",{className:"search-match-text",children:ze(s.match.text,de)})]}),p&&s.file.revision&&s.match.column&&(!s.file.ignored||S)&&e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-action",disabled:$,"aria-label":`Replace match on line ${s.match.line}`,onClick:()=>{z({file:s.file,match:s.match})},children:e.jsx(Z,{})})]})},a.key):null})})]})]})}function qe(l,c){const[i,h]=t.useState(l);return t.useEffect(()=>{const g=window.setTimeout(()=>h(l),c);return()=>window.clearTimeout(g)},[c,l]),i}function _({label:l,active:c,onToggle:i,children:h}){return e.jsxs(W,{children:[e.jsx(D,{render:e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-toggle","aria-label":l,"aria-pressed":c,onClick:i}),children:h}),e.jsx(O,{children:l})]})}function ze(l,c){const i=l.replace(/^\s+/,"");if(!c)return i;c.lastIndex=0;const h=[];let g=0;for(let o=c.exec(i);o!==null;o=c.exec(i)){if(o[0]===""){c.lastIndex+=1;continue}h.push(e.jsx(t.Fragment,{children:i.slice(g,o.index)},`${o.index}-plain`),e.jsx("mark",{children:o[0]},`${o.index}-hit`)),g=o.index+o[0].length}return h.length===0?i:(h.push(e.jsx(t.Fragment,{children:i.slice(g)},"tail")),h)}export{He as SearchView};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PierreDiffViewer-BRQK_cuH.js","assets/react-rd22PHbN.js","assets/PierreWorkerPool-CRVJ90kq.js","assets/platform-BMNQ8V5r.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-DwuduZw_.js","assets/tanstack-BEeM5REq.js","assets/base-ui-BxmCGIFY.js","assets/index-Bm8fY0Qs.css","assets/index-CtEztN1P.js","assets/App-1nMyZ0Eq.js","assets/File-C25AAfq1.js","assets/EditContext-CvJWfVl1.js","assets/DiffWorkspace-CZH8jCtn.js","assets/PierreEditBoundary-YYf1awXS.js","assets/MarkdownFileViewer-Y9tvTC3N.js","assets/viewer-tabs-B_boC13j.js","assets/viewer-tabs-D8o-L3pM.css","assets/EditableFileViewer-4ap_dRdR.js","assets/EditableFileViewer-B2G3Xa33.css","assets/render-markdown-BnNqckxy.js","assets/markdown-ChhkSSkz.css","assets/PullRequestViewer-6MhtdrJc.js","assets/gh-utils-XOjL-WGw.js","assets/GitHubAvatar-DV6lI4Jh.js","assets/HtmlFileViewer-CiPZFmIx.js","assets/HtmlFileViewer-D6UPnZvW.css","assets/ImageFileViewer-RAXxHOBt.js","assets/ImageFileViewer-D8TdwFTO.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as _,B as U,_ as x}from"./index-DwuduZw_.js";import{r as n,j as t}from"./react-rd22PHbN.js";import{K as se,L as ae,M as ne,k as R,N as le,J as Y,T as re,o as oe,q as fe}from"./App-1nMyZ0Eq.js";import"./tanstack-BEeM5REq.js";import"./base-ui-BxmCGIFY.js";class de{constructor(e){if(this.options=e,!Number.isInteger(e.maxEntries)||e.maxEntries<1)throw new RangeError("maxEntries must be a positive integer.");if(!Number.isFinite(e.maxBytes)||e.maxBytes<1)throw new RangeError("maxBytes must be a positive number.")}options;entries=new Map;totalBytes=0;get size(){return this.entries.size}get bytes(){return this.totalBytes}get(e){const o=this.entries.get(e);if(o)return this.entries.delete(e),this.entries.set(e,o),o.value}set(e,o){const d=ce(this.options.sizeOf(o)),v=this.entries.get(e);return v&&(this.entries.delete(e),this.totalBytes-=v.bytes),d>this.options.maxBytes?!1:(this.entries.set(e,{value:o,bytes:d}),this.totalBytes+=d,this.evictToBudget(),this.entries.has(e))}delete(e){const o=this.entries.get(e);return o?(this.entries.delete(e),this.totalBytes-=o.bytes,!0):!1}clear(){this.entries.clear(),this.totalBytes=0}evictToBudget(){for(;this.entries.size>this.options.maxEntries||this.totalBytes>this.options.maxBytes;){const e=this.entries.keys().next();if(e.done)break;this.delete(e.value)}}}function ce(i){if(!Number.isFinite(i)||i<0)throw new RangeError("sizeOf must return a finite, non-negative number.");return Math.ceil(i)}const G=n.lazy(()=>x(()=>import("./PierreDiffViewer-BRQK_cuH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),ue=n.lazy(()=>x(()=>import("./PierreEditBoundary-YYf1awXS.js"),__vite__mapDeps([15,6,1,7,8,9,13,11])).then(i=>({default:i.PierreEditBoundary}))),me=n.lazy(()=>x(()=>import("./MarkdownFileViewer-Y9tvTC3N.js"),__vite__mapDeps([16,1,11,6,7,8,9,17,18,19,2,3,4,5,10,12,13,15,20,21,22])).then(i=>({default:i.MarkdownFileViewer}))),he=n.lazy(()=>x(()=>import("./PullRequestViewer-6MhtdrJc.js"),__vite__mapDeps([23,6,1,7,8,9,11,17,18,24,25,22])).then(i=>({default:i.PullRequestViewer}))),pe=n.lazy(()=>x(()=>import("./EditableFileViewer-4ap_dRdR.js").then(i=>i.E),__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,10,11,12,13,15,20])).then(i=>({default:i.EditableFileViewer}))),xe=n.lazy(()=>x(()=>import("./HtmlFileViewer-CiPZFmIx.js"),__vite__mapDeps([26,1,17,6,7,8,9,18,19,2,3,4,5,10,11,12,13,15,20,27])).then(i=>({default:i.HtmlFileViewer}))),ve=n.lazy(()=>x(()=>import("./ImageFileViewer-RAXxHOBt.js"),__vite__mapDeps([28,1,6,7,8,9,11,17,18,19,2,3,4,5,10,12,13,15,20,29])).then(i=>({default:i.ImageFileViewer}))),ye=n.lazy(()=>x(()=>import("./ImageFileViewer-RAXxHOBt.js"),__vite__mapDeps([28,1,6,7,8,9,11,17,18,19,2,3,4,5,10,12,13,15,20,29])).then(i=>({default:i.SvgFileViewer}))),F=new de({maxEntries:8,maxBytes:16*1024*1024,sizeOf:i=>i.patch.length*2+i.path.length*2+256});let Q=null;function Se({repositoryId:i,selection:e,diffView:o,wrapLines:d,theme:v,revision:y,readOnly:g,commits:T,draftFor:E,onSelect:$,onOpenFile:Z,onDiffViewChange:K,onWrapLinesChange:M,onDraftChange:O,onDraftSaved:A,onUpdateConflict:W,onResolveConflict:I}){const[a,w]=n.useState(null),[ee,L]=n.useState(!1),[D,q]=n.useState(null),[V,H]=n.useState(!1),b=n.useRef(0),C=n.useRef(!1),u=je(i,e);n.useEffect(()=>{H(!1),C.current=!1},[e]),n.useEffect(()=>{Q!==i&&(F.clear(),Q=i);const s=++b.current;if(q(null),!e||e.type==="pull-request"){w(null),L(!1);return}L(!0),(async()=>{try{if(e.type==="file"||e.type==="conflict"){if(e.type==="file"&&le(e.path)){const l=await _.repository.readImage(i,e.path);if(s!==b.current)return;w({docKey:u,type:"image",value:l});return}const f=await _.repository.readFile(i,e.path,e.type==="conflict"?!0:V);if(s!==b.current)return;if(e.type==="conflict"){w({docKey:u,type:"conflict",value:f});return}w(l=>l&&l.docKey===u&&l.type==="file"&&C.current||l&&l.docKey===u&&l.type==="file"&&l.value.content===f.content&&l.value.size===f.size&&l.value.binary===f.binary&&l.value.tooLarge===f.tooLarge?l:{docKey:u,type:"file",value:f})}else{const f=e.type!=="diff";let l=f?F.get(u):void 0;if(l||(l=e.type==="commit"?await _.diff.getCommit(i,e.oid):e.type==="commit-file"?await _.diff.getCommitFile(i,e.oid,e.path,e.oldPath):await _.diff.get({repositoryId:i,path:e.path,kind:e.kind}),f&&F.set(u,l)),s!==b.current)return;const p=l;w(c=>c&&c.docKey===u&&c.type==="diff"&&c.value.patch===p.patch&&c.value.binary===p.binary?c:{docKey:u,type:"diff",value:p})}}catch(f){s===b.current&&q(f instanceof Error?f.message:"Could not load the viewer.")}finally{s===b.current&&L(!1)}})()},[V,u,i,y,e]);const j=v==="system"?"system":v,te=d?"wrap":"scroll",N=n.useCallback(s=>{C.current=s},[]),S=n.useCallback(async(s,h,f)=>{const l=E(s),p=await _.repository.writeFile(i,s,h,l?.expectedContent??f);return p.status==="saved"&&(C.current=!1,A(s),w(c=>c?.type==="file"&&c.value.path===s?{...c,value:{...c.value,content:h,binary:!1,tooLarge:!1,size:p.size,mtimeMs:p.mtimeMs}}:c)),p},[E,A,i]),B=n.useCallback(s=>s.path,[]),k=n.useCallback(s=>E(s.path)?.content??s.content,[E]),z=n.useCallback(s=>h=>O(s.path,h,s.content,s.mtimeMs),[O]),ie=ee&&a!==null&&!D;let r,P=null;if(!e)r=t.jsx(we,{});else if(e.type==="pull-request")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(he,{repositoryId:i,prNumber:e.number,diffView:o,themeType:j,wrapLines:d,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>$(null)},`${i}:${e.number}`)});else if(D)r=t.jsx("div",{className:"viewer-message text-destructive",children:D});else if(!a)r=t.jsxs("div",{className:"viewer-message",children:[t.jsx(R,{className:"spinner"})," ",t.jsx(Y,{text:"Loading…"})]});else if(a.type==="image")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ve,{image:a.value},`${a.value.path}:${a.value.mtimeMs}`)});else if(a.type!=="diff"&&a.value.binary)r=t.jsxs("div",{className:"viewer-message",children:["Binary file · ",X(a.value.size)]});else if(a.type==="file"&&a.value.tooLarge&&!V)r=t.jsxs("div",{className:"viewer-message flex-col gap-3",children:[t.jsxs("p",{children:["The file is ",X(a.value.size),". Preview is limited to protect performance."]}),t.jsx(U,{variant:"outline",onClick:()=>H(!0),children:"Load preview"})]});else if(a.type==="file"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The file exceeds the built-in editor's 8 MB safety limit."});else if(a.type==="conflict"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The conflicted file exceeds the viewer's safe limit. Open it in an external editor to resolve it."});else if(a.type==="conflict")r=null,P=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(G,{kind:"conflict",contentKey:a.docKey,file:a.value,themeType:j,overflow:te,onUpdate:W,onResolve:I})});else if(a.type==="file"&&se(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(me,{file:s,initialContent:k(s),revision:y,themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onOpenFile:Z,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"&&ae(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ye,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"&&ne(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(xe,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(pe,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="diff"&&a.value.patch){const s=e.type==="commit"||e.type==="commit-file"?e:null,h=s?T.find(l=>l.oid===s.oid):void 0,f=e.type==="commit-file"?t.jsx(U,{type:"button",variant:"outline",size:"xs",onClick:()=>$({type:"commit",oid:e.oid,subject:h?.subject??e.oid.slice(0,8)}),children:"All files"}):void 0;r=null,P=t.jsxs("div",{className:s?"commit-diff-viewer":"standalone-diff-viewer",children:[s&&t.jsx(ge,{commit:h,fallbackSubject:"subject"in s?s.subject:""},s.oid),t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(G,{kind:"diff",contentKey:a.docKey,value:a.value,diffView:o,themeType:j,wrapLines:d,initiallyCollapsed:e.type==="commit",compact:e.type==="diff",scopeControl:f,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>$(null)})})]})}else a.type==="diff"?r=t.jsx("div",{className:"viewer-message",children:"No differences to show."}):r=t.jsx("div",{className:"viewer-message",children:"This file cannot be edited."});const J=t.jsxs(t.Fragment,{children:[P??t.jsx("div",{className:"viewer-transition",children:r},a?a.docKey:u),ie&&t.jsx("span",{className:"viewer-reloading","aria-hidden":"true",children:t.jsx(R,{className:"spinner"})})]});return a?.type!=="file"?J:t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ue,{enabled:!0,children:J})})}function ge({commit:i,fallbackSubject:e}){const o=i?.date?new Date(i.date):null,[d,v]=n.useState(!1),y=i?.body??"",g=y.length>240||y.split(`
|
|
3
|
-
`).length>3;return t.jsxs("header",{className:"commit-diff-header",children:[t.jsx("h2",{children:i?.subject||e||"(no subject)"}),y&&t.jsxs("div",{className:"commit-diff-description-wrap",children:[t.jsx("p",{className:`commit-diff-description ${g&&!d?"collapsed":""}`,children:y}),g&&t.jsx("button",{type:"button",className:"commit-description-toggle","aria-expanded":d,onClick:()=>v(T=>!T),children:d?"Show less":"Show full description"})]}),t.jsxs("div",{className:"commit-diff-meta",children:[t.jsx("code",{children:i?.shortOid??"commit"}),i?.author&&t.jsxs("span",{children:[i.author,i.email?` <${i.email}>`:""]}),o&&Number.isFinite(o.getTime())&&t.jsxs(re,{children:[t.jsx(oe,{render:t.jsx("time",{dateTime:i?.date}),children:o.toLocaleString()}),t.jsx(fe,{children:o.toLocaleString()})]}),i?.parentCount&&i.parentCount>1?t.jsx("span",{children:"Merge commit"}):null,i?.upstreamState==="local-only"&&t.jsx("span",{className:"commit-local-label",children:"Local only"})]})]})}function je(i,e){return e?e.type==="pull-request"?`${i}:pull:${e.number}`:e.type==="commit"?`${i}:commit:${e.oid}`:e.type==="commit-file"?`${i}:commit-file:${e.oid}:${e.oldPath??""}:${e.path}`:e.type==="diff"?`${i}:diff:${e.kind}:${e.path}`:`${i}:${e.type}:${e.path}`:`${i}:empty`}function m(){return t.jsxs("div",{className:"viewer-message",children:[t.jsx(R,{className:"spinner"})," ",t.jsx(Y,{text:"Loading viewer…"})]})}function we(){return t.jsxs("div",{className:"viewer-empty",children:[t.jsx("h2",{children:"Nothing selected"}),t.jsx("p",{children:"Select a change, file, commit, or pull request."})]})}function X(i){return i?i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/1024/1024).toFixed(1)} MB`:"unknown size"}export{Se as default};
|