@visulima/vis 1.0.0-alpha.40 → 1.0.0-alpha.42
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 +41 -0
- package/LICENSE.md +265 -35
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/config/index.d.ts +19 -1
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/cli-exec.js +1 -0
- package/dist/packem_chunks/{bin.js → cli-main.js} +282 -274
- package/dist/packem_chunks/config.js +8 -11
- package/dist/packem_chunks/devtools.js +1 -78
- package/dist/packem_chunks/dispatch.js +4 -0
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +3 -3
- 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/handler2.js +1 -4
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +5 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -5
- package/dist/packem_chunks/handler27.js +5 -1
- package/dist/packem_chunks/handler28.js +1 -3
- package/dist/packem_chunks/handler29.js +3 -1
- package/dist/packem_chunks/handler3.js +1 -4
- package/dist/packem_chunks/handler30.js +1 -2
- package/dist/packem_chunks/handler31.js +1 -2
- package/dist/packem_chunks/handler32.js +2 -2
- package/dist/packem_chunks/handler33.js +2 -3
- package/dist/packem_chunks/handler34.js +2 -6
- package/dist/packem_chunks/handler35.js +3 -1
- package/dist/packem_chunks/handler36.js +6 -42
- package/dist/packem_chunks/handler37.js +1 -8
- package/dist/packem_chunks/handler38.js +42 -9
- package/dist/packem_chunks/handler39.js +7 -74
- package/dist/packem_chunks/handler4.js +4 -6
- package/dist/packem_chunks/handler40.js +9 -5
- package/dist/packem_chunks/handler41.js +75 -4
- package/dist/packem_chunks/handler42.js +5 -3
- package/dist/packem_chunks/handler43.js +4 -2
- package/dist/packem_chunks/handler44.js +3 -1
- package/dist/packem_chunks/handler45.js +2 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -3
- package/dist/packem_chunks/handler48.js +1 -1
- package/dist/packem_chunks/handler49.js +3 -7
- package/dist/packem_chunks/handler5.js +4 -8
- package/dist/packem_chunks/handler50.js +1 -33
- package/dist/packem_chunks/handler51.js +7 -3
- package/dist/packem_chunks/handler52.js +33 -8
- package/dist/packem_chunks/handler53.js +3 -4
- package/dist/packem_chunks/handler54.js +8 -1
- package/dist/packem_chunks/handler55.js +4 -12
- package/dist/packem_chunks/handler56.js +1 -7
- package/dist/packem_chunks/handler57.js +12 -5
- package/dist/packem_chunks/handler58.js +5 -11
- package/dist/packem_chunks/handler59.js +11 -3
- package/dist/packem_chunks/handler6.js +6 -1
- 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 +8 -23
- 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/handler7.js +8 -1
- package/dist/packem_chunks/handler70.js +24 -322
- package/dist/packem_chunks/handler71.js +322 -48
- package/dist/packem_chunks/handler72.js +700 -19
- package/dist/packem_chunks/handler73.js +48 -3
- package/dist/packem_chunks/handler74.js +21 -184
- package/dist/packem_chunks/handler75.js +3 -38
- package/dist/packem_chunks/handler76.js +190 -0
- package/dist/packem_chunks/handler77.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/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +4 -4
- package/dist/packem_chunks/index2.js +1 -1
- package/dist/packem_chunks/index3.js +135 -0
- package/dist/packem_chunks/index4.js +74 -0
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +4 -0
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/orchestrator.js +3 -3
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/registry.js +2 -2
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/shell-runner.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tar.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +2 -0
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +2 -2
- package/dist/packem_shared/CONFIG_FILES-MsOntfYT.js +1 -0
- package/dist/packem_shared/{Table-CcVkyULl-B_ef6zfS.js → Table-CcVkyULl-DLWu6XHL.js} +25 -26
- package/dist/packem_shared/{advisories-DLeO5KMN.js → advisories-aiDtubZQ.js} +1 -1
- package/dist/packem_shared/{affected-shas-cVnX8-zs.js → affected-shas-C1XuRlvo.js} +1 -1
- package/dist/packem_shared/{ai-analysis-BUeX2J2H.js → ai-analysis-CubpCxZJ.js} +4 -4
- package/dist/packem_shared/{ai-fix-9Vzlp6XU.js → ai-fix-Btd5AnSr.js} +2 -2
- package/dist/packem_shared/augment-8fIWWGSc.js +3 -0
- package/dist/packem_shared/bin-CnDBuLh3.js +2 -0
- package/dist/packem_shared/build-scripts-Doxce2VM.js +1 -0
- package/dist/packem_shared/command-runtime-RiCMa2C8.js +1 -0
- package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
- package/dist/packem_shared/{cyclonedx-kYozDyxp.js → cyclonedx-NUJ9R2GQ.js} +1 -1
- package/dist/packem_shared/dependency-scan-B0HV_qeB.js +1 -0
- package/dist/packem_shared/{docker-BMLrNtWm.js → docker-DKlF-gk3.js} +1 -1
- package/dist/packem_shared/failure-log-C7r6UZLP.js +2 -0
- package/dist/packem_shared/{giget-DHY1sQZC.js → giget-DVTFJlbR.js} +2 -2
- package/dist/packem_shared/glob-fqg4KepW-7Bs2kZuM.js +1 -0
- package/dist/packem_shared/index-BKFEWXU_.js +1 -0
- package/dist/packem_shared/index-CPhv-r4c.js +28 -0
- package/dist/packem_shared/{index-CgcF6_wo.js → index-Cb4x6lWY.js} +1 -1
- package/dist/packem_shared/index-DjTWo3sH.js +1 -0
- package/dist/packem_shared/{index-BDmTbWX1.js → index-OQZQyN5R.js} +1 -1
- package/dist/packem_shared/index.server-J83sowC4.js +2 -0
- package/dist/packem_shared/{lifecycle-4z9hHE5b.js → lifecycle-D5roTh0a.js} +2 -2
- package/dist/packem_shared/{lockfile-C8Q1_4KK.js → lockfile-DIGyLfmF.js} +1 -1
- package/dist/packem_shared/main-B3juSU5z.js +1 -0
- package/dist/packem_shared/manifests-pLwnVmCN.js +1 -0
- package/dist/packem_shared/{min-release-age-D1alDE3K.js → min-release-age-pUAqTiv3.js} +3 -3
- package/dist/packem_shared/missing-package-json-DhYzuKhD.js +1 -0
- package/dist/packem_shared/{native-config-sync-BEkJW7g3.js → native-config-sync-4K9wWTj5.js} +1 -1
- package/dist/packem_shared/{osv-bloom-B03tUWf3.js → osv-bloom-OuTfu_LE.js} +1 -1
- package/dist/packem_shared/{pm-runner-OGResYrA.js → pm-runner-Dws_Bw1y.js} +1 -1
- package/dist/packem_shared/provenance-C0P-UYOM.js +1 -0
- package/dist/packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js +4 -0
- package/dist/packem_shared/registry-keys-D4chF-Wj.js +1 -0
- package/dist/packem_shared/{resolve-explicit-CMDl55Nz.js → resolve-explicit-Cgheka3B.js} +3 -3
- package/dist/packem_shared/resolve-runtime-CJSWV-K8.js +1 -0
- package/dist/packem_shared/run-file-B4TqKa0X.js +1 -0
- package/dist/packem_shared/runtime-check-0lUJvgKt.js +1 -0
- package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
- package/dist/packem_shared/s1ngularity-Du1NnSFP.js +1 -0
- package/dist/packem_shared/scan-progress-CN9ONR0y.js +2 -0
- package/dist/packem_shared/{selectors-GCJIe342.js → selectors-UmnAuc26.js} +1 -1
- package/dist/packem_shared/{signatures-C730vkyK.js → signatures-BOUhghTv.js} +1 -1
- package/dist/packem_shared/{spinner-CV3WVJLv.js → spinner-lhXugSx3.js} +1 -1
- package/dist/packem_shared/tabs-DTiU3usb.js +1 -0
- package/dist/packem_shared/target-options-ChWcK60i.js +1 -0
- package/dist/packem_shared/toolchain-DyCKnGch.js +5 -0
- package/dist/packem_shared/typosquats-DBOvXwph.js +1 -0
- package/dist/packem_shared/use-measured-height-CK2Co3XI.js +1 -0
- package/dist/packem_shared/verify-CVPYlUrF.js +1 -0
- package/dist/packem_shared/vis-update-app-DtHkwBca.js +1 -0
- package/dist/packem_shared/watch-Bkp_AAbc.js +1 -0
- package/dist/packem_shared/watch-loop-D9zbXzRd.js +11 -0
- package/dist/runtime/preload.d.ts +1 -0
- package/dist/runtime/preload.js +1 -0
- package/index.d.ts +14 -0
- package/index.js +28 -27
- package/package.json +18 -27
- package/schemas/vis-config.schema.json +12 -0
- package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +0 -1
- package/dist/packem_shared/build-scripts-CCCi8U66.js +0 -1
- package/dist/packem_shared/dependency-scan-DnTgYleU.js +0 -1
- package/dist/packem_shared/failure-log-CEWP3bP0.js +0 -2
- package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +0 -1
- package/dist/packem_shared/index-Du8RWawQ.js +0 -1
- package/dist/packem_shared/index-yBikBkHT.js +0 -30
- package/dist/packem_shared/manifests-Dj3pRKBT.js +0 -1
- package/dist/packem_shared/missing-package-json-8vNHwbqw.js +0 -1
- package/dist/packem_shared/provenance-_CJjMKwu.js +0 -1
- package/dist/packem_shared/registry-keys-BfFto6vI.js +0 -1
- package/dist/packem_shared/runtime-check-Stc9AI78.js +0 -1
- package/dist/packem_shared/s1ngularity-Dhr3bPk0.js +0 -1
- package/dist/packem_shared/scan-progress-CFhc0CMj.js +0 -2
- package/dist/packem_shared/tabs-BuTy5gPV.js +0 -1
- package/dist/packem_shared/toolchain-pR7AJ-tB.js +0 -5
- package/dist/packem_shared/typosquats-DN78xx1x.js +0 -1
- package/dist/packem_shared/use-measured-height-_eVGWtWt.js +0 -1
- package/dist/packem_shared/verify-6WCmFmy8.js +0 -1
- package/dist/packem_shared/vis-update-app-k3fDxech.js +0 -1
- package/dist/packem_shared/watch-BvIwLG4N.js +0 -1
- package/dist/packem_shared/watch-loop-DWkvv2tK.js +0 -11
|
@@ -1,708 +1,6 @@
|
|
|
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
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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};
|
|
1
|
+
import{createRequire as z}from"node:module";import{y as J,v as _,m as P,f as M,J as K,B as V}from"../packem_shared/index-OQZQyN5R.js";import{a1 as t,a2 as a,m as c,aB as Y,aC as Q,aD as U,aA as Z,r as v,ab as ee,p as k,$ as re,d as te,s as se,aK as ne,aL as oe,aM as ie,i as le,W as N}from"./cli-main.js";import{I as ce}from"../packem_shared/bin-CnDBuLh3.js";import ae from"./index.js";import{sortPackageJsonStringWithOptions as q}from"#native";import{c as O}from"../packem_shared/utils-Cxree603.js";const Ye=z(import.meta.url),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const A={error:0,rewritten:1,"would-rewrite":1,unchanged:2},de=e=>[...e].sort((r,s)=>A[r.status]-A[s.status]),ue=(e,r)=>r==="all"?e:r==="errors"?e.filter(s=>s.status==="error"):r==="rewritten"?e.filter(s=>s.status==="rewritten"||s.status==="would-rewrite"):e.filter(s=>s.status==="unchanged");class fe{#e;#r=new Set;constructor(r){this.#e={entries:de(r),filterType:"all",focusedPanel:"list",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=r=>(this.#r.add(r),()=>{this.#r.delete(r)});getFilteredEntries=()=>ue(this.#e.entries,this.#e.filterType);#t(){this.#e={...this.#e};for(const r of this.#r)r()}select(r){const s=this.getFilteredEntries();this.#e.selectedIndex=s.length===0?-1:Math.max(0,Math.min(r,s.length-1)),this.#t()}selectStep(r){this.select(this.#e.selectedIndex+r)}setFilter(r){this.#e.filterType=r,this.#e.selectedIndex=0,this.#t()}setFocusedPanel(r){this.#e.focusedPanel=r,this.#t()}}const he=({checkMode:e,entry:r,focused:s,scrollRef:l})=>{const i=s?"white":"gray";return r?t.jsxs(a,{borderColor:i,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsx(a,{flexShrink:0,paddingTop:1,paddingX:2,children:t.jsx(c,{bold:!0,color:"white",children:r.relativePath})}),t.jsxs(Y,{flexGrow:1,flexShrink:1,paddingX:2,ref:l,scrollbar:!0,scrollbarColor:"gray",children:[t.jsx(c,{}),t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Status:"})}),r.status==="error"?t.jsx(c,{bold:!0,color:"red",children:"error"}):r.status==="unchanged"?t.jsx(c,{bold:!0,color:"green",children:"already sorted"}):r.status==="rewritten"?t.jsx(c,{bold:!0,color:"yellow",children:"rewritten"}):t.jsx(c,{bold:!0,color:"yellow",children:"would rewrite (--check)"})]}),t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Path:"})}),t.jsx(c,{children:r.filePath})]}),r.error?t.jsxs(t.Fragment,{children:[t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"red",children:"ERROR"}),t.jsxs(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Step:"})}),t.jsx(c,{color:"yellow",children:r.error.step})]}),r.error.context&&t.jsxs(a,{children:[t.jsx(a,{width:10,children:t.jsx(c,{dimColor:!0,children:"Position:"})}),t.jsx(c,{children:`line ${String(r.error.context.line)}, column ${String(r.error.context.column)}`})]}),t.jsx(a,{marginTop:1,children:t.jsx(c,{color:"red",children:r.error.message})})]})]}),r.error.context&&r.error.context.snippet.length>0&&t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"white",children:"SNIPPET"}),t.jsxs(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r.error.context.snippet.map(n=>{const o=`${n.isErrorLine?"❯":" "} ${String(n.lineNumber).padStart(4)} `;return t.jsxs(a,{children:[t.jsx(c,{color:n.isErrorLine?"red":"gray",children:o}),t.jsx(c,{color:n.isErrorLine?"white":"gray",wrap:"truncate-end",children:n.content||" "})]},n.lineNumber)}),r.error.context.column>0&&t.jsx(a,{children:t.jsx(c,{color:"red",children:`${" ".repeat(7+r.error.context.column-1)}↑`})})]})]})]}):t.jsxs(a,{flexDirection:"column",marginTop:1,children:[t.jsx(c,{dimColor:!0,children:"── "}),t.jsx(c,{bold:!0,color:"white",children:"KEY DIFF"}),t.jsx(a,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.diff.length===0?t.jsx(c,{dimColor:!0,children:"No top-level keys moved (sub-key reorder only)."}):r.diff.map(n=>{const o=n.toIndex-n.fromIndex,d=o<0?`↑ ${String(Math.abs(o))}`:`↓ ${String(o)}`,g=o<0?"green":"yellow";return t.jsxs(a,{children:[t.jsx(a,{width:28,children:t.jsx(c,{wrap:"truncate",children:n.key})}),t.jsx(a,{width:10,children:t.jsxs(c,{dimColor:!0,children:[String(n.fromIndex)," → ",String(n.toIndex)]})}),t.jsx(c,{color:g,children:d})]},n.key)})}),e&&r.status==="would-rewrite"&&t.jsx(a,{marginTop:1,paddingLeft:2,children:t.jsx(c,{dimColor:!0,children:"--check mode: no write performed."})})]})]})]}):t.jsx(a,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:t.jsx(c,{dimColor:!0,children:"No entry selected"})})},ge={error:"red",rewritten:"yellow",unchanged:"green","would-rewrite":"yellow"},pe={error:"ERROR",rewritten:"REWROTE",unchanged:"SORTED","would-rewrite":"REWRITE"},H={error:"errors",rewritten:"rewrites",unchanged:"sorted","would-rewrite":"rewrites"},xe={errors:"Errors",rewrites:"Rewrites",sorted:"Sorted"},me=[{count:e=>e.errors+e.rewrites+e.sorted,key:"all",label:"All",shortcut:"1"},{count:e=>e.rewrites,key:"rewritten",label:"Rewrites",shortcut:"2"},{count:e=>e.errors,key:"errors",label:"Errors",shortcut:"3"},{count:e=>e.sorted,key:"unchanged",label:"Sorted",shortcut:"4"}],X=e=>{const r={errors:0,rewrites:0,sorted:0};for(const s of e)r[H[s.status]]++;return r},we=({entry:e,isSelected:r})=>{const s=ge[e.status],l=pe[e.status];return t.jsxs(a,{flexShrink:0,height:1,children:[t.jsx(c,{children:r?">":" "}),t.jsx(c,{children:" "}),t.jsx(c,{bold:!0,color:s,children:`[${l}]`.padEnd(10)}),t.jsx(c,{children:" "}),t.jsx(a,{flexGrow:1,children:t.jsx(c,{bold:r,inverse:r,wrap:"truncate",children:e.relativePath})}),e.status!=="error"&&e.diff.length>0&&t.jsx(c,{dimColor:!0,children:` ${String(e.diff.length)} key${e.diff.length===1?"":"s"}`})]})},je=({color:e,count:r,label:s})=>t.jsx(a,{flexShrink:0,height:1,children:t.jsx(c,{bold:!0,color:e,children:`${s} (${String(r)})`})}),ye=({counts:e,entries:r,filterType:s,focused:l,selectedIndex:i,totalEntries:n,viewportHeight:o})=>{const d=l?"white":"gray",g=X(r),m=(g.errors>0?1:0)+(g.rewrites>0?1:0)+(g.sorted>0?1:0),y=s==="all"&&m>1,h=[];let w;for(const[u,x]of r.entries()){const b=H[x.status];y&&b!==w&&(w!==void 0&&h.push({kind:"spacer"}),h.push({color:b==="errors"?"red":b==="rewrites"?"yellow":"green",count:g[b],kind:"header",label:xe[b]}),w=b),h.push({entry:x,entryIndex:u,kind:"entry"})}const p=h.findIndex(u=>u.kind==="entry"&&u.entryIndex===i),S=p!==-1,j=h.length,$=Math.max(0,j-o);let f=0;S&&o>0&&(f=Math.min($,Math.max(0,p-o+1)));const E=j>o&&o>0;return t.jsxs(a,{borderColor:d,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsxs(a,{flexShrink:0,gap:1,paddingX:1,children:[t.jsx(c,{bold:!0,inverse:!0,children:" VIS SORT "}),t.jsxs(c,{wrap:"truncate",children:[n," ","file",n===1?"":"s"]})]}),t.jsx(a,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:me.map(u=>{const x=s===u.key,b=u.count(e);return t.jsxs(a,{children:[t.jsx(c,{dimColor:!x,children:"["}),t.jsx(c,{bold:x,color:x?"cyan":"gray",children:u.shortcut}),t.jsx(c,{dimColor:!x,children:"]"}),t.jsxs(c,{color:x?"white":"gray",children:[" ",u.label]}),t.jsxs(c,{dimColor:!0,children:[" ","(",b,")"]})]},u.key)})}),t.jsxs(a,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t.jsx(a,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t.jsx(a,{flexDirection:"column",marginTop:-f,children:h.map((u,x)=>u.kind==="spacer"?t.jsx(a,{flexShrink:0,height:1},`s-${String(x)}`):u.kind==="header"?t.jsx(je,{color:u.color,count:u.count,label:u.label},`h-${u.label}`):t.jsx(we,{entry:u.entry,isSelected:u.entryIndex===i},u.entry.filePath))})}),E&&t.jsx(a,{flexShrink:0,marginLeft:1,marginRight:1,children:t.jsx(Q,{contentHeight:j,placement:"inset",scrollOffset:f,style:"block",viewportHeight:o})})]})]})},be=100,D=10,ke=6,Se=1,F={1:"all",2:"rewritten",3:"errors",4:"unchanged"},$e=({checkMode:e,store:r})=>{const{exit:s}=U(),{columns:l,rows:i}=Z(),n=v.useSyncExternalStore(r.subscribe,r.getSnapshot),o=v.useRef(null),d=r.getFilteredEntries(),g=d[n.selectedIndex]??null,m=X(n.entries),y=l>=be,h=Math.max(0,i-Se),w=y?h:Math.floor(h/2),p=Math.max(0,w-ke),S=v.useCallback(()=>{s()},[s]),j=v.useRef(0),$=v.useRef(void 0),f=v.useRef(!1),E=v.useCallback((u,x)=>{j.current+=x,$.current=u,!f.current&&(f.current=!0,queueMicrotask(()=>{f.current=!1;const b=j.current,T=$.current;j.current=0,$.current=void 0,!(b===0||T===void 0)&&(T==="list"?r.selectStep(Math.sign(b)):o.current?.scrollBy(Math.sign(b)))}))},[r]);return ee((u,x)=>{if(u==="q"||x.escape){S();return}if(F[u]){r.setFilter(F[u]);return}if(x.tab){r.setFocusedPanel(n.focusedPanel==="list"?"detail":"list");return}n.focusedPanel==="list"?x.upArrow||u==="k"?E("list",-1):(x.downArrow||u==="j")&&E("list",1):n.focusedPanel==="detail"&&(x.upArrow||u==="k"?E("detail",-1):(x.downArrow||u==="j")&&E("detail",1))}),i<D?t.jsx(a,{alignItems:"center",justifyContent:"center",children:t.jsxs(c,{color:"yellow",children:["Terminal too small. Resize to at least",D," ","rows."]})}):t.jsxs(a,{flexDirection:"column",height:i,width:l,children:[t.jsxs(a,{flexDirection:y?"row":"column",flexGrow:1,children:[t.jsx(a,{flexBasis:"50%",flexGrow:1,flexShrink:1,children:t.jsx(ye,{counts:m,entries:d,filterType:n.filterType,focused:n.focusedPanel==="list",selectedIndex:n.selectedIndex,totalEntries:n.entries.length,viewportHeight:p})}),t.jsx(a,{flexBasis:"50%",flexGrow:1,flexShrink:1,children:t.jsx(he,{checkMode:e,entry:g,focused:n.focusedPanel==="detail",scrollRef:o})})]}),t.jsx(a,{flexShrink:0,paddingX:1,children:t.jsx(c,{dimColor:!0,children:"↑/↓ or j/k:navigate | tab:switch panel | 1-4:filter | q:quit"})})]})},B=["types","node-addons","node","import","require","default"],ve=/^git\+https:\/\/github\.com\/([^/]+)\/([^/.]+(?:\.git)?)$/,Ee=/^git\+ssh:\/\/git@github\.com\/([^/]+)\/([^/.]+(?:\.git)?)$/,C=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),I=e=>{if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(s=>I(s));const r={};for(const[s,l]of Object.entries(e))r[s]=I(l);return r},Pe=e=>{if(!C(e))return{changed:!1,value:e};const r=Object.keys(e);return r.length===1&&r[0]==="url"&&typeof e.url=="string"?{changed:!0,value:e.url}:{changed:!1,value:e}},Oe=e=>e.endsWith(".git")?e.slice(0,-4):e,Ce=e=>{if(!C(e))return{changed:!1,value:e};if(typeof e.directory=="string"&&e.directory.length>0)return{changed:!1,value:e};const{type:r}=e;if(r!==void 0&&r!=="git")return{changed:!1,value:e};const{url:s}=e;if(typeof s!="string")return{changed:!1,value:e};const l=ve.exec(s)??Ee.exec(s);if(!l)return{changed:!1,value:e};const i=l[1],n=Oe(l[2]??"");if(!i||!n)return{changed:!1,value:e};const o=new Set(["type","url"]);for(const d of Object.keys(e))if(!o.has(d))return{changed:!1,value:e};return{changed:!0,value:`${i}/${n}`}},Re=e=>{const r=Object.keys(e),s=[],l=[];for(const o of B)Object.hasOwn(e,o)&&s.push(o);for(const o of r)B.includes(o)||l.push(o);const i=[...s,...l];if(i.length===r.length&&i.every((o,d)=>o===r[d]))return{changed:!1,value:e};const n={};for(const o of i)n[o]=e[o];return{changed:!0,value:n}},W=e=>{if(!C(e))return{changed:!1,value:e};let r=!1;const s={};for(const[i,n]of Object.entries(e)){const o=W(n);s[i]=o.value,o.changed&&(r=!0)}const l=Re(s);return{changed:r||l.changed,value:l.value}},Ie=(e,r)=>{const s=I(e);let l=!1;if(r.formatBugs!==!1&&Object.hasOwn(s,"bugs")){const i=Pe(s.bugs);i.changed&&(s.bugs=i.value,l=!0)}if(r.formatRepository!==!1&&Object.hasOwn(s,"repository")){const i=Ce(s.repository);i.changed&&(s.repository=i.value,l=!0)}if(r.sortExports!==!1&&Object.hasOwn(s,"exports")&&C(s.exports)){const i=W(s.exports);i.changed&&(s.exports=i.value,l=!0)}return{changed:l,pkg:s}},Te=/at position (\d+)/,Me=/\(?line (\d+) column (\d+)\)?/,Ne=e=>{const r=new Set,s=[],l=n=>{const o=V(n);!r.has(o)&&M(o)&&(r.add(o),s.push(o))};l(P(e,"package.json"));const i=le(e);if(i){const n=N(e,i);for(const o of n)l(P(e,o,"package.json"))}else{const n=P(e,"package.json");if(M(n)){const o=JSON.parse(_(n)),d=Array.isArray(o.workspaces)?o.workspaces:o.workspaces?.packages;if(d){const g=N(e,d);for(const m of g)l(P(e,m,"package.json"))}}}return s},Ae=e=>/\n([ \t]+)/.exec(e)?.[1]??" ",De=e=>{if(!(e===void 0||e===""))return e==="tab"||e===String.raw`\t`?" ":/^\d+$/.test(e)?" ".repeat(Number.parseInt(e,10)):e},R=e=>e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(r=>r.split(",")).map(r=>r.trim()).filter(r=>r.length>0),Fe=e=>e.includes(`\r
|
|
2
|
+
`)?"crlf":"lf",Be=new Set(["auto","crlf","lf"]),Ge=e=>{if(e===void 0||e==="")return"auto";if(Be.has(e))return e;throw new Error(`--line-ending must be one of: auto, lf, crlf (got "${e}")`)},Le=(e,r,s)=>r.length===0?e:e.filter(l=>{const i=J(s,l),n=K(l);return!r.some(o=>{const d=o.includes("/")?i:n;return ae(o,d)})}),Je=(e,r)=>{if(r.length===0)return e;const s={},l=new Set;for(const i of r)Object.hasOwn(e,i)&&(s[i]=e[i],l.add(i));for(const i of Object.keys(e))l.has(i)||(s[i]=e[i]);return s},_e=(e,r,s)=>{if(s.length===0)return e;const l={...e};for(const i of s)Object.hasOwn(r,i)&&(l[i]=r[i]);return l},qe=(e,r)=>{let s=1,l=1;const i=Math.min(r,e.length);for(let n=0;n<i;n++)e.codePointAt(n)===10?(s++,l=1):l++;return{column:l,line:s}},G=(e,r,s=2)=>{const l=e.split(`
|
|
3
|
+
`);if(r<1||r>l.length)return[];const i=Math.max(0,r-1-s),n=Math.min(l.length,r+s),o=[];for(let d=i;d<n;d++)o.push({content:l[d]??"",isErrorLine:d+1===r,lineNumber:d+1});return o},L=(e,r)=>{if(!(e instanceof Error))return;const s=Te.exec(e.message);if(s){const{column:i,line:n}=qe(r,Number.parseInt(s[1]??"0",10));return{column:i,line:n,snippet:G(r,n)}}const l=Me.exec(e.message);if(l){const i=Number.parseInt(l[1]??"1",10);return{column:Number.parseInt(l[2]??"1",10),line:i,snippet:G(r,i)}}},He=(e,r)=>{const s=Object.keys(JSON.parse(e)),l=Object.keys(JSON.parse(r)),i=new Map(s.map((o,d)=>[o,d])),n=[];for(const[o,d]of l.entries()){const g=i.get(d);g!==void 0&&g!==o&&n.push({fromIndex:g,key:d,toIndex:o})}return n},Xe=(e,r,s)=>{const l=r.indent??s.indent??Ae(e),i=r.lineEnding==="auto"?s.lineEnding??Fe(e):r.lineEnding,n=q(e,{pretty:!1,sortScripts:r.sortScripts});let o=JSON.parse(n);if(r.unsorted.length>0){const y=JSON.parse(e);o=_e(o,y,r.unsorted)}o=Je(o,r.sortOrder);const d={formatBugs:r.formatBugs,formatRepository:r.formatRepository,sortExports:r.sortExports},g=Ie(o,d);let m=JSON.stringify(g.pkg,null,l);return r.finalNewline&&(m+=`
|
|
4
|
+
`),i==="crlf"&&(m=m.replaceAll(`
|
|
5
|
+
`,`\r
|
|
6
|
+
`)),m},We=(e,r)=>{const s=Ne(e),l=se(e),i=ne({cwd:e,extraPatterns:oe(l)}),n=s.filter(d=>!i.ignores(d)),o=Le(n,r,e);return{afterGitignore:n,allFiles:s,files:o}},ze=async(e,{checkMode:r,cwd:s,fs:l,normalized:i})=>{const n=J(s,e)||e;let o;try{o=_(e)}catch(h){return{diff:[],error:{message:O(h),step:"read"},filePath:e,relativePath:n,status:"error"}}let d;try{d=q(o,{pretty:!1,sortScripts:i.sortScripts})}catch(h){const w={message:O(h),step:"native-sort"},p=L(h,o);return p&&(w.context=p),{diff:[],error:w,filePath:e,relativePath:n,status:"error"}}const g=i.editorconfig?ie(e):{};let m;try{m=Xe(o,i,g)}catch(h){const w={message:O(h),step:"json-parse"},p=L(h,o);return p&&(w.context=p),{diff:[],error:w,filePath:e,relativePath:n,status:"error"}}if(o===m)return{diff:[],filePath:e,relativePath:n,status:"unchanged"};let y;try{y=He(o,d)}catch{y=[]}if(r)return{diff:y,filePath:e,relativePath:n,status:"would-rewrite"};try{await l.writeFile(e,m,"utf8")}catch(h){return{diff:y,error:{message:O(h),step:"write"},filePath:e,relativePath:n,status:"error"}}return{diff:y,filePath:e,relativePath:n,status:"rewritten"}},Ke=e=>{if(e.error&&(k.error(`${e.filePath}: ${e.error.message}`),k.info(` step: ${e.error.step}`),e.error.context)){k.info(` at line ${String(e.error.context.line)}, column ${String(e.error.context.column)}`);for(const r of e.error.context.snippet){const s=r.isErrorLine?">":" ";k.info(` ${s} ${String(r.lineNumber).padStart(4)} | ${r.content}`)}}},nr=async({fs:e,options:r,visConfig:s,workspaceRoot:l})=>{const i=l??process.cwd(),n=s?.sortPackageJson,o=r.check||!1,d={editorconfig:r.editorconfig===!1?!1:n?.editorconfig??!0,finalNewline:r.finalNewline??n?.finalNewline??!0,formatBugs:r.formatBugs===!1?!1:n?.formatBugs??!0,formatRepository:r.formatRepository===!1?!1:n?.formatRepository??!0,ignore:[...R(r.ignore),...n?.ignore??[]],indent:De(r.indent??n?.indent),lineEnding:Ge(r.lineEnding??n?.lineEnding),sortExports:r.sortExports===!1?!1:n?.sortExports??!0,sortOrder:[...R(r.sortOrder),...n?.sortOrder??[]],sortScripts:r.sortScripts||n?.sortScripts||!1,unsorted:[...R(r.unsorted),...n?.unsorted??[]]},g=We(i,d.ignore),{afterGitignore:m,allFiles:y,files:h}=g;if(h.length===0){y.length===0?k.info("No package.json files found."):m.length===0?k.info("All package.json files were excluded by .gitignore or workspace exclusions."):k.info("All package.json files were excluded by --ignore.");return}const w=[];for(const f of h)w.push(await ze(f,{checkMode:o,cwd:i,fs:e,normalized:d}));let p=0,S=0,j=0;for(const f of w)f.status==="error"?j++:f.status==="rewritten"||f.status==="would-rewrite"?p++:S++;const $=p>0||j>0;if(process.stdout.isTTY&&!ce&&$){const f=new fe(w);await re(te.createElement($e,{checkMode:o,store:f}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit()}else for(const f of w)switch(f.status){case"error":{Ke(f);break}case"rewritten":{k.success(`Sorted ${f.filePath}`);break}case"would-rewrite":{k.warn(`${f.filePath} is not sorted`);break}}if(o)p>0?(k.info(`${String(p)} file${p===1?"":"s"} not sorted, ${String(S)} already sorted`),process.exitCode=1):j===0&&k.info(`All ${String(S)} package.json file${S===1?" is":"s are"} sorted`);else{const f=[];p>0&&f.push(`sorted ${String(p)} file${p===1?"":"s"}`),S>0&&f.push(`${String(S)} already sorted`),j>0&&f.push(`${String(j)} error${j===1?"":"s"}`),f.length>0&&k.info(f.join(", "))}j>0&&(process.exitCode=1)};export{G as buildSnippet,He as computeKeyDiff,qe as computeLineColumn,nr as default,We as discoverPackageJsonFiles,L as extractParseErrorContext,ze as processFile};
|