@alpacachen/dsh-simple-worktree 1.0.8 → 1.0.9
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/client/client.js +3 -3
- package/lib/index.js +6 -1
- package/package.json +1 -1
package/client/client.js
CHANGED
|
@@ -3,7 +3,7 @@ window.__ModuleLoader__.load({
|
|
|
3
3
|
factory: function (require) {
|
|
4
4
|
var module = { exports: {} }
|
|
5
5
|
var exports = module.exports
|
|
6
|
-
"use strict";var Io=Object.create;var Oe=Object.defineProperty;var ho=Object.getOwnPropertyDescriptor;var go=Object.getOwnPropertyNames;var Co=Object.getPrototypeOf,So=Object.prototype.hasOwnProperty;var wo=(e,a)=>{for(var t in a)Oe(e,t,{get:a[t],enumerable:!0})},Aa=(e,a,t,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of go(a))!So.call(e,r)&&r!==t&&Oe(e,r,{get:()=>a[r],enumerable:!(o=ho(a,r))||o.enumerable});return e};var A=(e,a,t)=>(t=e!=null?Io(Co(e)):{},Aa(a||!e||!e.__esModule?Oe(t,"default",{value:e,enumerable:!0}):t,e)),vo=e=>Aa(Oe({},"__esModule",{value:!0}),e);var
|
|
6
|
+
"use strict";var Io=Object.create;var Oe=Object.defineProperty;var ho=Object.getOwnPropertyDescriptor;var go=Object.getOwnPropertyNames;var Co=Object.getPrototypeOf,So=Object.prototype.hasOwnProperty;var wo=(e,a)=>{for(var t in a)Oe(e,t,{get:a[t],enumerable:!0})},Aa=(e,a,t,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of go(a))!So.call(e,r)&&r!==t&&Oe(e,r,{get:()=>a[r],enumerable:!(o=ho(a,r))||o.enumerable});return e};var A=(e,a,t)=>(t=e!=null?Io(Co(e)):{},Aa(a||!e||!e.__esModule?Oe(t,"default",{value:e,enumerable:!0}):t,e)),vo=e=>Aa(Oe({},"__esModule",{value:!0}),e);var Gr={};wo(Gr,{default:()=>Nr});module.exports=vo(Gr);var Qe=require("react");var Da=`@layer dsh-simple-worktree {
|
|
7
7
|
.dswt-dialog-overlay {
|
|
8
8
|
position: fixed;
|
|
9
9
|
inset: 0;
|
|
@@ -167,11 +167,11 @@ Path: {path}`,retryRegister:"Retry registration and open",cleanupCreated:"Clean
|
|
|
167
167
|
`)},vt=function(){var e=parseInt(document.body.getAttribute(he)||"0",10);return isFinite(e)?e:0},mr=function(){ge.useEffect(function(){return document.body.setAttribute(he,(vt()+1).toString()),function(){var e=vt()-1;e<=0?document.body.removeAttribute(he):document.body.setAttribute(he,e.toString())}},[])},Ca=function(e){var a=e.noRelative,t=e.noImportant,o=e.gapMode,r=o===void 0?"margin":o;mr();var u=ge.useMemo(function(){return ga(r)},[r]);return ge.createElement(cr,{styles:pr(u,!a,r,t?"":"!important")})};var Sa=!1;if(typeof window<"u")try{Be=Object.defineProperty({},"passive",{get:function(){return Sa=!0,!0}}),window.addEventListener("test",Be,Be),window.removeEventListener("test",Be,Be)}catch{Sa=!1}var Be,ie=Sa?{passive:!1}:!1;var Lr=function(e){return e.tagName==="TEXTAREA"},kt=function(e,a){if(!(e instanceof Element))return!1;var t=window.getComputedStyle(e);return t[a]!=="hidden"&&!(t.overflowY===t.overflowX&&!Lr(e)&&t[a]==="visible")},xr=function(e){return kt(e,"overflowY")},Ir=function(e){return kt(e,"overflowX")},wa=function(e,a){var t=a.ownerDocument,o=a;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var r=yt(e,o);if(r){var u=Pt(e,o),s=u[1],l=u[2];if(s>l)return!0}o=o.parentNode}while(o&&o!==t.body);return!1},hr=function(e){var a=e.scrollTop,t=e.scrollHeight,o=e.clientHeight;return[a,t,o]},gr=function(e){var a=e.scrollLeft,t=e.scrollWidth,o=e.clientWidth;return[a,t,o]},yt=function(e,a){return e==="v"?xr(a):Ir(a)},Pt=function(e,a){return e==="v"?hr(a):gr(a)},Cr=function(e,a){return e==="h"&&a==="rtl"?-1:1},bt=function(e,a,t,o,r){var u=Cr(e,window.getComputedStyle(a).direction),s=u*o,l=t.target,i=a.contains(l),n=!1,c=s>0,m=0,x=0;do{if(!l)break;var I=Pt(e,l),h=I[0],d=I[1],p=I[2],L=d-p-u*h;(h||L)&&yt(e,l)&&(m+=L,x+=h);var f=l.parentNode;l=f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE?f.host:f}while(!i&&l!==document.body||i&&(a.contains(l)||a===l));return(c&&(r&&Math.abs(m)<1||!r&&s>m)||!c&&(r&&Math.abs(x)<1||!r&&-s>x))&&(n=!0),n};var Ke=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Rt=function(e){return[e.deltaX,e.deltaY]},At=function(e){return e&&"current"in e?e.current:e},Sr=function(e,a){return e[0]===a[0]&&e[1]===a[1]},wr=function(e){return`
|
|
168
168
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
169
169
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
170
|
-
`)},vr=0,Ce=[];function Dt(e){var a=D.useRef([]),t=D.useRef([0,0]),o=D.useRef(),r=D.useState(vr++)[0],u=D.useState(De)[0],s=D.useRef(e);D.useEffect(function(){s.current=e},[e]),D.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var d=mt([e.lockRef.current],(e.shards||[]).map(At),!0).filter(Boolean);return d.forEach(function(p){return p.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),d.forEach(function(p){return p.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=D.useCallback(function(d,p){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!s.current.allowPinchZoom;var L=Ke(d),f=t.current,C="deltaX"in d?d.deltaX:f[0]-L[0],S="deltaY"in d?d.deltaY:f[1]-L[1],w,y=d.target,g=Math.abs(C)>Math.abs(S)?"h":"v";if("touches"in d&&g==="h"&&y.type==="range")return!1;var T=window.getSelection(),$=T&&T.anchorNode,le=$?$===y||$.contains(y):!1;if(le)return!1;var me=wa(g,y);if(!me)return!0;if(me?w=g:(w=g==="v"?"h":"v",me=wa(g,y)),!me)return!1;if(!o.current&&"changedTouches"in d&&(C||S)&&(o.current=w),!w)return!0;var Te=o.current||w;return bt(Te,p,d,Te==="h"?C:S,!0)},[]),i=D.useCallback(function(d){var p=d;if(!(!Ce.length||Ce[Ce.length-1]!==u)){var L="deltaY"in p?Rt(p):Ke(p),f=a.current.filter(function(w){return w.name===p.type&&(w.target===p.target||p.target===w.shadowParent)&&Sr(w.delta,L)})[0];if(f&&f.should){p.cancelable&&p.preventDefault();return}if(!f){var C=(s.current.shards||[]).map(At).filter(Boolean).filter(function(w){return w.contains(p.target)}),S=C.length>0?l(p,C[0]):!s.current.noIsolation;S&&p.cancelable&&p.preventDefault()}}},[]),n=D.useCallback(function(d,p,L,f){var C={name:d,delta:p,target:L,should:f,shadowParent:kr(L)};a.current.push(C),setTimeout(function(){a.current=a.current.filter(function(S){return S!==C})},1)},[]),c=D.useCallback(function(d){t.current=Ke(d),o.current=void 0},[]),m=D.useCallback(function(d){n(d.type,Rt(d),d.target,l(d,e.lockRef.current))},[]),x=D.useCallback(function(d){n(d.type,Ke(d),d.target,l(d,e.lockRef.current))},[]);D.useEffect(function(){return Ce.push(u),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",i,ie),document.addEventListener("touchmove",i,ie),document.addEventListener("touchstart",c,ie),function(){Ce=Ce.filter(function(d){return d!==u}),document.removeEventListener("wheel",i,ie),document.removeEventListener("touchmove",i,ie),document.removeEventListener("touchstart",c,ie)}},[]);var I=e.removeScrollBar,h=e.inert;return D.createElement(D.Fragment,null,h?D.createElement(u,{styles:wr(r)}):null,I?D.createElement(Ca,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function kr(e){for(var a=null;e!==null;)e instanceof ShadowRoot&&(a=e.host,e=e.host),e=e.parentNode;return a}var Bt=ma(Xe,Dt);var Mt=je.forwardRef(function(e,a){return je.createElement(Ae,q({},e,{ref:a,sideCar:Bt}))});Mt.classNames=Ae.classNames;var va=Mt;var yr=function(e){if(typeof document>"u")return null;var a=Array.isArray(e)?e[0]:e;return a.ownerDocument.body},Se=new WeakMap,Ze=new WeakMap,$e={},ka=0,Ft=function(e){return e&&(e.host||Ft(e.parentNode))},Pr=function(e,a){return a.map(function(t){if(e.contains(t))return t;var o=Ft(t);return o&&e.contains(o)?o:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(t){return!!t})},br=function(e,a,t,o){var r=Pr(a,Array.isArray(e)?e:[e]);$e[t]||($e[t]=new WeakMap);var u=$e[t],s=[],l=new Set,i=new Set(r),n=function(m){!m||l.has(m)||(l.add(m),n(m.parentNode))};r.forEach(n);var c=function(m){!m||i.has(m)||Array.prototype.forEach.call(m.children,function(x){if(l.has(x))c(x);else try{var I=x.getAttribute(o),h=I!==null&&I!=="false",d=(Se.get(x)||0)+1,p=(u.get(x)||0)+1;Se.set(x,d),u.set(x,p),s.push(x),d===1&&h&&Ze.set(x,!0),p===1&&x.setAttribute(t,"true"),h||x.setAttribute(o,"true")}catch(L){console.error("aria-hidden: cannot operate on ",x,L)}})};return c(a),l.clear(),ka++,function(){s.forEach(function(m){var x=Se.get(m)-1,I=u.get(m)-1;Se.set(m,x),u.set(m,I),x||(Ze.has(m)||m.removeAttribute(o),Ze.delete(m)),I||m.removeAttribute(t)}),ka--,ka||(Se=new WeakMap,Se=new WeakMap,Ze=new WeakMap,$e={})}},Tt=function(e,a,t){t===void 0&&(t="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=a||yr(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),br(o,r,t,"aria-hidden")):function(){return null}};var k=require("react/jsx-runtime"),ya="Dialog",[Ot,
|
|
170
|
+
`)},vr=0,Ce=[];function Dt(e){var a=D.useRef([]),t=D.useRef([0,0]),o=D.useRef(),r=D.useState(vr++)[0],u=D.useState(De)[0],s=D.useRef(e);D.useEffect(function(){s.current=e},[e]),D.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var d=mt([e.lockRef.current],(e.shards||[]).map(At),!0).filter(Boolean);return d.forEach(function(p){return p.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),d.forEach(function(p){return p.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=D.useCallback(function(d,p){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!s.current.allowPinchZoom;var L=Ke(d),f=t.current,C="deltaX"in d?d.deltaX:f[0]-L[0],S="deltaY"in d?d.deltaY:f[1]-L[1],w,y=d.target,g=Math.abs(C)>Math.abs(S)?"h":"v";if("touches"in d&&g==="h"&&y.type==="range")return!1;var T=window.getSelection(),$=T&&T.anchorNode,le=$?$===y||$.contains(y):!1;if(le)return!1;var me=wa(g,y);if(!me)return!0;if(me?w=g:(w=g==="v"?"h":"v",me=wa(g,y)),!me)return!1;if(!o.current&&"changedTouches"in d&&(C||S)&&(o.current=w),!w)return!0;var Te=o.current||w;return bt(Te,p,d,Te==="h"?C:S,!0)},[]),i=D.useCallback(function(d){var p=d;if(!(!Ce.length||Ce[Ce.length-1]!==u)){var L="deltaY"in p?Rt(p):Ke(p),f=a.current.filter(function(w){return w.name===p.type&&(w.target===p.target||p.target===w.shadowParent)&&Sr(w.delta,L)})[0];if(f&&f.should){p.cancelable&&p.preventDefault();return}if(!f){var C=(s.current.shards||[]).map(At).filter(Boolean).filter(function(w){return w.contains(p.target)}),S=C.length>0?l(p,C[0]):!s.current.noIsolation;S&&p.cancelable&&p.preventDefault()}}},[]),n=D.useCallback(function(d,p,L,f){var C={name:d,delta:p,target:L,should:f,shadowParent:kr(L)};a.current.push(C),setTimeout(function(){a.current=a.current.filter(function(S){return S!==C})},1)},[]),c=D.useCallback(function(d){t.current=Ke(d),o.current=void 0},[]),m=D.useCallback(function(d){n(d.type,Rt(d),d.target,l(d,e.lockRef.current))},[]),x=D.useCallback(function(d){n(d.type,Ke(d),d.target,l(d,e.lockRef.current))},[]);D.useEffect(function(){return Ce.push(u),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",i,ie),document.addEventListener("touchmove",i,ie),document.addEventListener("touchstart",c,ie),function(){Ce=Ce.filter(function(d){return d!==u}),document.removeEventListener("wheel",i,ie),document.removeEventListener("touchmove",i,ie),document.removeEventListener("touchstart",c,ie)}},[]);var I=e.removeScrollBar,h=e.inert;return D.createElement(D.Fragment,null,h?D.createElement(u,{styles:wr(r)}):null,I?D.createElement(Ca,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function kr(e){for(var a=null;e!==null;)e instanceof ShadowRoot&&(a=e.host,e=e.host),e=e.parentNode;return a}var Bt=ma(Xe,Dt);var Mt=je.forwardRef(function(e,a){return je.createElement(Ae,q({},e,{ref:a,sideCar:Bt}))});Mt.classNames=Ae.classNames;var va=Mt;var yr=function(e){if(typeof document>"u")return null;var a=Array.isArray(e)?e[0]:e;return a.ownerDocument.body},Se=new WeakMap,Ze=new WeakMap,$e={},ka=0,Ft=function(e){return e&&(e.host||Ft(e.parentNode))},Pr=function(e,a){return a.map(function(t){if(e.contains(t))return t;var o=Ft(t);return o&&e.contains(o)?o:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)}).filter(function(t){return!!t})},br=function(e,a,t,o){var r=Pr(a,Array.isArray(e)?e:[e]);$e[t]||($e[t]=new WeakMap);var u=$e[t],s=[],l=new Set,i=new Set(r),n=function(m){!m||l.has(m)||(l.add(m),n(m.parentNode))};r.forEach(n);var c=function(m){!m||i.has(m)||Array.prototype.forEach.call(m.children,function(x){if(l.has(x))c(x);else try{var I=x.getAttribute(o),h=I!==null&&I!=="false",d=(Se.get(x)||0)+1,p=(u.get(x)||0)+1;Se.set(x,d),u.set(x,p),s.push(x),d===1&&h&&Ze.set(x,!0),p===1&&x.setAttribute(t,"true"),h||x.setAttribute(o,"true")}catch(L){console.error("aria-hidden: cannot operate on ",x,L)}})};return c(a),l.clear(),ka++,function(){s.forEach(function(m){var x=Se.get(m)-1,I=u.get(m)-1;Se.set(m,x),u.set(m,I),x||(Ze.has(m)||m.removeAttribute(o),Ze.delete(m)),I||m.removeAttribute(t)}),ka--,ka||(Se=new WeakMap,Se=new WeakMap,Ze=new WeakMap,$e={})}},Tt=function(e,a,t){t===void 0&&(t="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=a||yr(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),br(o,r,t,"aria-hidden")):function(){return null}};var k=require("react/jsx-runtime"),ya="Dialog",[Ot,Ls]=Va(ya),[Rr,_]=Ot(ya),Et=e=>{let{__scopeDialog:a,children:t,open:o,defaultOpen:r,onOpenChange:u,modal:s=!0}=e,l=b.useRef(null),i=b.useRef(null),[n=!1,c]=_a({prop:o,defaultProp:r,onChange:u});return(0,k.jsx)(Rr,{scope:a,triggerRef:l,contentRef:i,contentId:We(),titleId:We(),descriptionId:We(),open:n,onOpenChange:c,onOpenToggle:b.useCallback(()=>c(m=>!m),[c]),modal:s,children:t})};Et.displayName=ya;var qt="DialogTrigger",Ar=b.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(qt,t),u=V(a,r.triggerRef);return(0,k.jsx)(U.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Ra(r.open),...o,ref:u,onClick:j(e.onClick,r.onOpenToggle)})});Ar.displayName=qt;var Pa="DialogPortal",[Dr,Ut]=Ot(Pa,{forceMount:void 0}),Ht=e=>{let{__scopeDialog:a,forceMount:t,children:o,container:r}=e,u=_(Pa,a);return(0,k.jsx)(Dr,{scope:a,forceMount:t,children:b.Children.map(o,s=>(0,k.jsx)(Re,{present:t||u.open,children:(0,k.jsx)(da,{asChild:!0,container:r,children:s})}))})};Ht.displayName=Pa;var Je="DialogOverlay",Wt=b.forwardRef((e,a)=>{let t=Ut(Je,e.__scopeDialog),{forceMount:o=t.forceMount,...r}=e,u=_(Je,e.__scopeDialog);return u.modal?(0,k.jsx)(Re,{present:o||u.open,children:(0,k.jsx)(Br,{...r,ref:a})}):null});Wt.displayName=Je;var Br=b.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(Je,t);return(0,k.jsx)(va,{as:be,allowPinchZoom:!0,shards:[r.contentRef],children:(0,k.jsx)(U.div,{"data-state":Ra(r.open),...o,ref:a,style:{pointerEvents:"auto",...o.style}})})}),ce="DialogContent",Nt=b.forwardRef((e,a)=>{let t=Ut(ce,e.__scopeDialog),{forceMount:o=t.forceMount,...r}=e,u=_(ce,e.__scopeDialog);return(0,k.jsx)(Re,{present:o||u.open,children:u.modal?(0,k.jsx)(Mr,{...r,ref:a}):(0,k.jsx)(Fr,{...r,ref:a})})});Nt.displayName=ce;var Mr=b.forwardRef((e,a)=>{let t=_(ce,e.__scopeDialog),o=b.useRef(null),r=V(a,t.contentRef,o);return b.useEffect(()=>{let u=o.current;if(u)return Tt(u)},[]),(0,k.jsx)(Gt,{...e,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:j(e.onCloseAutoFocus,u=>{u.preventDefault(),t.triggerRef.current?.focus()}),onPointerDownOutside:j(e.onPointerDownOutside,u=>{let s=u.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&u.preventDefault()}),onFocusOutside:j(e.onFocusOutside,u=>u.preventDefault())})}),Fr=b.forwardRef((e,a)=>{let t=_(ce,e.__scopeDialog),o=b.useRef(!1),r=b.useRef(!1);return(0,k.jsx)(Gt,{...e,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{e.onCloseAutoFocus?.(u),u.defaultPrevented||(o.current||t.triggerRef.current?.focus(),u.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:u=>{e.onInteractOutside?.(u),u.defaultPrevented||(o.current=!0,u.detail.originalEvent.type==="pointerdown"&&(r.current=!0));let s=u.target;t.triggerRef.current?.contains(s)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&r.current&&u.preventDefault()}})}),Gt=b.forwardRef((e,a)=>{let{__scopeDialog:t,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:u,...s}=e,l=_(ce,t),i=b.useRef(null),n=V(a,i);return pt(),(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(sa,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:u,children:(0,k.jsx)(ra,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Ra(l.open),...s,ref:n,onDismiss:()=>l.onOpenChange(!1)})}),(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Tr,{titleId:l.titleId}),(0,k.jsx)(Er,{contentRef:i,descriptionId:l.descriptionId})]})]})}),ba="DialogTitle",Vt=b.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(ba,t);return(0,k.jsx)(U.h2,{id:r.titleId,...o,ref:a})});Vt.displayName=ba;var zt="DialogDescription",_t=b.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(zt,t);return(0,k.jsx)(U.p,{id:r.descriptionId,...o,ref:a})});_t.displayName=zt;var Xt="DialogClose",Kt=b.forwardRef((e,a)=>{let{__scopeDialog:t,...o}=e,r=_(Xt,t);return(0,k.jsx)(U.button,{type:"button",...o,ref:a,onClick:j(e.onClick,()=>r.onOpenChange(!1))})});Kt.displayName=Xt;function Ra(e){return e?"open":"closed"}var jt="DialogTitleWarning",[xs,Zt]=Ga(jt,{contentName:ce,titleName:ba,docsSlug:"dialog"}),Tr=({titleId:e})=>{let a=Zt(jt),t=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
|
|
171
171
|
|
|
172
172
|
If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
173
173
|
|
|
174
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(t))},[t,e]),null},Or="DialogDescriptionWarning",Er=({contentRef:e,descriptionId:a})=>{let o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Zt(Or).contentName}}.`;return b.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");a&&r&&(document.getElementById(a)||console.warn(o))},[o,e,a]),null},$t=Et;var Jt=Ht,Qt=Wt,Yt=Nt,eo=Vt,ao=_t,to=Kt;var Z=require("react/jsx-runtime");function H({className:e="",...a}){return(0,Z.jsx)("button",{className:`dswt-button ${e}`,...a})}function oo({className:e="",...a}){return(0,Z.jsx)("input",{className:`dswt-input ${e}`,...a})}function ro({children:e,...a}){return(0,Z.jsx)($t,{...a,children:e})}function uo({children:e}){let a=te();return(0,Z.jsxs)(Jt,{children:[(0,Z.jsx)(Qt,{className:"dswt-dialog-overlay"}),(0,Z.jsxs)(Yt,{className:"dswt-dialog-content",children:[e,(0,Z.jsx)(to,{className:"dswt-dialog-close","aria-label":a("close"),children:(0,Z.jsx)(ye,{size:16})})]})]})}var lo=eo,so=ao;var v=require("react/jsx-runtime");function fo({target:e,api:a,workspaces:t,sessions:o,defaultBaseChoice:r="current",onCreated:u,onClose:s}){let l=te(),[i,n]=(0,Y.useState)(null),[c,m]=(0,Y.useState)(""),[x,I]=(0,Y.useState)(r),[h,d]=(0,Y.useState)(""),[p,L]=(0,Y.useState)(!1),[f,C]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let P=!0;return n(null),d(""),m(""),I(r),a.list(e.path).then(W=>{P&&n(W)}).catch(W=>{P&&d(String(W?.message??W))}),()=>{P=!1}},[a,r,e.path]);let S=i?.repoPath,w=Ua(c),y=`task/${w}`,g=S?Ha(S,w):"",T=i?.worktrees.find(P=>F(P.path)===F(e.path))?.branch??"HEAD",$=i?.defaultBranch??i?.worktrees.find(P=>P.isMain)?.branch??T,le=x==="main"?i?.defaultRef??$:T,me=async(P,W)=>{let J=await t.create({path:P});await t.rename(J.workspaceId,`${e.title}/${W}`);let Le=await t.connectWorkspace(J.workspaceId);u(P),o.open(Le),s()},Te=async()=>{if(f){L(!0),d("");try{await me(f.path,f.branch.replace(/^task\//,"")),C(null)}catch(P){d(`${l("registerFailed")} ${String(P?.message??P)}`)}finally{L(!1)}}},Lo=async()=>{if(f){L(!0),d("");try{await a.remove({repoPath:f.repoPath,path:f.path}),C(null),s()}catch(P){d(oe(l("cleanupFailed"),{error:String(P?.message??P),path:f.path}))}finally{L(!1)}}},xo=async()=>{if(!S||!c.trim()){d(l("fillTaskName"));return}L(!0),d("");let P,W;try{let J=await a.create({repoPath:S,path:g,branch:y,baseRef:le});P=J.path,W=await t.create({path:J.path}),await t.rename(W.workspaceId,`${e.title}/${w}`);let Le=await t.connectWorkspace(W.workspaceId);u(J.path),o.open(Le),s()}catch(J){if(W?.workspaceId)try{await t.delete(W.workspaceId)}catch(Le){P&&C({repoPath:S,path:P,branch:y}),d(oe(l("cleanupFailed"),{error:String(Le?.message??Le),path:P??""}));return}P?(C({repoPath:S,path:P,branch:y}),d(l("registerFailed"))):d(`${l("operationFailed")}${String(J?.message??J)}`)}finally{L(!1)}};return(0,v.jsx)(ro,{open:!0,onOpenChange:P=>{!P&&!p&&s()},children:(0,v.jsxs)(uo,{children:[(0,v.jsx)(lo,{className:"dswt-dialog-title",children:oe(l("dialogTitle"),{name:e.title})}),(0,v.jsx)(so,{className:"dswt-visually-hidden",children:e.title}),h?(0,v.jsxs)("div",{className:"dswt-error",role:"alert",children:[(0,v.jsx)(X,{size:14})," ",h]}):null,(0,v.jsxs)("label",{className:"dswt-field",children:[(0,v.jsx)("span",{className:"dswt-field-label",children:l("taskName")}),(0,v.jsx)(oo,{"aria-label":l("taskName"),value:c,disabled:p,onChange:P=>m(P.target.value),placeholder:l("taskNamePlaceholder"),autoFocus:!0})]}),(0,v.jsxs)("fieldset",{className:"dswt-field dswt-base-fieldset",disabled:p||!i,children:[(0,v.jsx)("legend",{className:"dswt-field-label",children:l("basedOn")}),(0,v.jsxs)("div",{className:"dswt-radio-group",role:"radiogroup","aria-label":l("basedOn"),children:[(0,v.jsxs)("label",{className:"dswt-radio-option","data-selected":x==="current"?"true":void 0,children:[(0,v.jsx)("input",{className:"dswt-radio-input",type:"radio",name:"dswt-base-branch",value:"current",checked:x==="current",onChange:()=>I("current")}),(0,v.jsxs)("span",{className:"dswt-radio-copy",children:[(0,v.jsx)("span",{className:"dswt-radio-label",children:l("currentBranch")}),(0,v.jsx)("span",{className:"dswt-radio-branch",children:T})]})]}),(0,v.jsxs)("label",{className:"dswt-radio-option","data-selected":x==="main"?"true":void 0,children:[(0,v.jsx)("input",{className:"dswt-radio-input",type:"radio",name:"dswt-base-branch",value:"main",checked:x==="main",onChange:()=>I("main")}),(0,v.jsxs)("span",{className:"dswt-radio-copy",children:[(0,v.jsx)("span",{className:"dswt-radio-label",children:l("mainBranch")}),(0,v.jsx)("span",{className:"dswt-radio-branch",children:$})]})]})]})]}),f?(0,v.jsxs)("div",{className:"dswt-dialog-actions",children:[(0,v.jsx)(H,{type:"button",disabled:p,onClick:()=>{Te()},children:l("retryRegister")}),(0,v.jsx)(H,{type:"button",disabled:p,onClick:()=>{Lo()},children:l("cleanupCreated")})]}):null,f?null:(0,v.jsxs)("div",{className:"dswt-dialog-actions",children:[(0,v.jsx)(H,{type:"button",disabled:p,onClick:s,children:l("cancel")}),(0,v.jsxs)(H,{type:"button",className:"dswt-button-primary",disabled:p||!c.trim()||!i,onClick:xo,children:[p?(0,v.jsx)(K,{size:14,className:"dswt-spin"}):null,l(p?"creating":"createAndOpen")]})]})]})})}var pe=require("react/jsx-runtime");function Me(){return(0,pe.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,pe.jsx)("path",{d:"M4 2.25v8.5a2.25 2.25 0 1 0 1.5 0V7.75h4v3a2.25 2.25 0 1 0 1.5 0V6.25H5.5v-4H4Z",fill:"currentColor"}),(0,pe.jsx)("circle",{cx:"4.75",cy:"12.75",r:"1.5",fill:"currentColor"}),(0,pe.jsx)("circle",{cx:"10.25",cy:"12.75",r:"1.5",fill:"currentColor"}),(0,pe.jsx)("circle",{cx:"4.75",cy:"2.25",r:"1.5",fill:"currentColor"})]})}var Fe=require("react/jsx-runtime");function no({session:e,useWorkspaces:a,onOpen:t}){let o=te(),r=a(u=>u.items.find(s=>s.sessionIds?.includes(e.sessionId)));return!e.blank||!r?null:(0,Fe.jsx)("div",{className:"dswt-new-session-action",children:(0,Fe.jsxs)(H,{type:"button",className:"dswt-new-session-button",onClick:()=>t(r),children:[(0,Fe.jsx)(Me,{}),o("createWorktree")]})})}var ee=require("react");var R=require("react/jsx-runtime");function io({api:e,workspaces:a,sessions:t}){let o=te(),[r,u]=(0,ee.useState)([]),[s,l]=(0,ee.useState)(!1),[i,n]=(0,ee.useState)(""),[c,m]=(0,ee.useState)(null),x=(0,ee.useCallback)(async()=>{l(!0),n("");try{let L=new Set,f=[];for(let C of a.list.getSnapshot().items)try{let S=await e.list(C.path),w=F(S.repoPath);if(w&&!L.has(w)){L.add(w);let y=await Promise.all(S.worktrees.map(async g=>{try{return{...g,...await e.status(g.path)}}catch(T){return{...g,statusError:String(T?.message??T)}}}));f.push({...S,worktrees:y})}}catch{}u(f)}catch(L){n(String(L?.message??L))}finally{l(!1)}},[e,a]);(0,ee.useEffect)(()=>{x()},[x]);let I=L=>L.statusError==="worktree-unavailable"?o("unavailable"):L.statusError==="not-git-repository"?o("notGitWorkspace"):L.statusError,h=async(L,f)=>{m(f.path),n("");try{let C=a.list.getSnapshot().items.find(y=>F(y.path)===F(f.path)),S=!C;if(C||(C=await a.create({path:f.path})),S){let y=f.isMain?o("mainRepository"):`${L.defaultBranch??"worktree"}/${f.branch??"detached"}`;await a.rename(C.workspaceId,y)}let w=await a.connectWorkspace(C.workspaceId);t.open(w)}catch(C){n(`${o("operationError")}${String(C?.message??C)}`)}finally{m(null)}},d=async(L,f)=>{if(f.isMain)return;let C=f.statusError?o("unavailable"):f.changedFiles?oe(o("dirty"),{count:String(f.changedFiles)}):o("clean");if(f.changedFiles||f.statusError){n(f.statusError?`${o("operationError")}${I(f)}`:o("dirtyRemoveBlocked"));return}if(window.confirm(oe(o("removeConfirm"),{path:f.path,status:C}))){m(f.path),n("");try{await e.remove({repoPath:L.repoPath,path:f.path});let S=a.list.getSnapshot().items.find(w=>F(w.path)===F(f.path));S&&await a.delete(S.workspaceId),await x()}catch(S){n(`${o("operationError")}${String(S?.message??S)}`)}finally{m(null)}}},p=async L=>{m(L.repoPath),n("");try{await e.prune(L.repoPath),await x()}catch(f){n(`${o("operationError")}${String(f?.message??f)}`)}finally{m(null)}};return(0,R.jsxs)("section",{className:"dswt-settings","aria-label":o("worktrees"),children:[(0,R.jsxs)("div",{className:"dswt-settings-header",children:[(0,R.jsx)("h2",{children:o("worktrees")}),(0,R.jsx)(H,{type:"button","aria-label":o("refresh"),title:o("refresh"),disabled:s,onClick:()=>{x()},children:(0,R.jsx)(ke,{size:14,className:s?"dswt-spin":void 0})})]}),i?(0,R.jsxs)("div",{className:"dswt-error",role:"alert",children:[(0,R.jsx)(X,{size:14})," ",i]}):null,r.length===0&&!s?(0,R.jsx)("p",{className:"dswt-muted",children:o("noWorktrees")}):null,r.map(L=>(0,R.jsxs)("div",{className:"dswt-repo",children:[(0,R.jsxs)("div",{className:"dswt-repo-path",children:[L.repoPath,(0,R.jsx)(H,{type:"button",disabled:c===L.repoPath,onClick:()=>{p(L)},children:o("prune")})]}),L.worktrees.map(f=>(0,R.jsxs)("div",{className:"dswt-worktree",children:[(0,R.jsxs)("div",{className:"dswt-worktree-main",children:[(0,R.jsx)("strong",{children:f.branch??o("detached")}),(0,R.jsx)("span",{className:"dswt-worktree-path",title:f.path,children:f.path}),(0,R.jsx)("span",{children:f.isMain?o("mainRepository"):o("linkedWorktree")}),(0,R.jsx)("span",{children:f.statusError?I(f):f.changedFiles?oe(o("dirty"),{count:String(f.changedFiles)}):o("clean")}),f.locked?(0,R.jsx)("span",{children:o("locked")}):null,f.prunable?(0,R.jsx)("span",{children:o("prunable")}):null]}),(0,R.jsxs)("div",{className:"dswt-worktree-actions",children:[(0,R.jsxs)(H,{type:"button",disabled:c===f.path||!!f.statusError,onClick:()=>{h(L,f)},children:[c===f.path?(0,R.jsx)(K,{size:14,className:"dswt-spin"}):null,o("open")]}),!f.isMain&&(f.prunable||f.statusError)?(0,R.jsx)(H,{type:"button",disabled:c===f.path,onClick:()=>{p(L)},children:o("prune")}):null,!f.isMain&&!f.prunable&&!f.statusError?(0,R.jsx)(H,{type:"button",disabled:c===f.path,onClick:()=>{d(L,f)},children:o("remove")}):null]})]},f.path))]},L.repoPath))]})}var Ur="/dsh-simple-worktree";function co(e){async function a(t,o){let r=await e.rpc.call(Ur,t,o);if(!r?.ok){let u=r?.error?.code,s=new Error(u==="worktree-unavailable"?"worktree-unavailable":u==="not-git-repository"?"not-git-repository":r?.error?.message??"worktree operation failed");throw s.code=r?.error?.code,s}return r.value}return{list:t=>a("worktree.list",{path:t}),classify:t=>a("worktree.classify",{path:t}),create:t=>a("worktree.create",t),remove:t=>a("worktree.remove",t),status:t=>a("worktree.status",{path:t}),prune:t=>a("worktree.prune",{path:t})}}var we=require("react/jsx-runtime"),po="data-dsh-simple-worktree-style";function Hr(){if(typeof document>"u"||document.querySelector(`style[${po}]`))return;let e=document.createElement("style");return e.setAttribute(po,""),e.textContent=Da,document.head.appendChild(e),()=>e.remove()}var mo={name:"@alpacachen/dsh-simple-worktree",inject:["slots","connection","locale","workspaces","sessions"],apply(e){e.effect(Hr,"dsh-simple-worktree styles"),e.effect(()=>qa(e),"dsh-simple-worktree locale");let a=co(e.connection),t=e.workspaces,o=e.sessions,r=e.get("locale"),u=e.get("workspaceExtensions"),s=new Set;e.effect(()=>{if(!(!r||typeof r.subscribe!="function"||!u))return r.subscribe(()=>u.invalidate())},"dsh-simple-worktree locale refresh");let l=new Set,i=!0,n=()=>{},c=0,m=async()=>{let I=++c,h=t.list.getSnapshot().items,d=await Promise.all(h.map(async p=>{try{return await a.classify(p.path)}catch{return}}));if(!(!i||I!==c)){s.clear(),l.clear();for(let p of d)p?.isGit&&p.path&&s.add(F(p.path)),p?.isWorktree&&p.path&&l.add(F(p.path));u?.invalidate()}};e.effect(()=>u?u.register({id:"dsh-simple-worktree",menuItem(h){let d=F(h.path);if(!(!s.has(d)||l.has(d)))return{id:"dsh-simple-worktree.create",label:Pe("createWorktree"),icon:(0,we.jsx)(Me,{}),order:30,onSelect:()=>n(h)}},deleteWorkspace(h){let d=F(h.path);if(l.has(d))return(async()=>{let p=await a.classify(h.path);!p.isWorktree||!p.repoPath||(await a.remove({repoPath:p.repoPath,path:h.path}),await t.delete(h.workspaceId),s.delete(d),l.delete(d),u?.invalidate())})()},icon(h){return l.has(F(h.path))?(0,we.jsx)(Me,{}):void 0}}):void 0,"dsh-simple-worktree workspace extensions"),e.effect(()=>{i=!0;let I=t.list.subscribe(()=>{m()});return m(),()=>{i=!1,c+=1,I()}},"dsh-simple-worktree workspace classification");function x(){let[I,h]=(0,Qe.useState)(null);return(0,Qe.useEffect)(()=>(n=(d,p="current")=>h({target:d,defaultBaseChoice:p}),()=>{n=()=>{}}),[]),I?(0,we.jsx)(fo,{target:I.target,api:a,workspaces:t,sessions:o,defaultBaseChoice:I.defaultBaseChoice,onCreated:d=>{s.add(F(d)),l.add(F(d)),u?.invalidate()},onClose:()=>h(null)}):null}e.slots.inject("conversation.input.dock",()=>e.slots.register({name:"conversation.input.dock",id:"dsh-simple-worktree-new-session",order:-30,locale:se,label:()=>Pe("createWorktree")},I=>(0,we.jsx)(no,{session:I.session,useWorkspaces:I.useWorkspaces,onOpen:h=>n(h,"main")}))),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-simple-worktree-create",order:30,locale:se,label:()=>Pe("createWorktree")},x)),e.slots.inject("settings.plugin.item",()=>e.slots.register({name:"settings.plugin.item",key:se,locale:se,inject:()=>({})},()=>(0,we.jsx)(io,{api:a,workspaces:t,sessions:o})))}};var Wr=mo;
|
|
174
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(t))},[t,e]),null},Or="DialogDescriptionWarning",Er=({contentRef:e,descriptionId:a})=>{let o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Zt(Or).contentName}}.`;return b.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");a&&r&&(document.getElementById(a)||console.warn(o))},[o,e,a]),null},$t=Et;var Jt=Ht,Qt=Wt,Yt=Nt,eo=Vt,ao=_t,to=Kt;var Z=require("react/jsx-runtime");function H({className:e="",...a}){return(0,Z.jsx)("button",{className:`dswt-button ${e}`,...a})}function oo({className:e="",...a}){return(0,Z.jsx)("input",{className:`dswt-input ${e}`,...a})}function ro({children:e,...a}){return(0,Z.jsx)($t,{...a,children:e})}function uo({children:e}){let a=te();return(0,Z.jsxs)(Jt,{children:[(0,Z.jsx)(Qt,{className:"dswt-dialog-overlay"}),(0,Z.jsxs)(Yt,{className:"dswt-dialog-content",children:[e,(0,Z.jsx)(to,{className:"dswt-dialog-close","aria-label":a("close"),children:(0,Z.jsx)(ye,{size:16})})]})]})}var lo=eo,so=ao;var v=require("react/jsx-runtime");function fo({target:e,api:a,workspaces:t,sessions:o,defaultBaseChoice:r="current",onCreated:u,onClose:s}){let l=te(),[i,n]=(0,Y.useState)(null),[c,m]=(0,Y.useState)(""),[x,I]=(0,Y.useState)(r),[h,d]=(0,Y.useState)(""),[p,L]=(0,Y.useState)(!1),[f,C]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let P=!0;return n(null),d(""),m(""),I(r),a.list(e.path).then(W=>{P&&n(W)}).catch(W=>{P&&d(String(W?.message??W))}),()=>{P=!1}},[a,r,e.path]);let S=i?.repoPath,w=Ua(c),y=`task/${w}`,g=S?Ha(S,w):"",T=i?.worktrees.find(P=>F(P.path)===F(e.path))?.branch??"HEAD",$=i?.defaultBranch??i?.worktrees.find(P=>P.isMain)?.branch??T,le=x==="main"?i?.defaultRef??$:T,me=async(P,W)=>{let J=await t.create({path:P});await t.rename(J.workspaceId,`${e.title}/${W}`);let Le=await t.connectWorkspace(J.workspaceId);u(P),o.open(Le),s()},Te=async()=>{if(f){L(!0),d("");try{await me(f.path,f.branch.replace(/^task\//,"")),C(null)}catch(P){d(`${l("registerFailed")} ${String(P?.message??P)}`)}finally{L(!1)}}},Lo=async()=>{if(f){L(!0),d("");try{await a.remove({repoPath:f.repoPath,path:f.path}),C(null),s()}catch(P){d(oe(l("cleanupFailed"),{error:String(P?.message??P),path:f.path}))}finally{L(!1)}}},xo=async()=>{if(!S||!c.trim()){d(l("fillTaskName"));return}L(!0),d("");let P,W;try{let J=await a.create({repoPath:S,path:g,branch:y,baseRef:le});P=J.path,W=await t.create({path:J.path}),await t.rename(W.workspaceId,`${e.title}/${w}`);let Le=await t.connectWorkspace(W.workspaceId);u(J.path),o.open(Le),s()}catch(J){if(W?.workspaceId)try{await t.delete(W.workspaceId)}catch(Le){P&&C({repoPath:S,path:P,branch:y}),d(oe(l("cleanupFailed"),{error:String(Le?.message??Le),path:P??""}));return}P?(C({repoPath:S,path:P,branch:y}),d(l("registerFailed"))):d(`${l("operationFailed")}${String(J?.message??J)}`)}finally{L(!1)}};return(0,v.jsx)(ro,{open:!0,onOpenChange:P=>{!P&&!p&&s()},children:(0,v.jsxs)(uo,{children:[(0,v.jsx)(lo,{className:"dswt-dialog-title",children:oe(l("dialogTitle"),{name:e.title})}),(0,v.jsx)(so,{className:"dswt-visually-hidden",children:e.title}),h?(0,v.jsxs)("div",{className:"dswt-error",role:"alert",children:[(0,v.jsx)(X,{size:14})," ",h]}):null,(0,v.jsxs)("label",{className:"dswt-field",children:[(0,v.jsx)("span",{className:"dswt-field-label",children:l("taskName")}),(0,v.jsx)(oo,{"aria-label":l("taskName"),value:c,disabled:p,onChange:P=>m(P.target.value),placeholder:l("taskNamePlaceholder"),autoFocus:!0})]}),(0,v.jsxs)("fieldset",{className:"dswt-field dswt-base-fieldset",disabled:p||!i,children:[(0,v.jsx)("legend",{className:"dswt-field-label",children:l("basedOn")}),(0,v.jsxs)("div",{className:"dswt-radio-group",role:"radiogroup","aria-label":l("basedOn"),children:[(0,v.jsxs)("label",{className:"dswt-radio-option","data-selected":x==="current"?"true":void 0,children:[(0,v.jsx)("input",{className:"dswt-radio-input",type:"radio",name:"dswt-base-branch",value:"current",checked:x==="current",onChange:()=>I("current")}),(0,v.jsxs)("span",{className:"dswt-radio-copy",children:[(0,v.jsx)("span",{className:"dswt-radio-label",children:l("currentBranch")}),(0,v.jsx)("span",{className:"dswt-radio-branch",children:T})]})]}),(0,v.jsxs)("label",{className:"dswt-radio-option","data-selected":x==="main"?"true":void 0,children:[(0,v.jsx)("input",{className:"dswt-radio-input",type:"radio",name:"dswt-base-branch",value:"main",checked:x==="main",onChange:()=>I("main")}),(0,v.jsxs)("span",{className:"dswt-radio-copy",children:[(0,v.jsx)("span",{className:"dswt-radio-label",children:l("mainBranch")}),(0,v.jsx)("span",{className:"dswt-radio-branch",children:$})]})]})]})]}),f?(0,v.jsxs)("div",{className:"dswt-dialog-actions",children:[(0,v.jsx)(H,{type:"button",disabled:p,onClick:()=>{Te()},children:l("retryRegister")}),(0,v.jsx)(H,{type:"button",disabled:p,onClick:()=>{Lo()},children:l("cleanupCreated")})]}):null,f?null:(0,v.jsxs)("div",{className:"dswt-dialog-actions",children:[(0,v.jsx)(H,{type:"button",disabled:p,onClick:s,children:l("cancel")}),(0,v.jsxs)(H,{type:"button",className:"dswt-button-primary",disabled:p||!c.trim()||!i,onClick:xo,children:[p?(0,v.jsx)(K,{size:14,className:"dswt-spin"}):null,l(p?"creating":"createAndOpen")]})]})]})})}var pe=require("react/jsx-runtime");function Me(){return(0,pe.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,pe.jsx)("path",{d:"M4 2.25v8.5a2.25 2.25 0 1 0 1.5 0V7.75h4v3a2.25 2.25 0 1 0 1.5 0V6.25H5.5v-4H4Z",fill:"currentColor"}),(0,pe.jsx)("circle",{cx:"4.75",cy:"12.75",r:"1.5",fill:"currentColor"}),(0,pe.jsx)("circle",{cx:"10.25",cy:"12.75",r:"1.5",fill:"currentColor"}),(0,pe.jsx)("circle",{cx:"4.75",cy:"2.25",r:"1.5",fill:"currentColor"})]})}var Fe=require("react/jsx-runtime");function no({session:e,useWorkspaces:a,onOpen:t}){let o=te(),r=a(u=>u.items.find(s=>s.sessionIds?.includes(e.sessionId)));return!e.blank||!r?null:(0,Fe.jsx)("div",{className:"dswt-new-session-action",children:(0,Fe.jsxs)(H,{type:"button",className:"dswt-new-session-button",onClick:()=>t(r),children:[(0,Fe.jsx)(Me,{}),o("createWorktree")]})})}var ee=require("react");var R=require("react/jsx-runtime");function io({api:e,workspaces:a,sessions:t}){let o=te(),[r,u]=(0,ee.useState)([]),[s,l]=(0,ee.useState)(!1),[i,n]=(0,ee.useState)(""),[c,m]=(0,ee.useState)(null),x=(0,ee.useCallback)(async()=>{l(!0),n("");try{let L=new Set,f=[];for(let C of a.list.getSnapshot().items)try{let S=await e.list(C.path),w=F(S.repoPath);if(w&&!L.has(w)){L.add(w);let y=await Promise.all(S.worktrees.map(async g=>{try{return{...g,...await e.status(g.path)}}catch(T){return{...g,statusError:String(T?.message??T)}}}));f.push({...S,worktrees:y})}}catch{}u(f)}catch(L){n(String(L?.message??L))}finally{l(!1)}},[e,a]);(0,ee.useEffect)(()=>{x()},[x]);let I=L=>L.statusError==="worktree-unavailable"?o("unavailable"):L.statusError==="not-git-repository"?o("notGitWorkspace"):L.statusError,h=async(L,f)=>{m(f.path),n("");try{let C=a.list.getSnapshot().items.find(y=>F(y.path)===F(f.path)),S=!C;if(C||(C=await a.create({path:f.path})),S){let y=f.isMain?o("mainRepository"):`${L.defaultBranch??"worktree"}/${f.branch??"detached"}`;await a.rename(C.workspaceId,y)}let w=await a.connectWorkspace(C.workspaceId);t.open(w)}catch(C){n(`${o("operationError")}${String(C?.message??C)}`)}finally{m(null)}},d=async(L,f)=>{if(f.isMain)return;let C=f.statusError?o("unavailable"):f.changedFiles?oe(o("dirty"),{count:String(f.changedFiles)}):o("clean");if(f.changedFiles||f.statusError){n(f.statusError?`${o("operationError")}${I(f)}`:o("dirtyRemoveBlocked"));return}if(window.confirm(oe(o("removeConfirm"),{path:f.path,status:C}))){m(f.path),n("");try{await e.remove({repoPath:L.repoPath,path:f.path});let S=a.list.getSnapshot().items.find(w=>F(w.path)===F(f.path));S&&await a.delete(S.workspaceId),await x()}catch(S){n(`${o("operationError")}${String(S?.message??S)}`)}finally{m(null)}}},p=async L=>{m(L.repoPath),n("");try{await e.prune(L.repoPath),await x()}catch(f){n(`${o("operationError")}${String(f?.message??f)}`)}finally{m(null)}};return(0,R.jsxs)("section",{className:"dswt-settings","aria-label":o("worktrees"),children:[(0,R.jsxs)("div",{className:"dswt-settings-header",children:[(0,R.jsx)("h2",{children:o("worktrees")}),(0,R.jsx)(H,{type:"button","aria-label":o("refresh"),title:o("refresh"),disabled:s,onClick:()=>{x()},children:(0,R.jsx)(ke,{size:14,className:s?"dswt-spin":void 0})})]}),i?(0,R.jsxs)("div",{className:"dswt-error",role:"alert",children:[(0,R.jsx)(X,{size:14})," ",i]}):null,r.length===0&&!s?(0,R.jsx)("p",{className:"dswt-muted",children:o("noWorktrees")}):null,r.map(L=>(0,R.jsxs)("div",{className:"dswt-repo",children:[(0,R.jsxs)("div",{className:"dswt-repo-path",children:[L.repoPath,(0,R.jsx)(H,{type:"button",disabled:c===L.repoPath,onClick:()=>{p(L)},children:o("prune")})]}),L.worktrees.map(f=>(0,R.jsxs)("div",{className:"dswt-worktree",children:[(0,R.jsxs)("div",{className:"dswt-worktree-main",children:[(0,R.jsx)("strong",{children:f.branch??o("detached")}),(0,R.jsx)("span",{className:"dswt-worktree-path",title:f.path,children:f.path}),(0,R.jsx)("span",{children:f.isMain?o("mainRepository"):o("linkedWorktree")}),(0,R.jsx)("span",{children:f.statusError?I(f):f.changedFiles?oe(o("dirty"),{count:String(f.changedFiles)}):o("clean")}),f.locked?(0,R.jsx)("span",{children:o("locked")}):null,f.prunable?(0,R.jsx)("span",{children:o("prunable")}):null]}),(0,R.jsxs)("div",{className:"dswt-worktree-actions",children:[(0,R.jsxs)(H,{type:"button",disabled:c===f.path||!!f.statusError,onClick:()=>{h(L,f)},children:[c===f.path?(0,R.jsx)(K,{size:14,className:"dswt-spin"}):null,o("open")]}),!f.isMain&&(f.prunable||f.statusError)?(0,R.jsx)(H,{type:"button",disabled:c===f.path,onClick:()=>{p(L)},children:o("prune")}):null,!f.isMain&&!f.prunable&&!f.statusError?(0,R.jsx)(H,{type:"button",disabled:c===f.path,onClick:()=>{d(L,f)},children:o("remove")}):null]})]},f.path))]},L.repoPath))]})}var Ur="/dsh-simple-worktree";function Hr(e,a){if(e==="not-git-repository"||/not a git repository/i.test(a))return"not-git-repository";if(e==="worktree-unavailable"||/is not a working tree|No such file or directory/i.test(a))return"worktree-unavailable"}function co(e){async function a(t,o){let r=await e.rpc.call(Ur,t,o);if(!r?.ok){let u=r?.error?.message??"worktree operation failed",s=Hr(r?.error?.code,u),l=new Error(s??u);throw l.code=s??r?.error?.code,l}return r.value}return{list:t=>a("worktree.list",{path:t}),classify:t=>a("worktree.classify",{path:t}),create:t=>a("worktree.create",t),remove:t=>a("worktree.remove",t),status:t=>a("worktree.status",{path:t}),prune:t=>a("worktree.prune",{path:t})}}var we=require("react/jsx-runtime"),po="data-dsh-simple-worktree-style";function Wr(){if(typeof document>"u"||document.querySelector(`style[${po}]`))return;let e=document.createElement("style");return e.setAttribute(po,""),e.textContent=Da,document.head.appendChild(e),()=>e.remove()}var mo={name:"@alpacachen/dsh-simple-worktree",inject:["slots","connection","locale","workspaces","sessions"],apply(e){e.effect(Wr,"dsh-simple-worktree styles"),e.effect(()=>qa(e),"dsh-simple-worktree locale");let a=co(e.connection),t=e.workspaces,o=e.sessions,r=e.get("locale"),u=e.get("workspaceExtensions"),s=new Set;e.effect(()=>{if(!(!r||typeof r.subscribe!="function"||!u))return r.subscribe(()=>u.invalidate())},"dsh-simple-worktree locale refresh");let l=new Set,i=!0,n=()=>{},c=0,m=async()=>{let I=++c,h=t.list.getSnapshot().items,d=await Promise.all(h.map(async p=>{try{return await a.classify(p.path)}catch{return}}));if(!(!i||I!==c)){s.clear(),l.clear();for(let p of d)p?.isGit&&p.path&&s.add(F(p.path)),p?.isWorktree&&p.path&&l.add(F(p.path));u?.invalidate()}};e.effect(()=>u?u.register({id:"dsh-simple-worktree",menuItem(h){let d=F(h.path);if(!(!s.has(d)||l.has(d)))return{id:"dsh-simple-worktree.create",label:Pe("createWorktree"),icon:(0,we.jsx)(Me,{}),order:30,onSelect:()=>n(h)}},deleteWorkspace(h){let d=F(h.path);if(l.has(d))return(async()=>{let p=await a.classify(h.path);!p.isWorktree||!p.repoPath||(await a.remove({repoPath:p.repoPath,path:h.path}),await t.delete(h.workspaceId),s.delete(d),l.delete(d),u?.invalidate())})()},icon(h){return l.has(F(h.path))?(0,we.jsx)(Me,{}):void 0}}):void 0,"dsh-simple-worktree workspace extensions"),e.effect(()=>{i=!0;let I=t.list.subscribe(()=>{m()});return m(),()=>{i=!1,c+=1,I()}},"dsh-simple-worktree workspace classification");function x(){let[I,h]=(0,Qe.useState)(null);return(0,Qe.useEffect)(()=>(n=(d,p="current")=>h({target:d,defaultBaseChoice:p}),()=>{n=()=>{}}),[]),I?(0,we.jsx)(fo,{target:I.target,api:a,workspaces:t,sessions:o,defaultBaseChoice:I.defaultBaseChoice,onCreated:d=>{s.add(F(d)),l.add(F(d)),u?.invalidate()},onClose:()=>h(null)}):null}e.slots.inject("conversation.input.dock",()=>e.slots.register({name:"conversation.input.dock",id:"dsh-simple-worktree-new-session",order:-30,locale:se,label:()=>Pe("createWorktree")},I=>(0,we.jsx)(no,{session:I.session,useWorkspaces:I.useWorkspaces,onOpen:h=>n(h,"main")}))),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-simple-worktree-create",order:30,locale:se,label:()=>Pe("createWorktree")},x)),e.slots.inject("settings.plugin.item",()=>e.slots.register({name:"settings.plugin.item",key:se,locale:se,inject:()=>({})},()=>(0,we.jsx)(io,{api:a,workspaces:t,sessions:o})))}};var Nr=mo;
|
|
175
175
|
/*! Bundled license information:
|
|
176
176
|
|
|
177
177
|
lucide-react/dist/esm/shared/src/utils.js:
|
package/lib/index.js
CHANGED
|
@@ -6,9 +6,14 @@ const SETTINGS_NS = settingsNamespace('dsh-simple-worktree')
|
|
|
6
6
|
const SETTINGS_SCHEMA = z.object({})
|
|
7
7
|
|
|
8
8
|
export const ok = (value) => ({ ok: true, value })
|
|
9
|
+
const PUBLIC_ERROR_CODES = new Set([
|
|
10
|
+
'bad-request',
|
|
11
|
+
'cancelled',
|
|
12
|
+
])
|
|
13
|
+
|
|
9
14
|
export const fail = (code, message, details = {}) => ({
|
|
10
15
|
ok: false,
|
|
11
|
-
error: { code, message, details: { issues: [], ...details } },
|
|
16
|
+
error: { code: PUBLIC_ERROR_CODES.has(code) ? code : 'bad-request', message, details: { issues: [], ...details } },
|
|
12
17
|
})
|
|
13
18
|
|
|
14
19
|
export const cleanPath = (value) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpacachen/dsh-simple-worktree",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "A Git worktree plugin for DeepSeek Harness that creates task branches, registers worktrees as DSH Workspaces, and opens isolated sessions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|