@visulima/vis 1.0.0-alpha.40 → 1.0.0-alpha.41
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 +27 -0
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/config/index.d.ts +18 -0
- package/dist/packem_chunks/bin.js +202 -202
- package/dist/packem_chunks/handler10.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 +1 -1
- 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/handler21.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/handler30.js +1 -2
- package/dist/packem_chunks/handler31.js +2 -2
- package/dist/packem_chunks/handler32.js +2 -2
- package/dist/packem_chunks/handler33.js +2 -3
- package/dist/packem_chunks/handler34.js +3 -6
- package/dist/packem_chunks/handler35.js +6 -1
- package/dist/packem_chunks/handler36.js +1 -42
- package/dist/packem_chunks/handler37.js +42 -8
- package/dist/packem_chunks/handler38.js +8 -9
- package/dist/packem_chunks/handler39.js +9 -75
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +75 -5
- package/dist/packem_chunks/handler41.js +5 -4
- package/dist/packem_chunks/handler42.js +4 -3
- package/dist/packem_chunks/handler43.js +3 -2
- package/dist/packem_chunks/handler44.js +2 -1
- package/dist/packem_chunks/handler45.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -3
- package/dist/packem_chunks/handler48.js +3 -1
- package/dist/packem_chunks/handler49.js +1 -7
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +6 -32
- package/dist/packem_chunks/handler51.js +33 -3
- package/dist/packem_chunks/handler52.js +3 -8
- package/dist/packem_chunks/handler53.js +6 -2
- package/dist/packem_chunks/handler54.js +4 -1
- package/dist/packem_chunks/handler55.js +1 -12
- package/dist/packem_chunks/handler56.js +11 -6
- package/dist/packem_chunks/handler57.js +7 -5
- package/dist/packem_chunks/handler58.js +5 -11
- package/dist/packem_chunks/handler59.js +11 -3
- package/dist/packem_chunks/handler60.js +3 -22
- package/dist/packem_chunks/handler61.js +21 -60
- package/dist/packem_chunks/handler62.js +61 -3
- package/dist/packem_chunks/handler63.js +3 -6
- package/dist/packem_chunks/handler64.js +6 -708
- package/dist/packem_chunks/handler65.js +708 -24
- package/dist/packem_chunks/handler66.js +24 -25
- package/dist/packem_chunks/handler67.js +25 -153
- package/dist/packem_chunks/handler68.js +153 -10
- package/dist/packem_chunks/handler69.js +10 -24
- package/dist/packem_chunks/handler70.js +24 -322
- package/dist/packem_chunks/handler71.js +322 -48
- package/dist/packem_chunks/handler72.js +48 -27
- package/dist/packem_chunks/handler73.js +27 -3
- package/dist/packem_chunks/handler74.js +3 -190
- package/dist/packem_chunks/handler75.js +189 -37
- package/dist/packem_chunks/handler76.js +38 -0
- 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/help-command.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.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_chunks/version-resolver.js +1 -1
- package/dist/packem_shared/command-runtime-CR70qSUM.js +1 -0
- package/dist/packem_shared/{cyclonedx-kYozDyxp.js → cyclonedx-Cadls41z.js} +1 -1
- package/dist/packem_shared/{index-Du8RWawQ.js → index-3jMNqQom.js} +1 -1
- package/dist/packem_shared/index-Bt521H5J.js +30 -0
- package/dist/packem_shared/{index-CgcF6_wo.js → index-DGSsjmpV.js} +1 -1
- package/dist/packem_shared/{pm-runner-OGResYrA.js → pm-runner-BKZQo7Ts.js} +1 -1
- package/dist/packem_shared/{provenance-_CJjMKwu.js → provenance-BFEwKgI3.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-CMDl55Nz.js → resolve-explicit-C6WM-I2u.js} +1 -1
- package/dist/packem_shared/{s1ngularity-Dhr3bPk0.js → s1ngularity-DCPmPE5M.js} +1 -1
- package/dist/packem_shared/{signatures-C730vkyK.js → signatures-Xpd6HjG_.js} +1 -1
- package/index.d.ts +201 -201
- package/index.js +26 -26
- package/package.json +13 -13
- package/schemas/vis-config.schema.json +12 -0
- package/dist/packem_shared/index-yBikBkHT.js +0 -30
|
@@ -1,24 +1,708 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
`)}}},Ie=(r,e,n,o,c)=>{if(o.name==="deno")return{added:[],updated:[]};const i=A(e),l=JSON.parse(i),{overrides:u,source:k}=_e(r,l,o),s=[],d=[],m=new Set;if(o.name==="npm")for(const f of["dependencies","devDependencies"]){const x=l[f];if(x)for(const b of Object.keys(x))m.add(b)}for(const f of n){const x=u[f.original];if(typeof x=="object")continue;let b=f.spec;o.name==="npm"&&m.has(f.original)&&(b=`$${f.original}`),x!==b&&(x?d.push(f.original):s.push(f.original),u[f.original]=b)}if(s.length===0&&d.length===0)return{added:s,updated:d};const j=Object.fromEntries(Object.entries(u).sort(([f],[x])=>f.localeCompare(x)));return k==="pnpm-workspace.yaml"?Ae(r,j):Re(e,l,j,o.name,c),{added:s,updated:d}},Fe=(r,e)=>{const n={bun:["bun.lock"],deno:["deno.lock"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]};for(const o of n[e]??[]){const c=O(r,o);try{return A(c)}catch{continue}}return""},Me=(r,e,n)=>{if(!r)return!1;const o=e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);switch(n){case"bun":return r.includes(`"${e}":`)||new RegExp(String.raw`(^|\s|[",])${o}@`,"m").test(r);case"deno":return r.includes(`"${e}"`)||r.includes(`"npm:${e}@`)||r.includes(`"jsr:${e}@`);case"npm":return r.includes(`"${e}":`)||r.includes(`"node_modules/${e}":`);case"pnpm":return new RegExp(String.raw`(^|\s|['"/])${o}(@|['"]?:)`,"m").test(r);case"yarn":return new RegExp(String.raw`(^|\s|[",])${o}@`,"m").test(r);default:return!1}};var q={exports:{}},B,X;function K(){if(X)return B;X=1;var r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,c=(s,d)=>{for(var m in d)r(s,m,{get:d[m],enumerable:!0})},i=(s,d,m,j)=>{if(d&&typeof d=="object"||typeof d=="function")for(let f of n(d))!o.call(s,f)&&f!==m&&r(s,f,{get:()=>d[f],enumerable:!(j=e(d,f))||j.enumerable});return s},l=s=>i(r({},"__esModule",{value:!0}),s),u={};c(u,{PURL_Type:()=>k}),B=l(u);var k=(s=>(s.APK="apk",s.BITBUCKET="bitbucket",s.COCOAPODS="cocoapods",s.CARGO="cargo",s.CHROME="chrome",s.COMPOSER="composer",s.CONAN="conan",s.CONDA="conda",s.CRAN="cran",s.DEB="deb",s.DOCKER="docker",s.GEM="gem",s.GENERIC="generic",s.GITHUB="github",s.GOLANG="golang",s.HACKAGE="hackage",s.HEX="hex",s.HUGGINGFACE="huggingface",s.MAVEN="maven",s.MLFLOW="mlflow",s.NPM="npm",s.NUGET="nuget",s.OCI="oci",s.PUB="pub",s.PYPI="pypi",s.QPKG="qpkg",s.RPM="rpm",s.SWID="swid",s.SWIFT="swift",s.VCS="vcs",s))(k||{});return B}var V;function Ge(){return V||(V=1,(function(r){var e=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,i=(d,m)=>{for(var j in m)e(d,j,{get:m[j],enumerable:!0})},l=(d,m,j,f)=>{if(m&&typeof m=="object"||typeof m=="function")for(let x of o(m))!c.call(d,x)&&x!==j&&e(d,x,{get:()=>m[x],enumerable:!(f=n(m,x))||f.enumerable});return d},u=(d,m,j)=>(l(d,m,"default"),j&&l(j,m,"default")),k={};i(k,{getManifestData:()=>s}),u(k,K(),r.exports);function s(d,m){try{const j=require("../manifest.json");if(!d)return j;const f=j[d];if(!f)return;if(!m)return f;const x=f.find(([b,g])=>g.package===m);return x?x[1]:void 0}catch{return}}r.exports={getManifestData:s,...K()}})(q)),q.exports}var Le=Ge();const qe=(r,e,n)=>{let o=r;if(e!=="all"&&(o=o.filter(c=>c.category===e)),n){const c=n.toLowerCase();o=o.filter(i=>i.packageName.toLowerCase().includes(c))}return o};class Be{#e;#t=new Set;constructor(e){this.#e={applyProgress:null,checkedEntries:new Set,entries:e,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",phase:"browsing",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=e=>(this.#t.add(e),()=>{this.#t.delete(e)});getFilteredEntries=()=>qe(this.#e.entries,this.#e.filterType,this.#e.filterText);#r(){this.#e={...this.#e};for(const e of this.#t)e()}select(e){const n=this.getFilteredEntries();this.#e.selectedIndex=n.length===0?-1:Math.max(0,Math.min(e,n.length-1)),this.#r()}toggleCheck(e){const n=new Set(this.#e.checkedEntries);n.has(e)?n.delete(e):n.add(e),this.#e.checkedEntries=n,this.#r()}toggleAll(){const e=this.getFilteredEntries(),n=new Set(this.#e.checkedEntries);if(e.every(o=>n.has(o.packageName)))for(const o of e)n.delete(o.packageName);else for(const o of e)n.add(o.packageName);this.#e.checkedEntries=n,this.#r()}setFilter(e){this.#e.filterType=e,this.#e.selectedIndex=0,this.#r()}setFilterText(e){this.#e.filterText=e,this.#e.selectedIndex=0,this.#r()}setFilterActive(e){this.#e.filterActive=e,this.#r()}setFocusedPanel(e){this.#e.focusedPanel=e,this.#r()}setPhase(e){this.#e.phase=e,this.#r()}setProgress(e,n){this.#e.applyProgress={current:e,total:n},this.#r()}setError(e){this.#e.error=e,this.#e.phase="error",this.#r()}getCheckedEntries(){return this.#e.entries.filter(e=>this.#e.checkedEntries.has(e.packageName))}}const ee={"micro-utility":"gray",native:"green",preferred:"yellow",socket:"cyan"},Ue={"micro-utility":"MICRO",native:"NATIVE",preferred:"PREF",socket:"SOCKET"},ze={"micro-utility":"Trivial utility package that can be replaced with inline code.",native:"Polyfill for a native JS/Node.js API. Use the built-in instead.",preferred:"A lighter or faster alternative package exists.",socket:"Security-hardened replacement from Socket.dev's @socketregistry."},Je=({entry:r,focused:e,scrollRef:n})=>{const o=e?"white":"gray";if(!r)return t.jsx(h,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:t.jsx(a,{dimColor:!0,children:"No entry selected"})});const c=ee[r.category]??"gray";return t.jsxs(h,{borderColor:o,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsx(h,{flexShrink:0,paddingTop:1,paddingX:2,children:t.jsx(a,{bold:!0,color:"white",children:r.packageName})}),t.jsxs(pe,{flexGrow:1,flexShrink:1,paddingX:2,ref:n,scrollbar:!0,scrollbarColor:"gray",children:[t.jsx(a,{}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Category:"})}),t.jsx(a,{bold:!0,color:c,children:r.category})]}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Replace with:"})}),t.jsx(a,{children:r.replacement})]}),r.overrideSpec&&t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Override:"})}),t.jsx(a,{color:"cyan",children:r.overrideSpec})]}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Codemod:"})}),t.jsx(a,{color:r.hasCodemod?"green":"gray",children:r.hasCodemod?"available ⚙":"not available"})]}),t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"white",children:"DESCRIPTION"}),t.jsx(h,{marginTop:1,paddingLeft:2,children:t.jsx(a,{children:ze[r.category]??""})})]}),r.category==="native"&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"green",children:"ACTION"}),t.jsx(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.hasCodemod?t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"green",children:["✓"," ","Codemod will rewrite imports to use native API."]}),t.jsx(a,{dimColor:!0,children:" The package can then be removed from dependencies."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"yellow",children:["ℹ"," ","No automated codemod available."]}),t.jsx(a,{dimColor:!0,children:" Manual migration required — replace usage with native equivalent."})]})})]}),r.category==="socket"&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"cyan",children:"ACTION"}),t.jsxs(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{color:"cyan",children:["✓"," ","Override will redirect resolution to the hardened package."]}),t.jsx(a,{dimColor:!0,children:" No source code changes needed — drop-in replacement."})]})]}),(r.category==="preferred"||r.category==="micro-utility")&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"yellow",children:"ACTION"}),t.jsx(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.hasCodemod?t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"green",children:["✓"," ","Codemod will rewrite imports to the recommended alternative."]}),t.jsx(a,{dimColor:!0,children:" The original package can then be removed from dependencies."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"yellow",children:["ℹ"," ","Manual migration required."]}),r.docUrl?t.jsx(a,{dimColor:!0,children:" Open the migration guide below for the recommended alternative and steps."}):t.jsx(a,{dimColor:!0,children:" Consult the package's docs or the e18e module-replacements guide for an alternative."})]})})]}),t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"white",children:"LINKS"}),t.jsxs(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{color:"cyan",underline:!0,children:["https://npmx.dev/",r.packageName]}),r.docUrl&&t.jsx(a,{color:"cyan",underline:!0,children:r.docUrl})]})]})]})]})},He=[{key:"all",label:"All",shortcut:"1"},{key:"native",label:"Native",shortcut:"2"},{key:"preferred",label:"Preferred",shortcut:"3"},{key:"micro-utility",label:"Micro",shortcut:"4"},{key:"socket",label:"Socket",shortcut:"5"}],Xe=({checked:r,entry:e,isSelected:n})=>{const o=ee[e.category]??"white",c=Ue[e.category]??e.category,i=r?"☑":"☐",l=e.hasCodemod?"⚙":" ";return t.jsxs(h,{flexShrink:0,height:1,children:[t.jsx(a,{children:n?">":" "}),t.jsxs(a,{color:r?"white":"gray",children:[" ",i," "]}),t.jsx(a,{bold:!0,color:o,children:`[${c}]`.padEnd(9)}),t.jsxs(a,{children:[" ",l," "]}),t.jsx(h,{flexGrow:1,children:t.jsx(a,{bold:n,inverse:n,wrap:"truncate",children:e.packageName})}),t.jsx(a,{dimColor:!0,children:" → "}),t.jsx(a,{wrap:"truncate",children:e.replacement})]})},Ke=({checkedEntries:r,entries:e,filterActive:n,filterText:o,filterType:c,focused:i,isDryRun:l,scrollOffset:u,selectedIndex:k,totalEntries:s,viewportHeight:d})=>{const m=i?"white":"gray";let j=0,f=0,x=0,b=0;for(const C of e)switch(C.category){case"micro-utility":{x++;break}case"native":{j++;break}case"preferred":{f++;break}case"socket":{b++;break}}const g=[];j>0&&g.push(`${j} native`),f>0&&g.push(`${f} preferred`),x>0&&g.push(`${x} micro`),b>0&&g.push(`${b} socket`);const w=g.length>0?` (${g.join(", ")})`:"",$=r.size,T=[];for(const[C,p]of e.entries())T.push(t.jsx(Xe,{checked:r.has(p.packageName),entry:p,isSelected:C===k},p.packageName));const N=e.length,P=N>d&&d>0;return t.jsxs(h,{borderColor:m,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsxs(h,{flexShrink:0,gap:1,paddingX:1,children:[t.jsx(a,{bold:!0,inverse:!0,children:" VIS OPTIMIZE "}),t.jsxs(a,{wrap:"truncate",children:[s," ","optimizations",w]}),!l&&$>0&&t.jsxs(a,{dimColor:!0,children:[" ","—",$," ","selected"]})]}),t.jsx(h,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:He.map(C=>{const p=c===C.key;return t.jsxs(h,{children:[t.jsx(a,{dimColor:!p,children:"["}),t.jsx(a,{bold:p,color:p?"cyan":"gray",children:C.shortcut}),t.jsx(a,{dimColor:!p,children:"]"}),t.jsxs(a,{color:p?"white":"gray",children:[" ",C.label]})]},C.key)})}),n&&t.jsxs(h,{flexShrink:0,paddingX:1,children:[t.jsx(a,{bold:!0,color:"white",children:"/ "}),t.jsx(a,{children:o}),t.jsx(a,{inverse:!0,children:" "})]}),t.jsxs(h,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t.jsx(h,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t.jsx(h,{flexDirection:"column",marginTop:-u,children:T})}),P&&t.jsx(h,{flexShrink:0,marginLeft:1,marginRight:1,children:t.jsx(fe,{contentHeight:N,placement:"inset",scrollOffset:u,style:"block",viewportHeight:d})})]})]})},Ve=100,W=10,Y={1:"all",2:"native",3:"preferred",4:"micro-utility",5:"socket"},We=({isDryRun:r,store:e})=>{const{exit:n}=he(),{columns:o,rows:c}=ue(),i=D.useSyncExternalStore(e.subscribe,e.getSnapshot),l=D.useRef(null),[u,k]=D.useState(0),[s,d]=D.useState(!1),m=e.getFilteredEntries(),j=m[i.selectedIndex]??null,f=o>=Ve,x=Math.max(0,c-5),b=D.useCallback(g=>{n(g)},[n]);return me((g,w)=>{if(s){g==="y"||g==="Y"?b():d(!1);return}if(i.filterActive){w.escape?(e.setFilterActive(!1),e.setFilterText("")):w.return?e.setFilterActive(!1):w.backspace||w.delete?e.setFilterText(i.filterText.slice(0,-1)):g&&!w.ctrl&&!w.meta&&e.setFilterText(i.filterText+g);return}if(g==="q"){!r&&i.checkedEntries.size>0?d(!0):b();return}if(g==="/"){e.setFilterActive(!0);return}if(Y[g]){e.setFilter(Y[g]);return}if(w.tab){e.setFocusedPanel(i.focusedPanel==="list"?"detail":"list");return}if(i.focusedPanel==="list")if(w.upArrow||g==="k"){const $=Math.max(0,i.selectedIndex-1);e.select($),$<u&&k($)}else if(w.downArrow||g==="j"){const $=Math.min(m.length-1,i.selectedIndex+1);e.select($),$>=u+x&&k($-x+1)}else g===" "?j&&e.toggleCheck(j.packageName):g==="a"?e.toggleAll():w.return&&!r&&i.checkedEntries.size>0&&b(e.getCheckedEntries());else i.focusedPanel==="detail"&&(w.upArrow||g==="k"?l.current?.scrollBy(-1):(w.downArrow||g==="j")&&l.current?.scrollBy(1))},{isActive:i.phase==="browsing"}),c<W?t.jsx(h,{alignItems:"center",justifyContent:"center",children:t.jsxs(a,{color:"yellow",children:["Terminal too small. Resize to at least",W," ","rows."]})}):t.jsxs(h,{flexDirection:"column",height:c,width:o,children:[t.jsxs(h,{flexDirection:f?"row":"column",flexGrow:1,children:[t.jsx(h,{flexBasis:f?"50%":void 0,flexGrow:1,children:t.jsx(Ke,{checkedEntries:i.checkedEntries,entries:m,filterActive:i.filterActive,filterText:i.filterText,filterType:i.filterType,focused:i.focusedPanel==="list",isDryRun:r,scrollOffset:u,selectedIndex:i.selectedIndex,totalEntries:i.entries.length,viewportHeight:x})}),t.jsx(h,{flexBasis:f?"50%":void 0,flexGrow:1,children:t.jsx(Je,{entry:j,focused:i.focusedPanel==="detail",scrollRef:l})})]}),t.jsx(h,{flexShrink:0,paddingX:1,children:t.jsxs(a,{dimColor:!0,children:[r?"Preview mode":"space:toggle a:all enter:apply"," ","| tab:switch panel /: filter q:quit |","⚙","=codemod available"]})}),t.jsx(ge,{autoExitSeconds:3,onCancel:()=>{d(!1)},visible:s})]})},U=(r,e)=>{const n=new Set;try{const o=Q(r),c=e?[o.dependencies,o.optionalDependencies]:[o.dependencies,o.devDependencies,o.peerDependencies,o.optionalDependencies];for(const i of c)if(i)for(const l of Object.keys(i))n.add(l)}catch{}return n},re=r=>{const e=je(r);if(e)return J(r,e);const n=O(r,"package.json");if(!z(n))return[];try{const o=Q(n),c=Array.isArray(o.workspaces)?o.workspaces:o.workspaces?.packages;return c?J(r,c):[]}catch{return[]}},Ye="https://github.com/es-tooling/module-replacements/blob/main/docs/modules",Ze=r=>`${Ye}/${r}.md`,Qe=r=>{if(r.type==="simple"&&r.replacement)return r.replacement;if(r.type==="native"){const e=r.nodeVersion?` (Node ${r.nodeVersion}+)`:"";return r.replacement?`${r.replacement}${e}`:`Native API${e}`}return r.type==="documented"&&r.docPath?"see migration guide":""},te=r=>{const e=[],n=(o,c)=>{const i=o.moduleReplacements;if(Array.isArray(i))for(const l of i)r.has(l.moduleName)&&e.push({category:c,docUrl:l.type==="documented"&&l.docPath?Ze(l.docPath):void 0,hasCodemod:!1,overrideSpec:void 0,packageName:l.moduleName,replacement:Qe(l)})};return n(ve,"native"),n(be,"preferred"),n(we,"micro-utility"),e},ne=(r,e,n,o)=>{const c=Le.getManifestData("npm")??[],i=[];for(const[,l]of c){if(l.deprecated)continue;const u=r.has(l.package),k=e?Me(e,l.package,n.name):!1;if(!u&&!k)continue;const s=Z.coerce(l.version)?.major;if(s===void 0)continue;const d=o?`npm:${l.name}@${l.version}`:`npm:${l.name}@^${String(s)}`;i.push({category:"socket",hasCodemod:!1,overrideSpec:d,packageName:l.package,replacement:l.name})}return i};let G;const oe=async()=>{if(G)return G;try{return G=(await import("module-replacements-codemods")).codemods,G}catch{return{}}},se=async r=>{try{const e=await oe();for(const n of r)n.category!=="socket"&&e[n.packageName]&&(n.hasCodemod=!0)}catch{}},ie=async(r,e,n)=>{let o=0;try{const c=(await oe())[n];if(!c)return{filesChanged:0,packageName:n};const i=c({}),l=await er(e);for(const u of l){const k=A(u);if(k.includes(n))try{const s=await i.transform({file:{filename:u,source:k}});s!==k&&(await r.writeFile(u,s,"utf8"),o++)}catch(s){process.stderr.write(`warn: codemod transform failed for ${u}: ${s instanceof Error?s.message:String(s)}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import{createRequire as K}from"node:module";import{j as S,q as O,E as C}from"../packem_shared/Table-CcVkyULl-B_ef6zfS.js";import{projectGraphToDot as ee}from"@visulima/task-runner";import{a4 as e,a5 as s,m as r,aE as te,aF as re,aG as ae,aD as ne,s as j,ae as ie,aH as oe,aI as P,b as se,O as le,$ as ce,d as de,r as pe}from"./bin.js";import ue from"graphology";import _ from"graphology-layout-forceatlas2";import{d as xe}from"../packem_shared/anolilab-text-CAM_E6uK.js";const Z=K(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=n=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[t,a]=I.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return I.getBuiltinModule(n)}return Z(n)},{readFileSync:he}=R("node:fs"),{createRequire:fe}=R("node:module"),{join:ge,dirname:me}=R("node:path");var be=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-content:""}}}@layer theme{:root,:host{--color-white:#fff;--spacing:.25rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-light:300;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--leading-tight:1.25;--leading-snug:1.375;--radius-sm:.25rem;--ease-out:cubic-bezier(0, 0, .2, 1);--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--sans);--default-mono-font-family:var(--mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root{--bg:#f5f5f5;--panel:#fff;--panel2:#f0f0f0;--fg:#000;--muted:#555;--faint:#707070;--border:#e0e0e0;--border2:#bdbdbd;--row-hover:#f0f0f0;--accent:#d71921;--accent-soft:#d719210d;--link:#0050c0;--node-app:#000;--node-lib:#707070;--edge:#bdbdbd;--edge-faint:#e0e0e0;--mono:ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;--sans:system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif}@media (prefers-color-scheme:dark){:root{--bg:#141414;--panel:#1c1c1c;--panel2:#242424;--fg:#fff;--muted:#b8b8b8;--faint:#8a8a8a;--border:#2e2e2e;--border2:#3e3e3e;--row-hover:#1f1f1f;--accent:#ff4d54;--accent-soft:#ff4d5414;--link:#7eb0f9;--node-app:#fff;--node-lib:#8a8a8a;--edge:#3e3e3e;--edge-faint:#2e2e2e}}html[data-theme=light]{--bg:#f5f5f5;--panel:#fff;--panel2:#f0f0f0;--fg:#000;--muted:#555;--faint:#707070;--border:#e0e0e0;--border2:#bdbdbd;--row-hover:#f0f0f0;--accent:#d71921;--accent-soft:#d719210d;--link:#0050c0;--node-app:#000;--node-lib:#707070;--edge:#bdbdbd;--edge-faint:#e0e0e0}html[data-theme=dark]{--bg:#141414;--panel:#1c1c1c;--panel2:#242424;--fg:#fff;--muted:#b8b8b8;--faint:#8a8a8a;--border:#2e2e2e;--border2:#3e3e3e;--row-hover:#1f1f1f;--accent:#ff4d54;--accent-soft:#ff4d5414;--link:#7eb0f9;--node-app:#fff;--node-lib:#8a8a8a;--edge:#3e3e3e;--edge-faint:#2e2e2e}body{background-image:radial-gradient(circle, var(--border) .5px, transparent .5px);font-feature-settings:"ss01";background-size:14px 14px}}@layer components{.tbtn-theme [data-icon=moon]{display:inline-flex}.tbtn-theme [data-icon=sun]{display:none}@media (prefers-color-scheme:dark){.tbtn-theme [data-icon=moon]{display:none}.tbtn-theme [data-icon=sun]{display:inline-flex}}html[data-theme=light] .tbtn-theme [data-icon=moon]{display:inline-flex}html[data-theme=light] .tbtn-theme [data-icon=sun],html[data-theme=dark] .tbtn-theme [data-icon=moon]{display:none}html[data-theme=dark] .tbtn-theme [data-icon=sun]{display:inline-flex}.anolilab-logo{width:auto;height:13px;fill:var(--fg)}.anolilab-accent{fill:#dfff1b}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.top-4{top:calc(var(--spacing) * 4)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-4{right:calc(var(--spacing) * 4)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-5{bottom:calc(var(--spacing) * 5)}.left-0{left:calc(var(--spacing) * 0)}.left-4{left:calc(var(--spacing) * 4)}.isolate{isolation:isolate}.z-20{z-index:20}.z-30{z-index:30}.z-\\[2\\]{z-index:2}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.m-8{margin:calc(var(--spacing) * 8)}.m-9{margin:calc(var(--spacing) * 9)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-12{margin-inline:calc(var(--spacing) * 12)}.mx-\\[0\\.12em\\]{margin-inline:.12em}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-12{margin-top:calc(var(--spacing) * 12)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-10{margin-bottom:calc(var(--spacing) * 10)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-8{margin-left:calc(var(--spacing) * 8)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-\\[7px\\]{width:7px;height:7px}.h-2{height:calc(var(--spacing) * 2)}.h-5{height:calc(var(--spacing) * 5)}.h-7{height:calc(var(--spacing) * 7)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-\\[6px\\]{height:6px}.h-\\[7px\\]{height:7px}.h-\\[8px\\]{height:8px}.h-\\[10px\\]{height:10px}.h-\\[18px\\]{height:18px}.h-full{height:100%}.h-px{height:1px}.max-h-72{max-height:calc(var(--spacing) * 72)}.min-h-\\[400px\\]{min-height:400px}.min-h-\\[480px\\]{min-height:480px}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-9{width:calc(var(--spacing) * 9)}.w-\\[7px\\]{width:7px}.w-\\[8px\\]{width:8px}.w-full{width:100%}.w-px{width:1px}.max-w-\\[380px\\]{max-width:380px}.max-w-\\[1080px\\]{max-width:1080px}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-\\[200px\\]{min-width:200px}.min-w-\\[220px\\]{min-width:220px}.min-w-\\[260px\\]{min-width:260px}.flex-1{flex:1}.flex-\\[1_1_280px\\]{flex:280px}.flex-auto{flex:auto}.flex-none{flex:none}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-move{cursor:move}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\\[72px_1fr\\]{grid-template-columns:72px 1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0{gap:calc(var(--spacing) * 0)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-12{gap:calc(var(--spacing) * 12)}.gap-16{gap:calc(var(--spacing) * 16)}.gap-\\[0\\.65rem\\]{gap:.65rem}.gap-\\[2px\\]{gap:2px}.gap-\\[7px\\]{gap:7px}.gap-px{gap:1px}:where(.space-y-0\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.self-center{align-self:center}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-full{border-radius:3.40282e38px}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent,.border-accent\\/60{border-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.border-accent\\/60{border-color:color-mix(in oklab, var(--accent) 60%, transparent)}}.border-border{border-color:var(--border)}.border-border2{border-color:var(--border2)}.border-fg{border-color:var(--fg)}.border-link{border-color:var(--link)}.bg-accent{background-color:var(--accent)}.bg-accent-soft{background-color:var(--accent-soft)}.bg-accent\\/40{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.bg-accent\\/40{background-color:color-mix(in oklab, var(--accent) 40%, transparent)}}.bg-bg,.bg-bg\\/40{background-color:var(--bg)}@supports (color:color-mix(in lab, red, red)){.bg-bg\\/40{background-color:color-mix(in oklab, var(--bg) 40%, transparent)}}.bg-border{background-color:var(--border)}.bg-border2{background-color:var(--border2)}.bg-edge{background-color:var(--edge)}.bg-edge-faint{background-color:var(--edge-faint)}.bg-fg{background-color:var(--fg)}.bg-node-app{background-color:var(--node-app)}.bg-node-lib{background-color:var(--node-lib)}.bg-panel,.bg-panel\\/95{background-color:var(--panel)}@supports (color:color-mix(in lab, red, red)){.bg-panel\\/95{background-color:color-mix(in oklab, var(--panel) 95%, transparent)}}.bg-panel2{background-color:var(--panel2)}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-0\\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.px-12{padding-inline:calc(var(--spacing) * 12)}.px-\\[5px\\]{padding-inline:5px}.px-\\[6px\\]{padding-inline:6px}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.py-\\[3px\\]{padding-block:3px}.py-px{padding-block:1px}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-7{padding-top:calc(var(--spacing) * 7)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pt-12{padding-top:calc(var(--spacing) * 12)}.pr-0{padding-right:calc(var(--spacing) * 0)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pr-1234{padding-right:calc(var(--spacing) * 1234)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-8{padding-bottom:calc(var(--spacing) * 8)}.pb-12{padding-bottom:calc(var(--spacing) * 12)}.pl-0{padding-left:calc(var(--spacing) * 0)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-\\[7px\\]{padding-left:7px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--mono)}.font-sans{font-family:var(--sans)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-\\[22px\\]{font-size:22px}.text-\\[28px\\]{font-size:28px}.text-\\[44px\\]{font-size:44px}.text-\\[72px\\]{font-size:72px}.text-\\[clamp\\(28px\\,5vw\\,52px\\)\\]{font-size:clamp(28px,5vw,52px)}.leading-\\[0\\.9\\]{--tw-leading:.9;line-height:.9}.leading-none{--tw-leading:1;line-height:1}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\\[-0\\.02em\\]{--tw-tracking:-.02em;letter-spacing:-.02em}.tracking-\\[0\\.1em\\]{--tw-tracking:.1em;letter-spacing:.1em}.tracking-\\[0\\.05em\\]{--tw-tracking:.05em;letter-spacing:.05em}.tracking-\\[0\\.08em\\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\\[0\\.11em\\]{--tw-tracking:.11em;letter-spacing:.11em}.tracking-\\[0\\.12em\\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\\[0\\.15em\\]{--tw-tracking:.15em;letter-spacing:.15em}.tracking-\\[0\\.16em\\]{--tw-tracking:.16em;letter-spacing:.16em}.tracking-\\[0\\.22em\\]{--tw-tracking:.22em;letter-spacing:.22em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-accent{color:var(--accent)}.text-bg{color:var(--bg)}.text-faint{color:var(--faint)}.text-fg{color:var(--fg)}.text-link{color:var(--link)}.text-muted{color:var(--muted)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.opacity-40{opacity:.4}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_4px_12px_rgba\\(0\\,0\\,0\\,0\\.08\\)\\]{--tw-shadow:0 4px 12px var(--tw-shadow-color,#00000014);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_8px_24px_rgba\\(0\\,0\\,0\\,0\\.12\\)\\]{--tw-shadow:0 8px 24px var(--tw-shadow-color,#0000001f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-0{outline-style:var(--tw-outline-style);outline-width:0}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.select-none{-webkit-user-select:none;user-select:none}.\\[notifications\\:\\<id\\>\\]{notifications:<id>}.\\[notifications\\:slack\\]{notifications:slack}.\\[notifications\\:teams\\]{notifications:teams}.\\[verdaccio\\:dry-run\\]{verdaccio:dry-run}.group-data-\\[state\\=off\\]\\:opacity-30:is(:where(.group)[data-state=off] *){opacity:.3}.placeholder\\:text-faint::placeholder{color:var(--faint)}.before\\:absolute:before{content:var(--tw-content);position:absolute}.before\\:left-0:before{content:var(--tw-content);left:calc(var(--spacing) * 0)}.before\\:text-faint:before{content:var(--tw-content);color:var(--faint)}.before\\:content-\\[\\'→\\'\\]:before{--tw-content:"→";content:var(--tw-content)}.after\\:ml-auto:after{content:var(--tw-content);margin-left:auto}.after\\:font-mono:after{content:var(--tw-content);font-family:var(--mono)}.after\\:text-\\[9px\\]:after{content:var(--tw-content);font-size:9px}.after\\:tracking-\\[0\\.1em\\]:after{content:var(--tw-content);--tw-tracking:.1em;letter-spacing:.1em}.after\\:text-accent:after{content:var(--tw-content);color:var(--accent)}.after\\:content-\\[\\'ON\\'\\]:after{--tw-content:"ON";content:var(--tw-content)}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.focus-within\\:border-fg:focus-within{border-color:var(--fg)}@media (hover:hover){.hover\\:border-fg:hover{border-color:var(--fg)}.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-row-hover:hover{background-color:var(--row-hover)}.hover\\:text-accent:hover{color:var(--accent)}.hover\\:text-fg:hover{color:var(--fg)}.hover\\:text-white:hover{color:var(--color-white)}.hover\\:opacity-90:hover{opacity:.9}}.focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\\:ring-fg:focus-visible{--tw-ring-color:var(--fg)}.focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:opacity-40:disabled{opacity:.4}.aria-selected\\:bg-row-hover[aria-selected=true]{background-color:var(--row-hover)}.data-\\[open\\=false\\]\\:hidden[data-open=false]{display:none}.data-\\[pinned\\=true\\]\\:pointer-events-auto[data-pinned=true]{pointer-events:auto}.data-\\[pinned\\=true\\]\\:border-accent[data-pinned=true]{border-color:var(--accent)}.data-\\[state\\=off\\]\\:text-faint[data-state=off]{color:var(--faint)}.data-\\[state\\=off\\]\\:line-through[data-state=off]{text-decoration-line:line-through}.data-\\[state\\=off\\]\\:after\\:text-faint[data-state=off]:after{content:var(--tw-content);color:var(--faint)}.data-\\[state\\=off\\]\\:after\\:content-\\[\\'OFF\\'\\][data-state=off]:after{--tw-content:"OFF";content:var(--tw-content)}.data-\\[state\\=selected\\]\\:bg-row-hover[data-state=selected]{background-color:var(--row-hover)}.data-\\[state\\=zero\\]\\:text-accent[data-state=zero]{color:var(--accent)}@media (min-width:40rem){.sm\\:min-w-\\[320px\\]{min-width:320px}}@media (min-width:48rem){.md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\\:grid-cols-\\[1\\.4fr_1fr\\]{grid-template-columns:1.4fr 1fr}}.\\[\\&_svg\\]\\:size-\\[14px\\] svg{width:14px;height:14px}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.\\[\\&_tr\\]\\:border-b-0 tr{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.\\[\\&\\>\\*\\+\\*\\]\\:ml-6>*+*{margin-left:calc(var(--spacing) * 6)}.\\[\\&\\>\\*\\+\\*\\]\\:border-l>*+*{border-left-style:var(--tw-border-style);border-left-width:1px}.\\[\\&\\>\\*\\+\\*\\]\\:border-border>*+*{border-color:var(--border)}.\\[\\&\\>\\*\\+\\*\\]\\:pl-6>*+*{padding-left:calc(var(--spacing) * 6)}.\\[\\&\\>td\\]\\:border-b>td{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\\[\\&\\>td\\]\\:border-border>td{border-color:var(--border)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}`;const we=be,ve=fe(import.meta.url),A=(n,t)=>{const a=ve.resolve(n);return he(ge(me(a),t),"utf8")},ye=A("sigma","sigma.min.js"),ke=A("graphology","graphology.umd.min.js"),je=A("@floating-ui/core","floating-ui.core.umd.min.js"),Ce=A("@floating-ui/dom","floating-ui.dom.umd.min.js"),Te='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>',Ee='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32 1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32 1.41-1.41"/></svg>',E=n=>n.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"),Se=9,Ne=4,Ie=(n,t)=>{if(n.length===0)return[];const a=new ue({multi:!0,type:"directed"});for(const o of n){const f=a.order/n.length*Math.PI*2;a.addNode(o.name,{path:o.path,size:o.type==="application"?Se:Ne,type:o.type,x:Math.cos(f),y:Math.sin(f)})}for(const o of t)a.hasNode(o.source)&&a.hasNode(o.target)&&a.addEdge(o.source,o.target,{type:o.type});const i=_.inferSettings(a);_.assign(a,{iterations:600,settings:{...i,adjustSizes:!0,barnesHutOptimize:a.order>100,gravity:1.2,linLogMode:!0,scalingRatio:8,slowDown:4}});const l=[];return a.forEachNode((o,f)=>{l.push({name:o,path:f.path,size:f.size,type:f.type,x:f.x,y:f.y})}),l},Me=n=>{const t=n.now??new Date,a=n.nodes.filter(x=>x.type==="application").length,i=n.nodes.length-a,l=Ie(n.nodes,n.edges),o=new Set(l.map(x=>x.name)),f=n.edges.filter(x=>o.has(x.source)&&o.has(x.target)),d={edges:f,nodes:l},u=n.nodes.length===0,p={chip:"font-mono tracking-[0.08em] text-muted border border-border2 inline-flex h-7 items-center justify-center rounded-[4px] px-3 text-[11px] font-medium uppercase",dvNum:"font-mono text-[22px] font-medium text-fg leading-none",labelMono:"font-mono text-[10px] uppercase tracking-[0.15em] text-faint"};return`<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
+
<title>${E(n.tool.name)} graph · ${E(t.toISOString().slice(0,10))}</title>
|
|
8
|
+
<style>${we}</style>
|
|
9
|
+
</head>
|
|
10
|
+
<body class="bg-bg text-fg">
|
|
11
|
+
<div class="min-h-screen flex flex-col">
|
|
12
|
+
<header class="flex flex-wrap items-end gap-4 px-8 pt-8 pb-5">
|
|
13
|
+
<div class="font-sans text-[clamp(28px,5vw,52px)] font-semibold text-fg leading-none tracking-tight">${(()=>{const[x,...h]=n.tool.name.split("-");return h.length>0?`${E(x??n.tool.name)}<span class="text-accent mx-[0.12em] font-light">/</span>${E(h.join("-"))}`:E(n.tool.name)})()}<span class="font-mono tracking-[0.22em] text-faint mt-3 block text-[10px] font-medium uppercase">dependency graph</span></div>
|
|
14
|
+
<span class="flex-auto"></span>
|
|
15
|
+
<span class="${p.chip}">v${E(n.tool.version)}</span>
|
|
16
|
+
<button id="theme" class="tbtn-theme font-mono text-muted border border-border2 inline-flex h-7 w-9 cursor-pointer items-center justify-center rounded-[4px] bg-transparent transition-colors duration-150 hover:text-fg hover:border-fg" type="button" aria-label="Toggle color theme" title="Toggle color theme"><span data-icon="moon" class="items-center justify-center">${Te}</span><span data-icon="sun" class="items-center justify-center">${Ee}</span></button>
|
|
17
|
+
</header>
|
|
18
|
+
<div class="flex flex-wrap items-end gap-6 px-8 pt-5 pb-5 border-b border-border">
|
|
19
|
+
<div class="flex flex-wrap items-stretch gap-0 [&>*+*]:pl-6 [&>*+*]:ml-6 [&>*+*]:border-l [&>*+*]:border-border">
|
|
20
|
+
<div class="flex items-baseline gap-[0.65rem]"><span class="${p.labelMono}">apps</span><span class="${p.dvNum}">${String(a)}</span></div>
|
|
21
|
+
<div class="flex items-baseline gap-[0.65rem]"><span class="${p.labelMono}">libraries</span><span class="${p.dvNum}">${String(i)}</span></div>
|
|
22
|
+
<div class="flex items-baseline gap-[0.65rem]"><span class="${p.labelMono}">dependencies</span><span class="${p.dvNum}">${String(f.length)}</span></div>
|
|
23
|
+
</div>
|
|
24
|
+
<span class="flex-auto"></span>
|
|
25
|
+
<div class="relative min-w-[260px] sm:min-w-[320px] ml-auto">
|
|
26
|
+
<label class="flex items-center gap-3 border-b border-border2 transition-colors duration-150 hover:border-fg focus-within:border-fg pb-1.5">
|
|
27
|
+
<span class="${p.labelMono} select-none">find:</span>
|
|
28
|
+
<input id="filter" type="search" class="w-full min-w-0 border-0 bg-transparent py-0.5 text-fg text-[12px] font-mono outline-0 placeholder:text-faint" placeholder="package name…" aria-label="Filter packages" autocomplete="off" spellcheck="false" />
|
|
29
|
+
<span id="filter-count" data-state="" class="font-mono text-faint text-[10px] tracking-[0.05em] shrink-0 select-none data-[state=zero]:text-accent" aria-live="polite"></span>
|
|
30
|
+
</label>
|
|
31
|
+
<div id="filter-results" data-open="false" class="data-[open=false]:hidden absolute z-20 top-full left-0 right-0 mt-2 bg-panel border border-border max-h-72 overflow-y-auto shadow-[0_4px_12px_rgba(0,0,0,0.08)]" role="listbox" aria-label="Matching packages"></div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<main class="relative flex-1 min-h-[480px]">${u?'<div class="flex flex-col items-center justify-center min-h-[400px] gap-4 text-center"><div class="font-sans text-[72px] font-semibold text-fg leading-none tracking-tight">NONE</div><div class="font-mono text-faint text-[12px] uppercase tracking-[0.15em]">No projects discovered in this workspace.</div></div>':`<div id="graph" class="absolute inset-0"></div>
|
|
35
|
+
<div id="tooltip" data-pinned="false" class="fixed z-30 top-0 left-0 hidden bg-panel border border-border2 px-4 py-3 max-w-[380px] pointer-events-none font-sans shadow-[0_8px_24px_rgba(0,0,0,0.12)] data-[pinned=true]:pointer-events-auto data-[pinned=true]:border-accent"></div>
|
|
36
|
+
<div id="legend" class="absolute top-4 right-4 bg-panel/95 backdrop-blur-sm border border-border px-4 py-3 min-w-[200px]">
|
|
37
|
+
<div class="${p.labelMono} mb-2">Filter</div>
|
|
38
|
+
<div data-toggle="app" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-2 h-2 rounded-full bg-node-app shrink-0 group-data-[state=off]:opacity-30"></span>Application</div>
|
|
39
|
+
<div data-toggle="lib" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-2 h-2 rounded-full bg-node-lib shrink-0 group-data-[state=off]:opacity-30"></span>Library</div>
|
|
40
|
+
<div data-toggle="prod" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-4 h-px bg-edge shrink-0 group-data-[state=off]:opacity-30"></span>Static dep</div>
|
|
41
|
+
<div data-toggle="dev" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-4 h-px bg-edge-faint shrink-0 group-data-[state=off]:opacity-30"></span>Dev / implicit</div>
|
|
42
|
+
<div data-toggle="peer" data-state="on" class="group flex items-center gap-3 py-1 cursor-pointer text-[12px] text-fg select-none transition-colors hover:text-accent data-[state=off]:line-through data-[state=off]:text-faint after:content-['ON'] after:font-mono after:text-[9px] after:tracking-[0.1em] after:ml-auto after:text-accent data-[state=off]:after:content-['OFF'] data-[state=off]:after:text-faint" role="switch" aria-checked="true" tabindex="0"><span class="inline-block w-4 h-px bg-accent shrink-0 group-data-[state=off]:opacity-30"></span>Peer</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="absolute bottom-4 left-4 flex flex-wrap items-center gap-x-6 gap-y-2 bg-panel/95 backdrop-blur-sm border border-border px-4 py-2 font-mono text-[10px] uppercase tracking-[0.15em] text-faint">
|
|
45
|
+
<div class="flex items-center gap-2"><span class="inline-flex h-5 min-w-5 items-center justify-center px-1.5 border border-border2 rounded text-fg bg-panel2 normal-case tracking-normal text-[10px]">/</span><span>Search</span></div>
|
|
46
|
+
<div class="flex items-center gap-2"><span class="inline-flex h-5 min-w-5 items-center justify-center px-1.5 border border-border2 rounded text-fg bg-panel2 normal-case tracking-normal text-[10px]">R</span><span>Fit view</span></div>
|
|
47
|
+
<div class="flex items-center gap-2"><span class="inline-flex h-5 min-w-5 items-center justify-center px-1.5 border border-border2 rounded text-fg bg-panel2 normal-case tracking-normal text-[10px]">Click</span><span>Pin · click empty to unpin</span></div>
|
|
48
|
+
</div>`}</main>
|
|
49
|
+
<footer class="flex flex-wrap items-center justify-between gap-x-6 gap-y-3 px-8 py-4 text-[10px] uppercase border-t border-border font-mono text-faint tracking-[0.1em]">
|
|
50
|
+
<span><b class="text-fg font-semibold">${E(n.tool.name)}</b> ${E(n.tool.version)} · generated ${E(t.toISOString())}</span>
|
|
51
|
+
<span class="inline-flex items-center gap-2"><span>built by</span><a class="sig-by-link inline-flex items-center" href="https://anolilab.com" rel="noreferrer noopener" target="_blank" aria-label="Anolilab">${xe}</a></span>
|
|
52
|
+
</footer>
|
|
53
|
+
</div>
|
|
54
|
+
<script>${ke}<\/script>
|
|
55
|
+
<script>${ye}<\/script>
|
|
56
|
+
<script>${je}<\/script>
|
|
57
|
+
<script>${Ce}<\/script>
|
|
58
|
+
<script>
|
|
59
|
+
(() => {
|
|
60
|
+
const root = document.documentElement;
|
|
61
|
+
const themeBtn = document.getElementById('theme');
|
|
62
|
+
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const stored = localStorage.getItem('vis-graph-theme');
|
|
66
|
+
if (stored === 'light' || stored === 'dark') {
|
|
67
|
+
root.dataset.theme = stored;
|
|
68
|
+
}
|
|
69
|
+
} catch {}
|
|
70
|
+
|
|
71
|
+
const data = ${JSON.stringify(d).replaceAll("</",String.raw`<\/`)};
|
|
72
|
+
if (!data.nodes.length || !window.graphology || !window.Sigma) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Reusable Tailwind utility-class strings for dynamically-created elements.
|
|
77
|
+
// Inline-everywhere is the system of record; these strings only exist
|
|
78
|
+
// because the JS DOM API can't read Tailwind from the markup.
|
|
79
|
+
const CLS = {
|
|
80
|
+
ttlName: 'font-sans text-fg text-[13px] font-semibold leading-tight mb-1 break-words',
|
|
81
|
+
ttlType: 'font-mono text-faint text-[10px] uppercase tracking-[0.15em]',
|
|
82
|
+
ttlPath: 'font-mono text-muted text-[10px] mt-2 break-all',
|
|
83
|
+
ttlSection: 'font-mono text-faint text-[10px] uppercase tracking-[0.15em] mt-3 mb-1',
|
|
84
|
+
ttlEmpty: 'font-mono text-faint text-[10px] italic mt-2',
|
|
85
|
+
ttlMore: 'font-mono text-faint text-[10px] italic pl-3 mt-1',
|
|
86
|
+
ttlUl: 'mt-1 space-y-0.5',
|
|
87
|
+
ttlLi: "font-mono text-fg text-[11px] leading-snug pl-3 relative before:content-['→'] before:text-faint before:absolute before:left-0",
|
|
88
|
+
matchItem: 'flex items-center justify-between gap-3 px-3 py-2 cursor-pointer text-[12px] hover:bg-row-hover aria-selected:bg-row-hover',
|
|
89
|
+
miName: 'font-sans text-fg truncate',
|
|
90
|
+
miMark: 'bg-accent-soft text-accent rounded-sm px-0.5',
|
|
91
|
+
miKind: 'font-mono text-faint text-[10px] uppercase tracking-[0.15em] shrink-0',
|
|
92
|
+
matchEmpty: 'font-mono text-faint text-[10px] uppercase tracking-[0.15em] px-3 py-3',
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Read live colors from the rendered CSS so theme switches stay in one
|
|
96
|
+
// place: change vars → call sigma.refresh() and node/edge colors update.
|
|
97
|
+
const css = () => {
|
|
98
|
+
const s = getComputedStyle(root);
|
|
99
|
+
return {
|
|
100
|
+
app: s.getPropertyValue('--node-app').trim(),
|
|
101
|
+
lib: s.getPropertyValue('--node-lib').trim(),
|
|
102
|
+
edge: s.getPropertyValue('--edge').trim(),
|
|
103
|
+
edgeFaint: s.getPropertyValue('--edge-faint').trim(),
|
|
104
|
+
accent: s.getPropertyValue('--accent').trim(),
|
|
105
|
+
fg: s.getPropertyValue('--fg').trim(),
|
|
106
|
+
muted: s.getPropertyValue('--muted').trim(),
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
let theme = css();
|
|
111
|
+
|
|
112
|
+
const Graph = window.graphology.Graph || window.graphology;
|
|
113
|
+
const graph = new Graph({ multi: true, type: 'directed' });
|
|
114
|
+
|
|
115
|
+
const colorForNode = (type) => type === 'application' ? theme.app : theme.lib;
|
|
116
|
+
const colorForEdge = (type) => {
|
|
117
|
+
if (type === 'peerDependency') return theme.accent;
|
|
118
|
+
if (type === 'devDependency' || type === 'implicit') return theme.edgeFaint;
|
|
119
|
+
return theme.edge;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// Attribute is named "kind", not "type": sigma reads node.type as its
|
|
123
|
+
// program-class name and bails when it sees "application" / "library".
|
|
124
|
+
for (const n of data.nodes) {
|
|
125
|
+
graph.addNode(n.name, {
|
|
126
|
+
x: n.x,
|
|
127
|
+
y: n.y,
|
|
128
|
+
size: n.size,
|
|
129
|
+
label: n.name,
|
|
130
|
+
kind: n.type,
|
|
131
|
+
path: n.path,
|
|
132
|
+
color: colorForNode(n.type),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
for (const e of data.edges) {
|
|
137
|
+
graph.addEdge(e.source, e.target, {
|
|
138
|
+
color: colorForEdge(e.type),
|
|
139
|
+
depType: e.type,
|
|
140
|
+
size: 1,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Adjacency for tooltip & hover-emphasis.
|
|
145
|
+
const depMap = {}, rdepMap = {};
|
|
146
|
+
for (const n of data.nodes) { depMap[n.name] = []; rdepMap[n.name] = []; }
|
|
147
|
+
for (const e of data.edges) {
|
|
148
|
+
depMap[e.source].push(e.target);
|
|
149
|
+
rdepMap[e.target].push(e.source);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const container = document.getElementById('graph');
|
|
153
|
+
const tooltip = document.getElementById('tooltip');
|
|
154
|
+
const filterInput = document.getElementById('filter');
|
|
155
|
+
const filterCount = document.getElementById('filter-count');
|
|
156
|
+
const filterResults = document.getElementById('filter-results');
|
|
157
|
+
|
|
158
|
+
const renderer = new window.Sigma(graph, container, {
|
|
159
|
+
renderEdgeLabels: false,
|
|
160
|
+
labelColor: { color: theme.fg },
|
|
161
|
+
labelFont: 'system-ui, -apple-system, sans-serif',
|
|
162
|
+
labelSize: 11,
|
|
163
|
+
labelWeight: '500',
|
|
164
|
+
labelDensity: 0.7,
|
|
165
|
+
labelGridCellSize: 80,
|
|
166
|
+
defaultEdgeColor: theme.edge,
|
|
167
|
+
defaultNodeColor: theme.lib,
|
|
168
|
+
defaultEdgeType: 'arrow',
|
|
169
|
+
minCameraRatio: 0.05,
|
|
170
|
+
maxCameraRatio: 8,
|
|
171
|
+
// Suppress sigma's built-in hover label panel. We render our own tooltip,
|
|
172
|
+
// so its empty label box (the small rectangle near the cursor) is noise.
|
|
173
|
+
defaultDrawNodeHover: () => undefined,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// State: hover follows the mouse, focus is sticky (set by clicking a node
|
|
177
|
+
// or selecting a search result), pin keeps the tooltip locked in place.
|
|
178
|
+
let hoveredNode = null;
|
|
179
|
+
let focusedNode = null;
|
|
180
|
+
let pinned = false;
|
|
181
|
+
let filterTerm = '';
|
|
182
|
+
let matches = [];
|
|
183
|
+
let activeMatchIndex = -1;
|
|
184
|
+
|
|
185
|
+
// Legend filter state: each key toggles the visibility of a category.
|
|
186
|
+
// previewCategory is set transiently while hovering a legend row so the
|
|
187
|
+
// user can sneak-peek which lines/nodes belong to that category without
|
|
188
|
+
// committing to a toggle.
|
|
189
|
+
const visible = { app: true, lib: true, prod: true, dev: true, peer: true };
|
|
190
|
+
let previewCategory = null;
|
|
191
|
+
const isNodeCat = (k) => k === 'app' || k === 'lib';
|
|
192
|
+
const isEdgeCat = (k) => k === 'prod' || k === 'dev' || k === 'peer';
|
|
193
|
+
const edgeCategory = (depType) => {
|
|
194
|
+
if (depType === 'peerDependency') return 'peer';
|
|
195
|
+
if (depType === 'devDependency' || depType === 'implicit') return 'dev';
|
|
196
|
+
return 'prod';
|
|
197
|
+
};
|
|
198
|
+
const nodeVisible = (kind) => visible[kind === 'application' ? 'app' : 'lib'];
|
|
199
|
+
|
|
200
|
+
const activeNode = () => focusedNode || hoveredNode;
|
|
201
|
+
|
|
202
|
+
renderer.setSetting('nodeReducer', (node, attrs) => {
|
|
203
|
+
if (!nodeVisible(attrs.kind)) {
|
|
204
|
+
return { ...attrs, hidden: true, label: '' };
|
|
205
|
+
}
|
|
206
|
+
// Legend-row preview takes precedence over normal focus/hover emphasis:
|
|
207
|
+
// hovering a category gives an unambiguous "show me what's in this set".
|
|
208
|
+
if (previewCategory) {
|
|
209
|
+
const nodeCat = attrs.kind === 'application' ? 'app' : 'lib';
|
|
210
|
+
const inPreview = isNodeCat(previewCategory) ? nodeCat === previewCategory : false;
|
|
211
|
+
return {
|
|
212
|
+
...attrs,
|
|
213
|
+
color: inPreview ? attrs.color : theme.edgeFaint,
|
|
214
|
+
label: inPreview ? attrs.label : '',
|
|
215
|
+
zIndex: inPreview ? 1 : 0,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
const active = activeNode();
|
|
219
|
+
const matchedFilter = !filterTerm || node.toLowerCase().includes(filterTerm);
|
|
220
|
+
const isActive = active === node;
|
|
221
|
+
const isRelated = active && (depMap[active]?.includes(node) || rdepMap[active]?.includes(node));
|
|
222
|
+
const dim = (filterTerm && !matchedFilter) || (active && !isActive && !isRelated);
|
|
223
|
+
return {
|
|
224
|
+
...attrs,
|
|
225
|
+
color: isActive ? theme.accent : attrs.color,
|
|
226
|
+
label: dim ? '' : attrs.label,
|
|
227
|
+
zIndex: isActive ? 2 : isRelated ? 1 : 0,
|
|
228
|
+
};
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
renderer.setSetting('edgeReducer', (edge, attrs) => {
|
|
232
|
+
if (!visible[edgeCategory(attrs.depType)]) {
|
|
233
|
+
return { ...attrs, hidden: true };
|
|
234
|
+
}
|
|
235
|
+
const ext = graph.extremities(edge);
|
|
236
|
+
if (!nodeVisible(graph.getNodeAttribute(ext[0], 'kind')) || !nodeVisible(graph.getNodeAttribute(ext[1], 'kind'))) {
|
|
237
|
+
return { ...attrs, hidden: true };
|
|
238
|
+
}
|
|
239
|
+
if (previewCategory) {
|
|
240
|
+
if (isEdgeCat(previewCategory)) {
|
|
241
|
+
const inPreview = edgeCategory(attrs.depType) === previewCategory;
|
|
242
|
+
return { ...attrs, color: inPreview ? theme.accent : theme.edgeFaint, size: inPreview ? 1.5 : 0.3, zIndex: inPreview ? 1 : 0 };
|
|
243
|
+
}
|
|
244
|
+
// Previewing a node category dims every edge — the focus is on the dots.
|
|
245
|
+
return { ...attrs, color: theme.edgeFaint, size: 0.3 };
|
|
246
|
+
}
|
|
247
|
+
const active = activeNode();
|
|
248
|
+
const touchesActive = active && (ext[0] === active || ext[1] === active);
|
|
249
|
+
if (active && !touchesActive) {
|
|
250
|
+
return { ...attrs, color: theme.edgeFaint, hidden: false, size: 0.5 };
|
|
251
|
+
}
|
|
252
|
+
if (touchesActive) {
|
|
253
|
+
return { ...attrs, color: theme.accent, size: 1.5, zIndex: 1 };
|
|
254
|
+
}
|
|
255
|
+
return attrs;
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// Tooltip body assembled with safe DOM methods (createElement +
|
|
259
|
+
// textContent) — no innerHTML, no template strings of user data.
|
|
260
|
+
const MAX_TOOLTIP_ITEMS = 8;
|
|
261
|
+
const setTooltipContent = (name) => {
|
|
262
|
+
const node = graph.getNodeAttributes(name);
|
|
263
|
+
const deps = depMap[name] || [];
|
|
264
|
+
const rdeps = rdepMap[name] || [];
|
|
265
|
+
tooltip.textContent = '';
|
|
266
|
+
|
|
267
|
+
const nameEl = document.createElement('div');
|
|
268
|
+
nameEl.className = CLS.ttlName;
|
|
269
|
+
nameEl.textContent = name;
|
|
270
|
+
tooltip.appendChild(nameEl);
|
|
271
|
+
|
|
272
|
+
const typeEl = document.createElement('div');
|
|
273
|
+
typeEl.className = CLS.ttlType;
|
|
274
|
+
typeEl.textContent = node.kind + (pinned ? ' · pinned' : '');
|
|
275
|
+
tooltip.appendChild(typeEl);
|
|
276
|
+
|
|
277
|
+
if (node.path) {
|
|
278
|
+
const pathEl = document.createElement('div');
|
|
279
|
+
pathEl.className = CLS.ttlPath;
|
|
280
|
+
pathEl.textContent = node.path;
|
|
281
|
+
tooltip.appendChild(pathEl);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const addSection = (label, items) => {
|
|
285
|
+
const heading = document.createElement('div');
|
|
286
|
+
heading.className = CLS.ttlSection;
|
|
287
|
+
heading.textContent = label + ' (' + items.length + ')';
|
|
288
|
+
tooltip.appendChild(heading);
|
|
289
|
+
const ul = document.createElement('ul');
|
|
290
|
+
ul.className = CLS.ttlUl;
|
|
291
|
+
const shown = items.slice(0, MAX_TOOLTIP_ITEMS);
|
|
292
|
+
for (const item of shown) {
|
|
293
|
+
const li = document.createElement('li');
|
|
294
|
+
li.className = CLS.ttlLi;
|
|
295
|
+
li.textContent = item;
|
|
296
|
+
ul.appendChild(li);
|
|
297
|
+
}
|
|
298
|
+
if (items.length > MAX_TOOLTIP_ITEMS) {
|
|
299
|
+
const more = document.createElement('li');
|
|
300
|
+
more.className = CLS.ttlMore;
|
|
301
|
+
more.textContent = (items.length - MAX_TOOLTIP_ITEMS) + ' more';
|
|
302
|
+
ul.appendChild(more);
|
|
303
|
+
}
|
|
304
|
+
tooltip.appendChild(ul);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
if (deps.length) addSection('Depends on', deps);
|
|
308
|
+
if (rdeps.length) addSection('Required by', rdeps);
|
|
309
|
+
if (!deps.length && !rdeps.length) {
|
|
310
|
+
const empty = document.createElement('div');
|
|
311
|
+
empty.className = CLS.ttlEmpty;
|
|
312
|
+
empty.textContent = 'No dependencies';
|
|
313
|
+
tooltip.appendChild(empty);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// Tooltip placement delegated to Floating UI. We build a virtual reference
|
|
318
|
+
// element that either follows the cursor (hover) or anchors to a node's
|
|
319
|
+
// viewport position (pinned), then run computePosition with flip + shift +
|
|
320
|
+
// size middleware so the tooltip always fits the viewport.
|
|
321
|
+
const FUI = window.FloatingUIDOM;
|
|
322
|
+
let lastMouse = null;
|
|
323
|
+
let anchorMode = 'cursor'; // 'cursor' (follows mouse) or 'node' (sticky to node)
|
|
324
|
+
let anchorNode = null;
|
|
325
|
+
let cleanupAutoUpdate = null;
|
|
326
|
+
|
|
327
|
+
const cursorRef = {
|
|
328
|
+
getBoundingClientRect() {
|
|
329
|
+
const x = lastMouse ? lastMouse.clientX : 0;
|
|
330
|
+
const y = lastMouse ? lastMouse.clientY : 0;
|
|
331
|
+
return { width: 0, height: 0, x, y, top: y, left: x, right: x, bottom: y };
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const nodeRef = {
|
|
336
|
+
getBoundingClientRect() {
|
|
337
|
+
if (!anchorNode || !graph.hasNode(anchorNode)) {
|
|
338
|
+
return { width: 0, height: 0, x: 0, y: 0, top: 0, left: 0, right: 0, bottom: 0 };
|
|
339
|
+
}
|
|
340
|
+
const pos = renderer.getNodeDisplayData(anchorNode);
|
|
341
|
+
const vp = renderer.graphToViewport({ x: pos.x, y: pos.y });
|
|
342
|
+
const rect = container.getBoundingClientRect();
|
|
343
|
+
const r = (pos.size || 4) + 4;
|
|
344
|
+
const cx = rect.left + vp.x;
|
|
345
|
+
const cy = rect.top + vp.y;
|
|
346
|
+
return { width: r * 2, height: r * 2, x: cx - r, y: cy - r, top: cy - r, left: cx - r, right: cx + r, bottom: cy + r };
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const updatePosition = async () => {
|
|
351
|
+
if (tooltip.style.display !== 'block') return;
|
|
352
|
+
const ref = anchorMode === 'node' ? nodeRef : cursorRef;
|
|
353
|
+
const { x, y } = await FUI.computePosition(ref, tooltip, {
|
|
354
|
+
placement: 'right-start',
|
|
355
|
+
strategy: 'fixed',
|
|
356
|
+
middleware: [
|
|
357
|
+
FUI.offset(12),
|
|
358
|
+
FUI.flip({ fallbackPlacements: ['left-start', 'right-end', 'left-end', 'top', 'bottom'] }),
|
|
359
|
+
FUI.shift({ padding: 12 }),
|
|
360
|
+
FUI.size({
|
|
361
|
+
padding: 12,
|
|
362
|
+
apply({ availableWidth, availableHeight, elements }) {
|
|
363
|
+
const maxW = Math.min(380, Math.max(220, availableWidth));
|
|
364
|
+
const maxH = Math.max(160, availableHeight);
|
|
365
|
+
Object.assign(elements.floating.style, {
|
|
366
|
+
maxWidth: maxW + 'px',
|
|
367
|
+
maxHeight: maxH + 'px',
|
|
368
|
+
overflowY: 'auto',
|
|
369
|
+
});
|
|
370
|
+
},
|
|
371
|
+
}),
|
|
372
|
+
],
|
|
373
|
+
});
|
|
374
|
+
Object.assign(tooltip.style, { left: x + 'px', top: y + 'px' });
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
const stopAutoUpdate = () => {
|
|
378
|
+
if (cleanupAutoUpdate) { cleanupAutoUpdate(); cleanupAutoUpdate = null; }
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// Auto-update is only used for the node-anchored (pinned) mode, where the
|
|
382
|
+
// reference is stable across events but its viewport position changes when
|
|
383
|
+
// the user pans, zooms, or resizes. In cursor mode we drive recomputation
|
|
384
|
+
// ourselves from the mousemove handler.
|
|
385
|
+
const startAutoUpdate = () => {
|
|
386
|
+
stopAutoUpdate();
|
|
387
|
+
if (anchorMode === 'node') {
|
|
388
|
+
cleanupAutoUpdate = FUI.autoUpdate(nodeRef, tooltip, updatePosition);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const showTooltipFor = (name, mode = 'cursor') => {
|
|
393
|
+
anchorMode = mode;
|
|
394
|
+
anchorNode = mode === 'node' ? name : null;
|
|
395
|
+
setTooltipContent(name);
|
|
396
|
+
tooltip.style.display = 'block';
|
|
397
|
+
startAutoUpdate();
|
|
398
|
+
updatePosition();
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
const hideTooltip = () => {
|
|
402
|
+
stopAutoUpdate();
|
|
403
|
+
tooltip.style.display = 'none';
|
|
404
|
+
tooltip.dataset.pinned = 'false';
|
|
405
|
+
anchorNode = null;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
renderer.on('enterNode', (e) => {
|
|
409
|
+
hoveredNode = e.node;
|
|
410
|
+
if (!pinned) showTooltipFor(e.node, 'cursor');
|
|
411
|
+
renderer.refresh({ skipIndexation: true });
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
renderer.on('leaveNode', () => {
|
|
415
|
+
hoveredNode = null;
|
|
416
|
+
if (!pinned) hideTooltip();
|
|
417
|
+
renderer.refresh({ skipIndexation: true });
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
// Click a node to pin it; the anchor switches from the cursor to the node
|
|
421
|
+
// so the tooltip stays attached even when the mouse moves away.
|
|
422
|
+
renderer.on('clickNode', (e) => {
|
|
423
|
+
focusedNode = e.node;
|
|
424
|
+
pinned = true;
|
|
425
|
+
tooltip.dataset.pinned = 'true';
|
|
426
|
+
showTooltipFor(e.node, 'node');
|
|
427
|
+
renderer.refresh({ skipIndexation: true });
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
renderer.on('clickStage', () => {
|
|
431
|
+
if (pinned || focusedNode) {
|
|
432
|
+
focusedNode = null;
|
|
433
|
+
pinned = false;
|
|
434
|
+
tooltip.dataset.pinned = 'false';
|
|
435
|
+
if (hoveredNode) {
|
|
436
|
+
showTooltipFor(hoveredNode, 'cursor');
|
|
437
|
+
} else {
|
|
438
|
+
hideTooltip();
|
|
439
|
+
}
|
|
440
|
+
renderer.refresh({ skipIndexation: true });
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
let posRafQueued = false;
|
|
445
|
+
container.addEventListener('mousemove', (e) => {
|
|
446
|
+
lastMouse = { clientX: e.clientX, clientY: e.clientY };
|
|
447
|
+
if (anchorMode === 'cursor' && tooltip.style.display === 'block' && !posRafQueued) {
|
|
448
|
+
posRafQueued = true;
|
|
449
|
+
requestAnimationFrame(() => {
|
|
450
|
+
posRafQueued = false;
|
|
451
|
+
updatePosition();
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
const focusOnNode = (name, { pin = true } = {}) => {
|
|
457
|
+
if (!graph.hasNode(name)) return;
|
|
458
|
+
const pos = renderer.getNodeDisplayData(name);
|
|
459
|
+
if (pos) renderer.getCamera().animate({ x: pos.x, y: pos.y, ratio: 0.3 }, { duration: 600 });
|
|
460
|
+
focusedNode = name;
|
|
461
|
+
pinned = pin;
|
|
462
|
+
if (pin) tooltip.dataset.pinned = 'true';
|
|
463
|
+
showTooltipFor(name, pin ? 'node' : 'cursor');
|
|
464
|
+
renderer.refresh({ skipIndexation: true });
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
// ── Search results ───────────────────────────────────────────────────
|
|
468
|
+
const totalNodes = data.nodes.length;
|
|
469
|
+
const renderResults = () => {
|
|
470
|
+
filterResults.textContent = '';
|
|
471
|
+
if (!filterTerm) {
|
|
472
|
+
filterResults.dataset.open = 'false';
|
|
473
|
+
filterCount.textContent = '';
|
|
474
|
+
filterCount.dataset.state = '';
|
|
475
|
+
activeMatchIndex = -1;
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
filterCount.textContent = matches.length + ' / ' + totalNodes;
|
|
479
|
+
filterCount.dataset.state = matches.length === 0 ? 'zero' : '';
|
|
480
|
+
if (matches.length === 0) {
|
|
481
|
+
const empty = document.createElement('div');
|
|
482
|
+
empty.className = CLS.matchEmpty;
|
|
483
|
+
const b = document.createElement('b'); b.textContent = 'No matches'; b.className = 'text-fg';
|
|
484
|
+
empty.appendChild(b);
|
|
485
|
+
empty.appendChild(document.createTextNode(' for "' + filterTerm + '"'));
|
|
486
|
+
filterResults.appendChild(empty);
|
|
487
|
+
filterResults.dataset.open = 'true';
|
|
488
|
+
activeMatchIndex = -1;
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
const limit = Math.min(matches.length, 24);
|
|
492
|
+
for (let i = 0; i < limit; i++) {
|
|
493
|
+
const m = matches[i];
|
|
494
|
+
const row = document.createElement('div');
|
|
495
|
+
row.className = CLS.matchItem;
|
|
496
|
+
row.setAttribute('role', 'option');
|
|
497
|
+
row.dataset.index = String(i);
|
|
498
|
+
if (i === activeMatchIndex) row.setAttribute('aria-selected', 'true');
|
|
499
|
+
|
|
500
|
+
const nameEl = document.createElement('span');
|
|
501
|
+
nameEl.className = CLS.miName;
|
|
502
|
+
const idx = m.name.toLowerCase().indexOf(filterTerm);
|
|
503
|
+
if (idx >= 0) {
|
|
504
|
+
nameEl.appendChild(document.createTextNode(m.name.slice(0, idx)));
|
|
505
|
+
const mark = document.createElement('mark');
|
|
506
|
+
mark.className = CLS.miMark;
|
|
507
|
+
mark.textContent = m.name.slice(idx, idx + filterTerm.length);
|
|
508
|
+
nameEl.appendChild(mark);
|
|
509
|
+
nameEl.appendChild(document.createTextNode(m.name.slice(idx + filterTerm.length)));
|
|
510
|
+
} else {
|
|
511
|
+
nameEl.textContent = m.name;
|
|
512
|
+
}
|
|
513
|
+
row.appendChild(nameEl);
|
|
514
|
+
|
|
515
|
+
const kindEl = document.createElement('span');
|
|
516
|
+
kindEl.className = CLS.miKind;
|
|
517
|
+
kindEl.textContent = m.type === 'application' ? 'app' : 'lib';
|
|
518
|
+
row.appendChild(kindEl);
|
|
519
|
+
|
|
520
|
+
row.addEventListener('mousedown', (ev) => {
|
|
521
|
+
ev.preventDefault();
|
|
522
|
+
focusOnNode(m.name);
|
|
523
|
+
filterResults.dataset.open = 'false';
|
|
524
|
+
});
|
|
525
|
+
filterResults.appendChild(row);
|
|
526
|
+
}
|
|
527
|
+
if (matches.length > limit) {
|
|
528
|
+
const more = document.createElement('div');
|
|
529
|
+
more.className = CLS.matchEmpty;
|
|
530
|
+
more.textContent = '+ ' + (matches.length - limit) + ' more — refine to see';
|
|
531
|
+
filterResults.appendChild(more);
|
|
532
|
+
}
|
|
533
|
+
filterResults.dataset.open = 'true';
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
const recomputeMatches = () => {
|
|
537
|
+
if (!filterTerm) { matches = []; return; }
|
|
538
|
+
matches = [];
|
|
539
|
+
for (const n of data.nodes) {
|
|
540
|
+
if (n.name.toLowerCase().includes(filterTerm)) matches.push(n);
|
|
541
|
+
}
|
|
542
|
+
matches.sort((a, b) => {
|
|
543
|
+
// Apps first, then by closeness of match position, then by name.
|
|
544
|
+
if (a.type !== b.type) return a.type === 'application' ? -1 : 1;
|
|
545
|
+
const ai = a.name.toLowerCase().indexOf(filterTerm);
|
|
546
|
+
const bi = b.name.toLowerCase().indexOf(filterTerm);
|
|
547
|
+
if (ai !== bi) return ai - bi;
|
|
548
|
+
return a.name.localeCompare(b.name);
|
|
549
|
+
});
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
let rafQueued = false;
|
|
553
|
+
filterInput.addEventListener('input', () => {
|
|
554
|
+
filterTerm = filterInput.value.toLowerCase().trim();
|
|
555
|
+
recomputeMatches();
|
|
556
|
+
activeMatchIndex = matches.length ? 0 : -1;
|
|
557
|
+
renderResults();
|
|
558
|
+
if (!rafQueued) {
|
|
559
|
+
rafQueued = true;
|
|
560
|
+
requestAnimationFrame(() => {
|
|
561
|
+
rafQueued = false;
|
|
562
|
+
renderer.refresh({ skipIndexation: true });
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
filterInput.addEventListener('focus', () => {
|
|
568
|
+
if (filterTerm) filterResults.dataset.open = 'true';
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
document.addEventListener('mousedown', (e) => {
|
|
572
|
+
if (!filterResults.contains(e.target) && e.target !== filterInput) {
|
|
573
|
+
filterResults.dataset.open = 'false';
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
filterInput.addEventListener('keydown', (e) => {
|
|
578
|
+
if (e.key === 'ArrowDown') {
|
|
579
|
+
if (matches.length) {
|
|
580
|
+
e.preventDefault();
|
|
581
|
+
activeMatchIndex = (activeMatchIndex + 1) % matches.length;
|
|
582
|
+
renderResults();
|
|
583
|
+
}
|
|
584
|
+
} else if (e.key === 'ArrowUp') {
|
|
585
|
+
if (matches.length) {
|
|
586
|
+
e.preventDefault();
|
|
587
|
+
activeMatchIndex = (activeMatchIndex - 1 + matches.length) % matches.length;
|
|
588
|
+
renderResults();
|
|
589
|
+
}
|
|
590
|
+
} else if (e.key === 'Enter') {
|
|
591
|
+
if (matches.length && activeMatchIndex >= 0) {
|
|
592
|
+
e.preventDefault();
|
|
593
|
+
focusOnNode(matches[activeMatchIndex].name);
|
|
594
|
+
filterResults.dataset.open = 'false';
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
// ── Legend / category filter ─────────────────────────────────────────
|
|
600
|
+
const legend = document.getElementById('legend');
|
|
601
|
+
const toggleCategory = (key) => {
|
|
602
|
+
if (!(key in visible)) return;
|
|
603
|
+
visible[key] = !visible[key];
|
|
604
|
+
const row = legend?.querySelector('[data-toggle="' + key + '"]');
|
|
605
|
+
if (row) {
|
|
606
|
+
row.dataset.state = visible[key] ? 'on' : 'off';
|
|
607
|
+
row.setAttribute('aria-checked', String(visible[key]));
|
|
608
|
+
}
|
|
609
|
+
renderer.refresh({ skipIndexation: true });
|
|
610
|
+
};
|
|
611
|
+
let previewRafQueued = false;
|
|
612
|
+
const queuePreviewRefresh = () => {
|
|
613
|
+
if (previewRafQueued) return;
|
|
614
|
+
previewRafQueued = true;
|
|
615
|
+
requestAnimationFrame(() => {
|
|
616
|
+
previewRafQueued = false;
|
|
617
|
+
renderer.refresh({ skipIndexation: true });
|
|
618
|
+
});
|
|
619
|
+
};
|
|
620
|
+
legend?.querySelectorAll('[data-toggle]').forEach((row) => {
|
|
621
|
+
row.addEventListener('click', () => toggleCategory(row.dataset.toggle));
|
|
622
|
+
row.addEventListener('mouseenter', () => {
|
|
623
|
+
previewCategory = row.dataset.toggle;
|
|
624
|
+
queuePreviewRefresh();
|
|
625
|
+
});
|
|
626
|
+
row.addEventListener('mouseleave', () => {
|
|
627
|
+
previewCategory = null;
|
|
628
|
+
queuePreviewRefresh();
|
|
629
|
+
});
|
|
630
|
+
row.addEventListener('focus', () => {
|
|
631
|
+
previewCategory = row.dataset.toggle;
|
|
632
|
+
queuePreviewRefresh();
|
|
633
|
+
});
|
|
634
|
+
row.addEventListener('blur', () => {
|
|
635
|
+
previewCategory = null;
|
|
636
|
+
queuePreviewRefresh();
|
|
637
|
+
});
|
|
638
|
+
row.addEventListener('keydown', (e) => {
|
|
639
|
+
if (e.key === ' ' || e.key === 'Enter') {
|
|
640
|
+
e.preventDefault();
|
|
641
|
+
toggleCategory(row.dataset.toggle);
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
// ── Camera controls ──────────────────────────────────────────────────
|
|
647
|
+
const resetView = () => {
|
|
648
|
+
renderer.getCamera().animatedReset({ duration: 600 });
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
const applyTheme = () => {
|
|
652
|
+
theme = css();
|
|
653
|
+
graph.forEachNode((node, attrs) => {
|
|
654
|
+
graph.setNodeAttribute(node, 'color', colorForNode(attrs.kind));
|
|
655
|
+
});
|
|
656
|
+
graph.forEachEdge((edge, attrs) => {
|
|
657
|
+
graph.setEdgeAttribute(edge, 'color', colorForEdge(attrs.depType));
|
|
658
|
+
});
|
|
659
|
+
renderer.setSetting('labelColor', { color: theme.fg });
|
|
660
|
+
renderer.setSetting('defaultEdgeColor', theme.edge);
|
|
661
|
+
renderer.setSetting('defaultNodeColor', theme.lib);
|
|
662
|
+
renderer.refresh();
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
themeBtn?.addEventListener('click', () => {
|
|
666
|
+
const isDark = root.dataset.theme ? root.dataset.theme === 'dark' : mql.matches;
|
|
667
|
+
const next = isDark ? 'light' : 'dark';
|
|
668
|
+
root.dataset.theme = next;
|
|
669
|
+
try { localStorage.setItem('vis-graph-theme', next); } catch {}
|
|
670
|
+
applyTheme();
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
mql.addEventListener('change', () => {
|
|
674
|
+
if (!root.dataset.theme) applyTheme();
|
|
675
|
+
});
|
|
676
|
+
|
|
677
|
+
// Keyboard shortcuts: '/' focuses search, 'R' fits view, Esc clears + unpins.
|
|
678
|
+
window.addEventListener('keydown', (e) => {
|
|
679
|
+
const inField = document.activeElement === filterInput;
|
|
680
|
+
if (e.key === '/' && !inField) {
|
|
681
|
+
e.preventDefault();
|
|
682
|
+
filterInput.focus();
|
|
683
|
+
filterInput.select();
|
|
684
|
+
} else if ((e.key === 'r' || e.key === 'R') && !inField) {
|
|
685
|
+
e.preventDefault();
|
|
686
|
+
resetView();
|
|
687
|
+
} else if (e.key === 'Escape') {
|
|
688
|
+
if (inField) {
|
|
689
|
+
filterInput.value = '';
|
|
690
|
+
filterTerm = '';
|
|
691
|
+
matches = [];
|
|
692
|
+
renderResults();
|
|
693
|
+
renderer.refresh({ skipIndexation: true });
|
|
694
|
+
filterInput.blur();
|
|
695
|
+
} else if (pinned || focusedNode) {
|
|
696
|
+
focusedNode = null;
|
|
697
|
+
pinned = false;
|
|
698
|
+
tooltip.dataset.pinned = 'false';
|
|
699
|
+
if (!hoveredNode) hideTooltip();
|
|
700
|
+
renderer.refresh({ skipIndexation: true });
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
})();
|
|
705
|
+
<\/script>
|
|
706
|
+
</body>
|
|
707
|
+
</html>`},Ae={application:0,library:3,service:1,tool:2},B=n=>Ae[n]??Number.MAX_SAFE_INTEGER,Re=n=>{const t=new Map;for(const[a,i]of Object.entries(n.dependencies))for(const l of i){const o=t.get(l.target)??[];o.push(a),t.set(l.target,o)}return Object.values(n.nodes).map(a=>({deps:n.dependencies[a.name]??[],name:a.name,reverseDeps:t.get(a.name)??[],type:a.type})).sort((a,i)=>a.type!==i.type?B(a.type)-B(i.type):a.name.localeCompare(i.name))},ze=(n,t,a)=>{let i=n;if(t==="app"?i=i.filter(l=>l.type==="application"):t==="lib"&&(i=i.filter(l=>l.type!=="application")),a){const l=a.toLowerCase();i=i.filter(o=>o.name.toLowerCase().includes(l))}return i};class Fe{#e;#r=new Set;#a;constructor(t){this.#a=t;const a=Re(t);this.#e={allNodes:a,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=t=>(this.#r.add(t),()=>{this.#r.delete(t)});getFilteredNodes(){return ze(this.#e.allNodes,this.#e.filterType,this.#e.filterText)}getStats(){const t=this.#e.allNodes.filter(l=>l.type==="application").length,a=this.#e.allNodes.length,i=Object.values(this.#a.dependencies).reduce((l,o)=>l+o.length,0);return{apps:t,deps:i,libs:a-t,total:a}}setSelectedIndex(t){const a=this.getFilteredNodes(),i=a.length===0?-1:Math.max(0,Math.min(t,a.length-1));i!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:i})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:t})}setFilterType(t){t!==this.#e.filterType&&this.#t({...this.#e,filterType:t,selectedIndex:0})}setFilter(t){this.#t({...this.#e,filterText:t,selectedIndex:0})}setFilterActive(t){t!==this.#e.filterActive&&this.#t({...this.#e,filterActive:t,filterText:t?this.#e.filterText:"",selectedIndex:t?this.#e.selectedIndex:0})}#t(t){this.#e=t;for(const a of this.#r)try{a()}catch{}}}const Le=({focused:n,node:t,scrollRef:a})=>{const i=n?"white":"gray";if(!t)return e.jsx(s,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:e.jsx(r,{dimColor:!0,children:"No project selected"})});const l=t.type==="application",o=l?"yellow":"cyan",f=l?"Application":"Library";return e.jsx(s,{borderColor:i,borderStyle:"single",borderTopRightTitle:` ${f} `,borderTopTitle:` ${t.name} `,flexDirection:"column",flexGrow:1,children:e.jsxs(te,{flexGrow:1,flexShrink:1,paddingX:2,ref:a,scrollbar:!0,scrollbarColor:"gray",children:[e.jsxs(s,{flexDirection:"column",marginTop:1,children:[e.jsxs(s,{children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"DEPENDS ON"}),e.jsxs(r,{dimColor:!0,children:[" ","(",t.deps.length,")"]})]}),t.deps.length===0?e.jsx(s,{marginTop:1,paddingLeft:2,children:e.jsx(r,{dimColor:!0,children:"No dependencies"})}):e.jsx(s,{flexDirection:"column",marginTop:1,children:t.deps.map(d=>e.jsxs(s,{gap:1,paddingLeft:2,children:[e.jsx(r,{color:"cyan",children:"→"}),e.jsx(r,{children:d.target}),d.type!=="static"&&e.jsxs(r,{dimColor:!0,children:["(",d.type,")"]})]},d.target))})]}),e.jsxs(s,{flexDirection:"column",marginTop:1,children:[e.jsxs(s,{children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"REQUIRED BY"}),e.jsxs(r,{dimColor:!0,children:[" ","(",t.reverseDeps.length,")"]})]}),t.reverseDeps.length===0?e.jsx(s,{marginTop:1,paddingLeft:2,children:e.jsx(r,{dimColor:!0,children:"No reverse dependencies"})}):e.jsx(s,{flexDirection:"column",marginTop:1,children:t.reverseDeps.map(d=>e.jsxs(s,{gap:1,paddingLeft:2,children:[e.jsx(r,{color:"magenta",children:"←"}),e.jsx(r,{children:d})]},d))})]}),e.jsxs(s,{flexDirection:"column",marginTop:1,children:[e.jsxs(s,{children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"INFO"})]}),e.jsxs(s,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[e.jsxs(s,{children:[e.jsx(s,{width:16,children:e.jsx(r,{dimColor:!0,children:"Type:"})}),e.jsx(r,{color:o,children:f})]}),e.jsxs(s,{children:[e.jsx(s,{width:16,children:e.jsx(r,{dimColor:!0,children:"Dependencies:"})}),e.jsx(r,{children:String(t.deps.length)})]}),e.jsxs(s,{children:[e.jsx(s,{width:16,children:e.jsx(r,{dimColor:!0,children:"Required by:"})}),e.jsx(r,{children:String(t.reverseDeps.length)})]}),e.jsxs(s,{children:[e.jsx(s,{width:16,children:e.jsx(r,{dimColor:!0,children:"Connectivity:"})}),e.jsx(r,{children:String(t.deps.length+t.reverseDeps.length)})]})]})]})]})})},$e=[{key:"all",label:"All",shortcut:"1"},{key:"app",label:"Apps",shortcut:"2"},{key:"lib",label:"Libs",shortcut:"3"}],U=({isSelected:n,node:t})=>{const a=t.type==="application",i=a?"yellow":"cyan",l=a?"app":"lib";return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsxs(r,{children:[n?"▶":" "," "]}),e.jsx(s,{flexGrow:1,children:e.jsx(r,{bold:n,inverse:n,wrap:"truncate",children:t.name})}),e.jsxs(r,{color:i,children:[" ",l]}),e.jsxs(r,{dimColor:!0,children:[" ","→",t.deps.length," ","←",t.reverseDeps.length]})]})},q=({count:n,label:t})=>e.jsxs(s,{flexShrink:0,height:1,marginTop:1,children:[e.jsxs(r,{dimColor:!0,children:["▼"," "]}),e.jsx(r,{bold:!0,color:"white",children:t.toUpperCase()}),e.jsxs(r,{dimColor:!0,children:[" ","(",n,")"]})]}),De=({filterActive:n,filterText:t,filterType:a,focused:i,nodes:l,scrollOffset:o,selectedIndex:f,stats:d,viewportHeight:u})=>{const p=i?"white":"gray",x=l.filter(w=>w.type==="application"),h=l.filter(w=>w.type!=="application"),b=[];let g=0;if(x.length>0){b.push(e.jsx(q,{count:x.length,label:"Applications"},"hdr-apps"));for(const w of x){const k=g;b.push(e.jsx(U,{isSelected:k===f,node:w},w.name)),g++}}if(h.length>0){b.push(e.jsx(q,{count:h.length,label:"Libraries"},"hdr-libs"));for(const w of h){const k=g;b.push(e.jsx(U,{isSelected:k===f,node:w},w.name)),g++}}let y=0;x.length>0&&(y+=2+x.length),h.length>0&&(y+=2+h.length);const T=y>u&&u>0;return e.jsxs(s,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[d.total," ","packages"]}),e.jsxs(r,{dimColor:!0,children:["(",d.apps," ","apps,"," ",d.libs," ","libs,"," ",d.deps," ","deps)"]})]}),e.jsx(s,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:$e.map(w=>{const k=a===w.key;return e.jsxs(s,{children:[e.jsx(r,{dimColor:!k,children:"["}),e.jsx(r,{bold:k,color:k?"cyan":"gray",children:w.shortcut}),e.jsx(r,{dimColor:!k,children:"]"}),e.jsxs(r,{color:k?"white":"gray",children:[" ",w.label]})]},w.key)})}),n&&e.jsxs(s,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/ "}),e.jsx(r,{children:t}),e.jsx(r,{inverse:!0,children:" "})]}),e.jsxs(s,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[e.jsx(s,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(s,{flexDirection:"column",marginTop:-o,children:b})}),T&&e.jsx(s,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(re,{contentHeight:y,placement:"inset",scrollOffset:o,style:"block",viewportHeight:u})})]})]})},Oe=100,Pe=40,_e=10,G={1:"all",2:"app",3:"lib"},Be=({autoExitSeconds:n=0,store:t})=>{const{exit:a}=ae(),{columns:i,rows:l}=ne(),o=j.useSyncExternalStore(t.subscribe,t.getSnapshot),[f,d]=j.useState(!1),u=j.useRef(null),p=j.useRef(null),[x,h]=j.useState(0),[b,g]=j.useState(!1),y=j.useMemo(()=>t.getFilteredNodes(),[o.allNodes,o.filterType,o.filterText]),T=j.useMemo(()=>t.getStats(),[o.allNodes]),w=y[o.selectedIndex]??null,k=j.useMemo(()=>{let m=0,c=0;for(const v of y)v.type==="application"?m+=1:c+=1;return{appsCount:m,libsCount:c}},[y]),z=j.useCallback(m=>{const{appsCount:c,libsCount:v}=k;if(m<c)return(c>0?2:0)+m;const Y=c>0?2+c:0,J=v>0?2:0;return Y+J+(m-c)},[k]),M=Math.max(1,l-8-(o.filterActive?1:0)),N=j.useCallback(m=>{const c=z(m);h(v=>c>v+M-2?Math.max(0,c-M+2):c<v+1?Math.max(0,c-1):v)},[z,M]);if(j.useEffect(()=>{p.current?.scrollToTop()},[w?.name]),ie((m,c)=>{if(m==="c"&&c.ctrl){a();return}if(!b){if(f){c.escape||m==="?"?d(!1):m==="q"?(d(!1),g(!0)):c.downArrow||m==="j"?u.current?.scrollBy(1):(c.upArrow||m==="k")&&u.current?.scrollBy(-1);return}if(m==="?"){d(!0);return}if(m==="q"){g(!0);return}if(c.tab){t.setFocusedPanel(o.focusedPanel==="list"?"detail":"list");return}if(G[m]){t.setFilterType(G[m]);return}if(o.filterActive){if(c.escape){t.setFilterActive(!1);return}if(c.return){t.setFilterActive(!1);return}if(c.backspace){t.setFilter(o.filterText.slice(0,-1));return}if(m&&!c.ctrl&&!c.meta){t.setFilter(o.filterText+m);return}return}if(o.focusedPanel==="list"){if(y.length===0){m==="/"&&t.setFilterActive(!0);return}if(c.downArrow||m==="j"){const v=Math.min(o.selectedIndex+1,y.length-1);t.setSelectedIndex(v),N(v);return}if(c.upArrow||m==="k"){const v=Math.max(o.selectedIndex-1,0);t.setSelectedIndex(v),N(v);return}if(c.pageDown){const v=Math.min(o.selectedIndex+10,y.length-1);t.setSelectedIndex(v),N(v);return}if(c.pageUp){const v=Math.max(o.selectedIndex-10,0);t.setSelectedIndex(v),N(v);return}if(c.home){t.setSelectedIndex(0),h(0);return}if(c.end){const v=y.length-1;t.setSelectedIndex(v),N(v);return}if(m==="/"){t.setFilterActive(!0);return}if(c.rightArrow){t.setFocusedPanel("detail");return}return}if(o.focusedPanel==="detail"){if(c.escape||c.leftArrow){t.setFocusedPanel("list");return}if(c.downArrow||m==="j"){p.current?.scrollBy(1);return}if(c.upArrow||m==="k"){p.current?.scrollBy(-1);return}if(c.pageDown){p.current?.scrollBy(10);return}if(c.pageUp){p.current?.scrollBy(-10);return}if(c.home){p.current?.scrollToTop();return}c.end&&p.current?.scrollToBottom()}}},{isActive:!0}),i<Pe||l<_e)return e.jsx(s,{alignItems:"center",height:l,justifyContent:"center",width:i,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",i,"x",l,")"]})});const X=i>=Oe,F=e.jsx(s,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:e.jsxs(s,{flexWrap:"wrap",gap:2,paddingX:1,children:[e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]},"nav"),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"1-3 /"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]},"f"),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]},"t")]})}),L=e.jsxs(oe,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:u,title:"KEYBOARD SHORTCUTS",visible:f,width:52,children:[e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(s,{children:[e.jsx(s,{width:24,children:e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↑","/k"]}),e.jsx(r,{dimColor:!0,children:" Move up"})]})}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↓","/j"]}),e.jsx(r,{dimColor:!0,children:" Move down"})]})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Tab"]}),e.jsx(r,{dimColor:!0,children:" Switch panel"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","→","/","←"]}),e.jsx(r,{dimColor:!0,children:" Focus detail/list"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","PgUp/PgDn"]}),e.jsx(r,{dimColor:!0,children:" Jump 10 items"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Home/End"]}),e.jsx(r,{dimColor:!0,children:" Jump to start/end"})]})]}),e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FILTERS"})]}),e.jsxs(s,{children:[e.jsx(s,{width:24,children:e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","1"]}),e.jsx(r,{dimColor:!0,children:" All"})]})}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","2"]}),e.jsx(r,{dimColor:!0,children:" Apps only"})]})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","3"]}),e.jsx(r,{dimColor:!0,children:" Libraries only"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","/"]}),e.jsx(r,{dimColor:!0,children:" Text filter"})]})]}),e.jsxs(s,{flexDirection:"column",children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","q"]}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","?"]}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),$=e.jsx(De,{filterActive:o.filterActive,filterText:o.filterText,filterType:o.filterType,focused:o.focusedPanel==="list",nodes:y,scrollOffset:x,selectedIndex:o.selectedIndex,stats:T,viewportHeight:M}),D=e.jsx(Le,{focused:o.focusedPanel==="detail",node:w,scrollRef:p});if(X){const m=Math.floor(i*.35);return e.jsxs(s,{flexDirection:"column",height:l,width:i,children:[e.jsxs(s,{flexDirection:"row",flexGrow:1,children:[e.jsx(s,{flexGrow:1,children:$}),e.jsx(s,{width:m,children:D})]}),F,e.jsx(P,{autoExitSeconds:n??3,onCancel:()=>{g(!1)},visible:b}),L]})}const W=Math.floor(l*.55);return e.jsxs(s,{flexDirection:"column",height:l,width:i,children:[e.jsx(s,{height:W,children:$}),e.jsx(s,{flexGrow:1,children:D}),F,e.jsx(P,{autoExitSeconds:n??3,onCancel:()=>{g(!1)},visible:b}),L]})},Q=(n,t,a,i,l,o,f,d)=>{const u=a?C("└── "):C("├── "),p=l.has(n),x=p?C(" (*)"):"",h=i.get(n),b=h?.type==="application"?S(n):n;if(o.push(`${t}${u}${b}${x}`),p)return;l.add(n);const g=h?.deps??[],y=a?`${t} `:`${t}${C("│")} `;if(d>=f&&g.length>0){o.push(`${y}${C(`... ${g.length} more`)}`);return}for(let T=0;T<g.length;T++){const w=g[T];w&&Q(w.target,y,T===g.length-1,i,l,o,f,d+1)}},H=(n,t,a,i,l,o)=>{const f=t.get(n),d=f?.type==="application"?S(n):n;i.push(`${o}${d}`),a.add(n);const u=f?.deps??[];if(u.length===0){i.push(`${o} ${C("(no dependencies)")}`);return}if(l<=0){i.push(`${o} ${C(`... ${u.length} dependencies`)}`);return}for(let p=0;p<u.length;p++){const x=u[p];x&&Q(x.target,o,p===u.length-1,t,a,i,l,1)}},V=(n,t)=>{const a=new Map;for(const[h,b]of Object.entries(n.nodes))a.set(h,{deps:(n.dependencies[h]??[]).map(g=>({target:g.target,type:g.type})),name:h,type:b.type});const i=[],l=[];for(const[h,b]of a)b.type==="application"?i.push(h):l.push(h);i.sort(),l.sort();const o=i.length+l.length,f=Object.values(n.dependencies).reduce((h,b)=>h+b.length,0),d=[S("Project Dependency Graph"),""];if(i.length>0){d.push(` ${S(O(`Applications (${i.length})`))}`,"");for(const h of i)H(h,a,new Set,d,t," "),d.push("")}if(l.length>0){d.push(` ${S(O(`Libraries (${l.length})`))}`,"");for(const h of l)H(h,a,new Set,d,t," "),d.push("")}const u=process.stdout.columns||80;d.push(C("─".repeat(Math.min(u,60)))),d.push(`${S(String(o))} packages ${C("·")} ${S(String(f))} dependencies ${C("·")} ${S(String(i.length))} apps${C(",")} ${S(String(l.length))} libraries`);const p=new Set;let x=!1;for(const h of[...i,...l]){const b=a.get(h)?.deps??[];for(const g of b)p.has(g.target)&&(x=!0),p.add(g.target);p.add(h)}return x&&d.push(C("(*) = already shown above")),d.join(`
|
|
708
|
+
`)},Ue=n=>{const t=Object.values(n.nodes).map(a=>({name:a.name,type:a.type}));return{edges:Object.values(n.dependencies).flat(),nodes:t}},qe=n=>{const t=Object.values(n.nodes).map(i=>({name:i.name,path:i.data?.root,type:i.type})),a=[];for(const i of Object.values(n.dependencies))for(const l of i)a.push({source:l.source,target:l.target,type:l.type});return Me({edges:a,nodes:t,tool:{name:"vis-graph",version:"alpha"},workspaceRoot:process.cwd()})},Je=async({fs:n,logger:t,options:a,visConfig:i,workspaceRoot:l})=>{if(!l)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const o=l,{packageJsons:f,workspace:d}=se(o,i),u=le(o,d,f),p=!!process.stdout.isTTY&&!pe,x=a.format??(p?"tui":"ascii"),h=a.output,b=a.depth??1/0;let g;switch(x){case"dot":{g=ee(u);break}case"html":{g=qe(u);break}case"json":{g=JSON.stringify(Ue(u),void 0,2);break}case"tui":{if(!p){g=V(u,b);break}const y=i?.tui?.autoExit===!0?3:typeof i?.tui?.autoExit=="number"?i.tui.autoExit:0;process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const T=setInterval(()=>{},1e3),w=new Fe(u);await ce(de.createElement(Be,{autoExitSeconds:y,store:w}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(T);return}default:g=V(u,b)}h?(await n.writeFile(h,g,"utf8"),t.info(`Graph written to ${h}`)):t.info(g)};export{Je as default};
|