@graphrefly/graphrefly 0.45.0 → 0.46.0
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/README.md +1 -2
- package/dist/_internal-B23BagFd.d.cts +33 -0
- package/dist/_internal-B23BagFd.d.ts +33 -0
- package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
- package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
- package/dist/agents-C0Ji9ldU.d.cts +629 -0
- package/dist/agents-C9zexT7I.d.ts +629 -0
- package/dist/audit-BAXb3VOg.d.ts +246 -0
- package/dist/audit-C_bPfkqS.d.cts +246 -0
- package/dist/backoff-7KIK3WQW.js +24 -0
- package/dist/backoff-7KIK3WQW.js.map +1 -0
- package/dist/backoff-Bnb9OoPh.d.cts +6 -0
- package/dist/backoff-Bnb9OoPh.d.ts +6 -0
- package/dist/base/composition/index.cjs +811 -0
- package/dist/base/composition/index.cjs.map +1 -0
- package/dist/base/composition/index.d.cts +469 -0
- package/dist/base/composition/index.d.ts +469 -0
- package/dist/base/composition/index.js +40 -0
- package/dist/base/composition/index.js.map +1 -0
- package/dist/base/index.cjs +6336 -0
- package/dist/base/index.cjs.map +1 -0
- package/dist/base/index.d.cts +22 -0
- package/dist/base/index.d.ts +22 -0
- package/dist/base/index.js +259 -0
- package/dist/base/index.js.map +1 -0
- package/dist/base/io/index.cjs +3270 -0
- package/dist/base/io/index.cjs.map +1 -0
- package/dist/base/io/index.d.cts +2245 -0
- package/dist/base/io/index.d.ts +2245 -0
- package/dist/base/io/index.js +117 -0
- package/dist/base/io/index.js.map +1 -0
- package/dist/base/meta/index.cjs +43 -0
- package/dist/base/meta/index.cjs.map +1 -0
- package/dist/base/meta/index.d.cts +45 -0
- package/dist/base/meta/index.d.ts +45 -0
- package/dist/base/meta/index.js +13 -0
- package/dist/base/meta/index.js.map +1 -0
- package/dist/base/mutation/index.cjs +200 -0
- package/dist/base/mutation/index.cjs.map +1 -0
- package/dist/base/mutation/index.d.cts +177 -0
- package/dist/base/mutation/index.d.ts +177 -0
- package/dist/base/mutation/index.js +22 -0
- package/dist/base/mutation/index.js.map +1 -0
- package/dist/base/render/index.cjs +1120 -0
- package/dist/base/render/index.cjs.map +1 -0
- package/dist/base/render/index.d.cts +227 -0
- package/dist/base/render/index.d.ts +227 -0
- package/dist/base/render/index.js +24 -0
- package/dist/base/render/index.js.map +1 -0
- package/dist/base/sources/browser/index.cjs +172 -0
- package/dist/base/sources/browser/index.cjs.map +1 -0
- package/dist/base/sources/browser/index.d.cts +84 -0
- package/dist/base/sources/browser/index.d.ts +84 -0
- package/dist/base/sources/browser/index.js +151 -0
- package/dist/base/sources/browser/index.js.map +1 -0
- package/dist/base/sources/event/index.cjs +98 -0
- package/dist/base/sources/event/index.cjs.map +1 -0
- package/dist/base/sources/event/index.d.cts +91 -0
- package/dist/base/sources/event/index.d.ts +91 -0
- package/dist/base/sources/event/index.js +13 -0
- package/dist/base/sources/event/index.js.map +1 -0
- package/dist/base/sources/index.cjs +755 -0
- package/dist/base/sources/index.cjs.map +1 -0
- package/dist/base/sources/index.d.cts +357 -0
- package/dist/base/sources/index.d.ts +357 -0
- package/dist/base/sources/index.js +42 -0
- package/dist/base/sources/index.js.map +1 -0
- package/dist/base/sources/node/index.cjs +320 -0
- package/dist/base/sources/node/index.cjs.map +1 -0
- package/dist/base/sources/node/index.d.cts +185 -0
- package/dist/base/sources/node/index.d.ts +185 -0
- package/dist/base/sources/node/index.js +306 -0
- package/dist/base/sources/node/index.js.map +1 -0
- package/dist/base/utils/index.cjs +37 -0
- package/dist/base/utils/index.cjs.map +1 -0
- package/dist/base/utils/index.d.cts +37 -0
- package/dist/base/utils/index.d.ts +37 -0
- package/dist/base/utils/index.js +11 -0
- package/dist/base/utils/index.js.map +1 -0
- package/dist/base/worker/index.cjs +548 -0
- package/dist/base/worker/index.cjs.map +1 -0
- package/dist/base/worker/index.d.cts +207 -0
- package/dist/base/worker/index.d.ts +207 -0
- package/dist/base/worker/index.js +20 -0
- package/dist/base/worker/index.js.map +1 -0
- package/dist/breaker-C9skL3d8.d.ts +175 -0
- package/dist/breaker-ugSdq54q.d.cts +175 -0
- package/dist/cascading-CSSbKGrJ.d.ts +199 -0
- package/dist/cascading-baGkiihI.d.cts +199 -0
- package/dist/chunk-255UCBG4.js +58 -0
- package/dist/chunk-255UCBG4.js.map +1 -0
- package/dist/chunk-2LO3EL4W.js +1 -0
- package/dist/chunk-2LO3EL4W.js.map +1 -0
- package/dist/chunk-2OB3CEJS.js +1065 -0
- package/dist/chunk-2OB3CEJS.js.map +1 -0
- package/dist/chunk-36NMM65U.js +144 -0
- package/dist/chunk-36NMM65U.js.map +1 -0
- package/dist/chunk-3CEXCBN6.js +1 -0
- package/dist/chunk-3CEXCBN6.js.map +1 -0
- package/dist/chunk-3MUSLI6E.js +105 -0
- package/dist/chunk-3MUSLI6E.js.map +1 -0
- package/dist/chunk-3PSLNJDU.js +884 -0
- package/dist/chunk-3PSLNJDU.js.map +1 -0
- package/dist/chunk-3QZY5BI7.js +92 -0
- package/dist/chunk-3QZY5BI7.js.map +1 -0
- package/dist/chunk-42FQ27MQ.js +594 -0
- package/dist/chunk-42FQ27MQ.js.map +1 -0
- package/dist/chunk-4GYMCUDZ.js +1085 -0
- package/dist/chunk-4GYMCUDZ.js.map +1 -0
- package/dist/chunk-4S53H2KR.js +382 -0
- package/dist/chunk-4S53H2KR.js.map +1 -0
- package/dist/chunk-4XCHZRUJ.js +128 -0
- package/dist/chunk-4XCHZRUJ.js.map +1 -0
- package/dist/chunk-5THCXDWY.js +725 -0
- package/dist/chunk-5THCXDWY.js.map +1 -0
- package/dist/chunk-6XZYT4SW.js +256 -0
- package/dist/chunk-6XZYT4SW.js.map +1 -0
- package/dist/chunk-7EGRP2VX.js +76 -0
- package/dist/chunk-7EGRP2VX.js.map +1 -0
- package/dist/chunk-A7KV5UK4.js +150 -0
- package/dist/chunk-A7KV5UK4.js.map +1 -0
- package/dist/chunk-APY2SS5X.js +156 -0
- package/dist/chunk-APY2SS5X.js.map +1 -0
- package/dist/chunk-AZDQPQ3V.js +66 -0
- package/dist/chunk-AZDQPQ3V.js.map +1 -0
- package/dist/chunk-BU3SEFA5.js +90 -0
- package/dist/chunk-BU3SEFA5.js.map +1 -0
- package/dist/chunk-BXGZFGZ4.js +189 -0
- package/dist/chunk-BXGZFGZ4.js.map +1 -0
- package/dist/chunk-CGHORL6G.js +579 -0
- package/dist/chunk-CGHORL6G.js.map +1 -0
- package/dist/chunk-CXANAIZU.js +530 -0
- package/dist/chunk-CXANAIZU.js.map +1 -0
- package/dist/chunk-CZQHCKKG.js +1 -0
- package/dist/chunk-CZQHCKKG.js.map +1 -0
- package/dist/chunk-DKNHAICT.js +133 -0
- package/dist/chunk-DKNHAICT.js.map +1 -0
- package/dist/chunk-DM4OMPWK.js +584 -0
- package/dist/chunk-DM4OMPWK.js.map +1 -0
- package/dist/chunk-DMSNO6ZB.js +452 -0
- package/dist/chunk-DMSNO6ZB.js.map +1 -0
- package/dist/chunk-E5OZPDIW.js +229 -0
- package/dist/chunk-E5OZPDIW.js.map +1 -0
- package/dist/chunk-EVYY4X5A.js +509 -0
- package/dist/chunk-EVYY4X5A.js.map +1 -0
- package/dist/chunk-FDFD67UO.js +1 -0
- package/dist/chunk-FDFD67UO.js.map +1 -0
- package/dist/chunk-FMPF42Q4.js +13 -0
- package/dist/chunk-FMPF42Q4.js.map +1 -0
- package/dist/chunk-FR6RGA3B.js +1277 -0
- package/dist/chunk-FR6RGA3B.js.map +1 -0
- package/dist/chunk-FW23JYNQ.js +454 -0
- package/dist/chunk-FW23JYNQ.js.map +1 -0
- package/dist/chunk-GBCENOLN.js +1575 -0
- package/dist/chunk-GBCENOLN.js.map +1 -0
- package/dist/chunk-HL7HUJIX.js +1 -0
- package/dist/chunk-HL7HUJIX.js.map +1 -0
- package/dist/chunk-HULCUY35.js +2508 -0
- package/dist/chunk-HULCUY35.js.map +1 -0
- package/dist/chunk-IHTWQEDR.js +169 -0
- package/dist/chunk-IHTWQEDR.js.map +1 -0
- package/dist/chunk-IJRR6YAI.js +128 -0
- package/dist/chunk-IJRR6YAI.js.map +1 -0
- package/dist/chunk-JGFRAFDL.js +221 -0
- package/dist/chunk-JGFRAFDL.js.map +1 -0
- package/dist/chunk-KIIXR252.js +211 -0
- package/dist/chunk-KIIXR252.js.map +1 -0
- package/dist/chunk-KN3H5CNT.js +11 -0
- package/dist/chunk-KN3H5CNT.js.map +1 -0
- package/dist/chunk-KPG3DGLA.js +1 -0
- package/dist/chunk-KPG3DGLA.js.map +1 -0
- package/dist/chunk-KRNQ6RGQ.js +1 -0
- package/dist/chunk-KRNQ6RGQ.js.map +1 -0
- package/dist/chunk-LBAJK24K.js +1071 -0
- package/dist/chunk-LBAJK24K.js.map +1 -0
- package/dist/chunk-MLTPJMH6.js +417 -0
- package/dist/chunk-MLTPJMH6.js.map +1 -0
- package/dist/chunk-N3SZ7BMH.js +95 -0
- package/dist/chunk-N3SZ7BMH.js.map +1 -0
- package/dist/chunk-NDUD3IMO.js +540 -0
- package/dist/chunk-NDUD3IMO.js.map +1 -0
- package/dist/chunk-NY2PYHNC.js +873 -0
- package/dist/chunk-NY2PYHNC.js.map +1 -0
- package/dist/chunk-O3MT7DYI.js +225 -0
- package/dist/chunk-O3MT7DYI.js.map +1 -0
- package/dist/chunk-OCUDSN63.js +2386 -0
- package/dist/chunk-OCUDSN63.js.map +1 -0
- package/dist/chunk-OIWU3NYV.js +199 -0
- package/dist/chunk-OIWU3NYV.js.map +1 -0
- package/dist/chunk-OO5BM6CJ.js +1153 -0
- package/dist/chunk-OO5BM6CJ.js.map +1 -0
- package/dist/chunk-OQUIJT7A.js +1 -0
- package/dist/chunk-OQUIJT7A.js.map +1 -0
- package/dist/chunk-P5LBT622.js +105 -0
- package/dist/chunk-P5LBT622.js.map +1 -0
- package/dist/chunk-PKGQG5QQ.js +519 -0
- package/dist/chunk-PKGQG5QQ.js.map +1 -0
- package/dist/chunk-PKPO3JTZ.js +561 -0
- package/dist/chunk-PKPO3JTZ.js.map +1 -0
- package/dist/chunk-PL5UDIQ5.js +118 -0
- package/dist/chunk-PL5UDIQ5.js.map +1 -0
- package/dist/chunk-PZWISPIQ.js +432 -0
- package/dist/chunk-PZWISPIQ.js.map +1 -0
- package/dist/chunk-Q3EYOCZB.js +510 -0
- package/dist/chunk-Q3EYOCZB.js.map +1 -0
- package/dist/chunk-QMBYUVRL.js +15 -0
- package/dist/chunk-QMBYUVRL.js.map +1 -0
- package/dist/chunk-RAGGHLCV.js +200 -0
- package/dist/chunk-RAGGHLCV.js.map +1 -0
- package/dist/chunk-RGL53X5G.js +574 -0
- package/dist/chunk-RGL53X5G.js.map +1 -0
- package/dist/chunk-RJOG4IJU.js +1039 -0
- package/dist/chunk-RJOG4IJU.js.map +1 -0
- package/dist/chunk-SOOKUYVM.js +403 -0
- package/dist/chunk-SOOKUYVM.js.map +1 -0
- package/dist/chunk-T5BN5KG7.js +1 -0
- package/dist/chunk-T5BN5KG7.js.map +1 -0
- package/dist/chunk-TP7244Y6.js +207 -0
- package/dist/chunk-TP7244Y6.js.map +1 -0
- package/dist/chunk-TSBFTJKM.js +57 -0
- package/dist/chunk-TSBFTJKM.js.map +1 -0
- package/dist/chunk-URQ2CBBF.js +143 -0
- package/dist/chunk-URQ2CBBF.js.map +1 -0
- package/dist/chunk-W2BOPXTI.js +1 -0
- package/dist/chunk-W2BOPXTI.js.map +1 -0
- package/dist/chunk-WKSWLSCX.js +207 -0
- package/dist/chunk-WKSWLSCX.js.map +1 -0
- package/dist/chunk-Y52CS6YA.js +88 -0
- package/dist/chunk-Y52CS6YA.js.map +1 -0
- package/dist/chunk-YCBUWK77.js +92 -0
- package/dist/chunk-YCBUWK77.js.map +1 -0
- package/dist/chunk-YJ4U2D2C.js +314 -0
- package/dist/chunk-YJ4U2D2C.js.map +1 -0
- package/dist/chunk-Z4YXAUDN.js +239 -0
- package/dist/chunk-Z4YXAUDN.js.map +1 -0
- package/dist/chunk-Z6EGP5D7.js +92 -0
- package/dist/chunk-Z6EGP5D7.js.map +1 -0
- package/dist/compat/index.cjs +3083 -2
- package/dist/compat/index.cjs.map +1 -1
- package/dist/compat/index.d.cts +116 -1
- package/dist/compat/index.d.ts +116 -1
- package/dist/compat/index.js +175 -2
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/jotai/index.cjs +130 -2
- package/dist/compat/jotai/index.cjs.map +1 -1
- package/dist/compat/jotai/index.d.cts +2 -1
- package/dist/compat/jotai/index.d.ts +2 -1
- package/dist/compat/jotai/index.js +7 -2
- package/dist/compat/jotai/index.js.map +1 -1
- package/dist/compat/nanostores/index.cjs +186 -2
- package/dist/compat/nanostores/index.cjs.map +1 -1
- package/dist/compat/nanostores/index.d.cts +2 -1
- package/dist/compat/nanostores/index.d.ts +2 -1
- package/dist/compat/nanostores/index.js +21 -2
- package/dist/compat/nanostores/index.js.map +1 -1
- package/dist/compat/nestjs/index.cjs +2224 -2
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +10 -1
- package/dist/compat/nestjs/index.d.ts +10 -1
- package/dist/compat/nestjs/index.js +77 -2
- package/dist/compat/nestjs/index.js.map +1 -1
- package/dist/compat/react/index.cjs +95 -2
- package/dist/compat/react/index.cjs.map +1 -1
- package/dist/compat/react/index.d.cts +2 -1
- package/dist/compat/react/index.d.ts +2 -1
- package/dist/compat/react/index.js +11 -2
- package/dist/compat/react/index.js.map +1 -1
- package/dist/compat/solid/index.cjs +82 -2
- package/dist/compat/solid/index.cjs.map +1 -1
- package/dist/compat/solid/index.d.cts +2 -1
- package/dist/compat/solid/index.d.ts +2 -1
- package/dist/compat/solid/index.js +11 -2
- package/dist/compat/solid/index.js.map +1 -1
- package/dist/compat/svelte/index.cjs +85 -2
- package/dist/compat/svelte/index.cjs.map +1 -1
- package/dist/compat/svelte/index.d.cts +2 -1
- package/dist/compat/svelte/index.d.ts +2 -1
- package/dist/compat/svelte/index.js +11 -2
- package/dist/compat/svelte/index.js.map +1 -1
- package/dist/compat/vue/index.cjs +100 -2
- package/dist/compat/vue/index.cjs.map +1 -1
- package/dist/compat/vue/index.d.cts +3 -1
- package/dist/compat/vue/index.d.ts +3 -1
- package/dist/compat/vue/index.js +11 -2
- package/dist/compat/vue/index.js.map +1 -1
- package/dist/compat/zustand/index.cjs +50 -2
- package/dist/compat/zustand/index.cjs.map +1 -1
- package/dist/compat/zustand/index.d.cts +2 -1
- package/dist/compat/zustand/index.d.ts +2 -1
- package/dist/compat/zustand/index.js +7 -2
- package/dist/compat/zustand/index.js.map +1 -1
- package/dist/distill-De6Rnn15.d.cts +48 -0
- package/dist/distill-De6Rnn15.d.ts +48 -0
- package/dist/external-register-CWyroXb_.d.cts +138 -0
- package/dist/external-register-CWyroXb_.d.ts +138 -0
- package/dist/fallback-Bx46zqky.d.cts +243 -0
- package/dist/fallback-pIWW8A2d.d.ts +243 -0
- package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
- package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
- package/dist/index-5SU_O78r.d.cts +754 -0
- package/dist/index-B6pxYJzO.d.cts +36 -0
- package/dist/index-B6pxYJzO.d.ts +36 -0
- package/dist/index-BFsng6v1.d.cts +44 -0
- package/dist/index-BFsng6v1.d.ts +44 -0
- package/dist/index-Bg-LwEt-.d.cts +45 -0
- package/dist/index-Bg-LwEt-.d.ts +45 -0
- package/dist/index-Brp888t0.d.cts +127 -0
- package/dist/index-Brp888t0.d.ts +127 -0
- package/dist/index-CDfk6jHN.d.cts +37 -0
- package/dist/index-CDfk6jHN.d.ts +37 -0
- package/dist/index-CEXCtYYJ.d.ts +754 -0
- package/dist/index-DLAxYaN5.d.cts +169 -0
- package/dist/index-DLAxYaN5.d.ts +169 -0
- package/dist/index-DeWbQzMe.d.cts +34 -0
- package/dist/index-DeWbQzMe.d.ts +34 -0
- package/dist/index-dX9IzPqj.d.cts +86 -0
- package/dist/index-dX9IzPqj.d.ts +86 -0
- package/dist/index.cjs +25950 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -42
- package/dist/index.d.ts +56 -42
- package/dist/index.js +849 -0
- package/dist/index.js.map +1 -1
- package/dist/layout-types-B5aiHYgk.d.cts +72 -0
- package/dist/layout-types-B5aiHYgk.d.ts +72 -0
- package/dist/memory-composers-BryDrRBX.d.cts +529 -0
- package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
- package/dist/observable-BXQoW1P-.d.cts +36 -0
- package/dist/observable-BXQoW1P-.d.ts +36 -0
- package/dist/pipeline-graph-Ce47CB6Y.d.cts +145 -0
- package/dist/pipeline-graph-DXCwY9vG.d.ts +145 -0
- package/dist/presets/ai/index.cjs +4377 -0
- package/dist/presets/ai/index.cjs.map +1 -0
- package/dist/presets/ai/index.d.cts +98 -0
- package/dist/presets/ai/index.d.ts +98 -0
- package/dist/presets/ai/index.js +54 -0
- package/dist/presets/ai/index.js.map +1 -0
- package/dist/presets/harness/index.cjs +5929 -0
- package/dist/presets/harness/index.cjs.map +1 -0
- package/dist/presets/harness/index.d.cts +566 -0
- package/dist/presets/harness/index.d.ts +566 -0
- package/dist/presets/harness/index.js +71 -0
- package/dist/presets/harness/index.js.map +1 -0
- package/dist/presets/index.cjs +9782 -0
- package/dist/presets/index.cjs.map +1 -0
- package/dist/presets/index.d.cts +28 -0
- package/dist/presets/index.d.ts +28 -0
- package/dist/presets/index.js +129 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/inspect/index.cjs +1087 -0
- package/dist/presets/inspect/index.cjs.map +1 -0
- package/dist/presets/inspect/index.d.cts +172 -0
- package/dist/presets/inspect/index.d.ts +172 -0
- package/dist/presets/inspect/index.js +21 -0
- package/dist/presets/inspect/index.js.map +1 -0
- package/dist/presets/resilience/index.cjs +1593 -0
- package/dist/presets/resilience/index.cjs.map +1 -0
- package/dist/presets/resilience/index.d.cts +205 -0
- package/dist/presets/resilience/index.d.ts +205 -0
- package/dist/presets/resilience/index.js +18 -0
- package/dist/presets/resilience/index.js.map +1 -0
- package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
- package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
- package/dist/reactive-layout-fswlBUvX.d.cts +195 -0
- package/dist/reactive-layout-fswlBUvX.d.ts +195 -0
- package/dist/retry-BDbRZ_gx.d.ts +125 -0
- package/dist/retry-DWuhjvsA.d.cts +125 -0
- package/dist/solutions/index.cjs +8200 -0
- package/dist/solutions/index.cjs.map +1 -0
- package/dist/solutions/index.d.cts +23 -0
- package/dist/solutions/index.d.ts +23 -0
- package/dist/solutions/index.js +55 -0
- package/dist/solutions/index.js.map +1 -0
- package/dist/spawnable-5mDY501F.d.cts +746 -0
- package/dist/spawnable-D3lR0oQu.d.ts +746 -0
- package/dist/status-U-rUI79b.d.cts +84 -0
- package/dist/status-U-rUI79b.d.ts +84 -0
- package/dist/timeout-U5O4ESK3.js +12 -0
- package/dist/timeout-U5O4ESK3.js.map +1 -0
- package/dist/types-BB5Lw-pB.d.cts +442 -0
- package/dist/types-BB5Lw-pB.d.ts +442 -0
- package/dist/types-CJWIMJiZ.d.ts +548 -0
- package/dist/types-vCq7ShIm.d.cts +548 -0
- package/dist/utils/ai/browser.cjs +2169 -0
- package/dist/utils/ai/browser.cjs.map +1 -0
- package/dist/utils/ai/browser.d.cts +129 -0
- package/dist/utils/ai/browser.d.ts +129 -0
- package/dist/utils/ai/browser.js +255 -0
- package/dist/utils/ai/browser.js.map +1 -0
- package/dist/utils/ai/index.cjs +8468 -0
- package/dist/utils/ai/index.cjs.map +1 -0
- package/dist/utils/ai/index.d.cts +1777 -0
- package/dist/utils/ai/index.d.ts +1777 -0
- package/dist/utils/ai/index.js +173 -0
- package/dist/utils/ai/index.js.map +1 -0
- package/dist/utils/ai/node.cjs +648 -0
- package/dist/utils/ai/node.cjs.map +1 -0
- package/dist/utils/ai/node.d.cts +57 -0
- package/dist/utils/ai/node.d.ts +57 -0
- package/dist/utils/ai/node.js +84 -0
- package/dist/utils/ai/node.js.map +1 -0
- package/dist/utils/cqrs/index.cjs +1036 -0
- package/dist/utils/cqrs/index.cjs.map +1 -0
- package/dist/utils/cqrs/index.d.cts +438 -0
- package/dist/utils/cqrs/index.d.ts +438 -0
- package/dist/utils/cqrs/index.js +18 -0
- package/dist/utils/cqrs/index.js.map +1 -0
- package/dist/utils/demo-shell/index.cjs +865 -0
- package/dist/utils/demo-shell/index.cjs.map +1 -0
- package/dist/utils/demo-shell/index.d.cts +90 -0
- package/dist/utils/demo-shell/index.d.ts +90 -0
- package/dist/utils/demo-shell/index.js +13 -0
- package/dist/utils/demo-shell/index.js.map +1 -0
- package/dist/utils/domain-templates/index.cjs +732 -0
- package/dist/utils/domain-templates/index.cjs.map +1 -0
- package/dist/utils/domain-templates/index.d.cts +214 -0
- package/dist/utils/domain-templates/index.d.ts +214 -0
- package/dist/utils/domain-templates/index.js +17 -0
- package/dist/utils/domain-templates/index.js.map +1 -0
- package/dist/utils/graphspec/index.cjs +1174 -0
- package/dist/utils/graphspec/index.cjs.map +1 -0
- package/dist/utils/graphspec/index.d.cts +449 -0
- package/dist/utils/graphspec/index.d.ts +449 -0
- package/dist/utils/graphspec/index.js +35 -0
- package/dist/utils/graphspec/index.js.map +1 -0
- package/dist/utils/harness/index.cjs +656 -0
- package/dist/utils/harness/index.cjs.map +1 -0
- package/dist/utils/harness/index.d.cts +542 -0
- package/dist/utils/harness/index.d.ts +542 -0
- package/dist/utils/harness/index.js +56 -0
- package/dist/utils/harness/index.js.map +1 -0
- package/dist/utils/index.cjs +17609 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +96 -0
- package/dist/utils/index.d.ts +96 -0
- package/dist/utils/index.js +514 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/inspect/index.cjs +807 -0
- package/dist/utils/inspect/index.cjs.map +1 -0
- package/dist/utils/inspect/index.d.cts +123 -0
- package/dist/utils/inspect/index.d.ts +123 -0
- package/dist/utils/inspect/index.js +30 -0
- package/dist/utils/inspect/index.js.map +1 -0
- package/dist/utils/job-queue/index.cjs +717 -0
- package/dist/utils/job-queue/index.cjs.map +1 -0
- package/dist/utils/job-queue/index.d.cts +200 -0
- package/dist/utils/job-queue/index.d.ts +200 -0
- package/dist/utils/job-queue/index.js +18 -0
- package/dist/utils/job-queue/index.js.map +1 -0
- package/dist/utils/memory/index.cjs +1451 -0
- package/dist/utils/memory/index.cjs.map +1 -0
- package/dist/utils/memory/index.d.cts +582 -0
- package/dist/utils/memory/index.d.ts +582 -0
- package/dist/utils/memory/index.js +19 -0
- package/dist/utils/memory/index.js.map +1 -0
- package/dist/utils/messaging/index.cjs +666 -0
- package/dist/utils/messaging/index.cjs.map +1 -0
- package/dist/utils/messaging/index.d.cts +562 -0
- package/dist/utils/messaging/index.d.ts +562 -0
- package/dist/utils/messaging/index.js +50 -0
- package/dist/utils/messaging/index.js.map +1 -0
- package/dist/utils/orchestration/index.cjs +876 -0
- package/dist/utils/orchestration/index.cjs.map +1 -0
- package/dist/utils/orchestration/index.d.cts +233 -0
- package/dist/utils/orchestration/index.d.ts +233 -0
- package/dist/utils/orchestration/index.js +19 -0
- package/dist/utils/orchestration/index.js.map +1 -0
- package/dist/utils/process/index.cjs +743 -0
- package/dist/utils/process/index.cjs.map +1 -0
- package/dist/utils/process/index.d.cts +411 -0
- package/dist/utils/process/index.d.ts +411 -0
- package/dist/utils/process/index.js +14 -0
- package/dist/utils/process/index.js.map +1 -0
- package/dist/utils/reactive-layout/index.cjs +1607 -0
- package/dist/utils/reactive-layout/index.cjs.map +1 -0
- package/dist/utils/reactive-layout/index.d.cts +492 -0
- package/dist/utils/reactive-layout/index.d.ts +492 -0
- package/dist/utils/reactive-layout/index.js +52 -0
- package/dist/utils/reactive-layout/index.js.map +1 -0
- package/dist/utils/reduction/index.cjs +203 -0
- package/dist/utils/reduction/index.cjs.map +1 -0
- package/dist/utils/reduction/index.d.cts +102 -0
- package/dist/utils/reduction/index.d.ts +102 -0
- package/dist/utils/reduction/index.js +14 -0
- package/dist/utils/reduction/index.js.map +1 -0
- package/dist/utils/resilience/index.cjs +1617 -0
- package/dist/utils/resilience/index.cjs.map +1 -0
- package/dist/utils/resilience/index.d.cts +9 -0
- package/dist/utils/resilience/index.d.ts +9 -0
- package/dist/utils/resilience/index.js +44 -0
- package/dist/utils/resilience/index.js.map +1 -0
- package/dist/utils/surface/index.cjs +1070 -0
- package/dist/utils/surface/index.cjs.map +1 -0
- package/dist/utils/surface/index.d.cts +240 -0
- package/dist/utils/surface/index.d.ts +240 -0
- package/dist/utils/surface/index.js +30 -0
- package/dist/utils/surface/index.js.map +1 -0
- package/dist/utils/topology-view/index.cjs +620 -0
- package/dist/utils/topology-view/index.cjs.map +1 -0
- package/dist/utils/topology-view/index.d.cts +68 -0
- package/dist/utils/topology-view/index.d.ts +68 -0
- package/dist/utils/topology-view/index.js +11 -0
- package/dist/utils/topology-view/index.js.map +1 -0
- package/package.json +293 -237
- package/dist/core/index.cjs +0 -21
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -3
- package/dist/core/index.js.map +0 -1
- package/dist/extra/browser.cjs +0 -21
- package/dist/extra/browser.cjs.map +0 -1
- package/dist/extra/browser.d.cts +0 -1
- package/dist/extra/browser.d.ts +0 -1
- package/dist/extra/browser.js +0 -3
- package/dist/extra/browser.js.map +0 -1
- package/dist/extra/index.cjs +0 -21
- package/dist/extra/index.cjs.map +0 -1
- package/dist/extra/index.d.cts +0 -1
- package/dist/extra/index.d.ts +0 -1
- package/dist/extra/index.js +0 -3
- package/dist/extra/index.js.map +0 -1
- package/dist/extra/node.cjs +0 -21
- package/dist/extra/node.cjs.map +0 -1
- package/dist/extra/node.d.cts +0 -1
- package/dist/extra/node.d.ts +0 -1
- package/dist/extra/node.js +0 -3
- package/dist/extra/node.js.map +0 -1
- package/dist/extra/operators.cjs +0 -21
- package/dist/extra/operators.cjs.map +0 -1
- package/dist/extra/operators.d.cts +0 -1
- package/dist/extra/operators.d.ts +0 -1
- package/dist/extra/operators.js +0 -3
- package/dist/extra/operators.js.map +0 -1
- package/dist/extra/reactive.cjs +0 -21
- package/dist/extra/reactive.cjs.map +0 -1
- package/dist/extra/reactive.d.cts +0 -1
- package/dist/extra/reactive.d.ts +0 -1
- package/dist/extra/reactive.js +0 -3
- package/dist/extra/reactive.js.map +0 -1
- package/dist/extra/render/index.cjs +0 -21
- package/dist/extra/render/index.cjs.map +0 -1
- package/dist/extra/render/index.d.cts +0 -1
- package/dist/extra/render/index.d.ts +0 -1
- package/dist/extra/render/index.js +0 -3
- package/dist/extra/render/index.js.map +0 -1
- package/dist/extra/sources.cjs +0 -21
- package/dist/extra/sources.cjs.map +0 -1
- package/dist/extra/sources.d.cts +0 -1
- package/dist/extra/sources.d.ts +0 -1
- package/dist/extra/sources.js +0 -3
- package/dist/extra/sources.js.map +0 -1
- package/dist/extra/storage-browser.cjs +0 -21
- package/dist/extra/storage-browser.cjs.map +0 -1
- package/dist/extra/storage-browser.d.cts +0 -1
- package/dist/extra/storage-browser.d.ts +0 -1
- package/dist/extra/storage-browser.js +0 -3
- package/dist/extra/storage-browser.js.map +0 -1
- package/dist/extra/storage-core.cjs +0 -21
- package/dist/extra/storage-core.cjs.map +0 -1
- package/dist/extra/storage-core.d.cts +0 -1
- package/dist/extra/storage-core.d.ts +0 -1
- package/dist/extra/storage-core.js +0 -3
- package/dist/extra/storage-core.js.map +0 -1
- package/dist/extra/storage-node.cjs +0 -21
- package/dist/extra/storage-node.cjs.map +0 -1
- package/dist/extra/storage-node.d.cts +0 -1
- package/dist/extra/storage-node.d.ts +0 -1
- package/dist/extra/storage-node.js +0 -3
- package/dist/extra/storage-node.js.map +0 -1
- package/dist/extra/storage-tiers-browser.cjs +0 -21
- package/dist/extra/storage-tiers-browser.cjs.map +0 -1
- package/dist/extra/storage-tiers-browser.d.cts +0 -1
- package/dist/extra/storage-tiers-browser.d.ts +0 -1
- package/dist/extra/storage-tiers-browser.js +0 -3
- package/dist/extra/storage-tiers-browser.js.map +0 -1
- package/dist/extra/storage-tiers-node.cjs +0 -21
- package/dist/extra/storage-tiers-node.cjs.map +0 -1
- package/dist/extra/storage-tiers-node.d.cts +0 -1
- package/dist/extra/storage-tiers-node.d.ts +0 -1
- package/dist/extra/storage-tiers-node.js +0 -3
- package/dist/extra/storage-tiers-node.js.map +0 -1
- package/dist/extra/storage-tiers.cjs +0 -21
- package/dist/extra/storage-tiers.cjs.map +0 -1
- package/dist/extra/storage-tiers.d.cts +0 -1
- package/dist/extra/storage-tiers.d.ts +0 -1
- package/dist/extra/storage-tiers.js +0 -3
- package/dist/extra/storage-tiers.js.map +0 -1
- package/dist/extra/storage-wal.cjs +0 -21
- package/dist/extra/storage-wal.cjs.map +0 -1
- package/dist/extra/storage-wal.d.cts +0 -1
- package/dist/extra/storage-wal.d.ts +0 -1
- package/dist/extra/storage-wal.js +0 -3
- package/dist/extra/storage-wal.js.map +0 -1
- package/dist/graph/index.cjs +0 -21
- package/dist/graph/index.cjs.map +0 -1
- package/dist/graph/index.d.cts +0 -1
- package/dist/graph/index.d.ts +0 -1
- package/dist/graph/index.js +0 -3
- package/dist/graph/index.js.map +0 -1
- package/dist/patterns/ai/browser.cjs +0 -21
- package/dist/patterns/ai/browser.cjs.map +0 -1
- package/dist/patterns/ai/browser.d.cts +0 -1
- package/dist/patterns/ai/browser.d.ts +0 -1
- package/dist/patterns/ai/browser.js +0 -3
- package/dist/patterns/ai/browser.js.map +0 -1
- package/dist/patterns/ai/index.cjs +0 -21
- package/dist/patterns/ai/index.cjs.map +0 -1
- package/dist/patterns/ai/index.d.cts +0 -1
- package/dist/patterns/ai/index.d.ts +0 -1
- package/dist/patterns/ai/index.js +0 -3
- package/dist/patterns/ai/index.js.map +0 -1
- package/dist/patterns/ai/node.cjs +0 -21
- package/dist/patterns/ai/node.cjs.map +0 -1
- package/dist/patterns/ai/node.d.cts +0 -1
- package/dist/patterns/ai/node.d.ts +0 -1
- package/dist/patterns/ai/node.js +0 -3
- package/dist/patterns/ai/node.js.map +0 -1
- package/dist/patterns/cqrs/index.cjs +0 -21
- package/dist/patterns/cqrs/index.cjs.map +0 -1
- package/dist/patterns/cqrs/index.d.cts +0 -1
- package/dist/patterns/cqrs/index.d.ts +0 -1
- package/dist/patterns/cqrs/index.js +0 -3
- package/dist/patterns/cqrs/index.js.map +0 -1
- package/dist/patterns/demo-shell/index.cjs +0 -21
- package/dist/patterns/demo-shell/index.cjs.map +0 -1
- package/dist/patterns/demo-shell/index.d.cts +0 -1
- package/dist/patterns/demo-shell/index.d.ts +0 -1
- package/dist/patterns/demo-shell/index.js +0 -3
- package/dist/patterns/demo-shell/index.js.map +0 -1
- package/dist/patterns/domain-templates/index.cjs +0 -21
- package/dist/patterns/domain-templates/index.cjs.map +0 -1
- package/dist/patterns/domain-templates/index.d.cts +0 -1
- package/dist/patterns/domain-templates/index.d.ts +0 -1
- package/dist/patterns/domain-templates/index.js +0 -3
- package/dist/patterns/domain-templates/index.js.map +0 -1
- package/dist/patterns/graphspec/index.cjs +0 -21
- package/dist/patterns/graphspec/index.cjs.map +0 -1
- package/dist/patterns/graphspec/index.d.cts +0 -1
- package/dist/patterns/graphspec/index.d.ts +0 -1
- package/dist/patterns/graphspec/index.js +0 -3
- package/dist/patterns/graphspec/index.js.map +0 -1
- package/dist/patterns/harness/index.cjs +0 -21
- package/dist/patterns/harness/index.cjs.map +0 -1
- package/dist/patterns/harness/index.d.cts +0 -1
- package/dist/patterns/harness/index.d.ts +0 -1
- package/dist/patterns/harness/index.js +0 -3
- package/dist/patterns/harness/index.js.map +0 -1
- package/dist/patterns/inspect/index.cjs +0 -21
- package/dist/patterns/inspect/index.cjs.map +0 -1
- package/dist/patterns/inspect/index.d.cts +0 -1
- package/dist/patterns/inspect/index.d.ts +0 -1
- package/dist/patterns/inspect/index.js +0 -3
- package/dist/patterns/inspect/index.js.map +0 -1
- package/dist/patterns/job-queue/index.cjs +0 -21
- package/dist/patterns/job-queue/index.cjs.map +0 -1
- package/dist/patterns/job-queue/index.d.cts +0 -1
- package/dist/patterns/job-queue/index.d.ts +0 -1
- package/dist/patterns/job-queue/index.js +0 -3
- package/dist/patterns/job-queue/index.js.map +0 -1
- package/dist/patterns/memory/index.cjs +0 -21
- package/dist/patterns/memory/index.cjs.map +0 -1
- package/dist/patterns/memory/index.d.cts +0 -1
- package/dist/patterns/memory/index.d.ts +0 -1
- package/dist/patterns/memory/index.js +0 -3
- package/dist/patterns/memory/index.js.map +0 -1
- package/dist/patterns/messaging/index.cjs +0 -21
- package/dist/patterns/messaging/index.cjs.map +0 -1
- package/dist/patterns/messaging/index.d.cts +0 -1
- package/dist/patterns/messaging/index.d.ts +0 -1
- package/dist/patterns/messaging/index.js +0 -3
- package/dist/patterns/messaging/index.js.map +0 -1
- package/dist/patterns/orchestration/index.cjs +0 -21
- package/dist/patterns/orchestration/index.cjs.map +0 -1
- package/dist/patterns/orchestration/index.d.cts +0 -1
- package/dist/patterns/orchestration/index.d.ts +0 -1
- package/dist/patterns/orchestration/index.js +0 -3
- package/dist/patterns/orchestration/index.js.map +0 -1
- package/dist/patterns/process/index.cjs +0 -21
- package/dist/patterns/process/index.cjs.map +0 -1
- package/dist/patterns/process/index.d.cts +0 -1
- package/dist/patterns/process/index.d.ts +0 -1
- package/dist/patterns/process/index.js +0 -3
- package/dist/patterns/process/index.js.map +0 -1
- package/dist/patterns/reactive-layout/index.cjs +0 -21
- package/dist/patterns/reactive-layout/index.cjs.map +0 -1
- package/dist/patterns/reactive-layout/index.d.cts +0 -1
- package/dist/patterns/reactive-layout/index.d.ts +0 -1
- package/dist/patterns/reactive-layout/index.js +0 -3
- package/dist/patterns/reactive-layout/index.js.map +0 -1
- package/dist/patterns/reduction/index.cjs +0 -21
- package/dist/patterns/reduction/index.cjs.map +0 -1
- package/dist/patterns/reduction/index.d.cts +0 -1
- package/dist/patterns/reduction/index.d.ts +0 -1
- package/dist/patterns/reduction/index.js +0 -3
- package/dist/patterns/reduction/index.js.map +0 -1
- package/dist/patterns/surface/index.cjs +0 -21
- package/dist/patterns/surface/index.cjs.map +0 -1
- package/dist/patterns/surface/index.d.cts +0 -1
- package/dist/patterns/surface/index.d.ts +0 -1
- package/dist/patterns/surface/index.js +0 -3
- package/dist/patterns/surface/index.js.map +0 -1
- package/dist/patterns/topology-view/index.cjs +0 -21
- package/dist/patterns/topology-view/index.cjs.map +0 -1
- package/dist/patterns/topology-view/index.d.cts +0 -1
- package/dist/patterns/topology-view/index.d.ts +0 -1
- package/dist/patterns/topology-view/index.js +0 -3
- package/dist/patterns/topology-view/index.js.map +0 -1
- package/dist/testing/index.cjs +0 -21
- package/dist/testing/index.cjs.map +0 -1
- package/dist/testing/index.d.cts +0 -1
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -3
- package/dist/testing/index.js.map +0 -1
|
@@ -0,0 +1,1120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/base/render/index.ts
|
|
21
|
+
var render_exports = {};
|
|
22
|
+
__export(render_exports, {
|
|
23
|
+
graphSpecToAscii: () => graphSpecToAscii,
|
|
24
|
+
graphSpecToD2: () => graphSpecToD2,
|
|
25
|
+
graphSpecToJson: () => graphSpecToJson,
|
|
26
|
+
graphSpecToMermaid: () => graphSpecToMermaid,
|
|
27
|
+
graphSpecToMermaidUrl: () => graphSpecToMermaidUrl,
|
|
28
|
+
graphSpecToPretty: () => graphSpecToPretty,
|
|
29
|
+
layoutFrameToSvg: () => layoutFrameToSvg,
|
|
30
|
+
mermaidLiveUrl: () => mermaidLiveUrl
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(render_exports);
|
|
33
|
+
|
|
34
|
+
// src/base/render/_ascii-width.ts
|
|
35
|
+
function cellWidth(code) {
|
|
36
|
+
if (code >= 768 && code <= 879 || // Combining Diacritical Marks
|
|
37
|
+
code >= 1155 && code <= 1161 || // Cyrillic combining marks
|
|
38
|
+
code >= 1425 && code <= 1469 || // Hebrew combining marks
|
|
39
|
+
code >= 1552 && code <= 1562 || // Arabic combining marks
|
|
40
|
+
code >= 1611 && code <= 1631 || // Arabic combining marks
|
|
41
|
+
code >= 1648 && code === 1648 || // Arabic superscript alef
|
|
42
|
+
code >= 1750 && code <= 1756 || // Arabic combining marks
|
|
43
|
+
code >= 1759 && code <= 1764 || // Arabic combining marks
|
|
44
|
+
code >= 1767 && code <= 1768 || // Arabic combining marks
|
|
45
|
+
code >= 1770 && code <= 1773 || // Arabic combining marks
|
|
46
|
+
code >= 1840 && code <= 1866 || // Syriac combining marks
|
|
47
|
+
code >= 1958 && code <= 1968 || // Thaana combining marks
|
|
48
|
+
code >= 2304 && code <= 2307 || // Devanagari combining marks
|
|
49
|
+
code >= 2362 && code <= 2383 || // Devanagari combining marks
|
|
50
|
+
code >= 2385 && code <= 2391 || // Devanagari combining marks
|
|
51
|
+
code >= 2402 && code <= 2403 || // Devanagari combining marks
|
|
52
|
+
code >= 2433 && code <= 2435 || // Bengali combining marks
|
|
53
|
+
code >= 2492 && code <= 2509 || // Bengali combining marks
|
|
54
|
+
code >= 2561 && code <= 2563 || // Gurmukhi combining marks
|
|
55
|
+
code >= 2620 && code <= 2641 || // Gurmukhi combining marks
|
|
56
|
+
code >= 2672 && code <= 2673 || // Gurmukhi combining marks
|
|
57
|
+
code >= 2677 && code === 2677 || // Gurmukhi combining mark
|
|
58
|
+
code >= 3633 && code === 3633 || // Thai combining mark
|
|
59
|
+
code >= 3636 && code <= 3642 || // Thai combining marks
|
|
60
|
+
code >= 3655 && code <= 3662 || // Thai combining marks
|
|
61
|
+
code >= 3761 && code === 3761 || // Lao combining mark
|
|
62
|
+
code >= 3764 && code <= 3772 || // Lao combining marks
|
|
63
|
+
code >= 3784 && code <= 3790 || // Lao combining marks
|
|
64
|
+
code >= 7616 && code <= 7679 || // Combining Diacritical Marks Supplement
|
|
65
|
+
code >= 8400 && code <= 8447 || // Combining Diacritical Marks for Symbols
|
|
66
|
+
code >= 65024 && code <= 65039 || // Variation Selectors
|
|
67
|
+
code >= 65056 && code <= 65071 || // Combining Half Marks
|
|
68
|
+
code === 8205) {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
if (code >= 4352 && code <= 4447 || // Hangul Jamo
|
|
72
|
+
code >= 8986 && code <= 8987 || // Watch, Hourglass
|
|
73
|
+
code >= 9001 && code <= 9002 || // Angle brackets
|
|
74
|
+
code >= 9193 && code <= 9203 || // Media control symbols
|
|
75
|
+
code >= 9208 && code <= 9210 || // Media control symbols
|
|
76
|
+
code >= 9725 && code <= 9726 || // Medium squares
|
|
77
|
+
code >= 9748 && code <= 9749 || // Umbrella, Hot Beverage
|
|
78
|
+
code >= 9800 && code <= 9811 || // Zodiac symbols
|
|
79
|
+
code === 9855 || // Wheelchair
|
|
80
|
+
code === 9875 || // Anchor
|
|
81
|
+
code === 9889 || // High Voltage
|
|
82
|
+
code >= 9898 && code <= 9899 || // Medium circles
|
|
83
|
+
code >= 9917 && code <= 9918 || // Soccer, Baseball
|
|
84
|
+
code >= 9924 && code <= 9925 || // Snowman, Sun behind cloud
|
|
85
|
+
code === 9934 || // Ophiuchus
|
|
86
|
+
code === 9940 || // No Entry
|
|
87
|
+
code === 9962 || // Church
|
|
88
|
+
code >= 9970 && code <= 9971 || // Fountain, Golf
|
|
89
|
+
code === 9973 || // Sailboat
|
|
90
|
+
code === 9978 || // Tent
|
|
91
|
+
code === 9981 || // Fuel Pump
|
|
92
|
+
code === 9986 || // Scissors
|
|
93
|
+
code === 9989 || // Check Mark
|
|
94
|
+
code >= 9992 && code <= 9997 || // Airplane...Writing Hand
|
|
95
|
+
code === 9999 || // Pencil
|
|
96
|
+
code >= 10067 && code <= 10069 || // Question marks
|
|
97
|
+
code === 10071 || // Exclamation
|
|
98
|
+
code >= 10133 && code <= 10135 || // Plus, Minus, Divide
|
|
99
|
+
code === 10160 || // Curly Loop
|
|
100
|
+
code === 10175 || // Double Curly Loop
|
|
101
|
+
code >= 10548 && code <= 10549 || // Arrows
|
|
102
|
+
code >= 11013 && code <= 11015 || // Arrows
|
|
103
|
+
code >= 11035 && code <= 11036 || // Squares
|
|
104
|
+
code === 11088 || // Star
|
|
105
|
+
code === 11093 || // Circle
|
|
106
|
+
code >= 11904 && code <= 12350 || // CJK Radicals, Symbols, Punctuation
|
|
107
|
+
code >= 12352 && code <= 12447 || // Hiragana
|
|
108
|
+
code >= 12448 && code <= 12543 || // Katakana
|
|
109
|
+
code >= 12549 && code <= 12591 || // Bopomofo
|
|
110
|
+
code >= 12593 && code <= 12686 || // Hangul Compatibility Jamo
|
|
111
|
+
code >= 12688 && code <= 12771 || // Kanbun, CJK Strokes
|
|
112
|
+
code >= 12784 && code <= 12830 || // Katakana Phonetic Extensions
|
|
113
|
+
code >= 12832 && code <= 12871 || // Enclosed CJK
|
|
114
|
+
code >= 12880 && code <= 19903 || // CJK Extensions + Unified block
|
|
115
|
+
code >= 19968 && code <= 40959 || // CJK Unified Ideographs
|
|
116
|
+
code >= 43360 && code <= 43388 || // Hangul Jamo Extended-A
|
|
117
|
+
code >= 44032 && code <= 55203 || // Hangul Syllables
|
|
118
|
+
code >= 63744 && code <= 64255 || // CJK Compatibility Ideographs
|
|
119
|
+
code >= 65040 && code <= 65049 || // Vertical forms
|
|
120
|
+
code >= 65072 && code <= 65131 || // CJK Compatibility Forms
|
|
121
|
+
code >= 65281 && code <= 65376 || // Fullwidth Forms (excl. halfwidth)
|
|
122
|
+
code >= 65504 && code <= 65510 || // Fullwidth Signs
|
|
123
|
+
code >= 126980 && code === 126980 || // Mahjong Red Dragon
|
|
124
|
+
code === 127183 || // Joker
|
|
125
|
+
code >= 127344 && code <= 127345 || // A/B buttons
|
|
126
|
+
code === 127358 || // O button
|
|
127
|
+
code === 127359 || // P button
|
|
128
|
+
code === 127374 || // AB button
|
|
129
|
+
code >= 127377 && code <= 127386 || // Squared symbols
|
|
130
|
+
code >= 127456 && code <= 127487 || // Regional Indicator Symbols
|
|
131
|
+
code >= 127488 && code <= 127490 || // Enclosed ideographic
|
|
132
|
+
code === 127514 || // Squared CJK
|
|
133
|
+
code === 127535 || // Squared CJK
|
|
134
|
+
code >= 127538 && code <= 127546 || // Squared CJK
|
|
135
|
+
code >= 127568 && code <= 127569 || // Circled ideographic
|
|
136
|
+
code >= 127744 && code <= 129535 || // Misc Symbols / Emoticons / Emoji
|
|
137
|
+
code >= 129536 && code <= 129791 || // Chess, Symbols Extended-A
|
|
138
|
+
code >= 129792 && code <= 130047 || // Symbols for Legacy Computing
|
|
139
|
+
code >= 131072 && code <= 196605 || // CJK Extension B-F (excl. nonchars)
|
|
140
|
+
code >= 196608 && code <= 262141) {
|
|
141
|
+
return 2;
|
|
142
|
+
}
|
|
143
|
+
return 1;
|
|
144
|
+
}
|
|
145
|
+
function countCells(text) {
|
|
146
|
+
let cells = 0;
|
|
147
|
+
for (const ch of text) {
|
|
148
|
+
cells += cellWidth(ch.codePointAt(0));
|
|
149
|
+
}
|
|
150
|
+
return cells;
|
|
151
|
+
}
|
|
152
|
+
function truncateToCells(text, maxCells) {
|
|
153
|
+
if (maxCells <= 0) return "";
|
|
154
|
+
let cells = 0;
|
|
155
|
+
let out = "";
|
|
156
|
+
for (const ch of text) {
|
|
157
|
+
const w = cellWidth(ch.codePointAt(0));
|
|
158
|
+
if (cells + w > maxCells) {
|
|
159
|
+
if (maxCells <= 1) return "\u2026";
|
|
160
|
+
while (cells + 1 > maxCells && out.length > 0) {
|
|
161
|
+
const last = [...out].pop();
|
|
162
|
+
out = out.slice(0, -last.length);
|
|
163
|
+
cells -= cellWidth(last.codePointAt(0));
|
|
164
|
+
}
|
|
165
|
+
return `${out}\u2026`;
|
|
166
|
+
}
|
|
167
|
+
out += ch;
|
|
168
|
+
cells += w;
|
|
169
|
+
}
|
|
170
|
+
return out;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// src/base/render/_ascii-grid.ts
|
|
174
|
+
var UNICODE = {
|
|
175
|
+
horizontal: "\u2500",
|
|
176
|
+
vertical: "\u2502",
|
|
177
|
+
cornerTL: "\u250C",
|
|
178
|
+
cornerTR: "\u2510",
|
|
179
|
+
cornerBL: "\u2514",
|
|
180
|
+
cornerBR: "\u2518",
|
|
181
|
+
tDown: "\u252C",
|
|
182
|
+
tUp: "\u2534",
|
|
183
|
+
tRight: "\u251C",
|
|
184
|
+
tLeft: "\u2524",
|
|
185
|
+
cross: "\u253C",
|
|
186
|
+
arrowRight: "\u25B6",
|
|
187
|
+
arrowDown: "\u25BC",
|
|
188
|
+
arrowLeft: "\u25C0",
|
|
189
|
+
arrowUp: "\u25B2",
|
|
190
|
+
boxTL: "\u250C",
|
|
191
|
+
boxTR: "\u2510",
|
|
192
|
+
boxBL: "\u2514",
|
|
193
|
+
boxBR: "\u2518",
|
|
194
|
+
boxH: "\u2500",
|
|
195
|
+
boxV: "\u2502"
|
|
196
|
+
};
|
|
197
|
+
var ASCII = {
|
|
198
|
+
horizontal: "-",
|
|
199
|
+
vertical: "|",
|
|
200
|
+
cornerTL: "+",
|
|
201
|
+
cornerTR: "+",
|
|
202
|
+
cornerBL: "+",
|
|
203
|
+
cornerBR: "+",
|
|
204
|
+
tDown: "+",
|
|
205
|
+
tUp: "+",
|
|
206
|
+
tRight: "+",
|
|
207
|
+
tLeft: "+",
|
|
208
|
+
cross: "+",
|
|
209
|
+
arrowRight: ">",
|
|
210
|
+
arrowDown: "v",
|
|
211
|
+
arrowLeft: "<",
|
|
212
|
+
arrowUp: "^",
|
|
213
|
+
boxTL: "+",
|
|
214
|
+
boxTR: "+",
|
|
215
|
+
boxBL: "+",
|
|
216
|
+
boxBR: "+",
|
|
217
|
+
boxH: "-",
|
|
218
|
+
boxV: "|"
|
|
219
|
+
};
|
|
220
|
+
function renderGrid(layout, options) {
|
|
221
|
+
const glyphs = options.charset === "ascii" ? ASCII : UNICODE;
|
|
222
|
+
const width = layout.width;
|
|
223
|
+
const height = layout.height;
|
|
224
|
+
const grid = Array.from(
|
|
225
|
+
{ length: height },
|
|
226
|
+
() => Array.from({ length: width }, () => " ")
|
|
227
|
+
);
|
|
228
|
+
const kind = Array.from(
|
|
229
|
+
{ length: height },
|
|
230
|
+
() => Array.from({ length: width }, () => "empty")
|
|
231
|
+
);
|
|
232
|
+
for (const edge of layout.edges) {
|
|
233
|
+
drawEdge(grid, kind, glyphs, edge);
|
|
234
|
+
}
|
|
235
|
+
for (const box of layout.boxes) {
|
|
236
|
+
drawBox(grid, kind, glyphs, box, options.labelOf(box.id));
|
|
237
|
+
}
|
|
238
|
+
return grid.map((row) => stripTrailing(row.join(""))).join("\n");
|
|
239
|
+
}
|
|
240
|
+
function drawBox(grid, kind, glyphs, box, label) {
|
|
241
|
+
const { x, y, w, h } = box;
|
|
242
|
+
if (w < 2 || h < 2) {
|
|
243
|
+
if (h > 0) writeLabel(grid, kind, x, y, w, label);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
putBoxCell(grid, kind, x, y, glyphs.boxTL);
|
|
247
|
+
for (let cx = x + 1; cx < x + w - 1; cx += 1) putBoxCell(grid, kind, cx, y, glyphs.boxH);
|
|
248
|
+
putBoxCell(grid, kind, x + w - 1, y, glyphs.boxTR);
|
|
249
|
+
for (let cy = y + 1; cy < y + h - 1; cy += 1) {
|
|
250
|
+
putBoxCell(grid, kind, x, cy, glyphs.boxV);
|
|
251
|
+
for (let cx = x + 1; cx < x + w - 1; cx += 1) {
|
|
252
|
+
putBoxCellAs(grid, kind, cx, cy, " ", "empty");
|
|
253
|
+
}
|
|
254
|
+
putBoxCell(grid, kind, x + w - 1, cy, glyphs.boxV);
|
|
255
|
+
}
|
|
256
|
+
putBoxCell(grid, kind, x, y + h - 1, glyphs.boxBL);
|
|
257
|
+
for (let cx = x + 1; cx < x + w - 1; cx += 1) putBoxCell(grid, kind, cx, y + h - 1, glyphs.boxH);
|
|
258
|
+
putBoxCell(grid, kind, x + w - 1, y + h - 1, glyphs.boxBR);
|
|
259
|
+
const midY = y + Math.floor(h / 2);
|
|
260
|
+
writeLabel(grid, kind, x + 1, midY, w - 2, label);
|
|
261
|
+
}
|
|
262
|
+
function putBoxCell(grid, kind, x, y, glyph) {
|
|
263
|
+
const k = glyph === " " ? "empty" : glyph === "\u2500" || glyph === "-" ? "boxH" : glyph === "\u2502" || glyph === "|" ? "boxV" : "boxCorner";
|
|
264
|
+
putBoxCellAs(grid, kind, x, y, glyph, k);
|
|
265
|
+
}
|
|
266
|
+
function putBoxCellAs(grid, kind, x, y, glyph, k) {
|
|
267
|
+
if (y < 0 || y >= grid.length) return;
|
|
268
|
+
const row = grid[y];
|
|
269
|
+
if (x < 0 || x >= row.length) return;
|
|
270
|
+
row[x] = glyph;
|
|
271
|
+
kind[y][x] = k;
|
|
272
|
+
}
|
|
273
|
+
function writeLabel(grid, kind, x, y, maxWidthCells, label) {
|
|
274
|
+
if (y < 0 || y >= grid.length) return;
|
|
275
|
+
let cursor = x;
|
|
276
|
+
let cellsLeft = maxWidthCells;
|
|
277
|
+
for (const ch of label) {
|
|
278
|
+
const cw = countCells(ch);
|
|
279
|
+
if (cw === 0) continue;
|
|
280
|
+
if (cellsLeft < cw) break;
|
|
281
|
+
if (cursor >= 0 && cursor < grid[y].length) {
|
|
282
|
+
grid[y][cursor] = ch;
|
|
283
|
+
kind[y][cursor] = "label";
|
|
284
|
+
if (cw === 2 && cursor + 1 < grid[y].length) {
|
|
285
|
+
grid[y][cursor + 1] = "";
|
|
286
|
+
kind[y][cursor + 1] = "label";
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
cursor += cw;
|
|
290
|
+
cellsLeft -= cw;
|
|
291
|
+
}
|
|
292
|
+
while (cellsLeft > 0) {
|
|
293
|
+
if (cursor >= 0 && cursor < grid[y].length) {
|
|
294
|
+
grid[y][cursor] = " ";
|
|
295
|
+
kind[y][cursor] = "empty";
|
|
296
|
+
}
|
|
297
|
+
cursor += 1;
|
|
298
|
+
cellsLeft -= 1;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function drawEdge(grid, kind, glyphs, edge) {
|
|
302
|
+
const pts = edge.points;
|
|
303
|
+
if (pts.length < 2) return;
|
|
304
|
+
for (let i = 0; i + 1 < pts.length; i += 1) {
|
|
305
|
+
drawSegment(grid, kind, glyphs, pts[i], pts[i + 1]);
|
|
306
|
+
}
|
|
307
|
+
for (let i = 1; i + 1 < pts.length; i += 1) {
|
|
308
|
+
const a = pts[i - 1];
|
|
309
|
+
const b = pts[i];
|
|
310
|
+
const c = pts[i + 1];
|
|
311
|
+
const corner = cornerGlyph(a, b, c, glyphs);
|
|
312
|
+
if (corner) putEdgeCell(grid, kind, b.x, b.y, corner, "edgeCorner");
|
|
313
|
+
}
|
|
314
|
+
const tip = pts[pts.length - 1];
|
|
315
|
+
const prev = pts[pts.length - 2];
|
|
316
|
+
const arrow = arrowGlyph(prev, tip, glyphs);
|
|
317
|
+
if (arrow) putEdgeCell(grid, kind, tip.x, tip.y, arrow, "arrow");
|
|
318
|
+
}
|
|
319
|
+
function drawSegment(grid, kind, glyphs, a, b) {
|
|
320
|
+
if (a.x === b.x && a.y === b.y) return;
|
|
321
|
+
if (a.y === b.y) {
|
|
322
|
+
const y = a.y;
|
|
323
|
+
const x0 = Math.min(a.x, b.x);
|
|
324
|
+
const x1 = Math.max(a.x, b.x);
|
|
325
|
+
for (let x = x0; x <= x1; x += 1) {
|
|
326
|
+
putEdgeLine(grid, kind, x, y, glyphs, "h");
|
|
327
|
+
}
|
|
328
|
+
} else if (a.x === b.x) {
|
|
329
|
+
const x = a.x;
|
|
330
|
+
const y0 = Math.min(a.y, b.y);
|
|
331
|
+
const y1 = Math.max(a.y, b.y);
|
|
332
|
+
for (let y = y0; y <= y1; y += 1) {
|
|
333
|
+
putEdgeLine(grid, kind, x, y, glyphs, "v");
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function putEdgeLine(grid, kind, x, y, glyphs, orientation) {
|
|
338
|
+
if (y < 0 || y >= grid.length) return;
|
|
339
|
+
const row = grid[y];
|
|
340
|
+
if (x < 0 || x >= row.length) return;
|
|
341
|
+
const existing = kind[y][x];
|
|
342
|
+
if (existing === "boxH" || existing === "boxV" || existing === "boxCorner" || existing === "label") {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (existing === "empty") {
|
|
346
|
+
row[x] = orientation === "h" ? glyphs.horizontal : glyphs.vertical;
|
|
347
|
+
kind[y][x] = orientation === "h" ? "edgeH" : "edgeV";
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (existing === "edgeH" && orientation === "v") {
|
|
351
|
+
row[x] = glyphs.cross;
|
|
352
|
+
kind[y][x] = "edgeCorner";
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (existing === "edgeV" && orientation === "h") {
|
|
356
|
+
row[x] = glyphs.cross;
|
|
357
|
+
kind[y][x] = "edgeCorner";
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function putEdgeCell(grid, kind, x, y, glyph, k) {
|
|
362
|
+
if (y < 0 || y >= grid.length) return;
|
|
363
|
+
const row = grid[y];
|
|
364
|
+
if (x < 0 || x >= row.length) return;
|
|
365
|
+
const existing = kind[y][x];
|
|
366
|
+
if (existing === "boxH" || existing === "boxV" || existing === "boxCorner" || existing === "label")
|
|
367
|
+
return;
|
|
368
|
+
row[x] = glyph;
|
|
369
|
+
kind[y][x] = k;
|
|
370
|
+
}
|
|
371
|
+
function cornerGlyph(a, b, c, glyphs) {
|
|
372
|
+
const inHoriz = a.y === b.y;
|
|
373
|
+
const outHoriz = b.y === c.y;
|
|
374
|
+
if (inHoriz === outHoriz) return void 0;
|
|
375
|
+
if (inHoriz) {
|
|
376
|
+
const fromLeft = a.x < b.x;
|
|
377
|
+
const goingDown = c.y > b.y;
|
|
378
|
+
if (fromLeft && goingDown) return glyphs.cornerTR;
|
|
379
|
+
if (fromLeft && !goingDown) return glyphs.cornerBR;
|
|
380
|
+
if (!fromLeft && goingDown) return glyphs.cornerTL;
|
|
381
|
+
return glyphs.cornerBL;
|
|
382
|
+
}
|
|
383
|
+
const fromAbove = a.y < b.y;
|
|
384
|
+
const goingRight = c.x > b.x;
|
|
385
|
+
if (fromAbove && goingRight) return glyphs.cornerBL;
|
|
386
|
+
if (fromAbove && !goingRight) return glyphs.cornerBR;
|
|
387
|
+
if (!fromAbove && goingRight) return glyphs.cornerTL;
|
|
388
|
+
return glyphs.cornerTR;
|
|
389
|
+
}
|
|
390
|
+
function arrowGlyph(prev, tip, glyphs) {
|
|
391
|
+
if (tip.x > prev.x) return glyphs.arrowRight;
|
|
392
|
+
if (tip.x < prev.x) return glyphs.arrowLeft;
|
|
393
|
+
if (tip.y > prev.y) return glyphs.arrowDown;
|
|
394
|
+
if (tip.y < prev.y) return glyphs.arrowUp;
|
|
395
|
+
return void 0;
|
|
396
|
+
}
|
|
397
|
+
function stripTrailing(line) {
|
|
398
|
+
let end = line.length;
|
|
399
|
+
while (end > 0 && line.charCodeAt(end - 1) === 32) end -= 1;
|
|
400
|
+
return line.slice(0, end);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// src/base/render/_layout-sugiyama.ts
|
|
404
|
+
function sugiyamaLayout(input) {
|
|
405
|
+
const state = buildInitial(input);
|
|
406
|
+
assignLayers(state);
|
|
407
|
+
insertVirtualNodes(state);
|
|
408
|
+
minimizeCrossings(state);
|
|
409
|
+
assignCoordinates(state, input);
|
|
410
|
+
const edges = routeEdges(state, input);
|
|
411
|
+
const { width, height } = boundingBox(state);
|
|
412
|
+
const boxes = [];
|
|
413
|
+
for (const layer of state.layers) {
|
|
414
|
+
for (const n of layer) {
|
|
415
|
+
if (n.isVirtual) continue;
|
|
416
|
+
boxes.push({
|
|
417
|
+
id: n.id,
|
|
418
|
+
layer: n.layer,
|
|
419
|
+
order: n.order,
|
|
420
|
+
x: n.x,
|
|
421
|
+
y: n.y,
|
|
422
|
+
w: n.w,
|
|
423
|
+
h: n.h
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return { boxes, edges, width, height };
|
|
428
|
+
}
|
|
429
|
+
function buildInitial(input) {
|
|
430
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
431
|
+
for (const id of input.nodes) {
|
|
432
|
+
nodes.set(id, {
|
|
433
|
+
id,
|
|
434
|
+
isVirtual: false,
|
|
435
|
+
layer: -1,
|
|
436
|
+
order: 0,
|
|
437
|
+
x: 0,
|
|
438
|
+
y: 0,
|
|
439
|
+
w: input.widthCells(id),
|
|
440
|
+
h: input.heightCells(id),
|
|
441
|
+
in: [],
|
|
442
|
+
out: []
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
const hops = [];
|
|
446
|
+
let chainId = 0;
|
|
447
|
+
for (const e of input.edges) {
|
|
448
|
+
if (e.from === e.to) continue;
|
|
449
|
+
const f = nodes.get(e.from);
|
|
450
|
+
const t = nodes.get(e.to);
|
|
451
|
+
if (!f || !t) continue;
|
|
452
|
+
const hop = {
|
|
453
|
+
chainId: chainId++,
|
|
454
|
+
chainFrom: e.from,
|
|
455
|
+
chainTo: e.to,
|
|
456
|
+
fromId: e.from,
|
|
457
|
+
toId: e.to,
|
|
458
|
+
hopIndex: 0,
|
|
459
|
+
chainLen: 1
|
|
460
|
+
};
|
|
461
|
+
f.out.push(hop);
|
|
462
|
+
t.in.push(hop);
|
|
463
|
+
hops.push(hop);
|
|
464
|
+
}
|
|
465
|
+
return { nodes, layers: [], hops };
|
|
466
|
+
}
|
|
467
|
+
function assignLayers(state) {
|
|
468
|
+
const indeg = /* @__PURE__ */ new Map();
|
|
469
|
+
for (const n of state.nodes.values()) indeg.set(n.id, n.in.length);
|
|
470
|
+
const queue = [];
|
|
471
|
+
for (const n of state.nodes.values()) {
|
|
472
|
+
if ((indeg.get(n.id) ?? 0) === 0) {
|
|
473
|
+
n.layer = 0;
|
|
474
|
+
queue.push(n);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
const visited = /* @__PURE__ */ new Set();
|
|
478
|
+
let head = 0;
|
|
479
|
+
while (head < queue.length) {
|
|
480
|
+
const n = queue[head++];
|
|
481
|
+
if (visited.has(n.id)) continue;
|
|
482
|
+
visited.add(n.id);
|
|
483
|
+
for (const hop of n.out) {
|
|
484
|
+
const t = state.nodes.get(hop.toId);
|
|
485
|
+
t.layer = Math.max(t.layer, n.layer + 1);
|
|
486
|
+
const d = (indeg.get(t.id) ?? 0) - 1;
|
|
487
|
+
indeg.set(t.id, d);
|
|
488
|
+
if (d <= 0) queue.push(t);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
for (const n of state.nodes.values()) if (n.layer < 0) n.layer = 0;
|
|
492
|
+
}
|
|
493
|
+
function insertVirtualNodes(state) {
|
|
494
|
+
const maxLayer = Math.max(0, ...Array.from(state.nodes.values(), (n) => n.layer));
|
|
495
|
+
const layers = Array.from({ length: maxLayer + 1 }, () => []);
|
|
496
|
+
for (const n of state.nodes.values()) layers[n.layer].push(n);
|
|
497
|
+
const newHops = [];
|
|
498
|
+
let virtCounter = 0;
|
|
499
|
+
for (const hop of state.hops) {
|
|
500
|
+
const f = state.nodes.get(hop.fromId);
|
|
501
|
+
const t = state.nodes.get(hop.toId);
|
|
502
|
+
const span = t.layer - f.layer;
|
|
503
|
+
if (span <= 0) {
|
|
504
|
+
f.out = f.out.filter((h) => h !== hop);
|
|
505
|
+
t.in = t.in.filter((h) => h !== hop);
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (span === 1) {
|
|
509
|
+
hop.hopIndex = 0;
|
|
510
|
+
hop.chainLen = 1;
|
|
511
|
+
newHops.push(hop);
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
f.out = f.out.filter((h) => h !== hop);
|
|
515
|
+
t.in = t.in.filter((h) => h !== hop);
|
|
516
|
+
let prev = f;
|
|
517
|
+
for (let i = 1; i < span; i += 1) {
|
|
518
|
+
const vid = `__virt_${virtCounter++}__`;
|
|
519
|
+
const v = {
|
|
520
|
+
id: vid,
|
|
521
|
+
isVirtual: true,
|
|
522
|
+
layer: f.layer + i,
|
|
523
|
+
order: 0,
|
|
524
|
+
x: 0,
|
|
525
|
+
y: 0,
|
|
526
|
+
w: 0,
|
|
527
|
+
h: 1,
|
|
528
|
+
in: [],
|
|
529
|
+
out: []
|
|
530
|
+
};
|
|
531
|
+
state.nodes.set(vid, v);
|
|
532
|
+
layers[v.layer].push(v);
|
|
533
|
+
const h = {
|
|
534
|
+
chainId: hop.chainId,
|
|
535
|
+
chainFrom: hop.chainFrom,
|
|
536
|
+
chainTo: hop.chainTo,
|
|
537
|
+
fromId: prev.id,
|
|
538
|
+
toId: vid,
|
|
539
|
+
hopIndex: i - 1,
|
|
540
|
+
chainLen: span
|
|
541
|
+
};
|
|
542
|
+
prev.out.push(h);
|
|
543
|
+
v.in.push(h);
|
|
544
|
+
newHops.push(h);
|
|
545
|
+
prev = v;
|
|
546
|
+
}
|
|
547
|
+
const finalHop = {
|
|
548
|
+
chainId: hop.chainId,
|
|
549
|
+
chainFrom: hop.chainFrom,
|
|
550
|
+
chainTo: hop.chainTo,
|
|
551
|
+
fromId: prev.id,
|
|
552
|
+
toId: t.id,
|
|
553
|
+
hopIndex: span - 1,
|
|
554
|
+
chainLen: span
|
|
555
|
+
};
|
|
556
|
+
prev.out.push(finalHop);
|
|
557
|
+
t.in.push(finalHop);
|
|
558
|
+
newHops.push(finalHop);
|
|
559
|
+
}
|
|
560
|
+
for (const layer of layers) {
|
|
561
|
+
for (let i = 0; i < layer.length; i += 1) layer[i].order = i;
|
|
562
|
+
}
|
|
563
|
+
state.layers = layers;
|
|
564
|
+
state.hops = newHops;
|
|
565
|
+
}
|
|
566
|
+
function minimizeCrossings(state) {
|
|
567
|
+
const SWEEPS = 4;
|
|
568
|
+
for (let sweep = 0; sweep < SWEEPS; sweep += 1) {
|
|
569
|
+
for (let li = 1; li < state.layers.length; li += 1) {
|
|
570
|
+
sortByBarycenter(state, state.layers[li], "in");
|
|
571
|
+
reindex(state.layers[li]);
|
|
572
|
+
}
|
|
573
|
+
for (let li = state.layers.length - 2; li >= 0; li -= 1) {
|
|
574
|
+
sortByBarycenter(state, state.layers[li], "out");
|
|
575
|
+
reindex(state.layers[li]);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
for (let iter = 0; iter < 2; iter += 1) {
|
|
579
|
+
let improved = false;
|
|
580
|
+
for (let li = 1; li < state.layers.length; li += 1) {
|
|
581
|
+
const layer = state.layers[li];
|
|
582
|
+
for (let i = 0; i + 1 < layer.length; i += 1) {
|
|
583
|
+
const before = pairCrossings(state, layer[i], layer[i + 1], "in");
|
|
584
|
+
[layer[i], layer[i + 1]] = [layer[i + 1], layer[i]];
|
|
585
|
+
reindex(layer);
|
|
586
|
+
const after = pairCrossings(state, layer[i], layer[i + 1], "in");
|
|
587
|
+
if (after < before) {
|
|
588
|
+
improved = true;
|
|
589
|
+
} else {
|
|
590
|
+
[layer[i], layer[i + 1]] = [layer[i + 1], layer[i]];
|
|
591
|
+
reindex(layer);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
if (!improved) break;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function sortByBarycenter(state, layer, direction) {
|
|
599
|
+
const bary = /* @__PURE__ */ new Map();
|
|
600
|
+
for (const n of layer) {
|
|
601
|
+
const neighbors = direction === "in" ? n.in : n.out;
|
|
602
|
+
if (neighbors.length === 0) {
|
|
603
|
+
bary.set(n.id, n.order);
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
let sum = 0;
|
|
607
|
+
let count = 0;
|
|
608
|
+
for (const h of neighbors) {
|
|
609
|
+
const other = state.nodes.get(direction === "in" ? h.fromId : h.toId);
|
|
610
|
+
if (!other) continue;
|
|
611
|
+
sum += other.order;
|
|
612
|
+
count += 1;
|
|
613
|
+
}
|
|
614
|
+
bary.set(n.id, count === 0 ? n.order : sum / count);
|
|
615
|
+
}
|
|
616
|
+
layer.sort((a, b) => {
|
|
617
|
+
const ba = bary.get(a.id);
|
|
618
|
+
const bb = bary.get(b.id);
|
|
619
|
+
if (ba !== bb) return ba - bb;
|
|
620
|
+
return a.order - b.order;
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
function reindex(layer) {
|
|
624
|
+
for (let i = 0; i < layer.length; i += 1) layer[i].order = i;
|
|
625
|
+
}
|
|
626
|
+
function pairCrossings(state, a, b, direction) {
|
|
627
|
+
const aEdges = direction === "in" ? a.in : a.out;
|
|
628
|
+
const bEdges = direction === "in" ? b.in : b.out;
|
|
629
|
+
let crossings = 0;
|
|
630
|
+
for (const ea of aEdges) {
|
|
631
|
+
for (const eb of bEdges) {
|
|
632
|
+
const oa = state.nodes.get(direction === "in" ? ea.fromId : ea.toId)?.order ?? 0;
|
|
633
|
+
const ob = state.nodes.get(direction === "in" ? eb.fromId : eb.toId)?.order ?? 0;
|
|
634
|
+
if (a.order < b.order && oa > ob || a.order > b.order && oa < ob) {
|
|
635
|
+
crossings += 1;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return crossings;
|
|
640
|
+
}
|
|
641
|
+
function assignCoordinates(state, input) {
|
|
642
|
+
if (input.direction === "LR") assignCoordinatesLR(state, input);
|
|
643
|
+
else assignCoordinatesTD(state, input);
|
|
644
|
+
}
|
|
645
|
+
function assignCoordinatesLR(state, input) {
|
|
646
|
+
const layerX = [];
|
|
647
|
+
let cursorX = 0;
|
|
648
|
+
for (let li = 0; li < state.layers.length; li += 1) {
|
|
649
|
+
layerX.push(cursorX);
|
|
650
|
+
let maxW = 0;
|
|
651
|
+
for (const n of state.layers[li]) maxW = Math.max(maxW, n.w);
|
|
652
|
+
cursorX += maxW + input.layerGap;
|
|
653
|
+
}
|
|
654
|
+
for (let li = 0; li < state.layers.length; li += 1) {
|
|
655
|
+
for (const n of state.layers[li]) n.x = layerX[li];
|
|
656
|
+
}
|
|
657
|
+
for (const layer of state.layers) {
|
|
658
|
+
let y = 0;
|
|
659
|
+
for (const n of layer) {
|
|
660
|
+
n.y = y;
|
|
661
|
+
y += n.h + input.nodeGap;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
runMedianPasses(state, input, "y");
|
|
665
|
+
}
|
|
666
|
+
function assignCoordinatesTD(state, input) {
|
|
667
|
+
const layerY = [];
|
|
668
|
+
let cursorY = 0;
|
|
669
|
+
for (let li = 0; li < state.layers.length; li += 1) {
|
|
670
|
+
layerY.push(cursorY);
|
|
671
|
+
let maxH = 0;
|
|
672
|
+
for (const n of state.layers[li]) maxH = Math.max(maxH, n.h);
|
|
673
|
+
cursorY += maxH + input.layerGap;
|
|
674
|
+
}
|
|
675
|
+
for (let li = 0; li < state.layers.length; li += 1) {
|
|
676
|
+
for (const n of state.layers[li]) n.y = layerY[li];
|
|
677
|
+
}
|
|
678
|
+
for (const layer of state.layers) {
|
|
679
|
+
let x = 0;
|
|
680
|
+
for (const n of layer) {
|
|
681
|
+
n.x = x;
|
|
682
|
+
x += n.w + input.nodeGap;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
runMedianPasses(state, input, "x");
|
|
686
|
+
}
|
|
687
|
+
function runMedianPasses(state, input, axis) {
|
|
688
|
+
const sizeOf = (n) => axis === "y" ? n.h : n.w;
|
|
689
|
+
const gap = input.nodeGap;
|
|
690
|
+
for (let pass = 0; pass < 2; pass += 1) {
|
|
691
|
+
const walk = pass === 0 ? state.layers.slice(1) : state.layers.slice(0, -1).reverse();
|
|
692
|
+
for (const layer of walk) {
|
|
693
|
+
const preferred = /* @__PURE__ */ new Map();
|
|
694
|
+
for (const n of layer) {
|
|
695
|
+
const neighbors = pass === 0 ? n.in : n.out;
|
|
696
|
+
if (neighbors.length === 0) continue;
|
|
697
|
+
const centers = [];
|
|
698
|
+
for (const h of neighbors) {
|
|
699
|
+
const other = state.nodes.get(pass === 0 ? h.fromId : h.toId);
|
|
700
|
+
if (!other) continue;
|
|
701
|
+
const base = axis === "y" ? other.y : other.x;
|
|
702
|
+
centers.push(base + Math.floor(sizeOf(other) / 2));
|
|
703
|
+
}
|
|
704
|
+
if (centers.length === 0) continue;
|
|
705
|
+
centers.sort((a, b) => a - b);
|
|
706
|
+
const mid = centers[Math.floor(centers.length / 2)];
|
|
707
|
+
preferred.set(n.id, mid - Math.floor(sizeOf(n) / 2));
|
|
708
|
+
}
|
|
709
|
+
let floor = 0;
|
|
710
|
+
for (const n of layer) {
|
|
711
|
+
const p = preferred.get(n.id);
|
|
712
|
+
const current = axis === "y" ? n.y : n.x;
|
|
713
|
+
const target = p ?? current;
|
|
714
|
+
const clamped = Math.max(target, floor);
|
|
715
|
+
if (axis === "y") n.y = clamped;
|
|
716
|
+
else n.x = clamped;
|
|
717
|
+
floor = clamped + sizeOf(n) + gap;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
function routeEdges(state, input) {
|
|
723
|
+
const byChain = /* @__PURE__ */ new Map();
|
|
724
|
+
for (const h of state.hops) {
|
|
725
|
+
const arr = byChain.get(h.chainId);
|
|
726
|
+
if (arr) arr.push(h);
|
|
727
|
+
else byChain.set(h.chainId, [h]);
|
|
728
|
+
}
|
|
729
|
+
for (const arr of byChain.values()) arr.sort((a, b) => a.hopIndex - b.hopIndex);
|
|
730
|
+
const isLR = input.direction === "LR";
|
|
731
|
+
const primary = (n) => isLR ? n.x : n.y;
|
|
732
|
+
const primarySize = (n) => isLR ? n.w : n.h;
|
|
733
|
+
const crossCenter = (n) => isLR ? n.y + Math.floor(n.h / 2) : n.x + Math.floor(n.w / 2);
|
|
734
|
+
const hopTrackCross = /* @__PURE__ */ new Map();
|
|
735
|
+
for (let g = 0; g + 1 < state.layers.length; g += 1) {
|
|
736
|
+
const srcLayer = state.layers[g];
|
|
737
|
+
const dstLayer = state.layers[g + 1];
|
|
738
|
+
let gutterStart = 0;
|
|
739
|
+
for (const n of srcLayer) gutterStart = Math.max(gutterStart, primary(n) + primarySize(n));
|
|
740
|
+
let gutterEnd = Number.POSITIVE_INFINITY;
|
|
741
|
+
for (const n of dstLayer) gutterEnd = Math.min(gutterEnd, primary(n));
|
|
742
|
+
const gEnd = Number.isFinite(gutterEnd) ? gutterEnd - 1 : gutterStart;
|
|
743
|
+
const gutterWidth = Math.max(1, gEnd - gutterStart + 1);
|
|
744
|
+
const gutterHops = [];
|
|
745
|
+
for (const n of srcLayer) for (const h of n.out) gutterHops.push(h);
|
|
746
|
+
gutterHops.sort((a, b) => {
|
|
747
|
+
const sa = crossCenter(state.nodes.get(a.fromId));
|
|
748
|
+
const sb = crossCenter(state.nodes.get(b.fromId));
|
|
749
|
+
if (sa !== sb) return sa - sb;
|
|
750
|
+
const da = crossCenter(state.nodes.get(a.toId));
|
|
751
|
+
const db = crossCenter(state.nodes.get(b.toId));
|
|
752
|
+
return da - db;
|
|
753
|
+
});
|
|
754
|
+
const tracks = [];
|
|
755
|
+
const hopToTrackIdx = /* @__PURE__ */ new Map();
|
|
756
|
+
for (const h of gutterHops) {
|
|
757
|
+
const sc = crossCenter(state.nodes.get(h.fromId));
|
|
758
|
+
const dc = crossCenter(state.nodes.get(h.toId));
|
|
759
|
+
const lo = Math.min(sc, dc);
|
|
760
|
+
const hi = Math.max(sc, dc);
|
|
761
|
+
let idx = -1;
|
|
762
|
+
for (let t = 0; t < tracks.length; t += 1) {
|
|
763
|
+
const intervals = tracks[t];
|
|
764
|
+
let fits = true;
|
|
765
|
+
for (const iv of intervals) {
|
|
766
|
+
if (iv.lo <= hi && lo <= iv.hi) {
|
|
767
|
+
fits = false;
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
if (fits) {
|
|
772
|
+
intervals.push({ lo, hi });
|
|
773
|
+
idx = t;
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
if (idx < 0) {
|
|
778
|
+
tracks.push([{ lo, hi }]);
|
|
779
|
+
idx = tracks.length - 1;
|
|
780
|
+
}
|
|
781
|
+
hopToTrackIdx.set(h, idx);
|
|
782
|
+
}
|
|
783
|
+
const count = tracks.length;
|
|
784
|
+
const hasMargin = gutterWidth >= Math.max(3, count + 2);
|
|
785
|
+
const usableStart = hasMargin ? gutterStart + 1 : gutterStart;
|
|
786
|
+
const usableEnd = hasMargin ? gEnd - 1 : gEnd;
|
|
787
|
+
const usableWidth = Math.max(1, usableEnd - usableStart + 1);
|
|
788
|
+
for (const h of gutterHops) {
|
|
789
|
+
const idx = hopToTrackIdx.get(h);
|
|
790
|
+
let trackPrimary;
|
|
791
|
+
if (count <= 1) {
|
|
792
|
+
trackPrimary = usableStart + Math.floor(usableWidth / 2);
|
|
793
|
+
} else {
|
|
794
|
+
const step = (usableWidth - 1) / (count - 1);
|
|
795
|
+
trackPrimary = usableStart + Math.floor(idx * step);
|
|
796
|
+
}
|
|
797
|
+
hopTrackCross.set(h, Math.max(gutterStart, Math.min(gEnd, trackPrimary)));
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
const out = [];
|
|
801
|
+
for (const [, hops] of byChain) {
|
|
802
|
+
const points = [];
|
|
803
|
+
for (let i = 0; i < hops.length; i += 1) {
|
|
804
|
+
const h = hops[i];
|
|
805
|
+
const src = state.nodes.get(h.fromId);
|
|
806
|
+
const dst = state.nodes.get(h.toId);
|
|
807
|
+
const track = hopTrackCross.get(h);
|
|
808
|
+
const srcPrimary = src.isVirtual ? primary(src) : primary(src) + primarySize(src);
|
|
809
|
+
const dstPrimary = dst.isVirtual ? primary(dst) : primary(dst) - 1;
|
|
810
|
+
const sc = crossCenter(src);
|
|
811
|
+
const dc = crossCenter(dst);
|
|
812
|
+
if (i === 0) pushPoint(points, isLR, srcPrimary, sc);
|
|
813
|
+
if (sc !== dc) {
|
|
814
|
+
pushPoint(points, isLR, track, sc);
|
|
815
|
+
pushPoint(points, isLR, track, dc);
|
|
816
|
+
}
|
|
817
|
+
pushPoint(points, isLR, dstPrimary, dc);
|
|
818
|
+
}
|
|
819
|
+
const chain = hops[0];
|
|
820
|
+
out.push({
|
|
821
|
+
from: chain.chainFrom,
|
|
822
|
+
to: chain.chainTo,
|
|
823
|
+
points: dedupWaypoints(points)
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
return out;
|
|
827
|
+
}
|
|
828
|
+
function pushPoint(acc, isLR, primary, cross) {
|
|
829
|
+
acc.push(isLR ? { x: primary, y: cross } : { x: cross, y: primary });
|
|
830
|
+
}
|
|
831
|
+
function dedupWaypoints(points) {
|
|
832
|
+
const out = [];
|
|
833
|
+
for (const p of points) {
|
|
834
|
+
const last = out[out.length - 1];
|
|
835
|
+
if (!last || last.x !== p.x || last.y !== p.y) out.push(p);
|
|
836
|
+
}
|
|
837
|
+
return out;
|
|
838
|
+
}
|
|
839
|
+
function boundingBox(state) {
|
|
840
|
+
let w = 0;
|
|
841
|
+
let h = 0;
|
|
842
|
+
for (const layer of state.layers) {
|
|
843
|
+
for (const n of layer) {
|
|
844
|
+
w = Math.max(w, n.x + n.w);
|
|
845
|
+
h = Math.max(h, n.y + n.h);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return { width: w, height: h };
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// src/base/render/graph-spec-to-ascii.ts
|
|
852
|
+
var DEFAULT_LABEL_WIDTH = 24;
|
|
853
|
+
var LAYER_GAP = 4;
|
|
854
|
+
var NODE_GAP = 1;
|
|
855
|
+
var BOX_HEIGHT = 3;
|
|
856
|
+
function graphSpecToAscii(g, opts) {
|
|
857
|
+
const direction = normalizeAsciiDirection(opts?.direction);
|
|
858
|
+
const maxLabel = Math.max(3, opts?.maxLabelWidth ?? DEFAULT_LABEL_WIDTH);
|
|
859
|
+
const charset = opts?.asciiCharset ?? "unicode";
|
|
860
|
+
const paths = Object.keys(g.nodes).sort();
|
|
861
|
+
const nodeSet = new Set(paths);
|
|
862
|
+
const edges = g.edges.filter((e) => nodeSet.has(e.from) && nodeSet.has(e.to));
|
|
863
|
+
const labels = /* @__PURE__ */ new Map();
|
|
864
|
+
const widths = /* @__PURE__ */ new Map();
|
|
865
|
+
for (const p of paths) {
|
|
866
|
+
const label = truncateToCells(p, maxLabel);
|
|
867
|
+
labels.set(p, label);
|
|
868
|
+
widths.set(p, countCells(label) + 4);
|
|
869
|
+
}
|
|
870
|
+
const layout = sugiyamaLayout({
|
|
871
|
+
nodes: paths,
|
|
872
|
+
edges,
|
|
873
|
+
widthCells: (id) => widths.get(id) ?? 3,
|
|
874
|
+
heightCells: () => BOX_HEIGHT,
|
|
875
|
+
layerGap: LAYER_GAP,
|
|
876
|
+
nodeGap: NODE_GAP,
|
|
877
|
+
direction
|
|
878
|
+
});
|
|
879
|
+
const text = renderGrid(layout, {
|
|
880
|
+
charset,
|
|
881
|
+
labelOf: (id) => labels.get(id) ?? id
|
|
882
|
+
});
|
|
883
|
+
opts?.logger?.(text);
|
|
884
|
+
return text;
|
|
885
|
+
}
|
|
886
|
+
function normalizeAsciiDirection(direction) {
|
|
887
|
+
if (direction === void 0 || direction === "LR") return "LR";
|
|
888
|
+
if (direction === "TD") return "TD";
|
|
889
|
+
throw new Error(`ascii describe supports direction "LR" or "TD" only; got ${String(direction)}`);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// src/base/render/_internal.ts
|
|
893
|
+
function sortJsonValue(value) {
|
|
894
|
+
if (value === null || typeof value !== "object") {
|
|
895
|
+
return value;
|
|
896
|
+
}
|
|
897
|
+
if (Array.isArray(value)) {
|
|
898
|
+
return value.map(sortJsonValue);
|
|
899
|
+
}
|
|
900
|
+
const obj = value;
|
|
901
|
+
const keys = Object.keys(obj).sort();
|
|
902
|
+
const out = {};
|
|
903
|
+
for (const k of keys) {
|
|
904
|
+
out[k] = sortJsonValue(obj[k]);
|
|
905
|
+
}
|
|
906
|
+
return out;
|
|
907
|
+
}
|
|
908
|
+
function escapeMermaidLabel(value) {
|
|
909
|
+
return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
910
|
+
}
|
|
911
|
+
function escapeD2Label(value) {
|
|
912
|
+
return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
913
|
+
}
|
|
914
|
+
function d2DirectionFromGraphDirection(direction) {
|
|
915
|
+
if (direction === "TD") return "down";
|
|
916
|
+
if (direction === "BT") return "up";
|
|
917
|
+
if (direction === "RL") return "left";
|
|
918
|
+
return "right";
|
|
919
|
+
}
|
|
920
|
+
function collectDiagramArrows(described) {
|
|
921
|
+
const seen = /* @__PURE__ */ new Set();
|
|
922
|
+
const arrows = [];
|
|
923
|
+
function add(from, to) {
|
|
924
|
+
const key = `${from}\0${to}`;
|
|
925
|
+
if (seen.has(key)) return;
|
|
926
|
+
seen.add(key);
|
|
927
|
+
arrows.push([from, to]);
|
|
928
|
+
}
|
|
929
|
+
for (const [path, info] of Object.entries(described.nodes)) {
|
|
930
|
+
const deps = info.deps;
|
|
931
|
+
if (deps) {
|
|
932
|
+
for (const dep of deps) add(dep, path);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
for (const edge of described.edges) add(edge.from, edge.to);
|
|
936
|
+
return arrows;
|
|
937
|
+
}
|
|
938
|
+
function normalizeDiagramDirection(direction) {
|
|
939
|
+
if (direction === void 0) return "LR";
|
|
940
|
+
if (direction === "TD" || direction === "LR" || direction === "BT" || direction === "RL") {
|
|
941
|
+
return direction;
|
|
942
|
+
}
|
|
943
|
+
throw new Error(
|
|
944
|
+
`invalid diagram direction ${String(direction)}; expected one of: TD, LR, BT, RL`
|
|
945
|
+
);
|
|
946
|
+
}
|
|
947
|
+
function describeData(value) {
|
|
948
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
949
|
+
if (typeof value === "number" || typeof value === "boolean" || value == null)
|
|
950
|
+
return String(value);
|
|
951
|
+
try {
|
|
952
|
+
return JSON.stringify(value);
|
|
953
|
+
} catch {
|
|
954
|
+
return "[unserializable]";
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// src/base/render/graph-spec-to-d2.ts
|
|
959
|
+
function graphSpecToD2(g, opts) {
|
|
960
|
+
const direction = normalizeDiagramDirection(opts?.direction);
|
|
961
|
+
const paths = Object.keys(g.nodes).sort();
|
|
962
|
+
const ids = /* @__PURE__ */ new Map();
|
|
963
|
+
for (let i = 0; i < paths.length; i += 1) ids.set(paths[i], `n${i}`);
|
|
964
|
+
const lines = [`direction: ${d2DirectionFromGraphDirection(direction)}`];
|
|
965
|
+
for (const path of paths) {
|
|
966
|
+
const id = ids.get(path);
|
|
967
|
+
lines.push(`${id}: "${escapeD2Label(path)}"`);
|
|
968
|
+
}
|
|
969
|
+
for (const [from, to] of collectDiagramArrows(g)) {
|
|
970
|
+
const fromId = ids.get(from);
|
|
971
|
+
const toId = ids.get(to);
|
|
972
|
+
if (!fromId || !toId) continue;
|
|
973
|
+
lines.push(`${fromId} -> ${toId}`);
|
|
974
|
+
}
|
|
975
|
+
return lines.join("\n");
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// src/base/render/graph-spec-to-json.ts
|
|
979
|
+
function graphSpecToJson(g, opts) {
|
|
980
|
+
const includeEdges = opts?.includeEdges ?? true;
|
|
981
|
+
const includeSubgraphs = opts?.includeSubgraphs ?? true;
|
|
982
|
+
const { expand: _expand, ...rest } = g;
|
|
983
|
+
const payload = {
|
|
984
|
+
...rest,
|
|
985
|
+
edges: includeEdges ? g.edges : [],
|
|
986
|
+
subgraphs: includeSubgraphs ? g.subgraphs : []
|
|
987
|
+
};
|
|
988
|
+
const text = JSON.stringify(sortJsonValue(payload), null, opts?.indent ?? 2);
|
|
989
|
+
opts?.logger?.(text);
|
|
990
|
+
return text;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// src/base/render/graph-spec-to-mermaid.ts
|
|
994
|
+
function graphSpecToMermaid(g, opts) {
|
|
995
|
+
const direction = normalizeDiagramDirection(opts?.direction);
|
|
996
|
+
const paths = Object.keys(g.nodes).sort();
|
|
997
|
+
const ids = /* @__PURE__ */ new Map();
|
|
998
|
+
for (let i = 0; i < paths.length; i += 1) ids.set(paths[i], `n${i}`);
|
|
999
|
+
const lines = [`flowchart ${direction}`];
|
|
1000
|
+
for (const path of paths) {
|
|
1001
|
+
const id = ids.get(path);
|
|
1002
|
+
lines.push(` ${id}["${escapeMermaidLabel(path)}"]`);
|
|
1003
|
+
}
|
|
1004
|
+
for (const [from, to] of collectDiagramArrows(g)) {
|
|
1005
|
+
const fromId = ids.get(from);
|
|
1006
|
+
const toId = ids.get(to);
|
|
1007
|
+
if (!fromId || !toId) continue;
|
|
1008
|
+
lines.push(` ${fromId} --> ${toId}`);
|
|
1009
|
+
}
|
|
1010
|
+
return lines.join("\n");
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
// src/base/render/graph-spec-to-mermaid-url.ts
|
|
1014
|
+
function mermaidLiveUrl(mermaidSrc, opts) {
|
|
1015
|
+
const theme = opts?.theme ?? "default";
|
|
1016
|
+
const autoSync = opts?.autoSync ?? true;
|
|
1017
|
+
const payload = { code: mermaidSrc, mermaid: { theme }, autoSync };
|
|
1018
|
+
const json = JSON.stringify(payload);
|
|
1019
|
+
const bytes = new TextEncoder().encode(json);
|
|
1020
|
+
let binary = "";
|
|
1021
|
+
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
|
|
1022
|
+
const b64 = globalThis.btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1023
|
+
return `https://mermaid.live/edit#base64:${b64}`;
|
|
1024
|
+
}
|
|
1025
|
+
function graphSpecToMermaidUrl(g, opts) {
|
|
1026
|
+
const mermaidSrc = graphSpecToMermaid(g, opts);
|
|
1027
|
+
return mermaidLiveUrl(mermaidSrc, opts);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// src/base/render/graph-spec-to-pretty.ts
|
|
1031
|
+
function graphSpecToPretty(g, opts) {
|
|
1032
|
+
const includeEdges = opts?.includeEdges ?? true;
|
|
1033
|
+
const includeSubgraphs = opts?.includeSubgraphs ?? true;
|
|
1034
|
+
const lines = [];
|
|
1035
|
+
lines.push(`Graph ${g.name}`);
|
|
1036
|
+
lines.push("Nodes:");
|
|
1037
|
+
for (const path of Object.keys(g.nodes).sort()) {
|
|
1038
|
+
const n = g.nodes[path];
|
|
1039
|
+
lines.push(`- ${path} (${n.type}/${n.status}): ${describeData(n.value)}`);
|
|
1040
|
+
}
|
|
1041
|
+
if (includeEdges) {
|
|
1042
|
+
lines.push("Edges:");
|
|
1043
|
+
for (const edge of g.edges) {
|
|
1044
|
+
lines.push(`- ${edge.from} -> ${edge.to}`);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
if (includeSubgraphs) {
|
|
1048
|
+
lines.push("Subgraphs:");
|
|
1049
|
+
for (const sg of g.subgraphs) {
|
|
1050
|
+
lines.push(`- ${sg}`);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
const text = lines.join("\n");
|
|
1054
|
+
opts?.logger?.(text);
|
|
1055
|
+
return text;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
// src/base/render/layout-frame-to-svg.ts
|
|
1059
|
+
var SPECIAL_CHARS = {
|
|
1060
|
+
"&": "&",
|
|
1061
|
+
"<": "<",
|
|
1062
|
+
">": ">",
|
|
1063
|
+
'"': """,
|
|
1064
|
+
"'": "'"
|
|
1065
|
+
};
|
|
1066
|
+
function escapeXml(s) {
|
|
1067
|
+
return s.replace(/[&<>"']/g, (c) => SPECIAL_CHARS[c] ?? c);
|
|
1068
|
+
}
|
|
1069
|
+
function layoutFrameToSvg(frame, opts) {
|
|
1070
|
+
const cellW = opts?.cellWidth ?? 12;
|
|
1071
|
+
const cellH = opts?.cellHeight ?? 18;
|
|
1072
|
+
const pad = opts?.padding ?? 16;
|
|
1073
|
+
const boxStroke = escapeXml(opts?.boxStroke ?? "#444");
|
|
1074
|
+
const boxFill = escapeXml(opts?.boxFill ?? "#fff");
|
|
1075
|
+
const edgeStroke = escapeXml(opts?.edgeStroke ?? "#888");
|
|
1076
|
+
const textColor = escapeXml(opts?.textColor ?? "#111");
|
|
1077
|
+
const fontFamily = opts?.fontFamily ?? "ui-monospace, monospace";
|
|
1078
|
+
const fontSize = opts?.fontSize ?? 12;
|
|
1079
|
+
let maxX = 0;
|
|
1080
|
+
let maxY = 0;
|
|
1081
|
+
for (const b of frame.boxes) {
|
|
1082
|
+
maxX = Math.max(maxX, b.x + b.w);
|
|
1083
|
+
maxY = Math.max(maxY, b.y + b.h);
|
|
1084
|
+
}
|
|
1085
|
+
for (const e of frame.edges) {
|
|
1086
|
+
for (const [x, y] of e.points) {
|
|
1087
|
+
maxX = Math.max(maxX, x);
|
|
1088
|
+
maxY = Math.max(maxY, y);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
const width = Math.max(1, maxX) * cellW + pad * 2;
|
|
1092
|
+
const height = Math.max(1, maxY) * cellH + pad * 2;
|
|
1093
|
+
const lines = [];
|
|
1094
|
+
lines.push(
|
|
1095
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" width="${width}" height="${height}">`
|
|
1096
|
+
);
|
|
1097
|
+
for (const e of frame.edges) {
|
|
1098
|
+
if (e.points.length < 2) continue;
|
|
1099
|
+
const pts = e.points.map(([x, y]) => `${x * cellW + pad},${y * cellH + pad}`).join(" ");
|
|
1100
|
+
lines.push(
|
|
1101
|
+
` <polyline points="${pts}" fill="none" stroke="${edgeStroke}" stroke-width="1" data-from="${escapeXml(e.from)}" data-to="${escapeXml(e.to)}" data-dep-index="${e.depIndex}" />`
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
for (const b of frame.boxes) {
|
|
1105
|
+
const px = b.x * cellW + pad;
|
|
1106
|
+
const py = b.y * cellH + pad;
|
|
1107
|
+
const pw = Math.max(1, b.w) * cellW;
|
|
1108
|
+
const ph = Math.max(1, b.h) * cellH;
|
|
1109
|
+
const local = b.id.includes("::") ? b.id.split("::").pop() ?? b.id : b.id;
|
|
1110
|
+
lines.push(
|
|
1111
|
+
` <g data-id="${escapeXml(b.id)}">`,
|
|
1112
|
+
` <rect x="${px}" y="${py}" width="${pw}" height="${ph}" fill="${boxFill}" stroke="${boxStroke}" stroke-width="1" />`,
|
|
1113
|
+
` <text x="${px + pw / 2}" y="${py + ph / 2}" fill="${textColor}" font-family="${escapeXml(fontFamily)}" font-size="${fontSize}" text-anchor="middle" dominant-baseline="central">${escapeXml(local)}</text>`,
|
|
1114
|
+
` </g>`
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
lines.push("</svg>");
|
|
1118
|
+
return lines.join("\n");
|
|
1119
|
+
}
|
|
1120
|
+
//# sourceMappingURL=index.cjs.map
|