完成世界书、骰子、apiconfig页面处理
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 - 2022 Knut Sveidqvist
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+470
@@ -0,0 +1,470 @@
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/develop/docs/public/favicon.svg" height="150">
|
||||
</p>
|
||||
<h1 align="center">
|
||||
Mermaid
|
||||
</h1>
|
||||
<p align="center">
|
||||
Generate diagrams from markdown-like text.
|
||||
<p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/mermaid"><img src="https://img.shields.io/npm/v/mermaid?color=ff3670&label="></a>
|
||||
<p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://mermaid.ai/live/"><b>Live Editor!</b></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://mermaid.ai/open-source/">📖 Documentation</a> | <a href="https://mermaid.ai/open-source/intro/">🚀 Getting Started</a> | <a href="https://www.jsdelivr.com/package/npm/mermaid">🌐 CDN</a> | <a href="https://discord.gg/sKeNQX4Wtj" title="Discord invite">🙌 Join Us</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="./README.zh-CN.md">简体中文</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
Try Live Editor previews of future releases: <a href="https://develop.git.mermaid.live/" title="Try the mermaid version from the develop branch.">Develop</a> | <a href="https://next.git.mermaid.live/" title="Try the mermaid version from the next branch.">Next</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
[](https://www.npmjs.com/package/mermaid)
|
||||
[](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml)
|
||||
[](https://bundlephobia.com/package/mermaid)
|
||||
[](https://app.codecov.io/github/mermaid-js/mermaid/tree/develop)
|
||||
[](https://www.jsdelivr.com/package/npm/mermaid)
|
||||
[](https://www.npmjs.com/package/mermaid)
|
||||
[](https://discord.gg/sKeNQX4Wtj)
|
||||
[](https://twitter.com/mermaidjs_)
|
||||
[](https://argos-ci.com?utm_source=mermaid&utm_campaign=oss)
|
||||
[](https://securityscorecards.dev/viewer/?uri=github.com/mermaid-js/mermaid)
|
||||
|
||||
<img src="./img/header.png" alt="" />
|
||||
|
||||
:trophy: **Mermaid was nominated and won the [JS Open Source Awards (2019)](https://osawards.com/javascript/2019) in the category "The most exciting use of technology"!!!**
|
||||
|
||||
**Thanks to all involved, people committing pull requests, people answering questions! 🙏**
|
||||
|
||||
<a href="https://mermaid.js.org/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/intro/img/book-banner-post-release.jpg" alt='Banner for "The Official Guide to Mermaid.js" book'></a>
|
||||
|
||||
## Table of content
|
||||
|
||||
<details>
|
||||
<summary>Expand contents</summary>
|
||||
|
||||
- [About](#about)
|
||||
- [Examples](#examples)
|
||||
- [Release](#release)
|
||||
- [Related projects](#related-projects)
|
||||
- [Contributors](#contributors---)
|
||||
- [Security and safe diagrams](#security-and-safe-diagrams)
|
||||
- [Reporting vulnerabilities](#reporting-vulnerabilities)
|
||||
- [Appreciation](#appreciation)
|
||||
|
||||
</details>
|
||||
|
||||
## About
|
||||
|
||||
<!-- <Main description> -->
|
||||
|
||||
Mermaid is a JavaScript-based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. The main purpose of Mermaid is to help documentation catch up with development.
|
||||
|
||||
> Doc-Rot is a Catch-22 that Mermaid helps to solve.
|
||||
|
||||
Diagramming and documentation costs precious developer time and gets outdated quickly.
|
||||
But not having diagrams or docs ruins productivity and hurts organizational learning.<br/>
|
||||
Mermaid addresses this problem by enabling users to create easily modifiable diagrams. It can also be made part of production scripts (and other pieces of code).<br/>
|
||||
<br/>
|
||||
|
||||
Mermaid allows even non-programmers to easily create detailed diagrams through the [Mermaid Live Editor](https://mermaid.live/).<br/>
|
||||
For video tutorials, visit our [Tutorials](https://mermaid.js.org/ecosystem/tutorials.html) page.
|
||||
Use Mermaid with your favorite applications, check out the list of [Integrations and Usages of Mermaid](https://mermaid.js.org/ecosystem/integrations-community.html).
|
||||
|
||||
You can also use Mermaid within [GitHub](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/) as well many of your other favorite applications—check out the list of [Integrations and Usages of Mermaid](https://mermaid.js.org/ecosystem/integrations-community.html).
|
||||
|
||||
For a more detailed introduction to Mermaid and some of its more basic uses, look to the [Beginner's Guide](https://mermaid.js.org/intro/getting-started.html), [Usage](https://mermaid.js.org/config/usage.html) and [Tutorials](https://mermaid.js.org/ecosystem/tutorials.html).
|
||||
|
||||
Our PR Visual Regression Testing is powered by [Argos](https://argos-ci.com/?utm_source=mermaid&utm_campaign=oss) with their generous Open Source plan. It makes the process of reviewing PRs with visual changes a breeze.
|
||||
|
||||
[](https://argos-ci.com?utm_source=mermaid&utm_campaign=oss)
|
||||
|
||||
In our release process we rely heavily on visual regression tests using [applitools](https://applitools.com/). Applitools is a great service which has been easy to use and integrate with our tests.
|
||||
|
||||
<a href="https://applitools.com/">
|
||||
<svg width="170" height="32" viewBox="0 0 170 32" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" maskUnits="userSpaceOnUse" x="27" y="0" width="143" height="32"><path fill-rule="evenodd" clip-rule="evenodd" d="M27.732.227h141.391v31.19H27.733V.227z" fill="#fff"></path></mask><g mask="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M153.851 22.562l1.971-3.298c1.291 1.219 3.837 2.402 5.988 2.402 1.971 0 2.903-.753 2.903-1.829 0-2.832-10.253-.502-10.253-7.313 0-2.904 2.51-5.45 7.099-5.45 2.904 0 5.234 1.004 6.955 2.367l-1.829 3.226c-1.039-1.075-3.011-2.008-5.126-2.008-1.65 0-2.725.717-2.725 1.685 0 2.546 10.289.395 10.289 7.386 0 3.19-2.724 5.52-7.528 5.52-3.012 0-5.916-1.003-7.744-2.688zm-5.7 2.259h4.553V.908h-4.553v23.913zm-6.273-8.676c0-2.689-1.578-5.02-4.446-5.02-2.832 0-4.409 2.331-4.409 5.02 0 2.724 1.577 5.055 4.409 5.055 2.868 0 4.446-2.33 4.446-5.055zm-13.588 0c0-4.912 3.442-9.07 9.142-9.07 5.736 0 9.178 4.158 9.178 9.07 0 4.911-3.442 9.106-9.178 9.106-5.7 0-9.142-4.195-9.142-9.106zm-5.628 0c0-2.689-1.577-5.02-4.445-5.02-2.832 0-4.41 2.331-4.41 5.02 0 2.724 1.578 5.055 4.41 5.055 2.868 0 4.445-2.33 4.445-5.055zm-13.587 0c0-4.912 3.441-9.07 9.142-9.07 5.736 0 9.178 4.158 9.178 9.07 0 4.911-3.442 9.106-9.178 9.106-5.701 0-9.142-4.195-9.142-9.106zm-8.425 4.338v-8.999h-2.868v-3.98h2.868V2.773h4.553v4.733h3.514v3.979h-3.514v7.78c0 1.111.574 1.936 1.578 1.936.681 0 1.326-.251 1.577-.538l.968 3.478c-.681.609-1.9 1.11-3.8 1.11-3.191 0-4.876-1.648-4.876-4.767zm-8.962 4.338h4.553V7.505h-4.553V24.82zm-.43-21.905a2.685 2.685 0 012.688-2.69c1.506 0 2.725 1.184 2.725 2.69a2.724 2.724 0 01-2.725 2.724c-1.47 0-2.688-1.219-2.688-2.724zM84.482 24.82h4.553V.908h-4.553v23.913zm-6.165-8.676c0-2.976-1.793-5.02-4.41-5.02-1.47 0-3.119.825-3.908 1.973v6.094c.753 1.111 2.438 2.008 3.908 2.008 2.617 0 4.41-2.044 4.41-5.055zm-8.318 6.453v8.82h-4.553V7.504H70v2.187c1.327-1.685 3.227-2.618 5.342-2.618 4.446 0 7.672 3.299 7.672 9.07 0 5.773-3.226 9.107-7.672 9.107-2.043 0-3.907-.86-5.342-2.653zm-10.718-6.453c0-2.976-1.793-5.02-4.41-5.02-1.47 0-3.119.825-3.908 1.973v6.094c.753 1.111 2.438 2.008 3.908 2.008 2.617 0 4.41-2.044 4.41-5.055zm-8.318 6.453v8.82H46.41V7.504h4.553v2.187c1.327-1.685 3.227-2.618 5.342-2.618 4.446 0 7.672 3.299 7.672 9.07 0 5.773-3.226 9.107-7.672 9.107-2.043 0-3.908-.86-5.342-2.653zm-11.758-1.936V18.51c-.753-1.004-2.187-1.542-3.657-1.542-1.793 0-3.263.968-3.263 2.617 0 1.65 1.47 2.582 3.263 2.582 1.47 0 2.904-.502 3.657-1.506zm0 4.159v-1.829c-1.183 1.434-3.227 2.259-5.485 2.259-2.761 0-5.988-1.864-5.988-5.736 0-4.087 3.227-5.593 5.988-5.593 2.33 0 4.337.753 5.485 2.115V13.85c0-1.756-1.506-2.904-3.8-2.904-1.829 0-3.55.717-4.984 2.044L28.63 9.8c2.115-1.901 4.84-2.726 7.564-2.726 3.98 0 7.6 1.578 7.6 6.561v11.186h-4.588z" fill="#00A298"></path></g><path fill-rule="evenodd" clip-rule="evenodd" d="M14.934 16.177c0 1.287-.136 2.541-.391 3.752-1.666-1.039-3.87-2.288-6.777-3.752 2.907-1.465 5.11-2.714 6.777-3.753.255 1.211.39 2.466.39 3.753m4.6-7.666V4.486a78.064 78.064 0 01-4.336 3.567c-1.551-2.367-3.533-4.038-6.14-5.207C11.1 4.658 12.504 6.7 13.564 9.262 5.35 15.155 0 16.177 0 16.177s5.35 1.021 13.564 6.915c-1.06 2.563-2.463 4.603-4.507 6.415 2.607-1.169 4.589-2.84 6.14-5.207a77.978 77.978 0 014.336 3.568v-4.025s-.492-.82-2.846-2.492c.6-1.611.93-3.354.93-5.174a14.8 14.8 0 00-.93-5.174c2.354-1.673 2.846-2.492 2.846-2.492" fill="#00A298"></path></svg>
|
||||
</a>
|
||||
|
||||
<!-- </Main description> -->
|
||||
|
||||
## Examples
|
||||
|
||||
**The following are some examples of the diagrams, charts and graphs that can be made using Mermaid. Click here to jump into the [text syntax](https://mermaid.js.org/intro/syntax-reference.html).**
|
||||
|
||||
<!-- <Flowchart> -->
|
||||
|
||||
### Flowchart [<a href="https://mermaid.js.org/syntax/flowchart.html">docs</a> - <a href="https://mermaid.live/edit#pako:eNpNkMtqwzAQRX9FzKqFJK7t1km8KDQP6KJQSLOLvZhIY1tgS0GWmgbb_165IaFaiXvOFTPqgGtBkEJR6zOv0Fj2scsU8-ft8I5G5Gw6fe339GN7tnrYaafE45WvRsLW3Ya4bKVWwzVe_xU-FfVsc9hR62rLwvw_2591z7Y3FuUwgYZMg1L4ObrRzMBW1FAGqb8KKtCLGWRq8Ko7CbS0FdJqA2mBdUsTQGf110VxSK1xdJM2EkuDzd2qNQrypQ7s5TQuXcrW-ie5VoUsx9yZ2seVtac2DYIRz0ppK3eccd0ErRTjD1XfyyRIomSBUUzJPMaXOBb8GC4XRfQcFmL-FEYIwzD8AggvcHE">live editor</a>]
|
||||
|
||||
```
|
||||
flowchart LR
|
||||
|
||||
A[Hard] -->|Text| B(Round)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result 1]
|
||||
C -->|Two| E[Result 2]
|
||||
```
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
|
||||
A[Hard] -->|Text| B(Round)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result 1]
|
||||
C -->|Two| E[Result 2]
|
||||
```
|
||||
|
||||
### Sequence diagram [<a href="https://mermaid.js.org/syntax/sequenceDiagram.html">docs</a> - <a href="https://mermaid.live/edit#pako:eNo9kMluwjAQhl_F-AykQMuSA1WrbuLQQ3v1ZbAnsVXHkzrjVhHi3etQwKfRv4w-z0FqMihL2eF3wqDxyUEdoVHhwTuNk-12RzaU4g29JzHMY2HpV0BE0VO6V8ETtdkGz1Zb1F8qiPyG5LX84mrLAmpwoWNh-5a0pWCiAxUwGBXeiVHEU4oq8V_6AHYUwAu2lLLTjVQ4bc1rT2yleI0IfJG320faZ9ABbk-Jz3hZnFxBduR9L2oiM5Jj2WBswJn8-cMArSRbbFDJMo8GK0ielVThmKOpNcD4bBxTlGUFvsOxhMT02QctS44JL6HzAS-iJzCYOwfJfTscunYd542aQuXqQU_RZ9kyt11ZFIM9rR3btJ9qaorOGQuR7c9mWSznyzXMF7hcLeBusTB6P9usq_ntrDKrm9kc5PF4_AMJE56Z">live editor</a>]
|
||||
|
||||
```
|
||||
sequenceDiagram
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop HealthCheck
|
||||
John->>John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts!
|
||||
John-->>Alice: Great!
|
||||
John->>Bob: How about you?
|
||||
Bob-->>John: Jolly good!
|
||||
```
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop HealthCheck
|
||||
John->>John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts!
|
||||
John-->>Alice: Great!
|
||||
John->>Bob: How about you?
|
||||
Bob-->>John: Jolly good!
|
||||
```
|
||||
|
||||
### Gantt chart [<a href="https://mermaid.js.org/syntax/gantt.html">docs</a> - <a href="https://mermaid.live/edit#pako:eNp90cGOgyAQBuBXIZxtFbG29bbZ3fsmvXKZylhJEAyOTZrGd1_sto3xsHMBhu-HBO689hp5xS_giJQbsCbjHTv9jcp9-q63SKhZpb3DhMXSOIiE5ZkoNpnYZGXynh6U-4jBK7JnVfBYJo9QvgjtEya1cj8QwFq0TMz4lZqxTBg0hOF5m1jifI2Lf7Bc490CyxUu1rhc4GLGPOEdhg6Mjq92V44xxanFDhWv4lRjA6MlxZWbIh17DYTf2pAPvGrADphwGMmfbq7mFYURX-jLwCVA91bWg8YYunO69Y8vMgPFI2vvGnOZ-2Owsd0S9UOVpvP29mKoHc_b2nfpYHQLgdrrsUzLvDxALrHcS9hJqeuzOB6avBCN3mciBz5N0y_wxZ0J">live editor</a>]
|
||||
|
||||
```
|
||||
gantt
|
||||
section Section
|
||||
Completed :done, des1, 2014-01-06,2014-01-08
|
||||
Active :active, des2, 2014-01-07, 3d
|
||||
Parallel 1 : des3, after des1, 1d
|
||||
Parallel 2 : des4, after des1, 1d
|
||||
Parallel 3 : des5, after des3, 1d
|
||||
Parallel 4 : des6, after des4, 1d
|
||||
```
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
section Section
|
||||
Completed :done, des1, 2014-01-06,2014-01-08
|
||||
Active :active, des2, 2014-01-07, 3d
|
||||
Parallel 1 : des3, after des1, 1d
|
||||
Parallel 2 : des4, after des1, 1d
|
||||
Parallel 3 : des5, after des3, 1d
|
||||
Parallel 4 : des6, after des4, 1d
|
||||
```
|
||||
|
||||
### Class diagram [<a href="https://mermaid.js.org/syntax/classDiagram.html">docs</a> - <a href="https://mermaid.live/edit#pako:eNpdkTFPwzAQhf-K5QlQ2zQJJG1UBaGWDYmBgYEwXO1LYuTEwXYqlZL_jt02asXm--690zvfgTLFkWaUSTBmI6DS0BTt2lfzkKx-p1PytEO9f1FtdaQkI2ulZNGuVqK1qEtgmOfk7BitSzKdOhg59XuNGgk0RDxed-_IOr6uf8cZ6UhTZ8bvHqS5ub1mr9svZPbjk6DEBlu7AQuXyBkx4gcvDk9cUMJq0XT_YaW0kNK5j-ufAoRzcihaQvLcoN4Jv50vvVxw_xrnD3RCG9QNCO4-8OgpqK1dpoJm7smxhF7agp6kfcfB4jMXVmmalW4tnFDorXrbt4xmVvc4is53GKFUwNF5DtTuO3-sShjrJjLVlqLyvNfS4drazmRB4NuzSti6386YagIjeA3a1rtlEiRRsoAoxiSN4SGOOduGy0UZ3YclT-dhBHQYhj8dc6_I">live editor</a>]
|
||||
|
||||
```
|
||||
classDiagram
|
||||
Class01 <|-- AveryLongClass : Cool
|
||||
<<Interface>> Class01
|
||||
Class09 --> C2 : Where am I?
|
||||
Class09 --* C3
|
||||
Class09 --|> Class07
|
||||
Class07 : equals()
|
||||
Class07 : Object[] elementData
|
||||
Class01 : size()
|
||||
Class01 : int chimp
|
||||
Class01 : int gorilla
|
||||
class Class10 {
|
||||
<<service>>
|
||||
int id
|
||||
size()
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
Class01 <|-- AveryLongClass : Cool
|
||||
<<Interface>> Class01
|
||||
Class09 --> C2 : Where am I?
|
||||
Class09 --* C3
|
||||
Class09 --|> Class07
|
||||
Class07 : equals()
|
||||
Class07 : Object[] elementData
|
||||
Class01 : size()
|
||||
Class01 : int chimp
|
||||
Class01 : int gorilla
|
||||
class Class10 {
|
||||
<<service>>
|
||||
int id
|
||||
size()
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### State diagram [<a href="https://mermaid.js.org/syntax/stateDiagram.html">docs</a> - <a href="https://mermaid.live/edit#pako:eNpdkEFvgzAMhf8K8nEqpYSNthx22Xbcqcexg0sCiZQQlDhIFeK_L8A6TfXp6fOz9ewJGssFVOAJSbwr7ByadGR1n8T6evpO0vQ1uZDSekOrXGFsPqJPO6q-2-imH8f_0TeHXm50lfelsAMjnEHFY6xpMdRAUhhRQxUlFy0GTTXU_RytYeAx-AdXZB1ULWovdoCB7OXWN1CRC-Ju-r3uz6UtchGHJqDbsPygU57iysb2reoWHpyOWBINvsqypb3vFMlw3TfWZF5xiY7keC6zkpUnZIUojwW-FAVvrvn51LLnvOXHQ84Q5nn-AVtLcwk">live editor</a>]
|
||||
|
||||
```
|
||||
stateDiagram-v2
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
Moving --> Still
|
||||
Moving --> Crash
|
||||
Crash --> [*]
|
||||
```
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
Moving --> Still
|
||||
Moving --> Crash
|
||||
Crash --> [*]
|
||||
```
|
||||
|
||||
### Pie chart [<a href="https://mermaid.js.org/syntax/pie.html">docs</a> - <a href="https://mermaid.live/edit#pako:eNo9jsFugzAMhl8F-VzBgEEh13Uv0F1zcYkTIpEEBadShXj3BU3dzf_n77e8wxQUgYDVkvQSbsFsEgpRtEN_5i_kvzx05XiC-xvUHVzAUXRoVe7v0heFBJ7JkQSRR0Ua08ISpD-ymlaFTN_KcoggNC4bXQATh5-Xn0BwTPSWbhZNRPdvLQEV5dIO_FrPZ43dOJ-cgtfWnDzFJeOZed1EVZ3r0lie06Ocgqs2q2aMPD_HvuqbfsCmpf7aYte2anrU46Cbz1qr60fdIBzH8QvW9lkl">live editor</a>]
|
||||
|
||||
```
|
||||
pie
|
||||
"Dogs" : 386
|
||||
"Cats" : 85.9
|
||||
"Rats" : 15
|
||||
```
|
||||
|
||||
```mermaid
|
||||
pie
|
||||
"Dogs" : 386
|
||||
"Cats" : 85.9
|
||||
"Rats" : 15
|
||||
```
|
||||
|
||||
### Git graph [experimental - <a href="https://mermaid.live/edit#pako:eNqNkMFugzAMhl8F-VyVAR1tOW_aA-zKxSSGRCMJCk6lCvHuNZPKZdM0n-zf3_8r8QIqaIIGMqnB8kfEybQ--y4VnLP8-9RF9Mpkmm40hmlnDKmvkPiH_kfS7nFo_VN0FAf6XwocQGgxa_nGsm1bYEOOWmik1dRjGrmF1q-Cpkkj07u2HCI0PY4zHQATh8-7V9BwTPSE3iwOEd1OjQE1iWkBvk_bzQY7s0Sq4Hs7bHqKo8iGeZqbPN_WR7mpSd1RHpvPVhuMbG7XOq_L-oJlRfW5wteq0qorrpe-PBW9Pr8UJcK6rg-BLYPQ">live editor</a>]
|
||||
|
||||
```
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
branch develop
|
||||
checkout develop
|
||||
commit
|
||||
commit
|
||||
checkout main
|
||||
merge develop
|
||||
commit
|
||||
commit
|
||||
```
|
||||
|
||||
```mermaid
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
branch develop
|
||||
checkout develop
|
||||
commit
|
||||
commit
|
||||
checkout main
|
||||
merge develop
|
||||
commit
|
||||
commit
|
||||
```
|
||||
|
||||
### Bar chart (using gantt chart) [<a href="https://mermaid.js.org/syntax/gantt.html">docs</a> - <a href="https://mermaid.live/edit#pako:eNptkU1vhCAQhv8KIenNugiI4rkf6bmXpvEyFVxJFDYyNt1u9r8X63Z7WQ9m5pknLzieaBeMpQ3dg0dsPUkPOhwteXZIXmJcbCT3xMAxkuh8Z8kIEclyMIB209fqKcwTICFvG4IvFy_oLrZ-g9F26ILfQgvNFN94VaRXQ1iWqpumZBcu1J8p1E1TXDx59eQNr5LyEqjJn6hv5QnGNlxevZJmdLLpy5xJSzut45biYCfb0iaVxvawjNjS1p-TCguG16PvaIPzYjO67e3BwX6GiTY9jPFKH43DMF_hGMDY1J4oHg-_f8hFTJFd8L3br3yZx4QHxENsdrt1nO8dDstH3oVpF50ZYMbhU6ud4qoGLqyqBJRCmO6j0HXPZdGbihUc6Pmc0QP49xD-b5X69ZQv2gjO81IwzWqhC1lKrjJ6pA3nVS7SMiVjrKirWlYp5fs3osgrWeo00lorLWvOzz8JVbXm">live editor</a>]
|
||||
|
||||
```
|
||||
gantt
|
||||
title Git Issues - days since last update
|
||||
dateFormat X
|
||||
axisFormat %s
|
||||
|
||||
section Issue19062
|
||||
71 : 0, 71
|
||||
section Issue19401
|
||||
36 : 0, 36
|
||||
section Issue193
|
||||
34 : 0, 34
|
||||
section Issue7441
|
||||
9 : 0, 9
|
||||
section Issue1300
|
||||
5 : 0, 5
|
||||
```
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
title Git Issues - days since last update
|
||||
dateFormat X
|
||||
axisFormat %s
|
||||
|
||||
section Issue19062
|
||||
71 : 0, 71
|
||||
section Issue19401
|
||||
36 : 0, 36
|
||||
section Issue193
|
||||
34 : 0, 34
|
||||
section Issue7441
|
||||
9 : 0, 9
|
||||
section Issue1300
|
||||
5 : 0, 5
|
||||
```
|
||||
|
||||
### User Journey diagram [<a href="https://mermaid.js.org/syntax/userJourney.html">docs</a> - <a href="https://mermaid.live/edit#pako:eNplkMFuwjAQRH9l5TMiTVIC-FqqnjhxzWWJN4khsSN7XRSh_HsdKBVt97R6Mzsj-yoqq0hIAXCywRkaSwNxWHNHsB_hYt1ZmwYUfiueKtbWwIcFtjf5zgH2eCZgQgkrCXt64GgMg2fUzkvIn5Xd_V5COtMFvCH_62ht_5yk7MU8sn61HDTfxD8VYiF6cj1qFd94nWkpuKWYKWRcFdUYOi5FaaZoDYNCpnel2Toha-w8LQQGtofRVEKyC_Qw7TQ2DvsfV2dRUTy6Ch6H-UMb7TlGVtbUupl5cF3ELfPgZZLM8rLR3IbjsrJ94rVq0XH7uS2SIis2mOVUrHNc5bmqjul2U2evaa3WL2mGYpqmL2BGiho">live editor</a>]
|
||||
|
||||
```
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 3: Me
|
||||
```
|
||||
|
||||
```mermaid
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 3: Me
|
||||
```
|
||||
|
||||
### C4 diagram [<a href="https://mermaid.js.org/syntax/c4.html">docs</a>]
|
||||
|
||||
```
|
||||
C4Context
|
||||
title System Context diagram for Internet Banking System
|
||||
|
||||
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
|
||||
Person(customerB, "Banking Customer B")
|
||||
Person_Ext(customerC, "Banking Customer C")
|
||||
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")
|
||||
|
||||
Person(customerD, "Banking Customer D", "A customer of the bank, <br/> with personal bank accounts.")
|
||||
|
||||
Enterprise_Boundary(b1, "BankBoundary") {
|
||||
|
||||
SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")
|
||||
|
||||
System_Boundary(b2, "BankBoundary2") {
|
||||
System(SystemA, "Banking System A")
|
||||
System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
|
||||
}
|
||||
|
||||
System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
|
||||
SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")
|
||||
|
||||
Boundary(b3, "BankBoundary3", "boundary") {
|
||||
SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
|
||||
SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
|
||||
}
|
||||
}
|
||||
|
||||
BiRel(customerA, SystemAA, "Uses")
|
||||
BiRel(SystemAA, SystemE, "Uses")
|
||||
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
|
||||
Rel(SystemC, customerA, "Sends e-mails to")
|
||||
```
|
||||
|
||||
```mermaid
|
||||
C4Context
|
||||
title System Context diagram for Internet Banking System
|
||||
|
||||
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
|
||||
Person(customerB, "Banking Customer B")
|
||||
Person_Ext(customerC, "Banking Customer C")
|
||||
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")
|
||||
|
||||
Person(customerD, "Banking Customer D", "A customer of the bank, <br/> with personal bank accounts.")
|
||||
|
||||
Enterprise_Boundary(b1, "BankBoundary") {
|
||||
|
||||
SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")
|
||||
|
||||
System_Boundary(b2, "BankBoundary2") {
|
||||
System(SystemA, "Banking System A")
|
||||
System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
|
||||
}
|
||||
|
||||
System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
|
||||
SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")
|
||||
|
||||
Boundary(b3, "BankBoundary3", "boundary") {
|
||||
SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
|
||||
SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
|
||||
}
|
||||
}
|
||||
|
||||
BiRel(customerA, SystemAA, "Uses")
|
||||
BiRel(SystemAA, SystemE, "Uses")
|
||||
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
|
||||
Rel(SystemC, customerA, "Sends e-mails to")
|
||||
```
|
||||
|
||||
## Release
|
||||
|
||||
For those who have the permission to do so:
|
||||
|
||||
Update version number in `package.json`.
|
||||
|
||||
```sh
|
||||
npm publish
|
||||
```
|
||||
|
||||
The above command generates files into the `dist` folder and publishes them to <https://www.npmjs.com>.
|
||||
|
||||
## Related projects
|
||||
|
||||
- [Command Line Interface](https://github.com/mermaid-js/mermaid-cli)
|
||||
- [Live Editor](https://github.com/mermaid-js/mermaid-live-editor)
|
||||
- [HTTP Server](https://github.com/TomWright/mermaid-server)
|
||||
|
||||
## Contributors [](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+issue%21%22) [](https://github.com/mermaid-js/mermaid/graphs/contributors) [](https://github.com/mermaid-js/mermaid/graphs/contributors)
|
||||
|
||||
Mermaid is a growing community and is always accepting new contributors. There's a lot of different ways to help out and we're always looking for extra hands! Look at [this issue](https://github.com/mermaid-js/mermaid/issues/866) if you want to know where to start helping out.
|
||||
|
||||
Detailed information about how to contribute can be found in the [contribution guide](https://mermaid.js.org/community/contributing.html)
|
||||
|
||||
## Security and safe diagrams
|
||||
|
||||
For public sites, it can be precarious to retrieve text from users on the internet, storing that content for presentation in a browser at a later stage. The reason is that the user content can contain embedded malicious scripts that will run when the data is presented. For Mermaid this is a risk, specially as mermaid diagrams contain many characters that are used in html which makes the standard sanitation unusable as it also breaks the diagrams. We still make an effort to sanitize the incoming code and keep refining the process but it is hard to guarantee that there are no loop holes.
|
||||
|
||||
As an extra level of security for sites with external users we are happy to introduce a new security level in which the diagram is rendered in a sandboxed iframe preventing javascript in the code from being executed. This is a great step forward for better security.
|
||||
|
||||
_Unfortunately you cannot have a cake and eat it at the same time which in this case means that some of the interactive functionality gets blocked along with the possible malicious code._
|
||||
|
||||
## Reporting vulnerabilities
|
||||
|
||||
To report a vulnerability, please e-mail <security@mermaid.live> with a description of the issue, the steps you took to create the issue, affected versions, and if known, mitigations for the issue.
|
||||
|
||||
## Appreciation
|
||||
|
||||
A quick note from Knut Sveidqvist:
|
||||
|
||||
> _Many thanks to the [d3](https://d3js.org/) and [dagre-d3](https://github.com/cpettitt/dagre-d3) projects for providing the graphical layout and drawing libraries!_
|
||||
>
|
||||
> _Thanks also to the [js-sequence-diagram](https://bramp.github.io/js-sequence-diagrams) project for usage of the grammar for the sequence diagrams. Thanks to Jessica Peter for inspiration and starting point for gantt rendering._
|
||||
>
|
||||
> _Thank you to [Tyler Long](https://github.com/tylerlong) who has been a collaborator since April 2017._
|
||||
>
|
||||
> _Thank you to the ever-growing list of [contributors](https://github.com/mermaid-js/mermaid/graphs/contributors) that brought the project this far!_
|
||||
|
||||
---
|
||||
|
||||
_Mermaid was created by Knut Sveidqvist for easier documentation._
|
||||
+365
@@ -0,0 +1,365 @@
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/develop/docs/public/favicon.svg" height="150">
|
||||
</p>
|
||||
<h1 align="center">
|
||||
Mermaid
|
||||
</h1>
|
||||
<p align="center">
|
||||
通过解析类 Markdown 的文本语法来实现图表的创建和动态修改。
|
||||
<p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/mermaid"><img src="https://img.shields.io/npm/v/mermaid?color=ff3670&label="></a>
|
||||
<p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://mermaid.live/"><b>实时编辑器!</b></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://mermaid.js.org">📖 文档</a> | <a href="https://mermaid.js.org/intro/">🚀 入门</a> | <a href="https://www.jsdelivr.com/package/npm/mermaid">🌐 CDN</a> | <a href="https://discord.gg/sKeNQX4Wtj" title="Discord invite">🙌 加入我们</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="./README.md">English</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
尝试未来版本的实时编辑器预览: <a href="https://develop.git.mermaid.live/" title="尝试来自develop分支的mermaid版本。">Develop</a> | <a href="https://next.git.mermaid.live/" title="尝试来自next分支的mermaid版本。">Next</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
[](https://www.npmjs.com/package/mermaid)
|
||||
[](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml)
|
||||
[](https://bundlephobia.com/package/mermaid)
|
||||
[](https://app.codecov.io/github/mermaid-js/mermaid/tree/develop)
|
||||
[](https://www.jsdelivr.com/package/npm/mermaid)
|
||||
[](https://www.npmjs.com/package/mermaid)
|
||||
[](https://discord.gg/sKeNQX4Wtj)
|
||||
[](https://twitter.com/mermaidjs_)
|
||||
|
||||
<img src="./img/header.png" alt="" />
|
||||
|
||||
:trophy: **Mermaid 被提名并获得了 [JS Open Source Awards (2019)](https://osawards.com/javascript/2019) 的 "The most exciting use of technology" 奖项!!!**
|
||||
|
||||
**感谢所有参与进来提交 PR,解答疑问的人们! 🙏**
|
||||
|
||||
<a href="https://mermaid.js.org/landing/"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/intro/img/book-banner-post-release.jpg" alt='Banner for "The Official Guide to Mermaid.js" book'></a>
|
||||
|
||||
## 关于 Mermaid
|
||||
|
||||
<!-- <Main description> -->
|
||||
|
||||
Mermaid 是一个基于 JavaScript 的图表绘制工具,通过解析类 Markdown 的文本语法来实现图表的创建和动态修改。Mermaid 诞生的主要目的是让文档的更新能够及时跟上开发进度。
|
||||
|
||||
> Doc-Rot 是 Mermaid 致力于解决的一个难题。
|
||||
|
||||
绘图和编写文档花费了开发者宝贵的开发时间,而且随着业务的变更,它很快就会过期。 但是如果缺少了图表或文档,对于生产力和团队新人的业务学习都会产生巨大的阻碍。 <br/>
|
||||
Mermaid 通过允许用户创建便于修改的图表来解决这一难题,它也可以作为生产脚本(或其他代码)的一部分。<br/>
|
||||
<br/>
|
||||
Mermaid 甚至能让非程序员也能通过 [Mermaid Live Editor](https://mermaid.live/) 轻松创建详细的图表。<br/>
|
||||
你可以访问 [教程](https://mermaid.js.org/ecosystem/tutorials.html) 来查看 Live Editor 的视频教程,也可以查看 [Mermaid 的集成和使用](https://mermaid.js.org/ecosystem/integrations-community.html) 这个清单来检查你的文档工具是否已经集成了 Mermaid 支持。
|
||||
|
||||
如果想要查看关于 Mermaid 更详细的介绍及基础使用方式,可以查看 [入门指引](https://mermaid.js.org/intro/getting-started.html), [用法](https://mermaid.js.org/config/usage.html) 和 [教程](https://mermaid.js.org/ecosystem/tutorials.html).
|
||||
|
||||
<!-- </Main description> -->
|
||||
|
||||
## 示例
|
||||
|
||||
**下面是一些可以使用 Mermaid 创建的图表示例。点击 [语法](https://mermaid.js.org/intro/syntax-reference.html) 查看详情。**
|
||||
|
||||
<table>
|
||||
<!-- <Flowchart> -->
|
||||
|
||||
### 流程图 [<a href="https://mermaid.js.org/syntax/flowchart.html">文档</a> - <a href="https://mermaid.live/edit#base64:eyJjb2RlIjoiZ3JhcGggVERcbiAgICBBW0hhcmRdIC0tPnxUZXh0fCBCKFJvdW5kKVxuICAgIEIgLS0-IEN7RGVjaXNpb259XG4gICAgQyAtLT58T25lfCBEW1Jlc3VsdCAxXVxuICAgIEMgLS0-fFR3b3wgRVtSZXN1bHQgMl0iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9fQ">live editor</a>]
|
||||
|
||||
```
|
||||
flowchart LR
|
||||
A[Hard] -->|Text| B(Round)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result 1]
|
||||
C -->|Two| E[Result 2]
|
||||
```
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[Hard] -->|Text| B(Round)
|
||||
B --> C{Decision}
|
||||
C -->|One| D[Result 1]
|
||||
C -->|Two| E[Result 2]
|
||||
```
|
||||
|
||||
### 时序图 [<a href="https://mermaid.js.org/syntax/sequenceDiagram.html">文档</a> - <a href="https://mermaid.live/edit#base64:eyJjb2RlIjoic2VxdWVuY2VEaWFncmFtXG5BbGljZS0-PkpvaG46IEhlbGxvIEpvaG4sIGhvdyBhcmUgeW91P1xubG9vcCBIZWFsdGhjaGVja1xuICAgIEpvaG4tPj5Kb2huOiBGaWdodCBhZ2FpbnN0IGh5cG9jaG9uZHJpYVxuZW5kXG5Ob3RlIHJpZ2h0IG9mIEpvaG46IFJhdGlvbmFsIHRob3VnaHRzIVxuSm9obi0tPj5BbGljZTogR3JlYXQhXG5Kb2huLT4-Qm9iOiBIb3cgYWJvdXQgeW91P1xuQm9iLS0-PkpvaG46IEpvbGx5IGdvb2QhIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifX0">live editor</a>]
|
||||
|
||||
```
|
||||
sequenceDiagram
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop HealthCheck
|
||||
John->>John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts!
|
||||
John-->>Alice: Great!
|
||||
John->>Bob: How about you?
|
||||
Bob-->>John: Jolly good!
|
||||
```
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop HealthCheck
|
||||
John->>John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts!
|
||||
John-->>Alice: Great!
|
||||
John->>Bob: How about you?
|
||||
Bob-->>John: Jolly good!
|
||||
```
|
||||
|
||||
### 甘特图 [<a href="https://mermaid.js.org/syntax/gantt.html">文档</a> - <a href="https://mermaid.live/edit#base64:eyJjb2RlIjoiZ2FudHRcbnNlY3Rpb24gU2VjdGlvblxuQ29tcGxldGVkIDpkb25lLCAgICBkZXMxLCAyMDE0LTAxLTA2LDIwMTQtMDEtMDhcbkFjdGl2ZSAgICAgICAgOmFjdGl2ZSwgIGRlczIsIDIwMTQtMDEtMDcsIDNkXG5QYXJhbGxlbCAxICAgOiAgICAgICAgIGRlczMsIGFmdGVyIGRlczEsIDFkXG5QYXJhbGxlbCAyICAgOiAgICAgICAgIGRlczQsIGFmdGVyIGRlczEsIDFkXG5QYXJhbGxlbCAzICAgOiAgICAgICAgIGRlczUsIGFmdGVyIGRlczMsIDFkXG5QYXJhbGxlbCA0ICAgOiAgICAgICAgIGRlczYsIGFmdGVyIGRlczQsIDFkIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifX0">live editor</a>]
|
||||
|
||||
```
|
||||
gantt
|
||||
section Section
|
||||
Completed :done, des1, 2014-01-06,2014-01-08
|
||||
Active :active, des2, 2014-01-07, 3d
|
||||
Parallel 1 : des3, after des1, 1d
|
||||
Parallel 2 : des4, after des1, 1d
|
||||
Parallel 3 : des5, after des3, 1d
|
||||
Parallel 4 : des6, after des4, 1d
|
||||
```
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
section Section
|
||||
Completed :done, des1, 2014-01-06,2014-01-08
|
||||
Active :active, des2, 2014-01-07, 3d
|
||||
Parallel 1 : des3, after des1, 1d
|
||||
Parallel 2 : des4, after des1, 1d
|
||||
Parallel 3 : des5, after des3, 1d
|
||||
Parallel 4 : des6, after des4, 1d
|
||||
```
|
||||
|
||||
### 类图 [<a href="https://mermaid.js.org/syntax/classDiagram.html">文档</a> - <a href="https://mermaid.live/edit#base64:eyJjb2RlIjoiY2xhc3NEaWFncmFtXG5DbGFzczAxIDx8LS0gQXZlcnlMb25nQ2xhc3MgOiBDb29sXG48PGludGVyZmFjZT4-IENsYXNzMDFcbkNsYXNzMDkgLS0-IEMyIDogV2hlcmUgYW0gaT9cbkNsYXNzMDkgLS0qIEMzXG5DbGFzczA5IC0tfD4gQ2xhc3MwN1xuQ2xhc3MwNyA6IGVxdWFscygpXG5DbGFzczA3IDogT2JqZWN0W10gZWxlbWVudERhdGFcbkNsYXNzMDEgOiBzaXplKClcbkNsYXNzMDEgOiBpbnQgY2hpbXBcbkNsYXNzMDEgOiBpbnQgZ29yaWxsYVxuY2xhc3MgQ2xhc3MxMCB7XG4gID4-c2VydmljZT4-XG4gIGludCBpZFxuICBzaXplKClcbn0iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9fQ">live editor</a>]
|
||||
|
||||
```
|
||||
classDiagram
|
||||
Class01 <|-- AveryLongClass : Cool
|
||||
<<Interface>> Class01
|
||||
Class09 --> C2 : Where am I?
|
||||
Class09 --* C3
|
||||
Class09 --|> Class07
|
||||
Class07 : equals()
|
||||
Class07 : Object[] elementData
|
||||
Class01 : size()
|
||||
Class01 : int chimp
|
||||
Class01 : int gorilla
|
||||
class Class10 {
|
||||
<<service>>
|
||||
int id
|
||||
size()
|
||||
}
|
||||
```
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
Class01 <|-- AveryLongClass : Cool
|
||||
<<Interface>> Class01
|
||||
Class09 --> C2 : Where am I?
|
||||
Class09 --* C3
|
||||
Class09 --|> Class07
|
||||
Class07 : equals()
|
||||
Class07 : Object[] elementData
|
||||
Class01 : size()
|
||||
Class01 : int chimp
|
||||
Class01 : int gorilla
|
||||
class Class10 {
|
||||
<<service>>
|
||||
int id
|
||||
size()
|
||||
}
|
||||
```
|
||||
|
||||
### 状态图 [<a href="https://mermaid.js.org/syntax/stateDiagram.html">docs</a> - <a href="https://mermaid.live/edit#pako:eNpdkLsOwjAMRX-l8ojahTEDCzB26kgYrMYtkfJAqVMJVf13QiIKqqfr44d8vUDvFYGAiZHponEMaJv5KF2V4na4V01zqjrWxhSUZYapuEetn7UbCy16P_5HzwGnR6FZfpdCDZaCRa3SWcunQQI_yJIEkaSiAaNhCdKtqRUj--7lehAcItUQn-pnBMSAZtroVWn2YYOU07b4z29Y37gJVYk">live editor</a>]
|
||||
|
||||
```
|
||||
stateDiagram-v2
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
Moving --> Still
|
||||
Moving --> Crash
|
||||
Crash --> [*]
|
||||
```
|
||||
|
||||
```mermaid
|
||||
stateDiagram-v2
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
Moving --> Still
|
||||
Moving --> Crash
|
||||
Crash --> [*]
|
||||
```
|
||||
|
||||
### 饼图 [<a href="https://mermaid.js.org/syntax/pie.html">文档</a> - <a href="https://mermaid.live/edit#base64:eyJjb2RlIjoicGllXG5cIkRvZ3NcIiA6IDQyLjk2XG5cIkNhdHNcIiA6IDUwLjA1XG5cIlJhdHNcIiA6IDEwLjAxIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifX0">live editor</a>]
|
||||
|
||||
```
|
||||
pie
|
||||
"Dogs" : 386
|
||||
"Cats" : 85
|
||||
"Rats" : 15
|
||||
```
|
||||
|
||||
```mermaid
|
||||
pie
|
||||
"Dogs" : 386
|
||||
"Cats" : 85
|
||||
"Rats" : 15
|
||||
```
|
||||
|
||||
### Git 图 [实验特性 - <a href="https://mermaid.live/edit#base64:eyJjb2RlIjoiZ2l0R3JhcGg6XG5vcHRpb25zXG57XG4gICAgXCJub2RlU3BhY2luZ1wiOiAxNTAsXG4gICAgXCJub2RlUmFkaXVzXCI6IDEwXG59XG5lbmRcbmNvbW1pdFxuYnJhbmNoIG5ld2JyYW5jaFxuY2hlY2tvdXQgbmV3YnJhbmNoXG5jb21taXRcbmNvbW1pdFxuY2hlY2tvdXQgbWFzdGVyXG5jb21taXRcbmNvbW1pdFxubWVyZ2UgbmV3YnJhbmNoXG4iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9fQ">live editor</a>]
|
||||
|
||||
### 用户体验旅程图 [<a href="https://mermaid.js.org/syntax/userJourney.html">文档</a> - <a href="https://mermaid.live/edit#pako:eNpljzEPgkAMhf9K05nFGJdbJXFiYmVpuKIncDVHL4QQ_ruHaILaqXnf63vpjLVYRoMAd4nB81R5SKNOO4ZiglFC6_wVLL3JwLU68XARUHnhTQcoqGVQJgMnAwV_5GSMj0HJhcHAcU_y7d7AYVUzOJP-ddyk3ydZGf0n66uldPqCPxWYYc-hJ2fTj_OqVqg3Tplo0mq5odhphZVfkpWiSjn5Go2GyBnGhyXl3NE1UI-moW7g5QkSoF5m">live editor</a>]
|
||||
|
||||
```
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 3: Me
|
||||
```
|
||||
|
||||
```mermaid
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 3: Me
|
||||
```
|
||||
|
||||
### C4 图 [<a href="https://mermaid.js.org/syntax/c4.html">文档</a>]
|
||||
|
||||
```
|
||||
C4Context
|
||||
title System Context diagram for Internet Banking System
|
||||
|
||||
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
|
||||
Person(customerB, "Banking Customer B")
|
||||
Person_Ext(customerC, "Banking Customer C")
|
||||
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")
|
||||
|
||||
Person(customerD, "Banking Customer D", "A customer of the bank, <br/> with personal bank accounts.")
|
||||
|
||||
Enterprise_Boundary(b1, "BankBoundary") {
|
||||
|
||||
SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")
|
||||
|
||||
System_Boundary(b2, "BankBoundary2") {
|
||||
System(SystemA, "Banking System A")
|
||||
System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
|
||||
}
|
||||
|
||||
System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
|
||||
SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")
|
||||
|
||||
Boundary(b3, "BankBoundary3", "boundary") {
|
||||
SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
|
||||
SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
|
||||
}
|
||||
}
|
||||
|
||||
BiRel(customerA, SystemAA, "Uses")
|
||||
BiRel(SystemAA, SystemE, "Uses")
|
||||
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
|
||||
Rel(SystemC, customerA, "Sends e-mails to")
|
||||
```
|
||||
|
||||
```mermaid
|
||||
C4Context
|
||||
title System Context diagram for Internet Banking System
|
||||
|
||||
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
|
||||
Person(customerB, "Banking Customer B")
|
||||
Person_Ext(customerC, "Banking Customer C")
|
||||
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")
|
||||
|
||||
Person(customerD, "Banking Customer D", "A customer of the bank, <br/> with personal bank accounts.")
|
||||
|
||||
Enterprise_Boundary(b1, "BankBoundary") {
|
||||
|
||||
SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")
|
||||
|
||||
System_Boundary(b2, "BankBoundary2") {
|
||||
System(SystemA, "Banking System A")
|
||||
System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
|
||||
}
|
||||
|
||||
System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
|
||||
SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")
|
||||
|
||||
Boundary(b3, "BankBoundary3", "boundary") {
|
||||
SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
|
||||
SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
|
||||
}
|
||||
}
|
||||
|
||||
BiRel(customerA, SystemAA, "Uses")
|
||||
BiRel(SystemAA, SystemE, "Uses")
|
||||
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
|
||||
Rel(SystemC, customerA, "Sends e-mails to")
|
||||
```
|
||||
|
||||
## 发布
|
||||
|
||||
对于有权限的同学来说,你可以通过以下步骤来完成发布操作:
|
||||
|
||||
更新 `package.json` 中的版本号,然后执行如下命令:
|
||||
|
||||
```sh
|
||||
npm publish
|
||||
```
|
||||
|
||||
以上的命令会将文件打包到 `dist` 目录并发布至 <https://www.npmjs.com>.
|
||||
|
||||
## 相关项目
|
||||
|
||||
- [Command Line Interface](https://github.com/mermaid-js/mermaid-cli)
|
||||
- [Live Editor](https://github.com/mermaid-js/mermaid-live-editor)
|
||||
- [HTTP Server](https://github.com/TomWright/mermaid-server)
|
||||
|
||||
## 贡献者 [](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+issue%21%22) [](https://github.com/mermaid-js/mermaid/graphs/contributors) [](https://github.com/mermaid-js/mermaid/graphs/contributors)
|
||||
|
||||
Mermaid 是一个不断发展中的社区,并且还在接收新的贡献者。有很多不同的方式可以参与进来,而且我们还在寻找额外的帮助。如果你想知道如何开始贡献,请查看 [这个 issue](https://github.com/mermaid-js/mermaid/issues/866)。
|
||||
|
||||
关于如何贡献的详细信息可以在 [贡献指南](https://mermaid.js.org/community/contributing.html) 中找到。
|
||||
|
||||
## 安全
|
||||
|
||||
对于公开网站来说,从互联网上的用户处检索文本、存储供后续在浏览器中展示的内容可能是不安全的,理由是用户的内容可能嵌入一些数据加载完成之后就会运行的恶意脚本,这些对于 Mermaid 来说毫无疑问是一个风险,尤其是 mermaid 图表还包含了许多在 html 中使用的字符,这意味着我们难以使用常规的手段来过滤不安全代码,因为这些常规手段会造成图表损坏。我们仍然在努力对获取到的代码进行安全过滤并不断完善我们的程序,但很难保证没有漏洞。
|
||||
|
||||
作为拥有外部用户的网站的额外安全级别,我们很高兴推出一个新的安全级别,其中的图表在沙盒 iframe 中渲染,防止代码中的 javascript 被执行,这是在安全性方面迈出的一大步。
|
||||
|
||||
_很不幸的是,鱼与熊掌不可兼得,在这个场景下它意味着在可能的恶意代码被阻止时,也会损失部分交互能力_。
|
||||
|
||||
## 报告漏洞
|
||||
|
||||
如果想要报告漏洞,请发送邮件到 security@mermaid.live, 并附上问题的描述、复现问题的步骤、受影响的版本,以及解决问题的方案(如果有的话)。
|
||||
|
||||
## 鸣谢
|
||||
|
||||
来自 Knut Sveidqvist:
|
||||
|
||||
> _特别感谢 [d3](https://d3js.org/) 和 [dagre-d3](https://github.com/cpettitt/dagre-d3) 这两个优秀的项目,它们提供了图形布局和绘图工具库!_ > _同样感谢 [js-sequence-diagram](https://bramp.github.io/js-sequence-diagrams) 提供了时序图语法的使用。 感谢 Jessica Peter 提供了甘特图渲染的灵感。_ > _感谢 [Tyler Long](https://github.com/tylerlong) 从 2017 年四月开始成为了项目的合作者。_
|
||||
>
|
||||
> _感谢越来越多的 [贡献者们](https://github.com/mermaid-js/mermaid/graphs/contributors),没有你们,就没有这个项目的今天!_
|
||||
|
||||
---
|
||||
|
||||
_Mermaid 是由 Knut Sveidqvist 创建,它为了更简单的文档编写而生。_
|
||||
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
+2604
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../src/diagrams/globalStyles.ts"],
|
||||
"sourcesContent": ["export const getIconStyles = () => `\n /* Font Awesome icon styling - consolidated */\n .label-icon {\n display: inline-block;\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n }\n \n .node .label-icon path {\n fill: currentColor;\n stroke: revert;\n stroke-width: revert;\n }\n`;\n"],
|
||||
"mappings": ";;;;;AAAO,IAAM,gBAAgB,6BAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAN;",
|
||||
"names": []
|
||||
}
|
||||
+7
File diff suppressed because one or more lines are too long
+86
@@ -0,0 +1,86 @@
|
||||
import {
|
||||
insertEdge,
|
||||
insertEdgeLabel,
|
||||
markers_default,
|
||||
positionEdgeLabel
|
||||
} from "./chunk-O4XLMI2P.mjs";
|
||||
import {
|
||||
insertCluster,
|
||||
insertNode,
|
||||
labelHelper
|
||||
} from "./chunk-KYZI473N.mjs";
|
||||
import {
|
||||
interpolateToCurve
|
||||
} from "./chunk-GEFDOKGD.mjs";
|
||||
import {
|
||||
common_default,
|
||||
getConfig
|
||||
} from "./chunk-7R4GIKGN.mjs";
|
||||
import {
|
||||
__name,
|
||||
log
|
||||
} from "./chunk-AGHRB4JF.mjs";
|
||||
|
||||
// src/internals.ts
|
||||
var internalHelpers = {
|
||||
common: common_default,
|
||||
getConfig,
|
||||
insertCluster,
|
||||
insertEdge,
|
||||
insertEdgeLabel,
|
||||
insertMarkers: markers_default,
|
||||
insertNode,
|
||||
interpolateToCurve,
|
||||
labelHelper,
|
||||
log,
|
||||
positionEdgeLabel
|
||||
};
|
||||
|
||||
// src/rendering-util/render.ts
|
||||
var layoutAlgorithms = {};
|
||||
var registerLayoutLoaders = /* @__PURE__ */ __name((loaders) => {
|
||||
for (const loader of loaders) {
|
||||
layoutAlgorithms[loader.name] = loader;
|
||||
}
|
||||
}, "registerLayoutLoaders");
|
||||
var registerDefaultLayoutLoaders = /* @__PURE__ */ __name(() => {
|
||||
registerLayoutLoaders([
|
||||
{
|
||||
name: "dagre",
|
||||
loader: /* @__PURE__ */ __name(async () => await import("./dagre-KLK3FWXG.mjs"), "loader")
|
||||
},
|
||||
...true ? [
|
||||
{
|
||||
name: "cose-bilkent",
|
||||
loader: /* @__PURE__ */ __name(async () => await import("./cose-bilkent-S5V4N54A.mjs"), "loader")
|
||||
}
|
||||
] : []
|
||||
]);
|
||||
}, "registerDefaultLayoutLoaders");
|
||||
registerDefaultLayoutLoaders();
|
||||
var render = /* @__PURE__ */ __name(async (data4Layout, svg) => {
|
||||
if (!(data4Layout.layoutAlgorithm in layoutAlgorithms)) {
|
||||
throw new Error(`Unknown layout algorithm: ${data4Layout.layoutAlgorithm}`);
|
||||
}
|
||||
const layoutDefinition = layoutAlgorithms[data4Layout.layoutAlgorithm];
|
||||
const layoutRenderer = await layoutDefinition.loader();
|
||||
return layoutRenderer.render(data4Layout, svg, internalHelpers, {
|
||||
algorithm: layoutDefinition.algorithm
|
||||
});
|
||||
}, "render");
|
||||
var getRegisteredLayoutAlgorithm = /* @__PURE__ */ __name((algorithm = "", { fallback = "dagre" } = {}) => {
|
||||
if (algorithm in layoutAlgorithms) {
|
||||
return algorithm;
|
||||
}
|
||||
if (fallback in layoutAlgorithms) {
|
||||
log.warn(`Layout algorithm ${algorithm} is not registered. Using ${fallback} as fallback.`);
|
||||
return fallback;
|
||||
}
|
||||
throw new Error(`Both layout algorithms ${algorithm} and ${fallback} are not registered.`);
|
||||
}, "getRegisteredLayoutAlgorithm");
|
||||
|
||||
export {
|
||||
registerLayoutLoaders,
|
||||
render,
|
||||
getRegisteredLayoutAlgorithm
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../src/internals.ts", "../../../src/rendering-util/render.ts"],
|
||||
"sourcesContent": ["import { getConfig } from './config.js';\nimport common from './diagrams/common/common.js';\nimport { log } from './logger.js';\nimport { insertCluster } from './rendering-util/rendering-elements/clusters.js';\nimport {\n insertEdge,\n insertEdgeLabel,\n positionEdgeLabel,\n} from './rendering-util/rendering-elements/edges.js';\nimport insertMarkers from './rendering-util/rendering-elements/markers.js';\nimport { insertNode } from './rendering-util/rendering-elements/nodes.js';\nimport { labelHelper } from './rendering-util/rendering-elements/shapes/util.js';\nimport { interpolateToCurve } from './utils.js';\n\n/**\n * Internal helpers for mermaid\n * @deprecated - This should not be used by external packages, as the definitions will change without notice.\n */\nexport const internalHelpers = {\n common,\n getConfig,\n insertCluster,\n insertEdge,\n insertEdgeLabel,\n insertMarkers,\n insertNode,\n interpolateToCurve,\n labelHelper,\n log,\n positionEdgeLabel,\n};\n\nexport type InternalHelpers = typeof internalHelpers;\n", "import type { SVG } from '../diagram-api/types.js';\nimport type { InternalHelpers } from '../internals.js';\nimport { internalHelpers } from '../internals.js';\nimport { log } from '../logger.js';\nimport type { LayoutData } from './types.js';\n\n// console.log('MUST be removed, this only for keeping dev server working');\n// import tmp from './layout-algorithms/dagre/index.js';\n\nexport interface RenderOptions {\n algorithm?: string;\n}\n\nexport interface LayoutAlgorithm {\n render(\n layoutData: LayoutData,\n svg: SVG,\n helpers: InternalHelpers,\n options?: RenderOptions\n ): Promise<void>;\n}\n\nexport type LayoutLoader = () => Promise<LayoutAlgorithm>;\nexport interface LayoutLoaderDefinition {\n name: string;\n loader: LayoutLoader;\n algorithm?: string;\n}\n\nconst layoutAlgorithms: Record<string, LayoutLoaderDefinition> = {};\n\nexport const registerLayoutLoaders = (loaders: LayoutLoaderDefinition[]) => {\n for (const loader of loaders) {\n layoutAlgorithms[loader.name] = loader;\n }\n};\n\n// TODO: Should we load dagre without lazy loading?\nconst registerDefaultLayoutLoaders = () => {\n registerLayoutLoaders([\n {\n name: 'dagre',\n loader: async () => await import('./layout-algorithms/dagre/index.js'),\n },\n ...(injected.includeLargeFeatures\n ? [\n {\n name: 'cose-bilkent',\n loader: async () => await import('./layout-algorithms/cose-bilkent/index.js'),\n },\n ]\n : []),\n ]);\n};\n\nregisterDefaultLayoutLoaders();\n\nexport const render = async (data4Layout: LayoutData, svg: SVG) => {\n if (!(data4Layout.layoutAlgorithm in layoutAlgorithms)) {\n throw new Error(`Unknown layout algorithm: ${data4Layout.layoutAlgorithm}`);\n }\n\n const layoutDefinition = layoutAlgorithms[data4Layout.layoutAlgorithm];\n const layoutRenderer = await layoutDefinition.loader();\n return layoutRenderer.render(data4Layout, svg, internalHelpers, {\n algorithm: layoutDefinition.algorithm,\n });\n};\n\n/**\n * Get the registered layout algorithm. If the algorithm is not registered, use the fallback algorithm.\n */\nexport const getRegisteredLayoutAlgorithm = (algorithm = '', { fallback = 'dagre' } = {}) => {\n if (algorithm in layoutAlgorithms) {\n return algorithm;\n }\n if (fallback in layoutAlgorithms) {\n log.warn(`Layout algorithm ${algorithm} is not registered. Using ${fallback} as fallback.`);\n return fallback;\n }\n throw new Error(`Both layout algorithms ${algorithm} and ${fallback} are not registered.`);\n};\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAkBO,IAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ACDA,IAAM,mBAA2D,CAAC;AAE3D,IAAM,wBAAwB,wBAAC,YAAsC;AAC1E,aAAW,UAAU,SAAS;AAC5B,qBAAiB,OAAO,IAAI,IAAI;AAAA,EAClC;AACF,GAJqC;AAOrC,IAAM,+BAA+B,6BAAM;AACzC,wBAAsB;AAAA,IACpB;AAAA,MACE,MAAM;AAAA,MACN,QAAQ,mCAAY,MAAM,OAAO,sBAAoC,GAA7D;AAAA,IACV;AAAA,IACA,GAAI,OACA;AAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,QAAQ,mCAAY,MAAM,OAAO,6BAA2C,GAApE;AAAA,MACV;AAAA,IACF,IACA,CAAC;AAAA,EACP,CAAC;AACH,GAfqC;AAiBrC,6BAA6B;AAEtB,IAAM,SAAS,8BAAO,aAAyB,QAAa;AACjE,MAAI,EAAE,YAAY,mBAAmB,mBAAmB;AACtD,UAAM,IAAI,MAAM,6BAA6B,YAAY,eAAe,EAAE;AAAA,EAC5E;AAEA,QAAM,mBAAmB,iBAAiB,YAAY,eAAe;AACrE,QAAM,iBAAiB,MAAM,iBAAiB,OAAO;AACrD,SAAO,eAAe,OAAO,aAAa,KAAK,iBAAiB;AAAA,IAC9D,WAAW,iBAAiB;AAAA,EAC9B,CAAC;AACH,GAVsB;AAef,IAAM,+BAA+B,wBAAC,YAAY,IAAI,EAAE,WAAW,QAAQ,IAAI,CAAC,MAAM;AAC3F,MAAI,aAAa,kBAAkB;AACjC,WAAO;AAAA,EACT;AACA,MAAI,YAAY,kBAAkB;AAChC,QAAI,KAAK,oBAAoB,SAAS,6BAA6B,QAAQ,eAAe;AAC1F,WAAO;AAAA,EACT;AACA,QAAM,IAAI,MAAM,0BAA0B,SAAS,QAAQ,QAAQ,sBAAsB;AAC3F,GAT4C;",
|
||||
"names": []
|
||||
}
|
||||
+5333
File diff suppressed because it is too large
Load Diff
+7
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
import {
|
||||
ClassDB,
|
||||
classDiagram_default,
|
||||
classRenderer_v3_unified_default,
|
||||
styles_default
|
||||
} from "./chunk-WL4C6EOR.mjs";
|
||||
import "./chunk-FMBD7UC4.mjs";
|
||||
import "./chunk-JSJVCQXG.mjs";
|
||||
import "./chunk-55IACEB6.mjs";
|
||||
import "./chunk-KX2RTZJC.mjs";
|
||||
import "./chunk-GLR3WWYH.mjs";
|
||||
import "./chunk-O4XLMI2P.mjs";
|
||||
import "./chunk-MX3YWQON.mjs";
|
||||
import "./chunk-KYZI473N.mjs";
|
||||
import "./chunk-YBOYWFTD.mjs";
|
||||
import "./chunk-PQ6SQG4A.mjs";
|
||||
import "./chunk-PU5JKC2W.mjs";
|
||||
import "./chunk-GEFDOKGD.mjs";
|
||||
import "./chunk-7R4GIKGN.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-AGHRB4JF.mjs";
|
||||
|
||||
// src/diagrams/class/classDiagram-v2.ts
|
||||
var diagram = {
|
||||
parser: classDiagram_default,
|
||||
get db() {
|
||||
return new ClassDB();
|
||||
},
|
||||
renderer: classRenderer_v3_unified_default,
|
||||
styles: styles_default,
|
||||
init: /* @__PURE__ */ __name((cnf) => {
|
||||
if (!cnf.class) {
|
||||
cnf.class = {};
|
||||
}
|
||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||
}, "init")
|
||||
};
|
||||
export {
|
||||
diagram
|
||||
};
|
||||
+7
File diff suppressed because one or more lines are too long
+245
@@ -0,0 +1,245 @@
|
||||
import {
|
||||
selectSvgElement
|
||||
} from "./chunk-HHEYEP7N.mjs";
|
||||
import {
|
||||
populateCommonDb
|
||||
} from "./chunk-4BX2VUAB.mjs";
|
||||
import {
|
||||
cleanAndMerge
|
||||
} from "./chunk-GEFDOKGD.mjs";
|
||||
import {
|
||||
clear,
|
||||
configureSvgSize,
|
||||
defaultConfig_default,
|
||||
getAccDescription,
|
||||
getAccTitle,
|
||||
getConfig,
|
||||
getDiagramTitle,
|
||||
setAccDescription,
|
||||
setAccTitle,
|
||||
setDiagramTitle
|
||||
} from "./chunk-7R4GIKGN.mjs";
|
||||
import {
|
||||
__name,
|
||||
log
|
||||
} from "./chunk-AGHRB4JF.mjs";
|
||||
|
||||
// src/diagrams/packet/db.ts
|
||||
var DEFAULT_PACKET_CONFIG = defaultConfig_default.packet;
|
||||
var PacketDB = class {
|
||||
constructor() {
|
||||
this.packet = [];
|
||||
this.setAccTitle = setAccTitle;
|
||||
this.getAccTitle = getAccTitle;
|
||||
this.setDiagramTitle = setDiagramTitle;
|
||||
this.getDiagramTitle = getDiagramTitle;
|
||||
this.getAccDescription = getAccDescription;
|
||||
this.setAccDescription = setAccDescription;
|
||||
}
|
||||
static {
|
||||
__name(this, "PacketDB");
|
||||
}
|
||||
getConfig() {
|
||||
const config = cleanAndMerge({
|
||||
...DEFAULT_PACKET_CONFIG,
|
||||
...getConfig().packet
|
||||
});
|
||||
if (config.showBits) {
|
||||
config.paddingY += 10;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
getPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
pushWord(word) {
|
||||
if (word.length > 0) {
|
||||
this.packet.push(word);
|
||||
}
|
||||
}
|
||||
clear() {
|
||||
clear();
|
||||
this.packet = [];
|
||||
}
|
||||
};
|
||||
|
||||
// src/diagrams/packet/parser.ts
|
||||
import { parse } from "@mermaid-js/parser";
|
||||
var maxPacketSize = 1e4;
|
||||
var populate = /* @__PURE__ */ __name((ast, db) => {
|
||||
populateCommonDb(ast, db);
|
||||
let lastBit = -1;
|
||||
let word = [];
|
||||
let row = 1;
|
||||
const { bitsPerRow } = db.getConfig();
|
||||
for (let { start, end, bits, label } of ast.blocks) {
|
||||
if (start !== void 0 && end !== void 0 && end < start) {
|
||||
throw new Error(`Packet block ${start} - ${end} is invalid. End must be greater than start.`);
|
||||
}
|
||||
start ??= lastBit + 1;
|
||||
if (start !== lastBit + 1) {
|
||||
throw new Error(
|
||||
`Packet block ${start} - ${end ?? start} is not contiguous. It should start from ${lastBit + 1}.`
|
||||
);
|
||||
}
|
||||
if (bits === 0) {
|
||||
throw new Error(`Packet block ${start} is invalid. Cannot have a zero bit field.`);
|
||||
}
|
||||
end ??= start + (bits ?? 1) - 1;
|
||||
bits ??= end - start + 1;
|
||||
lastBit = end;
|
||||
log.debug(`Packet block ${start} - ${lastBit} with label ${label}`);
|
||||
while (word.length <= bitsPerRow + 1 && db.getPacket().length < maxPacketSize) {
|
||||
const [block, nextBlock] = getNextFittingBlock({ start, end, bits, label }, row, bitsPerRow);
|
||||
word.push(block);
|
||||
if (block.end + 1 === row * bitsPerRow) {
|
||||
db.pushWord(word);
|
||||
word = [];
|
||||
row++;
|
||||
}
|
||||
if (!nextBlock) {
|
||||
break;
|
||||
}
|
||||
({ start, end, bits, label } = nextBlock);
|
||||
}
|
||||
}
|
||||
db.pushWord(word);
|
||||
}, "populate");
|
||||
var getNextFittingBlock = /* @__PURE__ */ __name((block, row, bitsPerRow) => {
|
||||
if (block.start === void 0) {
|
||||
throw new Error("start should have been set during first phase");
|
||||
}
|
||||
if (block.end === void 0) {
|
||||
throw new Error("end should have been set during first phase");
|
||||
}
|
||||
if (block.start > block.end) {
|
||||
throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);
|
||||
}
|
||||
if (block.end + 1 <= row * bitsPerRow) {
|
||||
return [block, void 0];
|
||||
}
|
||||
const rowEnd = row * bitsPerRow - 1;
|
||||
const rowStart = row * bitsPerRow;
|
||||
return [
|
||||
{
|
||||
start: block.start,
|
||||
end: rowEnd,
|
||||
label: block.label,
|
||||
bits: rowEnd - block.start
|
||||
},
|
||||
{
|
||||
start: rowStart,
|
||||
end: block.end,
|
||||
label: block.label,
|
||||
bits: block.end - rowStart
|
||||
}
|
||||
];
|
||||
}, "getNextFittingBlock");
|
||||
var parser = {
|
||||
// @ts-expect-error - PacketDB is not assignable to DiagramDB
|
||||
parser: { yy: void 0 },
|
||||
parse: /* @__PURE__ */ __name(async (input) => {
|
||||
const ast = await parse("packet", input);
|
||||
const db = parser.parser?.yy;
|
||||
if (!(db instanceof PacketDB)) {
|
||||
throw new Error(
|
||||
"parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
|
||||
);
|
||||
}
|
||||
log.debug(ast);
|
||||
populate(ast, db);
|
||||
}, "parse")
|
||||
};
|
||||
|
||||
// src/diagrams/packet/renderer.ts
|
||||
var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
||||
const db = diagram2.db;
|
||||
const config = db.getConfig();
|
||||
const { rowHeight, paddingY, bitWidth, bitsPerRow } = config;
|
||||
const words = db.getPacket();
|
||||
const title = db.getDiagramTitle();
|
||||
const totalRowHeight = rowHeight + paddingY;
|
||||
const svgHeight = totalRowHeight * (words.length + 1) - (title ? 0 : rowHeight);
|
||||
const svgWidth = bitWidth * bitsPerRow + 2;
|
||||
const svg = selectSvgElement(id);
|
||||
svg.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
|
||||
configureSvgSize(svg, svgHeight, svgWidth, config.useMaxWidth);
|
||||
for (const [word, packet] of words.entries()) {
|
||||
drawWord(svg, packet, word, config);
|
||||
}
|
||||
svg.append("text").text(title).attr("x", svgWidth / 2).attr("y", svgHeight - totalRowHeight / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle");
|
||||
}, "draw");
|
||||
var drawWord = /* @__PURE__ */ __name((svg, word, rowNumber, { rowHeight, paddingX, paddingY, bitWidth, bitsPerRow, showBits }) => {
|
||||
const group = svg.append("g");
|
||||
const wordY = rowNumber * (rowHeight + paddingY) + paddingY;
|
||||
for (const block of word) {
|
||||
const blockX = block.start % bitsPerRow * bitWidth + 1;
|
||||
const width = (block.end - block.start + 1) * bitWidth - paddingX;
|
||||
group.append("rect").attr("x", blockX).attr("y", wordY).attr("width", width).attr("height", rowHeight).attr("class", "packetBlock");
|
||||
group.append("text").attr("x", blockX + width / 2).attr("y", wordY + rowHeight / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(block.label);
|
||||
if (!showBits) {
|
||||
continue;
|
||||
}
|
||||
const isSingleBlock = block.end === block.start;
|
||||
const bitNumberY = wordY - 2;
|
||||
group.append("text").attr("x", blockX + (isSingleBlock ? width / 2 : 0)).attr("y", bitNumberY).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", isSingleBlock ? "middle" : "start").text(block.start);
|
||||
if (!isSingleBlock) {
|
||||
group.append("text").attr("x", blockX + width).attr("y", bitNumberY).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(block.end);
|
||||
}
|
||||
}
|
||||
}, "drawWord");
|
||||
var renderer = { draw };
|
||||
|
||||
// src/diagrams/packet/styles.ts
|
||||
var defaultPacketStyleOptions = {
|
||||
byteFontSize: "10px",
|
||||
startByteColor: "black",
|
||||
endByteColor: "black",
|
||||
labelColor: "black",
|
||||
labelFontSize: "12px",
|
||||
titleColor: "black",
|
||||
titleFontSize: "14px",
|
||||
blockStrokeColor: "black",
|
||||
blockStrokeWidth: "1",
|
||||
blockFillColor: "#efefef"
|
||||
};
|
||||
var styles = /* @__PURE__ */ __name(({ packet } = {}) => {
|
||||
const options = cleanAndMerge(defaultPacketStyleOptions, packet);
|
||||
return `
|
||||
.packetByte {
|
||||
font-size: ${options.byteFontSize};
|
||||
}
|
||||
.packetByte.start {
|
||||
fill: ${options.startByteColor};
|
||||
}
|
||||
.packetByte.end {
|
||||
fill: ${options.endByteColor};
|
||||
}
|
||||
.packetLabel {
|
||||
fill: ${options.labelColor};
|
||||
font-size: ${options.labelFontSize};
|
||||
}
|
||||
.packetTitle {
|
||||
fill: ${options.titleColor};
|
||||
font-size: ${options.titleFontSize};
|
||||
}
|
||||
.packetBlock {
|
||||
stroke: ${options.blockStrokeColor};
|
||||
stroke-width: ${options.blockStrokeWidth};
|
||||
fill: ${options.blockFillColor};
|
||||
}
|
||||
`;
|
||||
}, "styles");
|
||||
|
||||
// src/diagrams/packet/diagram.ts
|
||||
var diagram = {
|
||||
parser,
|
||||
get db() {
|
||||
return new PacketDB();
|
||||
},
|
||||
renderer,
|
||||
styles
|
||||
};
|
||||
export {
|
||||
diagram
|
||||
};
|
||||
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
+2526
File diff suppressed because one or more lines are too long
+2301
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1014
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+1311
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1174
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+736
@@ -0,0 +1,736 @@
|
||||
import {
|
||||
clear,
|
||||
common_default,
|
||||
defaultConfig2 as defaultConfig,
|
||||
getAccDescription,
|
||||
getAccTitle,
|
||||
getConfig2 as getConfig,
|
||||
getDiagramTitle,
|
||||
setAccDescription,
|
||||
setAccTitle,
|
||||
setDiagramTitle,
|
||||
setupGraphViewbox
|
||||
} from "./chunk-7R4GIKGN.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-AGHRB4JF.mjs";
|
||||
|
||||
// src/diagrams/sankey/parser/sankey.jison
|
||||
var parser = (function() {
|
||||
var o = /* @__PURE__ */ __name(function(k, v, o2, l) {
|
||||
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
|
||||
return o2;
|
||||
}, "o"), $V0 = [1, 9], $V1 = [1, 10], $V2 = [1, 5, 10, 12];
|
||||
var parser2 = {
|
||||
trace: /* @__PURE__ */ __name(function trace() {
|
||||
}, "trace"),
|
||||
yy: {},
|
||||
symbols_: { "error": 2, "start": 3, "SANKEY": 4, "NEWLINE": 5, "csv": 6, "opt_eof": 7, "record": 8, "csv_tail": 9, "EOF": 10, "field[source]": 11, "COMMA": 12, "field[target]": 13, "field[value]": 14, "field": 15, "escaped": 16, "non_escaped": 17, "DQUOTE": 18, "ESCAPED_TEXT": 19, "NON_ESCAPED_TEXT": 20, "$accept": 0, "$end": 1 },
|
||||
terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" },
|
||||
productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
|
||||
performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
||||
var $0 = $$.length - 1;
|
||||
switch (yystate) {
|
||||
case 7:
|
||||
const source = yy.findOrCreateNode($$[$0 - 4].trim().replaceAll('""', '"'));
|
||||
const target = yy.findOrCreateNode($$[$0 - 2].trim().replaceAll('""', '"'));
|
||||
const value = parseFloat($$[$0].trim());
|
||||
yy.addLink(source, target, value);
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
case 11:
|
||||
this.$ = $$[$0];
|
||||
break;
|
||||
case 10:
|
||||
this.$ = $$[$0 - 1];
|
||||
break;
|
||||
}
|
||||
}, "anonymous"),
|
||||
table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 1: [2, 6], 7: 11, 10: [1, 12] }, o($V1, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, o($V2, [2, 8]), o($V2, [2, 9]), { 19: [1, 16] }, o($V2, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, o($V1, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 15: 18, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 18: [1, 19] }, o($V1, [2, 3]), { 12: [1, 20] }, o($V2, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: $V0, 20: $V1 }, o([1, 5, 10], [2, 7])],
|
||||
defaultActions: { 11: [2, 1], 12: [2, 5] },
|
||||
parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
|
||||
if (hash.recoverable) {
|
||||
this.trace(str);
|
||||
} else {
|
||||
var error = new Error(str);
|
||||
error.hash = hash;
|
||||
throw error;
|
||||
}
|
||||
}, "parseError"),
|
||||
parse: /* @__PURE__ */ __name(function parse(input) {
|
||||
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
|
||||
var args = lstack.slice.call(arguments, 1);
|
||||
var lexer2 = Object.create(this.lexer);
|
||||
var sharedState = { yy: {} };
|
||||
for (var k in this.yy) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
||||
sharedState.yy[k] = this.yy[k];
|
||||
}
|
||||
}
|
||||
lexer2.setInput(input, sharedState.yy);
|
||||
sharedState.yy.lexer = lexer2;
|
||||
sharedState.yy.parser = this;
|
||||
if (typeof lexer2.yylloc == "undefined") {
|
||||
lexer2.yylloc = {};
|
||||
}
|
||||
var yyloc = lexer2.yylloc;
|
||||
lstack.push(yyloc);
|
||||
var ranges = lexer2.options && lexer2.options.ranges;
|
||||
if (typeof sharedState.yy.parseError === "function") {
|
||||
this.parseError = sharedState.yy.parseError;
|
||||
} else {
|
||||
this.parseError = Object.getPrototypeOf(this).parseError;
|
||||
}
|
||||
function popStack(n) {
|
||||
stack.length = stack.length - 2 * n;
|
||||
vstack.length = vstack.length - n;
|
||||
lstack.length = lstack.length - n;
|
||||
}
|
||||
__name(popStack, "popStack");
|
||||
function lex() {
|
||||
var token;
|
||||
token = tstack.pop() || lexer2.lex() || EOF;
|
||||
if (typeof token !== "number") {
|
||||
if (token instanceof Array) {
|
||||
tstack = token;
|
||||
token = tstack.pop();
|
||||
}
|
||||
token = self.symbols_[token] || token;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
__name(lex, "lex");
|
||||
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
|
||||
while (true) {
|
||||
state = stack[stack.length - 1];
|
||||
if (this.defaultActions[state]) {
|
||||
action = this.defaultActions[state];
|
||||
} else {
|
||||
if (symbol === null || typeof symbol == "undefined") {
|
||||
symbol = lex();
|
||||
}
|
||||
action = table[state] && table[state][symbol];
|
||||
}
|
||||
if (typeof action === "undefined" || !action.length || !action[0]) {
|
||||
var errStr = "";
|
||||
expected = [];
|
||||
for (p in table[state]) {
|
||||
if (this.terminals_[p] && p > TERROR) {
|
||||
expected.push("'" + this.terminals_[p] + "'");
|
||||
}
|
||||
}
|
||||
if (lexer2.showPosition) {
|
||||
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
||||
} else {
|
||||
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
|
||||
}
|
||||
this.parseError(errStr, {
|
||||
text: lexer2.match,
|
||||
token: this.terminals_[symbol] || symbol,
|
||||
line: lexer2.yylineno,
|
||||
loc: yyloc,
|
||||
expected
|
||||
});
|
||||
}
|
||||
if (action[0] instanceof Array && action.length > 1) {
|
||||
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
||||
}
|
||||
switch (action[0]) {
|
||||
case 1:
|
||||
stack.push(symbol);
|
||||
vstack.push(lexer2.yytext);
|
||||
lstack.push(lexer2.yylloc);
|
||||
stack.push(action[1]);
|
||||
symbol = null;
|
||||
if (!preErrorSymbol) {
|
||||
yyleng = lexer2.yyleng;
|
||||
yytext = lexer2.yytext;
|
||||
yylineno = lexer2.yylineno;
|
||||
yyloc = lexer2.yylloc;
|
||||
if (recovering > 0) {
|
||||
recovering--;
|
||||
}
|
||||
} else {
|
||||
symbol = preErrorSymbol;
|
||||
preErrorSymbol = null;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
len = this.productions_[action[1]][1];
|
||||
yyval.$ = vstack[vstack.length - len];
|
||||
yyval._$ = {
|
||||
first_line: lstack[lstack.length - (len || 1)].first_line,
|
||||
last_line: lstack[lstack.length - 1].last_line,
|
||||
first_column: lstack[lstack.length - (len || 1)].first_column,
|
||||
last_column: lstack[lstack.length - 1].last_column
|
||||
};
|
||||
if (ranges) {
|
||||
yyval._$.range = [
|
||||
lstack[lstack.length - (len || 1)].range[0],
|
||||
lstack[lstack.length - 1].range[1]
|
||||
];
|
||||
}
|
||||
r = this.performAction.apply(yyval, [
|
||||
yytext,
|
||||
yyleng,
|
||||
yylineno,
|
||||
sharedState.yy,
|
||||
action[1],
|
||||
vstack,
|
||||
lstack
|
||||
].concat(args));
|
||||
if (typeof r !== "undefined") {
|
||||
return r;
|
||||
}
|
||||
if (len) {
|
||||
stack = stack.slice(0, -1 * len * 2);
|
||||
vstack = vstack.slice(0, -1 * len);
|
||||
lstack = lstack.slice(0, -1 * len);
|
||||
}
|
||||
stack.push(this.productions_[action[1]][0]);
|
||||
vstack.push(yyval.$);
|
||||
lstack.push(yyval._$);
|
||||
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
||||
stack.push(newState);
|
||||
break;
|
||||
case 3:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}, "parse")
|
||||
};
|
||||
var lexer = /* @__PURE__ */ (function() {
|
||||
var lexer2 = {
|
||||
EOF: 1,
|
||||
parseError: /* @__PURE__ */ __name(function parseError(str, hash) {
|
||||
if (this.yy.parser) {
|
||||
this.yy.parser.parseError(str, hash);
|
||||
} else {
|
||||
throw new Error(str);
|
||||
}
|
||||
}, "parseError"),
|
||||
// resets the lexer, sets new input
|
||||
setInput: /* @__PURE__ */ __name(function(input, yy) {
|
||||
this.yy = yy || this.yy || {};
|
||||
this._input = input;
|
||||
this._more = this._backtrack = this.done = false;
|
||||
this.yylineno = this.yyleng = 0;
|
||||
this.yytext = this.matched = this.match = "";
|
||||
this.conditionStack = ["INITIAL"];
|
||||
this.yylloc = {
|
||||
first_line: 1,
|
||||
first_column: 0,
|
||||
last_line: 1,
|
||||
last_column: 0
|
||||
};
|
||||
if (this.options.ranges) {
|
||||
this.yylloc.range = [0, 0];
|
||||
}
|
||||
this.offset = 0;
|
||||
return this;
|
||||
}, "setInput"),
|
||||
// consumes and returns one char from the input
|
||||
input: /* @__PURE__ */ __name(function() {
|
||||
var ch = this._input[0];
|
||||
this.yytext += ch;
|
||||
this.yyleng++;
|
||||
this.offset++;
|
||||
this.match += ch;
|
||||
this.matched += ch;
|
||||
var lines = ch.match(/(?:\r\n?|\n).*/g);
|
||||
if (lines) {
|
||||
this.yylineno++;
|
||||
this.yylloc.last_line++;
|
||||
} else {
|
||||
this.yylloc.last_column++;
|
||||
}
|
||||
if (this.options.ranges) {
|
||||
this.yylloc.range[1]++;
|
||||
}
|
||||
this._input = this._input.slice(1);
|
||||
return ch;
|
||||
}, "input"),
|
||||
// unshifts one char (or a string) into the input
|
||||
unput: /* @__PURE__ */ __name(function(ch) {
|
||||
var len = ch.length;
|
||||
var lines = ch.split(/(?:\r\n?|\n)/g);
|
||||
this._input = ch + this._input;
|
||||
this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
||||
this.offset -= len;
|
||||
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
||||
this.match = this.match.substr(0, this.match.length - 1);
|
||||
this.matched = this.matched.substr(0, this.matched.length - 1);
|
||||
if (lines.length - 1) {
|
||||
this.yylineno -= lines.length - 1;
|
||||
}
|
||||
var r = this.yylloc.range;
|
||||
this.yylloc = {
|
||||
first_line: this.yylloc.first_line,
|
||||
last_line: this.yylineno + 1,
|
||||
first_column: this.yylloc.first_column,
|
||||
last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
|
||||
};
|
||||
if (this.options.ranges) {
|
||||
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
||||
}
|
||||
this.yyleng = this.yytext.length;
|
||||
return this;
|
||||
}, "unput"),
|
||||
// When called from action, caches matched text and appends it on next action
|
||||
more: /* @__PURE__ */ __name(function() {
|
||||
this._more = true;
|
||||
return this;
|
||||
}, "more"),
|
||||
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
||||
reject: /* @__PURE__ */ __name(function() {
|
||||
if (this.options.backtrack_lexer) {
|
||||
this._backtrack = true;
|
||||
} else {
|
||||
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
|
||||
text: "",
|
||||
token: null,
|
||||
line: this.yylineno
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}, "reject"),
|
||||
// retain first n characters of the match
|
||||
less: /* @__PURE__ */ __name(function(n) {
|
||||
this.unput(this.match.slice(n));
|
||||
}, "less"),
|
||||
// displays already matched input, i.e. for error messages
|
||||
pastInput: /* @__PURE__ */ __name(function() {
|
||||
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
||||
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
|
||||
}, "pastInput"),
|
||||
// displays upcoming input, i.e. for error messages
|
||||
upcomingInput: /* @__PURE__ */ __name(function() {
|
||||
var next = this.match;
|
||||
if (next.length < 20) {
|
||||
next += this._input.substr(0, 20 - next.length);
|
||||
}
|
||||
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
|
||||
}, "upcomingInput"),
|
||||
// displays the character position where the lexing error occurred, i.e. for error messages
|
||||
showPosition: /* @__PURE__ */ __name(function() {
|
||||
var pre = this.pastInput();
|
||||
var c = new Array(pre.length + 1).join("-");
|
||||
return pre + this.upcomingInput() + "\n" + c + "^";
|
||||
}, "showPosition"),
|
||||
// test the lexed token: return FALSE when not a match, otherwise return token
|
||||
test_match: /* @__PURE__ */ __name(function(match, indexed_rule) {
|
||||
var token, lines, backup;
|
||||
if (this.options.backtrack_lexer) {
|
||||
backup = {
|
||||
yylineno: this.yylineno,
|
||||
yylloc: {
|
||||
first_line: this.yylloc.first_line,
|
||||
last_line: this.last_line,
|
||||
first_column: this.yylloc.first_column,
|
||||
last_column: this.yylloc.last_column
|
||||
},
|
||||
yytext: this.yytext,
|
||||
match: this.match,
|
||||
matches: this.matches,
|
||||
matched: this.matched,
|
||||
yyleng: this.yyleng,
|
||||
offset: this.offset,
|
||||
_more: this._more,
|
||||
_input: this._input,
|
||||
yy: this.yy,
|
||||
conditionStack: this.conditionStack.slice(0),
|
||||
done: this.done
|
||||
};
|
||||
if (this.options.ranges) {
|
||||
backup.yylloc.range = this.yylloc.range.slice(0);
|
||||
}
|
||||
}
|
||||
lines = match[0].match(/(?:\r\n?|\n).*/g);
|
||||
if (lines) {
|
||||
this.yylineno += lines.length;
|
||||
}
|
||||
this.yylloc = {
|
||||
first_line: this.yylloc.last_line,
|
||||
last_line: this.yylineno + 1,
|
||||
first_column: this.yylloc.last_column,
|
||||
last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
|
||||
};
|
||||
this.yytext += match[0];
|
||||
this.match += match[0];
|
||||
this.matches = match;
|
||||
this.yyleng = this.yytext.length;
|
||||
if (this.options.ranges) {
|
||||
this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
||||
}
|
||||
this._more = false;
|
||||
this._backtrack = false;
|
||||
this._input = this._input.slice(match[0].length);
|
||||
this.matched += match[0];
|
||||
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
||||
if (this.done && this._input) {
|
||||
this.done = false;
|
||||
}
|
||||
if (token) {
|
||||
return token;
|
||||
} else if (this._backtrack) {
|
||||
for (var k in backup) {
|
||||
this[k] = backup[k];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}, "test_match"),
|
||||
// return next match in input
|
||||
next: /* @__PURE__ */ __name(function() {
|
||||
if (this.done) {
|
||||
return this.EOF;
|
||||
}
|
||||
if (!this._input) {
|
||||
this.done = true;
|
||||
}
|
||||
var token, match, tempMatch, index;
|
||||
if (!this._more) {
|
||||
this.yytext = "";
|
||||
this.match = "";
|
||||
}
|
||||
var rules = this._currentRules();
|
||||
for (var i = 0; i < rules.length; i++) {
|
||||
tempMatch = this._input.match(this.rules[rules[i]]);
|
||||
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
||||
match = tempMatch;
|
||||
index = i;
|
||||
if (this.options.backtrack_lexer) {
|
||||
token = this.test_match(tempMatch, rules[i]);
|
||||
if (token !== false) {
|
||||
return token;
|
||||
} else if (this._backtrack) {
|
||||
match = false;
|
||||
continue;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.options.flex) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (match) {
|
||||
token = this.test_match(match, rules[index]);
|
||||
if (token !== false) {
|
||||
return token;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (this._input === "") {
|
||||
return this.EOF;
|
||||
} else {
|
||||
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
|
||||
text: "",
|
||||
token: null,
|
||||
line: this.yylineno
|
||||
});
|
||||
}
|
||||
}, "next"),
|
||||
// return next match that has a token
|
||||
lex: /* @__PURE__ */ __name(function lex() {
|
||||
var r = this.next();
|
||||
if (r) {
|
||||
return r;
|
||||
} else {
|
||||
return this.lex();
|
||||
}
|
||||
}, "lex"),
|
||||
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
||||
begin: /* @__PURE__ */ __name(function begin(condition) {
|
||||
this.conditionStack.push(condition);
|
||||
}, "begin"),
|
||||
// pop the previously active lexer condition state off the condition stack
|
||||
popState: /* @__PURE__ */ __name(function popState() {
|
||||
var n = this.conditionStack.length - 1;
|
||||
if (n > 0) {
|
||||
return this.conditionStack.pop();
|
||||
} else {
|
||||
return this.conditionStack[0];
|
||||
}
|
||||
}, "popState"),
|
||||
// produce the lexer rule set which is active for the currently active lexer condition state
|
||||
_currentRules: /* @__PURE__ */ __name(function _currentRules() {
|
||||
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
||||
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
||||
} else {
|
||||
return this.conditions["INITIAL"].rules;
|
||||
}
|
||||
}, "_currentRules"),
|
||||
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
||||
topState: /* @__PURE__ */ __name(function topState(n) {
|
||||
n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
||||
if (n >= 0) {
|
||||
return this.conditionStack[n];
|
||||
} else {
|
||||
return "INITIAL";
|
||||
}
|
||||
}, "topState"),
|
||||
// alias for begin(condition)
|
||||
pushState: /* @__PURE__ */ __name(function pushState(condition) {
|
||||
this.begin(condition);
|
||||
}, "pushState"),
|
||||
// return the number of states currently on the stack
|
||||
stateStackSize: /* @__PURE__ */ __name(function stateStackSize() {
|
||||
return this.conditionStack.length;
|
||||
}, "stateStackSize"),
|
||||
options: { "case-insensitive": true },
|
||||
performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
|
||||
var YYSTATE = YY_START;
|
||||
switch ($avoiding_name_collisions) {
|
||||
case 0:
|
||||
this.pushState("csv");
|
||||
return 4;
|
||||
break;
|
||||
case 1:
|
||||
this.pushState("csv");
|
||||
return 4;
|
||||
break;
|
||||
case 2:
|
||||
return 10;
|
||||
break;
|
||||
case 3:
|
||||
return 5;
|
||||
break;
|
||||
case 4:
|
||||
return 12;
|
||||
break;
|
||||
case 5:
|
||||
this.pushState("escaped_text");
|
||||
return 18;
|
||||
break;
|
||||
case 6:
|
||||
return 20;
|
||||
break;
|
||||
case 7:
|
||||
this.popState("escaped_text");
|
||||
return 18;
|
||||
break;
|
||||
case 8:
|
||||
return 19;
|
||||
break;
|
||||
}
|
||||
}, "anonymous"),
|
||||
rules: [/^(?:sankey-beta\b)/i, /^(?:sankey\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],
|
||||
conditions: { "csv": { "rules": [2, 3, 4, 5, 6, 7, 8], "inclusive": false }, "escaped_text": { "rules": [7, 8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8], "inclusive": true } }
|
||||
};
|
||||
return lexer2;
|
||||
})();
|
||||
parser2.lexer = lexer;
|
||||
function Parser() {
|
||||
this.yy = {};
|
||||
}
|
||||
__name(Parser, "Parser");
|
||||
Parser.prototype = parser2;
|
||||
parser2.Parser = Parser;
|
||||
return new Parser();
|
||||
})();
|
||||
parser.parser = parser;
|
||||
var sankey_default = parser;
|
||||
|
||||
// src/diagrams/sankey/sankeyDB.ts
|
||||
var links = [];
|
||||
var nodes = [];
|
||||
var nodesMap = /* @__PURE__ */ new Map();
|
||||
var clear2 = /* @__PURE__ */ __name(() => {
|
||||
links = [];
|
||||
nodes = [];
|
||||
nodesMap = /* @__PURE__ */ new Map();
|
||||
clear();
|
||||
}, "clear");
|
||||
var SankeyLink = class {
|
||||
constructor(source, target, value = 0) {
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
this.value = value;
|
||||
}
|
||||
static {
|
||||
__name(this, "SankeyLink");
|
||||
}
|
||||
};
|
||||
var addLink = /* @__PURE__ */ __name((source, target, value) => {
|
||||
links.push(new SankeyLink(source, target, value));
|
||||
}, "addLink");
|
||||
var SankeyNode = class {
|
||||
constructor(ID) {
|
||||
this.ID = ID;
|
||||
}
|
||||
static {
|
||||
__name(this, "SankeyNode");
|
||||
}
|
||||
};
|
||||
var findOrCreateNode = /* @__PURE__ */ __name((ID) => {
|
||||
ID = common_default.sanitizeText(ID, getConfig());
|
||||
let node = nodesMap.get(ID);
|
||||
if (node === void 0) {
|
||||
node = new SankeyNode(ID);
|
||||
nodesMap.set(ID, node);
|
||||
nodes.push(node);
|
||||
}
|
||||
return node;
|
||||
}, "findOrCreateNode");
|
||||
var getNodes = /* @__PURE__ */ __name(() => nodes, "getNodes");
|
||||
var getLinks = /* @__PURE__ */ __name(() => links, "getLinks");
|
||||
var getGraph = /* @__PURE__ */ __name(() => ({
|
||||
nodes: nodes.map((node) => ({ id: node.ID })),
|
||||
links: links.map((link) => ({
|
||||
source: link.source.ID,
|
||||
target: link.target.ID,
|
||||
value: link.value
|
||||
}))
|
||||
}), "getGraph");
|
||||
var sankeyDB_default = {
|
||||
nodesMap,
|
||||
getConfig: /* @__PURE__ */ __name(() => getConfig().sankey, "getConfig"),
|
||||
getNodes,
|
||||
getLinks,
|
||||
getGraph,
|
||||
addLink,
|
||||
findOrCreateNode,
|
||||
getAccTitle,
|
||||
setAccTitle,
|
||||
getAccDescription,
|
||||
setAccDescription,
|
||||
getDiagramTitle,
|
||||
setDiagramTitle,
|
||||
clear: clear2
|
||||
};
|
||||
|
||||
// src/diagrams/sankey/sankeyRenderer.ts
|
||||
import {
|
||||
select as d3select,
|
||||
scaleOrdinal as d3scaleOrdinal,
|
||||
schemeTableau10 as d3schemeTableau10
|
||||
} from "d3";
|
||||
import {
|
||||
sankey as d3Sankey,
|
||||
sankeyLinkHorizontal as d3SankeyLinkHorizontal,
|
||||
sankeyLeft as d3SankeyLeft,
|
||||
sankeyRight as d3SankeyRight,
|
||||
sankeyCenter as d3SankeyCenter,
|
||||
sankeyJustify as d3SankeyJustify
|
||||
} from "d3-sankey";
|
||||
|
||||
// src/rendering-util/uid.ts
|
||||
var Uid = class _Uid {
|
||||
static {
|
||||
__name(this, "Uid");
|
||||
}
|
||||
static {
|
||||
this.count = 0;
|
||||
}
|
||||
static next(name) {
|
||||
return new _Uid(name + ++_Uid.count);
|
||||
}
|
||||
constructor(id) {
|
||||
this.id = id;
|
||||
this.href = `#${id}`;
|
||||
}
|
||||
toString() {
|
||||
return "url(" + this.href + ")";
|
||||
}
|
||||
};
|
||||
|
||||
// src/diagrams/sankey/sankeyRenderer.ts
|
||||
var alignmentsMap = {
|
||||
left: d3SankeyLeft,
|
||||
right: d3SankeyRight,
|
||||
center: d3SankeyCenter,
|
||||
justify: d3SankeyJustify
|
||||
};
|
||||
var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
|
||||
const { securityLevel, sankey: conf } = getConfig();
|
||||
const defaultSankeyConfig = defaultConfig.sankey;
|
||||
let sandboxElement;
|
||||
if (securityLevel === "sandbox") {
|
||||
sandboxElement = d3select("#i" + id);
|
||||
}
|
||||
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
|
||||
const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : d3select(`[id="${id}"]`);
|
||||
const width = conf?.width ?? defaultSankeyConfig.width;
|
||||
const height = conf?.height ?? defaultSankeyConfig.width;
|
||||
const useMaxWidth = conf?.useMaxWidth ?? defaultSankeyConfig.useMaxWidth;
|
||||
const nodeAlignment = conf?.nodeAlignment ?? defaultSankeyConfig.nodeAlignment;
|
||||
const prefix = conf?.prefix ?? defaultSankeyConfig.prefix;
|
||||
const suffix = conf?.suffix ?? defaultSankeyConfig.suffix;
|
||||
const showValues = conf?.showValues ?? defaultSankeyConfig.showValues;
|
||||
const graph = diagObj.db.getGraph();
|
||||
const nodeAlign = alignmentsMap[nodeAlignment];
|
||||
const nodeWidth = 10;
|
||||
const sankey = d3Sankey().nodeId((d) => d.id).nodeWidth(nodeWidth).nodePadding(10 + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([
|
||||
[0, 0],
|
||||
[width, height]
|
||||
]);
|
||||
sankey(graph);
|
||||
const colorScheme = d3scaleOrdinal(d3schemeTableau10);
|
||||
svg.append("g").attr("class", "nodes").selectAll(".node").data(graph.nodes).join("g").attr("class", "node").attr("id", (d) => (d.uid = Uid.next("node-")).id).attr("transform", function(d) {
|
||||
return "translate(" + d.x0 + "," + d.y0 + ")";
|
||||
}).attr("x", (d) => d.x0).attr("y", (d) => d.y0).append("rect").attr("height", (d) => {
|
||||
return d.y1 - d.y0;
|
||||
}).attr("width", (d) => d.x1 - d.x0).attr("fill", (d) => colorScheme(d.id));
|
||||
const getText = /* @__PURE__ */ __name(({ id: id2, value }) => {
|
||||
if (!showValues) {
|
||||
return id2;
|
||||
}
|
||||
return `${id2}
|
||||
${prefix}${Math.round(value * 100) / 100}${suffix}`;
|
||||
}, "getText");
|
||||
svg.append("g").attr("class", "node-labels").attr("font-size", 14).selectAll("text").data(graph.nodes).join("text").attr("x", (d) => d.x0 < width / 2 ? d.x1 + 6 : d.x0 - 6).attr("y", (d) => (d.y1 + d.y0) / 2).attr("dy", `${showValues ? "0" : "0.35"}em`).attr("text-anchor", (d) => d.x0 < width / 2 ? "start" : "end").text(getText);
|
||||
const link = svg.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(graph.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply");
|
||||
const linkColor = conf?.linkColor ?? "gradient";
|
||||
if (linkColor === "gradient") {
|
||||
const gradient = link.append("linearGradient").attr("id", (d) => (d.uid = Uid.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (d) => d.source.x1).attr("x2", (d) => d.target.x0);
|
||||
gradient.append("stop").attr("offset", "0%").attr("stop-color", (d) => colorScheme(d.source.id));
|
||||
gradient.append("stop").attr("offset", "100%").attr("stop-color", (d) => colorScheme(d.target.id));
|
||||
}
|
||||
let coloring;
|
||||
switch (linkColor) {
|
||||
case "gradient":
|
||||
coloring = /* @__PURE__ */ __name((d) => d.uid, "coloring");
|
||||
break;
|
||||
case "source":
|
||||
coloring = /* @__PURE__ */ __name((d) => colorScheme(d.source.id), "coloring");
|
||||
break;
|
||||
case "target":
|
||||
coloring = /* @__PURE__ */ __name((d) => colorScheme(d.target.id), "coloring");
|
||||
break;
|
||||
default:
|
||||
coloring = linkColor;
|
||||
}
|
||||
link.append("path").attr("d", d3SankeyLinkHorizontal()).attr("stroke", coloring).attr("stroke-width", (d) => Math.max(1, d.width));
|
||||
setupGraphViewbox(void 0, svg, 0, useMaxWidth);
|
||||
}, "draw");
|
||||
var sankeyRenderer_default = {
|
||||
draw
|
||||
};
|
||||
|
||||
// src/diagrams/sankey/sankeyUtils.ts
|
||||
var prepareTextForParsing = /* @__PURE__ */ __name((text) => {
|
||||
const textToParse = text.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, "\n").trim();
|
||||
return textToParse;
|
||||
}, "prepareTextForParsing");
|
||||
|
||||
// src/diagrams/sankey/styles.js
|
||||
var getStyles = /* @__PURE__ */ __name((options) => `.label {
|
||||
font-family: ${options.fontFamily};
|
||||
}`, "getStyles");
|
||||
var styles_default = getStyles;
|
||||
|
||||
// src/diagrams/sankey/sankeyDiagram.ts
|
||||
var originalParse = sankey_default.parse.bind(sankey_default);
|
||||
sankey_default.parse = (text) => originalParse(prepareTextForParsing(text));
|
||||
var diagram = {
|
||||
styles: styles_default,
|
||||
parser: sankey_default,
|
||||
db: sankeyDB_default,
|
||||
renderer: sankeyRenderer_default
|
||||
};
|
||||
export {
|
||||
diagram
|
||||
};
|
||||
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
+1101
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+1964
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
+10
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
+220
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
import{a as f}from"./chunk-VELTKBKT.mjs";var d=f((t,r)=>{if(r)return"translate("+-t.width/2+", "+-t.height/2+")";let c=t.x??0,e=t.y??0;return"translate("+-(c+t.width/2)+", "+-(e+t.height/2)+")"},"computeLabelTransform");var s={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4},T={arrow_point:9,arrow_cross:12.5,arrow_circle:12.5};function x(t,r){if(t===void 0||r===void 0)return{angle:0,deltaX:0,deltaY:0};t=n(t),r=n(r);let[c,e]=[t.x,t.y],[o,i]=[r.x,r.y],l=o-c,p=i-e;return{angle:Math.atan(p/l),deltaX:l,deltaY:p}}f(x,"calculateDeltaAndAngle");var n=f(t=>Array.isArray(t)?{x:t[0],y:t[1]}:t,"pointTransformer"),E=f(t=>({x:f(function(r,c,e){let o=0,i=n(e[0]).x<n(e[e.length-1]).x?"left":"right";if(c===0&&Object.hasOwn(s,t.arrowTypeStart)){let{angle:a,deltaX:m}=x(e[0],e[1]);o=s[t.arrowTypeStart]*Math.cos(a)*(m>=0?1:-1)}else if(c===e.length-1&&Object.hasOwn(s,t.arrowTypeEnd)){let{angle:a,deltaX:m}=x(e[e.length-1],e[e.length-2]);o=s[t.arrowTypeEnd]*Math.cos(a)*(m>=0?1:-1)}let l=Math.abs(n(r).x-n(e[e.length-1]).x),p=Math.abs(n(r).y-n(e[e.length-1]).y),u=Math.abs(n(r).x-n(e[0]).x),b=Math.abs(n(r).y-n(e[0]).y),y=s[t.arrowTypeStart],h=s[t.arrowTypeEnd],g=1;if(l<h&&l>0&&p<h){let a=h+g-l;a*=i==="right"?-1:1,o-=a}if(u<y&&u>0&&b<y){let a=y+g-u;a*=i==="right"?-1:1,o+=a}return n(r).x+o},"x"),y:f(function(r,c,e){let o=0,i=n(e[0]).y<n(e[e.length-1]).y?"down":"up";if(c===0&&Object.hasOwn(s,t.arrowTypeStart)){let{angle:a,deltaY:m}=x(e[0],e[1]);o=s[t.arrowTypeStart]*Math.abs(Math.sin(a))*(m>=0?1:-1)}else if(c===e.length-1&&Object.hasOwn(s,t.arrowTypeEnd)){let{angle:a,deltaY:m}=x(e[e.length-1],e[e.length-2]);o=s[t.arrowTypeEnd]*Math.abs(Math.sin(a))*(m>=0?1:-1)}let l=Math.abs(n(r).y-n(e[e.length-1]).y),p=Math.abs(n(r).x-n(e[e.length-1]).x),u=Math.abs(n(r).y-n(e[0]).y),b=Math.abs(n(r).x-n(e[0]).x),y=s[t.arrowTypeStart],h=s[t.arrowTypeEnd],g=1;if(l<h&&l>0&&p<h){let a=h+g-l;a*=i==="up"?-1:1,o-=a}if(u<y&&u>0&&b<y){let a=y+g-u;a*=i==="up"?-1:1,o+=a}return n(r).y+o},"y")}),"getLineFunctionsWithOffset");export{d as a,s as b,T as c,E as d};
|
||||
+7
File diff suppressed because one or more lines are too long
+339
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../src/diagrams/common/populateCommonDb.ts"],
|
||||
"sourcesContent": ["import type { DiagramAST } from '@mermaid-js/parser';\nimport type { DiagramDB } from '../../diagram-api/types.js';\n\nexport function populateCommonDb(ast: DiagramAST, db: DiagramDB) {\n if (ast.accDescr) {\n db.setAccDescription?.(ast.accDescr);\n }\n if (ast.accTitle) {\n db.setAccTitle?.(ast.accTitle);\n }\n if (ast.title) {\n db.setDiagramTitle?.(ast.title);\n }\n}\n"],
|
||||
"mappings": "yCAGO,SAASA,EAAiBC,EAAiBC,EAAe,CAC3DD,EAAI,UACNC,EAAG,oBAAoBD,EAAI,QAAQ,EAEjCA,EAAI,UACNC,EAAG,cAAcD,EAAI,QAAQ,EAE3BA,EAAI,OACNC,EAAG,kBAAkBD,EAAI,KAAK,CAElC,CAVgBE,EAAAH,EAAA",
|
||||
"names": ["populateCommonDb", "ast", "db", "__name"]
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
import{Y as s}from"./chunk-3UWU4A3N.mjs";import{h as e}from"./chunk-MGPAVIPZ.mjs";import{a as n}from"./chunk-VELTKBKT.mjs";var d=n(t=>{let{securityLevel:m}=s(),o=e("body");if(m==="sandbox"){let c=e(`#i${t}`).node()?.contentDocument??document;o=e(c.body)}return o.select(`#${t}`)},"selectSvgElement");export{d as a};
|
||||
+7
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../parser/dist/chunks/mermaid-parser.core/chunk-EGIJ26TM.mjs"],
|
||||
"sourcesContent": ["import {\n AbstractMermaidTokenBuilder,\n CommonValueConverter,\n InfoGrammarGeneratedModule,\n MermaidGeneratedSharedModule,\n __name\n} from \"./chunk-XZSTWKYB.mjs\";\n\n// src/language/info/module.ts\nimport {\n EmptyFileSystem,\n createDefaultCoreModule,\n createDefaultSharedCoreModule,\n inject\n} from \"langium\";\n\n// src/language/info/tokenBuilder.ts\nvar InfoTokenBuilder = class extends AbstractMermaidTokenBuilder {\n static {\n __name(this, \"InfoTokenBuilder\");\n }\n constructor() {\n super([\"info\", \"showInfo\"]);\n }\n};\n\n// src/language/info/module.ts\nvar InfoModule = {\n parser: {\n TokenBuilder: /* @__PURE__ */ __name(() => new InfoTokenBuilder(), \"TokenBuilder\"),\n ValueConverter: /* @__PURE__ */ __name(() => new CommonValueConverter(), \"ValueConverter\")\n }\n};\nfunction createInfoServices(context = EmptyFileSystem) {\n const shared = inject(\n createDefaultSharedCoreModule(context),\n MermaidGeneratedSharedModule\n );\n const Info = inject(\n createDefaultCoreModule({ shared }),\n InfoGrammarGeneratedModule,\n InfoModule\n );\n shared.ServiceRegistry.register(Info);\n return { shared, Info };\n}\n__name(createInfoServices, \"createInfoServices\");\n\nexport {\n InfoModule,\n createInfoServices\n};\n"],
|
||||
"mappings": "4IAiBA,IAAIA,EAAmB,cAAcC,CAA4B,CAjBjE,MAiBiE,CAAAC,EAAA,yBAC/D,MAAO,CACLA,EAAO,KAAM,kBAAkB,CACjC,CACA,aAAc,CACZ,MAAM,CAAC,OAAQ,UAAU,CAAC,CAC5B,CACF,EAGIC,EAAa,CACf,OAAQ,CACN,aAA8BD,EAAO,IAAM,IAAIF,EAAoB,cAAc,EACjF,eAAgCE,EAAO,IAAM,IAAIE,EAAwB,gBAAgB,CAC3F,CACF,EACA,SAASC,EAAmBC,EAAUC,EAAiB,CACrD,IAAMC,EAASC,EACbC,EAA8BJ,CAAO,EACrCK,CACF,EACMC,EAAOH,EACXI,EAAwB,CAAE,OAAAL,CAAO,CAAC,EAClCM,EACAX,CACF,EACA,OAAAK,EAAO,gBAAgB,SAASI,CAAI,EAC7B,CAAE,OAAAJ,EAAQ,KAAAI,CAAK,CACxB,CAZSV,EAAAG,EAAA,sBAaTH,EAAOG,EAAoB,oBAAoB",
|
||||
"names": ["InfoTokenBuilder", "AbstractMermaidTokenBuilder", "__name", "InfoModule", "CommonValueConverter", "createInfoServices", "context", "EmptyFileSystem", "shared", "inject", "createDefaultSharedCoreModule", "MermaidGeneratedSharedModule", "Info", "createDefaultCoreModule", "InfoGrammarGeneratedModule"]
|
||||
}
|
||||
+7
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../parser/dist/chunks/mermaid-parser.core/chunk-7E7YKBS2.mjs"],
|
||||
"sourcesContent": ["import {\n AbstractMermaidTokenBuilder,\n CommonValueConverter,\n GitGraphGrammarGeneratedModule,\n MermaidGeneratedSharedModule,\n __name\n} from \"./chunk-XZSTWKYB.mjs\";\n\n// src/language/gitGraph/module.ts\nimport {\n inject,\n createDefaultCoreModule,\n createDefaultSharedCoreModule,\n EmptyFileSystem\n} from \"langium\";\n\n// src/language/gitGraph/tokenBuilder.ts\nvar GitGraphTokenBuilder = class extends AbstractMermaidTokenBuilder {\n static {\n __name(this, \"GitGraphTokenBuilder\");\n }\n constructor() {\n super([\"gitGraph\"]);\n }\n};\n\n// src/language/gitGraph/module.ts\nvar GitGraphModule = {\n parser: {\n TokenBuilder: /* @__PURE__ */ __name(() => new GitGraphTokenBuilder(), \"TokenBuilder\"),\n ValueConverter: /* @__PURE__ */ __name(() => new CommonValueConverter(), \"ValueConverter\")\n }\n};\nfunction createGitGraphServices(context = EmptyFileSystem) {\n const shared = inject(\n createDefaultSharedCoreModule(context),\n MermaidGeneratedSharedModule\n );\n const GitGraph = inject(\n createDefaultCoreModule({ shared }),\n GitGraphGrammarGeneratedModule,\n GitGraphModule\n );\n shared.ServiceRegistry.register(GitGraph);\n return { shared, GitGraph };\n}\n__name(createGitGraphServices, \"createGitGraphServices\");\n\nexport {\n GitGraphModule,\n createGitGraphServices\n};\n"],
|
||||
"mappings": "iJAiBA,IAAIA,EAAuB,cAAcC,CAA4B,CAjBrE,MAiBqE,CAAAC,EAAA,6BACnE,MAAO,CACLA,EAAO,KAAM,sBAAsB,CACrC,CACA,aAAc,CACZ,MAAM,CAAC,UAAU,CAAC,CACpB,CACF,EAGIC,EAAiB,CACnB,OAAQ,CACN,aAA8BD,EAAO,IAAM,IAAIF,EAAwB,cAAc,EACrF,eAAgCE,EAAO,IAAM,IAAIE,EAAwB,gBAAgB,CAC3F,CACF,EACA,SAASC,EAAuBC,EAAUC,EAAiB,CACzD,IAAMC,EAASC,EACbC,EAA8BJ,CAAO,EACrCK,CACF,EACMC,EAAWH,EACfI,EAAwB,CAAE,OAAAL,CAAO,CAAC,EAClCM,EACAX,CACF,EACA,OAAAK,EAAO,gBAAgB,SAASI,CAAQ,EACjC,CAAE,OAAAJ,EAAQ,SAAAI,CAAS,CAC5B,CAZSV,EAAAG,EAAA,0BAaTH,EAAOG,EAAwB,wBAAwB",
|
||||
"names": ["GitGraphTokenBuilder", "AbstractMermaidTokenBuilder", "__name", "GitGraphModule", "CommonValueConverter", "createGitGraphServices", "context", "EmptyFileSystem", "shared", "inject", "createDefaultSharedCoreModule", "MermaidGeneratedSharedModule", "GitGraph", "createDefaultCoreModule", "GitGraphGrammarGeneratedModule"]
|
||||
}
|
||||
+37
File diff suppressed because one or more lines are too long
+2
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
import{B as v,D as P,G as S,a as e,c as y,f as i,g as a,i as f,t as b,v as n,y as j,z as d}from"./chunk-JIN56HTB.mjs";import{a as m}from"./chunk-VELTKBKT.mjs";var C=b(Object.keys,Object),T=C;var V=Object.prototype,D=V.hasOwnProperty;function K(r){if(!n(r))return T(r);var t=[];for(var o in Object(r))D.call(r,o)&&o!="constructor"&&t.push(o);return t}m(K,"baseKeys");var O=K;var N=a(e,"DataView"),s=N;var W=a(e,"Promise"),c=W;var B=a(e,"Set"),g=B;var z=a(e,"WeakMap"),u=z;var M="[object Map]",E="[object Object]",h="[object Promise]",x="[object Set]",k="[object WeakMap]",l="[object DataView]",G=i(s),L=i(f),q=i(c),F=i(g),H=i(u),p=y;(s&&p(new s(new ArrayBuffer(1)))!=l||f&&p(new f)!=M||c&&p(c.resolve())!=h||g&&p(new g)!=x||u&&p(new u)!=k)&&(p=m(function(r){var t=y(r),o=t==E?r.constructor:void 0,w=o?i(o):"";if(w)switch(w){case G:return l;case L:return M;case q:return h;case F:return x;case H:return k}return t},"getTag"));var A=p;var I="[object Map]",J="[object Set]",Q=Object.prototype,R=Q.hasOwnProperty;function U(r){if(r==null)return!0;if(v(r)&&(d(r)||typeof r=="string"||typeof r.splice=="function"||P(r)||S(r)||j(r)))return!r.length;var t=A(r);if(t==I||t==J)return!r.size;if(n(r))return!O(r).length;for(var o in r)if(R.call(r,o))return!1;return!0}m(U,"isEmpty");var Cr=U;export{O as a,g as b,A as c,Cr as d};
|
||||
+7
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
import{a as i}from"./chunk-VELTKBKT.mjs";var s=class{constructor(t){this.init=t;this.records=this.init()}static{i(this,"ImperativeState")}reset(){this.records=this.init()}};export{s as a};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../src/diagrams/common/svgDrawCommon.ts"],
|
||||
"sourcesContent": ["import { sanitizeUrl } from '@braintree/sanitize-url';\nimport { select } from 'd3';\nimport type { SVG, SVGGroup } from '../../diagram-api/types.js';\nimport { lineBreakRegex } from './common.js';\nimport type {\n Bound,\n D3ImageElement,\n D3RectElement,\n D3TSpanElement,\n D3TextElement,\n D3UseElement,\n RectData,\n TextData,\n TextObject,\n} from './commonTypes.js';\n\nexport const drawRect = (element: SVG | SVGGroup, rectData: RectData): D3RectElement => {\n const rectElement: D3RectElement = element.append('rect');\n rectElement.attr('x', rectData.x);\n rectElement.attr('y', rectData.y);\n rectElement.attr('fill', rectData.fill);\n rectElement.attr('stroke', rectData.stroke);\n rectElement.attr('width', rectData.width);\n rectElement.attr('height', rectData.height);\n if (rectData.name) {\n rectElement.attr('name', rectData.name);\n }\n if (rectData.rx) {\n rectElement.attr('rx', rectData.rx);\n }\n if (rectData.ry) {\n rectElement.attr('ry', rectData.ry);\n }\n\n if (rectData.attrs !== undefined) {\n for (const attrKey in rectData.attrs) {\n rectElement.attr(attrKey, rectData.attrs[attrKey]);\n }\n }\n\n if (rectData.class) {\n rectElement.attr('class', rectData.class);\n }\n\n return rectElement;\n};\n\n/**\n * Draws a background rectangle\n *\n * @param element - Diagram (reference for bounds)\n * @param bounds - Shape of the rectangle\n */\nexport const drawBackgroundRect = (element: SVG | SVGGroup, bounds: Bound): void => {\n const rectData: RectData = {\n x: bounds.startx,\n y: bounds.starty,\n width: bounds.stopx - bounds.startx,\n height: bounds.stopy - bounds.starty,\n fill: bounds.fill,\n stroke: bounds.stroke,\n class: 'rect',\n };\n const rectElement: D3RectElement = drawRect(element, rectData);\n rectElement.lower();\n};\n\nexport const drawText = (element: SVG | SVGGroup, textData: TextData): D3TextElement => {\n const nText: string = textData.text.replace(lineBreakRegex, ' ');\n\n const textElem: D3TextElement = element.append('text');\n textElem.attr('x', textData.x);\n textElem.attr('y', textData.y);\n textElem.attr('class', 'legend');\n\n textElem.style('text-anchor', textData.anchor);\n if (textData.class) {\n textElem.attr('class', textData.class);\n }\n\n const tspan: D3TSpanElement = textElem.append('tspan');\n tspan.attr('x', textData.x + textData.textMargin * 2);\n tspan.text(nText);\n\n return textElem;\n};\n\nexport const drawImage = (elem: SVG | SVGGroup, x: number, y: number, link: string): void => {\n const imageElement: D3ImageElement = elem.append('image');\n imageElement.attr('x', x);\n imageElement.attr('y', y);\n const sanitizedLink: string = sanitizeUrl(link);\n imageElement.attr('xlink:href', sanitizedLink);\n};\n\nexport const drawEmbeddedImage = (\n element: SVG | SVGGroup,\n x: number,\n y: number,\n link: string\n): void => {\n const imageElement: D3UseElement = element.append('use');\n imageElement.attr('x', x);\n imageElement.attr('y', y);\n const sanitizedLink: string = sanitizeUrl(link);\n imageElement.attr('xlink:href', `#${sanitizedLink}`);\n};\n\nexport const getNoteRect = (): RectData => {\n const noteRectData: RectData = {\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n fill: '#EDF2AE',\n stroke: '#666',\n anchor: 'start',\n rx: 0,\n ry: 0,\n };\n return noteRectData;\n};\n\nexport const getTextObj = (): TextObject => {\n const testObject: TextObject = {\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n 'text-anchor': 'start',\n style: '#666',\n textMargin: 0,\n rx: 0,\n ry: 0,\n tspan: true,\n };\n return testObject;\n};\n\nexport const createTooltip = () => {\n let tooltipElem = select<HTMLDivElement, unknown>('.mermaidTooltip');\n if (tooltipElem.empty()) {\n tooltipElem = select('body')\n .append('div')\n .attr('class', 'mermaidTooltip')\n .style('opacity', 0)\n .style('position', 'absolute')\n .style('text-align', 'center')\n .style('max-width', '200px')\n .style('padding', '2px')\n .style('font-size', '12px')\n .style('background', '#ffffde')\n .style('border', '1px solid #333')\n .style('border-radius', '2px')\n .style('pointer-events', 'none')\n .style('z-index', '100');\n }\n return tooltipElem;\n};\n"],
|
||||
"mappings": "2KAAA,IAAAA,EAA4B,SAgBrB,IAAMC,EAAWC,EAAA,CAACC,EAAyBC,IAAsC,CACtF,IAAMC,EAA6BF,EAAQ,OAAO,MAAM,EAiBxD,GAhBAE,EAAY,KAAK,IAAKD,EAAS,CAAC,EAChCC,EAAY,KAAK,IAAKD,EAAS,CAAC,EAChCC,EAAY,KAAK,OAAQD,EAAS,IAAI,EACtCC,EAAY,KAAK,SAAUD,EAAS,MAAM,EAC1CC,EAAY,KAAK,QAASD,EAAS,KAAK,EACxCC,EAAY,KAAK,SAAUD,EAAS,MAAM,EACtCA,EAAS,MACXC,EAAY,KAAK,OAAQD,EAAS,IAAI,EAEpCA,EAAS,IACXC,EAAY,KAAK,KAAMD,EAAS,EAAE,EAEhCA,EAAS,IACXC,EAAY,KAAK,KAAMD,EAAS,EAAE,EAGhCA,EAAS,QAAU,OACrB,QAAWE,KAAWF,EAAS,MAC7BC,EAAY,KAAKC,EAASF,EAAS,MAAME,CAAO,CAAC,EAIrD,OAAIF,EAAS,OACXC,EAAY,KAAK,QAASD,EAAS,KAAK,EAGnCC,CACT,EA7BwB,YAqCXE,EAAqBL,EAAA,CAACC,EAAyBK,IAAwB,CAClF,IAAMJ,EAAqB,CACzB,EAAGI,EAAO,OACV,EAAGA,EAAO,OACV,MAAOA,EAAO,MAAQA,EAAO,OAC7B,OAAQA,EAAO,MAAQA,EAAO,OAC9B,KAAMA,EAAO,KACb,OAAQA,EAAO,OACf,MAAO,MACT,EACmCP,EAASE,EAASC,CAAQ,EACjD,MAAM,CACpB,EAZkC,sBAcrBK,EAAWP,EAAA,CAACC,EAAyBO,IAAsC,CACtF,IAAMC,EAAgBD,EAAS,KAAK,QAAQE,EAAgB,GAAG,EAEzDC,EAA0BV,EAAQ,OAAO,MAAM,EACrDU,EAAS,KAAK,IAAKH,EAAS,CAAC,EAC7BG,EAAS,KAAK,IAAKH,EAAS,CAAC,EAC7BG,EAAS,KAAK,QAAS,QAAQ,EAE/BA,EAAS,MAAM,cAAeH,EAAS,MAAM,EACzCA,EAAS,OACXG,EAAS,KAAK,QAASH,EAAS,KAAK,EAGvC,IAAMI,EAAwBD,EAAS,OAAO,OAAO,EACrD,OAAAC,EAAM,KAAK,IAAKJ,EAAS,EAAIA,EAAS,WAAa,CAAC,EACpDI,EAAM,KAAKH,CAAK,EAETE,CACT,EAlBwB,YAoBXE,EAAYb,EAAA,CAACc,EAAsBC,EAAWC,EAAWC,IAAuB,CAC3F,IAAMC,EAA+BJ,EAAK,OAAO,OAAO,EACxDI,EAAa,KAAK,IAAKH,CAAC,EACxBG,EAAa,KAAK,IAAKF,CAAC,EACxB,IAAMG,KAAwB,eAAYF,CAAI,EAC9CC,EAAa,KAAK,aAAcC,CAAa,CAC/C,EANyB,aAQZC,EAAoBpB,EAAA,CAC/BC,EACAc,EACAC,EACAC,IACS,CACT,IAAMC,EAA6BjB,EAAQ,OAAO,KAAK,EACvDiB,EAAa,KAAK,IAAKH,CAAC,EACxBG,EAAa,KAAK,IAAKF,CAAC,EACxB,IAAMG,KAAwB,eAAYF,CAAI,EAC9CC,EAAa,KAAK,aAAc,IAAIC,CAAa,EAAE,CACrD,EAXiC,qBAapBE,EAAcrB,EAAA,KACM,CAC7B,EAAG,EACH,EAAG,EACH,MAAO,IACP,OAAQ,IACR,KAAM,UACN,OAAQ,OACR,OAAQ,QACR,GAAI,EACJ,GAAI,CACN,GAXyB,eAedsB,EAAatB,EAAA,KACO,CAC7B,EAAG,EACH,EAAG,EACH,MAAO,IACP,OAAQ,IACR,cAAe,QACf,MAAO,OACP,WAAY,EACZ,GAAI,EACJ,GAAI,EACJ,MAAO,EACT,GAZwB,cAgBbuB,EAAgBvB,EAAA,IAAM,CACjC,IAAIwB,EAAcC,EAAgC,iBAAiB,EACnE,OAAID,EAAY,MAAM,IACpBA,EAAcC,EAAO,MAAM,EACxB,OAAO,KAAK,EACZ,KAAK,QAAS,gBAAgB,EAC9B,MAAM,UAAW,CAAC,EAClB,MAAM,WAAY,UAAU,EAC5B,MAAM,aAAc,QAAQ,EAC5B,MAAM,YAAa,OAAO,EAC1B,MAAM,UAAW,KAAK,EACtB,MAAM,YAAa,MAAM,EACzB,MAAM,aAAc,SAAS,EAC7B,MAAM,SAAU,gBAAgB,EAChC,MAAM,gBAAiB,KAAK,EAC5B,MAAM,iBAAkB,MAAM,EAC9B,MAAM,UAAW,KAAK,GAEpBD,CACT,EAnB6B",
|
||||
"names": ["import_sanitize_url", "drawRect", "__name", "element", "rectData", "rectElement", "attrKey", "drawBackgroundRect", "bounds", "drawText", "textData", "nText", "lineBreakRegex", "textElem", "tspan", "drawImage", "elem", "x", "y", "link", "imageElement", "sanitizedLink", "drawEmbeddedImage", "getNoteRect", "getTextObj", "createTooltip", "tooltipElem", "select_default"]
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../parser/dist/chunks/mermaid-parser.core/chunk-OZEHJAEY.mjs"],
|
||||
"sourcesContent": ["import {\n AbstractMermaidTokenBuilder,\n AbstractMermaidValueConverter,\n MermaidGeneratedSharedModule,\n TreemapGrammarGeneratedModule,\n __name\n} from \"./chunk-XZSTWKYB.mjs\";\n\n// src/language/treemap/module.ts\nimport {\n EmptyFileSystem,\n createDefaultCoreModule,\n createDefaultSharedCoreModule,\n inject\n} from \"langium\";\n\n// src/language/treemap/tokenBuilder.ts\nvar TreemapTokenBuilder = class extends AbstractMermaidTokenBuilder {\n static {\n __name(this, \"TreemapTokenBuilder\");\n }\n constructor() {\n super([\"treemap\"]);\n }\n};\n\n// src/language/treemap/valueConverter.ts\nvar classDefRegex = /classDef\\s+([A-Z_a-z]\\w+)(?:\\s+([^\\n\\r;]*))?;?/;\nvar TreemapValueConverter = class extends AbstractMermaidValueConverter {\n static {\n __name(this, \"TreemapValueConverter\");\n }\n runCustomConverter(rule, input, _cstNode) {\n if (rule.name === \"NUMBER2\") {\n return parseFloat(input.replace(/,/g, \"\"));\n } else if (rule.name === \"SEPARATOR\") {\n return input.substring(1, input.length - 1);\n } else if (rule.name === \"STRING2\") {\n return input.substring(1, input.length - 1);\n } else if (rule.name === \"INDENTATION\") {\n return input.length;\n } else if (rule.name === \"ClassDef\") {\n if (typeof input !== \"string\") {\n return input;\n }\n const match = classDefRegex.exec(input);\n if (match) {\n return {\n $type: \"ClassDefStatement\",\n className: match[1],\n styleText: match[2] || void 0\n };\n }\n }\n return void 0;\n }\n};\n\n// src/language/treemap/treemap-validator.ts\nfunction registerValidationChecks(services) {\n const validator = services.validation.TreemapValidator;\n const registry = services.validation.ValidationRegistry;\n if (registry) {\n const checks = {\n Treemap: validator.checkSingleRoot.bind(validator)\n // Remove unused validation for TreemapRow\n };\n registry.register(checks, validator);\n }\n}\n__name(registerValidationChecks, \"registerValidationChecks\");\nvar TreemapValidator = class {\n static {\n __name(this, \"TreemapValidator\");\n }\n /**\n * Validates that a treemap has only one root node.\n * A root node is defined as a node that has no indentation.\n */\n checkSingleRoot(doc, accept) {\n let rootNodeIndentation;\n for (const row of doc.TreemapRows) {\n if (!row.item) {\n continue;\n }\n if (rootNodeIndentation === void 0 && // Check if this is a root node (no indentation)\n row.indent === void 0) {\n rootNodeIndentation = 0;\n } else if (row.indent === void 0) {\n accept(\"error\", \"Multiple root nodes are not allowed in a treemap.\", {\n node: row,\n property: \"item\"\n });\n } else if (rootNodeIndentation !== void 0 && rootNodeIndentation >= parseInt(row.indent, 10)) {\n accept(\"error\", \"Multiple root nodes are not allowed in a treemap.\", {\n node: row,\n property: \"item\"\n });\n }\n }\n }\n};\n\n// src/language/treemap/module.ts\nvar TreemapModule = {\n parser: {\n TokenBuilder: /* @__PURE__ */ __name(() => new TreemapTokenBuilder(), \"TokenBuilder\"),\n ValueConverter: /* @__PURE__ */ __name(() => new TreemapValueConverter(), \"ValueConverter\")\n },\n validation: {\n TreemapValidator: /* @__PURE__ */ __name(() => new TreemapValidator(), \"TreemapValidator\")\n }\n};\nfunction createTreemapServices(context = EmptyFileSystem) {\n const shared = inject(\n createDefaultSharedCoreModule(context),\n MermaidGeneratedSharedModule\n );\n const Treemap = inject(\n createDefaultCoreModule({ shared }),\n TreemapGrammarGeneratedModule,\n TreemapModule\n );\n shared.ServiceRegistry.register(Treemap);\n registerValidationChecks(Treemap);\n return { shared, Treemap };\n}\n__name(createTreemapServices, \"createTreemapServices\");\n\nexport {\n TreemapModule,\n createTreemapServices\n};\n"],
|
||||
"mappings": "4IAiBA,IAAIA,EAAsB,cAAcC,CAA4B,CAjBpE,MAiBoE,CAAAC,EAAA,4BAClE,MAAO,CACLA,EAAO,KAAM,qBAAqB,CACpC,CACA,aAAc,CACZ,MAAM,CAAC,SAAS,CAAC,CACnB,CACF,EAGIC,EAAgB,iDAChBC,EAAwB,cAAcC,CAA8B,CA5BxE,MA4BwE,CAAAH,EAAA,8BACtE,MAAO,CACLA,EAAO,KAAM,uBAAuB,CACtC,CACA,mBAAmBI,EAAMC,EAAOC,EAAU,CACxC,GAAIF,EAAK,OAAS,UAChB,OAAO,WAAWC,EAAM,QAAQ,KAAM,EAAE,CAAC,EACpC,GAAID,EAAK,OAAS,YACvB,OAAOC,EAAM,UAAU,EAAGA,EAAM,OAAS,CAAC,EACrC,GAAID,EAAK,OAAS,UACvB,OAAOC,EAAM,UAAU,EAAGA,EAAM,OAAS,CAAC,EACrC,GAAID,EAAK,OAAS,cACvB,OAAOC,EAAM,OACR,GAAID,EAAK,OAAS,WAAY,CACnC,GAAI,OAAOC,GAAU,SACnB,OAAOA,EAET,IAAME,EAAQN,EAAc,KAAKI,CAAK,EACtC,GAAIE,EACF,MAAO,CACL,MAAO,oBACP,UAAWA,EAAM,CAAC,EAClB,UAAWA,EAAM,CAAC,GAAK,MACzB,CAEJ,CAEF,CACF,EAGA,SAASC,EAAyBC,EAAU,CAC1C,IAAMC,EAAYD,EAAS,WAAW,iBAChCE,EAAWF,EAAS,WAAW,mBACrC,GAAIE,EAAU,CACZ,IAAMC,EAAS,CACb,QAASF,EAAU,gBAAgB,KAAKA,CAAS,CAEnD,EACAC,EAAS,SAASC,EAAQF,CAAS,CACrC,CACF,CAVSV,EAAAQ,EAAA,4BAWTR,EAAOQ,EAA0B,0BAA0B,EAC3D,IAAIK,EAAmB,KAAM,CAvE7B,MAuE6B,CAAAb,EAAA,yBAC3B,MAAO,CACLA,EAAO,KAAM,kBAAkB,CACjC,CAKA,gBAAgBc,EAAKC,EAAQ,CAC3B,IAAIC,EACJ,QAAWC,KAAOH,EAAI,YACfG,EAAI,OAGLD,IAAwB,QAC5BC,EAAI,SAAW,OACbD,EAAsB,EACbC,EAAI,SAAW,OACxBF,EAAO,QAAS,oDAAqD,CACnE,KAAME,EACN,SAAU,MACZ,CAAC,EACQD,IAAwB,QAAUA,GAAuB,SAASC,EAAI,OAAQ,EAAE,GACzFF,EAAO,QAAS,oDAAqD,CACnE,KAAME,EACN,SAAU,MACZ,CAAC,EAGP,CACF,EAGIC,EAAgB,CAClB,OAAQ,CACN,aAA8BlB,EAAO,IAAM,IAAIF,EAAuB,cAAc,EACpF,eAAgCE,EAAO,IAAM,IAAIE,EAAyB,gBAAgB,CAC5F,EACA,WAAY,CACV,iBAAkCF,EAAO,IAAM,IAAIa,EAAoB,kBAAkB,CAC3F,CACF,EACA,SAASM,EAAsBC,EAAUC,EAAiB,CACxD,IAAMC,EAASC,EACbC,EAA8BJ,CAAO,EACrCK,CACF,EACMC,EAAUH,EACdI,EAAwB,CAAE,OAAAL,CAAO,CAAC,EAClCM,EACAV,CACF,EACA,OAAAI,EAAO,gBAAgB,SAASI,CAAO,EACvClB,EAAyBkB,CAAO,EACzB,CAAE,OAAAJ,EAAQ,QAAAI,CAAQ,CAC3B,CAbS1B,EAAAmB,EAAA,yBAcTnB,EAAOmB,EAAuB,uBAAuB",
|
||||
"names": ["TreemapTokenBuilder", "AbstractMermaidTokenBuilder", "__name", "classDefRegex", "TreemapValueConverter", "AbstractMermaidValueConverter", "rule", "input", "_cstNode", "match", "registerValidationChecks", "services", "validator", "registry", "checks", "TreemapValidator", "doc", "accept", "rootNodeIndentation", "row", "TreemapModule", "createTreemapServices", "context", "EmptyFileSystem", "shared", "inject", "createDefaultSharedCoreModule", "MermaidGeneratedSharedModule", "Treemap", "createDefaultCoreModule", "TreemapGrammarGeneratedModule"]
|
||||
}
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
import{a,b as o,c as e,d as t}from"./chunk-TFLKLN34.mjs";import"./chunk-KSICW3F5.mjs";import"./chunk-W2A4CRWB.mjs";import"./chunk-TBF5ZNIQ.mjs";import"./chunk-T4EQAHMB.mjs";import"./chunk-SK62O5VA.mjs";import"./chunk-5YHUCXBM.mjs";import"./chunk-3ZBQQEZ6.mjs";import"./chunk-BDKIFH7H.mjs";import"./chunk-XODN6PIJ.mjs";import"./chunk-IWDTEBJL.mjs";import"./chunk-D2KP3OBD.mjs";import"./chunk-YLHEXJF3.mjs";import"./chunk-Q3CC2MQB.mjs";import"./chunk-XBXGYYE5.mjs";import"./chunk-3UWU4A3N.mjs";import"./chunk-MGPAVIPZ.mjs";import"./chunk-JIN56HTB.mjs";import{a as i}from"./chunk-VELTKBKT.mjs";var n={parser:a,get db(){return new o},renderer:t,styles:e,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
|
||||
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
+4
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
import{a as r,b as e}from"./chunk-NHJX6F6M.mjs";import"./chunk-GAX3EE6F.mjs";import"./chunk-H3VCZNTA.mjs";import"./chunk-QU3B7NT4.mjs";import"./chunk-JIN56HTB.mjs";import"./chunk-VELTKBKT.mjs";export{r as GitGraphModule,e as createGitGraphServices};
|
||||
Generated
Vendored
+73
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
import{a as e,b as i,c as a,d as o}from"./chunk-33NP3AWU.mjs";import"./chunk-TBF5ZNIQ.mjs";import"./chunk-T4EQAHMB.mjs";import"./chunk-SK62O5VA.mjs";import"./chunk-5YHUCXBM.mjs";import"./chunk-3ZBQQEZ6.mjs";import"./chunk-BDKIFH7H.mjs";import"./chunk-XODN6PIJ.mjs";import"./chunk-IWDTEBJL.mjs";import"./chunk-D2KP3OBD.mjs";import"./chunk-YLHEXJF3.mjs";import"./chunk-Q3CC2MQB.mjs";import"./chunk-XBXGYYE5.mjs";import"./chunk-3UWU4A3N.mjs";import"./chunk-MGPAVIPZ.mjs";import"./chunk-JIN56HTB.mjs";import{a as t}from"./chunk-VELTKBKT.mjs";var f={parser:e,get db(){return new a(2)},renderer:i,styles:o,init:t(r=>{r.state||(r.state={}),r.state.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram};
|
||||
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+8938
File diff suppressed because it is too large
Load Diff
+3807
File diff suppressed because it is too large
Load Diff
+7
File diff suppressed because one or more lines are too long
+2016
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../parser/dist/chunks/mermaid-parser.core/chunk-EGIJ26TM.mjs"],
|
||||
"sourcesContent": ["import {\n AbstractMermaidTokenBuilder,\n CommonValueConverter,\n InfoGrammarGeneratedModule,\n MermaidGeneratedSharedModule,\n __name\n} from \"./chunk-XZSTWKYB.mjs\";\n\n// src/language/info/module.ts\nimport {\n EmptyFileSystem,\n createDefaultCoreModule,\n createDefaultSharedCoreModule,\n inject\n} from \"langium\";\n\n// src/language/info/tokenBuilder.ts\nvar InfoTokenBuilder = class extends AbstractMermaidTokenBuilder {\n static {\n __name(this, \"InfoTokenBuilder\");\n }\n constructor() {\n super([\"info\", \"showInfo\"]);\n }\n};\n\n// src/language/info/module.ts\nvar InfoModule = {\n parser: {\n TokenBuilder: /* @__PURE__ */ __name(() => new InfoTokenBuilder(), \"TokenBuilder\"),\n ValueConverter: /* @__PURE__ */ __name(() => new CommonValueConverter(), \"ValueConverter\")\n }\n};\nfunction createInfoServices(context = EmptyFileSystem) {\n const shared = inject(\n createDefaultSharedCoreModule(context),\n MermaidGeneratedSharedModule\n );\n const Info = inject(\n createDefaultCoreModule({ shared }),\n InfoGrammarGeneratedModule,\n InfoModule\n );\n shared.ServiceRegistry.register(Info);\n return { shared, Info };\n}\n__name(createInfoServices, \"createInfoServices\");\n\nexport {\n InfoModule,\n createInfoServices\n};\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;AAiBA,IAAI,mBAAmB,cAAc,4BAA4B;AAAA,EAjBjE,OAiBiE;AAAA;AAAA;AAAA,EAC/D,OAAO;AACL,IAAAA,QAAO,MAAM,kBAAkB;AAAA,EACjC;AAAA,EACA,cAAc;AACZ,UAAM,CAAC,QAAQ,UAAU,CAAC;AAAA,EAC5B;AACF;AAGA,IAAI,aAAa;AAAA,EACf,QAAQ;AAAA,IACN,cAA8B,gBAAAA,QAAO,MAAM,IAAI,iBAAiB,GAAG,cAAc;AAAA,IACjF,gBAAgC,gBAAAA,QAAO,MAAM,IAAI,qBAAqB,GAAG,gBAAgB;AAAA,EAC3F;AACF;AACA,SAAS,mBAAmB,UAAU,iBAAiB;AACrD,QAAM,SAAS;AAAA,IACb,8BAA8B,OAAO;AAAA,IACrC;AAAA,EACF;AACA,QAAM,OAAO;AAAA,IACX,wBAAwB,EAAE,OAAO,CAAC;AAAA,IAClC;AAAA,IACA;AAAA,EACF;AACA,SAAO,gBAAgB,SAAS,IAAI;AACpC,SAAO,EAAE,QAAQ,KAAK;AACxB;AAZS;AAaTA,QAAO,oBAAoB,oBAAoB;",
|
||||
"names": ["__name"]
|
||||
}
|
||||
+2716
File diff suppressed because it is too large
Load Diff
+7
File diff suppressed because one or more lines are too long
+68
@@ -0,0 +1,68 @@
|
||||
import {
|
||||
parseFontSize
|
||||
} from "./chunk-XCSQNVCT.mjs";
|
||||
import {
|
||||
defaultConfig_default,
|
||||
getConfig2 as getConfig
|
||||
} from "./chunk-UKMXQNCB.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-FQFHLQFH.mjs";
|
||||
|
||||
// src/utils/subGraphTitleMargins.ts
|
||||
var getSubGraphTitleMargins = /* @__PURE__ */ __name(({
|
||||
flowchart
|
||||
}) => {
|
||||
const subGraphTitleTopMargin = flowchart?.subGraphTitleMargin?.top ?? 0;
|
||||
const subGraphTitleBottomMargin = flowchart?.subGraphTitleMargin?.bottom ?? 0;
|
||||
const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;
|
||||
return {
|
||||
subGraphTitleTopMargin,
|
||||
subGraphTitleBottomMargin,
|
||||
subGraphTitleTotalMargin
|
||||
};
|
||||
}, "getSubGraphTitleMargins");
|
||||
|
||||
// src/rendering-util/rendering-elements/shapes/labelImageUtils.ts
|
||||
async function configureLabelImages(container, labelText) {
|
||||
const images = container.getElementsByTagName("img");
|
||||
if (!images || images.length === 0) {
|
||||
return;
|
||||
}
|
||||
const noImgText = labelText.replace(/<img[^>]*>/g, "").trim() === "";
|
||||
await Promise.all(
|
||||
[...images].map(
|
||||
(img) => new Promise((res) => {
|
||||
function setupImage() {
|
||||
img.style.display = "flex";
|
||||
img.style.flexDirection = "column";
|
||||
if (noImgText) {
|
||||
const bodyFontSize = getConfig().fontSize ? getConfig().fontSize : window.getComputedStyle(document.body).fontSize;
|
||||
const enlargingFactor = 5;
|
||||
const [parsedBodyFontSize = defaultConfig_default.fontSize] = parseFontSize(bodyFontSize);
|
||||
const width = parsedBodyFontSize * enlargingFactor + "px";
|
||||
img.style.minWidth = width;
|
||||
img.style.maxWidth = width;
|
||||
} else {
|
||||
img.style.width = "100%";
|
||||
}
|
||||
res(img);
|
||||
}
|
||||
__name(setupImage, "setupImage");
|
||||
setTimeout(() => {
|
||||
if (img.complete) {
|
||||
setupImage();
|
||||
}
|
||||
});
|
||||
img.addEventListener("error", setupImage);
|
||||
img.addEventListener("load", setupImage);
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
__name(configureLabelImages, "configureLabelImages");
|
||||
|
||||
export {
|
||||
configureLabelImages,
|
||||
getSubGraphTitleMargins
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../../parser/dist/chunks/mermaid-parser.core/chunk-L3YUKLVL.mjs"],
|
||||
"sourcesContent": ["import {\n AbstractMermaidTokenBuilder,\n CommonValueConverter,\n MermaidGeneratedSharedModule,\n RadarGrammarGeneratedModule,\n __name\n} from \"./chunk-XZSTWKYB.mjs\";\n\n// src/language/radar/module.ts\nimport {\n EmptyFileSystem,\n createDefaultCoreModule,\n createDefaultSharedCoreModule,\n inject\n} from \"langium\";\n\n// src/language/radar/tokenBuilder.ts\nvar RadarTokenBuilder = class extends AbstractMermaidTokenBuilder {\n static {\n __name(this, \"RadarTokenBuilder\");\n }\n constructor() {\n super([\"radar-beta\"]);\n }\n};\n\n// src/language/radar/module.ts\nvar RadarModule = {\n parser: {\n TokenBuilder: /* @__PURE__ */ __name(() => new RadarTokenBuilder(), \"TokenBuilder\"),\n ValueConverter: /* @__PURE__ */ __name(() => new CommonValueConverter(), \"ValueConverter\")\n }\n};\nfunction createRadarServices(context = EmptyFileSystem) {\n const shared = inject(\n createDefaultSharedCoreModule(context),\n MermaidGeneratedSharedModule\n );\n const Radar = inject(\n createDefaultCoreModule({ shared }),\n RadarGrammarGeneratedModule,\n RadarModule\n );\n shared.ServiceRegistry.register(Radar);\n return { shared, Radar };\n}\n__name(createRadarServices, \"createRadarServices\");\n\nexport {\n RadarModule,\n createRadarServices\n};\n"],
|
||||
"mappings": ";;;;;;;;;;;;;;;;;AAiBA,IAAI,oBAAoB,cAAc,4BAA4B;AAAA,EAjBlE,OAiBkE;AAAA;AAAA;AAAA,EAChE,OAAO;AACL,IAAAA,QAAO,MAAM,mBAAmB;AAAA,EAClC;AAAA,EACA,cAAc;AACZ,UAAM,CAAC,YAAY,CAAC;AAAA,EACtB;AACF;AAGA,IAAI,cAAc;AAAA,EAChB,QAAQ;AAAA,IACN,cAA8B,gBAAAA,QAAO,MAAM,IAAI,kBAAkB,GAAG,cAAc;AAAA,IAClF,gBAAgC,gBAAAA,QAAO,MAAM,IAAI,qBAAqB,GAAG,gBAAgB;AAAA,EAC3F;AACF;AACA,SAAS,oBAAoB,UAAU,iBAAiB;AACtD,QAAM,SAAS;AAAA,IACb,8BAA8B,OAAO;AAAA,IACrC;AAAA,EACF;AACA,QAAM,QAAQ;AAAA,IACZ,wBAAwB,EAAE,OAAO,CAAC;AAAA,IAClC;AAAA,IACA;AAAA,EACF;AACA,SAAO,gBAAgB,SAAS,KAAK;AACrC,SAAO,EAAE,QAAQ,MAAM;AACzB;AAZS;AAaTA,QAAO,qBAAqB,qBAAqB;",
|
||||
"names": ["__name"]
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
import {
|
||||
AbstractMermaidTokenBuilder,
|
||||
CommonValueConverter,
|
||||
EmptyFileSystem,
|
||||
GitGraphGrammarGeneratedModule,
|
||||
MermaidGeneratedSharedModule,
|
||||
__name as __name2,
|
||||
createDefaultCoreModule,
|
||||
createDefaultSharedCoreModule,
|
||||
inject,
|
||||
lib_exports
|
||||
} from "./chunk-S3MDV2AR.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-FQFHLQFH.mjs";
|
||||
|
||||
// ../parser/dist/chunks/mermaid-parser.core/chunk-7E7YKBS2.mjs
|
||||
var GitGraphTokenBuilder = class extends AbstractMermaidTokenBuilder {
|
||||
static {
|
||||
__name(this, "GitGraphTokenBuilder");
|
||||
}
|
||||
static {
|
||||
__name2(this, "GitGraphTokenBuilder");
|
||||
}
|
||||
constructor() {
|
||||
super(["gitGraph"]);
|
||||
}
|
||||
};
|
||||
var GitGraphModule = {
|
||||
parser: {
|
||||
TokenBuilder: /* @__PURE__ */ __name2(() => new GitGraphTokenBuilder(), "TokenBuilder"),
|
||||
ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter")
|
||||
}
|
||||
};
|
||||
function createGitGraphServices(context = EmptyFileSystem) {
|
||||
const shared = inject(
|
||||
createDefaultSharedCoreModule(context),
|
||||
MermaidGeneratedSharedModule
|
||||
);
|
||||
const GitGraph = inject(
|
||||
createDefaultCoreModule({ shared }),
|
||||
GitGraphGrammarGeneratedModule,
|
||||
GitGraphModule
|
||||
);
|
||||
shared.ServiceRegistry.register(GitGraph);
|
||||
return { shared, GitGraph };
|
||||
}
|
||||
__name(createGitGraphServices, "createGitGraphServices");
|
||||
__name2(createGitGraphServices, "createGitGraphServices");
|
||||
|
||||
export {
|
||||
GitGraphModule,
|
||||
createGitGraphServices
|
||||
};
|
||||
+25684
File diff suppressed because one or more lines are too long
+132
@@ -0,0 +1,132 @@
|
||||
import {
|
||||
require_dist
|
||||
} from "./chunk-3OTVAOVH.mjs";
|
||||
import {
|
||||
lineBreakRegex
|
||||
} from "./chunk-UKMXQNCB.mjs";
|
||||
import {
|
||||
select_default
|
||||
} from "./chunk-GRVEB7DL.mjs";
|
||||
import {
|
||||
__name,
|
||||
__toESM
|
||||
} from "./chunk-FQFHLQFH.mjs";
|
||||
|
||||
// src/diagrams/common/svgDrawCommon.ts
|
||||
var import_sanitize_url = __toESM(require_dist(), 1);
|
||||
var drawRect = /* @__PURE__ */ __name((element, rectData) => {
|
||||
const rectElement = element.append("rect");
|
||||
rectElement.attr("x", rectData.x);
|
||||
rectElement.attr("y", rectData.y);
|
||||
rectElement.attr("fill", rectData.fill);
|
||||
rectElement.attr("stroke", rectData.stroke);
|
||||
rectElement.attr("width", rectData.width);
|
||||
rectElement.attr("height", rectData.height);
|
||||
if (rectData.name) {
|
||||
rectElement.attr("name", rectData.name);
|
||||
}
|
||||
if (rectData.rx) {
|
||||
rectElement.attr("rx", rectData.rx);
|
||||
}
|
||||
if (rectData.ry) {
|
||||
rectElement.attr("ry", rectData.ry);
|
||||
}
|
||||
if (rectData.attrs !== void 0) {
|
||||
for (const attrKey in rectData.attrs) {
|
||||
rectElement.attr(attrKey, rectData.attrs[attrKey]);
|
||||
}
|
||||
}
|
||||
if (rectData.class) {
|
||||
rectElement.attr("class", rectData.class);
|
||||
}
|
||||
return rectElement;
|
||||
}, "drawRect");
|
||||
var drawBackgroundRect = /* @__PURE__ */ __name((element, bounds) => {
|
||||
const rectData = {
|
||||
x: bounds.startx,
|
||||
y: bounds.starty,
|
||||
width: bounds.stopx - bounds.startx,
|
||||
height: bounds.stopy - bounds.starty,
|
||||
fill: bounds.fill,
|
||||
stroke: bounds.stroke,
|
||||
class: "rect"
|
||||
};
|
||||
const rectElement = drawRect(element, rectData);
|
||||
rectElement.lower();
|
||||
}, "drawBackgroundRect");
|
||||
var drawText = /* @__PURE__ */ __name((element, textData) => {
|
||||
const nText = textData.text.replace(lineBreakRegex, " ");
|
||||
const textElem = element.append("text");
|
||||
textElem.attr("x", textData.x);
|
||||
textElem.attr("y", textData.y);
|
||||
textElem.attr("class", "legend");
|
||||
textElem.style("text-anchor", textData.anchor);
|
||||
if (textData.class) {
|
||||
textElem.attr("class", textData.class);
|
||||
}
|
||||
const tspan = textElem.append("tspan");
|
||||
tspan.attr("x", textData.x + textData.textMargin * 2);
|
||||
tspan.text(nText);
|
||||
return textElem;
|
||||
}, "drawText");
|
||||
var drawImage = /* @__PURE__ */ __name((elem, x, y, link) => {
|
||||
const imageElement = elem.append("image");
|
||||
imageElement.attr("x", x);
|
||||
imageElement.attr("y", y);
|
||||
const sanitizedLink = (0, import_sanitize_url.sanitizeUrl)(link);
|
||||
imageElement.attr("xlink:href", sanitizedLink);
|
||||
}, "drawImage");
|
||||
var drawEmbeddedImage = /* @__PURE__ */ __name((element, x, y, link) => {
|
||||
const imageElement = element.append("use");
|
||||
imageElement.attr("x", x);
|
||||
imageElement.attr("y", y);
|
||||
const sanitizedLink = (0, import_sanitize_url.sanitizeUrl)(link);
|
||||
imageElement.attr("xlink:href", `#${sanitizedLink}`);
|
||||
}, "drawEmbeddedImage");
|
||||
var getNoteRect = /* @__PURE__ */ __name(() => {
|
||||
const noteRectData = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 100,
|
||||
height: 100,
|
||||
fill: "#EDF2AE",
|
||||
stroke: "#666",
|
||||
anchor: "start",
|
||||
rx: 0,
|
||||
ry: 0
|
||||
};
|
||||
return noteRectData;
|
||||
}, "getNoteRect");
|
||||
var getTextObj = /* @__PURE__ */ __name(() => {
|
||||
const testObject = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 100,
|
||||
height: 100,
|
||||
"text-anchor": "start",
|
||||
style: "#666",
|
||||
textMargin: 0,
|
||||
rx: 0,
|
||||
ry: 0,
|
||||
tspan: true
|
||||
};
|
||||
return testObject;
|
||||
}, "getTextObj");
|
||||
var createTooltip = /* @__PURE__ */ __name(() => {
|
||||
let tooltipElem = select_default(".mermaidTooltip");
|
||||
if (tooltipElem.empty()) {
|
||||
tooltipElem = select_default("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0).style("position", "absolute").style("text-align", "center").style("max-width", "200px").style("padding", "2px").style("font-size", "12px").style("background", "#ffffde").style("border", "1px solid #333").style("border-radius", "2px").style("pointer-events", "none").style("z-index", "100");
|
||||
}
|
||||
return tooltipElem;
|
||||
}, "createTooltip");
|
||||
|
||||
export {
|
||||
drawRect,
|
||||
drawBackgroundRect,
|
||||
drawText,
|
||||
drawImage,
|
||||
drawEmbeddedImage,
|
||||
getNoteRect,
|
||||
getTextObj,
|
||||
createTooltip
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../../src/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.ts"],
|
||||
"sourcesContent": ["import { getConfig } from '../../../diagram-api/diagramAPI.js';\nimport type { Node } from '../../types.js';\n\n// Striped fill like start or fork nodes in state diagrams\nexport const solidStateFill = (color: string) => {\n const { handDrawnSeed } = getConfig();\n return {\n fill: color,\n hachureAngle: 120, // angle of hachure,\n hachureGap: 4,\n fillWeight: 2,\n roughness: 0.7,\n stroke: color,\n seed: handDrawnSeed,\n };\n};\n\nexport const compileStyles = (node: Node) => {\n // node.cssCompiledStyles is an array of strings in the form of 'key: value' where key is the css property and value is the value\n // the array is the styles of node from the classes it is using\n // node.cssStyles is an array of styles directly set on the node\n // concat the arrays and remove duplicates such that the values from node.cssStyles are used if there are duplicates\n const stylesMap = styles2Map([\n ...(node.cssCompiledStyles || []),\n ...(node.cssStyles || []),\n ...(node.labelStyle || []),\n ]);\n return { stylesMap, stylesArray: [...stylesMap] };\n};\n\nexport const styles2Map = (styles: string[]) => {\n const styleMap = new Map<string, string>();\n styles.forEach((style) => {\n const [key, value] = style.split(':');\n styleMap.set(key.trim(), value?.trim());\n });\n return styleMap;\n};\nexport const isLabelStyle = (key: string) => {\n return (\n key === 'color' ||\n key === 'font-size' ||\n key === 'font-family' ||\n key === 'font-weight' ||\n key === 'font-style' ||\n key === 'text-decoration' ||\n key === 'text-align' ||\n key === 'text-transform' ||\n key === 'line-height' ||\n key === 'letter-spacing' ||\n key === 'word-spacing' ||\n key === 'text-shadow' ||\n key === 'text-overflow' ||\n key === 'white-space' ||\n key === 'word-wrap' ||\n key === 'word-break' ||\n key === 'overflow-wrap' ||\n key === 'hyphens'\n );\n};\nexport const styles2String = (node: Node) => {\n const { stylesArray } = compileStyles(node);\n const labelStyles: string[] = [];\n const nodeStyles: string[] = [];\n const borderStyles: string[] = [];\n const backgroundStyles: string[] = [];\n\n stylesArray.forEach((style) => {\n const key = style[0];\n if (isLabelStyle(key)) {\n labelStyles.push(style.join(':') + ' !important');\n } else {\n nodeStyles.push(style.join(':') + ' !important');\n if (key.includes('stroke')) {\n borderStyles.push(style.join(':') + ' !important');\n }\n if (key === 'fill') {\n backgroundStyles.push(style.join(':') + ' !important');\n }\n }\n });\n\n return {\n labelStyles: labelStyles.join(';'),\n nodeStyles: nodeStyles.join(';'),\n stylesArray,\n borderStyles,\n backgroundStyles,\n };\n};\n\n// Striped fill like start or fork nodes in state diagrams\n// TODO remove any\nexport const userNodeOverrides = (node: Node, options: any) => {\n const { themeVariables, handDrawnSeed } = getConfig();\n const { nodeBorder, mainBkg } = themeVariables;\n const { stylesMap } = compileStyles(node);\n\n // index the style array to a map object\n const result = Object.assign(\n {\n roughness: 0.7,\n fill: stylesMap.get('fill') || mainBkg,\n fillStyle: 'hachure', // solid fill\n fillWeight: 4,\n hachureGap: 5.2,\n stroke: stylesMap.get('stroke') || nodeBorder,\n seed: handDrawnSeed,\n strokeWidth: stylesMap.get('stroke-width')?.replace('px', '') || 1.3,\n fillLineDash: [0, 0],\n strokeLineDash: getStrokeDashArray(stylesMap.get('stroke-dasharray')),\n },\n options\n );\n return result;\n};\n\nconst getStrokeDashArray = (strokeDasharrayStyle?: string) => {\n if (!strokeDasharrayStyle) {\n return [0, 0];\n }\n const dashArray = strokeDasharrayStyle.trim().split(/\\s+/).map(Number);\n if (dashArray.length === 1) {\n const val = isNaN(dashArray[0]) ? 0 : dashArray[0];\n return [val, val];\n }\n const first = isNaN(dashArray[0]) ? 0 : dashArray[0];\n const second = isNaN(dashArray[1]) ? 0 : dashArray[1];\n return [first, second];\n};\n"],
|
||||
"mappings": ";;;;;;;;AAIO,IAAM,iBAAiB,wBAAC,UAAkB;AAC/C,QAAM,EAAE,cAAc,IAAI,UAAU;AACpC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,cAAc;AAAA;AAAA,IACd,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AACF,GAX8B;AAavB,IAAM,gBAAgB,wBAAC,SAAe;AAK3C,QAAM,YAAY,WAAW;AAAA,IAC3B,GAAI,KAAK,qBAAqB,CAAC;AAAA,IAC/B,GAAI,KAAK,aAAa,CAAC;AAAA,IACvB,GAAI,KAAK,cAAc,CAAC;AAAA,EAC1B,CAAC;AACD,SAAO,EAAE,WAAW,aAAa,CAAC,GAAG,SAAS,EAAE;AAClD,GAX6B;AAatB,IAAM,aAAa,wBAAC,WAAqB;AAC9C,QAAM,WAAW,oBAAI,IAAoB;AACzC,SAAO,QAAQ,CAAC,UAAU;AACxB,UAAM,CAAC,KAAK,KAAK,IAAI,MAAM,MAAM,GAAG;AACpC,aAAS,IAAI,IAAI,KAAK,GAAG,OAAO,KAAK,CAAC;AAAA,EACxC,CAAC;AACD,SAAO;AACT,GAP0B;AAQnB,IAAM,eAAe,wBAAC,QAAgB;AAC3C,SACE,QAAQ,WACR,QAAQ,eACR,QAAQ,iBACR,QAAQ,iBACR,QAAQ,gBACR,QAAQ,qBACR,QAAQ,gBACR,QAAQ,oBACR,QAAQ,iBACR,QAAQ,oBACR,QAAQ,kBACR,QAAQ,iBACR,QAAQ,mBACR,QAAQ,iBACR,QAAQ,eACR,QAAQ,gBACR,QAAQ,mBACR,QAAQ;AAEZ,GArB4B;AAsBrB,IAAM,gBAAgB,wBAAC,SAAe;AAC3C,QAAM,EAAE,YAAY,IAAI,cAAc,IAAI;AAC1C,QAAM,cAAwB,CAAC;AAC/B,QAAM,aAAuB,CAAC;AAC9B,QAAM,eAAyB,CAAC;AAChC,QAAM,mBAA6B,CAAC;AAEpC,cAAY,QAAQ,CAAC,UAAU;AAC7B,UAAM,MAAM,MAAM,CAAC;AACnB,QAAI,aAAa,GAAG,GAAG;AACrB,kBAAY,KAAK,MAAM,KAAK,GAAG,IAAI,aAAa;AAAA,IAClD,OAAO;AACL,iBAAW,KAAK,MAAM,KAAK,GAAG,IAAI,aAAa;AAC/C,UAAI,IAAI,SAAS,QAAQ,GAAG;AAC1B,qBAAa,KAAK,MAAM,KAAK,GAAG,IAAI,aAAa;AAAA,MACnD;AACA,UAAI,QAAQ,QAAQ;AAClB,yBAAiB,KAAK,MAAM,KAAK,GAAG,IAAI,aAAa;AAAA,MACvD;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,aAAa,YAAY,KAAK,GAAG;AAAA,IACjC,YAAY,WAAW,KAAK,GAAG;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GA7B6B;AAiCtB,IAAM,oBAAoB,wBAAC,MAAY,YAAiB;AAC7D,QAAM,EAAE,gBAAgB,cAAc,IAAI,UAAU;AACpD,QAAM,EAAE,YAAY,QAAQ,IAAI;AAChC,QAAM,EAAE,UAAU,IAAI,cAAc,IAAI;AAGxC,QAAM,SAAS,OAAO;AAAA,IACpB;AAAA,MACE,WAAW;AAAA,MACX,MAAM,UAAU,IAAI,MAAM,KAAK;AAAA,MAC/B,WAAW;AAAA;AAAA,MACX,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,QAAQ,UAAU,IAAI,QAAQ,KAAK;AAAA,MACnC,MAAM;AAAA,MACN,aAAa,UAAU,IAAI,cAAc,GAAG,QAAQ,MAAM,EAAE,KAAK;AAAA,MACjE,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB,gBAAgB,mBAAmB,UAAU,IAAI,kBAAkB,CAAC;AAAA,IACtE;AAAA,IACA;AAAA,EACF;AACA,SAAO;AACT,GAtBiC;AAwBjC,IAAM,qBAAqB,wBAAC,yBAAkC;AAC5D,MAAI,CAAC,sBAAsB;AACzB,WAAO,CAAC,GAAG,CAAC;AAAA,EACd;AACA,QAAM,YAAY,qBAAqB,KAAK,EAAE,MAAM,KAAK,EAAE,IAAI,MAAM;AACrE,MAAI,UAAU,WAAW,GAAG;AAC1B,UAAM,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC;AACjD,WAAO,CAAC,KAAK,GAAG;AAAA,EAClB;AACA,QAAM,QAAQ,MAAM,UAAU,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC;AACnD,QAAM,SAAS,MAAM,UAAU,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC;AACpD,SAAO,CAAC,OAAO,MAAM;AACvB,GAZ2B;",
|
||||
"names": []
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
select_default
|
||||
} from "./chunk-GRVEB7DL.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-FQFHLQFH.mjs";
|
||||
|
||||
// src/rendering-util/insertElementsForSize.js
|
||||
var getDiagramElement = /* @__PURE__ */ __name((id, securityLevel) => {
|
||||
let sandboxElement;
|
||||
if (securityLevel === "sandbox") {
|
||||
sandboxElement = select_default("#i" + id);
|
||||
}
|
||||
const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
|
||||
const svg = root.select(`[id="${id}"]`);
|
||||
return svg;
|
||||
}, "getDiagramElement");
|
||||
|
||||
export {
|
||||
getDiagramElement
|
||||
};
|
||||
+4924
File diff suppressed because it is too large
Load Diff
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
import {
|
||||
ClassDB,
|
||||
classDiagram_default,
|
||||
classRenderer_v3_unified_default,
|
||||
styles_default
|
||||
} from "./chunk-2WLNDWH6.mjs";
|
||||
import "./chunk-SXA26SXQ.mjs";
|
||||
import "./chunk-SBHDPRHC.mjs";
|
||||
import "./chunk-U2CUWHSV.mjs";
|
||||
import "./chunk-M4FGLBOT.mjs";
|
||||
import "./chunk-EKL7DDBO.mjs";
|
||||
import "./chunk-TZW2344G.mjs";
|
||||
import "./chunk-UYNZS3GD.mjs";
|
||||
import "./chunk-UAL2TQZE.mjs";
|
||||
import "./chunk-FWQXANIB.mjs";
|
||||
import "./chunk-D2KOLKXV.mjs";
|
||||
import "./chunk-TEV7DDKD.mjs";
|
||||
import "./chunk-YHLHMBDM.mjs";
|
||||
import "./chunk-XCSQNVCT.mjs";
|
||||
import "./chunk-3OTVAOVH.mjs";
|
||||
import "./chunk-UKMXQNCB.mjs";
|
||||
import "./chunk-GRVEB7DL.mjs";
|
||||
import "./chunk-3QJOF6JT.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-FQFHLQFH.mjs";
|
||||
|
||||
// src/diagrams/class/classDiagram-v2.ts
|
||||
var diagram = {
|
||||
parser: classDiagram_default,
|
||||
get db() {
|
||||
return new ClassDB();
|
||||
},
|
||||
renderer: classRenderer_v3_unified_default,
|
||||
styles: styles_default,
|
||||
init: /* @__PURE__ */ __name((cnf) => {
|
||||
if (!cnf.class) {
|
||||
cnf.class = {};
|
||||
}
|
||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||
}, "init")
|
||||
};
|
||||
export {
|
||||
diagram
|
||||
};
|
||||
+582
@@ -0,0 +1,582 @@
|
||||
import {
|
||||
populateCommonDb
|
||||
} from "./chunk-WASTHULE.mjs";
|
||||
import {
|
||||
parse
|
||||
} from "./chunk-6OSLE3NY.mjs";
|
||||
import "./chunk-OBMQL7OE.mjs";
|
||||
import "./chunk-BDXV45HO.mjs";
|
||||
import "./chunk-ALB5NAU3.mjs";
|
||||
import "./chunk-LYCWX5BJ.mjs";
|
||||
import "./chunk-LIIAENVV.mjs";
|
||||
import "./chunk-NUOAVMUD.mjs";
|
||||
import {
|
||||
selectSvgElement
|
||||
} from "./chunk-NWP4V2O6.mjs";
|
||||
import {
|
||||
setupViewPortForSVG
|
||||
} from "./chunk-M4FGLBOT.mjs";
|
||||
import {
|
||||
isLabelStyle,
|
||||
styles2String
|
||||
} from "./chunk-TEV7DDKD.mjs";
|
||||
import {
|
||||
cleanAndMerge
|
||||
} from "./chunk-XCSQNVCT.mjs";
|
||||
import "./chunk-3OTVAOVH.mjs";
|
||||
import {
|
||||
clear,
|
||||
configureSvgSize,
|
||||
defaultConfig_default,
|
||||
getAccDescription,
|
||||
getAccTitle,
|
||||
getConfig,
|
||||
getDiagramTitle,
|
||||
setAccDescription,
|
||||
setAccTitle,
|
||||
setDiagramTitle
|
||||
} from "./chunk-UKMXQNCB.mjs";
|
||||
import {
|
||||
format,
|
||||
hierarchy,
|
||||
log,
|
||||
ordinal,
|
||||
select_default,
|
||||
treemap_default
|
||||
} from "./chunk-GRVEB7DL.mjs";
|
||||
import "./chunk-75NCXSTK.mjs";
|
||||
import "./chunk-S3MDV2AR.mjs";
|
||||
import "./chunk-MFRUYFWM.mjs";
|
||||
import "./chunk-UKL4YMJ2.mjs";
|
||||
import "./chunk-3QJOF6JT.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-FQFHLQFH.mjs";
|
||||
|
||||
// src/diagrams/treemap/db.ts
|
||||
var TreeMapDB = class {
|
||||
constructor() {
|
||||
this.nodes = [];
|
||||
this.levels = /* @__PURE__ */ new Map();
|
||||
this.outerNodes = [];
|
||||
this.classes = /* @__PURE__ */ new Map();
|
||||
this.setAccTitle = setAccTitle;
|
||||
this.getAccTitle = getAccTitle;
|
||||
this.setDiagramTitle = setDiagramTitle;
|
||||
this.getDiagramTitle = getDiagramTitle;
|
||||
this.getAccDescription = getAccDescription;
|
||||
this.setAccDescription = setAccDescription;
|
||||
}
|
||||
static {
|
||||
__name(this, "TreeMapDB");
|
||||
}
|
||||
getNodes() {
|
||||
return this.nodes;
|
||||
}
|
||||
getConfig() {
|
||||
const defaultConfig = defaultConfig_default;
|
||||
const userConfig = getConfig();
|
||||
return cleanAndMerge({
|
||||
...defaultConfig.treemap,
|
||||
...userConfig.treemap ?? {}
|
||||
});
|
||||
}
|
||||
addNode(node, level) {
|
||||
this.nodes.push(node);
|
||||
this.levels.set(node, level);
|
||||
if (level === 0) {
|
||||
this.outerNodes.push(node);
|
||||
this.root ??= node;
|
||||
}
|
||||
}
|
||||
getRoot() {
|
||||
return { name: "", children: this.outerNodes };
|
||||
}
|
||||
addClass(id, _style) {
|
||||
const styleClass = this.classes.get(id) ?? { id, styles: [], textStyles: [] };
|
||||
const styles = _style.replace(/\\,/g, "\xA7\xA7\xA7").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
|
||||
if (styles) {
|
||||
styles.forEach((s) => {
|
||||
if (isLabelStyle(s)) {
|
||||
if (styleClass?.textStyles) {
|
||||
styleClass.textStyles.push(s);
|
||||
} else {
|
||||
styleClass.textStyles = [s];
|
||||
}
|
||||
}
|
||||
if (styleClass?.styles) {
|
||||
styleClass.styles.push(s);
|
||||
} else {
|
||||
styleClass.styles = [s];
|
||||
}
|
||||
});
|
||||
}
|
||||
this.classes.set(id, styleClass);
|
||||
}
|
||||
getClasses() {
|
||||
return this.classes;
|
||||
}
|
||||
getStylesForClass(classSelector) {
|
||||
return this.classes.get(classSelector)?.styles ?? [];
|
||||
}
|
||||
clear() {
|
||||
clear();
|
||||
this.nodes = [];
|
||||
this.levels = /* @__PURE__ */ new Map();
|
||||
this.outerNodes = [];
|
||||
this.classes = /* @__PURE__ */ new Map();
|
||||
this.root = void 0;
|
||||
}
|
||||
};
|
||||
|
||||
// src/diagrams/treemap/utils.ts
|
||||
function buildHierarchy(items) {
|
||||
if (!items.length) {
|
||||
return [];
|
||||
}
|
||||
const root = [];
|
||||
const stack = [];
|
||||
items.forEach((item) => {
|
||||
const node = {
|
||||
name: item.name,
|
||||
children: item.type === "Leaf" ? void 0 : []
|
||||
};
|
||||
node.classSelector = item?.classSelector;
|
||||
if (item?.cssCompiledStyles) {
|
||||
node.cssCompiledStyles = item.cssCompiledStyles;
|
||||
}
|
||||
if (item.type === "Leaf" && item.value !== void 0) {
|
||||
node.value = item.value;
|
||||
}
|
||||
while (stack.length > 0 && stack[stack.length - 1].level >= item.level) {
|
||||
stack.pop();
|
||||
}
|
||||
if (stack.length === 0) {
|
||||
root.push(node);
|
||||
} else {
|
||||
const parent = stack[stack.length - 1].node;
|
||||
if (parent.children) {
|
||||
parent.children.push(node);
|
||||
} else {
|
||||
parent.children = [node];
|
||||
}
|
||||
}
|
||||
if (item.type !== "Leaf") {
|
||||
stack.push({ node, level: item.level });
|
||||
}
|
||||
});
|
||||
return root;
|
||||
}
|
||||
__name(buildHierarchy, "buildHierarchy");
|
||||
|
||||
// src/diagrams/treemap/parser.ts
|
||||
var populate = /* @__PURE__ */ __name((ast, db) => {
|
||||
populateCommonDb(ast, db);
|
||||
const items = [];
|
||||
for (const row of ast.TreemapRows ?? []) {
|
||||
if (row.$type === "ClassDefStatement") {
|
||||
db.addClass(row.className ?? "", row.styleText ?? "");
|
||||
}
|
||||
}
|
||||
for (const row of ast.TreemapRows ?? []) {
|
||||
const item = row.item;
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
const level = row.indent ? parseInt(row.indent) : 0;
|
||||
const name = getItemName(item);
|
||||
const styles = item.classSelector ? db.getStylesForClass(item.classSelector) : [];
|
||||
const cssCompiledStyles = styles.length > 0 ? styles : void 0;
|
||||
const itemData = {
|
||||
level,
|
||||
name,
|
||||
type: item.$type,
|
||||
value: item.value,
|
||||
classSelector: item.classSelector,
|
||||
cssCompiledStyles
|
||||
};
|
||||
items.push(itemData);
|
||||
}
|
||||
const hierarchyNodes = buildHierarchy(items);
|
||||
const addNodesRecursively = /* @__PURE__ */ __name((nodes, level) => {
|
||||
for (const node of nodes) {
|
||||
db.addNode(node, level);
|
||||
if (node.children && node.children.length > 0) {
|
||||
addNodesRecursively(node.children, level + 1);
|
||||
}
|
||||
}
|
||||
}, "addNodesRecursively");
|
||||
addNodesRecursively(hierarchyNodes, 0);
|
||||
}, "populate");
|
||||
var getItemName = /* @__PURE__ */ __name((item) => {
|
||||
return item.name ? String(item.name) : "";
|
||||
}, "getItemName");
|
||||
var parser = {
|
||||
// @ts-expect-error - TreeMapDB is not assignable to DiagramDB
|
||||
parser: { yy: void 0 },
|
||||
parse: /* @__PURE__ */ __name(async (text) => {
|
||||
try {
|
||||
const parseFunc = parse;
|
||||
const ast = await parseFunc("treemap", text);
|
||||
log.debug("Treemap AST:", ast);
|
||||
const db = parser.parser?.yy;
|
||||
if (!(db instanceof TreeMapDB)) {
|
||||
throw new Error(
|
||||
"parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
|
||||
);
|
||||
}
|
||||
populate(ast, db);
|
||||
} catch (error) {
|
||||
log.error("Error parsing treemap:", error);
|
||||
throw error;
|
||||
}
|
||||
}, "parse")
|
||||
};
|
||||
|
||||
// src/diagrams/treemap/renderer.ts
|
||||
var DEFAULT_INNER_PADDING = 10;
|
||||
var SECTION_INNER_PADDING = 10;
|
||||
var SECTION_HEADER_HEIGHT = 25;
|
||||
var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
||||
const treemapDb = diagram2.db;
|
||||
const config = treemapDb.getConfig();
|
||||
const treemapInnerPadding = config.padding ?? DEFAULT_INNER_PADDING;
|
||||
const title = treemapDb.getDiagramTitle();
|
||||
const root = treemapDb.getRoot();
|
||||
const { themeVariables } = getConfig();
|
||||
if (!root) {
|
||||
return;
|
||||
}
|
||||
const titleHeight = title ? 30 : 0;
|
||||
const svg = selectSvgElement(id);
|
||||
const width = config.nodeWidth ? config.nodeWidth * SECTION_INNER_PADDING : 960;
|
||||
const height = config.nodeHeight ? config.nodeHeight * SECTION_INNER_PADDING : 500;
|
||||
const svgWidth = width;
|
||||
const svgHeight = height + titleHeight;
|
||||
svg.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
|
||||
configureSvgSize(svg, svgHeight, svgWidth, config.useMaxWidth);
|
||||
let valueFormat;
|
||||
try {
|
||||
const formatStr = config.valueFormat || ",";
|
||||
if (formatStr === "$0,0") {
|
||||
valueFormat = /* @__PURE__ */ __name((value) => "$" + format(",")(value), "valueFormat");
|
||||
} else if (formatStr.startsWith("$") && formatStr.includes(",")) {
|
||||
const precision = /\.\d+/.exec(formatStr);
|
||||
const precisionStr = precision ? precision[0] : "";
|
||||
valueFormat = /* @__PURE__ */ __name((value) => "$" + format("," + precisionStr)(value), "valueFormat");
|
||||
} else if (formatStr.startsWith("$")) {
|
||||
const restOfFormat = formatStr.substring(1);
|
||||
valueFormat = /* @__PURE__ */ __name((value) => "$" + format(restOfFormat || "")(value), "valueFormat");
|
||||
} else {
|
||||
valueFormat = format(formatStr);
|
||||
}
|
||||
} catch (error) {
|
||||
log.error("Error creating format function:", error);
|
||||
valueFormat = format(",");
|
||||
}
|
||||
const colorScale = ordinal().range([
|
||||
"transparent",
|
||||
themeVariables.cScale0,
|
||||
themeVariables.cScale1,
|
||||
themeVariables.cScale2,
|
||||
themeVariables.cScale3,
|
||||
themeVariables.cScale4,
|
||||
themeVariables.cScale5,
|
||||
themeVariables.cScale6,
|
||||
themeVariables.cScale7,
|
||||
themeVariables.cScale8,
|
||||
themeVariables.cScale9,
|
||||
themeVariables.cScale10,
|
||||
themeVariables.cScale11
|
||||
]);
|
||||
const colorScalePeer = ordinal().range([
|
||||
"transparent",
|
||||
themeVariables.cScalePeer0,
|
||||
themeVariables.cScalePeer1,
|
||||
themeVariables.cScalePeer2,
|
||||
themeVariables.cScalePeer3,
|
||||
themeVariables.cScalePeer4,
|
||||
themeVariables.cScalePeer5,
|
||||
themeVariables.cScalePeer6,
|
||||
themeVariables.cScalePeer7,
|
||||
themeVariables.cScalePeer8,
|
||||
themeVariables.cScalePeer9,
|
||||
themeVariables.cScalePeer10,
|
||||
themeVariables.cScalePeer11
|
||||
]);
|
||||
const colorScaleLabel = ordinal().range([
|
||||
themeVariables.cScaleLabel0,
|
||||
themeVariables.cScaleLabel1,
|
||||
themeVariables.cScaleLabel2,
|
||||
themeVariables.cScaleLabel3,
|
||||
themeVariables.cScaleLabel4,
|
||||
themeVariables.cScaleLabel5,
|
||||
themeVariables.cScaleLabel6,
|
||||
themeVariables.cScaleLabel7,
|
||||
themeVariables.cScaleLabel8,
|
||||
themeVariables.cScaleLabel9,
|
||||
themeVariables.cScaleLabel10,
|
||||
themeVariables.cScaleLabel11
|
||||
]);
|
||||
if (title) {
|
||||
svg.append("text").attr("x", svgWidth / 2).attr("y", titleHeight / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title);
|
||||
}
|
||||
const g = svg.append("g").attr("transform", `translate(0, ${titleHeight})`).attr("class", "treemapContainer");
|
||||
const hierarchyRoot = hierarchy(root).sum((d) => d.value ?? 0).sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
|
||||
const treemapLayout = treemap_default().size([width, height]).paddingTop(
|
||||
(d) => d.children && d.children.length > 0 ? SECTION_HEADER_HEIGHT + SECTION_INNER_PADDING : 0
|
||||
).paddingInner(treemapInnerPadding).paddingLeft((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingRight((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingBottom((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).round(true);
|
||||
const treemapData = treemapLayout(hierarchyRoot);
|
||||
const branchNodes = treemapData.descendants().filter((d) => d.children && d.children.length > 0);
|
||||
const sections = g.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class", "treemapSection").attr("transform", (d) => `translate(${d.x0},${d.y0})`);
|
||||
sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", SECTION_HEADER_HEIGHT).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (d) => {
|
||||
if (d.depth === 0) {
|
||||
return "display: none;";
|
||||
}
|
||||
return "";
|
||||
});
|
||||
sections.append("clipPath").attr("id", (_d, i) => `clip-section-${id}-${i}`).append("rect").attr("width", (d) => Math.max(0, d.x1 - d.x0 - 12)).attr("height", SECTION_HEADER_HEIGHT);
|
||||
sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", (_d, i) => {
|
||||
return `treemapSection section${i}`;
|
||||
}).attr("fill", (d) => colorScale(d.data.name)).attr("fill-opacity", 0.6).attr("stroke", (d) => colorScalePeer(d.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (d) => {
|
||||
if (d.depth === 0) {
|
||||
return "display: none;";
|
||||
}
|
||||
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
||||
return styles.nodeStyles + ";" + styles.borderStyles.join(";");
|
||||
});
|
||||
sections.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", SECTION_HEADER_HEIGHT / 2).attr("dominant-baseline", "middle").text((d) => d.depth === 0 ? "" : d.data.name).attr("font-weight", "bold").attr("style", (d) => {
|
||||
if (d.depth === 0) {
|
||||
return "display: none;";
|
||||
}
|
||||
const labelStyles = "dominant-baseline: middle; font-size: 12px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
|
||||
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
||||
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
||||
}).each(function(d) {
|
||||
if (d.depth === 0) {
|
||||
return;
|
||||
}
|
||||
const self = select_default(this);
|
||||
const originalText = d.data.name;
|
||||
self.text(originalText);
|
||||
const totalHeaderWidth = d.x1 - d.x0;
|
||||
const labelXPosition = 6;
|
||||
let spaceForTextContent;
|
||||
if (config.showValues !== false && d.value) {
|
||||
const valueEndsAtXRelative = totalHeaderWidth - 10;
|
||||
const estimatedValueTextActualWidth = 30;
|
||||
const gapBetweenLabelAndValue = 10;
|
||||
const labelMustEndBeforeX = valueEndsAtXRelative - estimatedValueTextActualWidth - gapBetweenLabelAndValue;
|
||||
spaceForTextContent = labelMustEndBeforeX - labelXPosition;
|
||||
} else {
|
||||
const labelOwnRightPadding = 6;
|
||||
spaceForTextContent = totalHeaderWidth - labelXPosition - labelOwnRightPadding;
|
||||
}
|
||||
const minimumWidthToDisplay = 15;
|
||||
const actualAvailableWidth = Math.max(minimumWidthToDisplay, spaceForTextContent);
|
||||
const textNode = self.node();
|
||||
const currentTextContentLength = textNode.getComputedTextLength();
|
||||
if (currentTextContentLength > actualAvailableWidth) {
|
||||
const ellipsis = "...";
|
||||
let currentTruncatedText = originalText;
|
||||
while (currentTruncatedText.length > 0) {
|
||||
currentTruncatedText = originalText.substring(0, currentTruncatedText.length - 1);
|
||||
if (currentTruncatedText.length === 0) {
|
||||
self.text(ellipsis);
|
||||
if (textNode.getComputedTextLength() > actualAvailableWidth) {
|
||||
self.text("");
|
||||
}
|
||||
break;
|
||||
}
|
||||
self.text(currentTruncatedText + ellipsis);
|
||||
if (textNode.getComputedTextLength() <= actualAvailableWidth) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (config.showValues !== false) {
|
||||
sections.append("text").attr("class", "treemapSectionValue").attr("x", (d) => d.x1 - d.x0 - 10).attr("y", SECTION_HEADER_HEIGHT / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((d) => d.value ? valueFormat(d.value) : "").attr("font-style", "italic").attr("style", (d) => {
|
||||
if (d.depth === 0) {
|
||||
return "display: none;";
|
||||
}
|
||||
const labelStyles = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
|
||||
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
||||
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
||||
});
|
||||
}
|
||||
const leafNodes = treemapData.leaves();
|
||||
const cell = g.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class", (d, i) => {
|
||||
return `treemapNode treemapLeafGroup leaf${i}${d.data.classSelector ? ` ${d.data.classSelector}` : ""}x`;
|
||||
}).attr("transform", (d) => `translate(${d.x0},${d.y0})`);
|
||||
cell.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", "treemapLeaf").attr("fill", (d) => {
|
||||
return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
|
||||
}).attr("style", (d) => {
|
||||
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
||||
return styles.nodeStyles;
|
||||
}).attr("fill-opacity", 0.3).attr("stroke", (d) => {
|
||||
return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
|
||||
}).attr("stroke-width", 3);
|
||||
cell.append("clipPath").attr("id", (_d, i) => `clip-${id}-${i}`).append("rect").attr("width", (d) => Math.max(0, d.x1 - d.x0 - 4)).attr("height", (d) => Math.max(0, d.y1 - d.y0 - 4));
|
||||
const leafLabels = cell.append("text").attr("class", "treemapLabel").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", (d) => (d.y1 - d.y0) / 2).attr("style", (d) => {
|
||||
const labelStyles = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + colorScaleLabel(d.data.name) + ";";
|
||||
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
||||
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
||||
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.data.name);
|
||||
leafLabels.each(function(d) {
|
||||
const self = select_default(this);
|
||||
const nodeWidth = d.x1 - d.x0;
|
||||
const nodeHeight = d.y1 - d.y0;
|
||||
const textNode = self.node();
|
||||
const padding = 4;
|
||||
const availableWidth = nodeWidth - 2 * padding;
|
||||
const availableHeight = nodeHeight - 2 * padding;
|
||||
if (availableWidth < 10 || availableHeight < 10) {
|
||||
self.style("display", "none");
|
||||
return;
|
||||
}
|
||||
let currentLabelFontSize = parseInt(self.style("font-size"), 10);
|
||||
const minLabelFontSize = 8;
|
||||
const originalValueRelFontSize = 28;
|
||||
const valueScaleFactor = 0.6;
|
||||
const minValueFontSize = 6;
|
||||
const spacingBetweenLabelAndValue = 2;
|
||||
while (textNode.getComputedTextLength() > availableWidth && currentLabelFontSize > minLabelFontSize) {
|
||||
currentLabelFontSize--;
|
||||
self.style("font-size", `${currentLabelFontSize}px`);
|
||||
}
|
||||
let prospectiveValueFontSize = Math.max(
|
||||
minValueFontSize,
|
||||
Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
|
||||
);
|
||||
let combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
|
||||
while (combinedHeight > availableHeight && currentLabelFontSize > minLabelFontSize) {
|
||||
currentLabelFontSize--;
|
||||
prospectiveValueFontSize = Math.max(
|
||||
minValueFontSize,
|
||||
Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
|
||||
);
|
||||
if (prospectiveValueFontSize < minValueFontSize && currentLabelFontSize === minLabelFontSize) {
|
||||
break;
|
||||
}
|
||||
self.style("font-size", `${currentLabelFontSize}px`);
|
||||
combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
|
||||
if (prospectiveValueFontSize <= minValueFontSize && combinedHeight > availableHeight) {
|
||||
}
|
||||
}
|
||||
self.style("font-size", `${currentLabelFontSize}px`);
|
||||
if (textNode.getComputedTextLength() > availableWidth || currentLabelFontSize < minLabelFontSize || availableHeight < currentLabelFontSize) {
|
||||
self.style("display", "none");
|
||||
}
|
||||
});
|
||||
if (config.showValues !== false) {
|
||||
const leafValues = cell.append("text").attr("class", "treemapValue").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", function(d) {
|
||||
return (d.y1 - d.y0) / 2;
|
||||
}).attr("style", (d) => {
|
||||
const labelStyles = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + colorScaleLabel(d.data.name) + ";";
|
||||
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
||||
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
||||
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.value ? valueFormat(d.value) : "");
|
||||
leafValues.each(function(d) {
|
||||
const valueTextElement = select_default(this);
|
||||
const parentCellNode = this.parentNode;
|
||||
if (!parentCellNode) {
|
||||
valueTextElement.style("display", "none");
|
||||
return;
|
||||
}
|
||||
const labelElement = select_default(parentCellNode).select(".treemapLabel");
|
||||
if (labelElement.empty() || labelElement.style("display") === "none") {
|
||||
valueTextElement.style("display", "none");
|
||||
return;
|
||||
}
|
||||
const finalLabelFontSize = parseFloat(labelElement.style("font-size"));
|
||||
const originalValueFontSize = 28;
|
||||
const valueScaleFactor = 0.6;
|
||||
const minValueFontSize = 6;
|
||||
const spacingBetweenLabelAndValue = 2;
|
||||
const actualValueFontSize = Math.max(
|
||||
minValueFontSize,
|
||||
Math.min(originalValueFontSize, Math.round(finalLabelFontSize * valueScaleFactor))
|
||||
);
|
||||
valueTextElement.style("font-size", `${actualValueFontSize}px`);
|
||||
const labelCenterY = (d.y1 - d.y0) / 2;
|
||||
const valueTopActualY = labelCenterY + finalLabelFontSize / 2 + spacingBetweenLabelAndValue;
|
||||
valueTextElement.attr("y", valueTopActualY);
|
||||
const nodeWidth = d.x1 - d.x0;
|
||||
const nodeTotalHeight = d.y1 - d.y0;
|
||||
const cellBottomPadding = 4;
|
||||
const maxValueBottomY = nodeTotalHeight - cellBottomPadding;
|
||||
const availableWidthForValue = nodeWidth - 2 * 4;
|
||||
if (valueTextElement.node().getComputedTextLength() > availableWidthForValue || valueTopActualY + actualValueFontSize > maxValueBottomY || actualValueFontSize < minValueFontSize) {
|
||||
valueTextElement.style("display", "none");
|
||||
} else {
|
||||
valueTextElement.style("display", null);
|
||||
}
|
||||
});
|
||||
}
|
||||
const diagramPadding = config.diagramPadding ?? 8;
|
||||
setupViewPortForSVG(svg, diagramPadding, "flowchart", config?.useMaxWidth || false);
|
||||
}, "draw");
|
||||
var getClasses = /* @__PURE__ */ __name(function(_text, diagramObj) {
|
||||
return diagramObj.db.getClasses();
|
||||
}, "getClasses");
|
||||
var renderer = { draw, getClasses };
|
||||
|
||||
// src/diagrams/treemap/styles.ts
|
||||
var defaultTreemapStyleOptions = {
|
||||
sectionStrokeColor: "black",
|
||||
sectionStrokeWidth: "1",
|
||||
sectionFillColor: "#efefef",
|
||||
leafStrokeColor: "black",
|
||||
leafStrokeWidth: "1",
|
||||
leafFillColor: "#efefef",
|
||||
labelColor: "black",
|
||||
labelFontSize: "12px",
|
||||
valueFontSize: "10px",
|
||||
valueColor: "black",
|
||||
titleColor: "black",
|
||||
titleFontSize: "14px"
|
||||
};
|
||||
var getStyles = /* @__PURE__ */ __name(({
|
||||
treemap
|
||||
} = {}) => {
|
||||
const options = cleanAndMerge(defaultTreemapStyleOptions, treemap);
|
||||
return `
|
||||
.treemapNode.section {
|
||||
stroke: ${options.sectionStrokeColor};
|
||||
stroke-width: ${options.sectionStrokeWidth};
|
||||
fill: ${options.sectionFillColor};
|
||||
}
|
||||
.treemapNode.leaf {
|
||||
stroke: ${options.leafStrokeColor};
|
||||
stroke-width: ${options.leafStrokeWidth};
|
||||
fill: ${options.leafFillColor};
|
||||
}
|
||||
.treemapLabel {
|
||||
fill: ${options.labelColor};
|
||||
font-size: ${options.labelFontSize};
|
||||
}
|
||||
.treemapValue {
|
||||
fill: ${options.valueColor};
|
||||
font-size: ${options.valueFontSize};
|
||||
}
|
||||
.treemapTitle {
|
||||
fill: ${options.titleColor};
|
||||
font-size: ${options.titleFontSize};
|
||||
}
|
||||
`;
|
||||
}, "getStyles");
|
||||
var styles_default = getStyles;
|
||||
|
||||
// src/diagrams/treemap/diagram.ts
|
||||
var diagram = {
|
||||
parser,
|
||||
get db() {
|
||||
return new TreeMapDB();
|
||||
},
|
||||
renderer,
|
||||
styles: styles_default
|
||||
};
|
||||
export {
|
||||
diagram
|
||||
};
|
||||
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": [],
|
||||
"sourcesContent": [],
|
||||
"mappings": "",
|
||||
"names": []
|
||||
}
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": [],
|
||||
"sourcesContent": [],
|
||||
"mappings": "",
|
||||
"names": []
|
||||
}
|
||||
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
import {
|
||||
PacketModule,
|
||||
createPacketServices
|
||||
} from "./chunk-OBMQL7OE.mjs";
|
||||
import "./chunk-S3MDV2AR.mjs";
|
||||
import "./chunk-MFRUYFWM.mjs";
|
||||
import "./chunk-UKL4YMJ2.mjs";
|
||||
import "./chunk-3QJOF6JT.mjs";
|
||||
import "./chunk-FQFHLQFH.mjs";
|
||||
export {
|
||||
PacketModule,
|
||||
createPacketServices
|
||||
};
|
||||
+236
@@ -0,0 +1,236 @@
|
||||
import {
|
||||
populateCommonDb
|
||||
} from "./chunk-WASTHULE.mjs";
|
||||
import {
|
||||
parse
|
||||
} from "./chunk-6OSLE3NY.mjs";
|
||||
import "./chunk-OBMQL7OE.mjs";
|
||||
import "./chunk-BDXV45HO.mjs";
|
||||
import "./chunk-ALB5NAU3.mjs";
|
||||
import "./chunk-LYCWX5BJ.mjs";
|
||||
import "./chunk-LIIAENVV.mjs";
|
||||
import "./chunk-NUOAVMUD.mjs";
|
||||
import {
|
||||
selectSvgElement
|
||||
} from "./chunk-NWP4V2O6.mjs";
|
||||
import {
|
||||
cleanAndMerge,
|
||||
parseFontSize
|
||||
} from "./chunk-XCSQNVCT.mjs";
|
||||
import "./chunk-3OTVAOVH.mjs";
|
||||
import {
|
||||
clear,
|
||||
configureSvgSize,
|
||||
defaultConfig_default,
|
||||
getAccDescription,
|
||||
getAccTitle,
|
||||
getConfig2 as getConfig,
|
||||
getDiagramTitle,
|
||||
setAccDescription,
|
||||
setAccTitle,
|
||||
setDiagramTitle
|
||||
} from "./chunk-UKMXQNCB.mjs";
|
||||
import {
|
||||
arc_default,
|
||||
log,
|
||||
ordinal,
|
||||
pie_default
|
||||
} from "./chunk-GRVEB7DL.mjs";
|
||||
import "./chunk-75NCXSTK.mjs";
|
||||
import "./chunk-S3MDV2AR.mjs";
|
||||
import "./chunk-MFRUYFWM.mjs";
|
||||
import "./chunk-UKL4YMJ2.mjs";
|
||||
import "./chunk-3QJOF6JT.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-FQFHLQFH.mjs";
|
||||
|
||||
// src/diagrams/pie/pieDb.ts
|
||||
var DEFAULT_PIE_CONFIG = defaultConfig_default.pie;
|
||||
var DEFAULT_PIE_DB = {
|
||||
sections: /* @__PURE__ */ new Map(),
|
||||
showData: false,
|
||||
config: DEFAULT_PIE_CONFIG
|
||||
};
|
||||
var sections = DEFAULT_PIE_DB.sections;
|
||||
var showData = DEFAULT_PIE_DB.showData;
|
||||
var config = structuredClone(DEFAULT_PIE_CONFIG);
|
||||
var getConfig2 = /* @__PURE__ */ __name(() => structuredClone(config), "getConfig");
|
||||
var clear2 = /* @__PURE__ */ __name(() => {
|
||||
sections = /* @__PURE__ */ new Map();
|
||||
showData = DEFAULT_PIE_DB.showData;
|
||||
clear();
|
||||
}, "clear");
|
||||
var addSection = /* @__PURE__ */ __name(({ label, value }) => {
|
||||
if (value < 0) {
|
||||
throw new Error(
|
||||
`"${label}" has invalid value: ${value}. Negative values are not allowed in pie charts. All slice values must be >= 0.`
|
||||
);
|
||||
}
|
||||
if (!sections.has(label)) {
|
||||
sections.set(label, value);
|
||||
log.debug(`added new section: ${label}, with value: ${value}`);
|
||||
}
|
||||
}, "addSection");
|
||||
var getSections = /* @__PURE__ */ __name(() => sections, "getSections");
|
||||
var setShowData = /* @__PURE__ */ __name((toggle) => {
|
||||
showData = toggle;
|
||||
}, "setShowData");
|
||||
var getShowData = /* @__PURE__ */ __name(() => showData, "getShowData");
|
||||
var db = {
|
||||
getConfig: getConfig2,
|
||||
clear: clear2,
|
||||
setDiagramTitle,
|
||||
getDiagramTitle,
|
||||
setAccTitle,
|
||||
getAccTitle,
|
||||
setAccDescription,
|
||||
getAccDescription,
|
||||
addSection,
|
||||
getSections,
|
||||
setShowData,
|
||||
getShowData
|
||||
};
|
||||
|
||||
// src/diagrams/pie/pieParser.ts
|
||||
var populateDb = /* @__PURE__ */ __name((ast, db2) => {
|
||||
populateCommonDb(ast, db2);
|
||||
db2.setShowData(ast.showData);
|
||||
ast.sections.map(db2.addSection);
|
||||
}, "populateDb");
|
||||
var parser = {
|
||||
parse: /* @__PURE__ */ __name(async (input) => {
|
||||
const ast = await parse("pie", input);
|
||||
log.debug(ast);
|
||||
populateDb(ast, db);
|
||||
}, "parse")
|
||||
};
|
||||
|
||||
// src/diagrams/pie/pieStyles.ts
|
||||
var getStyles = /* @__PURE__ */ __name((options) => `
|
||||
.pieCircle{
|
||||
stroke: ${options.pieStrokeColor};
|
||||
stroke-width : ${options.pieStrokeWidth};
|
||||
opacity : ${options.pieOpacity};
|
||||
}
|
||||
.pieOuterCircle{
|
||||
stroke: ${options.pieOuterStrokeColor};
|
||||
stroke-width: ${options.pieOuterStrokeWidth};
|
||||
fill: none;
|
||||
}
|
||||
.pieTitleText {
|
||||
text-anchor: middle;
|
||||
font-size: ${options.pieTitleTextSize};
|
||||
fill: ${options.pieTitleTextColor};
|
||||
font-family: ${options.fontFamily};
|
||||
}
|
||||
.slice {
|
||||
font-family: ${options.fontFamily};
|
||||
fill: ${options.pieSectionTextColor};
|
||||
font-size:${options.pieSectionTextSize};
|
||||
// fill: white;
|
||||
}
|
||||
.legend text {
|
||||
fill: ${options.pieLegendTextColor};
|
||||
font-family: ${options.fontFamily};
|
||||
font-size: ${options.pieLegendTextSize};
|
||||
}
|
||||
`, "getStyles");
|
||||
var pieStyles_default = getStyles;
|
||||
|
||||
// src/diagrams/pie/pieRenderer.ts
|
||||
var createPieArcs = /* @__PURE__ */ __name((sections2) => {
|
||||
const sum = [...sections2.values()].reduce((acc, val) => acc + val, 0);
|
||||
const pieData = [...sections2.entries()].map(([label, value]) => ({ label, value })).filter((d) => d.value / sum * 100 >= 1).sort((a, b) => b.value - a.value);
|
||||
const pie = pie_default().value((d) => d.value);
|
||||
return pie(pieData);
|
||||
}, "createPieArcs");
|
||||
var draw = /* @__PURE__ */ __name((text, id, _version, diagObj) => {
|
||||
log.debug("rendering pie chart\n" + text);
|
||||
const db2 = diagObj.db;
|
||||
const globalConfig = getConfig();
|
||||
const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
|
||||
const MARGIN = 40;
|
||||
const LEGEND_RECT_SIZE = 18;
|
||||
const LEGEND_SPACING = 4;
|
||||
const height = 450;
|
||||
const pieWidth = height;
|
||||
const svg = selectSvgElement(id);
|
||||
const group = svg.append("g");
|
||||
group.attr("transform", "translate(" + pieWidth / 2 + "," + height / 2 + ")");
|
||||
const { themeVariables } = globalConfig;
|
||||
let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
|
||||
outerStrokeWidth ??= 2;
|
||||
const textPosition = pieConfig.textPosition;
|
||||
const radius = Math.min(pieWidth, height) / 2 - MARGIN;
|
||||
const arcGenerator = arc_default().innerRadius(0).outerRadius(radius);
|
||||
const labelArcGenerator = arc_default().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
|
||||
group.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
|
||||
const sections2 = db2.getSections();
|
||||
const arcs = createPieArcs(sections2);
|
||||
const myGeneratedColors = [
|
||||
themeVariables.pie1,
|
||||
themeVariables.pie2,
|
||||
themeVariables.pie3,
|
||||
themeVariables.pie4,
|
||||
themeVariables.pie5,
|
||||
themeVariables.pie6,
|
||||
themeVariables.pie7,
|
||||
themeVariables.pie8,
|
||||
themeVariables.pie9,
|
||||
themeVariables.pie10,
|
||||
themeVariables.pie11,
|
||||
themeVariables.pie12
|
||||
];
|
||||
let sum = 0;
|
||||
sections2.forEach((section) => {
|
||||
sum += section;
|
||||
});
|
||||
const filteredArcs = arcs.filter((datum) => (datum.data.value / sum * 100).toFixed(0) !== "0");
|
||||
const color = ordinal(myGeneratedColors);
|
||||
group.selectAll("mySlices").data(filteredArcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
|
||||
return color(datum.data.label);
|
||||
}).attr("class", "pieCircle");
|
||||
group.selectAll("mySlices").data(filteredArcs).enter().append("text").text((datum) => {
|
||||
return (datum.data.value / sum * 100).toFixed(0) + "%";
|
||||
}).attr("transform", (datum) => {
|
||||
return "translate(" + labelArcGenerator.centroid(datum) + ")";
|
||||
}).style("text-anchor", "middle").attr("class", "slice");
|
||||
group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -(height - 50) / 2).attr("class", "pieTitleText");
|
||||
const allSectionData = [...sections2.entries()].map(([label, value]) => ({
|
||||
label,
|
||||
value
|
||||
}));
|
||||
const legend = group.selectAll(".legend").data(allSectionData).enter().append("g").attr("class", "legend").attr("transform", (_datum, index) => {
|
||||
const height2 = LEGEND_RECT_SIZE + LEGEND_SPACING;
|
||||
const offset = height2 * allSectionData.length / 2;
|
||||
const horizontal = 12 * LEGEND_RECT_SIZE;
|
||||
const vertical = index * height2 - offset;
|
||||
return "translate(" + horizontal + "," + vertical + ")";
|
||||
});
|
||||
legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", (d) => color(d.label)).style("stroke", (d) => color(d.label));
|
||||
legend.append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((d) => {
|
||||
if (db2.getShowData()) {
|
||||
return `${d.label} [${d.value}]`;
|
||||
}
|
||||
return d.label;
|
||||
});
|
||||
const longestTextWidth = Math.max(
|
||||
...legend.selectAll("text").nodes().map((node) => node?.getBoundingClientRect().width ?? 0)
|
||||
);
|
||||
const totalWidth = pieWidth + MARGIN + LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
|
||||
svg.attr("viewBox", `0 0 ${totalWidth} ${height}`);
|
||||
configureSvgSize(svg, height, totalWidth, pieConfig.useMaxWidth);
|
||||
}, "draw");
|
||||
var renderer = { draw };
|
||||
|
||||
// src/diagrams/pie/pieDiagram.ts
|
||||
var diagram = {
|
||||
parser,
|
||||
db,
|
||||
renderer,
|
||||
styles: pieStyles_default
|
||||
};
|
||||
export {
|
||||
diagram
|
||||
};
|
||||
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
+498
@@ -0,0 +1,498 @@
|
||||
import {
|
||||
StateDB,
|
||||
stateDiagram_default,
|
||||
styles_default
|
||||
} from "./chunk-3VXWS7DV.mjs";
|
||||
import {
|
||||
layout
|
||||
} from "./chunk-6JEIXYVA.mjs";
|
||||
import {
|
||||
Graph
|
||||
} from "./chunk-KACY6BU5.mjs";
|
||||
import "./chunk-U2CUWHSV.mjs";
|
||||
import "./chunk-M4FGLBOT.mjs";
|
||||
import "./chunk-EKL7DDBO.mjs";
|
||||
import "./chunk-TZW2344G.mjs";
|
||||
import "./chunk-UYNZS3GD.mjs";
|
||||
import "./chunk-UAL2TQZE.mjs";
|
||||
import "./chunk-FWQXANIB.mjs";
|
||||
import "./chunk-D2KOLKXV.mjs";
|
||||
import "./chunk-TEV7DDKD.mjs";
|
||||
import "./chunk-YHLHMBDM.mjs";
|
||||
import {
|
||||
utils_default
|
||||
} from "./chunk-XCSQNVCT.mjs";
|
||||
import "./chunk-3OTVAOVH.mjs";
|
||||
import {
|
||||
common_default,
|
||||
configureSvgSize,
|
||||
getConfig2 as getConfig,
|
||||
getUrl
|
||||
} from "./chunk-UKMXQNCB.mjs";
|
||||
import {
|
||||
basis_default,
|
||||
line_default,
|
||||
log,
|
||||
select_default
|
||||
} from "./chunk-GRVEB7DL.mjs";
|
||||
import "./chunk-MFRUYFWM.mjs";
|
||||
import "./chunk-UKL4YMJ2.mjs";
|
||||
import "./chunk-3QJOF6JT.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-FQFHLQFH.mjs";
|
||||
|
||||
// src/diagrams/state/shapes.js
|
||||
var drawStartState = /* @__PURE__ */ __name((g) => g.append("circle").attr("class", "start-state").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit), "drawStartState");
|
||||
var drawDivider = /* @__PURE__ */ __name((g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig().state.textHeight).attr("class", "divider").attr("x2", getConfig().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
|
||||
var drawSimpleState = /* @__PURE__ */ __name((g, stateDef) => {
|
||||
const state = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 2 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
|
||||
const classBox = state.node().getBBox();
|
||||
g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", classBox.width + 2 * getConfig().state.padding).attr("height", classBox.height + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
|
||||
return state;
|
||||
}, "drawSimpleState");
|
||||
var drawDescrState = /* @__PURE__ */ __name((g, stateDef) => {
|
||||
const addTspan = /* @__PURE__ */ __name(function(textEl, txt, isFirst2) {
|
||||
const tSpan = textEl.append("tspan").attr("x", 2 * getConfig().state.padding).text(txt);
|
||||
if (!isFirst2) {
|
||||
tSpan.attr("dy", getConfig().state.textHeight);
|
||||
}
|
||||
}, "addTspan");
|
||||
const title = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 1.3 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
|
||||
const titleBox = title.node().getBBox();
|
||||
const titleHeight = titleBox.height;
|
||||
const description = g.append("text").attr("x", getConfig().state.padding).attr(
|
||||
"y",
|
||||
titleHeight + getConfig().state.padding * 0.4 + getConfig().state.dividerMargin + getConfig().state.textHeight
|
||||
).attr("class", "state-description");
|
||||
let isFirst = true;
|
||||
let isSecond = true;
|
||||
stateDef.descriptions.forEach(function(descr) {
|
||||
if (!isFirst) {
|
||||
addTspan(description, descr, isSecond);
|
||||
isSecond = false;
|
||||
}
|
||||
isFirst = false;
|
||||
});
|
||||
const descrLine = g.append("line").attr("x1", getConfig().state.padding).attr("y1", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("y2", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("class", "descr-divider");
|
||||
const descrBox = description.node().getBBox();
|
||||
const width = Math.max(descrBox.width, titleBox.width);
|
||||
descrLine.attr("x2", width + 3 * getConfig().state.padding);
|
||||
g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", width + 2 * getConfig().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
|
||||
return g;
|
||||
}, "drawDescrState");
|
||||
var addTitleAndBox = /* @__PURE__ */ __name((g, stateDef, altBkg) => {
|
||||
const pad = getConfig().state.padding;
|
||||
const dblPad = 2 * getConfig().state.padding;
|
||||
const orgBox = g.node().getBBox();
|
||||
const orgWidth = orgBox.width;
|
||||
const orgX = orgBox.x;
|
||||
const title = g.append("text").attr("x", 0).attr("y", getConfig().state.titleShift).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
|
||||
const titleBox = title.node().getBBox();
|
||||
const titleWidth = titleBox.width + dblPad;
|
||||
let width = Math.max(titleWidth, orgWidth);
|
||||
if (width === orgWidth) {
|
||||
width = width + dblPad;
|
||||
}
|
||||
let startX;
|
||||
const graphBox = g.node().getBBox();
|
||||
if (stateDef.doc) {
|
||||
}
|
||||
startX = orgX - pad;
|
||||
if (titleWidth > orgWidth) {
|
||||
startX = (orgWidth - width) / 2 + pad;
|
||||
}
|
||||
if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
|
||||
startX = orgX - (titleWidth - orgWidth) / 2;
|
||||
}
|
||||
const lineY = 1 - getConfig().state.textHeight;
|
||||
g.insert("rect", ":first-child").attr("x", startX).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width).attr(
|
||||
"height",
|
||||
graphBox.height + getConfig().state.textHeight + getConfig().state.titleShift + 1
|
||||
).attr("rx", "0");
|
||||
title.attr("x", startX + pad);
|
||||
if (titleWidth <= orgWidth) {
|
||||
title.attr("x", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);
|
||||
}
|
||||
g.insert("rect", ":first-child").attr("x", startX).attr(
|
||||
"y",
|
||||
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
|
||||
).attr("width", width).attr("height", getConfig().state.textHeight * 3).attr("rx", getConfig().state.radius);
|
||||
g.insert("rect", ":first-child").attr("x", startX).attr(
|
||||
"y",
|
||||
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
|
||||
).attr("width", width).attr("height", graphBox.height + 3 + 2 * getConfig().state.textHeight).attr("rx", getConfig().state.radius);
|
||||
return g;
|
||||
}, "addTitleAndBox");
|
||||
var drawEndState = /* @__PURE__ */ __name((g) => {
|
||||
g.append("circle").attr("class", "end-state-outer").attr("r", getConfig().state.sizeUnit + getConfig().state.miniPadding).attr(
|
||||
"cx",
|
||||
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
|
||||
).attr(
|
||||
"cy",
|
||||
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
|
||||
);
|
||||
return g.append("circle").attr("class", "end-state-inner").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit + 2).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit + 2);
|
||||
}, "drawEndState");
|
||||
var drawForkJoinState = /* @__PURE__ */ __name((g, stateDef) => {
|
||||
let width = getConfig().state.forkWidth;
|
||||
let height = getConfig().state.forkHeight;
|
||||
if (stateDef.parentId) {
|
||||
let tmp = width;
|
||||
width = height;
|
||||
height = tmp;
|
||||
}
|
||||
return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", getConfig().state.padding).attr("y", getConfig().state.padding);
|
||||
}, "drawForkJoinState");
|
||||
var _drawLongText = /* @__PURE__ */ __name((_text, x, y, g) => {
|
||||
let textHeight = 0;
|
||||
const textElem = g.append("text");
|
||||
textElem.style("text-anchor", "start");
|
||||
textElem.attr("class", "noteText");
|
||||
let text = _text.replace(/\r\n/g, "<br/>");
|
||||
text = text.replace(/\n/g, "<br/>");
|
||||
const lines = text.split(common_default.lineBreakRegex);
|
||||
let tHeight = 1.25 * getConfig().state.noteMargin;
|
||||
for (const line of lines) {
|
||||
const txt = line.trim();
|
||||
if (txt.length > 0) {
|
||||
const span = textElem.append("tspan");
|
||||
span.text(txt);
|
||||
if (tHeight === 0) {
|
||||
const textBounds = span.node().getBBox();
|
||||
tHeight += textBounds.height;
|
||||
}
|
||||
textHeight += tHeight;
|
||||
span.attr("x", x + getConfig().state.noteMargin);
|
||||
span.attr("y", y + textHeight + 1.25 * getConfig().state.noteMargin);
|
||||
}
|
||||
}
|
||||
return { textWidth: textElem.node().getBBox().width, textHeight };
|
||||
}, "_drawLongText");
|
||||
var drawNote = /* @__PURE__ */ __name((text, g) => {
|
||||
g.attr("class", "state-note");
|
||||
const note = g.append("rect").attr("x", 0).attr("y", getConfig().state.padding);
|
||||
const rectElem = g.append("g");
|
||||
const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
|
||||
note.attr("height", textHeight + 2 * getConfig().state.noteMargin);
|
||||
note.attr("width", textWidth + getConfig().state.noteMargin * 2);
|
||||
return note;
|
||||
}, "drawNote");
|
||||
var drawState = /* @__PURE__ */ __name(function(elem, stateDef) {
|
||||
const id = stateDef.id;
|
||||
const stateInfo = {
|
||||
id,
|
||||
label: stateDef.id,
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
const g = elem.append("g").attr("id", id).attr("class", "stateGroup");
|
||||
if (stateDef.type === "start") {
|
||||
drawStartState(g);
|
||||
}
|
||||
if (stateDef.type === "end") {
|
||||
drawEndState(g);
|
||||
}
|
||||
if (stateDef.type === "fork" || stateDef.type === "join") {
|
||||
drawForkJoinState(g, stateDef);
|
||||
}
|
||||
if (stateDef.type === "note") {
|
||||
drawNote(stateDef.note.text, g);
|
||||
}
|
||||
if (stateDef.type === "divider") {
|
||||
drawDivider(g);
|
||||
}
|
||||
if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
|
||||
drawSimpleState(g, stateDef);
|
||||
}
|
||||
if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
|
||||
drawDescrState(g, stateDef);
|
||||
}
|
||||
const stateBox = g.node().getBBox();
|
||||
stateInfo.width = stateBox.width + 2 * getConfig().state.padding;
|
||||
stateInfo.height = stateBox.height + 2 * getConfig().state.padding;
|
||||
return stateInfo;
|
||||
}, "drawState");
|
||||
var edgeCount = 0;
|
||||
var drawEdge = /* @__PURE__ */ __name(function(elem, path, relation) {
|
||||
const getRelationType = /* @__PURE__ */ __name(function(type) {
|
||||
switch (type) {
|
||||
case StateDB.relationType.AGGREGATION:
|
||||
return "aggregation";
|
||||
case StateDB.relationType.EXTENSION:
|
||||
return "extension";
|
||||
case StateDB.relationType.COMPOSITION:
|
||||
return "composition";
|
||||
case StateDB.relationType.DEPENDENCY:
|
||||
return "dependency";
|
||||
}
|
||||
}, "getRelationType");
|
||||
path.points = path.points.filter((p) => !Number.isNaN(p.y));
|
||||
const lineData = path.points;
|
||||
const lineFunction = line_default().x(function(d) {
|
||||
return d.x;
|
||||
}).y(function(d) {
|
||||
return d.y;
|
||||
}).curve(basis_default);
|
||||
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
|
||||
let url = "";
|
||||
if (getConfig().state.arrowMarkerAbsolute) {
|
||||
url = getUrl(true);
|
||||
}
|
||||
svgPath.attr(
|
||||
"marker-end",
|
||||
"url(" + url + "#" + getRelationType(StateDB.relationType.DEPENDENCY) + "End)"
|
||||
);
|
||||
if (relation.title !== void 0) {
|
||||
const label = elem.append("g").attr("class", "stateLabel");
|
||||
const { x, y } = utils_default.calcLabelPosition(path.points);
|
||||
const rows = common_default.getRows(relation.title);
|
||||
let titleHeight = 0;
|
||||
const titleRows = [];
|
||||
let maxWidth = 0;
|
||||
let minX = 0;
|
||||
for (let i = 0; i <= rows.length; i++) {
|
||||
const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
|
||||
const boundsTmp = title.node().getBBox();
|
||||
maxWidth = Math.max(maxWidth, boundsTmp.width);
|
||||
minX = Math.min(minX, boundsTmp.x);
|
||||
log.info(boundsTmp.x, x, y + titleHeight);
|
||||
if (titleHeight === 0) {
|
||||
const titleBox = title.node().getBBox();
|
||||
titleHeight = titleBox.height;
|
||||
log.info("Title height", titleHeight, y);
|
||||
}
|
||||
titleRows.push(title);
|
||||
}
|
||||
let boxHeight = titleHeight * rows.length;
|
||||
if (rows.length > 1) {
|
||||
const heightAdj = (rows.length - 1) * titleHeight * 0.5;
|
||||
titleRows.forEach((title, i) => title.attr("y", y + i * titleHeight - heightAdj));
|
||||
boxHeight = titleHeight * rows.length;
|
||||
}
|
||||
const bounds = label.node().getBBox();
|
||||
label.insert("rect", ":first-child").attr("class", "box").attr("x", x - maxWidth / 2 - getConfig().state.padding / 2).attr("y", y - boxHeight / 2 - getConfig().state.padding / 2 - 3.5).attr("width", maxWidth + getConfig().state.padding).attr("height", boxHeight + getConfig().state.padding);
|
||||
log.info(bounds);
|
||||
}
|
||||
edgeCount++;
|
||||
}, "drawEdge");
|
||||
|
||||
// src/diagrams/state/stateRenderer.js
|
||||
var conf;
|
||||
var transformationLog = {};
|
||||
var setConf = /* @__PURE__ */ __name(function() {
|
||||
}, "setConf");
|
||||
var insertMarkers = /* @__PURE__ */ __name(function(elem) {
|
||||
elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
|
||||
}, "insertMarkers");
|
||||
var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
|
||||
conf = getConfig().state;
|
||||
const securityLevel = getConfig().securityLevel;
|
||||
let sandboxElement;
|
||||
if (securityLevel === "sandbox") {
|
||||
sandboxElement = select_default("#i" + id);
|
||||
}
|
||||
const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
|
||||
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
|
||||
log.debug("Rendering diagram " + text);
|
||||
const diagram2 = root.select(`[id='${id}']`);
|
||||
insertMarkers(diagram2);
|
||||
const rootDoc = diagObj.db.getRootDoc();
|
||||
renderDoc(rootDoc, diagram2, void 0, false, root, doc, diagObj);
|
||||
const padding = conf.padding;
|
||||
const bounds = diagram2.node().getBBox();
|
||||
const width = bounds.width + padding * 2;
|
||||
const height = bounds.height + padding * 2;
|
||||
const svgWidth = width * 1.75;
|
||||
configureSvgSize(diagram2, height, svgWidth, conf.useMaxWidth);
|
||||
diagram2.attr(
|
||||
"viewBox",
|
||||
`${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + " " + height
|
||||
);
|
||||
}, "draw");
|
||||
var getLabelWidth = /* @__PURE__ */ __name((text) => {
|
||||
return text ? text.length * conf.fontSizeFactor : 1;
|
||||
}, "getLabelWidth");
|
||||
var renderDoc = /* @__PURE__ */ __name((doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
|
||||
const graph = new Graph({
|
||||
compound: true,
|
||||
multigraph: true
|
||||
});
|
||||
let i;
|
||||
let edgeFreeDoc = true;
|
||||
for (i = 0; i < doc.length; i++) {
|
||||
if (doc[i].stmt === "relation") {
|
||||
edgeFreeDoc = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (parentId) {
|
||||
graph.setGraph({
|
||||
rankdir: "LR",
|
||||
multigraph: true,
|
||||
compound: true,
|
||||
// acyclicer: 'greedy',
|
||||
ranker: "tight-tree",
|
||||
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
|
||||
nodeSep: edgeFreeDoc ? 1 : 50,
|
||||
isMultiGraph: true
|
||||
// ranksep: 5,
|
||||
// nodesep: 1
|
||||
});
|
||||
} else {
|
||||
graph.setGraph({
|
||||
rankdir: "TB",
|
||||
multigraph: true,
|
||||
compound: true,
|
||||
// isCompound: true,
|
||||
// acyclicer: 'greedy',
|
||||
// ranker: 'longest-path'
|
||||
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
|
||||
nodeSep: edgeFreeDoc ? 1 : 50,
|
||||
ranker: "tight-tree",
|
||||
// ranker: 'network-simplex'
|
||||
isMultiGraph: true
|
||||
});
|
||||
}
|
||||
graph.setDefaultEdgeLabel(function() {
|
||||
return {};
|
||||
});
|
||||
const states = diagObj.db.getStates();
|
||||
const relations = diagObj.db.getRelations();
|
||||
const keys = Object.keys(states);
|
||||
let first = true;
|
||||
for (const key of keys) {
|
||||
const stateDef = states[key];
|
||||
if (parentId) {
|
||||
stateDef.parentId = parentId;
|
||||
}
|
||||
let node;
|
||||
if (stateDef.doc) {
|
||||
let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
|
||||
node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
|
||||
if (first) {
|
||||
sub = addTitleAndBox(sub, stateDef, altBkg);
|
||||
let boxBounds = sub.node().getBBox();
|
||||
node.width = boxBounds.width;
|
||||
node.height = boxBounds.height + conf.padding / 2;
|
||||
transformationLog[stateDef.id] = { y: conf.compositTitleSize };
|
||||
} else {
|
||||
let boxBounds = sub.node().getBBox();
|
||||
node.width = boxBounds.width;
|
||||
node.height = boxBounds.height;
|
||||
}
|
||||
} else {
|
||||
node = drawState(diagram2, stateDef, graph);
|
||||
}
|
||||
if (stateDef.note) {
|
||||
const noteDef = {
|
||||
descriptions: [],
|
||||
id: stateDef.id + "-note",
|
||||
note: stateDef.note,
|
||||
type: "note"
|
||||
};
|
||||
const note = drawState(diagram2, noteDef, graph);
|
||||
if (stateDef.note.position === "left of") {
|
||||
graph.setNode(node.id + "-note", note);
|
||||
graph.setNode(node.id, node);
|
||||
} else {
|
||||
graph.setNode(node.id, node);
|
||||
graph.setNode(node.id + "-note", note);
|
||||
}
|
||||
graph.setParent(node.id, node.id + "-group");
|
||||
graph.setParent(node.id + "-note", node.id + "-group");
|
||||
} else {
|
||||
graph.setNode(node.id, node);
|
||||
}
|
||||
}
|
||||
log.debug("Count=", graph.nodeCount(), graph);
|
||||
let cnt = 0;
|
||||
relations.forEach(function(relation) {
|
||||
cnt++;
|
||||
log.debug("Setting edge", relation);
|
||||
graph.setEdge(
|
||||
relation.id1,
|
||||
relation.id2,
|
||||
{
|
||||
relation,
|
||||
width: getLabelWidth(relation.title),
|
||||
height: conf.labelHeight * common_default.getRows(relation.title).length,
|
||||
labelpos: "c"
|
||||
},
|
||||
"id" + cnt
|
||||
);
|
||||
});
|
||||
layout(graph);
|
||||
log.debug("Graph after layout", graph.nodes());
|
||||
const svgElem = diagram2.node();
|
||||
graph.nodes().forEach(function(v) {
|
||||
if (v !== void 0 && graph.node(v) !== void 0) {
|
||||
log.warn("Node " + v + ": " + JSON.stringify(graph.node(v)));
|
||||
root.select("#" + svgElem.id + " #" + v).attr(
|
||||
"transform",
|
||||
"translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + " )"
|
||||
);
|
||||
root.select("#" + svgElem.id + " #" + v).attr("data-x-shift", graph.node(v).x - graph.node(v).width / 2);
|
||||
const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v + " .divider");
|
||||
dividers.forEach((divider) => {
|
||||
const parent = divider.parentElement;
|
||||
let pWidth = 0;
|
||||
let pShift = 0;
|
||||
if (parent) {
|
||||
if (parent.parentElement) {
|
||||
pWidth = parent.parentElement.getBBox().width;
|
||||
}
|
||||
pShift = parseInt(parent.getAttribute("data-x-shift"), 10);
|
||||
if (Number.isNaN(pShift)) {
|
||||
pShift = 0;
|
||||
}
|
||||
}
|
||||
divider.setAttribute("x1", 0 - pShift + 8);
|
||||
divider.setAttribute("x2", pWidth - pShift - 8);
|
||||
});
|
||||
} else {
|
||||
log.debug("No Node " + v + ": " + JSON.stringify(graph.node(v)));
|
||||
}
|
||||
});
|
||||
let stateBox = svgElem.getBBox();
|
||||
graph.edges().forEach(function(e) {
|
||||
if (e !== void 0 && graph.edge(e) !== void 0) {
|
||||
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
|
||||
drawEdge(diagram2, graph.edge(e), graph.edge(e).relation);
|
||||
}
|
||||
});
|
||||
stateBox = svgElem.getBBox();
|
||||
const stateInfo = {
|
||||
id: parentId ? parentId : "root",
|
||||
label: parentId ? parentId : "root",
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
stateInfo.width = stateBox.width + 2 * conf.padding;
|
||||
stateInfo.height = stateBox.height + 2 * conf.padding;
|
||||
log.debug("Doc rendered", stateInfo, graph);
|
||||
return stateInfo;
|
||||
}, "renderDoc");
|
||||
var stateRenderer_default = {
|
||||
setConf,
|
||||
draw
|
||||
};
|
||||
|
||||
// src/diagrams/state/stateDiagram.ts
|
||||
var diagram = {
|
||||
parser: stateDiagram_default,
|
||||
get db() {
|
||||
return new StateDB(1);
|
||||
},
|
||||
renderer: stateRenderer_default,
|
||||
styles: styles_default,
|
||||
init: /* @__PURE__ */ __name((cnf) => {
|
||||
if (!cnf.state) {
|
||||
cnf.state = {};
|
||||
}
|
||||
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||
}, "init")
|
||||
};
|
||||
export {
|
||||
diagram
|
||||
};
|
||||
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
Generated
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
import {
|
||||
TreemapModule,
|
||||
createTreemapServices
|
||||
} from "./chunk-NUOAVMUD.mjs";
|
||||
import "./chunk-S3MDV2AR.mjs";
|
||||
import "./chunk-MFRUYFWM.mjs";
|
||||
import "./chunk-UKL4YMJ2.mjs";
|
||||
import "./chunk-3QJOF6JT.mjs";
|
||||
import "./chunk-FQFHLQFH.mjs";
|
||||
export {
|
||||
TreemapModule,
|
||||
createTreemapServices
|
||||
};
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": [],
|
||||
"sourcesContent": [],
|
||||
"mappings": "",
|
||||
"names": []
|
||||
}
|
||||
Generated
Vendored
+7
File diff suppressed because one or more lines are too long
+8
@@ -0,0 +1,8 @@
|
||||
import type { Direction } from '../../src/diagrams/block/blockTypes.js';
|
||||
export declare const getArrowPoints: (duplicatedDirections: Direction[], bbox: {
|
||||
width: number;
|
||||
height: number;
|
||||
}, node: any) => {
|
||||
x: any;
|
||||
y: number;
|
||||
}[];
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export function insertCluster(elem: any, node: any): Promise<void>;
|
||||
export function getClusterTitleWidth(elem: any, node: any): Promise<any>;
|
||||
export function clear(): void;
|
||||
export function positionCluster(node: any): void;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user