@opentig/cli 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/chunks/{cli-Bi6ET5UT.mjs → cli-B6JTojx_.mjs} +1 -1
  3. package/dist/client/assets/App-Dfm5F199.js +74 -0
  4. package/dist/client/assets/CreatePullRequestDialog-CAeykZ72.js +2 -0
  5. package/dist/client/assets/{DiffWorkspace-RDG_Y70N.js → DiffWorkspace-BRicWHvw.js} +13 -13
  6. package/dist/client/assets/{EditableFileViewer-CsbifqBO.js → EditableFileViewer-DWeSDnZn.js} +1 -1
  7. package/dist/client/assets/{File-CHjvYpb2.js → File-D65shwRR.js} +1 -1
  8. package/dist/client/assets/FilesView-EfoU7sF-.js +1 -0
  9. package/dist/client/assets/GitHubAvatar-C8R3iNoM.js +1 -0
  10. package/dist/client/assets/HistoryView-C6T2dsBC.js +1 -0
  11. package/dist/client/assets/{HtmlFileViewer-h8ULU8Gy.js → HtmlFileViewer-JXLHTNPm.js} +1 -1
  12. package/dist/client/assets/{IconEdit-Cg8S2wqW.js → IconEdit-3fgBTCQ4.js} +1 -1
  13. package/dist/client/assets/{IconFolderSymlink-BZSLX1ez.js → IconFolderSymlink-C4ydD1eS.js} +1 -1
  14. package/dist/client/assets/{ImageFileViewer-Cjw58ckv.js → ImageFileViewer-YH2xhkkk.js} +1 -1
  15. package/dist/client/assets/LocalRefsDialog--1NiYKYj.js +1 -0
  16. package/dist/client/assets/{MarkdownFileViewer-kLiduag6.js → MarkdownFileViewer-BsB8WkIH.js} +2 -2
  17. package/dist/client/assets/PairingPage-DXRyAYHn.js +1 -0
  18. package/dist/client/assets/{PierreDiffViewer-eAcugmoF.js → PierreDiffViewer-DoV3V0IW.js} +1 -1
  19. package/dist/client/assets/{PierreEditBoundary-DlGd1pqO.js → PierreEditBoundary-BnYZbHfi.js} +1 -1
  20. package/dist/client/assets/{PierreWorkerPool-Col4k7qz.js → PierreWorkerPool-Cg9zdxiI.js} +1 -1
  21. package/dist/client/assets/PullRequestDiff-D6QG5Anx.js +1 -0
  22. package/dist/client/assets/PullRequestViewer-jC3LVmiO.js +2 -0
  23. package/dist/client/assets/PullRequestsView-GStKxG7k.js +1 -0
  24. package/dist/client/assets/{QuickOpenDialog-BFDDZVCL.js → QuickOpenDialog-HvslpGQl.js} +1 -1
  25. package/dist/client/assets/{RepositoryProjectsDialog-CvB8KcFp.js → RepositoryProjectsDialog-Biqv5GO_.js} +1 -1
  26. package/dist/client/assets/SearchView-D5XB6wdu.js +1 -0
  27. package/dist/client/assets/SettingsDialog-DWAunOQB.js +72 -0
  28. package/dist/client/assets/{Viewer-o1hDU33O.js → Viewer-Gfy3Ejyo.js} +3 -3
  29. package/dist/client/assets/{abnfDiagram-N423BO3Z-BvrnK_R-.js → abnfDiagram-N423BO3Z-DdAfHevw.js} +1 -1
  30. package/dist/client/assets/{arc-DLa3_7ua.js → arc-C43uoeEi.js} +1 -1
  31. package/dist/client/assets/{architectureDiagram-T3A2C74G-BexwhnyX.js → architectureDiagram-T3A2C74G-C7q0hhRO.js} +1 -1
  32. package/dist/client/assets/{blockDiagram-VBNYF7ZC-CoOttUUo.js → blockDiagram-VBNYF7ZC-C1x9Iap4.js} +1 -1
  33. package/dist/client/assets/{c4Diagram-5PPSVZJV-Bgp6ppUh.js → c4Diagram-5PPSVZJV-BmKaVW6q.js} +1 -1
  34. package/dist/client/assets/channel-Diwpee6E.js +1 -0
  35. package/dist/client/assets/checkbox-XfIUFPxh.js +1 -0
  36. package/dist/client/assets/{chunk-2GRJ4B5K-C_kzp38w.js → chunk-2GRJ4B5K-kzy_H3BQ.js} +1 -1
  37. package/dist/client/assets/{chunk-2Q5K7J3B-CysYnRkJ.js → chunk-2Q5K7J3B-BMj-FT4X.js} +1 -1
  38. package/dist/client/assets/{chunk-5RXB4S5H-oMS6x_ag.js → chunk-5RXB4S5H-DmPGiCCb.js} +1 -1
  39. package/dist/client/assets/{chunk-5VM5RSS4-C5-dW5wf.js → chunk-5VM5RSS4-DYFL8__L.js} +1 -1
  40. package/dist/client/assets/{chunk-6Q2QTUOP-DxahInnA.js → chunk-6Q2QTUOP-CI98oVdT.js} +1 -1
  41. package/dist/client/assets/{chunk-GF5L2VYU-D7V-3eRg.js → chunk-GF5L2VYU-D9JiiMlX.js} +1 -1
  42. package/dist/client/assets/{chunk-JWPE2WC7-BrLmjbVP.js → chunk-JWPE2WC7-D0THYpZl.js} +1 -1
  43. package/dist/client/assets/{chunk-KBJHAD2P-CyOvijwM.js → chunk-KBJHAD2P-Z1tJfyAr.js} +1 -1
  44. package/dist/client/assets/{chunk-RYQCIY6F-BvEjVjQs.js → chunk-RYQCIY6F-31aS4cD3.js} +1 -1
  45. package/dist/client/assets/{chunk-XXDRQBXY-C_IY9A64.js → chunk-XXDRQBXY-ClWDHmEp.js} +1 -1
  46. package/dist/client/assets/classDiagram-JCYQIIEL-BDuo9kiS.js +1 -0
  47. package/dist/client/assets/classDiagram-v2-OCEON4UE-BDuo9kiS.js +1 -0
  48. package/dist/client/assets/{cose-bilkent-JH36ORCC-Cu7qZi7h.js → cose-bilkent-JH36ORCC-Btg2MYLh.js} +1 -1
  49. package/dist/client/assets/{cynefin-VYW2F7L2-B4M1t9lL.js → cynefin-VYW2F7L2-Cbh4Pk6j.js} +1 -1
  50. package/dist/client/assets/{cynefinDiagram-MW4NZA55-CAosOLmT.js → cynefinDiagram-MW4NZA55-BBqorl0u.js} +1 -1
  51. package/dist/client/assets/{dagre-VZM6K2ZE-q354V538.js → dagre-VZM6K2ZE-DugEItZ0.js} +1 -1
  52. package/dist/client/assets/{diagram-7IWD3JNH-C_CzkBPt.js → diagram-7IWD3JNH-Biu7dmH8.js} +1 -1
  53. package/dist/client/assets/{diagram-B4RE2ZJO-VvvYHE9c.js → diagram-B4RE2ZJO-UDm4DXFS.js} +1 -1
  54. package/dist/client/assets/{diagram-LBJQPF4R-D8vRQwb5.js → diagram-LBJQPF4R-Bcku4gb-.js} +1 -1
  55. package/dist/client/assets/{diagram-Q27KOJAE-Bul4aDKg.js → diagram-Q27KOJAE-DFRjglV-.js} +1 -1
  56. package/dist/client/assets/{diagram-UB23O5K3-DNadEE58.js → diagram-UB23O5K3-CgfMWtd0.js} +1 -1
  57. package/dist/client/assets/{ebnfDiagram-BXEA7PRR-Bf-68MMZ.js → ebnfDiagram-BXEA7PRR-CZzYOqs0.js} +1 -1
  58. package/dist/client/assets/{erDiagram-JOGREHBK-CJ-jHFsf.js → erDiagram-JOGREHBK-Cdlbxgs6.js} +1 -1
  59. package/dist/client/assets/{flowDiagram-UKHOOZJN-DMOdinBU.js → flowDiagram-UKHOOZJN-BgImDwpP.js} +1 -1
  60. package/dist/client/assets/{ganttDiagram-PKOTCBZU-DzezS3Zy.js → ganttDiagram-PKOTCBZU-SFhtiyL4.js} +1 -1
  61. package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-Dftpvns8.js → gitGraphDiagram-DS77QQ5N-Bkm5ueys.js} +1 -1
  62. package/dist/client/assets/{index-DAUK3rnz.js → index-B5RC4THs.js} +4 -4
  63. package/dist/client/assets/index-Dc9xVluy.css +1 -0
  64. package/dist/client/assets/{infoDiagram-6WML65LV-DmgUBq17.js → infoDiagram-6WML65LV-pCYc-VX2.js} +1 -1
  65. package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-CL0PQhpQ.js → ishikawaDiagram-WSZJBQD7-BtNbG3Y6.js} +1 -1
  66. package/dist/client/assets/{journeyDiagram-NVQOT4AX-Ck4pQx_A.js → journeyDiagram-NVQOT4AX-CPW2qT3y.js} +1 -1
  67. package/dist/client/assets/{kanban-definition-27J2QSJJ-DuRZxBql.js → kanban-definition-27J2QSJJ-wD6JXQFs.js} +1 -1
  68. package/dist/client/assets/{linear-C2JDCaz4.js → linear-sj8MOkmS.js} +1 -1
  69. package/dist/client/assets/{mermaid.core-9dt2ugQA.js → mermaid.core-CGJtfmwb.js} +4 -4
  70. package/dist/client/assets/{mindmap-definition-FAOFIHXS-vy0fdDF0.js → mindmap-definition-FAOFIHXS-BQwLHBVs.js} +1 -1
  71. package/dist/client/assets/{pegDiagram-VL7TDLO6-DjVJy-Gm.js → pegDiagram-VL7TDLO6-DtDsb-Z8.js} +1 -1
  72. package/dist/client/assets/{pieDiagram-7S7Q4E2Y-ATbd_8vw.js → pieDiagram-7S7Q4E2Y-B3WhqNuS.js} +1 -1
  73. package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-C8o6ofcl.js → quadrantDiagram-CIZ2JOQS-CPi38pp_.js} +1 -1
  74. package/dist/client/assets/{railroadDiagram-AXF67PYL-Qvij9Ubo.js → railroadDiagram-AXF67PYL-Btac44Ux.js} +1 -1
  75. package/dist/client/assets/{render-markdown-BtCybfvQ.js → render-markdown-hAIWRfn0.js} +6 -6
  76. package/dist/client/assets/{requirementDiagram-LRYGKXZP-yLfrba2h.js → requirementDiagram-LRYGKXZP-CHJgDNdg.js} +1 -1
  77. package/dist/client/assets/{sankeyDiagram-W5VNT64P-BTXRtTyG.js → sankeyDiagram-W5VNT64P-OYJHfmtd.js} +1 -1
  78. package/dist/client/assets/{sequenceDiagram-SI44F4Z6-BN1CCZIX.js → sequenceDiagram-SI44F4Z6-9ypa9W08.js} +1 -1
  79. package/dist/client/assets/{sizeCapture-X5ZJPWSS-BfXjBBYo.js → sizeCapture-X5ZJPWSS-5ZDUTERI.js} +1 -1
  80. package/dist/client/assets/{stateDiagram-OKZ733FA-DMAWiBsP.js → stateDiagram-OKZ733FA-nGHE1hN7.js} +1 -1
  81. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-CkCpE1Yu.js +1 -0
  82. package/dist/client/assets/{swimlanes-SLNWSIFB-BD20m5cw.js → swimlanes-SLNWSIFB-BZFv9Zp8.js} +2 -2
  83. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-Dxlb7bju.js +8 -0
  84. package/dist/client/assets/tanstack-CcfAJoQ7.js +1 -0
  85. package/dist/client/assets/{timeline-definition-Z64GVDOM-gtc0-AHB.js → timeline-definition-Z64GVDOM-pUIcaCIE.js} +1 -1
  86. package/dist/client/assets/{vennDiagram-T6HMQDX7-Cdr4AXTp.js → vennDiagram-T6HMQDX7-D6dEIJmP.js} +1 -1
  87. package/dist/client/assets/{viewer-tabs-D-T0xQaq.js → viewer-tabs-BjG3oKQ9.js} +1 -1
  88. package/dist/client/assets/{wardleyDiagram-T6FBY63Y-BcU4vxO8.js → wardleyDiagram-T6FBY63Y-DZ8ro_-y.js} +1 -1
  89. package/dist/client/assets/{xychartDiagram-ELKLHX3M-B3Zuadj8.js → xychartDiagram-ELKLHX3M-WJ2Zfmlk.js} +1 -1
  90. package/dist/client/index.html +3 -3
  91. package/dist/dev.mjs +2 -2
  92. package/dist/manifest.json +2 -2
  93. package/dist/server.mjs +1616 -473
  94. package/dist/utility.mjs +11 -5
  95. package/package.json +1 -1
  96. package/dist/client/assets/App-BXZLGT86.js +0 -74
  97. package/dist/client/assets/CreatePullRequestDialog-DFonMYEx.js +0 -2
  98. package/dist/client/assets/FilesView-Dl8QFbFA.js +0 -1
  99. package/dist/client/assets/GitHubAvatar-CnBaloV0.js +0 -1
  100. package/dist/client/assets/HistoryView-BgCZU2JO.js +0 -1
  101. package/dist/client/assets/LocalRefsDialog-DNgrd7Qp.js +0 -1
  102. package/dist/client/assets/PairingPage-C97sv-8s.js +0 -1
  103. package/dist/client/assets/PullRequestDiff-DhKTXyIF.js +0 -1
  104. package/dist/client/assets/PullRequestViewer-BgI8HFMe.js +0 -2
  105. package/dist/client/assets/PullRequestsView-PYWLy8We.js +0 -1
  106. package/dist/client/assets/SearchView-BwF_MsxK.js +0 -1
  107. package/dist/client/assets/SettingsDialog-DIcLmXSE.js +0 -9
  108. package/dist/client/assets/channel-1k1AYpyV.js +0 -1
  109. package/dist/client/assets/checkbox-BRH0ZNIC.js +0 -1
  110. package/dist/client/assets/classDiagram-JCYQIIEL-ChyNFpay.js +0 -1
  111. package/dist/client/assets/classDiagram-v2-OCEON4UE-ChyNFpay.js +0 -1
  112. package/dist/client/assets/index-BfA4tAc1.css +0 -1
  113. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-D_ofZeaa.js +0 -1
  114. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-CF9m5JSB.js +0 -8
  115. package/dist/client/assets/tanstack-B0Sf7wNU.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as e,r as f}from"./react-rd22PHbN.js";import{g as m,q as j,x as r,p as x,y as v,z as k,A as I,B as S,C as p,E as G,F as P}from"./App-Dfm5F199.js";import{G as O,P as y,I as R,a as w}from"./GitHubAvatar-C8R3iNoM.js";import{a as L}from"./tanstack-CcfAJoQ7.js";import{c as z,B as t,I as N,T as c,b as o,d as u}from"./index-B5RC4THs.js";import{C as E}from"./checkbox-XfIUFPxh.js";import{P as q,b as D,c as H,d as T,e as $}from"./base-ui-CJ8ZIx3d.js";const A=[["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"}]],F=z("outline","filter","Filter",A);function Q(s){return s.info===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(m,{className:"spinner"})," ",e.jsx(j,{text:"Checking repository…"})]}):s.info.isGitHub?s.account?.state==="error"||s.error&&s.ghStatus===null?e.jsxs(h,{icon:e.jsx(r,{}),title:"GitHub account unavailable",children:[s.account?.message??s.error,e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsx(t,{variant:"outline",size:"sm",onClick:s.onOpenGitHubSettings,children:"Open GitHub settings"}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(x,{})," Check again"]})]})]}):s.ghStatus===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(m,{className:"spinner"})," ",e.jsx(j,{text:"Checking GitHub CLI…"})]}):s.ghStatus.installed?s.ghStatus.authStatus==="unauthenticated"?e.jsxs(h,{icon:e.jsx(r,{}),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(N,{})," Copy command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(x,{})," Check again"]})]})]}):e.jsx(M,{...s,nameWithOwner:s.info.nameWithOwner??""}):e.jsxs(h,{icon:e.jsx(r,{}),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(N,{})," Copy install command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(x,{})," Check again"]})]}),e.jsx("small",{children:"Download from cli.github.com, then check again."})]}):e.jsxs(h,{icon:e.jsx(r,{}),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 M(s){const n=f.useRef(null),l=s.pulls,i=L({count:l?.length??0,getScrollElement:()=>n.current,estimateSize:()=>68,getItemKey:a=>l?.[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(r,{"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(m,{className:"animate-spin"}):e.jsx(x,{})}),e.jsx(u,{children:"Refresh pull requests"})]}),s.account?.login&&e.jsxs(c,{children:[e.jsxs(o,{render:e.jsx(t,{variant:"ghost",size:"xs",className:"github-pulls-account",onClick:s.onOpenGitHubSettings}),children:[e.jsx(r,{})," @",s.account.login]}),e.jsx(u,{children:"Account used for this repository · open GitHub settings"})]}),e.jsxs(q,{children:[e.jsx(D,{render:e.jsx(t,{variant:b(s.states)?"ghost":"secondary",size:"icon-xs",className:"change-action-button","aria-label":"Filter pull requests","aria-pressed":!b(s.states)}),children:e.jsx(F,{})}),e.jsx(H,{children:e.jsx(T,{side:"bottom",align:"end",sideOffset:4,className:"isolate z-50 outline-none",children:e.jsxs($,{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(E,{id:`pulls-state-${a.toLowerCase()}`,checked:s.states.includes(a),onCheckedChange:d=>s.onStateChange(a,d===!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(v,{})," 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:n,className:"pulls-scroll",role:"list","aria-label":`${s.states.map(g).join(", ")||"No"} pull requests`,children:l===null&&!s.error?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(m,{className:"spinner"})," ",e.jsx(j,{text:"Loading pull requests…"})]}):l!==null&&l.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."}):l!==null&&e.jsx("div",{className:"virtual-list",style:{height:i.getTotalSize()},children:i.getVirtualItems().map(a=>{const d=l[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(B,{repositoryId:s.repositoryId,pr:d,active:s.activeNumber===d.number,onSelect:s.onSelect})},a.key)})})})]})}function B({repositoryId:s,pr:n,active:l,onSelect:i}){const a=n.state.toLowerCase();return e.jsxs("div",{className:`pull-item ${l?"active":""}`,role:"listitem",children:[e.jsxs("button",{className:"pull-main",onClick:()=>i(n.number),"aria-label":`View pull request #${n.number}`,children:[e.jsx("span",{className:`pull-state-icon ${a}${n.isDraft?" draft":""}`,"aria-label":n.isDraft?"Draft":g(n.state),children:e.jsx(C,{state:n.state})}),e.jsxs("span",{className:"pull-content",children:[e.jsx("span",{className:"pull-title",children:n.title||"(no title)"}),e.jsxs("span",{className:"pull-meta",children:[e.jsxs("span",{className:"pull-number",children:["#",n.number]}),e.jsx(O,{src:n.authorAvatarUrl,className:"pull-avatar"}),e.jsx("span",{className:"pull-author",children:n.author}),e.jsx(V,{state:n.checksState}),n.isDraft&&e.jsx("span",{className:"pull-draft-label",children:"Draft"})]})]}),e.jsxs("span",{className:"pull-row-aside",children:[e.jsx("time",{dateTime:n.updatedAt,children:S(n.updatedAt)}),e.jsxs("span",{className:"pull-line-stats",children:[e.jsxs("span",{className:"add",children:["+",n.additions]})," ",e.jsxs("span",{className:"del",children:["−",n.deletions]})]})]})]}),n.stack&&e.jsx(y,{repositoryId:s,number:n.number,membership:n.stack,onSelect:i}),e.jsxs(c,{children:[e.jsx(o,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button pull-open-external",onClick:()=>G(n.url),"aria-label":`Open #${n.number} on GitHub`}),children:e.jsx(p,{})}),e.jsx(u,{children:"Open on GitHub"})]})]})}function C({state:s,className:n}){return s==="MERGED"?e.jsx(k,{"aria-hidden":"true",className:n}):e.jsx(I,{"aria-hidden":"true",className:n})}function V({state:s}){if(s==="NONE")return null;const n=s==="PASSING"?"Checks passing":s==="FAILING"?"Checks failing":"Checks pending",l=s==="PASSING"?R:s==="FAILING"?w:P;return e.jsx("span",{className:`pull-checks ${s.toLowerCase()}`,"aria-label":n,children:e.jsx(l,{"aria-hidden":"true"})})}function g(s){return s==="OPEN"?"Open":s==="CLOSED"?"Closed":"Merged"}function b(s){return s.length===1&&s[0]==="OPEN"}function h({icon:s,title:n,children:l}){return e.jsxs("div",{className:"pulls-notice",children:[e.jsx("span",{className:"pulls-notice-icon","aria-hidden":"true",children:s}),e.jsx("strong",{children:n}),e.jsx("p",{children:l})]})}export{Q as PullRequestsView};
@@ -1 +1 @@
1
- import{r as f,j as e}from"./react-rd22PHbN.js";import{ad as y,ae as N,D as v,c as R,d as C,e as D,j as F,k as S,Q as b,ac as I}from"./App-BXZLGT86.js";import{c as M}from"./index-DAUK3rnz.js";import{A as q,j as Q,k as w,l as z}from"./base-ui-CJ8ZIx3d.js";import"./tanstack-B0Sf7wNU.js";const L=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M12 21h-5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v4.5",key:"svg-1"}],["path",{d:"M14 17.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0",key:"svg-2"}],["path",{d:"M18.5 19.5l2.5 2.5",key:"svg-3"}]],O=M("outline","file-search","FileSearch",L);function E(t,s){const n=[],r=c=>{for(const i of c)i.type==="directory"?r(i.children):n.push({path:i.path,name:i.name,parentPath:N(i.path)})};return r(s?t:y(t)),n}function T(t,s,{includeIgnored:n,activePath:r=null,limit:c=100}){const i=E(t,n),h=x(s).trim(),l=Math.max(0,Math.floor(c));if(!h)return i.sort((a,p)=>a.path===r?-1:p.path===r?1:k(a.path,p.path)).slice(0,l);const u=h.replace(/\s+/g,"");return i.map(a=>{const p=x(a.name),m=x(a.path),o=A(p,m,h,u);return o?{...a,rank:o}:null}).filter(a=>a!==null).sort((a,p)=>P(a.rank,p.rank)||j(a.path)-j(p.path)||k(a.path,p.path)).slice(0,l).map(a=>({path:a.path,name:a.name,parentPath:a.parentPath}))}function A(t,s,n,r){if(t===n)return[0,0,0,0];if(t.startsWith(n))return[1,0,t.length-n.length,0];const c=t.indexOf(n);if(c>=0)return[2,c,t.length-n.length,0];const i=s.indexOf(n);if(i>=0)return[3,i,s.length-n.length,0];const h=g(t,r);if(h)return[4,...h];const l=g(s,r);return l?[5,...l]:null}function g(t,s){if(!s)return null;let n=-1,r=-1,c=0,i=0;for(const h of s){const l=t.indexOf(h,n+1);if(l<0)return null;r<0&&(r=l),n>=0&&(c+=l-n-1,l===n+1&&(i+=1)),n=l}return[c,-i,r,t.length-s.length]}function P(t,s){for(let n=0;n<Math.max(t.length,s.length);n+=1){const r=(t[n]??0)-(s[n]??0);if(r!==0)return r}return 0}function x(t){return t.replace(/\\/g,"/").toLocaleLowerCase()}function j(t){return t.split("/").length}function k(t,s){return t.localeCompare(s,void 0,{sensitivity:"base"})||t.localeCompare(s)}function W({open:t,files:s,includeIgnored:n,activePath:r,onOpenChange:c,onOpenFile:i}){const[h,l]=f.useState(""),u=f.useRef(null),a=f.useMemo(()=>s?T(s,h,{includeIgnored:n,activePath:r,limit:100}):[],[r,s,n,h]);f.useEffect(()=>{t&&(l(""),window.requestAnimationFrame(()=>u.current?.focus()))},[t]);const p=o=>{i(o)&&c(!1)},m=h.trim();return e.jsx(v,{open:t,onOpenChange:c,children:e.jsxs(R,{className:"quick-open-dialog top-[max(64px,12vh)] w-[min(640px,calc(100vw-2.5rem))] -translate-y-0",children:[e.jsx(C,{className:"sr-only",children:"Open file"}),e.jsx(D,{className:"sr-only",children:"Search files in the current repository."}),e.jsxs(q,{items:a,value:h,onValueChange:l,itemToStringValue:o=>o.path,mode:"none",inline:!0,open:t,autoHighlight:"always",onOpenChange:(o,d)=>{!o&&d.reason!=="item-press"&&c(!1)},children:[e.jsxs("div",{className:"quick-open-input-shell",children:[e.jsx(F,{"aria-hidden":"true"}),e.jsx(Q,{ref:u,"aria-label":"Search files by name or path",autoComplete:"off",spellCheck:!1,placeholder:"Search files by name or path"})]}),e.jsx(w,{"aria-label":"Repository files",className:"quick-open-results",children:s===null?e.jsxs("div",{className:"quick-open-status loading",role:"status",children:[e.jsx(S,{className:"spinner","aria-hidden":"true"})," ",e.jsx(b,{text:"Loading files…"})]}):a.length===0?e.jsxs("div",{className:"quick-open-status",role:"status",children:[e.jsx(O,{"aria-hidden":"true"}),e.jsx("strong",{children:"No matching files"}),e.jsx("p",{children:m?e.jsxs(e.Fragment,{children:["Nothing matches ",e.jsx("em",{children:m})," in this repository."]}):"This repository has no files to open."})]}):a.map((o,d)=>e.jsxs(z,{value:o,index:d,className:"quick-open-result",onClick:()=>p(o.path),children:[e.jsx("img",{className:"quick-open-icon",src:I(o.path),alt:"","aria-hidden":"true",draggable:!1}),e.jsx("span",{className:"quick-open-name",children:o.name}),e.jsx("span",{className:"quick-open-parent",children:o.parentPath||"Repository root"})]},o.path))})]}),e.jsxs("footer",{className:"quick-open-footer",children:[e.jsxs("span",{className:"quick-open-hints",children:[e.jsxs("span",{children:[e.jsx("kbd",{children:"↑"}),e.jsx("kbd",{children:"↓"})," navigate"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"↵"})," open"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"Esc"})," close"]})]}),s!==null&&e.jsx("span",{className:"quick-open-count",children:a.length===100?"Top 100 matches":`${a.length} ${a.length===1?"file":"files"}`})]})]})})}export{W as QuickOpenDialog};
1
+ import{r as f,j as e}from"./react-rd22PHbN.js";import{a2 as y,a3 as N,D as v,a as R,b as C,c as b,W as D,g as F,q as S,a1 as q}from"./App-Dfm5F199.js";import{c as I}from"./index-B5RC4THs.js";import{A as M,j as w,k as z,l as L}from"./base-ui-CJ8ZIx3d.js";import"./tanstack-CcfAJoQ7.js";const O=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M12 21h-5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v4.5",key:"svg-1"}],["path",{d:"M14 17.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0",key:"svg-2"}],["path",{d:"M18.5 19.5l2.5 2.5",key:"svg-3"}]],Q=I("outline","file-search","FileSearch",O);function E(t,s){const n=[],r=c=>{for(const i of c)i.type==="directory"?r(i.children):n.push({path:i.path,name:i.name,parentPath:N(i.path)})};return r(s?t:y(t)),n}function T(t,s,{includeIgnored:n,activePath:r=null,limit:c=100}){const i=E(t,n),h=x(s).trim(),l=Math.max(0,Math.floor(c));if(!h)return i.sort((a,p)=>a.path===r?-1:p.path===r?1:k(a.path,p.path)).slice(0,l);const u=h.replace(/\s+/g,"");return i.map(a=>{const p=x(a.name),m=x(a.path),o=A(p,m,h,u);return o?{...a,rank:o}:null}).filter(a=>a!==null).sort((a,p)=>P(a.rank,p.rank)||j(a.path)-j(p.path)||k(a.path,p.path)).slice(0,l).map(a=>({path:a.path,name:a.name,parentPath:a.parentPath}))}function A(t,s,n,r){if(t===n)return[0,0,0,0];if(t.startsWith(n))return[1,0,t.length-n.length,0];const c=t.indexOf(n);if(c>=0)return[2,c,t.length-n.length,0];const i=s.indexOf(n);if(i>=0)return[3,i,s.length-n.length,0];const h=g(t,r);if(h)return[4,...h];const l=g(s,r);return l?[5,...l]:null}function g(t,s){if(!s)return null;let n=-1,r=-1,c=0,i=0;for(const h of s){const l=t.indexOf(h,n+1);if(l<0)return null;r<0&&(r=l),n>=0&&(c+=l-n-1,l===n+1&&(i+=1)),n=l}return[c,-i,r,t.length-s.length]}function P(t,s){for(let n=0;n<Math.max(t.length,s.length);n+=1){const r=(t[n]??0)-(s[n]??0);if(r!==0)return r}return 0}function x(t){return t.replace(/\\/g,"/").toLocaleLowerCase()}function j(t){return t.split("/").length}function k(t,s){return t.localeCompare(s,void 0,{sensitivity:"base"})||t.localeCompare(s)}function U({open:t,files:s,includeIgnored:n,activePath:r,onOpenChange:c,onOpenFile:i}){const[h,l]=f.useState(""),u=f.useRef(null),a=f.useMemo(()=>s?T(s,h,{includeIgnored:n,activePath:r,limit:100}):[],[r,s,n,h]);f.useEffect(()=>{t&&(l(""),window.requestAnimationFrame(()=>u.current?.focus()))},[t]);const p=o=>{i(o)&&c(!1)},m=h.trim();return e.jsx(v,{open:t,onOpenChange:c,children:e.jsxs(R,{className:"quick-open-dialog top-[max(64px,12vh)] w-[min(640px,calc(100vw-2.5rem))] -translate-y-0",children:[e.jsx(C,{className:"sr-only",children:"Open file"}),e.jsx(b,{className:"sr-only",children:"Search files in the current repository."}),e.jsxs(M,{items:a,value:h,onValueChange:l,itemToStringValue:o=>o.path,mode:"none",inline:!0,open:t,autoHighlight:"always",onOpenChange:(o,d)=>{!o&&d.reason!=="item-press"&&c(!1)},children:[e.jsxs("div",{className:"quick-open-input-shell",children:[e.jsx(D,{"aria-hidden":"true"}),e.jsx(w,{ref:u,"aria-label":"Search files by name or path",autoComplete:"off",spellCheck:!1,placeholder:"Search files by name or path"})]}),e.jsx(z,{"aria-label":"Repository files",className:"quick-open-results",children:s===null?e.jsxs("div",{className:"quick-open-status loading",role:"status",children:[e.jsx(F,{className:"spinner","aria-hidden":"true"})," ",e.jsx(S,{text:"Loading files…"})]}):a.length===0?e.jsxs("div",{className:"quick-open-status",role:"status",children:[e.jsx(Q,{"aria-hidden":"true"}),e.jsx("strong",{children:"No matching files"}),e.jsx("p",{children:m?e.jsxs(e.Fragment,{children:["Nothing matches ",e.jsx("em",{children:m})," in this repository."]}):"This repository has no files to open."})]}):a.map((o,d)=>e.jsxs(L,{value:o,index:d,className:"quick-open-result",onClick:()=>p(o.path),children:[e.jsx("img",{className:"quick-open-icon",src:q(o.path),alt:"","aria-hidden":"true",draggable:!1}),e.jsx("span",{className:"quick-open-name",children:o.name}),e.jsx("span",{className:"quick-open-parent",children:o.parentPath||"Repository root"})]},o.path))})]}),e.jsxs("footer",{className:"quick-open-footer",children:[e.jsxs("span",{className:"quick-open-hints",children:[e.jsxs("span",{children:[e.jsx("kbd",{children:"↑"}),e.jsx("kbd",{children:"↓"})," navigate"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"↵"})," open"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"Esc"})," close"]})]}),s!==null&&e.jsx("span",{className:"quick-open-count",children:a.length===100?"Top 100 matches":`${a.length} ${a.length===1?"file":"files"}`})]})]})})}export{U as QuickOpenDialog};
@@ -1 +1 @@
1
- import{r as o,j as e}from"./react-rd22PHbN.js";import{D as W,c as Y,d as q,e as Q,g as I,I as Z,m as w,M as z,k as O,F as C,G as ee,C as E,H as se,S as ne,O as ae}from"./App-BXZLGT86.js";import{B as r,T as k,a as B,b as R,o as h}from"./index-DAUK3rnz.js";import{I as ie,a as re}from"./IconFolderSymlink-BZSLX1ez.js";import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";const D="__opentig_no_project__";function he({open:l,projects:c,repositories:x,onOpenChange:_,onOrganizationChange:M,onForgetRepository:L,onRelocateRepository:P}){const[A,g]=o.useState(null),[p,f]=o.useState(null),[b,T]=o.useState(""),[y,d]=o.useState(null),[N,$]=o.useState(""),[G,j]=o.useState(null),[n,v]=o.useState(null),[S,m]=o.useState(null),H=o.useMemo(()=>new Map(c.flatMap(s=>s.repositoryKeys.map(a=>[a,s.id]))),[c]);o.useEffect(()=>{l||(g(null),f(null),d(null),j(null),m(null))},[l]);const u=async(s,a)=>{v(s),m(null);try{const t=await a();return M(t),!0}catch(t){return m(F(t)),!1}finally{v(null)}},J=async s=>{s.preventDefault();const a=b.trim();!a||n||await u("create",()=>h.projects.create(a))&&T("")},K=async s=>{s.preventDefault();const a=N.trim();!y||!a||n||await u(`rename:${y}`,()=>h.projects.rename(y,a))&&d(null)},X=async s=>{n||await u(`remove:${s}`,()=>h.projects.remove(s))&&j(null)},U=async(s,a)=>{n||await u(`assign:${s}`,()=>h.projects.assign(s,a))},V=async s=>{if(!n){if(m(null),!window.opentigDesktop){f(s);return}v(`relocate:${s.key}`);try{const a=await h.repository.select(`Relocate ${s.name}`);a&&await P(s,a)}catch(a){m(F(a))}finally{v(null)}}};return e.jsxs(W,{open:l,onOpenChange:s=>{n||_(s)},children:[e.jsxs(Y,{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(q,{children:"Manage projects"}),e.jsx(Q,{children:"Group repositories, update their locations, or remove them from OpenTig. Files stay on disk."})]}),e.jsx(I,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":"Close project management",disabled:!!n}),children:e.jsx(Z,{})})]}),e.jsxs("div",{className:"repository-projects-body",children:[S&&e.jsxs("div",{className:"repository-projects-error",role:"alert",children:[e.jsx(w,{"aria-hidden":"true"}),e.jsx("span",{children:S})]}),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=>{J(s)},children:[e.jsx("label",{className:"sr-only",htmlFor:"new-project-name",children:"Project name"}),e.jsx("input",{id:"new-project-name",value:b,maxLength:z,onChange:s=>T(s.target.value),placeholder:"New project name",disabled:!!n}),e.jsxs(r,{type:"submit",size:"sm",disabled:!b.trim()||!!n,children:[n==="create"?e.jsx(O,{className:"animate-spin"}):e.jsx(ie,{})," 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:y===s.id?e.jsxs("form",{className:"repository-inline-form",onSubmit:i=>{K(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:N,maxLength:z,onChange:i=>$(i.target.value),disabled:!!n}),e.jsx(r,{type:"submit",size:"xs",disabled:!N.trim()||!!n,children:"Save"}),e.jsx(r,{type:"button",variant:"ghost",size:"xs",onClick:()=>d(null),disabled:!!n,children:"Cancel"})]}):G===s.id?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(w,{"aria-hidden":"true"}),e.jsxs("span",{children:["Delete ",e.jsx("strong",{children:s.name}),"? Its repositories stay available, just ungrouped."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{X(s.id)},children:"Delete"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>j(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"repository-project-icon","aria-hidden":"true",children:e.jsx(C,{})}),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(r,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${s.name}`,disabled:!!n,onClick:()=>{d(s.id),$(s.name),j(null)},children:e.jsx(ee,{})}),e.jsx(r,{variant:"ghost",size:"icon-sm",className:"repository-row-delete","aria-label":`Delete ${s.name}`,disabled:!!n,onClick:()=>{j(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:x.length})]}),e.jsx("p",{children:"One project per repository"})]}),e.jsxs("div",{className:"repository-assignment-list",children:[x.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No recent repositories to assign yet."}),x.map(s=>{const a=H.get(s.key)??D,t=n?.endsWith(`:${s.key}`);return e.jsx("div",{className:"repository-assignment-row","aria-busy":t||void 0,children:A===s.key?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(w,{"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(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{u(`forget:${s.key}`,()=>L(s)).then(i=>{i&&g(null)})},children:"Remove"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>g(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx(C,{"aria-hidden":"true"}),e.jsxs("span",{className:"repository-assignment-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs(k,{children:[e.jsx(B,{render:e.jsx("small",{}),children:se(s.rootPath,4)}),e.jsx(R,{children:s.rootPath})]})]}),t&&e.jsx(O,{className:"repository-assignment-busy animate-spin","aria-hidden":"true"}),e.jsx(ne,{groups:[{id:"none",label:"",items:[{value:D,label:"No project",pinned:!0}]},{id:"projects",label:"Projects",items:c.map(i=>({value:i.id,label:i.name,icon:e.jsx(C,{})}))}],value:a,onValueChange:i=>{U(s.key,i===D?null:i)},label:`Project for ${s.name}`,triggerLabel:c.find(i=>i.id===a)?.name??"No project",placeholder:"Search projects…",disabled:!!n}),e.jsxs("span",{className:"repository-management-actions",children:[e.jsxs(k,{children:[e.jsx(B,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Relocate ${s.name}`,disabled:!!n,onClick:()=>{V(s)}}),children:e.jsx(re,{})}),e.jsx(R,{children:"Relocate repository"})]}),e.jsxs(k,{children:[e.jsx(B,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.name} from OpenTig`,disabled:!!n,onClick:()=>{g(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(r,{variant:"outline",size:"sm",disabled:!!n}),children:"Done"})})]}),e.jsx(ae,{open:p!==null,onOpenChange:s=>{s||f(null)},title:"Relocate repository",description:`Choose the existing server folder for ${p?.name??"this repository"}. This updates its saved location; it does not move files.`,confirmLabel:"Use this folder",initialPath:p?.recent.path,recent:x.map(s=>s.recent),onBrowse:h.repository.browseDirectories,onOpen:async s=>{p&&await P(p,s)}})]})}function F(l){return l instanceof Error?l.message:String(l)}export{he as RepositoryProjectsDialog};
1
+ import{r as o,j as e}from"./react-rd22PHbN.js";import{D as W,a as Y,b as q,c as Q,d as z,e as Z,f as w,M as I,g as O,h as C,i as ee,j as E,s as se,S as ne,O as ae}from"./App-Dfm5F199.js";import{B as r,T as k,b as B,d as R,o as h}from"./index-B5RC4THs.js";import{I as ie,a as re}from"./IconFolderSymlink-C4ydD1eS.js";import"./tanstack-CcfAJoQ7.js";import"./base-ui-CJ8ZIx3d.js";const D="__opentig_no_project__";function he({open:l,projects:c,repositories:x,onOpenChange:F,onOrganizationChange:M,onForgetRepository:L,onRelocateRepository:P}){const[A,g]=o.useState(null),[p,f]=o.useState(null),[b,T]=o.useState(""),[y,d]=o.useState(null),[N,$]=o.useState(""),[G,j]=o.useState(null),[n,v]=o.useState(null),[S,m]=o.useState(null),J=o.useMemo(()=>new Map(c.flatMap(s=>s.repositoryKeys.map(a=>[a,s.id]))),[c]);o.useEffect(()=>{l||(g(null),f(null),d(null),j(null),m(null))},[l]);const u=async(s,a)=>{v(s),m(null);try{const t=await a();return M(t),!0}catch(t){return m(_(t)),!1}finally{v(null)}},K=async s=>{s.preventDefault();const a=b.trim();!a||n||await u("create",()=>h.projects.create(a))&&T("")},X=async s=>{s.preventDefault();const a=N.trim();!y||!a||n||await u(`rename:${y}`,()=>h.projects.rename(y,a))&&d(null)},H=async s=>{n||await u(`remove:${s}`,()=>h.projects.remove(s))&&j(null)},U=async(s,a)=>{n||await u(`assign:${s}`,()=>h.projects.assign(s,a))},V=async s=>{if(!n){if(m(null),!window.opentigDesktop){f(s);return}v(`relocate:${s.key}`);try{const a=await h.repository.select(`Relocate ${s.name}`);a&&await P(s,a)}catch(a){m(_(a))}finally{v(null)}}};return e.jsxs(W,{open:l,onOpenChange:s=>{n||F(s)},children:[e.jsxs(Y,{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(q,{children:"Manage projects"}),e.jsx(Q,{children:"Group repositories, update their locations, or remove them from OpenTig. Files stay on disk."})]}),e.jsx(z,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":"Close project management",disabled:!!n}),children:e.jsx(Z,{})})]}),e.jsxs("div",{className:"repository-projects-body",children:[S&&e.jsxs("div",{className:"repository-projects-error",role:"alert",children:[e.jsx(w,{"aria-hidden":"true"}),e.jsx("span",{children:S})]}),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=>{K(s)},children:[e.jsx("label",{className:"sr-only",htmlFor:"new-project-name",children:"Project name"}),e.jsx("input",{id:"new-project-name",value:b,maxLength:I,onChange:s=>T(s.target.value),placeholder:"New project name",disabled:!!n}),e.jsxs(r,{type:"submit",size:"sm",disabled:!b.trim()||!!n,children:[n==="create"?e.jsx(O,{className:"animate-spin"}):e.jsx(ie,{})," 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:y===s.id?e.jsxs("form",{className:"repository-inline-form",onSubmit:i=>{X(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:N,maxLength:I,onChange:i=>$(i.target.value),disabled:!!n}),e.jsx(r,{type:"submit",size:"xs",disabled:!N.trim()||!!n,children:"Save"}),e.jsx(r,{type:"button",variant:"ghost",size:"xs",onClick:()=>d(null),disabled:!!n,children:"Cancel"})]}):G===s.id?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(w,{"aria-hidden":"true"}),e.jsxs("span",{children:["Delete ",e.jsx("strong",{children:s.name}),"? Its repositories stay available, just ungrouped."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{H(s.id)},children:"Delete"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>j(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"repository-project-icon","aria-hidden":"true",children:e.jsx(C,{})}),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(r,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${s.name}`,disabled:!!n,onClick:()=>{d(s.id),$(s.name),j(null)},children:e.jsx(ee,{})}),e.jsx(r,{variant:"ghost",size:"icon-sm",className:"repository-row-delete","aria-label":`Delete ${s.name}`,disabled:!!n,onClick:()=>{j(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:x.length})]}),e.jsx("p",{children:"One project per repository"})]}),e.jsxs("div",{className:"repository-assignment-list",children:[x.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No recent repositories to assign yet."}),x.map(s=>{const a=J.get(s.key)??D,t=n?.endsWith(`:${s.key}`);return e.jsx("div",{className:"repository-assignment-row","aria-busy":t||void 0,children:A===s.key?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(w,{"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(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{u(`forget:${s.key}`,()=>L(s)).then(i=>{i&&g(null)})},children:"Remove"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>g(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx(C,{"aria-hidden":"true"}),e.jsxs("span",{className:"repository-assignment-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs(k,{children:[e.jsx(B,{render:e.jsx("small",{}),children:se(s.rootPath,4)}),e.jsx(R,{children:s.rootPath})]})]}),t&&e.jsx(O,{className:"repository-assignment-busy animate-spin","aria-hidden":"true"}),e.jsx(ne,{groups:[{id:"none",label:"",items:[{value:D,label:"No project",pinned:!0}]},{id:"projects",label:"Projects",items:c.map(i=>({value:i.id,label:i.name,icon:e.jsx(C,{})}))}],value:a,onValueChange:i=>{U(s.key,i===D?null:i)},label:`Project for ${s.name}`,triggerLabel:c.find(i=>i.id===a)?.name??"No project",placeholder:"Search projects…",disabled:!!n}),e.jsxs("span",{className:"repository-management-actions",children:[e.jsxs(k,{children:[e.jsx(B,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Relocate ${s.name}`,disabled:!!n,onClick:()=>{V(s)}}),children:e.jsx(re,{})}),e.jsx(R,{children:"Relocate repository"})]}),e.jsxs(k,{children:[e.jsx(B,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.name} from OpenTig`,disabled:!!n,onClick:()=>{g(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(z,{render:e.jsx(r,{variant:"outline",size:"sm",disabled:!!n}),children:"Done"})})]}),e.jsx(ae,{open:p!==null,onOpenChange:s=>{s||f(null)},title:"Relocate repository",description:`Choose the existing server folder for ${p?.name??"this repository"}. This updates its saved location; it does not move files.`,confirmLabel:"Use this folder",initialPath:p?.recent.path,recent:x.map(s=>s.recent),onBrowse:h.repository.browseDirectories,onOpen:async s=>{p&&await P(p,s)}})]})}function _(l){return l instanceof Error?l.message:String(l)}export{he as RepositoryProjectsDialog};
@@ -0,0 +1 @@
1
+ import{r as t,j as e}from"./react-rd22PHbN.js";import{V as pe,ak as A,_ as P,W as fe,q as Y,g as me}from"./App-Dfm5F199.js";import{u as xe,a as ve}from"./tanstack-CcfAJoQ7.js";import{c as x,B as k,T as W,b as D,d as O,s as m,o as J,q as je}from"./index-B5RC4THs.js";import"./base-ui-CJ8ZIx3d.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),[$,L]=t.useState(!1),[oe,he]=t.useState(0),[Q,V]=t.useState(()=>new Set),G=t.useRef(null),K=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:()=>J.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&&G.current?.focus()},[c]),t.useEffect(()=>{d.data&&V(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=!Q.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},[Q,n]),T=ve({count:I.length,getScrollElement:()=>K.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=>V(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}L(!0);try{const r=await J.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{L(!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(P,{})}),e.jsxs("div",{className:"search-input",children:[e.jsx(fe,{"aria-hidden":"true"}),e.jsx("input",{ref:G,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(Y,{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:K,className:"search-results",children:[q&&!n&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(me,{className:"spinner"})," ",e.jsx(Y,{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(P,{}),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};