The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
feat(markdown): Render Mermaid diagrams in the preview (#82)
l0ng-ai4100ab3341e4
diff --git a/package.json b/package.jsonindex 3521d1f75..b4e91ff5d 100644--- a/package.json+++ b/package.json@@ -52,6 +52,7 @@"emmet": "2.4.11","immer": "^11.1.21","marked": "^18.1.1",+ "mermaid": "12.1.0","react": "^19.1.0","react-dom": "^19.1.0","react-resizable-panels": "^4.14.6",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 06ab3552a..1c51fd36e 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -92,6 +92,9 @@ importers:marked:specifier: ^18.1.1version: 18.1.1+ mermaid:+ specifier: 12.1.0+ version: 12.1.0react:specifier: ^19.1.0version: 19.3.1@@ -168,6 +171,9 @@ packages:'@adobe/[email protected]':resolution: {integrity: sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==}+ '@antfu/[email protected]':+ resolution: {integrity: sha512-sdg9NxU3zR4Mnawfbc/x6GB5Wf17WYud5qOuEuxXjaKpYpMkISSJEjItGebXJ2bQ4DIcly4NYH23mtkGJjvKUw==}+'@asamuzakjp/[email protected]':resolution: {integrity: sha512-Q7ioeear07HwixdIitIn9KS1LZi97CEDFCSjPNm9v+y8KNbsu9q4Lrd4zUQW4faED+E7qxvfeVnbNRW46wFKuw==}engines: {node: ^22.22.2 || ^24.15.0 || >=26.0.0}@@ -247,6 +253,9 @@ packages:resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}engines: {node: '>=6.9.0'}+ '@braintree/[email protected]':+ resolution: {integrity: sha512-jigsZK+sMF/cuiB7sERuo9V7N9jx+dhmHHnQyDSVdpZwVutaBu7WvNYqMDLSgFgfB30n452TP3vjDAvFC973mA==}+'@bramus/[email protected]':resolution: {integrity: sha512-0GEz8qJWokkUVYQYRukmkSHIFNoBH8QTreeHrAFbvz1XFYc3Y+puhMs8PQ5x8GNugiC2l5jvDBXKLbBIByeSBw==}hasBin: true@@ -257,6 +266,21 @@ packages:'@cacheable/[email protected]':resolution: {integrity: sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==}+ '@chevrotain/[email protected]':+ resolution: {integrity: sha512-bA9dvWlhAUcHkNwU+8w9yiUxJPlj/Lm3VqS7MD+NbIR/7LmpNLuK/AWNFdCo/T3SK5ND0/UHf3IJvl/Jn/i6yg==}++ '@chevrotain/[email protected]':+ resolution: {integrity: sha512-bCARdAsG+eEbOveSXcOAC7pVxA04I1ionzeMOwIYf5NX7SaS7zgn4Dgug2BSqoL+iyKeMNSorQjsFSHJHsCNwg==}++ '@chevrotain/[email protected]':+ resolution: {integrity: sha512-kxpUkLtiaK09ph+dib+Yvm+3sWSnuwlo25gqfKRgTPNmF6H7uW4gVkMjaRdtnN783S9sM6vUNWh9CsxYX4QwKw==}++ '@chevrotain/[email protected]':+ resolution: {integrity: sha512-7qrYHRlKfWf2AvBfJi5eVOrKAkbxvMFsy/iIHTGIiApNcEecCaVIdR+mIQhyCBsTDJxBz4JWXHMo6krbhR9hVg==}++ '@chevrotain/[email protected]':+ resolution: {integrity: sha512-SzKYY68rseOrb9KILVzPsl6SjkQtdWw01SRGB5aCVI5kFcHltQsOYV3JB0Ffst72DgkvHCyDQ0NLwxtmCCf97Q==}+'@codemirror/[email protected]':resolution: {integrity: sha512-tlosUqb+3BbxCxZdu4tKeRghPFC+QM7q4X5YhKV2eCmPG+1r2F3f4AaSz5sCrFqUtX4Jh20VFTKecl16MgiV9g==}@@ -487,6 +511,12 @@ packages:resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}engines: {node: '>=18.18'}+ '@iconify/[email protected]':+ resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==}++ '@iconify/[email protected]':+ resolution: {integrity: sha512-JZHlwdID+dy+lTgbYC8NEC4zeugqeYsc6jewvzb4c58kHauJn+X7rNwQjxz5p2qSjqaEeQoLkCIQ9v/H4PK0/w==}+'@jridgewell/[email protected]':resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}@@ -566,6 +596,10 @@ packages:'@marijn/[email protected]':resolution: {integrity: sha512-Wy0V7+SGUjnF9/TkiM1hKVDPj7jKXduPNboMVtHTA8dySMURWqfg/JZ9E2Sq8JgSJmkl7k7Qe9FLeMSrSraWmQ==}+ '@mermaid-js/[email protected]':+ resolution: {integrity: sha512-j37dj/h6p6pots1L7pLPPNuABEEu9WP4OYg9pW1g+nYG331j0+3canE9OagtYdytYvdSAMG+2fKU5cxep6LgjA==}+ engines: {node: '>=22.12.0'}+'@oxc-project/[email protected]':resolution: {integrity: sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==}@@ -820,6 +854,99 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}+ '@types/[email protected]':+ resolution: {integrity: sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A==}++ '@types/[email protected]':+ resolution: {integrity: sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==}++ '@types/[email protected]':+ resolution: {integrity: sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-5o9OIAdKkhN1QItV2oqaE5KMIiXAvDWBDPrD85e58Qlz1c1kI/J0NcqbEG88CoTwJrYe7ntUCVfeUl2UJKbWgA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ==}++ '@types/[email protected]':+ resolution: {integrity: sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g==}++ '@types/[email protected]':+ resolution: {integrity: sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==}++ '@types/[email protected]':+ resolution: {integrity: sha512-65Emv9fQiQQqphLlRkuQ5ypPsOmWPhtBGCMv61JDPEPMvsx+gzhGf74yw1a78xFKPj6zw4AgQICJoQv0vK9M2w==}++ '@types/[email protected]':+ resolution: {integrity: sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-UHYId5WTCx4L4YNel7NU00XUXXgvgpgZOvp10PuvsQENjMDXhh2RyFc0KBjO7B45ne4Ha1yVH7ii0vnzKkuzWA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ==}++ '@types/[email protected]':+ resolution: {integrity: sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-Qe/KWYhEiIIxGs7HrAAjMfShxKldx19SJtr5zu53f3afPsdZNz7HHtdTLXo/kqeiWNXVycI24kSnfzBYkTzpgw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-kVd74ta9eof3eJOvbNd1vGKS/XERRyQbT26Og63hIsvDO84cjD5gEOhsXf26w3FSoNlPVz84DOFcKv/oou+fMw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==}++ '@types/[email protected]':+ resolution: {integrity: sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==}++ '@types/[email protected]':+ resolution: {integrity: sha512-uZS5shfxzO3rGlu0cC3bjmMFKsXv+SmZZcgp0KD22ts4uGXp5EVYGzu/0YdwZeKmddhcAccYtREJKkPfXkZuCg==}++ '@types/[email protected]':+ resolution: {integrity: sha512-0sE1406XBYJGiqD3AusTl9ZqC//2mIXix51tbom25gDCA8ri4xnSZg28CaSE8Srl6FClqABUKfsn0qghgdepMA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==}+'@types/[email protected]':resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}@@ -833,6 +960,9 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==}+ '@types/[email protected]':+ resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==}+'@types/[email protected]':resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}@@ -909,6 +1039,9 @@ packages:resolution: {integrity: sha512-zozlN0UA32bSG2zkKAgQyRYSbEISVoyU6vvkKYo2aSny74D8Jh4e+POkJ6Lk0dlezZi5x7TtD+88Xb06IB8nhg==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}+ '@upsetjs/[email protected]':+ resolution: {integrity: sha512-WbBhLrooyePuQ1VZxrJjtLvTc4NVfpOyKx0sKqioq9bX1C1m7Jgykkn8gLrtwumBioXIqam8DLxp88Adbue6Hw==}+'@vitejs/[email protected]':resolution: {integrity: sha512-fhJNGUdscQa4HkI0xFxwonWyhnVReCPDbXI7FH7jmzpnVCrFQI7PRrhWecO263610vOrs9tr2Y4xcf8uAdFxbw==}engines: {node: ^20.19.0 || >=22.12.0}@@ -1014,6 +1147,10 @@ packages:resolution: {integrity: sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==}engines: {node: '>=18'}+ resolution: {integrity: sha512-GTouk5YzgBxlTPCaDn5q0q2EJKkrYmnPF+HmF8v0Qo4r3iyPG7HJivkN1wthCXZcm3sIcZFpGTRovLPNdJNRCA==}+ engines: {node: '>=22.0.0'}+resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}engines: {node: '>=6'}@@ -1021,9 +1158,23 @@ packages:resolution: {integrity: sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==}+ resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==}+ engines: {node: '>= 10'}++ resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==}+ engines: {node: '>= 12'}+resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}+ resolution: {integrity: sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg==}++ resolution: {integrity: sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g==}+resolution: {integrity: sha512-aK6BbWfhf4U/wCcLHKPJl/xa6VkVstRaPywWtMKGwuOLc/wZTyQYuoxgvZnNsBvv7Kg3YTBQYYBCggcviQczuA==}@@ -1041,10 +1192,169 @@ packages:resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}+ resolution: {integrity: sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ==}+ peerDependencies:+ cytoscape: ^3.2.0++ resolution: {integrity: sha512-ki1/VuRIHFCzxWNrsshHYPs6L7TvLu3DL+TyIGEsRcvVERmxokbf5Gdk7mFxZnTdiGtnA4cfSmjZJMviqSuZrQ==}+ peerDependencies:+ cytoscape: ^3.2.0++ resolution: {integrity: sha512-msY99tMY8iWTg+sIPGfSqDcPNOt4xcj+v/K/7qUFaCUxxlqnMkUYLBjRUzn9W5CU/R2hrmtJa5+UtovrEM2ctg==}+ engines: {node: '>=0.10'}++ resolution: {integrity: sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==}++ resolution: {integrity: sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==}+ engines: {node: '>=12'}+ hasBin: true++ resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==}++ resolution: {integrity: sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ==}++ resolution: {integrity: sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==}++ resolution: {integrity: sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==}+ engines: {node: '>=12'}+ peerDependencies:+ d3-selection: 2 - 3++ resolution: {integrity: sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==}+ engines: {node: '>=12'}++ resolution: {integrity: sha512-P4rFMVq9ESWqmOgK+dlXvOtLwYg0i7u0HBGJER0LZDJT2VHIPAMZ/riPxqJceWMStH5+E61QxFra9kIS3AqdMg==}+resolution: {integrity: sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ==}engines: {node: ^22.14.0 || >=24.0.0}+ resolution: {integrity: sha512-QDTCU0M0MxR3hQfnlDJfwekQiaanm1ubOD231u73WBckQ/fsamwRLiE2GBz6D3a/xF1NgfiDLJjXBa1hYOYTtQ==}+resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}engines: {node: '>=6.0'}@@ -1060,6 +1370,9 @@ packages:resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}+ resolution: {integrity: sha512-AGrQ4QSgssa1NGmWmLPqN5NY2KajF5MqxetNEO+o0n3ZwZZeTmt7bBnvzHWrmkZFxGgr4HdyFgelzgi06otLuQ==}+resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}engines: {node: '>=6'}@@ -1080,6 +1393,9 @@ packages:resolution: {integrity: sha512-4SC9HHSFjO/liAhifpdOL5hG9b4BP7/5G3y3UPZVO8trlAXr1CaUEEJL0gWK3kOcYcZrOA5rkwG45Gra/lTIgg==}+ resolution: {integrity: sha512-f/ZeWvW/BCXbhGEf1Ujp29EASo/lk1FDnETgNKwJrsVvGZhUWCZyg3xLJjAsxfOmt8KjswHmI5EwCQcPMpOYhQ==}+resolution: {integrity: sha512-23QPJB3moh/U9sT4rQzGgeyyGIrcM+GH5uVYg2C6wZIxAIJq7Ng3QLT79tl8FUwDXhyq9SusfknOrofAKqvgyQ==}@@ -1090,6 +1406,9 @@ packages:resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==}+ resolution: {integrity: sha512-3+AYXp9fmJ/UhHBMYj2/U+RaUouMD90SzoItyDOB2Za7W6dB7fQApFGnZPl2MF6K8/Tv1koh1JyirSx/kju6Pw==}+resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}engines: {node: '>=6'}@@ -1197,6 +1516,9 @@ packages:resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}engines: {node: '>=10.13.0'}+ resolution: {integrity: sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg==}+resolution: {integrity: sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==}engines: {node: '>=20'}@@ -1217,6 +1539,10 @@ packages:resolution: {integrity: sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==}engines: {node: ^22.13.0 || >=24.0.0}+ resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}+ engines: {node: '>=0.10.0'}+resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}engines: {node: '>= 4'}@@ -1228,6 +1554,9 @@ packages:resolution: {integrity: sha512-bZSadeCPGdaY5/qRLgr6mDSH1ra21rD3rqpiWk7+QTr4ayYPTE9qZYdLh/NdPhMe0wSrTvHD/Lk8q5EwhUs0aw==}+ resolution: {integrity: sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==}+resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}engines: {node: '>=0.8.19'}@@ -1236,6 +1565,13 @@ packages:resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==}engines: {node: '>=8'}+ resolution: {integrity: sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==}++ resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}engines: {node: '>=0.10.0'}@@ -1278,9 +1614,22 @@ packages:engines: {node: '>=6'}hasBin: true+ resolution: {integrity: sha512-Eeo8Ys1doU1z+x8AZsPpQu+p/QcZBI5PeOo7QGQdy2x2m0MU/hYagBbGOmXwr5KVbEfVuWv9LpnQWeehogurjg==}+ hasBin: true+resolution: {integrity: sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==}+ resolution: {integrity: sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw==}++ resolution: {integrity: sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==}++ resolution: {integrity: sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg==}+resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}engines: {node: '>= 0.8.0'}@@ -1363,6 +1712,9 @@ packages:resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}engines: {node: '>=10'}+ resolution: {integrity: sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==}+resolution: {integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==}engines: {node: 20 || >=22}@@ -1377,6 +1729,11 @@ packages:resolution: {integrity: sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==}+ resolution: {integrity: sha512-TI3V8YYWvkVf3KJe1dRkpnjs68JUPyEa5vjKrp1XEEJUAOaQc+Qj+L1qWbPd0SJuAdQkFU0h73sXXqwDYxsiDA==}+ engines: {node: '>= 20'}+ hasBin: true+resolution: {integrity: sha512-zEGgrtUG8crk+TrMacJSVABU4DYDDkS8uqgU3ohrn/2fW9C2AEfUrO3m6IhpIpQpl7YcVpiXXC9cSMWDANT3dg==}engines: {node: '>= 20'}@@ -1385,6 +1742,10 @@ packages:resolution: {integrity: sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==}+ resolution: {integrity: sha512-wlVCp+8eTupfCeeFvoZNNiTuHrvag0P2jz/ILgb/f/6jkVokUefOcujefi8qUe/j2asHiSePncVsz/xzzA80LQ==}+ engines: {node: '>=22.12.0'}+resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}engines: {node: '>=4'}@@ -1424,9 +1785,15 @@ packages:resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==}engines: {node: '>=10'}+ resolution: {integrity: sha512-zAMfbta9nPA8AKkA4WdmNAT8R8s6Dk0/xwPsqNnRidMFcLo1YkLuPDTgs2f64XdzS8vbLNnoJ+uUIkgbz7oRHA==}+resolution: {integrity: sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==}+ resolution: {integrity: sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w==}+resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}engines: {node: '>=8'}@@ -1452,6 +1819,12 @@ packages:engines: {node: '>=20'}hasBin: true+ resolution: {integrity: sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A==}++ resolution: {integrity: sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g==}+resolution: {integrity: sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==}engines: {node: ^10 || ^12 || >=14}@@ -1503,11 +1876,23 @@ packages:resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}engines: {node: '>=0.10.0'}+ resolution: {integrity: sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==}+resolution: {integrity: sha512-eTBTTqMR6uHKLgcUqpJP8ntzDI6V4LYA8negAMBEI7gkgVvOdrx6VsvS2Ym+83KhOPdLCHWJu0w7UQFJZhHKNw==}engines: {node: ^20.19.0 || >=22.12.0}hasBin: true+ resolution: {integrity: sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==}++ resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==}++ resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}+resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==}engines: {node: '>=v12.22.7'}@@ -1546,6 +1931,9 @@ packages:resolution: {integrity: sha512-XXWIQt633/EpAFx8aZDOTjBzrCaGmhvEQlQo6MVPfa2OzO2cWo+4hV9h+6UkHYlXGfy+ODXKUdP7Pthmcu5ATw==}+ resolution: {integrity: sha512-5Z9ZpRzfuH6l/UAvCPAPUo3665Nk2wLaZU3x+TLHKVzIz33+sbJqbtrYoC3KD4/uVOr2Zp+L0LySezP9OHV9yA==}+resolution: {integrity: sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==}engines: {node: '>=20.0.0'}@@ -1579,6 +1967,10 @@ packages:peerDependencies:typescript: '>=4.8.4'+ resolution: {integrity: sha512-JfJeIHke7y2egdGGgRAvpCwYFUsHlM2gPcrVOxFkznt/4uzQ7HFmvE63iFHVLBJNDuyDOQgijDK/tXH/f6Msjg==}+ engines: {node: '>=6.10'}+resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}engines: {node: '>= 0.8.0'}@@ -1611,6 +2003,10 @@ packages:resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}+ resolution: {integrity: sha512-Sc5u1VVln93y1Xnz4R+CunOZc7R9LUcTmhj7Rc7Eg3HVcf7rVn2FOoa812fe0W8p3jD7xeoGSYbfqCGGH2B6xw==}+ hasBin: true+resolution: {integrity: sha512-IftLE8phJhdNRIGNEV4JCCvfNScoZQVfcXaN8TQropWGJtOHcu+iAB9pHcuGvmEb/kddw0LBe/jS8ztdC6xdiQ==}engines: {node: ^20.19.0 || >=22.12.0}@@ -1773,6 +2169,11 @@ snapshots:'@adobe/[email protected]': {}+ '@antfu/[email protected]':+ dependencies:+ package-manager-detector: 1.9.0+ tinyexec: 1.3.1+'@asamuzakjp/[email protected]':dependencies:'@csstools/css-calc': 3.4.3(@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])@@ -1890,6 +2291,8 @@ snapshots:'@babel/helper-string-parser': 7.29.7'@babel/helper-validator-identifier': 7.29.7+ '@braintree/[email protected]': {}+'@bramus/[email protected]':dependencies:css-tree: 3.2.1@@ -1906,6 +2309,21 @@ snapshots:hashery: 1.5.1keyv: 5.6.0+ '@chevrotain/[email protected]':+ dependencies:+ '@chevrotain/gast': 13.2.0+ '@chevrotain/types': 13.2.0++ '@chevrotain/[email protected]':+ dependencies:+ '@chevrotain/types': 13.2.0++ '@chevrotain/[email protected]': {}++ '@chevrotain/[email protected]': {}++ '@chevrotain/[email protected]': {}+'@codemirror/[email protected]':dependencies:'@codemirror/language': 6.13.1@@ -2275,6 +2693,14 @@ snapshots:'@humanwhocodes/[email protected]': {}+ '@iconify/[email protected]': {}++ '@iconify/[email protected]':+ dependencies:+ '@antfu/install-pkg': 2.1.0+ '@iconify/types': 2.0.0+ import-meta-resolve: 4.2.0+'@jridgewell/[email protected]':dependencies:'@jridgewell/sourcemap-codec': 1.6.0@@ -2397,6 +2823,10 @@ snapshots:'@marijn/[email protected]': {}+ '@mermaid-js/[email protected]':+ dependencies:+ '@chevrotain/types': 13.2.0+'@oxc-project/[email protected]': {}'@playwright/[email protected]':@@ -2570,6 +3000,123 @@ snapshots:'@types/deep-eql': 4.0.2assertion-error: 2.0.1+ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/d3-selection': 3.0.12++ '@types/[email protected]':+ dependencies:+ '@types/d3-selection': 3.0.12++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/d3-array': 3.2.2+ '@types/geojson': 7946.0.16++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/d3-selection': 3.0.12++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/d3-dsv': 3.0.7++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/geojson': 7946.0.16++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/d3-color': 3.1.3++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/d3-time': 3.0.4++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/d3-path': 3.1.1++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/d3-selection': 3.0.12++ '@types/[email protected]':+ dependencies:+ '@types/d3-interpolate': 3.0.4+ '@types/d3-selection': 3.0.12++ '@types/[email protected]':+ dependencies:+ '@types/d3-array': 3.2.2+ '@types/d3-axis': 3.0.6+ '@types/d3-brush': 3.0.6+ '@types/d3-chord': 3.0.6+ '@types/d3-color': 3.1.3+ '@types/d3-contour': 3.0.6+ '@types/d3-delaunay': 6.0.4+ '@types/d3-dispatch': 3.0.7+ '@types/d3-drag': 3.0.7+ '@types/d3-dsv': 3.0.7+ '@types/d3-ease': 3.0.2+ '@types/d3-fetch': 3.0.7+ '@types/d3-force': 3.0.10+ '@types/d3-format': 3.0.4+ '@types/d3-geo': 3.1.1+ '@types/d3-hierarchy': 3.1.7+ '@types/d3-interpolate': 3.0.4+ '@types/d3-path': 3.1.1+ '@types/d3-polygon': 3.0.2+ '@types/d3-quadtree': 3.0.6+ '@types/d3-random': 3.0.4+ '@types/d3-scale': 4.0.9+ '@types/d3-scale-chromatic': 3.1.0+ '@types/d3-selection': 3.0.12+ '@types/d3-shape': 3.2.0+ '@types/d3-time': 3.0.4+ '@types/d3-time-format': 4.0.3+ '@types/d3-timer': 3.0.2+ '@types/d3-transition': 3.0.9+ '@types/d3-zoom': 3.0.9+'@types/[email protected]': {}'@types/[email protected]':@@ -2580,6 +3127,8 @@ snapshots:'@types/[email protected]': {}+ '@types/[email protected]': {}+'@types/[email protected]': {}'@types/[email protected]':@@ -2688,6 +3237,11 @@ snapshots:'@typescript-eslint/types': 8.71.2eslint-visitor-keys: 5.0.1+ '@upsetjs/[email protected]':+ optionalDependencies:+ d3-selection: 3.0.0+ d3-transition: 3.0.1([email protected])+dependencies:'@rolldown/pluginutils': 1.0.1@@ -2769,6 +3323,14 @@ snapshots:+ dependencies:+ '@chevrotain/cst-dts-gen': 13.2.0+ '@chevrotain/gast': 13.2.0+ '@chevrotain/regexp-to-ast': 13.2.0+ '@chevrotain/types': 13.2.0+ '@chevrotain/utils': 13.2.0+@@ -2781,8 +3343,20 @@ snapshots:'@codemirror/state': 6.7.6'@codemirror/view': 6.43.14+ [email protected]: {}++ [email protected]: {}++ dependencies:+ layout-base: 1.0.2++ dependencies:+ layout-base: 2.0.1+@@ -2800,6 +3374,190 @@ snapshots:+ dependencies:+ cose-base: 1.0.3+ cytoscape: 3.34.4++ dependencies:+ cose-base: 2.2.0+ cytoscape: 3.34.4++ [email protected]: {}++ dependencies:+ internmap: 1.0.1++ dependencies:+ internmap: 2.0.3++ [email protected]: {}++ dependencies:+ d3-dispatch: 3.0.1+ d3-drag: 3.0.0+ d3-interpolate: 3.0.1+ d3-selection: 3.0.0+ d3-transition: 3.0.1([email protected])++ dependencies:+ d3-path: 3.1.0++ [email protected]: {}++ dependencies:+ d3-array: 3.2.4++ dependencies:+ delaunator: 5.1.0++ [email protected]: {}++ dependencies:+ d3-dispatch: 3.0.1+ d3-selection: 3.0.0++ dependencies:+ commander: 7.2.0+ iconv-lite: 0.6.3+ rw: 1.3.3++ [email protected]: {}++ dependencies:+ d3-dsv: 3.0.1++ dependencies:+ d3-dispatch: 3.0.1+ d3-quadtree: 3.0.1+ d3-timer: 3.0.1++ [email protected]: {}++ dependencies:+ d3-array: 3.2.4++ [email protected]: {}++ dependencies:+ d3-color: 3.1.0++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ dependencies:+ d3-array: 2.12.1+ d3-shape: 1.3.7++ dependencies:+ d3-color: 3.1.0+ d3-interpolate: 3.0.1++ dependencies:+ d3-array: 3.2.4+ d3-format: 3.1.2+ d3-interpolate: 3.0.1+ d3-time: 3.1.0+ d3-time-format: 4.1.0++ [email protected]: {}++ dependencies:+ d3-path: 1.0.9++ dependencies:+ d3-path: 3.1.0++ dependencies:+ d3-time: 3.1.0++ dependencies:+ d3-array: 3.2.4++ [email protected]: {}++ dependencies:+ d3-color: 3.1.0+ d3-dispatch: 3.0.1+ d3-ease: 3.0.1+ d3-interpolate: 3.0.1+ d3-selection: 3.0.0+ d3-timer: 3.0.1++ dependencies:+ d3-dispatch: 3.0.1+ d3-drag: 3.0.0+ d3-interpolate: 3.0.1+ d3-selection: 3.0.0+ d3-transition: 3.0.1([email protected])++ dependencies:+ d3-array: 3.2.4+ d3-axis: 3.0.0+ d3-brush: 3.0.0+ d3-chord: 3.0.1+ d3-color: 3.1.0+ d3-contour: 4.0.2+ d3-delaunay: 6.0.4+ d3-dispatch: 3.0.1+ d3-drag: 3.0.0+ d3-dsv: 3.0.1+ d3-ease: 3.0.1+ d3-fetch: 3.0.1+ d3-force: 3.0.0+ d3-format: 3.1.2+ d3-geo: 3.1.1+ d3-hierarchy: 3.1.2+ d3-interpolate: 3.0.1+ d3-path: 3.1.0+ d3-polygon: 3.0.1+ d3-quadtree: 3.0.1+ d3-random: 3.0.1+ d3-scale: 4.0.2+ d3-scale-chromatic: 3.1.0+ d3-selection: 3.0.0+ d3-shape: 3.2.0+ d3-time: 3.1.0+ d3-time-format: 4.1.0+ d3-timer: 3.0.1+ d3-transition: 3.0.1([email protected])+ d3-zoom: 3.0.0++ dependencies:+ d3: 7.9.0+ lodash-es: 4.18.1+dependencies:whatwg-mimetype: 5.0.0@@ -2807,6 +3565,8 @@ snapshots:transitivePeerDependencies:- '@noble/hashes'+ [email protected]: {}+dependencies:ms: 2.1.3@@ -2815,6 +3575,10 @@ snapshots:+ dependencies:+ robust-predicates: 3.0.3+@@ -2829,6 +3593,8 @@ snapshots:+ [email protected]: {}+dependencies:'@emmetio/abbreviation': 2.3.3@@ -2838,6 +3604,8 @@ snapshots:+ [email protected]: {}+@@ -2959,6 +3727,8 @@ snapshots:dependencies:is-glob: 4.0.3+ [email protected]: {}+dependencies:hookified: 1.15.1@@ -2979,16 +3749,26 @@ snapshots:transitivePeerDependencies:- '@noble/hashes'+ dependencies:+ safer-buffer: 2.1.2++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}+@@ -3034,10 +3814,20 @@ snapshots:+ dependencies:+ commander: 8.3.0+dependencies:'@keyv/serialize': 1.1.1+ [email protected]: {}++ [email protected]: {}++ [email protected]: {}+dependencies:prelude-ls: 1.2.1@@ -3096,6 +3886,8 @@ snapshots:dependencies:p-locate: 5.0.0+ [email protected]: {}+@@ -3108,10 +3900,38 @@ snapshots:dependencies:'@jridgewell/sourcemap-codec': 1.6.0+ [email protected]: {}++ dependencies:+ '@braintree/sanitize-url': 7.1.2+ '@iconify/utils': 3.1.7+ '@mermaid-js/parser': 2.0.1+ '@types/d3': 7.4.3+ '@upsetjs/venn.js': 2.0.0+ chevrotain: 13.2.0+ cytoscape: 3.34.4+ cytoscape-cose-bilkent: 4.1.0([email protected])+ cytoscape-fcose: 2.2.0([email protected])+ d3: 7.9.0+ d3-sankey: 0.12.3+ dagre-d3-es: 7.0.14+ dayjs: 1.11.23+ dompurify: 3.4.17+ elkjs: 0.9.3+ es-toolkit: 1.53.0+ katex: 0.16.47+ khroma: 2.1.0+ marked: 16.4.2+ roughjs: 4.6.6+ stylis: 4.4.0+ ts-dedent: 2.3.0+ uuid: 14.0.3+@@ -3145,10 +3965,14 @@ snapshots:dependencies:p-limit: 3.1.0+ [email protected]: {}+dependencies:entities: 8.1.0+ [email protected]: {}+@@ -3163,6 +3987,13 @@ snapshots:dependencies:playwright-core: 1.64.1+ [email protected]: {}++ dependencies:+ path-data-parser: 0.1.0+ points-on-curve: 0.2.0+dependencies:nanoid: 3.3.20@@ -3206,6 +4037,8 @@ snapshots:+ [email protected]: {}+dependencies:'@oxc-project/types': 0.154.0@@ -3227,6 +4060,17 @@ snapshots:'@rolldown/binding-win32-arm64-msvc': 1.2.14'@rolldown/binding-win32-x64-msvc': 1.2.14+ dependencies:+ hachure-fill: 0.5.2+ path-data-parser: 0.1.0+ points-on-curve: 0.2.0+ points-on-path: 0.2.1++ [email protected]: {}++ [email protected]: {}+dependencies:xmlchars: 2.2.0@@ -3253,6 +4097,8 @@ snapshots:+ [email protected]: {}+@@ -3280,6 +4126,8 @@ snapshots:dependencies:typescript: 6.0.3+ [email protected]: {}+dependencies:prelude-ls: 1.2.1@@ -3311,6 +4159,8 @@ snapshots:dependencies:punycode: 2.3.1+ [email protected]: {}+[email protected](@types/[email protected]):dependencies:lightningcss: 1.33.0diff --git a/src/features/viewers/markdown/Markdown.module.css b/src/features/viewers/markdown/Markdown.module.cssindex 2c4005d58..57f2e6796 100644--- a/src/features/viewers/markdown/Markdown.module.css+++ b/src/features/viewers/markdown/Markdown.module.css@@ -188,3 +188,30 @@.preview :global(.tok-operator) {color: var(--syn-punct);}++/* Mermaid diagrams: the source stays until the diagram is drawn, and next to an error. */+.preview :global([data-mermaid]) {+ margin: 0 0 1em;+}+.preview :global([data-mermaid] > pre) {+ margin: 0;+}+.preview :global([data-mermaid-state="ok"] > pre) {+ display: none;+}+.preview :global(.mermaid-output) {+ overflow-x: auto;+ text-align: center;+}+.preview :global([data-mermaid-state="error"] > .mermaid-output) {+ margin-top: 6px;+ padding: 6px 10px;+ border-left: 3px solid var(--danger);+ border-radius: var(--radius-small);+ background: var(--bg-elev);+ color: var(--danger);+ font-family: var(--font-mono);+ font-size: var(--fs-code);+ text-align: left;+ white-space: pre-wrap;+}diff --git a/src/features/viewers/markdown/MarkdownEditor.tsx b/src/features/viewers/markdown/MarkdownEditor.tsxindex 5876f9192..a8c39c2cd 100644--- a/src/features/viewers/markdown/MarkdownEditor.tsx+++ b/src/features/viewers/markdown/MarkdownEditor.tsx@@ -3,13 +3,24 @@* side by side, switched from the floating toolbar at the top right. The* preview follows the editor's scroll position in the split layout.*/-import { useDeferredValue, useEffect, useLayoutEffect, useMemo, useRef, type MouseEvent, type ReactNode } from "react";+import {+ useDeferredValue,+ useEffect,+ useLayoutEffect,+ useMemo,+ useRef,+ useState,+ useSyncExternalStore,+ type MouseEvent,+ type ReactNode,+} from "react";import clsx from "clsx";import { call, commands, isTauri } from "@/platform/ipc";import { maybeEditorService } from "@/workbench/contributions";import { highlightInto } from "@/editor/lsp/markdown";import { IconButton, selectableText } from "@/ui";import { useLiveMarkdown } from "./live";+import { hasMermaid, MERMAID_SELECTOR, renderMermaidIn, subscribeTheme, themeKey } from "./mermaid";import { modeOf, useMarkdownModes } from "./modes";import { ANCHOR_PREFIX, previewOffsetForLine, renderMarkdown, resolveLink, slugify } from "./render";import styles from "./Markdown.module.css";@@ -74,6 +85,22 @@ function MarkdownPreview({ path, sync }: { path: string; sync: boolean }) {const deferred = useDeferredValue(text ?? "");const html = useMemo(() => renderMarkdown(deferred), [deferred]);const ref = useRef<HTMLDivElement>(null);+ const theme = useSyncExternalStore(subscribeTheme, themeKey, () => "");+ const diagrams = useRef<Node[]>([]);+ const [diagramsDrawn, setDiagramsDrawn] = useState(0);++ // Mermaid diagrams: before paint, so cached ones don't flash their source.+ useLayoutEffect(() => {+ const root = ref.current;+ if (!root || !hasMermaid(root)) return;+ const pass = renderMermaidIn(root, diagrams.current);+ let live = true;+ if (pass.async) void pass.done.then(() => live && setDiagramsDrawn((n) => n + 1));+ return () => {+ live = false;+ pass.cancel();+ };+ }, [html, theme]);// Images and code highlighting after each render.useEffect(() => {@@ -98,6 +125,7 @@ function MarkdownPreview({ path, sync }: { path: string; sync: boolean }) {);});root.querySelectorAll<HTMLElement>("pre > code").forEach((code) => {+ if (code.closest(MERMAID_SELECTOR)) return;const lang = [...code.classList].find((c) => c.startsWith("language-"))?.slice("language-".length) ?? null;const src = (code.textContent ?? "").replace(/\n+$/, "");code.textContent = src;@@ -117,7 +145,7 @@ function MarkdownPreview({ path, sync }: { path: string; sync: boolean }) {top: el.offsetTop,}));root.scrollTop = topLine <= 0 ? 0 : previewOffsetForLine(blocks, topLine, root.scrollHeight);- }, [html, topLine, scrollSeq, sync]);+ }, [html, topLine, scrollSeq, sync, diagramsDrawn]);const onClick = (e: MouseEvent) => {const a = (e.target as Element).closest("a");diff --git a/src/features/viewers/markdown/mermaid.test.ts b/src/features/viewers/markdown/mermaid.test.tsnew file mode 100644index 000000000..71ff0c7cc--- /dev/null+++ b/src/features/viewers/markdown/mermaid.test.ts@@ -0,0 +1,119 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+import { renderMarkdown } from "./render";+import { hasMermaid, renderMermaidIn, resetMermaidForTests } from "./mermaid";++const m = vi.hoisted(() => ({+ loads: 0,+ initialize: vi.fn(),+ render: vi.fn(async (id: string, text: string) => {+ // Like mermaid: a measuring node under <body> while rendering.+ const tmp = document.createElement("div");+ tmp.id = `d${id}`;+ document.body.append(tmp);+ if (text.includes("bad")) throw new Error("Parse error on line 2:\nbad\n^");+ return { svg: `<svg id="${id}"><text>${text.split("\n")[0]}</text></svg>` };+ }),+}));++vi.mock("mermaid", () => {+ m.loads++;+ return { default: { initialize: m.initialize, render: m.render } };+});++function preview(md: string): HTMLElement {+ const root = document.createElement("div");+ root.innerHTML = renderMarkdown(md);+ document.body.append(root);+ return root;+}++const SEQ = "```mermaid\nsequenceDiagram\n A->B:test\n```\n";++describe("mermaid in the markdown preview", () => {+ beforeEach(() => {+ resetMermaidForTests();+ m.render.mockClear();+ m.initialize.mockClear();+ document.body.innerHTML = "";+ });++ it("emits a placeholder holding the escaped source, other code blocks unchanged", () => {+ const root = preview(+ `# T\n\n${SEQ}\n\`\`\`js\nlet a = 1;\n\`\`\`\n\n\`\`\`Mermaid title\ngraph TD\n a["<b>x</b>"]-->b\n\`\`\`\n`,+ );+ const blocks = root.querySelectorAll<HTMLElement>("[data-mermaid]");+ expect(blocks).toHaveLength(2);+ expect(blocks[0]!.parentElement?.dataset.line).toBe("2");+ expect(blocks[0]!.querySelector("pre > code.language-mermaid")?.textContent).toBe("sequenceDiagram\n A->B:test");+ expect(blocks[1]!.querySelector("code")?.textContent).toContain('a["<b>x</b>"]');+ expect(blocks[1]!.querySelector("b")).toBeNull();+ expect(root.querySelector("code.language-js")?.closest("[data-mermaid]")).toBeNull();+ });++ it("loads mermaid only for previews with a diagram", async () => {+ const plain = preview("# Plain\n\n```js\n1\n```\n");+ expect(hasMermaid(plain)).toBe(false);+ const pass = renderMermaidIn(plain);+ expect(pass.async).toBe(false);+ await pass.done;+ expect(m.loads).toBe(0);++ const root = preview(SEQ);+ expect(hasMermaid(root)).toBe(true);+ await renderMermaidIn(root).done;+ expect(m.loads).toBe(1);+ expect(m.initialize).toHaveBeenCalledWith(+ expect.objectContaining({ startOnLoad: false, securityLevel: "strict", theme: "base" }),+ );+ const block = root.querySelector<HTMLElement>("[data-mermaid]")!;+ expect(block.getAttribute("data-mermaid-state")).toBe("ok");+ expect(block.querySelector(".mermaid-output svg")).not.toBeNull();+ // Temporary nodes mermaid leaves under <body> are removed.+ expect(document.body.querySelector(":scope > [id^='d']")).toBeNull();+ });++ it("shows syntax errors inline next to the source without throwing", async () => {+ const root = preview("```mermaid\nsequenceDiagram\nbad\n```\n");+ await expect(renderMermaidIn(root).done).resolves.toBeUndefined();+ const block = root.querySelector<HTMLElement>("[data-mermaid]")!;+ expect(block.getAttribute("data-mermaid-state")).toBe("error");+ expect(block.querySelector("pre code")?.textContent).toContain("bad");+ const error = block.querySelector(".mermaid-output")!;+ expect(error.getAttribute("role")).toBe("alert");+ expect(error.textContent).toContain("Parse error on line 2");+ expect(error.querySelector("svg")).toBeNull();+ });++ it("renders with unique ids, reuses results and keeps the old diagram while a new one renders", async () => {+ const first = preview(SEQ);+ await renderMermaidIn(first, []).done;+ const ids = new Set(m.render.mock.calls.map(([id]) => id));++ // Same source again (e.g. an edit elsewhere): drawn synchronously from the cache.+ const previous: Node[] = [];+ const again = preview(SEQ);+ const pass = renderMermaidIn(again, previous);+ expect(pass.async).toBe(false);+ expect(again.querySelector("[data-mermaid-state='ok'] svg")).not.toBeNull();+ expect(m.render).toHaveBeenCalledTimes(1);++ // Edited diagram: the previous drawing stands in until the new one is ready.+ const edited = preview(SEQ.replace("test", "edited"));+ const next = renderMermaidIn(edited, previous);+ expect(next.async).toBe(true);+ expect(edited.querySelector(".mermaid-output svg")?.textContent).toBe("sequenceDiagram");+ await next.done;+ expect(m.render).toHaveBeenCalledTimes(2);+ ids.add(m.render.mock.calls[1]![0]);+ expect(ids.size).toBe(2);+ });++ it("skips superseded renders", async () => {+ const root = preview(SEQ.replace("test", "stale"));+ const pass = renderMermaidIn(root);+ pass.cancel();+ await pass.done;+ expect(m.render).not.toHaveBeenCalled();+ expect(root.querySelector("[data-mermaid]")?.getAttribute("data-mermaid-state")).toBe("pending");+ });+});diff --git a/src/features/viewers/markdown/mermaid.ts b/src/features/viewers/markdown/mermaid.tsnew file mode 100644index 000000000..70568eece--- /dev/null+++ b/src/features/viewers/markdown/mermaid.ts@@ -0,0 +1,203 @@+/**+ * Mermaid diagrams in the Markdown preview. `renderMarkdown` emits a+ * `[data-mermaid]` placeholder holding the source in `pre > code`; this module+ * turns placeholders into SVG. The library is imported on first use only.+ */+import type { Mermaid } from "mermaid";++export const MERMAID_SELECTOR = "[data-mermaid]";+const OUTPUT_CLASS = "mermaid-output";+const RENDERED_ATTR = "data-mermaid-state";++type Result = { svg: string } | { error: string };++let loading: Promise<Mermaid> | null = null;+let configured = "";+let seq = 0;+/** Results by theme + source, so edits elsewhere in the file don't re-render diagrams. */+const cache = new Map<string, Result>();+const CACHE_LIMIT = 64;+/** mermaid's render isn't re-entrant across configuration changes: one at a time. */+let queue: Promise<unknown> = Promise.resolve();++function loadMermaid(): Promise<Mermaid> {+ loading ??= import("mermaid").then((m) => m.default);+ loading.catch(() => (loading = null));+ return loading;+}++/** Theme identity: anything that changes the colours read below. */+export function themeKey(): string {+ const root = document.documentElement;+ return `${root.dataset.theme ?? ""}|${root.dataset.contrast ?? ""}|${root.style.getPropertyValue("--accent")}`;+}++/** Calls `cb` when the theme attributes or the accent on the root change. */+export function subscribeTheme(cb: () => void): () => void {+ if (typeof MutationObserver === "undefined") return () => {};+ const observer = new MutationObserver(cb);+ observer.observe(document.documentElement, {+ attributes: true,+ attributeFilter: ["data-theme", "data-contrast", "style"],+ });+ return () => observer.disconnect();+}++/** Diagram colours from the IDE tokens; values mermaid can't parse (e.g. `color-mix`) are skipped. */+function themeVariables(): Record<string, string | boolean> {+ const css = getComputedStyle(document.documentElement);+ const token = (...names: string[]) => {+ for (const n of names) {+ const v = css.getPropertyValue(n).trim();+ if (/^(#[0-9a-f]{3,8}|rgba?\([^)]*\))$/i.test(v)) return v;+ }+ return undefined;+ };+ const vars: Record<string, string | undefined> = {+ background: token("--bg-editor", "--bg-app"),+ mainBkg: token("--bg-elev"),+ primaryColor: token("--bg-elev"),+ primaryBorderColor: token("--border-strong"),+ primaryTextColor: token("--fg-strong", "--fg"),+ secondaryColor: token("--bg-popup"),+ tertiaryColor: token("--bg-hover"),+ lineColor: token("--fg-secondary"),+ textColor: token("--fg"),+ edgeLabelBackground: token("--bg-editor", "--bg-app"),+ errorBkgColor: token("--bg-elev"),+ errorTextColor: token("--danger"),+ };+ const out: Record<string, string | boolean> = { darkMode: document.documentElement.dataset.theme !== "light" };+ for (const [k, v] of Object.entries(vars)) if (v) out[k] = v;+ const font = css.getPropertyValue("--font-ui").trim();+ if (font) out.fontFamily = font;+ return out;+}++function configure(mermaid: Mermaid, key: string) {+ if (configured === key) return;+ mermaid.initialize({+ startOnLoad: false,+ securityLevel: "strict",+ suppressErrorRendering: true,+ theme: "base",+ themeVariables: themeVariables(),+ });+ configured = key;+}++function removeTemp(id: string) {+ // mermaid measures in detached-from-preview nodes under <body>: `d<id>` (and `i<id>` when sandboxed).+ for (const tmp of [`d${id}`, `i${id}`, id]) document.getElementById(tmp)?.remove();+}++async function renderOne(source: string, key: string): Promise<Result> {+ const mermaid = await loadMermaid();+ configure(mermaid, key);+ const id = `openidea-mermaid-${++seq}`;+ try {+ const { svg } = await mermaid.render(id, source);+ return { svg };+ } catch (e) {+ const msg = e instanceof Error ? e.message : String(e);+ return { error: msg.trim() || "Invalid diagram" };+ } finally {+ removeTemp(id);+ }+}++/** Resolves `null` when the pass was superseded before its turn came. */+function enqueue(source: string, key: string, live: () => boolean): Promise<Result | null> {+ const p = queue.then(() => (live() ? renderOne(source, key) : null));+ queue = p.catch(() => undefined);+ return p;+}++function remember(k: string, r: Result) {+ if (cache.size >= CACHE_LIMIT) cache.delete(cache.keys().next().value!);+ cache.set(k, r);+}++function show(block: HTMLElement, result: Result | null, stale?: Node) {+ block.querySelector(`:scope > .${OUTPUT_CLASS}`)?.remove();+ const out = document.createElement("div");+ out.className = OUTPUT_CLASS;+ if (result && "svg" in result) {+ out.innerHTML = result.svg;+ block.setAttribute(RENDERED_ATTR, "ok");+ } else if (result) {+ out.setAttribute("role", "alert");+ out.textContent = result.error;+ block.setAttribute(RENDERED_ATTR, "error");+ } else if (stale) {+ // The diagram before this edit, until the new one is ready (no flicker while typing).+ out.append(stale.cloneNode(true));+ block.setAttribute(RENDERED_ATTR, "ok");+ } else {+ block.setAttribute(RENDERED_ATTR, "pending");+ return;+ }+ block.append(out);+}++export const hasMermaid = (root: ParentNode) => root.querySelector(MERMAID_SELECTOR) !== null;++export interface MermaidPass {+ /** Whether some diagram renders asynchronously (it changes the layout when `done`). */+ async: boolean;+ /** Settles when every diagram of the pass is in place (or the pass was cancelled). */+ done: Promise<void>;+ cancel(): void;+}++/**+ * Renders the placeholders under `root`. `previous` holds the last rendered+ * output per block index of the same preview (updated in place) and stands in+ * while a changed diagram renders. Cached results are applied synchronously.+ */+export function renderMermaidIn(root: HTMLElement, previous: Node[] = []): MermaidPass {+ const blocks = [...root.querySelectorAll<HTMLElement>(MERMAID_SELECTOR)];+ let live = true;+ if (!blocks.length) return { async: false, done: Promise.resolve(), cancel: () => {} };+ const key = themeKey();+ const pending: Promise<void>[] = [];+ blocks.forEach((block, i) => {+ const source = (block.querySelector("code")?.textContent ?? "").replace(/\n+$/, "");+ const k = `${key}\n${source}`;+ const cached = cache.get(k);+ const keep = () => {+ const out = block.querySelector(`:scope > .${OUTPUT_CLASS}`);+ if (out && block.getAttribute(RENDERED_ATTR) === "ok") previous[i] = out.firstChild ?? out;+ };+ if (cached) {+ show(block, cached);+ keep();+ return;+ }+ show(block, null, previous[i]);+ pending.push(+ enqueue(source, key, () => live).then((r) => {+ if (!r) return;+ remember(k, r);+ if (!live) return;+ show(block, r);+ keep();+ }),+ );+ });+ previous.length = blocks.length;+ return {+ async: pending.length > 0,+ done: Promise.all(pending).then(() => undefined),+ cancel: () => {+ live = false;+ },+ };+}++/** For tests. */+export function resetMermaidForTests() {+ cache.clear();+ configured = "";+ loading = null;+}diff --git a/src/features/viewers/markdown/render.ts b/src/features/viewers/markdown/render.tsindex 4e68eaa44..a07531b6c 100644--- a/src/features/viewers/markdown/render.ts+++ b/src/features/viewers/markdown/render.ts@@ -2,12 +2,25 @@* Markdown → sanitized HTML for the preview. Every top-level block is wrapped* in an element carrying its 0-based source line (`data-line`) for scroll* sync; images keep their source in `data-src` and are loaded by the preview- * (local files through the backend, as the CSP blocks file URLs).+ * (local files through the backend, as the CSP blocks file URLs). Mermaid+ * blocks become `[data-mermaid]` placeholders, drawn by `./mermaid`.*/import { Marked, type Token, type TokensList } from "marked";import DOMPurify from "dompurify";-const marked = new Marked({ gfm: true, breaks: false });+const escapeHtml = (s: string) =>+ s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);++const marked = new Marked({+ gfm: true,+ breaks: false,+ renderer: {+ code({ text, lang }) {+ if (lang?.trim().split(/\s+/)[0]?.toLowerCase() !== "mermaid") return false;+ return `<div data-mermaid=""><pre><code class="language-mermaid">${escapeHtml(text)}</code></pre></div>\n`;+ },+ },+});// Own instance: hooks must not leak into the hover / documentation renderer.let purifier: ReturnType<typeof DOMPurify> | null = null;