@visulima/vis 1.0.0-alpha.24 → 1.0.0-alpha.26
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/CHANGELOG.md +78 -0
- package/LICENSE.md +1154 -179
- package/README.md +5 -3
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +19 -0
- package/dist/packem_chunks/bin.js +299 -290
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/config.js +15 -15
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +2 -2
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +10 -10
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +2 -2
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +5 -5
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +2 -2
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler32.js +3 -3
- package/dist/packem_chunks/handler34.js +5 -28
- package/dist/packem_chunks/handler35.js +22 -5
- package/dist/packem_chunks/handler36.js +60 -21
- package/dist/packem_chunks/handler37.js +6 -61
- package/dist/packem_chunks/handler38.js +24 -6
- package/dist/packem_chunks/handler39.js +152 -707
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +10 -24
- package/dist/packem_chunks/handler41.js +25 -286
- package/dist/packem_chunks/handler42.js +707 -152
- package/dist/packem_chunks/handler43.js +24 -10
- package/dist/packem_chunks/handler44.js +322 -25
- package/dist/packem_chunks/handler45.js +46 -24
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +7 -7
- package/dist/packem_chunks/handler48.js +66 -58
- package/dist/packem_chunks/handler5.js +3 -3
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +16 -16
- package/dist/packem_chunks/index.js +6 -6
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/prune.js +3 -3
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{advisories-U1QKY_tg.js → advisories-DS8JEB_g.js} +1 -1
- package/dist/packem_shared/affected-shas-Dm7eqcI8.js +1 -0
- package/dist/packem_shared/{ai-analysis-B8pDCOuT.js → ai-analysis-Csn82p17.js} +1 -1
- package/dist/packem_shared/{ai-fix-DiGSrGKv.js → ai-fix-BlYyz5bI.js} +3 -3
- package/dist/packem_shared/{cyclonedx-DPEW0nwS.js → cyclonedx-ja1cbU69.js} +1 -1
- package/dist/packem_shared/dependency-scan-s2MD0vi-.js +1 -0
- package/dist/packem_shared/{docker-_pBC9Loj.js → docker-Bw9gKo69.js} +1 -1
- package/dist/packem_shared/{index-D_tAc2nS.js → index-88UK-tt_.js} +1 -1
- package/dist/packem_shared/index-CS6a2wFB.js +29 -0
- package/dist/packem_shared/lifecycle-ChCFTm5Q.js +2 -0
- package/dist/packem_shared/{lockfile-CQLFNyVa.js → lockfile-BG1HvBzH.js} +1 -1
- package/dist/packem_shared/{min-release-age-Cz6HbF-I.js → min-release-age-heJgeP7o.js} +1 -1
- package/dist/packem_shared/{osv-bloom-CyCDpXBl.js → osv-bloom-QSAn2Dcw.js} +2 -2
- package/dist/packem_shared/{pm-runner-Dnj9J3KF.js → pm-runner-BzGZmzYs.js} +1 -1
- package/dist/packem_shared/{provenance-yESbF7Vs.js → provenance-BsBn1f5S.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BpxcFRuk.js → resolve-explicit-CBPr617N.js} +1 -1
- package/dist/packem_shared/{s1ngularity-B_xjP4lC.js → s1ngularity-j_ArCZAs.js} +1 -1
- package/dist/packem_shared/{signatures-DBwSnMBB.js → signatures-CaXzNuEn.js} +1 -1
- package/dist/packem_shared/{typosquats-Citu7BRY.js → typosquats-C1e6RNjF.js} +1 -1
- package/dist/packem_shared/vis-update-app-qhQPV97i.js +1 -0
- package/index.d.ts +201 -201
- package/index.js +52 -52
- package/package.json +14 -25
- package/schemas/project.schema.json +4 -0
- package/schemas/vis-config.schema.json +5 -0
- package/dist/packem_shared/dependency-scan-BbtivycX.js +0 -1
- package/dist/packem_shared/index-B8Ko8mwG.js +0 -29
- package/dist/packem_shared/lifecycle-DJDsjoic.js +0 -2
- package/dist/packem_shared/vis-update-app-BWA1kA1q.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var be=Object.defineProperty;var T=(h,t)=>be(h,"name",{value:t,configurable:!0});import{jsxs as l,jsx as r,Fragment as Z}from"react/jsx-runtime";import{Box as i}from"@visulima/tui/components/box";import{Spinner as xe}from"@visulima/tui/components/spinner";import{Text as e}from"@visulima/tui/components/text";import{useWindowSize as fe}from"@visulima/tui/hooks/use-window-size";import{useSyncExternalStore as Te,useState as j,useRef as z,useMemo as Se,useCallback as se,useEffect as ve}from"react";import{Dialog as ee}from"@visulima/tui/components/dialog";import{useApp as Ee}from"@visulima/tui/hooks/use-app";import{useInput as Ae}from"@visulima/tui/hooks/use-input";import{K as ye,au as ue}from"../packem_chunks/bin.js";import{ScrollView as Re}from"@visulima/tui/components/scroll-view";import{ScrollBar as Ie}from"@visulima/tui/components/scroll-bar";import{Tab as De}from"@visulima/tui/components/tab";import{Tabs as Me}from"@visulima/tui/components/tabs";import{u as Ne}from"./use-measured-height-DjYgUOKk.js";var Be=Object.defineProperty,Pe=T((h,t)=>Be(h,"name",{value:t,configurable:!0}),"a");const wr=Pe(({current:h,total:t})=>{const{columns:o}=fe(),n=o||80,s=t>0?Math.min(1,h/t):0,u=`${String(Math.round(s*100)).padStart(3)}%`,w=`${String(h)}/${String(t)}`,C=Math.max(10,n-2-u.length-1),m=Math.round(C*s),f=C-m;return l(i,{flexDirection:"column",paddingX:1,children:[l(i,{children:[r(xe,{type:"dots"}),r(e,{children:" Checking catalog dependencies "}),r(e,{dimColor:!0,children:w})]}),l(i,{children:[r(e,{color:"cyan",children:"━".repeat(m)}),r(e,{dimColor:!0,children:"─".repeat(f)}),l(e,{dimColor:!0,children:[" ",u]})]})]})},"CheckProgressApp");var Le=Object.defineProperty,v=T((h,t)=>Le(h,"name",{value:t,configurable:!0}),"l");const re=["default","name","updateType","severity"],pe=v(h=>{const t=h.vulnerabilities?.map(o=>o.severity)??[];return t.includes("CRITICAL")?4:t.includes("HIGH")?3:t.includes("MODERATE")?2:t.includes("LOW")?1:0},"severityRank"),ge={digest:0,major:3,minor:2,patch:1,pin:0,unknown:0},me=v((h,t)=>{if(t==="default")return h;const o=[...h];return t==="name"?o.sort((n,s)=>n.packageName.localeCompare(s.packageName)):t==="updateType"?o.sort((n,s)=>(ge[s.updateType]??0)-(ge[n.updateType]??0)||n.packageName.localeCompare(s.packageName)):o.sort((n,s)=>pe(s)-pe(n)||n.packageName.localeCompare(s.packageName)),o},"sortEntries"),te=v(h=>`${h.ecosystem}|${h.file}:${String(h.line)}|${h.name}`,"ecosystemEntryKey"),Q=v(h=>{const t=new Map;for(const o of h){const n=t.get(o.catalogName);n?n.push(o):t.set(o.catalogName,[o])}return t},"groupByCatalog"),H=v((h,t,o)=>{let n=h;if(t!=="all"&&(n=t==="security"?n.filter(s=>s.vulnerabilities&&s.vulnerabilities.length>0||s.socketReport&&s.socketReport.alerts.length>0):n.filter(s=>s.updateType===t)),o){const s=o.toLowerCase();n=n.filter(u=>u.packageName.toLowerCase().includes(s))}return n},"filterEntries");class Cr{static{T(this,"UpdateStore")}static{v(this,"UpdateStore")}#e;#l=new Set;#t;#i;#o=null;constructor(t,o=null,n=[]){this.#t=t,this.#i=n,o&&(this.#o=new Map(o.recommendations.map(s=>[s.package,s]))),this.#e={aiResult:o,allChecked:!0,applyProgress:null,checkedEcosystemKeys:new Set(n.map(s=>te(s))),checkedEntries:new Set(t.map(s=>s.packageName)),ecosystemEntries:n,entries:t,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:Q(t),phase:"browsing",selectedIndex:0,sortMode:"default"}}getSnapshot=v(()=>this.#e,"getSnapshot");subscribe=v(t=>(this.#l.add(t),()=>{this.#l.delete(t)}),"subscribe");getFilteredEntries(){return me(H(this.#t,this.#e.filterType,this.#e.filterText),this.#e.sortMode)}setSortMode(t){if(t===this.#e.sortMode)return;const o=this.getFilteredEntries()[this.#e.selectedIndex]?.packageName,n=me(H(this.#t,this.#e.filterType,this.#e.filterText),t),s=o?Math.max(0,n.findIndex(u=>u.packageName===o)):0;this.#r({...this.#e,selectedIndex:s,sortMode:t})}cycleSortMode(){const t=re.indexOf(this.#e.sortMode),o=re[(t+1)%re.length]??"default";this.setSortMode(o)}getRecommendation(t){return this.#o?.get(t)}getCheckedEntries(){return this.#t.filter(t=>this.#e.checkedEntries.has(t.packageName))}getCheckedEcosystemEntries(){return this.#i.filter(t=>this.#e.checkedEcosystemKeys.has(te(t)))}toggleEcosystemCheck(t){const o=new Set(this.#e.checkedEcosystemKeys);o.has(t)?o.delete(t):o.add(t),this.#r({...this.#e,checkedEcosystemKeys:o})}checkAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set(this.#i.map(t=>te(t)))})}uncheckAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set})}setSelectedIndex(t){const o=this.getFilteredEntries(),n=Math.max(0,Math.min(t,o.length-1));n!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:n})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:t})}setFilterType(t){if(t!==this.#e.filterType){const o=H(this.#t,t,this.#e.filterText);this.#r({...this.#e,entries:o,filterType:t,groupedByCatalog:Q(o),selectedIndex:0})}}setFilter(t){const o=H(this.#t,this.#e.filterType,t);this.#r({...this.#e,entries:o,filterText:t,groupedByCatalog:Q(o),selectedIndex:0})}setFilterActive(t){if(t!==this.#e.filterActive)if(t)this.#r({...this.#e,filterActive:!0});else{const o=H(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:o,filterActive:!1,filterText:"",groupedByCatalog:Q(o),selectedIndex:0})}}toggleCheck(t){const o=new Set(this.#e.checkedEntries);o.has(t)?o.delete(t):o.add(t),this.#r({...this.#e,allChecked:o.size===this.#t.length,checkedEntries:o})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#t.map(t=>t.packageName))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const t=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:t.length},phase:"applying"})}updateApplyProgress(t){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:t}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(t){this.#r({...this.#e,error:t,phase:"error"})}#r(t){this.#e=t;for(const o of this.#l)try{o()}catch{}}}var je=Object.defineProperty,$e=T((h,t)=>je(h,"name",{value:t,configurable:!0}),"d");const Oe={major:"red",minor:"yellow",patch:"green"},Fe={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Ue={critical:"red",high:"red",low:"gray",medium:"yellow"},Ge={critical:"red",high:"red",low:"green",medium:"yellow"},He={defer:"gray",review:"yellow",skip:"red",update:"green"},Ke=$e(({changelogUrl:h,entry:t,focused:o,recommendation:n,scrollRef:s})=>{const u=o?"white":"gray";if(!t)return r(i,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:r(e,{dimColor:!0,children:"No package selected"})});const w=Oe[t.updateType]??"white",C=t.vulnerabilities&&t.vulnerabilities.length>0,m=t.socketReport?.score.overall??0,f=t.socketReport?ye(m):"gray";return l(i,{borderColor:u,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[r(i,{flexShrink:0,paddingTop:1,paddingX:2,children:r(e,{bold:!0,color:"white",children:t.packageName})}),l(Re,{flexGrow:1,flexShrink:1,paddingX:2,ref:s,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[r(e,{}),l(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Current:"})}),r(e,{children:t.currentRange})]}),l(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Target:"})}),r(e,{children:t.newRange}),l(e,{bold:!0,color:w,children:[" ","(",t.updateType,")"]})]}),l(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Version:"})}),r(e,{children:t.targetVersion})]}),l(i,{children:[r(i,{width:12,children:r(e,{dimColor:!0,children:"Catalog:"})}),r(e,{children:t.catalogName})]}),t.acceptedRisk&&l(i,{flexDirection:"column",marginTop:1,children:[r(e,{color:"gray",children:"── "}),r(e,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),l(i,{flexDirection:"column",paddingLeft:2,children:[l(i,{children:[r(e,{dimColor:!0,children:"Reason: "}),r(e,{children:t.acceptedRisk.reason})]}),l(i,{children:[r(e,{dimColor:!0,children:"Accepted: "}),r(e,{children:t.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),C&&l(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"red",children:"SECURITY"}),r(e,{}),t.vulnerabilities.map(c=>l(i,{flexDirection:"column",marginBottom:1,children:[l(i,{gap:1,children:[l(e,{bold:!0,color:Fe[c.severity]??"gray",children:["⚠"," ",c.severity]}),r(e,{bold:!0,children:c.id})]}),r(i,{paddingLeft:2,children:r(e,{children:c.summary})}),l(i,{gap:2,paddingLeft:2,children:[c.cvssScore!==void 0&&l(e,{dimColor:!0,children:["CVSS:",String(c.cvssScore)]}),c.fixedVersions.length>0&&l(e,{dimColor:!0,children:["Fixed in:",c.fixedVersions.join(", ")]})]})]},c.id))]}),t.socketReport&&l(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),r(e,{}),l(i,{gap:2,children:[l(i,{children:[r(e,{dimColor:!0,children:"Overall: "}),l(e,{bold:!0,color:f,children:[String(Math.round(m*100)),"%"]})]}),l(i,{children:[r(e,{dimColor:!0,children:"Supply Chain: "}),l(e,{children:[String(Math.round(t.socketReport.score.supplyChain*100)),"%"]})]}),l(i,{children:[r(e,{dimColor:!0,children:"Quality: "}),l(e,{children:[String(Math.round(t.socketReport.score.quality*100)),"%"]})]})]}),l(i,{gap:2,children:[l(i,{children:[r(e,{dimColor:!0,children:"Maintenance: "}),l(e,{children:[String(Math.round(t.socketReport.score.maintenance*100)),"%"]})]}),l(i,{children:[r(e,{dimColor:!0,children:"Vulnerability: "}),l(e,{children:[String(Math.round(t.socketReport.score.vulnerability*100)),"%"]})]}),l(i,{children:[r(e,{dimColor:!0,children:"License: "}),l(e,{children:[t.socketReport.license||"unknown"," ","(",String(Math.round(t.socketReport.score.license*100)),"%)"]})]})]}),t.socketReport.alerts.length>0&&l(i,{flexDirection:"column",marginTop:1,children:[l(e,{bold:!0,color:"yellow",children:["⚠"," ",String(t.socketReport.alerts.length)," ","alert",t.socketReport.alerts.length===1?"":"s",":"]}),t.socketReport.alerts.map(c=>l(i,{gap:1,paddingLeft:2,children:[l(e,{bold:!0,color:Ue[c.severity]??"gray",children:["[",c.severity.toUpperCase(),"]"]}),r(e,{children:c.type}),l(e,{dimColor:!0,children:["(",c.category,")"]})]},c.key))]})]}),n&&l(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"AI ANALYSIS"}),r(e,{}),l(i,{gap:2,children:[l(i,{children:[r(e,{dimColor:!0,children:"Action: "}),r(e,{bold:!0,color:He[n.action]??"white",children:n.action})]}),l(i,{children:[r(e,{dimColor:!0,children:"Risk: "}),r(e,{bold:!0,color:Ge[n.riskLevel]??"white",children:n.riskLevel})]}),l(i,{children:[r(e,{dimColor:!0,children:"Effort: "}),r(e,{bold:!0,children:n.effort})]})]}),n.reason&&r(i,{marginTop:1,paddingLeft:2,children:r(e,{children:n.reason})}),n.breakingChanges.length>0&&l(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r(e,{bold:!0,color:"yellow",children:"Breaking changes:"}),n.breakingChanges.map((c,D)=>l(e,{children:[" ","•"," ",c]},String(D)))]})]}),h&&l(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"CHANGELOG"}),r(i,{marginTop:1,paddingLeft:2,children:r(e,{color:"cyan",underline:!0,children:h})})]}),l(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"LINKS"}),r(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:l(e,{color:"cyan",underline:!0,children:["https://npmx.dev/",t.packageName]})})]}),!n&&l(i,{flexDirection:"column",marginTop:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"GUIDANCE"}),l(i,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.updateType==="major"&&l(Z,{children:[l(e,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),r(e,{dimColor:!0,children:" Review the changelog before updating."}),r(e,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),t.updateType==="minor"&&l(Z,{children:[l(e,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),r(e,{dimColor:!0,children:" Generally safe to update."})]}),t.updateType==="patch"&&l(Z,{children:[l(e,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),r(e,{dimColor:!0,children:" Safe to update."})]}),!n&&r(e,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},"PackageDetailPanel");var Ve=Object.defineProperty,le=T((h,t)=>Ve(h,"name",{value:t,configurable:!0}),"x");const qe={major:"red",minor:"yellow",patch:"green"},Xe=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],Ye=le(({checked:h,entry:t,isSelected:o})=>{const n=qe[t.updateType]??"white",s=t.vulnerabilities&&t.vulnerabilities.length>0,u=t.socketReport&&t.socketReport.alerts.length>0,w=!!t.acceptedRisk,C=h?"☑":"☐",m=t.socketReport?`${String(Math.round(t.socketReport.score.overall*100))}%`:"",f=t.socketReport?ye(t.socketReport.score.overall):"gray";return l(i,{flexShrink:0,height:1,children:[r(e,{children:o?">":" "}),l(e,{color:h?"white":"gray",children:[" ",C," "]}),s||u?r(e,{color:w?"gray":"red",children:w?"✓ ":"⚠ "}):r(e,{children:" "}),r(i,{flexGrow:1,children:l(e,{bold:o,inverse:o,wrap:"truncate",children:[t.packageName,w?" [ack]":""]})}),m&&l(e,{color:f,children:[" ",m]}),l(e,{dimColor:!0,children:[" ",t.currentRange]}),l(e,{dimColor:!0,children:[" ","→"," "]}),l(e,{children:[t.newRange," "]}),r(e,{bold:!0,color:n,children:t.updateType})]})},"PackageRow"),We=le(({count:h,name:t})=>l(i,{flexShrink:0,height:1,marginTop:1,children:[l(e,{dimColor:!0,children:["▼"," "]}),r(e,{bold:!0,color:"white",children:t.toUpperCase()}),l(e,{dimColor:!0,children:[" ","(",h,")"]})]}),"CatalogHeader"),ze=le(({checkedEntries:h,entries:t,filterActive:o,filteredOutCount:n,filterText:s,filterType:u,focused:w,groupedByCatalog:C,isDryRun:m,onViewportHeightChange:f,scrollOffset:c,selectedIndex:D,totalCatalogEntries:M,totalChecked:E,totalEntries:V,viewportHeight:$})=>{const O=w?"white":"gray",{measuredHeight:y,ref:A}=Ne($,f);let F=0,S=0,N=0,R=0;for(const g of t)g.updateType==="major"?F++:g.updateType==="minor"?S++:N++,(g.vulnerabilities&&g.vulnerabilities.length>0||g.socketReport&&g.socketReport.alerts.length>0)&&R++;const b=[];F>0&&b.push(`${F} major`),S>0&&b.push(`${S} minor`),N>0&&b.push(`${N} patch`),R>0&&b.push(`${R} vulnerable`);const B=b.length>0?` (${b.join(", ")})`:"";let x=0;for(const g of t)h.has(g.packageName)&&x++;const k=[];let q=0;for(const[g,I]of C){k.push(r(We,{count:I.length,name:g},`hdr-${g}`));for(const G of I){const P=q;k.push(r(Ye,{checked:h.has(G.packageName),entry:G,isSelected:P===D},G.packageName)),q++}}let U=0;for(const[,g]of C)U+=2+g.length;const X=U>y&&y>0;return l(i,{borderColor:O,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[l(i,{flexShrink:0,gap:1,paddingX:1,children:[r(e,{bold:!0,inverse:!0,children:" VIS "}),l(e,{wrap:"truncate",children:[V,E>0?`/${E}`:""," ","outdated",B,M>E?` · ${M-E} dupes`:""]}),!m&&x>0&&l(e,{dimColor:!0,children:[" ","—",x," ","selected"]})]}),r(i,{flexShrink:0,paddingX:1,paddingY:1,children:r(Me,{isFocused:w,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:T(()=>{},"onChange"),showIndex:!1,value:u,children:Xe.map(({id:g,label:I})=>r(De,{name:g,children:I},g))})}),o&&l(i,{flexShrink:0,paddingX:1,children:[r(e,{bold:!0,color:"white",children:"/ "}),r(e,{children:s}),r(e,{inverse:!0,children:" "})]}),n>0&&r(i,{flexShrink:0,paddingX:1,children:l(e,{color:"yellow",children:["⚠"," ",n," ","package",n===1?"":"s"," ","filtered out by target constraint — press"," ",r(e,{bold:!0,color:"white",children:"f"})," ","to view"]})}),l(i,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:A,children:[r(i,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(i,{flexDirection:"column",marginTop:-c,children:k})}),X&&r(i,{flexShrink:0,marginLeft:1,marginRight:1,children:r(Ie,{contentHeight:U,placement:"inset",scrollOffset:c,style:"block",viewportHeight:y})})]},`list-${u}-${s}`)]})},"PackageListPanel");var Qe=Object.defineProperty,_e=T((h,t)=>Qe(h,"name",{value:t,configurable:!0}),"X");const Je=100,Ze=40,er=10,rr=[],K=["all","major","minor","patch","security"],kr=_e(({autoExitSeconds:h=0,changelogUrls:t,checkedCount:o=0,filteredOutEntries:n=rr,isDryRun:s,store:u,totalCatalogEntries:w=0})=>{const{exit:C}=Ee(),{columns:m,rows:f}=fe(),c=Te(u.subscribe,u.getSnapshot),[D,M]=j(!1),[E,V]=j(!1),$=z(null),O=z(null),y=z(null),A=z(null),[F,S]=j(0),[N,R]=j(!1),[b,B]=j(!1),x=Se(()=>u.getFilteredEntries(),[c.entries,c.filterType,c.filterText,c.sortMode]),k=x[c.selectedIndex]??null,q=k?u.getRecommendation(k.packageName):void 0,U=k&&t?t.get(k.packageName):void 0,X=se(d=>{let a=0,p=0;for(const[,J]of c.groupedByCatalog){a+=2;for(let he=0;he<J.length;he++){if(p===d)return a;a+=1,p++}}return a},[c.groupedByCatalog]),g=Math.max(1,f-8-(c.filterActive?1:0)),[I,G]=j(g),P=I>0?I:g,L=se(d=>{const a=X(d);S(p=>a>p+P-2?Math.max(0,a-P+2):a<p+1?Math.max(0,a-1):p)},[X,P]);if(ve(()=>{y.current?.scrollToTop()},[k?.packageName]),Ae((d,a)=>{if(d==="c"&&a.ctrl){C();return}if(!b){if(E){a.escape||d==="f"||d==="q"?V(!1):a.downArrow||d==="j"?O.current?.scrollBy(1):(a.upArrow||d==="k")&&O.current?.scrollBy(-1);return}if(N){d==="u"||a.return?(R(!1),u.startApply(),C(u.getCheckedEntries())):a.escape||d==="q"?R(!1):a.downArrow||d==="j"?A.current?.scrollBy(1):a.upArrow||d==="k"?A.current?.scrollBy(-1):a.pageDown?A.current?.scrollBy(5):a.pageUp&&A.current?.scrollBy(-5);return}if(D){a.escape||d==="?"?M(!1):d==="q"?(M(!1),B(!0)):a.downArrow||d==="j"?$.current?.scrollBy(1):(a.upArrow||d==="k")&&$.current?.scrollBy(-1);return}if(d==="?"){M(!0);return}if(d==="q"){B(!0);return}if(a.tab){u.setFocusedPanel(c.focusedPanel==="list"?"detail":"list");return}if(c.focusedPanel==="list"&&(a.leftArrow||a.rightArrow)){const p=K.indexOf(c.filterType),J=a.rightArrow?(p+1)%K.length:(p-1+K.length)%K.length;S(0),y.current?.scrollToTop(),u.setFilterType(K[J]);return}if(d==="f"&&n.length>0){V(p=>!p);return}if(c.filterActive){if(a.escape){u.setFilterActive(!1);return}if(a.return){u.setFilterActive(!1);return}if(a.backspace){S(0),u.setFilter(c.filterText.slice(0,-1));return}if(d&&!a.ctrl&&!a.meta){S(0),u.setFilter(c.filterText+d);return}return}if(c.focusedPanel==="list"){if(a.downArrow||d==="j"){const p=Math.min(c.selectedIndex+1,x.length-1);u.setSelectedIndex(p),L(p);return}if(a.upArrow||d==="k"){const p=Math.max(c.selectedIndex-1,0);u.setSelectedIndex(p),L(p);return}if(a.pageDown){const p=Math.min(c.selectedIndex+10,x.length-1);u.setSelectedIndex(p),L(p);return}if(a.pageUp){const p=Math.max(c.selectedIndex-10,0);u.setSelectedIndex(p),L(p);return}if(a.home){u.setSelectedIndex(0),S(0);return}if(a.end){const p=x.length-1;u.setSelectedIndex(p),L(p);return}if(d===" "||a.return){k&&u.toggleCheck(k.packageName);return}if(d==="a"){u.toggleAll();return}if(d==="s"){u.cycleSortMode(),L(u.getSnapshot().selectedIndex);return}if(d==="/"){u.setFilterActive(!0);return}if(d==="u"&&!s&&c.checkedEntries.size>0){R(!0);return}if(a.rightArrow){u.setFocusedPanel("detail");return}return}if(c.focusedPanel==="detail"){if(a.escape||a.leftArrow){u.setFocusedPanel("list");return}if(a.downArrow||d==="j"){y.current?.scrollBy(1);return}if(a.upArrow||d==="k"){y.current?.scrollBy(-1);return}if(a.pageDown){y.current?.scrollBy(10);return}if(a.pageUp){y.current?.scrollBy(-10);return}if(a.home){y.current?.scrollToTop();return}a.end&&y.current?.scrollToBottom()}}},{isActive:!0}),m<Ze||f<er)return r(i,{alignItems:"center",height:f,justifyContent:"center",width:m,children:l(e,{color:"yellow",children:["Terminal too small (",m,"x",f,")"]})});const we=m>=Je,Y=[l(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"q"}),r(e,{dimColor:!0,children:"QUIT"})]},"q"),l(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"?"}),r(e,{dimColor:!0,children:"HELP"})]},"?"),l(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"↑↓"}),r(e,{dimColor:!0,children:"NAV"})]},"nav"),l(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"Space"}),r(e,{dimColor:!0,children:"CHECK"})]},"sp"),l(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"a"}),r(e,{dimColor:!0,children:"ALL"})]},"a")];!s&&c.checkedEntries.size>0&&Y.push(l(i,{gap:1,children:[r(e,{bold:!0,color:"green",children:"u"}),r(e,{dimColor:!0,children:"APPLY"})]},"u")),n.length>0&&Y.push(l(i,{gap:1,children:[r(e,{bold:!0,color:"yellow",children:"f"}),l(e,{dimColor:!0,children:["FILTERED (",n.length,")"]})]},"fo")),Y.push(l(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"←→"}),r(e,{dimColor:!0,children:"FILTER"})]},"lr"),l(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"/"}),r(e,{dimColor:!0,children:"SEARCH"})]},"f"),l(i,{gap:1,children:[r(e,{bold:!0,color:"white",children:"Tab"}),r(e,{dimColor:!0,children:"PANEL"})]},"t"));const ie=r(i,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:r(i,{flexWrap:"wrap",gap:2,paddingX:1,children:Y})}),oe=l(ee,{footer:l(e,{dimColor:!0,children:[r(e,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(e,{bold:!0,color:"white",children:"?"}),"/",r(e,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:$,title:"KEYBOARD SHORTCUTS",visible:D,width:52,children:[l(i,{flexDirection:"column",marginBottom:1,children:[l(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"NAVIGATION"})]}),l(i,{children:[r(i,{width:24,children:l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","↑","/k"]}),r(e,{dimColor:!0,children:" Move up"})]})}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","↓","/j"]}),r(e,{dimColor:!0,children:" Move down"})]})]}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","Tab"]}),r(e,{dimColor:!0,children:" Switch panel"})]}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","→","/","←"]}),r(e,{dimColor:!0,children:" Focus detail/list"})]})]}),l(i,{flexDirection:"column",marginBottom:1,children:[l(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"SELECTION"})]}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","Space"]}),r(e,{dimColor:!0,children:" Toggle check on package"})]}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","a"]}),r(e,{dimColor:!0,children:" Toggle check all"})]}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","s"]}),r(e,{dimColor:!0,children:" Cycle sort (default / name / type / severity)"})]})]}),l(i,{flexDirection:"column",marginBottom:1,children:[l(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"FILTERS"})]}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","←→"]}),r(e,{dimColor:!0,children:" Switch filter tab"})]}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","/"]}),r(e,{dimColor:!0,children:" Text filter"})]}),n.length>0&&l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","f"]}),r(e,{dimColor:!0,children:" View filtered-out packages"})]})]}),l(i,{flexDirection:"column",children:[l(i,{marginBottom:1,children:[r(e,{dimColor:!0,children:"── "}),r(e,{bold:!0,color:"white",children:"ACTIONS"})]}),!s&&l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","u"]}),r(e,{dimColor:!0,children:" Apply selected updates"})]}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","q"]}),r(e,{dimColor:!0,children:" Quit"})]}),l(e,{children:[l(e,{bold:!0,color:"white",children:[" ","?"]}),r(e,{dimColor:!0,children:" Toggle help"})]})]})]}),W=u.getCheckedEntries(),_=W.filter(d=>d.updateType==="major").length,Ce=l(i,{alignItems:"center",flexDirection:"column",children:[_>0&&r(i,{marginBottom:1,marginTop:1,children:l(e,{color:"yellow",children:["⚠"," ",_," ","major update",_===1?"":"s"," ","— review breaking changes"]})}),l(e,{dimColor:!0,children:["Press"," ",r(e,{bold:!0,color:"white",children:"u"})," ","or"," ",r(e,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",r(e,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),ne=r(ee,{footer:Ce,scrollRef:A,title:`Apply ${W.length} update${W.length===1?"":"s"}?`,visible:N,width:70,children:W.map(d=>l(i,{gap:1,children:[l(e,{children:[" ",d.packageName]}),l(e,{dimColor:!0,children:[d.currentRange," ","→"," ",d.newRange]}),r(e,{bold:!0,color:d.updateType==="major"?"red":d.updateType==="minor"?"yellow":"green",children:d.updateType})]},d.packageName))}),ce=n.length>0?r(ee,{footer:l(e,{dimColor:!0,children:[r(e,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",r(e,{bold:!0,color:"white",children:"f"}),"/",r(e,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:O,title:`${n.length} PACKAGE${n.length===1?"":"S"} FILTERED BY TARGET`,visible:E,width:70,children:l(i,{flexDirection:"column",children:[r(i,{marginBottom:1,children:l(e,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",r(e,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),n.map(d=>l(i,{gap:1,children:[l(e,{children:[" ",d.packageName]}),l(e,{dimColor:!0,children:[d.currentRange," ","→"," ",d.newRange]}),r(e,{bold:!0,color:d.updateType==="major"?"red":d.updateType==="minor"?"yellow":"green",children:d.updateType})]},d.packageName))]})}):null,de=r(ze,{checkedEntries:c.checkedEntries,entries:x,filterActive:c.filterActive,filteredOutCount:n.length,filterText:c.filterText,filterType:c.filterType,focused:c.focusedPanel==="list",groupedByCatalog:c.groupedByCatalog,isDryRun:s,onViewportHeightChange:G,scrollOffset:F,selectedIndex:c.selectedIndex,totalCatalogEntries:w,totalChecked:o,totalEntries:x.length,viewportHeight:P}),ae=r(Ke,{changelogUrl:U,entry:k,focused:c.focusedPanel==="detail",recommendation:q,scrollRef:y});if(we){const d=Math.floor(m*.35);return l(i,{flexDirection:"column",height:f,width:m,children:[l(i,{flexDirection:"row",flexGrow:1,children:[r(i,{flexGrow:1,children:de}),r(i,{width:d,children:ae})]}),ie,ne,ce,r(ue,{autoExitSeconds:h||3,onCancel:T(()=>{B(!1)},"onCancel"),visible:b}),oe]})}const ke=Math.floor(f*.55);return l(i,{flexDirection:"column",height:f,width:m,children:[r(i,{height:ke,children:de}),r(i,{flexGrow:1,children:ae}),ie,ne,ce,r(ue,{autoExitSeconds:h||3,onCancel:T(()=>{B(!1)},"onCancel"),visible:b}),oe]})},"VisUpdateApp");export{kr as C,Cr as U,wr as a};
|