research-copilot 0.1.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/LICENSE +21 -0
- package/README.md +190 -0
- package/app/build/icon.icns +0 -0
- package/app/build/icon.ico +0 -0
- package/app/build/icon.png +0 -0
- package/app/out/main/index.mjs +6719 -0
- package/app/out/preload/index.js +141 -0
- package/app/out/renderer/assets/Inter-Variable-Latin-8kRkwJBP.woff2 +0 -0
- package/app/out/renderer/assets/Inter-Variable-LatinExt-B_-bZUTo.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/app/out/renderer/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/app/out/renderer/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/app/out/renderer/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/app/out/renderer/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/app/out/renderer/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/app/out/renderer/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/app/out/renderer/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/app/out/renderer/assets/MilkdownMarkdownEditor-bLPxrCVb.js +89821 -0
- package/app/out/renderer/assets/MilkdownMarkdownEditor-tTNRIB2K.css +2555 -0
- package/app/out/renderer/assets/Tableau10-BqnYsPR6.js +9 -0
- package/app/out/renderer/assets/apl-fqmucPXA.js +140 -0
- package/app/out/renderer/assets/arc-J47ePHZ2.js +132 -0
- package/app/out/renderer/assets/array-DgktLKBx.js +6 -0
- package/app/out/renderer/assets/asciiarmor-DucZyvP0.js +56 -0
- package/app/out/renderer/assets/asn1-BnOEsgAm.js +144 -0
- package/app/out/renderer/assets/asterisk-QAlztEwS.js +345 -0
- package/app/out/renderer/assets/blockDiagram-c4efeb88-5uRQXgQJ.js +1817 -0
- package/app/out/renderer/assets/brainfuck-DZVCuF_t.js +53 -0
- package/app/out/renderer/assets/c4Diagram-c83219d4-C4iCTPEL.js +2464 -0
- package/app/out/renderer/assets/channel-ZAmhHE3g.js +7 -0
- package/app/out/renderer/assets/classDiagram-beda092f-7NOZxq_W.js +357 -0
- package/app/out/renderer/assets/classDiagram-v2-2358418a-5fPT-cUH.js +291 -0
- package/app/out/renderer/assets/clike-xqXYL6ge.js +805 -0
- package/app/out/renderer/assets/clojure-BhXMqnxz.js +849 -0
- package/app/out/renderer/assets/clone-CsnzsYXQ.js +8 -0
- package/app/out/renderer/assets/cmake-BGaNd9E7.js +71 -0
- package/app/out/renderer/assets/cobol-4yqQntpt.js +120 -0
- package/app/out/renderer/assets/coffeescript-D2dXvhEc.js +308 -0
- package/app/out/renderer/assets/commonlisp-CF_VNHQR.js +130 -0
- package/app/out/renderer/assets/createText-1719965b-Cji7KN4K.js +4904 -0
- package/app/out/renderer/assets/crystal-DyuLTqLs.js +398 -0
- package/app/out/renderer/assets/css-c-jst79C.js +1783 -0
- package/app/out/renderer/assets/cypher-Dlu_3r4V.js +121 -0
- package/app/out/renderer/assets/d-UURgV0Ux.js +179 -0
- package/app/out/renderer/assets/diff-B_Bi2Crb.js +25 -0
- package/app/out/renderer/assets/dockerfile-Bvk733Ga.js +201 -0
- package/app/out/renderer/assets/dtd-Dy74G54E.js +114 -0
- package/app/out/renderer/assets/dylan-TSb-Nfix.js +314 -0
- package/app/out/renderer/assets/ebnf-DAomQUbD.js +139 -0
- package/app/out/renderer/assets/ecl-B59qGGVg.js +178 -0
- package/app/out/renderer/assets/edges-96097737-CD0EvAZQ.js +1844 -0
- package/app/out/renderer/assets/eiffel-Dze7nlu3.js +134 -0
- package/app/out/renderer/assets/elm-DG7jkhNZ.js +176 -0
- package/app/out/renderer/assets/erDiagram-0228fc6a-DRYXBpi7.js +1321 -0
- package/app/out/renderer/assets/erlang-BO6gOnGA.js +674 -0
- package/app/out/renderer/assets/factor-CMxFHDqz.js +65 -0
- package/app/out/renderer/assets/fcl-CDDUNjTj.js +141 -0
- package/app/out/renderer/assets/flowDb-c6c81e3f-CuoIN-Cy.js +1713 -0
- package/app/out/renderer/assets/flowDiagram-50d868cf-CPWPLOml.js +1272 -0
- package/app/out/renderer/assets/flowDiagram-v2-4f6560a1-C_R12s4S.js +33 -0
- package/app/out/renderer/assets/flowchart-elk-definition-6af322e1-BdKUSFpi.js +92921 -0
- package/app/out/renderer/assets/forth-B9D2JCeE.js +116 -0
- package/app/out/renderer/assets/fortran-CAG2BFbe.js +467 -0
- package/app/out/renderer/assets/ganttDiagram-a2739b55-ygqT5HlG.js +3399 -0
- package/app/out/renderer/assets/gas-d3KEcW3x.js +294 -0
- package/app/out/renderer/assets/gherkin-DhZlEZiy.js +115 -0
- package/app/out/renderer/assets/gitGraphDiagram-82fe8481-D97GT4iA.js +1791 -0
- package/app/out/renderer/assets/graph-DpC13d95.js +1237 -0
- package/app/out/renderer/assets/groovy-CpwJiBl7.js +223 -0
- package/app/out/renderer/assets/haskell-BlGBCCe3.js +459 -0
- package/app/out/renderer/assets/haxe-7MlzfeYV.js +514 -0
- package/app/out/renderer/assets/http-BqypyemW.js +79 -0
- package/app/out/renderer/assets/idl-4HIGJlDI.js +985 -0
- package/app/out/renderer/assets/index-4-ziknCv.js +292 -0
- package/app/out/renderer/assets/index-5325376f-Bbs7Fbqr.js +663 -0
- package/app/out/renderer/assets/index-B2jip-rk.js +2489 -0
- package/app/out/renderer/assets/index-BKTVfokE.js +312 -0
- package/app/out/renderer/assets/index-BiJbFgVG.js +118 -0
- package/app/out/renderer/assets/index-Bn433Fat.js +83 -0
- package/app/out/renderer/assets/index-BqDyyRCx.js +39679 -0
- package/app/out/renderer/assets/index-BzFMeMPn.js +158 -0
- package/app/out/renderer/assets/index-C-_uCjZJ.css +2701 -0
- package/app/out/renderer/assets/index-C1ithNW1.js +1765 -0
- package/app/out/renderer/assets/index-CAJkRYkO.js +407 -0
- package/app/out/renderer/assets/index-CleO0-yj.js +690 -0
- package/app/out/renderer/assets/index-Cq4MH3sY.js +1020 -0
- package/app/out/renderer/assets/index-CtA0Xj22.js +705 -0
- package/app/out/renderer/assets/index-CvAZkqBZ.js +83 -0
- package/app/out/renderer/assets/index-D3UDN-5c.js +152 -0
- package/app/out/renderer/assets/index-D4F9R5ao.js +179 -0
- package/app/out/renderer/assets/index-D6RguhZ5.js +328 -0
- package/app/out/renderer/assets/index-DnEowqXv.js +386 -0
- package/app/out/renderer/assets/index-K8c8Mqdy.js +98 -0
- package/app/out/renderer/assets/index-Kh14gO6K.js +62 -0
- package/app/out/renderer/assets/index-WFd2jRnA.js +333 -0
- package/app/out/renderer/assets/index-WgMfkRFp.js +313 -0
- package/app/out/renderer/assets/index-Y4lKyF6t.js +1042 -0
- package/app/out/renderer/assets/index-fx307_f1.js +643 -0
- package/app/out/renderer/assets/infoDiagram-8eee0895-ptaVSwzq.js +511 -0
- package/app/out/renderer/assets/init-ZxktEp_H.js +16 -0
- package/app/out/renderer/assets/javascript-C3MnDRiU.js +994 -0
- package/app/out/renderer/assets/journeyDiagram-c64418c1-aloEGOQp.js +1184 -0
- package/app/out/renderer/assets/julia-Bs6JJhYG.js +407 -0
- package/app/out/renderer/assets/layout-ZeuHE_aY.js +2217 -0
- package/app/out/renderer/assets/line-CAgaGl-S.js +45 -0
- package/app/out/renderer/assets/linear-DIg7lTe1.js +539 -0
- package/app/out/renderer/assets/livescript-DmzgM3Yt.js +296 -0
- package/app/out/renderer/assets/lua-8cJgIlqe.js +256 -0
- package/app/out/renderer/assets/mathematica-DNLOL9PQ.js +110 -0
- package/app/out/renderer/assets/mbox-Ga7d4MMN.js +117 -0
- package/app/out/renderer/assets/mindmap-definition-8da855dc-B8XVoUxz.js +36054 -0
- package/app/out/renderer/assets/mirc-Dma3B8rS.js +107 -0
- package/app/out/renderer/assets/mllike-DHn7xckP.js +334 -0
- package/app/out/renderer/assets/modelica-0d55jYY0.js +147 -0
- package/app/out/renderer/assets/mscgen-DdqZYINH.js +135 -0
- package/app/out/renderer/assets/mumps-Btr8VblO.js +93 -0
- package/app/out/renderer/assets/nginx-DTDtBDVN.js +141 -0
- package/app/out/renderer/assets/nsis-3zG7tgur.js +62 -0
- package/app/out/renderer/assets/ntriples-CvgOYMpL.js +153 -0
- package/app/out/renderer/assets/octave-DYBj3-tl.js +200 -0
- package/app/out/renderer/assets/ordinal-DSZU4PqD.js +76 -0
- package/app/out/renderer/assets/oz-R_e8WMIi.js +231 -0
- package/app/out/renderer/assets/pascal-GD8iposT.js +105 -0
- package/app/out/renderer/assets/path-Cp2qmpkd.js +109 -0
- package/app/out/renderer/assets/perl-DL9mHpoi.js +1105 -0
- package/app/out/renderer/assets/pieDiagram-a8764435-DlwoeBU2.js +770 -0
- package/app/out/renderer/assets/pig-C_4T4YIV.js +101 -0
- package/app/out/renderer/assets/powershell-B0suO7Vd.js +328 -0
- package/app/out/renderer/assets/properties-BR-vP1aU.js +58 -0
- package/app/out/renderer/assets/protobuf-BxgpyhoW.js +77 -0
- package/app/out/renderer/assets/pug-By0kVCfm.js +405 -0
- package/app/out/renderer/assets/puppet-Bdao66PW.js +137 -0
- package/app/out/renderer/assets/python-CvWbmiX4.js +427 -0
- package/app/out/renderer/assets/q-CrbCVq4a.js +131 -0
- package/app/out/renderer/assets/quadrantDiagram-1e28029f-BaSi1XB4.js +1200 -0
- package/app/out/renderer/assets/r-V7nswm59.js +170 -0
- package/app/out/renderer/assets/requirementDiagram-08caed73-D3EFyegZ.js +1092 -0
- package/app/out/renderer/assets/rpm-C-DLY-If.js +109 -0
- package/app/out/renderer/assets/ruby-JDKLJNK0.js +330 -0
- package/app/out/renderer/assets/sankeyDiagram-a04cb91d-Cv44AsnM.js +1174 -0
- package/app/out/renderer/assets/sas-D2UG-yhZ.js +207 -0
- package/app/out/renderer/assets/scheme-BKzrkGJD.js +222 -0
- package/app/out/renderer/assets/sequenceDiagram-c5b8d532-CuUBu-x4.js +3337 -0
- package/app/out/renderer/assets/shell-BlsXDxCn.js +222 -0
- package/app/out/renderer/assets/sieve-CjwBwOY5.js +135 -0
- package/app/out/renderer/assets/simple-mode-DMneyfDu.js +130 -0
- package/app/out/renderer/assets/smalltalk-BOIGQuhN.js +121 -0
- package/app/out/renderer/assets/solr-CwD7U71z.js +69 -0
- package/app/out/renderer/assets/sparql-DYskk2vE.js +249 -0
- package/app/out/renderer/assets/spreadsheet-Bgtt3oLP.js +87 -0
- package/app/out/renderer/assets/sql-BSrOzCRI.js +354 -0
- package/app/out/renderer/assets/stateDiagram-1ecb1508-BOU34Zp4.js +454 -0
- package/app/out/renderer/assets/stateDiagram-v2-c2b004d7-BgRoffou.js +326 -0
- package/app/out/renderer/assets/stex-B6LNC55o.js +231 -0
- package/app/out/renderer/assets/styles-b4e223ce-BMr9TPuj.js +1483 -0
- package/app/out/renderer/assets/styles-ca3715f6-DgbNw99p.js +1363 -0
- package/app/out/renderer/assets/styles-d45a18b0-DtRYKYKf.js +574 -0
- package/app/out/renderer/assets/stylus-BkS-boTH.js +565 -0
- package/app/out/renderer/assets/svgDrawCommon-b86b1483-Bein03PD.js +100 -0
- package/app/out/renderer/assets/swift-FRZi1uvB.js +291 -0
- package/app/out/renderer/assets/tcl-CUcaCdmq.js +114 -0
- package/app/out/renderer/assets/textile-BnFpjsrl.js +414 -0
- package/app/out/renderer/assets/tiddlywiki-CjprD-Qp.js +218 -0
- package/app/out/renderer/assets/tiki-B4EPSQ1G.js +265 -0
- package/app/out/renderer/assets/timeline-definition-faaaa080-BlWpLE_4.js +1212 -0
- package/app/out/renderer/assets/toml-BOuWGMcf.js +76 -0
- package/app/out/renderer/assets/troff-E1bJ0PPL.js +61 -0
- package/app/out/renderer/assets/ttcn-cfg-Dc39-fIP.js +133 -0
- package/app/out/renderer/assets/ttcn-tKd4HLu4.js +192 -0
- package/app/out/renderer/assets/turtle-Dq7-1WAf.js +124 -0
- package/app/out/renderer/assets/vb-Dp90gtsv.js +196 -0
- package/app/out/renderer/assets/vbscript-CI6_mxxU.js +479 -0
- package/app/out/renderer/assets/velocity-BwIZK1TH.js +149 -0
- package/app/out/renderer/assets/verilog-DDCYnHN8.js +430 -0
- package/app/out/renderer/assets/vhdl-DCkMIyT9.js +158 -0
- package/app/out/renderer/assets/webidl-BTLTThCm.js +204 -0
- package/app/out/renderer/assets/xquery-BgiOC5Ce.js +525 -0
- package/app/out/renderer/assets/xychartDiagram-f5964ef8-Bhga-YXm.js +1799 -0
- package/app/out/renderer/assets/yacas-b5lAVEIl.js +130 -0
- package/app/out/renderer/assets/z80-BZV19vqv.js +93 -0
- package/app/out/renderer/index.html +13 -0
- package/app/out/skills/community-builtin/README.md +29 -0
- package/app/out/skills/community-builtin/document-docx/SKILL.md +44 -0
- package/app/out/skills/community-builtin/document-docx/scripts/docx-to-markdown.sh +20 -0
- package/app/out/skills/community-builtin/document-docx/scripts/extract-docx-text.sh +28 -0
- package/app/out/skills/community-builtin/document-docx/scripts/init-docx-template.sh +32 -0
- package/app/out/skills/community-builtin/document-docx/scripts/setup-docx-tools.sh +10 -0
- package/app/out/skills/community-builtin/markitdown/SKILL.md +105 -0
- package/app/out/skills/community-builtin/markitdown/scripts/batch-convert.sh +40 -0
- package/app/out/skills/community-builtin/markitdown/scripts/convert-file.sh +24 -0
- package/app/out/skills/community-builtin/markitdown/scripts/setup-markitdown.sh +10 -0
- package/app/out/skills/community-builtin/repo-quick-audit/SKILL.md +27 -0
- package/app/out/skills/community-builtin/repo-quick-audit/scripts/audit-basics.sh +19 -0
- package/app/out/skills/research-pilot-default-project-skills/README.md +23 -0
- package/app/out/skills/research-pilot-default-project-skills/citation-management/SKILL.md +39 -0
- package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/doi-to-bibtex.sh +25 -0
- package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/normalize-bibtex-keys.sh +51 -0
- package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/setup-citation-tools.sh +10 -0
- package/app/out/skills/research-pilot-default-project-skills/citation-management/scripts/validate-bib.sh +31 -0
- package/app/out/skills/research-pilot-default-project-skills/matplotlib/SKILL.md +34 -0
- package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/api_reference.md +412 -0
- package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/common_issues.md +563 -0
- package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/plot_types.md +476 -0
- package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/styling_guide.md +589 -0
- package/app/out/skills/research-pilot-default-project-skills/matplotlib/references/subagent_quickstart.md +30 -0
- package/app/out/skills/research-pilot-default-project-skills/matplotlib/scripts/plot_template.py +401 -0
- package/app/out/skills/research-pilot-default-project-skills/matplotlib/scripts/style_configurator.py +409 -0
- package/app/out/skills/research-pilot-default-project-skills/research-grants/SKILL.md +38 -0
- package/app/out/skills/research-pilot-default-project-skills/research-grants/scripts/check-grant-compliance.sh +40 -0
- package/app/out/skills/research-pilot-default-project-skills/research-grants/scripts/grant-summary-card.sh +32 -0
- package/app/out/skills/research-pilot-default-project-skills/research-grants/scripts/init-grant-structure.sh +70 -0
- package/app/package.json +77 -0
- package/bin/cli.mjs +56 -0
- package/lib/README.md +145 -0
- package/lib/skills/_generated.ts +13 -0
- package/lib/skills/builtin/brainstorming-research-ideas/SKILL.md +280 -0
- package/lib/skills/builtin/coding/SKILL.md +114 -0
- package/lib/skills/builtin/creative-thinking-for-research/SKILL.md +273 -0
- package/lib/skills/builtin/matplotlib/SKILL.md +361 -0
- package/lib/skills/builtin/matplotlib/references/api_reference.md +412 -0
- package/lib/skills/builtin/matplotlib/references/common_issues.md +563 -0
- package/lib/skills/builtin/matplotlib/references/plot_types.md +476 -0
- package/lib/skills/builtin/matplotlib/references/styling_guide.md +589 -0
- package/lib/skills/builtin/matplotlib/scripts/plot_template.py +401 -0
- package/lib/skills/builtin/matplotlib/scripts/style_configurator.py +409 -0
- package/lib/skills/builtin/paper-writing/SKILL.md +554 -0
- package/lib/skills/builtin/paper-writing/references/checklists.md +524 -0
- package/lib/skills/builtin/paper-writing/references/citation-workflow.md +562 -0
- package/lib/skills/builtin/paper-writing/references/reviewer-guidelines.md +462 -0
- package/lib/skills/builtin/paper-writing/references/sources.md +189 -0
- package/lib/skills/builtin/paper-writing/references/systems-conferences.md +260 -0
- package/lib/skills/builtin/paper-writing/references/writing-guide.md +476 -0
- package/lib/skills/builtin/paper-writing/templates/README.md +408 -0
- package/lib/skills/builtin/paper-writing/templates/aaai2026/README.md +534 -0
- package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026-unified-supp.tex +144 -0
- package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026-unified-template.tex +952 -0
- package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026.bib +111 -0
- package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026.bst +1493 -0
- package/lib/skills/builtin/paper-writing/templates/aaai2026/aaai2026.sty +315 -0
- package/lib/skills/builtin/paper-writing/templates/acl/README.md +50 -0
- package/lib/skills/builtin/paper-writing/templates/acl/acl.sty +312 -0
- package/lib/skills/builtin/paper-writing/templates/acl/acl_latex.tex +377 -0
- package/lib/skills/builtin/paper-writing/templates/acl/acl_lualatex.tex +101 -0
- package/lib/skills/builtin/paper-writing/templates/acl/acl_natbib.bst +1940 -0
- package/lib/skills/builtin/paper-writing/templates/acl/anthology.bib.txt +26 -0
- package/lib/skills/builtin/paper-writing/templates/acl/custom.bib +70 -0
- package/lib/skills/builtin/paper-writing/templates/acl/formatting.md +326 -0
- package/lib/skills/builtin/paper-writing/templates/asplos2027/main.tex +459 -0
- package/lib/skills/builtin/paper-writing/templates/asplos2027/references.bib +135 -0
- package/lib/skills/builtin/paper-writing/templates/colm2025/README.md +3 -0
- package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.bib +11 -0
- package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.bst +1440 -0
- package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.pdf +0 -0
- package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.sty +218 -0
- package/lib/skills/builtin/paper-writing/templates/colm2025/colm2025_conference.tex +305 -0
- package/lib/skills/builtin/paper-writing/templates/colm2025/fancyhdr.sty +485 -0
- package/lib/skills/builtin/paper-writing/templates/colm2025/math_commands.tex +508 -0
- package/lib/skills/builtin/paper-writing/templates/colm2025/natbib.sty +1246 -0
- package/lib/skills/builtin/paper-writing/templates/iclr2026/fancyhdr.sty +485 -0
- package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.bib +24 -0
- package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.bst +1440 -0
- package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.pdf +0 -0
- package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.sty +246 -0
- package/lib/skills/builtin/paper-writing/templates/iclr2026/iclr2026_conference.tex +414 -0
- package/lib/skills/builtin/paper-writing/templates/iclr2026/math_commands.tex +508 -0
- package/lib/skills/builtin/paper-writing/templates/iclr2026/natbib.sty +1246 -0
- package/lib/skills/builtin/paper-writing/templates/icml2026/algorithm.sty +79 -0
- package/lib/skills/builtin/paper-writing/templates/icml2026/algorithmic.sty +201 -0
- package/lib/skills/builtin/paper-writing/templates/icml2026/example_paper.bib +75 -0
- package/lib/skills/builtin/paper-writing/templates/icml2026/example_paper.pdf +0 -0
- package/lib/skills/builtin/paper-writing/templates/icml2026/example_paper.tex +662 -0
- package/lib/skills/builtin/paper-writing/templates/icml2026/fancyhdr.sty +864 -0
- package/lib/skills/builtin/paper-writing/templates/icml2026/icml2026.bst +1443 -0
- package/lib/skills/builtin/paper-writing/templates/icml2026/icml2026.sty +767 -0
- package/lib/skills/builtin/paper-writing/templates/icml2026/icml_numpapers.pdf +0 -0
- package/lib/skills/builtin/paper-writing/templates/neurips2025/Makefile +36 -0
- package/lib/skills/builtin/paper-writing/templates/neurips2025/extra_pkgs.tex +53 -0
- package/lib/skills/builtin/paper-writing/templates/neurips2025/main.tex +38 -0
- package/lib/skills/builtin/paper-writing/templates/neurips2025/neurips.sty +382 -0
- package/lib/skills/builtin/paper-writing/templates/nsdi2027/main.tex +426 -0
- package/lib/skills/builtin/paper-writing/templates/nsdi2027/references.bib +151 -0
- package/lib/skills/builtin/paper-writing/templates/nsdi2027/usenix-2020-09.sty +83 -0
- package/lib/skills/builtin/paper-writing/templates/osdi2026/main.tex +429 -0
- package/lib/skills/builtin/paper-writing/templates/osdi2026/references.bib +150 -0
- package/lib/skills/builtin/paper-writing/templates/osdi2026/usenix-2020-09.sty +83 -0
- package/lib/skills/builtin/paper-writing/templates/sosp2026/main.tex +532 -0
- package/lib/skills/builtin/paper-writing/templates/sosp2026/references.bib +148 -0
- package/lib/skills/builtin/research-grants/SKILL.md +958 -0
- package/lib/skills/builtin/research-grants/assets/budget_justification_template.md +453 -0
- package/lib/skills/builtin/research-grants/assets/nih_specific_aims_template.md +166 -0
- package/lib/skills/builtin/research-grants/assets/nsf_project_summary_template.md +92 -0
- package/lib/skills/builtin/research-grants/references/README.md +285 -0
- package/lib/skills/builtin/research-grants/references/broader_impacts.md +392 -0
- package/lib/skills/builtin/research-grants/references/darpa_guidelines.md +636 -0
- package/lib/skills/builtin/research-grants/references/doe_guidelines.md +586 -0
- package/lib/skills/builtin/research-grants/references/nih_guidelines.md +851 -0
- package/lib/skills/builtin/research-grants/references/nsf_guidelines.md +570 -0
- package/lib/skills/builtin/research-grants/references/nstc_guidelines.md +733 -0
- package/lib/skills/builtin/research-grants/references/specific_aims_guide.md +458 -0
- package/lib/skills/builtin/rewrite-humanize/SKILL.md +116 -0
- package/lib/skills/builtin/rewrite-humanize/references/cs-venue-tone.md +57 -0
- package/lib/skills/builtin/rewrite-humanize/references/lexicon.md +50 -0
- package/lib/skills/builtin/scholar-evaluation/SKILL.md +300 -0
- package/lib/skills/builtin/scholar-evaluation/references/evaluation_framework.md +663 -0
- package/lib/skills/builtin/scholar-evaluation/scripts/calculate_scores.py +379 -0
- package/lib/skills/builtin/scientific-schematics/SKILL.md +603 -0
- package/lib/skills/builtin/scientific-schematics/references/QUICK_REFERENCE.md +182 -0
- package/lib/skills/builtin/scientific-schematics/references/README.md +292 -0
- package/lib/skills/builtin/scientific-schematics/references/best_practices.md +560 -0
- package/lib/skills/builtin/scientific-schematics/scripts/__pycache__/generate_schematic.cpython-312.pyc +0 -0
- package/lib/skills/builtin/scientific-schematics/scripts/__pycache__/generate_schematic_ai.cpython-312.pyc +0 -0
- package/lib/skills/builtin/scientific-schematics/scripts/example_usage.sh +85 -0
- package/lib/skills/builtin/scientific-schematics/scripts/generate_schematic.py +141 -0
- package/lib/skills/builtin/scientific-schematics/scripts/generate_schematic_ai.py +910 -0
- package/lib/skills/builtin/scientific-visualization/SKILL.md +749 -0
- package/lib/skills/builtin/scientific-visualization/assets/color_palettes.py +197 -0
- package/lib/skills/builtin/scientific-visualization/assets/nature.mplstyle +63 -0
- package/lib/skills/builtin/scientific-visualization/assets/presentation.mplstyle +61 -0
- package/lib/skills/builtin/scientific-visualization/assets/publication.mplstyle +68 -0
- package/lib/skills/builtin/scientific-visualization/references/color_palettes.md +348 -0
- package/lib/skills/builtin/scientific-visualization/references/journal_requirements.md +320 -0
- package/lib/skills/builtin/scientific-visualization/references/matplotlib_examples.md +620 -0
- package/lib/skills/builtin/scientific-visualization/references/publication_guidelines.md +205 -0
- package/lib/skills/builtin/scientific-visualization/scripts/figure_export.py +343 -0
- package/lib/skills/builtin/scientific-visualization/scripts/style_presets.py +416 -0
- package/lib/skills/builtin/scientific-writing/SKILL.md +745 -0
- package/lib/skills/builtin/scientific-writing/assets/REPORT_FORMATTING_GUIDE.md +574 -0
- package/lib/skills/builtin/scientific-writing/assets/scientific_report.sty +606 -0
- package/lib/skills/builtin/scientific-writing/assets/scientific_report_template.tex +449 -0
- package/lib/skills/builtin/scientific-writing/references/citation_styles.md +720 -0
- package/lib/skills/builtin/scientific-writing/references/figures_tables.md +806 -0
- package/lib/skills/builtin/scientific-writing/references/imrad_structure.md +686 -0
- package/lib/skills/builtin/scientific-writing/references/professional_report_formatting.md +664 -0
- package/lib/skills/builtin/scientific-writing/references/reporting_guidelines.md +748 -0
- package/lib/skills/builtin/scientific-writing/references/writing_principles.md +824 -0
- package/lib/skills/builtin/seaborn/SKILL.md +674 -0
- package/lib/skills/builtin/seaborn/references/examples.md +822 -0
- package/lib/skills/builtin/seaborn/references/function_reference.md +770 -0
- package/lib/skills/builtin/seaborn/references/objects_interface.md +964 -0
- package/lib/skills/data-analysis/SKILL.md +285 -0
- package/lib/skills/generate-skill-content.mjs +58 -0
- package/lib/skills/index.ts +34 -0
- package/lib/skills/loader.ts +452 -0
- package/package.json +62 -0
|
@@ -0,0 +1,1272 @@
|
|
|
1
|
+
import { f as flowDb, p as parser$1 } from "./flowDb-c6c81e3f-CuoIN-Cy.js";
|
|
2
|
+
import { u as select, an as curveLinear, v as log$1, r as getConfig, ak as setupGraphViewbox$1, al as getStylesFromArray, am as interpolateToCurve, S as evaluate, ah as renderKatexSanitized, C as common$1 } from "./MilkdownMarkdownEditor-bLPxrCVb.js";
|
|
3
|
+
import { G as Graph } from "./graph-DpC13d95.js";
|
|
4
|
+
import { u as uniqueId, r as range, p as pick, l as layout, d as defaults } from "./layout-ZeuHE_aY.js";
|
|
5
|
+
import { b as applyStyle, c as addHtmlLabel, i as isSubgraph, d as applyTransition, e as edgeToId, g as applyClass, f as flowStyles, a as flowRendererV2, s as selectAll } from "./styles-d45a18b0-DtRYKYKf.js";
|
|
6
|
+
import { l as line } from "./line-CAgaGl-S.js";
|
|
7
|
+
import "./index-BqDyyRCx.js";
|
|
8
|
+
import "./index-5325376f-Bbs7Fbqr.js";
|
|
9
|
+
import "./clone-CsnzsYXQ.js";
|
|
10
|
+
import "./edges-96097737-CD0EvAZQ.js";
|
|
11
|
+
import "./createText-1719965b-Cji7KN4K.js";
|
|
12
|
+
import "./channel-ZAmhHE3g.js";
|
|
13
|
+
import "./array-DgktLKBx.js";
|
|
14
|
+
import "./path-Cp2qmpkd.js";
|
|
15
|
+
function responseText(response) {
|
|
16
|
+
if (!response.ok) throw new Error(response.status + " " + response.statusText);
|
|
17
|
+
return response.text();
|
|
18
|
+
}
|
|
19
|
+
function text(input, init) {
|
|
20
|
+
return fetch(input, init).then(responseText);
|
|
21
|
+
}
|
|
22
|
+
function parser(type) {
|
|
23
|
+
return (input, init) => text(input, init).then((text2) => new DOMParser().parseFromString(text2, type));
|
|
24
|
+
}
|
|
25
|
+
var svg = parser("image/svg+xml");
|
|
26
|
+
var arrows = {
|
|
27
|
+
normal,
|
|
28
|
+
vee,
|
|
29
|
+
undirected
|
|
30
|
+
};
|
|
31
|
+
function setArrows(value) {
|
|
32
|
+
arrows = value;
|
|
33
|
+
}
|
|
34
|
+
function normal(parent, id, edge, type) {
|
|
35
|
+
var marker = parent.append("marker").attr("id", id).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
|
|
36
|
+
var path = marker.append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
|
37
|
+
applyStyle(path, edge[type + "Style"]);
|
|
38
|
+
if (edge[type + "Class"]) {
|
|
39
|
+
path.attr("class", edge[type + "Class"]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function vee(parent, id, edge, type) {
|
|
43
|
+
var marker = parent.append("marker").attr("id", id).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
|
|
44
|
+
var path = marker.append("path").attr("d", "M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
|
45
|
+
applyStyle(path, edge[type + "Style"]);
|
|
46
|
+
if (edge[type + "Class"]) {
|
|
47
|
+
path.attr("class", edge[type + "Class"]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function undirected(parent, id, edge, type) {
|
|
51
|
+
var marker = parent.append("marker").attr("id", id).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
|
|
52
|
+
var path = marker.append("path").attr("d", "M 0 5 L 10 5").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
|
53
|
+
applyStyle(path, edge[type + "Style"]);
|
|
54
|
+
if (edge[type + "Class"]) {
|
|
55
|
+
path.attr("class", edge[type + "Class"]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function addSVGLabel(root, node) {
|
|
59
|
+
var domNode = root;
|
|
60
|
+
domNode.node().appendChild(node.label);
|
|
61
|
+
applyStyle(domNode, node.labelStyle);
|
|
62
|
+
return domNode;
|
|
63
|
+
}
|
|
64
|
+
function addTextLabel(root, node) {
|
|
65
|
+
var domNode = root.append("text");
|
|
66
|
+
var lines = processEscapeSequences(node.label).split("\n");
|
|
67
|
+
for (var i = 0; i < lines.length; i++) {
|
|
68
|
+
domNode.append("tspan").attr("xml:space", "preserve").attr("dy", "1em").attr("x", "1").text(lines[i]);
|
|
69
|
+
}
|
|
70
|
+
applyStyle(domNode, node.labelStyle);
|
|
71
|
+
return domNode;
|
|
72
|
+
}
|
|
73
|
+
function processEscapeSequences(text2) {
|
|
74
|
+
var newText = "";
|
|
75
|
+
var escaped = false;
|
|
76
|
+
var ch;
|
|
77
|
+
for (var i = 0; i < text2.length; ++i) {
|
|
78
|
+
ch = text2[i];
|
|
79
|
+
if (escaped) {
|
|
80
|
+
switch (ch) {
|
|
81
|
+
case "n":
|
|
82
|
+
newText += "\n";
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
newText += ch;
|
|
86
|
+
}
|
|
87
|
+
escaped = false;
|
|
88
|
+
} else if (ch === "\\") {
|
|
89
|
+
escaped = true;
|
|
90
|
+
} else {
|
|
91
|
+
newText += ch;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return newText;
|
|
95
|
+
}
|
|
96
|
+
function addLabel(root, node, location2) {
|
|
97
|
+
var label = node.label;
|
|
98
|
+
var labelSvg = root.append("g");
|
|
99
|
+
if (node.labelType === "svg") {
|
|
100
|
+
addSVGLabel(labelSvg, node);
|
|
101
|
+
} else if (typeof label !== "string" || node.labelType === "html") {
|
|
102
|
+
addHtmlLabel(labelSvg, node);
|
|
103
|
+
} else {
|
|
104
|
+
addTextLabel(labelSvg, node);
|
|
105
|
+
}
|
|
106
|
+
var labelBBox = labelSvg.node().getBBox();
|
|
107
|
+
var y;
|
|
108
|
+
switch (location2) {
|
|
109
|
+
case "top":
|
|
110
|
+
y = -node.height / 2;
|
|
111
|
+
break;
|
|
112
|
+
case "bottom":
|
|
113
|
+
y = node.height / 2 - labelBBox.height;
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
y = -labelBBox.height / 2;
|
|
117
|
+
}
|
|
118
|
+
labelSvg.attr("transform", "translate(" + -labelBBox.width / 2 + "," + y + ")");
|
|
119
|
+
return labelSvg;
|
|
120
|
+
}
|
|
121
|
+
var createClusters = function(selection, g) {
|
|
122
|
+
var clusters = g.nodes().filter(function(v) {
|
|
123
|
+
return isSubgraph(g, v);
|
|
124
|
+
});
|
|
125
|
+
var svgClusters = selection.selectAll("g.cluster").data(clusters, function(v) {
|
|
126
|
+
return v;
|
|
127
|
+
});
|
|
128
|
+
applyTransition(svgClusters.exit(), g).style("opacity", 0).remove();
|
|
129
|
+
var enterSelection = svgClusters.enter().append("g").attr("class", "cluster").attr("id", function(v) {
|
|
130
|
+
var node = g.node(v);
|
|
131
|
+
return node.id;
|
|
132
|
+
}).style("opacity", 0).each(function(v) {
|
|
133
|
+
var node = g.node(v);
|
|
134
|
+
var thisGroup = select(this);
|
|
135
|
+
select(this).append("rect");
|
|
136
|
+
var labelGroup = thisGroup.append("g").attr("class", "label");
|
|
137
|
+
addLabel(labelGroup, node, node.clusterLabelPos);
|
|
138
|
+
});
|
|
139
|
+
svgClusters = svgClusters.merge(enterSelection);
|
|
140
|
+
svgClusters = applyTransition(svgClusters, g).style("opacity", 1);
|
|
141
|
+
svgClusters.selectAll("rect").each(function(c) {
|
|
142
|
+
var node = g.node(c);
|
|
143
|
+
var domCluster = select(this);
|
|
144
|
+
applyStyle(domCluster, node.style);
|
|
145
|
+
});
|
|
146
|
+
return svgClusters;
|
|
147
|
+
};
|
|
148
|
+
function setCreateClusters(value) {
|
|
149
|
+
createClusters = value;
|
|
150
|
+
}
|
|
151
|
+
let createEdgeLabels = function(selection, g) {
|
|
152
|
+
var svgEdgeLabels = selection.selectAll("g.edgeLabel").data(g.edges(), function(e) {
|
|
153
|
+
return edgeToId(e);
|
|
154
|
+
}).classed("update", true);
|
|
155
|
+
svgEdgeLabels.exit().remove();
|
|
156
|
+
svgEdgeLabels.enter().append("g").classed("edgeLabel", true).style("opacity", 0);
|
|
157
|
+
svgEdgeLabels = selection.selectAll("g.edgeLabel");
|
|
158
|
+
svgEdgeLabels.each(function(e) {
|
|
159
|
+
var root = select(this);
|
|
160
|
+
root.select(".label").remove();
|
|
161
|
+
var edge = g.edge(e);
|
|
162
|
+
var label = addLabel(root, g.edge(e), 0).classed("label", true);
|
|
163
|
+
var bbox = label.node().getBBox();
|
|
164
|
+
if (edge.labelId) {
|
|
165
|
+
label.attr("id", edge.labelId);
|
|
166
|
+
}
|
|
167
|
+
if (!Object.prototype.hasOwnProperty.call(edge, "width")) {
|
|
168
|
+
edge.width = bbox.width;
|
|
169
|
+
}
|
|
170
|
+
if (!Object.prototype.hasOwnProperty.call(edge, "height")) {
|
|
171
|
+
edge.height = bbox.height;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
var exitSelection;
|
|
175
|
+
if (svgEdgeLabels.exit) {
|
|
176
|
+
exitSelection = svgEdgeLabels.exit();
|
|
177
|
+
} else {
|
|
178
|
+
exitSelection = svgEdgeLabels.selectAll(null);
|
|
179
|
+
}
|
|
180
|
+
applyTransition(exitSelection, g).style("opacity", 0).remove();
|
|
181
|
+
return svgEdgeLabels;
|
|
182
|
+
};
|
|
183
|
+
function setCreateEdgeLabels(value) {
|
|
184
|
+
createEdgeLabels = value;
|
|
185
|
+
}
|
|
186
|
+
function intersectNode(node, point) {
|
|
187
|
+
return node.intersect(point);
|
|
188
|
+
}
|
|
189
|
+
var createEdgePaths = function(selection, g, arrows2) {
|
|
190
|
+
var previousPaths = selection.selectAll("g.edgePath").data(g.edges(), function(e) {
|
|
191
|
+
return edgeToId(e);
|
|
192
|
+
}).classed("update", true);
|
|
193
|
+
var newPaths = enter(previousPaths, g);
|
|
194
|
+
exit(previousPaths, g);
|
|
195
|
+
var svgPaths = previousPaths.merge !== void 0 ? previousPaths.merge(newPaths) : previousPaths;
|
|
196
|
+
applyTransition(svgPaths, g).style("opacity", 1);
|
|
197
|
+
svgPaths.each(function(e) {
|
|
198
|
+
var domEdge = select(this);
|
|
199
|
+
var edge = g.edge(e);
|
|
200
|
+
edge.elem = this;
|
|
201
|
+
if (edge.id) {
|
|
202
|
+
domEdge.attr("id", edge.id);
|
|
203
|
+
}
|
|
204
|
+
applyClass(
|
|
205
|
+
domEdge,
|
|
206
|
+
edge["class"],
|
|
207
|
+
(domEdge.classed("update") ? "update " : "") + "edgePath"
|
|
208
|
+
);
|
|
209
|
+
});
|
|
210
|
+
svgPaths.selectAll("path.path").each(function(e) {
|
|
211
|
+
var edge = g.edge(e);
|
|
212
|
+
edge.arrowheadId = uniqueId("arrowhead");
|
|
213
|
+
var domEdge = select(this).attr("marker-end", function() {
|
|
214
|
+
return "url(" + makeFragmentRef(location.href, edge.arrowheadId) + ")";
|
|
215
|
+
}).style("fill", "none");
|
|
216
|
+
applyTransition(domEdge, g).attr("d", function(e2) {
|
|
217
|
+
return calcPoints(g, e2);
|
|
218
|
+
});
|
|
219
|
+
applyStyle(domEdge, edge.style);
|
|
220
|
+
});
|
|
221
|
+
svgPaths.selectAll("defs *").remove();
|
|
222
|
+
svgPaths.selectAll("defs").each(function(e) {
|
|
223
|
+
var edge = g.edge(e);
|
|
224
|
+
var arrowhead = arrows2[edge.arrowhead];
|
|
225
|
+
arrowhead(select(this), edge.arrowheadId, edge, "arrowhead");
|
|
226
|
+
});
|
|
227
|
+
return svgPaths;
|
|
228
|
+
};
|
|
229
|
+
function setCreateEdgePaths(value) {
|
|
230
|
+
createEdgePaths = value;
|
|
231
|
+
}
|
|
232
|
+
function makeFragmentRef(url, fragmentId) {
|
|
233
|
+
var baseUrl = url.split("#")[0];
|
|
234
|
+
return baseUrl + "#" + fragmentId;
|
|
235
|
+
}
|
|
236
|
+
function calcPoints(g, e) {
|
|
237
|
+
var edge = g.edge(e);
|
|
238
|
+
var tail = g.node(e.v);
|
|
239
|
+
var head = g.node(e.w);
|
|
240
|
+
var points = edge.points.slice(1, edge.points.length - 1);
|
|
241
|
+
points.unshift(intersectNode(tail, points[0]));
|
|
242
|
+
points.push(intersectNode(head, points[points.length - 1]));
|
|
243
|
+
return createLine(edge, points);
|
|
244
|
+
}
|
|
245
|
+
function createLine(edge, points) {
|
|
246
|
+
var line$1 = (line || svg.line)().x(function(d) {
|
|
247
|
+
return d.x;
|
|
248
|
+
}).y(function(d) {
|
|
249
|
+
return d.y;
|
|
250
|
+
});
|
|
251
|
+
(line$1.curve || line$1.interpolate)(edge.curve);
|
|
252
|
+
return line$1(points);
|
|
253
|
+
}
|
|
254
|
+
function getCoords(elem) {
|
|
255
|
+
var bbox = elem.getBBox();
|
|
256
|
+
var matrix = elem.ownerSVGElement.getScreenCTM().inverse().multiply(elem.getScreenCTM()).translate(bbox.width / 2, bbox.height / 2);
|
|
257
|
+
return { x: matrix.e, y: matrix.f };
|
|
258
|
+
}
|
|
259
|
+
function enter(svgPaths, g) {
|
|
260
|
+
var svgPathsEnter = svgPaths.enter().append("g").attr("class", "edgePath").style("opacity", 0);
|
|
261
|
+
svgPathsEnter.append("path").attr("class", "path").attr("d", function(e) {
|
|
262
|
+
var edge = g.edge(e);
|
|
263
|
+
var sourceElem = g.node(e.v).elem;
|
|
264
|
+
var points = range(edge.points.length).map(function() {
|
|
265
|
+
return getCoords(sourceElem);
|
|
266
|
+
});
|
|
267
|
+
return createLine(edge, points);
|
|
268
|
+
});
|
|
269
|
+
svgPathsEnter.append("defs");
|
|
270
|
+
return svgPathsEnter;
|
|
271
|
+
}
|
|
272
|
+
function exit(svgPaths, g) {
|
|
273
|
+
var svgPathExit = svgPaths.exit();
|
|
274
|
+
applyTransition(svgPathExit, g).style("opacity", 0).remove();
|
|
275
|
+
}
|
|
276
|
+
var createNodes = function(selection, g, shapes2) {
|
|
277
|
+
var simpleNodes = g.nodes().filter(function(v) {
|
|
278
|
+
return !isSubgraph(g, v);
|
|
279
|
+
});
|
|
280
|
+
var svgNodes = selection.selectAll("g.node").data(simpleNodes, function(v) {
|
|
281
|
+
return v;
|
|
282
|
+
}).classed("update", true);
|
|
283
|
+
svgNodes.exit().remove();
|
|
284
|
+
svgNodes.enter().append("g").attr("class", "node").style("opacity", 0);
|
|
285
|
+
svgNodes = selection.selectAll("g.node");
|
|
286
|
+
svgNodes.each(function(v) {
|
|
287
|
+
var node = g.node(v);
|
|
288
|
+
var thisGroup = select(this);
|
|
289
|
+
applyClass(
|
|
290
|
+
thisGroup,
|
|
291
|
+
node["class"],
|
|
292
|
+
(thisGroup.classed("update") ? "update " : "") + "node"
|
|
293
|
+
);
|
|
294
|
+
thisGroup.select("g.label").remove();
|
|
295
|
+
var labelGroup = thisGroup.append("g").attr("class", "label");
|
|
296
|
+
var labelDom = addLabel(labelGroup, node);
|
|
297
|
+
var shape = shapes2[node.shape];
|
|
298
|
+
var bbox = pick(labelDom.node().getBBox(), "width", "height");
|
|
299
|
+
node.elem = this;
|
|
300
|
+
if (node.id) {
|
|
301
|
+
thisGroup.attr("id", node.id);
|
|
302
|
+
}
|
|
303
|
+
if (node.labelId) {
|
|
304
|
+
labelGroup.attr("id", node.labelId);
|
|
305
|
+
}
|
|
306
|
+
if (Object.prototype.hasOwnProperty.call(node, "width")) {
|
|
307
|
+
bbox.width = node.width;
|
|
308
|
+
}
|
|
309
|
+
if (Object.prototype.hasOwnProperty.call(node, "height")) {
|
|
310
|
+
bbox.height = node.height;
|
|
311
|
+
}
|
|
312
|
+
bbox.width += node.paddingLeft + node.paddingRight;
|
|
313
|
+
bbox.height += node.paddingTop + node.paddingBottom;
|
|
314
|
+
labelGroup.attr(
|
|
315
|
+
"transform",
|
|
316
|
+
"translate(" + (node.paddingLeft - node.paddingRight) / 2 + "," + (node.paddingTop - node.paddingBottom) / 2 + ")"
|
|
317
|
+
);
|
|
318
|
+
var root = select(this);
|
|
319
|
+
root.select(".label-container").remove();
|
|
320
|
+
var shapeSvg = shape(root, bbox, node).classed("label-container", true);
|
|
321
|
+
applyStyle(shapeSvg, node.style);
|
|
322
|
+
var shapeBBox = shapeSvg.node().getBBox();
|
|
323
|
+
node.width = shapeBBox.width;
|
|
324
|
+
node.height = shapeBBox.height;
|
|
325
|
+
});
|
|
326
|
+
var exitSelection;
|
|
327
|
+
if (svgNodes.exit) {
|
|
328
|
+
exitSelection = svgNodes.exit();
|
|
329
|
+
} else {
|
|
330
|
+
exitSelection = svgNodes.selectAll(null);
|
|
331
|
+
}
|
|
332
|
+
applyTransition(exitSelection, g).style("opacity", 0).remove();
|
|
333
|
+
return svgNodes;
|
|
334
|
+
};
|
|
335
|
+
function setCreateNodes(value) {
|
|
336
|
+
createNodes = value;
|
|
337
|
+
}
|
|
338
|
+
function positionClusters(selection, g) {
|
|
339
|
+
var created = selection.filter(function() {
|
|
340
|
+
return !select(this).classed("update");
|
|
341
|
+
});
|
|
342
|
+
function translate(v) {
|
|
343
|
+
var node = g.node(v);
|
|
344
|
+
return "translate(" + node.x + "," + node.y + ")";
|
|
345
|
+
}
|
|
346
|
+
created.attr("transform", translate);
|
|
347
|
+
applyTransition(selection, g).style("opacity", 1).attr("transform", translate);
|
|
348
|
+
applyTransition(created.selectAll("rect"), g).attr("width", function(v) {
|
|
349
|
+
return g.node(v).width;
|
|
350
|
+
}).attr("height", function(v) {
|
|
351
|
+
return g.node(v).height;
|
|
352
|
+
}).attr("x", function(v) {
|
|
353
|
+
var node = g.node(v);
|
|
354
|
+
return -node.width / 2;
|
|
355
|
+
}).attr("y", function(v) {
|
|
356
|
+
var node = g.node(v);
|
|
357
|
+
return -node.height / 2;
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
function positionEdgeLabels(selection, g) {
|
|
361
|
+
var created = selection.filter(function() {
|
|
362
|
+
return !select(this).classed("update");
|
|
363
|
+
});
|
|
364
|
+
function translate(e) {
|
|
365
|
+
var edge = g.edge(e);
|
|
366
|
+
return Object.prototype.hasOwnProperty.call(edge, "x") ? "translate(" + edge.x + "," + edge.y + ")" : "";
|
|
367
|
+
}
|
|
368
|
+
created.attr("transform", translate);
|
|
369
|
+
applyTransition(selection, g).style("opacity", 1).attr("transform", translate);
|
|
370
|
+
}
|
|
371
|
+
function positionNodes(selection, g) {
|
|
372
|
+
var created = selection.filter(function() {
|
|
373
|
+
return !select(this).classed("update");
|
|
374
|
+
});
|
|
375
|
+
function translate(v) {
|
|
376
|
+
var node = g.node(v);
|
|
377
|
+
return "translate(" + node.x + "," + node.y + ")";
|
|
378
|
+
}
|
|
379
|
+
created.attr("transform", translate);
|
|
380
|
+
applyTransition(selection, g).style("opacity", 1).attr("transform", translate);
|
|
381
|
+
}
|
|
382
|
+
function intersectEllipse(node, rx, ry, point) {
|
|
383
|
+
var cx = node.x;
|
|
384
|
+
var cy = node.y;
|
|
385
|
+
var px = cx - point.x;
|
|
386
|
+
var py = cy - point.y;
|
|
387
|
+
var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
|
|
388
|
+
var dx = Math.abs(rx * ry * px / det);
|
|
389
|
+
if (point.x < cx) {
|
|
390
|
+
dx = -dx;
|
|
391
|
+
}
|
|
392
|
+
var dy = Math.abs(rx * ry * py / det);
|
|
393
|
+
if (point.y < cy) {
|
|
394
|
+
dy = -dy;
|
|
395
|
+
}
|
|
396
|
+
return { x: cx + dx, y: cy + dy };
|
|
397
|
+
}
|
|
398
|
+
function intersectCircle(node, rx, point) {
|
|
399
|
+
return intersectEllipse(node, rx, rx, point);
|
|
400
|
+
}
|
|
401
|
+
function intersectLine(p1, p2, q1, q2) {
|
|
402
|
+
var a1, a2, b1, b2, c1, c2;
|
|
403
|
+
var r1, r2, r3, r4;
|
|
404
|
+
var denom, offset, num;
|
|
405
|
+
var x, y;
|
|
406
|
+
a1 = p2.y - p1.y;
|
|
407
|
+
b1 = p1.x - p2.x;
|
|
408
|
+
c1 = p2.x * p1.y - p1.x * p2.y;
|
|
409
|
+
r3 = a1 * q1.x + b1 * q1.y + c1;
|
|
410
|
+
r4 = a1 * q2.x + b1 * q2.y + c1;
|
|
411
|
+
if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
a2 = q2.y - q1.y;
|
|
415
|
+
b2 = q1.x - q2.x;
|
|
416
|
+
c2 = q2.x * q1.y - q1.x * q2.y;
|
|
417
|
+
r1 = a2 * p1.x + b2 * p1.y + c2;
|
|
418
|
+
r2 = a2 * p2.x + b2 * p2.y + c2;
|
|
419
|
+
if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
denom = a1 * b2 - a2 * b1;
|
|
423
|
+
if (denom === 0) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
offset = Math.abs(denom / 2);
|
|
427
|
+
num = b1 * c2 - b2 * c1;
|
|
428
|
+
x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
|
|
429
|
+
num = a2 * c1 - a1 * c2;
|
|
430
|
+
y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
|
|
431
|
+
return { x, y };
|
|
432
|
+
}
|
|
433
|
+
function sameSign(r1, r2) {
|
|
434
|
+
return r1 * r2 > 0;
|
|
435
|
+
}
|
|
436
|
+
function intersectPolygon(node, polyPoints, point) {
|
|
437
|
+
var x1 = node.x;
|
|
438
|
+
var y1 = node.y;
|
|
439
|
+
var intersections = [];
|
|
440
|
+
var minX = Number.POSITIVE_INFINITY;
|
|
441
|
+
var minY = Number.POSITIVE_INFINITY;
|
|
442
|
+
polyPoints.forEach(function(entry) {
|
|
443
|
+
minX = Math.min(minX, entry.x);
|
|
444
|
+
minY = Math.min(minY, entry.y);
|
|
445
|
+
});
|
|
446
|
+
var left = x1 - node.width / 2 - minX;
|
|
447
|
+
var top = y1 - node.height / 2 - minY;
|
|
448
|
+
for (var i = 0; i < polyPoints.length; i++) {
|
|
449
|
+
var p1 = polyPoints[i];
|
|
450
|
+
var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
|
|
451
|
+
var intersect = intersectLine(
|
|
452
|
+
node,
|
|
453
|
+
point,
|
|
454
|
+
{ x: left + p1.x, y: top + p1.y },
|
|
455
|
+
{ x: left + p2.x, y: top + p2.y }
|
|
456
|
+
);
|
|
457
|
+
if (intersect) {
|
|
458
|
+
intersections.push(intersect);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
if (!intersections.length) {
|
|
462
|
+
console.log("NO INTERSECTION FOUND, RETURN NODE CENTER", node);
|
|
463
|
+
return node;
|
|
464
|
+
}
|
|
465
|
+
if (intersections.length > 1) {
|
|
466
|
+
intersections.sort(function(p, q) {
|
|
467
|
+
var pdx = p.x - point.x;
|
|
468
|
+
var pdy = p.y - point.y;
|
|
469
|
+
var distp = Math.sqrt(pdx * pdx + pdy * pdy);
|
|
470
|
+
var qdx = q.x - point.x;
|
|
471
|
+
var qdy = q.y - point.y;
|
|
472
|
+
var distq = Math.sqrt(qdx * qdx + qdy * qdy);
|
|
473
|
+
return distp < distq ? -1 : distp === distq ? 0 : 1;
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
return intersections[0];
|
|
477
|
+
}
|
|
478
|
+
function intersectRect(node, point) {
|
|
479
|
+
var x = node.x;
|
|
480
|
+
var y = node.y;
|
|
481
|
+
var dx = point.x - x;
|
|
482
|
+
var dy = point.y - y;
|
|
483
|
+
var w = node.width / 2;
|
|
484
|
+
var h = node.height / 2;
|
|
485
|
+
var sx, sy;
|
|
486
|
+
if (Math.abs(dy) * w > Math.abs(dx) * h) {
|
|
487
|
+
if (dy < 0) {
|
|
488
|
+
h = -h;
|
|
489
|
+
}
|
|
490
|
+
sx = dy === 0 ? 0 : h * dx / dy;
|
|
491
|
+
sy = h;
|
|
492
|
+
} else {
|
|
493
|
+
if (dx < 0) {
|
|
494
|
+
w = -w;
|
|
495
|
+
}
|
|
496
|
+
sx = w;
|
|
497
|
+
sy = dx === 0 ? 0 : w * dy / dx;
|
|
498
|
+
}
|
|
499
|
+
return { x: x + sx, y: y + sy };
|
|
500
|
+
}
|
|
501
|
+
var shapes = {
|
|
502
|
+
rect,
|
|
503
|
+
ellipse,
|
|
504
|
+
circle,
|
|
505
|
+
diamond
|
|
506
|
+
};
|
|
507
|
+
function setShapes(value) {
|
|
508
|
+
shapes = value;
|
|
509
|
+
}
|
|
510
|
+
function rect(parent, bbox, node) {
|
|
511
|
+
var shapeSvg = parent.insert("rect", ":first-child").attr("rx", node.rx).attr("ry", node.ry).attr("x", -bbox.width / 2).attr("y", -bbox.height / 2).attr("width", bbox.width).attr("height", bbox.height);
|
|
512
|
+
node.intersect = function(point) {
|
|
513
|
+
return intersectRect(node, point);
|
|
514
|
+
};
|
|
515
|
+
return shapeSvg;
|
|
516
|
+
}
|
|
517
|
+
function ellipse(parent, bbox, node) {
|
|
518
|
+
var rx = bbox.width / 2;
|
|
519
|
+
var ry = bbox.height / 2;
|
|
520
|
+
var shapeSvg = parent.insert("ellipse", ":first-child").attr("x", -bbox.width / 2).attr("y", -bbox.height / 2).attr("rx", rx).attr("ry", ry);
|
|
521
|
+
node.intersect = function(point) {
|
|
522
|
+
return intersectEllipse(node, rx, ry, point);
|
|
523
|
+
};
|
|
524
|
+
return shapeSvg;
|
|
525
|
+
}
|
|
526
|
+
function circle(parent, bbox, node) {
|
|
527
|
+
var r = Math.max(bbox.width, bbox.height) / 2;
|
|
528
|
+
var shapeSvg = parent.insert("circle", ":first-child").attr("x", -bbox.width / 2).attr("y", -bbox.height / 2).attr("r", r);
|
|
529
|
+
node.intersect = function(point) {
|
|
530
|
+
return intersectCircle(node, r, point);
|
|
531
|
+
};
|
|
532
|
+
return shapeSvg;
|
|
533
|
+
}
|
|
534
|
+
function diamond(parent, bbox, node) {
|
|
535
|
+
var w = bbox.width * Math.SQRT2 / 2;
|
|
536
|
+
var h = bbox.height * Math.SQRT2 / 2;
|
|
537
|
+
var points = [
|
|
538
|
+
{ x: 0, y: -h },
|
|
539
|
+
{ x: -w, y: 0 },
|
|
540
|
+
{ x: 0, y: h },
|
|
541
|
+
{ x: w, y: 0 }
|
|
542
|
+
];
|
|
543
|
+
var shapeSvg = parent.insert("polygon", ":first-child").attr(
|
|
544
|
+
"points",
|
|
545
|
+
points.map(function(p) {
|
|
546
|
+
return p.x + "," + p.y;
|
|
547
|
+
}).join(" ")
|
|
548
|
+
);
|
|
549
|
+
node.intersect = function(p) {
|
|
550
|
+
return intersectPolygon(node, points, p);
|
|
551
|
+
};
|
|
552
|
+
return shapeSvg;
|
|
553
|
+
}
|
|
554
|
+
function render() {
|
|
555
|
+
var fn = function(svg2, g) {
|
|
556
|
+
preProcessGraph(g);
|
|
557
|
+
var outputGroup = createOrSelectGroup(svg2, "output");
|
|
558
|
+
var clustersGroup = createOrSelectGroup(outputGroup, "clusters");
|
|
559
|
+
var edgePathsGroup = createOrSelectGroup(outputGroup, "edgePaths");
|
|
560
|
+
var edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, "edgeLabels"), g);
|
|
561
|
+
var nodes = createNodes(createOrSelectGroup(outputGroup, "nodes"), g, shapes);
|
|
562
|
+
layout(g);
|
|
563
|
+
positionNodes(nodes, g);
|
|
564
|
+
positionEdgeLabels(edgeLabels, g);
|
|
565
|
+
createEdgePaths(edgePathsGroup, g, arrows);
|
|
566
|
+
var clusters = createClusters(clustersGroup, g);
|
|
567
|
+
positionClusters(clusters, g);
|
|
568
|
+
postProcessGraph(g);
|
|
569
|
+
};
|
|
570
|
+
fn.createNodes = function(value) {
|
|
571
|
+
if (!arguments.length) return createNodes;
|
|
572
|
+
setCreateNodes(value);
|
|
573
|
+
return fn;
|
|
574
|
+
};
|
|
575
|
+
fn.createClusters = function(value) {
|
|
576
|
+
if (!arguments.length) return createClusters;
|
|
577
|
+
setCreateClusters(value);
|
|
578
|
+
return fn;
|
|
579
|
+
};
|
|
580
|
+
fn.createEdgeLabels = function(value) {
|
|
581
|
+
if (!arguments.length) return createEdgeLabels;
|
|
582
|
+
setCreateEdgeLabels(value);
|
|
583
|
+
return fn;
|
|
584
|
+
};
|
|
585
|
+
fn.createEdgePaths = function(value) {
|
|
586
|
+
if (!arguments.length) return createEdgePaths;
|
|
587
|
+
setCreateEdgePaths(value);
|
|
588
|
+
return fn;
|
|
589
|
+
};
|
|
590
|
+
fn.shapes = function(value) {
|
|
591
|
+
if (!arguments.length) return shapes;
|
|
592
|
+
setShapes(value);
|
|
593
|
+
return fn;
|
|
594
|
+
};
|
|
595
|
+
fn.arrows = function(value) {
|
|
596
|
+
if (!arguments.length) return arrows;
|
|
597
|
+
setArrows(value);
|
|
598
|
+
return fn;
|
|
599
|
+
};
|
|
600
|
+
return fn;
|
|
601
|
+
}
|
|
602
|
+
var NODE_DEFAULT_ATTRS = {
|
|
603
|
+
paddingLeft: 10,
|
|
604
|
+
paddingRight: 10,
|
|
605
|
+
paddingTop: 10,
|
|
606
|
+
paddingBottom: 10,
|
|
607
|
+
rx: 0,
|
|
608
|
+
ry: 0,
|
|
609
|
+
shape: "rect"
|
|
610
|
+
};
|
|
611
|
+
var EDGE_DEFAULT_ATTRS = {
|
|
612
|
+
arrowhead: "normal",
|
|
613
|
+
curve: curveLinear
|
|
614
|
+
};
|
|
615
|
+
function preProcessGraph(g) {
|
|
616
|
+
g.nodes().forEach((v) => {
|
|
617
|
+
const node = g.node(v);
|
|
618
|
+
if (!Object.prototype.hasOwnProperty.call(node, "label") && !g.children(v).length) {
|
|
619
|
+
node.label = v;
|
|
620
|
+
}
|
|
621
|
+
if (Object.prototype.hasOwnProperty.call(node, "paddingX")) {
|
|
622
|
+
defaults(node, {
|
|
623
|
+
paddingLeft: node.paddingX,
|
|
624
|
+
paddingRight: node.paddingX
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
if (Object.prototype.hasOwnProperty.call(node, "paddingY")) {
|
|
628
|
+
defaults(node, {
|
|
629
|
+
paddingTop: node.paddingY,
|
|
630
|
+
paddingBottom: node.paddingY
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
if (Object.prototype.hasOwnProperty.call(node, "padding")) {
|
|
634
|
+
defaults(node, {
|
|
635
|
+
paddingLeft: node.padding,
|
|
636
|
+
paddingRight: node.padding,
|
|
637
|
+
paddingTop: node.padding,
|
|
638
|
+
paddingBottom: node.padding
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
defaults(node, NODE_DEFAULT_ATTRS);
|
|
642
|
+
["paddingLeft", "paddingRight", "paddingTop", "paddingBottom"].forEach((k) => {
|
|
643
|
+
node[k] = Number(node[k]);
|
|
644
|
+
});
|
|
645
|
+
if (Object.prototype.hasOwnProperty.call(node, "width")) {
|
|
646
|
+
node._prevWidth = node.width;
|
|
647
|
+
}
|
|
648
|
+
if (Object.prototype.hasOwnProperty.call(node, "height")) {
|
|
649
|
+
node._prevHeight = node.height;
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
g.edges().forEach(function(e) {
|
|
653
|
+
var edge = g.edge(e);
|
|
654
|
+
if (!Object.prototype.hasOwnProperty.call(edge, "label")) {
|
|
655
|
+
edge.label = "";
|
|
656
|
+
}
|
|
657
|
+
defaults(edge, EDGE_DEFAULT_ATTRS);
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
function postProcessGraph(g) {
|
|
661
|
+
g.nodes().forEach((v) => {
|
|
662
|
+
var node = g.node(v);
|
|
663
|
+
if (Object.prototype.hasOwnProperty.call(node, "_prevWidth")) {
|
|
664
|
+
node.width = node._prevWidth;
|
|
665
|
+
} else {
|
|
666
|
+
delete node.width;
|
|
667
|
+
}
|
|
668
|
+
if (Object.prototype.hasOwnProperty.call(node, "_prevHeight")) {
|
|
669
|
+
node.height = node._prevHeight;
|
|
670
|
+
} else {
|
|
671
|
+
delete node.height;
|
|
672
|
+
}
|
|
673
|
+
delete node._prevWidth;
|
|
674
|
+
delete node._prevHeight;
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
function createOrSelectGroup(root, name) {
|
|
678
|
+
var selection = root.select("g." + name);
|
|
679
|
+
if (selection.empty()) {
|
|
680
|
+
selection = root.append("g").attr("class", name);
|
|
681
|
+
}
|
|
682
|
+
return selection;
|
|
683
|
+
}
|
|
684
|
+
function question(parent, bbox, node) {
|
|
685
|
+
const w = bbox.width;
|
|
686
|
+
const h = bbox.height;
|
|
687
|
+
const s = (w + h) * 0.9;
|
|
688
|
+
const points = [
|
|
689
|
+
{ x: s / 2, y: 0 },
|
|
690
|
+
{ x: s, y: -s / 2 },
|
|
691
|
+
{ x: s / 2, y: -s },
|
|
692
|
+
{ x: 0, y: -s / 2 }
|
|
693
|
+
];
|
|
694
|
+
const shapeSvg = insertPolygonShape(parent, s, s, points);
|
|
695
|
+
node.intersect = function(point) {
|
|
696
|
+
return intersectPolygon(node, points, point);
|
|
697
|
+
};
|
|
698
|
+
return shapeSvg;
|
|
699
|
+
}
|
|
700
|
+
function hexagon(parent, bbox, node) {
|
|
701
|
+
const f = 4;
|
|
702
|
+
const h = bbox.height;
|
|
703
|
+
const m = h / f;
|
|
704
|
+
const w = bbox.width + 2 * m;
|
|
705
|
+
const points = [
|
|
706
|
+
{ x: m, y: 0 },
|
|
707
|
+
{ x: w - m, y: 0 },
|
|
708
|
+
{ x: w, y: -h / 2 },
|
|
709
|
+
{ x: w - m, y: -h },
|
|
710
|
+
{ x: m, y: -h },
|
|
711
|
+
{ x: 0, y: -h / 2 }
|
|
712
|
+
];
|
|
713
|
+
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
|
714
|
+
node.intersect = function(point) {
|
|
715
|
+
return intersectPolygon(node, points, point);
|
|
716
|
+
};
|
|
717
|
+
return shapeSvg;
|
|
718
|
+
}
|
|
719
|
+
function rect_left_inv_arrow(parent, bbox, node) {
|
|
720
|
+
const w = bbox.width;
|
|
721
|
+
const h = bbox.height;
|
|
722
|
+
const points = [
|
|
723
|
+
{ x: -h / 2, y: 0 },
|
|
724
|
+
{ x: w, y: 0 },
|
|
725
|
+
{ x: w, y: -h },
|
|
726
|
+
{ x: -h / 2, y: -h },
|
|
727
|
+
{ x: 0, y: -h / 2 }
|
|
728
|
+
];
|
|
729
|
+
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
|
730
|
+
node.intersect = function(point) {
|
|
731
|
+
return intersectPolygon(node, points, point);
|
|
732
|
+
};
|
|
733
|
+
return shapeSvg;
|
|
734
|
+
}
|
|
735
|
+
function lean_right(parent, bbox, node) {
|
|
736
|
+
const w = bbox.width;
|
|
737
|
+
const h = bbox.height;
|
|
738
|
+
const points = [
|
|
739
|
+
{ x: -2 * h / 6, y: 0 },
|
|
740
|
+
{ x: w - h / 6, y: 0 },
|
|
741
|
+
{ x: w + 2 * h / 6, y: -h },
|
|
742
|
+
{ x: h / 6, y: -h }
|
|
743
|
+
];
|
|
744
|
+
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
|
745
|
+
node.intersect = function(point) {
|
|
746
|
+
return intersectPolygon(node, points, point);
|
|
747
|
+
};
|
|
748
|
+
return shapeSvg;
|
|
749
|
+
}
|
|
750
|
+
function lean_left(parent, bbox, node) {
|
|
751
|
+
const w = bbox.width;
|
|
752
|
+
const h = bbox.height;
|
|
753
|
+
const points = [
|
|
754
|
+
{ x: 2 * h / 6, y: 0 },
|
|
755
|
+
{ x: w + h / 6, y: 0 },
|
|
756
|
+
{ x: w - 2 * h / 6, y: -h },
|
|
757
|
+
{ x: -h / 6, y: -h }
|
|
758
|
+
];
|
|
759
|
+
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
|
760
|
+
node.intersect = function(point) {
|
|
761
|
+
return intersectPolygon(node, points, point);
|
|
762
|
+
};
|
|
763
|
+
return shapeSvg;
|
|
764
|
+
}
|
|
765
|
+
function trapezoid(parent, bbox, node) {
|
|
766
|
+
const w = bbox.width;
|
|
767
|
+
const h = bbox.height;
|
|
768
|
+
const points = [
|
|
769
|
+
{ x: -2 * h / 6, y: 0 },
|
|
770
|
+
{ x: w + 2 * h / 6, y: 0 },
|
|
771
|
+
{ x: w - h / 6, y: -h },
|
|
772
|
+
{ x: h / 6, y: -h }
|
|
773
|
+
];
|
|
774
|
+
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
|
775
|
+
node.intersect = function(point) {
|
|
776
|
+
return intersectPolygon(node, points, point);
|
|
777
|
+
};
|
|
778
|
+
return shapeSvg;
|
|
779
|
+
}
|
|
780
|
+
function inv_trapezoid(parent, bbox, node) {
|
|
781
|
+
const w = bbox.width;
|
|
782
|
+
const h = bbox.height;
|
|
783
|
+
const points = [
|
|
784
|
+
{ x: h / 6, y: 0 },
|
|
785
|
+
{ x: w - h / 6, y: 0 },
|
|
786
|
+
{ x: w + 2 * h / 6, y: -h },
|
|
787
|
+
{ x: -2 * h / 6, y: -h }
|
|
788
|
+
];
|
|
789
|
+
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
|
790
|
+
node.intersect = function(point) {
|
|
791
|
+
return intersectPolygon(node, points, point);
|
|
792
|
+
};
|
|
793
|
+
return shapeSvg;
|
|
794
|
+
}
|
|
795
|
+
function rect_right_inv_arrow(parent, bbox, node) {
|
|
796
|
+
const w = bbox.width;
|
|
797
|
+
const h = bbox.height;
|
|
798
|
+
const points = [
|
|
799
|
+
{ x: 0, y: 0 },
|
|
800
|
+
{ x: w + h / 2, y: 0 },
|
|
801
|
+
{ x: w, y: -h / 2 },
|
|
802
|
+
{ x: w + h / 2, y: -h },
|
|
803
|
+
{ x: 0, y: -h }
|
|
804
|
+
];
|
|
805
|
+
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
|
806
|
+
node.intersect = function(point) {
|
|
807
|
+
return intersectPolygon(node, points, point);
|
|
808
|
+
};
|
|
809
|
+
return shapeSvg;
|
|
810
|
+
}
|
|
811
|
+
function stadium(parent, bbox, node) {
|
|
812
|
+
const h = bbox.height;
|
|
813
|
+
const w = bbox.width + h / 4;
|
|
814
|
+
const shapeSvg = parent.insert("rect", ":first-child").attr("rx", h / 2).attr("ry", h / 2).attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h);
|
|
815
|
+
node.intersect = function(point) {
|
|
816
|
+
return intersectRect(node, point);
|
|
817
|
+
};
|
|
818
|
+
return shapeSvg;
|
|
819
|
+
}
|
|
820
|
+
function subroutine(parent, bbox, node) {
|
|
821
|
+
const w = bbox.width;
|
|
822
|
+
const h = bbox.height;
|
|
823
|
+
const points = [
|
|
824
|
+
{ x: 0, y: 0 },
|
|
825
|
+
{ x: w, y: 0 },
|
|
826
|
+
{ x: w, y: -h },
|
|
827
|
+
{ x: 0, y: -h },
|
|
828
|
+
{ x: 0, y: 0 },
|
|
829
|
+
{ x: -8, y: 0 },
|
|
830
|
+
{ x: w + 8, y: 0 },
|
|
831
|
+
{ x: w + 8, y: -h },
|
|
832
|
+
{ x: -8, y: -h },
|
|
833
|
+
{ x: -8, y: 0 }
|
|
834
|
+
];
|
|
835
|
+
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
|
836
|
+
node.intersect = function(point) {
|
|
837
|
+
return intersectPolygon(node, points, point);
|
|
838
|
+
};
|
|
839
|
+
return shapeSvg;
|
|
840
|
+
}
|
|
841
|
+
function cylinder(parent, bbox, node) {
|
|
842
|
+
const w = bbox.width;
|
|
843
|
+
const rx = w / 2;
|
|
844
|
+
const ry = rx / (2.5 + w / 50);
|
|
845
|
+
const h = bbox.height + ry;
|
|
846
|
+
const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 a " + rx + "," + ry + " 0,0,0 " + -w + " 0 l 0," + h + " a " + rx + "," + ry + " 0,0,0 " + w + " 0 l 0," + -h;
|
|
847
|
+
const shapeSvg = parent.attr("label-offset-y", ry).insert("path", ":first-child").attr("d", shape).attr("transform", "translate(" + -w / 2 + "," + -(h / 2 + ry) + ")");
|
|
848
|
+
node.intersect = function(point) {
|
|
849
|
+
const pos = intersectRect(node, point);
|
|
850
|
+
const x = pos.x - node.x;
|
|
851
|
+
if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
|
|
852
|
+
let y = ry * ry * (1 - x * x / (rx * rx));
|
|
853
|
+
if (y != 0) {
|
|
854
|
+
y = Math.sqrt(y);
|
|
855
|
+
}
|
|
856
|
+
y = ry - y;
|
|
857
|
+
if (point.y - node.y > 0) {
|
|
858
|
+
y = -y;
|
|
859
|
+
}
|
|
860
|
+
pos.y += y;
|
|
861
|
+
}
|
|
862
|
+
return pos;
|
|
863
|
+
};
|
|
864
|
+
return shapeSvg;
|
|
865
|
+
}
|
|
866
|
+
function addToRender(render2) {
|
|
867
|
+
render2.shapes().question = question;
|
|
868
|
+
render2.shapes().hexagon = hexagon;
|
|
869
|
+
render2.shapes().stadium = stadium;
|
|
870
|
+
render2.shapes().subroutine = subroutine;
|
|
871
|
+
render2.shapes().cylinder = cylinder;
|
|
872
|
+
render2.shapes().rect_left_inv_arrow = rect_left_inv_arrow;
|
|
873
|
+
render2.shapes().lean_right = lean_right;
|
|
874
|
+
render2.shapes().lean_left = lean_left;
|
|
875
|
+
render2.shapes().trapezoid = trapezoid;
|
|
876
|
+
render2.shapes().inv_trapezoid = inv_trapezoid;
|
|
877
|
+
render2.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
|
|
878
|
+
}
|
|
879
|
+
function addToRenderV2(addShape) {
|
|
880
|
+
addShape({ question });
|
|
881
|
+
addShape({ hexagon });
|
|
882
|
+
addShape({ stadium });
|
|
883
|
+
addShape({ subroutine });
|
|
884
|
+
addShape({ cylinder });
|
|
885
|
+
addShape({ rect_left_inv_arrow });
|
|
886
|
+
addShape({ lean_right });
|
|
887
|
+
addShape({ lean_left });
|
|
888
|
+
addShape({ trapezoid });
|
|
889
|
+
addShape({ inv_trapezoid });
|
|
890
|
+
addShape({ rect_right_inv_arrow });
|
|
891
|
+
}
|
|
892
|
+
function insertPolygonShape(parent, w, h, points) {
|
|
893
|
+
return parent.insert("polygon", ":first-child").attr(
|
|
894
|
+
"points",
|
|
895
|
+
points.map(function(d) {
|
|
896
|
+
return d.x + "," + d.y;
|
|
897
|
+
}).join(" ")
|
|
898
|
+
).attr("transform", "translate(" + -w / 2 + "," + h / 2 + ")");
|
|
899
|
+
}
|
|
900
|
+
const flowChartShapes = {
|
|
901
|
+
addToRender,
|
|
902
|
+
addToRenderV2
|
|
903
|
+
};
|
|
904
|
+
const conf = {};
|
|
905
|
+
const setConf = function(cnf) {
|
|
906
|
+
const keys = Object.keys(cnf);
|
|
907
|
+
for (const key of keys) {
|
|
908
|
+
conf[key] = cnf[key];
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
const addVertices = async function(vert, g, svgId, root, _doc, diagObj) {
|
|
912
|
+
const svg2 = !root ? select(`[id="${svgId}"]`) : root.select(`[id="${svgId}"]`);
|
|
913
|
+
const doc = !_doc ? document : _doc;
|
|
914
|
+
const keys = Object.keys(vert);
|
|
915
|
+
for (const id of keys) {
|
|
916
|
+
const vertex = vert[id];
|
|
917
|
+
let classStr = "default";
|
|
918
|
+
if (vertex.classes.length > 0) {
|
|
919
|
+
classStr = vertex.classes.join(" ");
|
|
920
|
+
}
|
|
921
|
+
const styles = getStylesFromArray(vertex.styles);
|
|
922
|
+
let vertexText = vertex.text !== void 0 ? vertex.text : vertex.id;
|
|
923
|
+
let vertexNode;
|
|
924
|
+
if (evaluate(getConfig().flowchart.htmlLabels)) {
|
|
925
|
+
const node = {
|
|
926
|
+
label: await renderKatexSanitized(
|
|
927
|
+
vertexText.replace(
|
|
928
|
+
/fa[blrs]?:fa-[\w-]+/g,
|
|
929
|
+
// cspell:disable-line
|
|
930
|
+
(s) => `<i class='${s.replace(":", " ")}'></i>`
|
|
931
|
+
),
|
|
932
|
+
getConfig()
|
|
933
|
+
)
|
|
934
|
+
};
|
|
935
|
+
vertexNode = addHtmlLabel(svg2, node).node();
|
|
936
|
+
vertexNode.parentNode.removeChild(vertexNode);
|
|
937
|
+
} else {
|
|
938
|
+
const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
939
|
+
svgLabel.setAttribute("style", styles.labelStyle.replace("color:", "fill:"));
|
|
940
|
+
const rows = vertexText.split(common$1.lineBreakRegex);
|
|
941
|
+
for (const row of rows) {
|
|
942
|
+
const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
943
|
+
tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
944
|
+
tspan.setAttribute("dy", "1em");
|
|
945
|
+
tspan.setAttribute("x", "1");
|
|
946
|
+
tspan.textContent = row;
|
|
947
|
+
svgLabel.appendChild(tspan);
|
|
948
|
+
}
|
|
949
|
+
vertexNode = svgLabel;
|
|
950
|
+
}
|
|
951
|
+
let radius = 0;
|
|
952
|
+
let _shape = "";
|
|
953
|
+
switch (vertex.type) {
|
|
954
|
+
case "round":
|
|
955
|
+
radius = 5;
|
|
956
|
+
_shape = "rect";
|
|
957
|
+
break;
|
|
958
|
+
case "square":
|
|
959
|
+
_shape = "rect";
|
|
960
|
+
break;
|
|
961
|
+
case "diamond":
|
|
962
|
+
_shape = "question";
|
|
963
|
+
break;
|
|
964
|
+
case "hexagon":
|
|
965
|
+
_shape = "hexagon";
|
|
966
|
+
break;
|
|
967
|
+
case "odd":
|
|
968
|
+
_shape = "rect_left_inv_arrow";
|
|
969
|
+
break;
|
|
970
|
+
case "lean_right":
|
|
971
|
+
_shape = "lean_right";
|
|
972
|
+
break;
|
|
973
|
+
case "lean_left":
|
|
974
|
+
_shape = "lean_left";
|
|
975
|
+
break;
|
|
976
|
+
case "trapezoid":
|
|
977
|
+
_shape = "trapezoid";
|
|
978
|
+
break;
|
|
979
|
+
case "inv_trapezoid":
|
|
980
|
+
_shape = "inv_trapezoid";
|
|
981
|
+
break;
|
|
982
|
+
case "odd_right":
|
|
983
|
+
_shape = "rect_left_inv_arrow";
|
|
984
|
+
break;
|
|
985
|
+
case "circle":
|
|
986
|
+
_shape = "circle";
|
|
987
|
+
break;
|
|
988
|
+
case "ellipse":
|
|
989
|
+
_shape = "ellipse";
|
|
990
|
+
break;
|
|
991
|
+
case "stadium":
|
|
992
|
+
_shape = "stadium";
|
|
993
|
+
break;
|
|
994
|
+
case "subroutine":
|
|
995
|
+
_shape = "subroutine";
|
|
996
|
+
break;
|
|
997
|
+
case "cylinder":
|
|
998
|
+
_shape = "cylinder";
|
|
999
|
+
break;
|
|
1000
|
+
case "group":
|
|
1001
|
+
_shape = "rect";
|
|
1002
|
+
break;
|
|
1003
|
+
default:
|
|
1004
|
+
_shape = "rect";
|
|
1005
|
+
}
|
|
1006
|
+
log$1.warn("Adding node", vertex.id, vertex.domId);
|
|
1007
|
+
g.setNode(diagObj.db.lookUpDomId(vertex.id), {
|
|
1008
|
+
labelType: "svg",
|
|
1009
|
+
labelStyle: styles.labelStyle,
|
|
1010
|
+
shape: _shape,
|
|
1011
|
+
label: vertexNode,
|
|
1012
|
+
rx: radius,
|
|
1013
|
+
ry: radius,
|
|
1014
|
+
class: classStr,
|
|
1015
|
+
style: styles.style,
|
|
1016
|
+
id: diagObj.db.lookUpDomId(vertex.id)
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
};
|
|
1020
|
+
const addEdges = async function(edges, g, diagObj) {
|
|
1021
|
+
let cnt = 0;
|
|
1022
|
+
let defaultStyle;
|
|
1023
|
+
let defaultLabelStyle;
|
|
1024
|
+
if (edges.defaultStyle !== void 0) {
|
|
1025
|
+
const defaultStyles = getStylesFromArray(edges.defaultStyle);
|
|
1026
|
+
defaultStyle = defaultStyles.style;
|
|
1027
|
+
defaultLabelStyle = defaultStyles.labelStyle;
|
|
1028
|
+
}
|
|
1029
|
+
for (const edge of edges) {
|
|
1030
|
+
cnt++;
|
|
1031
|
+
const linkId = "L-" + edge.start + "-" + edge.end;
|
|
1032
|
+
const linkNameStart = "LS-" + edge.start;
|
|
1033
|
+
const linkNameEnd = "LE-" + edge.end;
|
|
1034
|
+
const edgeData = {};
|
|
1035
|
+
if (edge.type === "arrow_open") {
|
|
1036
|
+
edgeData.arrowhead = "none";
|
|
1037
|
+
} else {
|
|
1038
|
+
edgeData.arrowhead = "normal";
|
|
1039
|
+
}
|
|
1040
|
+
let style = "";
|
|
1041
|
+
let labelStyle = "";
|
|
1042
|
+
if (edge.style !== void 0) {
|
|
1043
|
+
const styles = getStylesFromArray(edge.style);
|
|
1044
|
+
style = styles.style;
|
|
1045
|
+
labelStyle = styles.labelStyle;
|
|
1046
|
+
} else {
|
|
1047
|
+
switch (edge.stroke) {
|
|
1048
|
+
case "normal":
|
|
1049
|
+
style = "fill:none";
|
|
1050
|
+
if (defaultStyle !== void 0) {
|
|
1051
|
+
style = defaultStyle;
|
|
1052
|
+
}
|
|
1053
|
+
if (defaultLabelStyle !== void 0) {
|
|
1054
|
+
labelStyle = defaultLabelStyle;
|
|
1055
|
+
}
|
|
1056
|
+
break;
|
|
1057
|
+
case "dotted":
|
|
1058
|
+
style = "fill:none;stroke-width:2px;stroke-dasharray:3;";
|
|
1059
|
+
break;
|
|
1060
|
+
case "thick":
|
|
1061
|
+
style = " stroke-width: 3.5px;fill:none";
|
|
1062
|
+
break;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
edgeData.style = style;
|
|
1066
|
+
edgeData.labelStyle = labelStyle;
|
|
1067
|
+
if (edge.interpolate !== void 0) {
|
|
1068
|
+
edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);
|
|
1069
|
+
} else if (edges.defaultInterpolate !== void 0) {
|
|
1070
|
+
edgeData.curve = interpolateToCurve(edges.defaultInterpolate, curveLinear);
|
|
1071
|
+
} else {
|
|
1072
|
+
edgeData.curve = interpolateToCurve(conf.curve, curveLinear);
|
|
1073
|
+
}
|
|
1074
|
+
if (edge.text === void 0) {
|
|
1075
|
+
if (edge.style !== void 0) {
|
|
1076
|
+
edgeData.arrowheadStyle = "fill: #333";
|
|
1077
|
+
}
|
|
1078
|
+
} else {
|
|
1079
|
+
edgeData.arrowheadStyle = "fill: #333";
|
|
1080
|
+
edgeData.labelpos = "c";
|
|
1081
|
+
if (evaluate(getConfig().flowchart.htmlLabels)) {
|
|
1082
|
+
edgeData.labelType = "html";
|
|
1083
|
+
edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}" style="${edgeData.labelStyle}">${await renderKatexSanitized(
|
|
1084
|
+
edge.text.replace(
|
|
1085
|
+
/fa[blrs]?:fa-[\w-]+/g,
|
|
1086
|
+
// cspell:disable-line
|
|
1087
|
+
(s) => `<i class='${s.replace(":", " ")}'></i>`
|
|
1088
|
+
),
|
|
1089
|
+
getConfig()
|
|
1090
|
+
)}</span>`;
|
|
1091
|
+
} else {
|
|
1092
|
+
edgeData.labelType = "text";
|
|
1093
|
+
edgeData.label = edge.text.replace(common$1.lineBreakRegex, "\n");
|
|
1094
|
+
if (edge.style === void 0) {
|
|
1095
|
+
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
|
|
1096
|
+
}
|
|
1097
|
+
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
edgeData.id = linkId;
|
|
1101
|
+
edgeData.class = linkNameStart + " " + linkNameEnd;
|
|
1102
|
+
edgeData.minlen = edge.length || 1;
|
|
1103
|
+
g.setEdge(diagObj.db.lookUpDomId(edge.start), diagObj.db.lookUpDomId(edge.end), edgeData, cnt);
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
const getClasses = function(text2, diagObj) {
|
|
1107
|
+
log$1.info("Extracting classes");
|
|
1108
|
+
return diagObj.db.getClasses();
|
|
1109
|
+
};
|
|
1110
|
+
const draw = async function(text2, id, _version, diagObj) {
|
|
1111
|
+
log$1.info("Drawing flowchart");
|
|
1112
|
+
const { securityLevel, flowchart: conf2 } = getConfig();
|
|
1113
|
+
let sandboxElement;
|
|
1114
|
+
if (securityLevel === "sandbox") {
|
|
1115
|
+
sandboxElement = select("#i" + id);
|
|
1116
|
+
}
|
|
1117
|
+
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
|
1118
|
+
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
|
|
1119
|
+
let dir = diagObj.db.getDirection();
|
|
1120
|
+
if (dir === void 0) {
|
|
1121
|
+
dir = "TD";
|
|
1122
|
+
}
|
|
1123
|
+
const nodeSpacing = conf2.nodeSpacing || 50;
|
|
1124
|
+
const rankSpacing = conf2.rankSpacing || 50;
|
|
1125
|
+
const g = new Graph({
|
|
1126
|
+
multigraph: true,
|
|
1127
|
+
compound: true
|
|
1128
|
+
}).setGraph({
|
|
1129
|
+
rankdir: dir,
|
|
1130
|
+
nodesep: nodeSpacing,
|
|
1131
|
+
ranksep: rankSpacing,
|
|
1132
|
+
marginx: 8,
|
|
1133
|
+
marginy: 8
|
|
1134
|
+
}).setDefaultEdgeLabel(function() {
|
|
1135
|
+
return {};
|
|
1136
|
+
});
|
|
1137
|
+
let subG;
|
|
1138
|
+
const subGraphs = diagObj.db.getSubGraphs();
|
|
1139
|
+
for (let i2 = subGraphs.length - 1; i2 >= 0; i2--) {
|
|
1140
|
+
subG = subGraphs[i2];
|
|
1141
|
+
diagObj.db.addVertex(subG.id, subG.title, "group", void 0, subG.classes);
|
|
1142
|
+
}
|
|
1143
|
+
const vert = diagObj.db.getVertices();
|
|
1144
|
+
log$1.warn("Get vertices", vert);
|
|
1145
|
+
const edges = diagObj.db.getEdges();
|
|
1146
|
+
let i = 0;
|
|
1147
|
+
for (i = subGraphs.length - 1; i >= 0; i--) {
|
|
1148
|
+
subG = subGraphs[i];
|
|
1149
|
+
selectAll("cluster").append("text");
|
|
1150
|
+
for (let j = 0; j < subG.nodes.length; j++) {
|
|
1151
|
+
log$1.warn(
|
|
1152
|
+
"Setting subgraph",
|
|
1153
|
+
subG.nodes[j],
|
|
1154
|
+
diagObj.db.lookUpDomId(subG.nodes[j]),
|
|
1155
|
+
diagObj.db.lookUpDomId(subG.id)
|
|
1156
|
+
);
|
|
1157
|
+
g.setParent(diagObj.db.lookUpDomId(subG.nodes[j]), diagObj.db.lookUpDomId(subG.id));
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
await addVertices(vert, g, id, root, doc, diagObj);
|
|
1161
|
+
await addEdges(edges, g, diagObj);
|
|
1162
|
+
const render$1 = new render();
|
|
1163
|
+
flowChartShapes.addToRender(render$1);
|
|
1164
|
+
render$1.arrows().none = function normal2(parent, id2, edge, type) {
|
|
1165
|
+
const marker = parent.append("marker").attr("id", id2).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
|
|
1166
|
+
const path = marker.append("path").attr("d", "M 0 0 L 0 0 L 0 0 z");
|
|
1167
|
+
applyStyle(path, edge[type + "Style"]);
|
|
1168
|
+
};
|
|
1169
|
+
render$1.arrows().normal = function normal2(parent, id2) {
|
|
1170
|
+
const marker = parent.append("marker").attr("id", id2).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto");
|
|
1171
|
+
marker.append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowheadPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
|
|
1172
|
+
};
|
|
1173
|
+
const svg2 = root.select(`[id="${id}"]`);
|
|
1174
|
+
const element = root.select("#" + id + " g");
|
|
1175
|
+
render$1(element, g);
|
|
1176
|
+
element.selectAll("g.node").attr("title", function() {
|
|
1177
|
+
return diagObj.db.getTooltip(this.id);
|
|
1178
|
+
});
|
|
1179
|
+
diagObj.db.indexNodes("subGraph" + i);
|
|
1180
|
+
for (i = 0; i < subGraphs.length; i++) {
|
|
1181
|
+
subG = subGraphs[i];
|
|
1182
|
+
if (subG.title !== "undefined") {
|
|
1183
|
+
const clusterRects = doc.querySelectorAll(
|
|
1184
|
+
"#" + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"] rect'
|
|
1185
|
+
);
|
|
1186
|
+
const clusterEl = doc.querySelectorAll(
|
|
1187
|
+
"#" + id + ' [id="' + diagObj.db.lookUpDomId(subG.id) + '"]'
|
|
1188
|
+
);
|
|
1189
|
+
const xPos = clusterRects[0].x.baseVal.value;
|
|
1190
|
+
const yPos = clusterRects[0].y.baseVal.value;
|
|
1191
|
+
const _width = clusterRects[0].width.baseVal.value;
|
|
1192
|
+
const cluster = select(clusterEl[0]);
|
|
1193
|
+
const te = cluster.select(".label");
|
|
1194
|
+
te.attr("transform", `translate(${xPos + _width / 2}, ${yPos + 14})`);
|
|
1195
|
+
te.attr("id", id + "Text");
|
|
1196
|
+
for (let j = 0; j < subG.classes.length; j++) {
|
|
1197
|
+
clusterEl[0].classList.add(subG.classes[j]);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
if (!conf2.htmlLabels) {
|
|
1202
|
+
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
|
1203
|
+
for (const label of labels) {
|
|
1204
|
+
const dim = label.getBBox();
|
|
1205
|
+
const rect2 = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
1206
|
+
rect2.setAttribute("rx", 0);
|
|
1207
|
+
rect2.setAttribute("ry", 0);
|
|
1208
|
+
rect2.setAttribute("width", dim.width);
|
|
1209
|
+
rect2.setAttribute("height", dim.height);
|
|
1210
|
+
label.insertBefore(rect2, label.firstChild);
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
setupGraphViewbox$1(g, svg2, conf2.diagramPadding, conf2.useMaxWidth);
|
|
1214
|
+
const keys = Object.keys(vert);
|
|
1215
|
+
keys.forEach(function(key) {
|
|
1216
|
+
const vertex = vert[key];
|
|
1217
|
+
if (vertex.link) {
|
|
1218
|
+
const node = root.select("#" + id + ' [id="' + diagObj.db.lookUpDomId(key) + '"]');
|
|
1219
|
+
if (node) {
|
|
1220
|
+
const link = doc.createElementNS("http://www.w3.org/2000/svg", "a");
|
|
1221
|
+
link.setAttributeNS("http://www.w3.org/2000/svg", "class", vertex.classes.join(" "));
|
|
1222
|
+
link.setAttributeNS("http://www.w3.org/2000/svg", "href", vertex.link);
|
|
1223
|
+
link.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener");
|
|
1224
|
+
if (securityLevel === "sandbox") {
|
|
1225
|
+
link.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top");
|
|
1226
|
+
} else if (vertex.linkTarget) {
|
|
1227
|
+
link.setAttributeNS("http://www.w3.org/2000/svg", "target", vertex.linkTarget);
|
|
1228
|
+
}
|
|
1229
|
+
const linkNode = node.insert(function() {
|
|
1230
|
+
return link;
|
|
1231
|
+
}, ":first-child");
|
|
1232
|
+
const shape = node.select(".label-container");
|
|
1233
|
+
if (shape) {
|
|
1234
|
+
linkNode.append(function() {
|
|
1235
|
+
return shape.node();
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
const label = node.select(".label");
|
|
1239
|
+
if (label) {
|
|
1240
|
+
linkNode.append(function() {
|
|
1241
|
+
return label.node();
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
};
|
|
1248
|
+
const flowRenderer = {
|
|
1249
|
+
setConf,
|
|
1250
|
+
addVertices,
|
|
1251
|
+
addEdges,
|
|
1252
|
+
getClasses,
|
|
1253
|
+
draw
|
|
1254
|
+
};
|
|
1255
|
+
const diagram = {
|
|
1256
|
+
parser: parser$1,
|
|
1257
|
+
db: flowDb,
|
|
1258
|
+
renderer: flowRendererV2,
|
|
1259
|
+
styles: flowStyles,
|
|
1260
|
+
init: (cnf) => {
|
|
1261
|
+
if (!cnf.flowchart) {
|
|
1262
|
+
cnf.flowchart = {};
|
|
1263
|
+
}
|
|
1264
|
+
cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
1265
|
+
flowRenderer.setConf(cnf.flowchart);
|
|
1266
|
+
flowDb.clear();
|
|
1267
|
+
flowDb.setGen("gen-1");
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
export {
|
|
1271
|
+
diagram
|
|
1272
|
+
};
|