mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-22 22:45:42 -06:00
Merge branch 'nunocoracao:main' into main
This commit is contained in:
commit
3f476412ac
1519 changed files with 5907 additions and 1390942 deletions
21
.github/workflows/create-config-zip.yml
vendored
Normal file
21
.github/workflows/create-config-zip.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
name: Create ZIP
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
zip:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- run: zip -r config-default.zip config/_default
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: config-default
|
||||||
|
path: config-default.zip
|
||||||
|
- name: Upload to release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: config-default.zip
|
||||||
|
tag_name: ${{ github.event.release.tag_name }}
|
2
.github/workflows/hugo-version-update.yml
vendored
2
.github/workflows/hugo-version-update.yml
vendored
|
@ -37,7 +37,7 @@ jobs:
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: steps.git-check.outputs.modified == 'true'
|
if: steps.git-check.outputs.modified == 'true'
|
||||||
uses: peter-evans/create-pull-request@v6
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
commit-message: Update Hugo supported version
|
commit-message: Update Hugo supported version
|
||||||
title: ⚙️ Update Hugo supported version
|
title: ⚙️ Update Hugo supported version
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
English | [简体中文](https://github.com/nunocoracao/blowfish/blob/main/README.zh-cn.md)
|
||||||
# Blowfish
|
# Blowfish
|
||||||
[![Deploy Production to Firebase](https://github.com/nunocoracao/blowfish/actions/workflows/firebase-production.yml/badge.svg)](https://github.com/nunocoracao/blowfish/actions/workflows/firebase-production.yml)
|
[![Deploy Production to Firebase](https://github.com/nunocoracao/blowfish/actions/workflows/firebase-production.yml/badge.svg)](https://github.com/nunocoracao/blowfish/actions/workflows/firebase-production.yml)
|
||||||
[![Deploy Production to GitHub pages](https://github.com/nunocoracao/blowfish/actions/workflows/pages.yml/badge.svg)](https://github.com/nunocoracao/blowfish/actions/workflows/pages.yml)
|
[![Deploy Production to GitHub pages](https://github.com/nunocoracao/blowfish/actions/workflows/pages.yml/badge.svg)](https://github.com/nunocoracao/blowfish/actions/workflows/pages.yml)
|
||||||
|
@ -118,7 +119,7 @@ blowfish-tools new mynewsite
|
||||||
|
|
||||||
3. In the root folder of your website, delete the `config.toml` file that was generated by Hugo. Copy the `*.toml` config files from the theme into your `config/_default/` folder.
|
3. In the root folder of your website, delete the `config.toml` file that was generated by Hugo. Copy the `*.toml` config files from the theme into your `config/_default/` folder.
|
||||||
|
|
||||||
You will find these theme config files in the Hugo cache directory, or [download a copy](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/nunocoracao/blowfish/tree/main/config/_default) from GitHub.
|
You will find these theme config files in the Hugo cache directory, or [download a copy](https://github.com/nunocoracao/blowfish/releases/latest/download/config-default.zip) from GitHub.
|
||||||
|
|
||||||
4. Follow the [Getting Started](https://blowfish.page/docs/getting-started/) instructions to configure your website.
|
4. Follow the [Getting Started](https://blowfish.page/docs/getting-started/) instructions to configure your website.
|
||||||
|
|
||||||
|
@ -141,11 +142,11 @@ blowfish-tools new mynewsite
|
||||||
|
|
||||||
3. Start your server using `hugo server` and the theme will be downloaded automatically.
|
3. Start your server using `hugo server` and the theme will be downloaded automatically.
|
||||||
|
|
||||||
4. In the root folder of your website, delete the `config.toml` file that was generated by Hugo. Copy the `*.toml` config files from the theme into your `config/_default/` folder.
|
4. In the root folder of your website, delete the `hugo.toml` file that was generated by Hugo. Copy the `*.toml` config files from the theme into your `config/_default/` folder.
|
||||||
|
|
||||||
> **Note:** Do not overwrite the `module.toml` file you created above!
|
> **Note:** Do not overwrite the `module.toml` file you created above!
|
||||||
|
|
||||||
You will find these theme config files in the Hugo cache directory, or [download a copy](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/nunocoracao/blowfish/tree/main/config/_default) from GitHub.
|
You will find these theme config files in the Hugo cache directory, or [download a copy](https://github.com/nunocoracao/blowfish/releases/latest/download/config-default.zip) from GitHub.
|
||||||
|
|
||||||
5. Follow the [Getting Started](https://blowfish.page/docs/getting-started/) instructions to configure your website.
|
5. Follow the [Getting Started](https://blowfish.page/docs/getting-started/) instructions to configure your website.
|
||||||
|
|
||||||
|
|
176
README.zh-cn.md
Normal file
176
README.zh-cn.md
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
[English](https://github.com/nunocoracao/blowfish/blob/main/README.md) | 简体中文
|
||||||
|
# Blowfish
|
||||||
|
[![Deploy Production to Firebase](https://github.com/nunocoracao/blowfish/actions/workflows/firebase-production.yml/badge.svg)](https://github.com/nunocoracao/blowfish/actions/workflows/firebase-production.yml)
|
||||||
|
[![Deploy Production to GitHub pages](https://github.com/nunocoracao/blowfish/actions/workflows/pages.yml/badge.svg)](https://github.com/nunocoracao/blowfish/actions/workflows/pages.yml)
|
||||||
|
[![Minimum Hugo Version](https://img.shields.io/static/v1?label=min-HUGO-version&message=0.87.0&color=blue&logo=hugo)](https://github.com/gohugoio/hugo/releases/tag/v0.87.0)
|
||||||
|
[![GitHub](https://img.shields.io/github/license/nunocoracao/blowfish)](https://github.com/nunocoracao/blowfish/blob/main/LICENSE)
|
||||||
|
[![Blowfish](https://img.shields.io/badge/Hugo--Themes-@Blowfish-blue)](https://themes.gohugo.io/themes/blowfish/)
|
||||||
|
![code-size](https://img.shields.io/github/languages/code-size/nunocoracao/blowfish)
|
||||||
|
|
||||||
|
Blowfish 是一个轻量有力的 Hugo 主题。它使用 Tailwind CSS 构建,洁净而富有极简主义,是你网站内容载体的不二之选。
|
||||||
|
|
||||||
|
![blowfish screenshot](https://github.com/nunocoracao/blowfish/blob/main/images/screenshot.png?raw=true)
|
||||||
|
|
||||||
|
|
||||||
|
🌏 [示例站点](https://blowfish.page/zh-cn/)
|
||||||
|
📑 [主题文档](https://blowfish.page/zh-cn/docs/)
|
||||||
|
💎 [周边商店](http://tee.pub/lic/qwSlWVBL5zc)
|
||||||
|
🐛 [Bug 问题报告](https://github.com/nunocoracao/blowfish/issues)
|
||||||
|
💡 [问答和功能需求](https://github.com/nunocoracao/blowfish/discussions)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a href="https://www.buymeacoffee.com/nunocoracao" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
||||||
|
<a target="_blank" href="http://tee.pub/lic/qwSlWVBL5zc"><img class="nozoom" src="https://img.buymeacoffee.com/button-api/?text=Merch Store &emoji=💎&slug=nunocoracao&button_colour=5F7FFF&font_colour=ffffff&font_family=Lato&outline_colour=000000&coffee_colour=FFDD00" /></a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 特性
|
||||||
|
|
||||||
|
- 使用 Tailwind CSS 3.0 构建全面响应式布局
|
||||||
|
- 多种配色方案,亦可完全由你定义
|
||||||
|
- 夜间模式支持(手动开启/关闭或根据用户设备自动切换)
|
||||||
|
- 高度自主的配置方式
|
||||||
|
- 集成 Firebase 以支持动态数据统计
|
||||||
|
- 集成浏览次数统计和点赞机制
|
||||||
|
- “相关文章”列表生成
|
||||||
|
- 多种主页布局
|
||||||
|
- 多作者模式支持
|
||||||
|
- 可将文章整理成选集列表
|
||||||
|
- 禅模式支持
|
||||||
|
- 可灵活定义各种内容类型、分类标准和菜单
|
||||||
|
- 页眉和页脚双重菜单可选
|
||||||
|
- 支持嵌套菜单和子导航菜单
|
||||||
|
- 支持多语言内容,包括 RTL 语言
|
||||||
|
- 可链接到第三方网站上的帖子
|
||||||
|
- 支持多种简码,如图库、时间轴、GitHub 卡片和图片灯箱
|
||||||
|
- 支持 Buymeacoffee
|
||||||
|
- 拥有由 Fuse.js 支持的客户端一侧网站搜索功能
|
||||||
|
- 植入了基于 Mermaid 的图表功能
|
||||||
|
- 植入了基于 Chart.js 的图表功能
|
||||||
|
- 集成逼真的自动打字效果
|
||||||
|
- 集成性能优化的 Youtube 卡片简码
|
||||||
|
- 集成 KaTeX 的公式
|
||||||
|
- 集成 FontAwesome 6 的矢量图标引用
|
||||||
|
- 使用 Hugo Pipes 自动调整图像大小
|
||||||
|
- 拥有标题锚点、目录、代码复制、按钮、分类徽章等功能
|
||||||
|
- 文章内部支持 HTML 和 Emoji 🎉
|
||||||
|
- 便于搜索引擎优化,文章可一键分享到社交媒体
|
||||||
|
- 支持 Fathom Analytics 和 Google Analytics
|
||||||
|
- 支持 RSS 订阅、网站图标和评论功能
|
||||||
|
- 可使用简单的 Tailwind 对颜色和样式进行高级定制
|
||||||
|
- 优化了性能和可访问性,拥有极高的 Lighthouse 评分
|
||||||
|
- 文档齐全,定期更新
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
![blowfish logo](https://github.com/nunocoracao/blowfish/blob/main/logo.png?raw=true)
|
||||||
|
|
||||||
|
## 文档
|
||||||
|
Blowfish 有 [全面的文档](https://blowfish.page/zh-cn/docs/),覆盖主题的任何一个方面。 请确保 [阅读文档](https://blowfish.page/zh-cn/docs/) 以详细了解本主题有哪些功能。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
Blowfish 支持多种安装方式,既能作为 git 子模块、Hugo 模块,也可完全手动安装。
|
||||||
|
|
||||||
|
每种方法的详细说明都可以在 [安装](https://blowfish.page/zh-cn/docs/installation) 文档中找到。为了获得最简单的安装体验,请查阅文档。如果你使用的是 git,请阅读下面使用子模块的快速开始指南;如果你能安装 Hugo 主题,请阅读下面 Hugo 模块的快速开始指南。
|
||||||
|
|
||||||
|
### 使用 Blowfish Tools 快速开始
|
||||||
|
|
||||||
|
> **注:** 请确保你已安装 **Node.js**、 **Git**、 **Go** 和 **Hugo** ,且已经创建了一个 Hugo 工程。
|
||||||
|
|
||||||
|
我们最新推出了一个新的 CLI 工具,帮助你开始使用 Blowfish。它将为你创建一个新的 Hugo 项目、安装主题并设置主题配置文件。它仍处于测试阶段,因此请 [报告你发现的任何问题](https://github.com/nunocoracao/blowfish-tools)。
|
||||||
|
|
||||||
|
使用 npm(或其他软件包管理器)全局安装 CLI 工具:
|
||||||
|
```shell
|
||||||
|
npm i -g blowfish-tools
|
||||||
|
```
|
||||||
|
|
||||||
|
然后运行 "blowfish-tools "命令,开启一个交互式进程,引导你完成创建和配置。
|
||||||
|
```shell
|
||||||
|
blowfish-tools
|
||||||
|
```
|
||||||
|
|
||||||
|
你也可以运行命令 `blowfish-tools new` 来创建一个新的 Hugo 项目,并一次性安装主题。更多信息请查看 CLI 帮助。
|
||||||
|
```shell
|
||||||
|
blowfish-tools new mynewsite
|
||||||
|
```
|
||||||
|
|
||||||
|
### 使用 git 子模块快速开始
|
||||||
|
|
||||||
|
> **注:** 请确保你已安装 **Node.js**、 **Git**、 **Go** 和 **Hugo** ,且已经创建了一个 Hugo 工程。
|
||||||
|
|
||||||
|
1. 从你工程的所在目录初始化 git 仓库
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git init
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 配置 Blowfish 作为 git 子模块
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git submodule add -b main https://github.com/nunocoracao/blowfish.git themes/blowfish
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 在你网站的根目录中删除由 Hugo 自动生成的 `config.toml`文件,并把主题文件夹中的`*.toml`配置文件复制到你的 `config/_default/`文件夹中
|
||||||
|
|
||||||
|
你可在 Hugo 缓存目录中找到主题配置文件,或者也可以从[这里](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/nunocoracao/blowfish/tree/main/config/_default)下载一份。
|
||||||
|
|
||||||
|
4. 按照[入门指南](https://blowfish.page/zh-cn/docs/getting-started/)来配置你的网站
|
||||||
|
|
||||||
|
### 使用 Hugo 快速开始
|
||||||
|
|
||||||
|
> **注:** 确保你已经安装了 **Go** 和 **Hugo**,且已创建了一个 Hugo 工程。
|
||||||
|
|
||||||
|
1. 从你工程的所在目录初始化 Hugo 模块
|
||||||
|
|
||||||
|
```shell
|
||||||
|
hugo mod init github.com/<用户名>/<仓库名>
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 新建 `config/_default/module.toml` 并写入以下内容:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[imports]]
|
||||||
|
path = "github.com/nunocoracao/blowfish/v2"
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 运行 `hugo server` 启动你的本地服务器,本主题就会自动下载。
|
||||||
|
|
||||||
|
4. 在你网站的根目录中删除由 Hugo 自动生成的 `config.toml`文件,并把主题文件夹中的`*.toml`配置文件复制到你的 `config/_default/`文件夹中
|
||||||
|
|
||||||
|
> **注** 不要覆盖之前的 `module.toml` !
|
||||||
|
|
||||||
|
你可在 Hugo 缓存目录中找到主题配置文件,或者也可以从[这里](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/nunocoracao/blowfish/tree/main/config/_default)下载一份。
|
||||||
|
|
||||||
|
5. 按照[入门指南](https://blowfish.page/zh-cn/docs/getting-started/)来配置你的网站
|
||||||
|
|
||||||
|
### Installing theme updates
|
||||||
|
|
||||||
|
当新的主题版本发布,你可以在你网站的根目录使用 Hugo 命令`hugo mod get -u`来简单地把主题更新到最新版本。
|
||||||
|
|
||||||
|
详细的[更新指南](https://blowfish.page/zh-cn/docs/installation/#%E6%9B%B4%E6%96%B0%E4%B8%BB%E9%A2%98)在文档中。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 贡献
|
||||||
|
|
||||||
|
Blowfish 将会持续进化。我打算不断增加功能,并按需进行修改。
|
||||||
|
|
||||||
|
如有任何问题或对新功能的建议,请随时联系我。
|
||||||
|
|
||||||
|
- 🐛 **Bug 问题报告** 使用 [GitHub Issues](https://github.com/nunocoracao/blowfish/issues)
|
||||||
|
- 💡 **发表关于新功能的想法:** 在 [GitHub Discussions](https://github.com/nunocoracao/blowfish/discussions) 发起讨论
|
||||||
|
- 🙋♀️ **一般问题:** 查看 [GitHub Discussions](https://github.com/nunocoracao/blowfish/discussions)
|
||||||
|
|
||||||
|
如果你有能力修补 Bug 或者实现新功能,欢迎提交 PR。[了解更多](https://github.com/nunocoracao/blowfish/blob/main/CONTRIBUTING.md).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Star 数量统计
|
||||||
|
|
||||||
|
[![Stargazers over time](https://starchart.cc/nunocoracao/blowfish.svg)](https://starchart.cc/nunocoracao/blowfish)
|
||||||
|
|
||||||
|
<a rel="me" href="https://masto.ai/@blowfish">Mastodon</a>
|
|
@ -14,7 +14,115 @@ body.zen-mode-enable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com */
|
*, ::before, ::after {
|
||||||
|
--tw-border-spacing-x:0;
|
||||||
|
--tw-border-spacing-y:0;
|
||||||
|
--tw-translate-x:0;
|
||||||
|
--tw-translate-y:0;
|
||||||
|
--tw-rotate:0;
|
||||||
|
--tw-skew-x:0;
|
||||||
|
--tw-skew-y:0;
|
||||||
|
--tw-scale-x:1;
|
||||||
|
--tw-scale-y:1;
|
||||||
|
--tw-pan-x: ;
|
||||||
|
--tw-pan-y: ;
|
||||||
|
--tw-pinch-zoom: ;
|
||||||
|
--tw-scroll-snap-strictness:proximity;
|
||||||
|
--tw-gradient-from-position: ;
|
||||||
|
--tw-gradient-via-position: ;
|
||||||
|
--tw-gradient-to-position: ;
|
||||||
|
--tw-ordinal: ;
|
||||||
|
--tw-slashed-zero: ;
|
||||||
|
--tw-numeric-figure: ;
|
||||||
|
--tw-numeric-spacing: ;
|
||||||
|
--tw-numeric-fraction: ;
|
||||||
|
--tw-ring-inset: ;
|
||||||
|
--tw-ring-offset-width:0px;
|
||||||
|
--tw-ring-offset-color:#fff;
|
||||||
|
--tw-ring-color:rgb(59 130 246 / 0.5);
|
||||||
|
--tw-ring-offset-shadow:0 0 #0000;
|
||||||
|
--tw-ring-shadow:0 0 #0000;
|
||||||
|
--tw-shadow:0 0 #0000;
|
||||||
|
--tw-shadow-colored:0 0 #0000;
|
||||||
|
--tw-blur: ;
|
||||||
|
--tw-brightness: ;
|
||||||
|
--tw-contrast: ;
|
||||||
|
--tw-grayscale: ;
|
||||||
|
--tw-hue-rotate: ;
|
||||||
|
--tw-invert: ;
|
||||||
|
--tw-saturate: ;
|
||||||
|
--tw-sepia: ;
|
||||||
|
--tw-drop-shadow: ;
|
||||||
|
--tw-backdrop-blur: ;
|
||||||
|
--tw-backdrop-brightness: ;
|
||||||
|
--tw-backdrop-contrast: ;
|
||||||
|
--tw-backdrop-grayscale: ;
|
||||||
|
--tw-backdrop-hue-rotate: ;
|
||||||
|
--tw-backdrop-invert: ;
|
||||||
|
--tw-backdrop-opacity: ;
|
||||||
|
--tw-backdrop-saturate: ;
|
||||||
|
--tw-backdrop-sepia: ;
|
||||||
|
--tw-contain-size: ;
|
||||||
|
--tw-contain-layout: ;
|
||||||
|
--tw-contain-paint: ;
|
||||||
|
--tw-contain-style:
|
||||||
|
}
|
||||||
|
|
||||||
|
::backdrop {
|
||||||
|
--tw-border-spacing-x:0;
|
||||||
|
--tw-border-spacing-y:0;
|
||||||
|
--tw-translate-x:0;
|
||||||
|
--tw-translate-y:0;
|
||||||
|
--tw-rotate:0;
|
||||||
|
--tw-skew-x:0;
|
||||||
|
--tw-skew-y:0;
|
||||||
|
--tw-scale-x:1;
|
||||||
|
--tw-scale-y:1;
|
||||||
|
--tw-pan-x: ;
|
||||||
|
--tw-pan-y: ;
|
||||||
|
--tw-pinch-zoom: ;
|
||||||
|
--tw-scroll-snap-strictness:proximity;
|
||||||
|
--tw-gradient-from-position: ;
|
||||||
|
--tw-gradient-via-position: ;
|
||||||
|
--tw-gradient-to-position: ;
|
||||||
|
--tw-ordinal: ;
|
||||||
|
--tw-slashed-zero: ;
|
||||||
|
--tw-numeric-figure: ;
|
||||||
|
--tw-numeric-spacing: ;
|
||||||
|
--tw-numeric-fraction: ;
|
||||||
|
--tw-ring-inset: ;
|
||||||
|
--tw-ring-offset-width:0px;
|
||||||
|
--tw-ring-offset-color:#fff;
|
||||||
|
--tw-ring-color:rgb(59 130 246 / 0.5);
|
||||||
|
--tw-ring-offset-shadow:0 0 #0000;
|
||||||
|
--tw-ring-shadow:0 0 #0000;
|
||||||
|
--tw-shadow:0 0 #0000;
|
||||||
|
--tw-shadow-colored:0 0 #0000;
|
||||||
|
--tw-blur: ;
|
||||||
|
--tw-brightness: ;
|
||||||
|
--tw-contrast: ;
|
||||||
|
--tw-grayscale: ;
|
||||||
|
--tw-hue-rotate: ;
|
||||||
|
--tw-invert: ;
|
||||||
|
--tw-saturate: ;
|
||||||
|
--tw-sepia: ;
|
||||||
|
--tw-drop-shadow: ;
|
||||||
|
--tw-backdrop-blur: ;
|
||||||
|
--tw-backdrop-brightness: ;
|
||||||
|
--tw-backdrop-contrast: ;
|
||||||
|
--tw-backdrop-grayscale: ;
|
||||||
|
--tw-backdrop-hue-rotate: ;
|
||||||
|
--tw-backdrop-invert: ;
|
||||||
|
--tw-backdrop-opacity: ;
|
||||||
|
--tw-backdrop-saturate: ;
|
||||||
|
--tw-backdrop-sepia: ;
|
||||||
|
--tw-contain-size: ;
|
||||||
|
--tw-contain-layout: ;
|
||||||
|
--tw-contain-paint: ;
|
||||||
|
--tw-contain-style:
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! tailwindcss v3.4.14 | MIT License | https://tailwindcss.com */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
||||||
|
@ -456,7 +564,7 @@ video {
|
||||||
|
|
||||||
/* Make elements with the HTML hidden attribute stay hidden by default */
|
/* Make elements with the HTML hidden attribute stay hidden by default */
|
||||||
|
|
||||||
[hidden] {
|
[hidden]:where(:not([hidden="until-found"])) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,114 +770,6 @@ select {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*, ::before, ::after {
|
|
||||||
--tw-border-spacing-x:0;
|
|
||||||
--tw-border-spacing-y:0;
|
|
||||||
--tw-translate-x:0;
|
|
||||||
--tw-translate-y:0;
|
|
||||||
--tw-rotate:0;
|
|
||||||
--tw-skew-x:0;
|
|
||||||
--tw-skew-y:0;
|
|
||||||
--tw-scale-x:1;
|
|
||||||
--tw-scale-y:1;
|
|
||||||
--tw-pan-x: ;
|
|
||||||
--tw-pan-y: ;
|
|
||||||
--tw-pinch-zoom: ;
|
|
||||||
--tw-scroll-snap-strictness:proximity;
|
|
||||||
--tw-gradient-from-position: ;
|
|
||||||
--tw-gradient-via-position: ;
|
|
||||||
--tw-gradient-to-position: ;
|
|
||||||
--tw-ordinal: ;
|
|
||||||
--tw-slashed-zero: ;
|
|
||||||
--tw-numeric-figure: ;
|
|
||||||
--tw-numeric-spacing: ;
|
|
||||||
--tw-numeric-fraction: ;
|
|
||||||
--tw-ring-inset: ;
|
|
||||||
--tw-ring-offset-width:0px;
|
|
||||||
--tw-ring-offset-color:#fff;
|
|
||||||
--tw-ring-color:rgb(59 130 246 / 0.5);
|
|
||||||
--tw-ring-offset-shadow:0 0 #0000;
|
|
||||||
--tw-ring-shadow:0 0 #0000;
|
|
||||||
--tw-shadow:0 0 #0000;
|
|
||||||
--tw-shadow-colored:0 0 #0000;
|
|
||||||
--tw-blur: ;
|
|
||||||
--tw-brightness: ;
|
|
||||||
--tw-contrast: ;
|
|
||||||
--tw-grayscale: ;
|
|
||||||
--tw-hue-rotate: ;
|
|
||||||
--tw-invert: ;
|
|
||||||
--tw-saturate: ;
|
|
||||||
--tw-sepia: ;
|
|
||||||
--tw-drop-shadow: ;
|
|
||||||
--tw-backdrop-blur: ;
|
|
||||||
--tw-backdrop-brightness: ;
|
|
||||||
--tw-backdrop-contrast: ;
|
|
||||||
--tw-backdrop-grayscale: ;
|
|
||||||
--tw-backdrop-hue-rotate: ;
|
|
||||||
--tw-backdrop-invert: ;
|
|
||||||
--tw-backdrop-opacity: ;
|
|
||||||
--tw-backdrop-saturate: ;
|
|
||||||
--tw-backdrop-sepia: ;
|
|
||||||
--tw-contain-size: ;
|
|
||||||
--tw-contain-layout: ;
|
|
||||||
--tw-contain-paint: ;
|
|
||||||
--tw-contain-style:
|
|
||||||
}
|
|
||||||
|
|
||||||
::backdrop {
|
|
||||||
--tw-border-spacing-x:0;
|
|
||||||
--tw-border-spacing-y:0;
|
|
||||||
--tw-translate-x:0;
|
|
||||||
--tw-translate-y:0;
|
|
||||||
--tw-rotate:0;
|
|
||||||
--tw-skew-x:0;
|
|
||||||
--tw-skew-y:0;
|
|
||||||
--tw-scale-x:1;
|
|
||||||
--tw-scale-y:1;
|
|
||||||
--tw-pan-x: ;
|
|
||||||
--tw-pan-y: ;
|
|
||||||
--tw-pinch-zoom: ;
|
|
||||||
--tw-scroll-snap-strictness:proximity;
|
|
||||||
--tw-gradient-from-position: ;
|
|
||||||
--tw-gradient-via-position: ;
|
|
||||||
--tw-gradient-to-position: ;
|
|
||||||
--tw-ordinal: ;
|
|
||||||
--tw-slashed-zero: ;
|
|
||||||
--tw-numeric-figure: ;
|
|
||||||
--tw-numeric-spacing: ;
|
|
||||||
--tw-numeric-fraction: ;
|
|
||||||
--tw-ring-inset: ;
|
|
||||||
--tw-ring-offset-width:0px;
|
|
||||||
--tw-ring-offset-color:#fff;
|
|
||||||
--tw-ring-color:rgb(59 130 246 / 0.5);
|
|
||||||
--tw-ring-offset-shadow:0 0 #0000;
|
|
||||||
--tw-ring-shadow:0 0 #0000;
|
|
||||||
--tw-shadow:0 0 #0000;
|
|
||||||
--tw-shadow-colored:0 0 #0000;
|
|
||||||
--tw-blur: ;
|
|
||||||
--tw-brightness: ;
|
|
||||||
--tw-contrast: ;
|
|
||||||
--tw-grayscale: ;
|
|
||||||
--tw-hue-rotate: ;
|
|
||||||
--tw-invert: ;
|
|
||||||
--tw-saturate: ;
|
|
||||||
--tw-sepia: ;
|
|
||||||
--tw-drop-shadow: ;
|
|
||||||
--tw-backdrop-blur: ;
|
|
||||||
--tw-backdrop-brightness: ;
|
|
||||||
--tw-backdrop-contrast: ;
|
|
||||||
--tw-backdrop-grayscale: ;
|
|
||||||
--tw-backdrop-hue-rotate: ;
|
|
||||||
--tw-backdrop-invert: ;
|
|
||||||
--tw-backdrop-opacity: ;
|
|
||||||
--tw-backdrop-saturate: ;
|
|
||||||
--tw-backdrop-sepia: ;
|
|
||||||
--tw-contain-size: ;
|
|
||||||
--tw-contain-layout: ;
|
|
||||||
--tw-contain-paint: ;
|
|
||||||
--tw-contain-style:
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
width:100%
|
width:100%
|
||||||
}
|
}
|
||||||
|
@ -1121,7 +1121,6 @@ select {
|
||||||
.prose :where(table):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
.prose :where(table):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
||||||
width:100%;
|
width:100%;
|
||||||
table-layout:auto;
|
table-layout:auto;
|
||||||
text-align:start;
|
|
||||||
margin-top:2em;
|
margin-top:2em;
|
||||||
margin-bottom:2em;
|
margin-bottom:2em;
|
||||||
font-size:0.875em;
|
font-size:0.875em;
|
||||||
|
@ -1164,6 +1163,10 @@ select {
|
||||||
vertical-align:top
|
vertical-align:top
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.prose :where(th, td):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
||||||
|
text-align:start
|
||||||
|
}
|
||||||
|
|
||||||
.prose :where(figure > *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
.prose :where(figure > *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
||||||
margin-top:0;
|
margin-top:0;
|
||||||
margin-bottom:0
|
margin-bottom:0
|
||||||
|
@ -2523,10 +2526,6 @@ select {
|
||||||
padding:0px
|
padding:0px
|
||||||
}
|
}
|
||||||
|
|
||||||
.p-1 {
|
|
||||||
padding:0.25rem
|
|
||||||
}
|
|
||||||
|
|
||||||
.p-1\.5 {
|
.p-1\.5 {
|
||||||
padding:0.375rem
|
padding:0.375rem
|
||||||
}
|
}
|
||||||
|
@ -3167,6 +3166,13 @@ body button {
|
||||||
width:1em
|
width:1em
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Scale SVG logos to appropriate size */
|
||||||
|
|
||||||
|
.logo svg {
|
||||||
|
height:5rem;
|
||||||
|
width:5rem
|
||||||
|
}
|
||||||
|
|
||||||
/* Search */
|
/* Search */
|
||||||
|
|
||||||
#search-query::-webkit-search-cancel-button,
|
#search-query::-webkit-search-cancel-button,
|
||||||
|
@ -3176,21 +3182,6 @@ body button {
|
||||||
display:none
|
display:none
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hamburger menu */
|
|
||||||
|
|
||||||
body:has(#menu-controller:checked) {
|
|
||||||
overflow-y:hidden
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu-button:has(#menu-controller:checked) {
|
|
||||||
visibility:hidden
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu-controller:checked~#menu-wrapper {
|
|
||||||
visibility:visible;
|
|
||||||
opacity:1
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RTL support */
|
/* RTL support */
|
||||||
|
|
||||||
.prose blockquote:where([dir="rtl"], [dir="rtl"] *) {
|
.prose blockquote:where([dir="rtl"], [dir="rtl"] *) {
|
||||||
|
@ -3350,6 +3341,14 @@ code {
|
||||||
/* Renamed property in CSS3 draft spec */
|
/* Renamed property in CSS3 draft spec */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fix long URLs breaking out of article bounds on mobile */
|
||||||
|
|
||||||
|
a {
|
||||||
|
word-break: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
/* -- Chroma Highlight -- */
|
/* -- Chroma Highlight -- */
|
||||||
|
|
||||||
/* Background */
|
/* Background */
|
||||||
|
|
|
@ -16,6 +16,11 @@ body button {
|
||||||
@apply h-[1em] w-[1em];
|
@apply h-[1em] w-[1em];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Scale SVG logos to appropriate size */
|
||||||
|
.logo svg {
|
||||||
|
@apply h-[5rem] w-[5rem];
|
||||||
|
}
|
||||||
|
|
||||||
/* Search */
|
/* Search */
|
||||||
#search-query::-webkit-search-cancel-button,
|
#search-query::-webkit-search-cancel-button,
|
||||||
#search-query::-webkit-search-decoration,
|
#search-query::-webkit-search-decoration,
|
||||||
|
@ -24,19 +29,6 @@ body button {
|
||||||
@apply hidden;
|
@apply hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hamburger menu */
|
|
||||||
body:has(#menu-controller:checked) {
|
|
||||||
@apply overflow-y-hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu-button:has(#menu-controller:checked) {
|
|
||||||
@apply invisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
#menu-controller:checked~#menu-wrapper {
|
|
||||||
@apply visible opacity-100;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RTL support */
|
/* RTL support */
|
||||||
.prose blockquote {
|
.prose blockquote {
|
||||||
@apply rtl:pr-4 rtl:border-l-0 rtl:border-r-4;
|
@apply rtl:pr-4 rtl:border-l-0 rtl:border-r-4;
|
||||||
|
@ -128,6 +120,13 @@ code {
|
||||||
overflow-wrap: break-word; /* Renamed property in CSS3 draft spec */
|
overflow-wrap: break-word; /* Renamed property in CSS3 draft spec */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fix long URLs breaking out of article bounds on mobile */
|
||||||
|
a {
|
||||||
|
word-break: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
/* -- Chroma Highlight -- */
|
/* -- Chroma Highlight -- */
|
||||||
/* Background */
|
/* Background */
|
||||||
.prose .chroma {
|
.prose .chroma {
|
||||||
|
|
1
assets/icons/forgejo.svg
Normal file
1
assets/icons/forgejo.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg viewBox="0 0 212 212" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="currentColor"><g style="opacity:.7"><path stroke-width="25" d="M64 174V76a50 50 0 0 1 50-50h20"/><circle stroke-width="15" cx="148" cy="26" r="18"/></g><path stroke-width="25" d="M64 174v-30a50 50 0 0 1 50-50h20"/><circle stroke-width="15" cx="148" cy="94" r="18"/><circle stroke-width="15" cx="64" cy="186" r="18"/></g></svg>
|
After Width: | Height: | Size: 411 B |
1
assets/icons/gitea.svg
Normal file
1
assets/icons/gitea.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="5.67 143.05 628.65 387.55"><path fill="currentColor" d="M115.912 143.075c-6.462 0-13.762.525-22.012 2.325-8.7 1.8-33.5 7.4-53.8 26.9C-4.9 212.4 6.6 276.2 8 285.8c1.7 11.7 6.9 44.2 31.7 72.5 45.8 56.1 144.4 54.8 144.4 54.8s12.1 28.9 30.6 55.5c25 33.1 50.7 58.9 75.7 62 63 0 188.9-.1 188.9-.1s12 .1 28.3-10.3c14-8.5 26.5-23.4 26.5-23.4S547 483 565 451.5c5.5-9.7 10.1-19.1 14.1-28 0 0 55.2-117.1 55.2-231.1-1.1-34.5-9.6-40.6-11.6-42.6-4.1-4.1-9.6-4-9.6-4s-117.2 6.6-177.9 8c-13.267.3-26.433.597-39.5.697l.1 117.002s57.4 24.202 83.1 40.102c3.7 2.3 10.2 6.798 12.9 14.398 2.1 6.1 2 13.101-1 19.301l-61 126.9c-6.2 12.7-21.4 18.1-33.9 12l-126.9-61c-12.5-6-17.9-21.2-11.8-33.8l61-126.9c6-12.5 21.2-17.9 33.8-11.8a5290.322 5290.322 0 0 0 27 12.954c0-36.449-.1-109.053-.1-109.053-29 .4-89.2-2.201-89.2-2.201s-141.4-7.1-156.8-8.5c-4.9-.3-10.525-.825-16.988-.825zm12.188 48.026s7.1 59.399 15.7 94.199c7.2 29.2 24.8 77.7 24.8 77.7s-26.1-3.1-43-9.1c-25.9-8.5-36.9-18.7-36.9-18.7S69.6 321.8 60 295.4c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5 38.5-30c13.8-3.7 31-3.1 31-3.1z"/><path fill="currentColor" d="M326.8 380.1c-8.2.1-15.4 5.8-17.3 13.8-1.9 8 2 16.3 9.1 20 7.7 4 17.5 1.8 22.7-5.4 5.1-7.1 4.3-16.9-1.8-23.1l24-49.1c1.5.1 3.7.2 6.2-.5 4.1-.9 7.1-3.6 7.1-3.6 4.2 1.8 8.6 3.8 13.2 6.1 4.8 2.4 9.3 4.9 13.4 7.3.9.5 1.8 1.1 2.8 1.9 1.6 1.3 3.4 3.1 4.7 5.5 1.9 5.5-1.9 14.9-1.9 14.9-2.3 7.6-18.4 40.6-18.4 40.6-8.1-.2-15.3 5-17.7 12.5-2.6 8.1 1.1 17.3 8.9 21.3 7.8 4 17.4 1.7 22.5-5.3 5-6.8 4.6-16.3-1.1-22.6 1.9-3.7 3.7-7.4 5.6-11.3 5-10.4 13.5-30.4 13.5-30.4.9-1.7 5.7-10.3 2.7-21.3-2.5-11.4-12.6-16.7-12.6-16.7-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3 4.7-9.7 9.4-19.3 14.1-29-4.1-2-8.1-4-12.2-6.1-4.8 9.8-9.7 19.7-14.5 29.5-6.7-.1-12.9 3.5-16.1 9.4-3.4 6.3-2.7 14.1 1.9 19.8l-24.6 50.4z"/></svg>
|
After Width: | Height: | Size: 1.8 KiB |
1
assets/icons/spotify.svg
Normal file
1
assets/icons/spotify.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8zm100.7 364.9c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4zm26.9-65.6c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm31-76.2c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3z"/></svg>
|
After Width: | Height: | Size: 889 B |
33
assets/js/mobilemenu.js
Normal file
33
assets/js/mobilemenu.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
var menuButton = document.getElementById("menu-button");
|
||||||
|
var menuCloseButton = document.getElementById("menu-close-button");
|
||||||
|
var menuWrapper = document.getElementById("menu-wrapper");
|
||||||
|
|
||||||
|
var menuOpen = false;
|
||||||
|
|
||||||
|
var openMenu = function (e) {
|
||||||
|
if (!menuOpen) {
|
||||||
|
menuOpen = true;
|
||||||
|
document.body.style.overflowY = "hidden";
|
||||||
|
menuButton.style.visibility = "hidden";
|
||||||
|
menuWrapper.style.visibility = "visible";
|
||||||
|
menuWrapper.style.opacity = "1";
|
||||||
|
window.onbeforeunload = function (event) {
|
||||||
|
closeMenu()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var closeMenu = function (e) {
|
||||||
|
if (menuOpen) {
|
||||||
|
menuOpen = false;
|
||||||
|
document.body.style.overflowY = "auto";
|
||||||
|
menuButton.style.visibility = "visible";
|
||||||
|
menuWrapper.style.visibility = "hidden";
|
||||||
|
menuWrapper.style.opacity = "0";
|
||||||
|
window.onbeforeunload = function (event) { }
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
menuButton.addEventListener("click", openMenu);
|
||||||
|
menuCloseButton.addEventListener("click", closeMenu);
|
|
@ -73,8 +73,6 @@ document.addEventListener("keydown", function (event) {
|
||||||
} else {
|
} else {
|
||||||
document.activeElement.click();
|
document.activeElement.click();
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +153,11 @@ function executeQuery(term) {
|
||||||
|
|
||||||
if (results.length > 0) {
|
if (results.length > 0) {
|
||||||
results.forEach(function (value, key) {
|
results.forEach(function (value, key) {
|
||||||
|
console.log(value.item.summary);
|
||||||
|
var html = value.item.summary;
|
||||||
|
var div = document.createElement("div");
|
||||||
|
div.innerHTML = html;
|
||||||
|
value.item.summary = div.textContent || div.innerText || "";
|
||||||
var title = value.item.externalUrl? value.item.title + '<span class="text-xs ml-2 align-center cursor-default text-neutral-400 dark:text-neutral-500">'+value.item.externalUrl+'</span>' : value.item.title;
|
var title = value.item.externalUrl? value.item.title + '<span class="text-xs ml-2 align-center cursor-default text-neutral-400 dark:text-neutral-500">'+value.item.externalUrl+'</span>' : value.item.title;
|
||||||
var linkconfig = value.item.externalUrl? 'target="_blank" rel="noopener" href="'+value.item.externalUrl+'"' : 'href="'+value.item.permalink+'"';
|
var linkconfig = value.item.externalUrl? 'target="_blank" rel="noopener" href="'+value.item.externalUrl+'"' : 'href="'+value.item.permalink+'"';
|
||||||
resultsHTML =
|
resultsHTML =
|
||||||
|
|
6
assets/lib/chart/chart.min.js
vendored
6
assets/lib/chart/chart.min.js
vendored
File diff suppressed because one or more lines are too long
2
assets/lib/katex/katex.min.css
vendored
2
assets/lib/katex/katex.min.css
vendored
File diff suppressed because one or more lines are too long
2
assets/lib/katex/katex.min.js
vendored
2
assets/lib/katex/katex.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -46,10 +46,23 @@ class LiteYTEmbed extends HTMLElement {
|
||||||
|
|
||||||
this.addNoscriptIframe();
|
this.addNoscriptIframe();
|
||||||
|
|
||||||
|
// for the PE pattern, change anchor's semantics to button
|
||||||
|
if(playBtnEl.nodeName === 'A'){
|
||||||
playBtnEl.removeAttribute('href');
|
playBtnEl.removeAttribute('href');
|
||||||
|
playBtnEl.setAttribute('tabindex', '0');
|
||||||
|
playBtnEl.setAttribute('role', 'button');
|
||||||
|
// fake button needs keyboard help
|
||||||
|
playBtnEl.addEventListener('keydown', e => {
|
||||||
|
if( e.key === 'Enter' || e.key === ' ' ){
|
||||||
|
e.preventDefault();
|
||||||
|
this.activate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// On hover (or tap), warm up the TCP connections we're (likely) about to use.
|
// On hover (or tap), warm up the TCP connections we're (likely) about to use.
|
||||||
this.addEventListener('pointerover', LiteYTEmbed.warmConnections, {once: true});
|
this.addEventListener('pointerover', LiteYTEmbed.warmConnections, {once: true});
|
||||||
|
this.addEventListener('focusin', LiteYTEmbed.warmConnections, {once: true});
|
||||||
|
|
||||||
// Once the user clicks, add the real iframe and drop our play button
|
// Once the user clicks, add the real iframe and drop our play button
|
||||||
// TODO: In the future we could be like amp-youtube and silently swap in the iframe during idle time
|
// TODO: In the future we could be like amp-youtube and silently swap in the iframe during idle time
|
||||||
|
|
33
assets/lib/mermaid/Diagram.d.ts
vendored
33
assets/lib/mermaid/Diagram.d.ts
vendored
|
@ -1,33 +0,0 @@
|
||||||
import type { DetailedError } from './utils.js';
|
|
||||||
import type { DiagramDefinition, DiagramMetadata } from './diagram-api/types.js';
|
|
||||||
export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;
|
|
||||||
/**
|
|
||||||
* An object representing a parsed mermaid diagram definition.
|
|
||||||
* @privateRemarks This is exported as part of the public mermaidAPI.
|
|
||||||
*/
|
|
||||||
export declare class Diagram {
|
|
||||||
text: string;
|
|
||||||
metadata: Pick<DiagramMetadata, 'title'>;
|
|
||||||
type: string;
|
|
||||||
parser: DiagramDefinition['parser'];
|
|
||||||
renderer: DiagramDefinition['renderer'];
|
|
||||||
db: DiagramDefinition['db'];
|
|
||||||
private init?;
|
|
||||||
private detectError?;
|
|
||||||
constructor(text: string, metadata?: Pick<DiagramMetadata, 'title'>);
|
|
||||||
parse(): void;
|
|
||||||
render(id: string, version: string): Promise<void>;
|
|
||||||
getParser(): import("./diagram-api/types.js").ParserDefinition;
|
|
||||||
getType(): string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Parse the text asynchronously and generate a Diagram object asynchronously.
|
|
||||||
* **Warning:** This function may be changed in the future.
|
|
||||||
* @alpha
|
|
||||||
* @param text - The mermaid diagram definition.
|
|
||||||
* @param metadata - Diagram metadata, defined in YAML.
|
|
||||||
* @returns A the Promise of a Diagram object.
|
|
||||||
* @throws {@link UnknownDiagramError} if the diagram type can not be found.
|
|
||||||
* @privateRemarks This is exported as part of the public mermaidAPI.
|
|
||||||
*/
|
|
||||||
export declare const getDiagramFromText: (text: string, metadata?: Pick<DiagramMetadata, 'title'>) => Promise<Diagram>;
|
|
|
@ -1,10 +0,0 @@
|
||||||
function colors(specifier) {
|
|
||||||
var n = specifier.length / 6 | 0, colors2 = new Array(n), i = 0;
|
|
||||||
while (i < n)
|
|
||||||
colors2[i] = "#" + specifier.slice(i * 6, ++i * 6);
|
|
||||||
return colors2;
|
|
||||||
}
|
|
||||||
const d3schemeTableau10 = colors("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
|
|
||||||
export {
|
|
||||||
d3schemeTableau10 as d
|
|
||||||
};
|
|
|
@ -1,9 +0,0 @@
|
||||||
function o(e) {
|
|
||||||
for (var c = e.length / 6 | 0, n = new Array(c), a = 0; a < c; )
|
|
||||||
n[a] = "#" + e.slice(a * 6, ++a * 6);
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
const r = o("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
|
|
||||||
export {
|
|
||||||
r as d
|
|
||||||
};
|
|
13
assets/lib/mermaid/__mocks__/mermaidAPI.d.ts
vendored
13
assets/lib/mermaid/__mocks__/mermaidAPI.d.ts
vendored
|
@ -1,13 +0,0 @@
|
||||||
export declare const mermaidAPI: {
|
|
||||||
render: import("@vitest/spy").Mock<any, any>;
|
|
||||||
parse: (text: string, parseOptions?: import("../mermaidAPI.js").ParseOptions | undefined) => Promise<boolean>;
|
|
||||||
initialize: import("@vitest/spy").Mock<any, any>;
|
|
||||||
getConfig: () => import("../config.type.js").MermaidConfig;
|
|
||||||
setConfig: (conf: import("../config.type.js").MermaidConfig) => import("../config.type.js").MermaidConfig;
|
|
||||||
getSiteConfig: () => import("../config.type.js").MermaidConfig;
|
|
||||||
updateSiteConfig: (conf: import("../config.type.js").MermaidConfig) => import("../config.type.js").MermaidConfig;
|
|
||||||
reset: () => void;
|
|
||||||
globalReset: () => void;
|
|
||||||
defaultConfig: import("../config.type.js").MermaidConfig;
|
|
||||||
};
|
|
||||||
export default mermaidAPI;
|
|
27
assets/lib/mermaid/accessibility.d.ts
vendored
27
assets/lib/mermaid/accessibility.d.ts
vendored
|
@ -1,27 +0,0 @@
|
||||||
/**
|
|
||||||
* Accessibility (a11y) functions, types, helpers.
|
|
||||||
*
|
|
||||||
* @see https://www.w3.org/WAI/
|
|
||||||
* @see https://www.w3.org/TR/wai-aria-1.1/
|
|
||||||
* @see https://www.w3.org/TR/svg-aam-1.0/
|
|
||||||
*/
|
|
||||||
import type { D3Element } from './mermaidAPI.js';
|
|
||||||
/**
|
|
||||||
* Add role and aria-roledescription to the svg element.
|
|
||||||
*
|
|
||||||
* @param svg - d3 object that contains the SVG HTML element
|
|
||||||
* @param diagramType - diagram name for to the aria-roledescription
|
|
||||||
*/
|
|
||||||
export declare function setA11yDiagramInfo(svg: D3Element, diagramType: string): void;
|
|
||||||
/**
|
|
||||||
* Add an accessible title and/or description element to a chart.
|
|
||||||
* The title is usually not displayed and the description is never displayed.
|
|
||||||
*
|
|
||||||
* The following charts display their title as a visual and accessibility element: gantt.
|
|
||||||
*
|
|
||||||
* @param svg - d3 node to insert the a11y title and desc info
|
|
||||||
* @param a11yTitle - a11y title. undefined or empty strings mean to skip them
|
|
||||||
* @param a11yDesc - a11y description. undefined or empty strings mean to skip them
|
|
||||||
* @param baseId - id used to construct the a11y title and description id
|
|
||||||
*/
|
|
||||||
export declare function addSVGa11yTitleDescription(svg: D3Element, a11yTitle: string | undefined, a11yDesc: string | undefined, baseId: string): void;
|
|
1
assets/lib/mermaid/accessibility.spec.d.ts
vendored
1
assets/lib/mermaid/accessibility.spec.d.ts
vendored
|
@ -1 +0,0 @@
|
||||||
export {};
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,85 +0,0 @@
|
||||||
import { c as Q, p as sn } from "./constant-2fe7eae5.js";
|
|
||||||
import { J as en, K as X, N as I, O as rn, P as y, I as ln, Q as z, R as b, T as un, V as t, W as an, X as on, Y as tn } from "./utils-aa888deb.js";
|
|
||||||
function fn(l) {
|
|
||||||
return l.innerRadius;
|
|
||||||
}
|
|
||||||
function cn(l) {
|
|
||||||
return l.outerRadius;
|
|
||||||
}
|
|
||||||
function yn(l) {
|
|
||||||
return l.startAngle;
|
|
||||||
}
|
|
||||||
function gn(l) {
|
|
||||||
return l.endAngle;
|
|
||||||
}
|
|
||||||
function mn(l) {
|
|
||||||
return l && l.padAngle;
|
|
||||||
}
|
|
||||||
function pn(l, x, w, O, h, v, S, r) {
|
|
||||||
var s = w - l, n = O - x, m = S - h, i = r - v, u = i * s - m * n;
|
|
||||||
if (!(u * u < y))
|
|
||||||
return u = (m * (x - v) - i * (l - h)) / u, [l + u * s, x + u * n];
|
|
||||||
}
|
|
||||||
function H(l, x, w, O, h, v, S) {
|
|
||||||
var r = l - w, s = x - O, n = (S ? v : -v) / z(r * r + s * s), m = n * s, i = -n * r, u = l + m, f = x + i, c = w + m, D = O + i, o = (u + c) / 2, E = (f + D) / 2, p = c - u, g = D - f, R = p * p + g * g, J = h - v, P = u * D - c * f, K = (g < 0 ? -1 : 1) * z(tn(0, J * J * R - P * P)), N = (P * g - p * K) / R, d = (-P * p - g * K) / R, A = (P * g + p * K) / R, T = (-P * p + g * K) / R, e = N - o, a = d - E, V = A - o, W = T - E;
|
|
||||||
return e * e + a * a > V * V + W * W && (N = A, d = T), {
|
|
||||||
cx: N,
|
|
||||||
cy: d,
|
|
||||||
x01: -m,
|
|
||||||
y01: -i,
|
|
||||||
x11: N * (h / J - 1),
|
|
||||||
y11: d * (h / J - 1)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function hn() {
|
|
||||||
var l = fn, x = cn, w = Q(0), O = null, h = yn, v = gn, S = mn, r = null;
|
|
||||||
function s() {
|
|
||||||
var n, m, i = +l.apply(this, arguments), u = +x.apply(this, arguments), f = h.apply(this, arguments) - rn, c = v.apply(this, arguments) - rn, D = un(c - f), o = c > f;
|
|
||||||
if (r || (r = n = sn()), u < i && (m = u, u = i, i = m), !(u > y))
|
|
||||||
r.moveTo(0, 0);
|
|
||||||
else if (D > ln - y)
|
|
||||||
r.moveTo(u * X(f), u * I(f)), r.arc(0, 0, u, f, c, !o), i > y && (r.moveTo(i * X(c), i * I(c)), r.arc(0, 0, i, c, f, o));
|
|
||||||
else {
|
|
||||||
var E = f, p = c, g = f, R = c, J = D, P = D, K = S.apply(this, arguments) / 2, N = K > y && (O ? +O.apply(this, arguments) : z(i * i + u * u)), d = b(un(u - i) / 2, +w.apply(this, arguments)), A = d, T = d, e, a;
|
|
||||||
if (N > y) {
|
|
||||||
var V = an(N / i * I(K)), W = an(N / u * I(K));
|
|
||||||
(J -= V * 2) > y ? (V *= o ? 1 : -1, g += V, R -= V) : (J = 0, g = R = (f + c) / 2), (P -= W * 2) > y ? (W *= o ? 1 : -1, E += W, p -= W) : (P = 0, E = p = (f + c) / 2);
|
|
||||||
}
|
|
||||||
var Y = u * X(E), j = u * I(E), B = i * X(R), C = i * I(R);
|
|
||||||
if (d > y) {
|
|
||||||
var F = u * X(p), G = u * I(p), L = i * X(g), M = i * I(g), q;
|
|
||||||
if (D < en && (q = pn(Y, j, L, M, F, G, B, C))) {
|
|
||||||
var U = Y - q[0], Z = j - q[1], $ = F - q[0], k = G - q[1], _ = 1 / I(on((U * $ + Z * k) / (z(U * U + Z * Z) * z($ * $ + k * k))) / 2), nn = z(q[0] * q[0] + q[1] * q[1]);
|
|
||||||
A = b(d, (i - nn) / (_ - 1)), T = b(d, (u - nn) / (_ + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
P > y ? T > y ? (e = H(L, M, Y, j, u, T, o), a = H(F, G, B, C, u, T, o), r.moveTo(e.cx + e.x01, e.cy + e.y01), T < d ? r.arc(e.cx, e.cy, T, t(e.y01, e.x01), t(a.y01, a.x01), !o) : (r.arc(e.cx, e.cy, T, t(e.y01, e.x01), t(e.y11, e.x11), !o), r.arc(0, 0, u, t(e.cy + e.y11, e.cx + e.x11), t(a.cy + a.y11, a.cx + a.x11), !o), r.arc(a.cx, a.cy, T, t(a.y11, a.x11), t(a.y01, a.x01), !o))) : (r.moveTo(Y, j), r.arc(0, 0, u, E, p, !o)) : r.moveTo(Y, j), !(i > y) || !(J > y) ? r.lineTo(B, C) : A > y ? (e = H(B, C, F, G, i, -A, o), a = H(Y, j, L, M, i, -A, o), r.lineTo(e.cx + e.x01, e.cy + e.y01), A < d ? r.arc(e.cx, e.cy, A, t(e.y01, e.x01), t(a.y01, a.x01), !o) : (r.arc(e.cx, e.cy, A, t(e.y01, e.x01), t(e.y11, e.x11), !o), r.arc(0, 0, i, t(e.cy + e.y11, e.cx + e.x11), t(a.cy + a.y11, a.cx + a.x11), o), r.arc(a.cx, a.cy, A, t(a.y11, a.x11), t(a.y01, a.x01), !o))) : r.arc(0, 0, i, R, g, o);
|
|
||||||
}
|
|
||||||
if (r.closePath(), n)
|
|
||||||
return r = null, n + "" || null;
|
|
||||||
}
|
|
||||||
return s.centroid = function() {
|
|
||||||
var n = (+l.apply(this, arguments) + +x.apply(this, arguments)) / 2, m = (+h.apply(this, arguments) + +v.apply(this, arguments)) / 2 - en / 2;
|
|
||||||
return [X(m) * n, I(m) * n];
|
|
||||||
}, s.innerRadius = function(n) {
|
|
||||||
return arguments.length ? (l = typeof n == "function" ? n : Q(+n), s) : l;
|
|
||||||
}, s.outerRadius = function(n) {
|
|
||||||
return arguments.length ? (x = typeof n == "function" ? n : Q(+n), s) : x;
|
|
||||||
}, s.cornerRadius = function(n) {
|
|
||||||
return arguments.length ? (w = typeof n == "function" ? n : Q(+n), s) : w;
|
|
||||||
}, s.padRadius = function(n) {
|
|
||||||
return arguments.length ? (O = n == null ? null : typeof n == "function" ? n : Q(+n), s) : O;
|
|
||||||
}, s.startAngle = function(n) {
|
|
||||||
return arguments.length ? (h = typeof n == "function" ? n : Q(+n), s) : h;
|
|
||||||
}, s.endAngle = function(n) {
|
|
||||||
return arguments.length ? (v = typeof n == "function" ? n : Q(+n), s) : v;
|
|
||||||
}, s.padAngle = function(n) {
|
|
||||||
return arguments.length ? (S = typeof n == "function" ? n : Q(+n), s) : S;
|
|
||||||
}, s.context = function(n) {
|
|
||||||
return arguments.length ? (r = n ?? null, s) : r;
|
|
||||||
}, s;
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
hn as d
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=arc-1bd4335b.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,86 +0,0 @@
|
||||||
import { w as ln, c as H } from "./path-428ebac9.js";
|
|
||||||
import { aw as an, ax as V, ay as D, az as rn, aA as y, V as on, aB as K, aC as _, aD as un, aE as t, aF as sn, aG as tn, aH as fn } from "./mermaid-00886c59.js";
|
|
||||||
function cn(l) {
|
|
||||||
return l.innerRadius;
|
|
||||||
}
|
|
||||||
function yn(l) {
|
|
||||||
return l.outerRadius;
|
|
||||||
}
|
|
||||||
function gn(l) {
|
|
||||||
return l.startAngle;
|
|
||||||
}
|
|
||||||
function mn(l) {
|
|
||||||
return l.endAngle;
|
|
||||||
}
|
|
||||||
function pn(l) {
|
|
||||||
return l && l.padAngle;
|
|
||||||
}
|
|
||||||
function dn(l, h, z, E, v, A, I, a) {
|
|
||||||
var B = z - l, i = E - h, n = I - v, m = a - A, r = m * B - n * i;
|
|
||||||
if (!(r * r < y))
|
|
||||||
return r = (n * (h - A) - m * (l - v)) / r, [l + r * B, h + r * i];
|
|
||||||
}
|
|
||||||
function W(l, h, z, E, v, A, I) {
|
|
||||||
var a = l - z, B = h - E, i = (I ? A : -A) / K(a * a + B * B), n = i * B, m = -i * a, r = l + n, s = h + m, f = z + n, c = E + m, O = (r + f) / 2, o = (s + c) / 2, p = f - r, g = c - s, R = p * p + g * g, T = v - A, w = r * c - f * s, C = (g < 0 ? -1 : 1) * K(fn(0, T * T * R - w * w)), F = (w * g - p * C) / R, G = (-w * p - g * C) / R, P = (w * g + p * C) / R, d = (-w * p + g * C) / R, x = F - O, e = G - o, u = P - O, S = d - o;
|
|
||||||
return x * x + e * e > u * u + S * S && (F = P, G = d), {
|
|
||||||
cx: F,
|
|
||||||
cy: G,
|
|
||||||
x01: -n,
|
|
||||||
y01: -m,
|
|
||||||
x11: F * (v / T - 1),
|
|
||||||
y11: G * (v / T - 1)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function vn() {
|
|
||||||
var l = cn, h = yn, z = H(0), E = null, v = gn, A = mn, I = pn, a = null, B = ln(i);
|
|
||||||
function i() {
|
|
||||||
var n, m, r = +l.apply(this, arguments), s = +h.apply(this, arguments), f = v.apply(this, arguments) - rn, c = A.apply(this, arguments) - rn, O = un(c - f), o = c > f;
|
|
||||||
if (a || (a = n = B()), s < r && (m = s, s = r, r = m), !(s > y))
|
|
||||||
a.moveTo(0, 0);
|
|
||||||
else if (O > on - y)
|
|
||||||
a.moveTo(s * V(f), s * D(f)), a.arc(0, 0, s, f, c, !o), r > y && (a.moveTo(r * V(c), r * D(c)), a.arc(0, 0, r, c, f, o));
|
|
||||||
else {
|
|
||||||
var p = f, g = c, R = f, T = c, w = O, C = O, F = I.apply(this, arguments) / 2, G = F > y && (E ? +E.apply(this, arguments) : K(r * r + s * s)), P = _(un(s - r) / 2, +z.apply(this, arguments)), d = P, x = P, e, u;
|
|
||||||
if (G > y) {
|
|
||||||
var S = sn(G / r * D(F)), L = sn(G / s * D(F));
|
|
||||||
(w -= S * 2) > y ? (S *= o ? 1 : -1, R += S, T -= S) : (w = 0, R = T = (f + c) / 2), (C -= L * 2) > y ? (L *= o ? 1 : -1, p += L, g -= L) : (C = 0, p = g = (f + c) / 2);
|
|
||||||
}
|
|
||||||
var j = s * V(p), J = s * D(p), M = r * V(T), N = r * D(T);
|
|
||||||
if (P > y) {
|
|
||||||
var Q = s * V(g), U = s * D(g), X = r * V(R), Y = r * D(R), q;
|
|
||||||
if (O < an)
|
|
||||||
if (q = dn(j, J, X, Y, Q, U, M, N)) {
|
|
||||||
var Z = j - q[0], $ = J - q[1], k = Q - q[0], b = U - q[1], nn = 1 / D(tn((Z * k + $ * b) / (K(Z * Z + $ * $) * K(k * k + b * b))) / 2), en = K(q[0] * q[0] + q[1] * q[1]);
|
|
||||||
d = _(P, (r - en) / (nn - 1)), x = _(P, (s - en) / (nn + 1));
|
|
||||||
} else
|
|
||||||
d = x = 0;
|
|
||||||
}
|
|
||||||
C > y ? x > y ? (e = W(X, Y, j, J, s, x, o), u = W(Q, U, M, N, s, x, o), a.moveTo(e.cx + e.x01, e.cy + e.y01), x < P ? a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, s, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), !o), a.arc(u.cx, u.cy, x, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : (a.moveTo(j, J), a.arc(0, 0, s, p, g, !o)) : a.moveTo(j, J), !(r > y) || !(w > y) ? a.lineTo(M, N) : d > y ? (e = W(M, N, Q, U, r, -d, o), u = W(j, J, X, Y, r, -d, o), a.lineTo(e.cx + e.x01, e.cy + e.y01), d < P ? a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, r, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), o), a.arc(u.cx, u.cy, d, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : a.arc(0, 0, r, T, R, o);
|
|
||||||
}
|
|
||||||
if (a.closePath(), n)
|
|
||||||
return a = null, n + "" || null;
|
|
||||||
}
|
|
||||||
return i.centroid = function() {
|
|
||||||
var n = (+l.apply(this, arguments) + +h.apply(this, arguments)) / 2, m = (+v.apply(this, arguments) + +A.apply(this, arguments)) / 2 - an / 2;
|
|
||||||
return [V(m) * n, D(m) * n];
|
|
||||||
}, i.innerRadius = function(n) {
|
|
||||||
return arguments.length ? (l = typeof n == "function" ? n : H(+n), i) : l;
|
|
||||||
}, i.outerRadius = function(n) {
|
|
||||||
return arguments.length ? (h = typeof n == "function" ? n : H(+n), i) : h;
|
|
||||||
}, i.cornerRadius = function(n) {
|
|
||||||
return arguments.length ? (z = typeof n == "function" ? n : H(+n), i) : z;
|
|
||||||
}, i.padRadius = function(n) {
|
|
||||||
return arguments.length ? (E = n == null ? null : typeof n == "function" ? n : H(+n), i) : E;
|
|
||||||
}, i.startAngle = function(n) {
|
|
||||||
return arguments.length ? (v = typeof n == "function" ? n : H(+n), i) : v;
|
|
||||||
}, i.endAngle = function(n) {
|
|
||||||
return arguments.length ? (A = typeof n == "function" ? n : H(+n), i) : A;
|
|
||||||
}, i.padAngle = function(n) {
|
|
||||||
return arguments.length ? (I = typeof n == "function" ? n : H(+n), i) : I;
|
|
||||||
}, i.context = function(n) {
|
|
||||||
return arguments.length ? (a = n ?? null, i) : a;
|
|
||||||
}, i;
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
vn as d
|
|
||||||
};
|
|
|
@ -1,148 +0,0 @@
|
||||||
import { w as withPath, c as constant } from "./path-39bad7e2.js";
|
|
||||||
import { aw as pi, ax as cos, ay as sin, az as halfPi, aA as epsilon, V as tau, aB as sqrt, aC as min, aD as abs, aE as atan2, aF as asin, aG as acos, aH as max } from "./mermaid-c5809711.js";
|
|
||||||
function arcInnerRadius(d) {
|
|
||||||
return d.innerRadius;
|
|
||||||
}
|
|
||||||
function arcOuterRadius(d) {
|
|
||||||
return d.outerRadius;
|
|
||||||
}
|
|
||||||
function arcStartAngle(d) {
|
|
||||||
return d.startAngle;
|
|
||||||
}
|
|
||||||
function arcEndAngle(d) {
|
|
||||||
return d.endAngle;
|
|
||||||
}
|
|
||||||
function arcPadAngle(d) {
|
|
||||||
return d && d.padAngle;
|
|
||||||
}
|
|
||||||
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
||||||
var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;
|
|
||||||
if (t * t < epsilon)
|
|
||||||
return;
|
|
||||||
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
|
||||||
return [x0 + t * x10, y0 + t * y10];
|
|
||||||
}
|
|
||||||
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
||||||
var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
|
|
||||||
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1)
|
|
||||||
cx0 = cx1, cy0 = cy1;
|
|
||||||
return {
|
|
||||||
cx: cx0,
|
|
||||||
cy: cy0,
|
|
||||||
x01: -ox,
|
|
||||||
y01: -oy,
|
|
||||||
x11: cx0 * (r1 / r - 1),
|
|
||||||
y11: cy0 * (r1 / r - 1)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function d3arc() {
|
|
||||||
var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = withPath(arc);
|
|
||||||
function arc() {
|
|
||||||
var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
|
|
||||||
if (!context)
|
|
||||||
context = buffer = path();
|
|
||||||
if (r1 < r0)
|
|
||||||
r = r1, r1 = r0, r0 = r;
|
|
||||||
if (!(r1 > epsilon))
|
|
||||||
context.moveTo(0, 0);
|
|
||||||
else if (da > tau - epsilon) {
|
|
||||||
context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
|
||||||
context.arc(0, 0, r1, a0, a1, !cw);
|
|
||||||
if (r0 > epsilon) {
|
|
||||||
context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
|
||||||
context.arc(0, 0, r0, a1, a0, cw);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
|
|
||||||
if (rp > epsilon) {
|
|
||||||
var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
|
|
||||||
if ((da0 -= p0 * 2) > epsilon)
|
|
||||||
p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
|
|
||||||
else
|
|
||||||
da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
|
||||||
if ((da1 -= p1 * 2) > epsilon)
|
|
||||||
p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
|
|
||||||
else
|
|
||||||
da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
|
||||||
}
|
|
||||||
var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
|
|
||||||
if (rc > epsilon) {
|
|
||||||
var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
|
|
||||||
if (da < pi) {
|
|
||||||
if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
|
|
||||||
var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
||||||
rc0 = min(rc, (r0 - lc) / (kc - 1));
|
|
||||||
rc1 = min(rc, (r1 - lc) / (kc + 1));
|
|
||||||
} else {
|
|
||||||
rc0 = rc1 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!(da1 > epsilon))
|
|
||||||
context.moveTo(x01, y01);
|
|
||||||
else if (rc1 > epsilon) {
|
|
||||||
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
|
||||||
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
|
||||||
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
||||||
if (rc1 < rc)
|
|
||||||
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
else {
|
|
||||||
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
||||||
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
|
||||||
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
|
||||||
if (!(r0 > epsilon) || !(da0 > epsilon))
|
|
||||||
context.lineTo(x10, y10);
|
|
||||||
else if (rc0 > epsilon) {
|
|
||||||
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
|
||||||
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
|
||||||
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
||||||
if (rc0 < rc)
|
|
||||||
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
else {
|
|
||||||
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
||||||
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
|
||||||
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
context.arc(0, 0, r0, a10, a00, cw);
|
|
||||||
}
|
|
||||||
context.closePath();
|
|
||||||
if (buffer)
|
|
||||||
return context = null, buffer + "" || null;
|
|
||||||
}
|
|
||||||
arc.centroid = function() {
|
|
||||||
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
|
|
||||||
return [cos(a) * r, sin(a) * r];
|
|
||||||
};
|
|
||||||
arc.innerRadius = function(_) {
|
|
||||||
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
|
|
||||||
};
|
|
||||||
arc.outerRadius = function(_) {
|
|
||||||
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
|
|
||||||
};
|
|
||||||
arc.cornerRadius = function(_) {
|
|
||||||
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
|
|
||||||
};
|
|
||||||
arc.padRadius = function(_) {
|
|
||||||
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
|
|
||||||
};
|
|
||||||
arc.startAngle = function(_) {
|
|
||||||
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
|
|
||||||
};
|
|
||||||
arc.endAngle = function(_) {
|
|
||||||
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
|
|
||||||
};
|
|
||||||
arc.padAngle = function(_) {
|
|
||||||
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
|
|
||||||
};
|
|
||||||
arc.context = function(_) {
|
|
||||||
return arguments.length ? (context = _ == null ? null : _, arc) : context;
|
|
||||||
};
|
|
||||||
return arc;
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
d3arc as d
|
|
||||||
};
|
|
|
@ -1,145 +0,0 @@
|
||||||
import { c as constant, p as path } from "./constant-b644328d.js";
|
|
||||||
import { J as pi, K as cos, N as sin, O as halfPi, P as epsilon, I as tau, Q as sqrt, R as min, T as abs, V as atan2, W as asin, X as acos, Y as max } from "./utils-872dfc50.js";
|
|
||||||
function arcInnerRadius(d) {
|
|
||||||
return d.innerRadius;
|
|
||||||
}
|
|
||||||
function arcOuterRadius(d) {
|
|
||||||
return d.outerRadius;
|
|
||||||
}
|
|
||||||
function arcStartAngle(d) {
|
|
||||||
return d.startAngle;
|
|
||||||
}
|
|
||||||
function arcEndAngle(d) {
|
|
||||||
return d.endAngle;
|
|
||||||
}
|
|
||||||
function arcPadAngle(d) {
|
|
||||||
return d && d.padAngle;
|
|
||||||
}
|
|
||||||
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
||||||
var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;
|
|
||||||
if (t * t < epsilon)
|
|
||||||
return;
|
|
||||||
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
|
||||||
return [x0 + t * x10, y0 + t * y10];
|
|
||||||
}
|
|
||||||
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
||||||
var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
|
|
||||||
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1)
|
|
||||||
cx0 = cx1, cy0 = cy1;
|
|
||||||
return {
|
|
||||||
cx: cx0,
|
|
||||||
cy: cy0,
|
|
||||||
x01: -ox,
|
|
||||||
y01: -oy,
|
|
||||||
x11: cx0 * (r1 / r - 1),
|
|
||||||
y11: cy0 * (r1 / r - 1)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function d3arc() {
|
|
||||||
var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null;
|
|
||||||
function arc() {
|
|
||||||
var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
|
|
||||||
if (!context)
|
|
||||||
context = buffer = path();
|
|
||||||
if (r1 < r0)
|
|
||||||
r = r1, r1 = r0, r0 = r;
|
|
||||||
if (!(r1 > epsilon))
|
|
||||||
context.moveTo(0, 0);
|
|
||||||
else if (da > tau - epsilon) {
|
|
||||||
context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
|
||||||
context.arc(0, 0, r1, a0, a1, !cw);
|
|
||||||
if (r0 > epsilon) {
|
|
||||||
context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
|
||||||
context.arc(0, 0, r0, a1, a0, cw);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
|
|
||||||
if (rp > epsilon) {
|
|
||||||
var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
|
|
||||||
if ((da0 -= p0 * 2) > epsilon)
|
|
||||||
p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
|
|
||||||
else
|
|
||||||
da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
|
||||||
if ((da1 -= p1 * 2) > epsilon)
|
|
||||||
p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
|
|
||||||
else
|
|
||||||
da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
|
||||||
}
|
|
||||||
var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
|
|
||||||
if (rc > epsilon) {
|
|
||||||
var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
|
|
||||||
if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
|
|
||||||
var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
||||||
rc0 = min(rc, (r0 - lc) / (kc - 1));
|
|
||||||
rc1 = min(rc, (r1 - lc) / (kc + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!(da1 > epsilon))
|
|
||||||
context.moveTo(x01, y01);
|
|
||||||
else if (rc1 > epsilon) {
|
|
||||||
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
|
||||||
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
|
||||||
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
||||||
if (rc1 < rc)
|
|
||||||
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
else {
|
|
||||||
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
||||||
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
|
||||||
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
|
||||||
if (!(r0 > epsilon) || !(da0 > epsilon))
|
|
||||||
context.lineTo(x10, y10);
|
|
||||||
else if (rc0 > epsilon) {
|
|
||||||
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
|
||||||
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
|
||||||
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
||||||
if (rc0 < rc)
|
|
||||||
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
else {
|
|
||||||
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
||||||
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
|
||||||
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
context.arc(0, 0, r0, a10, a00, cw);
|
|
||||||
}
|
|
||||||
context.closePath();
|
|
||||||
if (buffer)
|
|
||||||
return context = null, buffer + "" || null;
|
|
||||||
}
|
|
||||||
arc.centroid = function() {
|
|
||||||
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
|
|
||||||
return [cos(a) * r, sin(a) * r];
|
|
||||||
};
|
|
||||||
arc.innerRadius = function(_) {
|
|
||||||
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
|
|
||||||
};
|
|
||||||
arc.outerRadius = function(_) {
|
|
||||||
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
|
|
||||||
};
|
|
||||||
arc.cornerRadius = function(_) {
|
|
||||||
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
|
|
||||||
};
|
|
||||||
arc.padRadius = function(_) {
|
|
||||||
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
|
|
||||||
};
|
|
||||||
arc.startAngle = function(_) {
|
|
||||||
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
|
|
||||||
};
|
|
||||||
arc.endAngle = function(_) {
|
|
||||||
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
|
|
||||||
};
|
|
||||||
arc.padAngle = function(_) {
|
|
||||||
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
|
|
||||||
};
|
|
||||||
arc.context = function(_) {
|
|
||||||
return arguments.length ? (context = _ == null ? null : _, arc) : context;
|
|
||||||
};
|
|
||||||
return arc;
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
d3arc as d
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=arc-7c943a40.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,148 +0,0 @@
|
||||||
import { w as withPath, c as constant } from "./path-39bad7e2.js";
|
|
||||||
import { aw as pi, ax as cos, ay as sin, az as halfPi, aA as epsilon, V as tau, aB as sqrt, aC as min, aD as abs, aE as atan2, aF as asin, aG as acos, aH as max } from "./mermaid-dcacb631.js";
|
|
||||||
function arcInnerRadius(d) {
|
|
||||||
return d.innerRadius;
|
|
||||||
}
|
|
||||||
function arcOuterRadius(d) {
|
|
||||||
return d.outerRadius;
|
|
||||||
}
|
|
||||||
function arcStartAngle(d) {
|
|
||||||
return d.startAngle;
|
|
||||||
}
|
|
||||||
function arcEndAngle(d) {
|
|
||||||
return d.endAngle;
|
|
||||||
}
|
|
||||||
function arcPadAngle(d) {
|
|
||||||
return d && d.padAngle;
|
|
||||||
}
|
|
||||||
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
||||||
var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;
|
|
||||||
if (t * t < epsilon)
|
|
||||||
return;
|
|
||||||
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
|
||||||
return [x0 + t * x10, y0 + t * y10];
|
|
||||||
}
|
|
||||||
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
||||||
var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
|
|
||||||
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1)
|
|
||||||
cx0 = cx1, cy0 = cy1;
|
|
||||||
return {
|
|
||||||
cx: cx0,
|
|
||||||
cy: cy0,
|
|
||||||
x01: -ox,
|
|
||||||
y01: -oy,
|
|
||||||
x11: cx0 * (r1 / r - 1),
|
|
||||||
y11: cy0 * (r1 / r - 1)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function d3arc() {
|
|
||||||
var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = withPath(arc);
|
|
||||||
function arc() {
|
|
||||||
var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
|
|
||||||
if (!context)
|
|
||||||
context = buffer = path();
|
|
||||||
if (r1 < r0)
|
|
||||||
r = r1, r1 = r0, r0 = r;
|
|
||||||
if (!(r1 > epsilon))
|
|
||||||
context.moveTo(0, 0);
|
|
||||||
else if (da > tau - epsilon) {
|
|
||||||
context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
|
||||||
context.arc(0, 0, r1, a0, a1, !cw);
|
|
||||||
if (r0 > epsilon) {
|
|
||||||
context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
|
||||||
context.arc(0, 0, r0, a1, a0, cw);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
|
|
||||||
if (rp > epsilon) {
|
|
||||||
var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
|
|
||||||
if ((da0 -= p0 * 2) > epsilon)
|
|
||||||
p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
|
|
||||||
else
|
|
||||||
da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
|
||||||
if ((da1 -= p1 * 2) > epsilon)
|
|
||||||
p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
|
|
||||||
else
|
|
||||||
da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
|
||||||
}
|
|
||||||
var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
|
|
||||||
if (rc > epsilon) {
|
|
||||||
var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
|
|
||||||
if (da < pi) {
|
|
||||||
if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
|
|
||||||
var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
||||||
rc0 = min(rc, (r0 - lc) / (kc - 1));
|
|
||||||
rc1 = min(rc, (r1 - lc) / (kc + 1));
|
|
||||||
} else {
|
|
||||||
rc0 = rc1 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!(da1 > epsilon))
|
|
||||||
context.moveTo(x01, y01);
|
|
||||||
else if (rc1 > epsilon) {
|
|
||||||
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
|
||||||
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
|
||||||
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
||||||
if (rc1 < rc)
|
|
||||||
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
else {
|
|
||||||
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
||||||
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
|
||||||
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
|
||||||
if (!(r0 > epsilon) || !(da0 > epsilon))
|
|
||||||
context.lineTo(x10, y10);
|
|
||||||
else if (rc0 > epsilon) {
|
|
||||||
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
|
||||||
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
|
||||||
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
||||||
if (rc0 < rc)
|
|
||||||
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
else {
|
|
||||||
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
||||||
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
|
||||||
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
context.arc(0, 0, r0, a10, a00, cw);
|
|
||||||
}
|
|
||||||
context.closePath();
|
|
||||||
if (buffer)
|
|
||||||
return context = null, buffer + "" || null;
|
|
||||||
}
|
|
||||||
arc.centroid = function() {
|
|
||||||
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
|
|
||||||
return [cos(a) * r, sin(a) * r];
|
|
||||||
};
|
|
||||||
arc.innerRadius = function(_) {
|
|
||||||
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
|
|
||||||
};
|
|
||||||
arc.outerRadius = function(_) {
|
|
||||||
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
|
|
||||||
};
|
|
||||||
arc.cornerRadius = function(_) {
|
|
||||||
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
|
|
||||||
};
|
|
||||||
arc.padRadius = function(_) {
|
|
||||||
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
|
|
||||||
};
|
|
||||||
arc.startAngle = function(_) {
|
|
||||||
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
|
|
||||||
};
|
|
||||||
arc.endAngle = function(_) {
|
|
||||||
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
|
|
||||||
};
|
|
||||||
arc.padAngle = function(_) {
|
|
||||||
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
|
|
||||||
};
|
|
||||||
arc.context = function(_) {
|
|
||||||
return arguments.length ? (context = _ == null ? null : _, arc) : context;
|
|
||||||
};
|
|
||||||
return arc;
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
d3arc as d
|
|
||||||
};
|
|
|
@ -1,86 +0,0 @@
|
||||||
import { w as ln, c as H } from "./path-428ebac9.js";
|
|
||||||
import { aw as an, ax as V, ay as D, az as rn, aA as y, V as on, aB as K, aC as _, aD as un, aE as t, aF as sn, aG as tn, aH as fn } from "./mermaid-9f2aa176.js";
|
|
||||||
function cn(l) {
|
|
||||||
return l.innerRadius;
|
|
||||||
}
|
|
||||||
function yn(l) {
|
|
||||||
return l.outerRadius;
|
|
||||||
}
|
|
||||||
function gn(l) {
|
|
||||||
return l.startAngle;
|
|
||||||
}
|
|
||||||
function mn(l) {
|
|
||||||
return l.endAngle;
|
|
||||||
}
|
|
||||||
function pn(l) {
|
|
||||||
return l && l.padAngle;
|
|
||||||
}
|
|
||||||
function dn(l, h, z, E, v, A, I, a) {
|
|
||||||
var B = z - l, i = E - h, n = I - v, m = a - A, r = m * B - n * i;
|
|
||||||
if (!(r * r < y))
|
|
||||||
return r = (n * (h - A) - m * (l - v)) / r, [l + r * B, h + r * i];
|
|
||||||
}
|
|
||||||
function W(l, h, z, E, v, A, I) {
|
|
||||||
var a = l - z, B = h - E, i = (I ? A : -A) / K(a * a + B * B), n = i * B, m = -i * a, r = l + n, s = h + m, f = z + n, c = E + m, O = (r + f) / 2, o = (s + c) / 2, p = f - r, g = c - s, R = p * p + g * g, T = v - A, w = r * c - f * s, C = (g < 0 ? -1 : 1) * K(fn(0, T * T * R - w * w)), F = (w * g - p * C) / R, G = (-w * p - g * C) / R, P = (w * g + p * C) / R, d = (-w * p + g * C) / R, x = F - O, e = G - o, u = P - O, S = d - o;
|
|
||||||
return x * x + e * e > u * u + S * S && (F = P, G = d), {
|
|
||||||
cx: F,
|
|
||||||
cy: G,
|
|
||||||
x01: -n,
|
|
||||||
y01: -m,
|
|
||||||
x11: F * (v / T - 1),
|
|
||||||
y11: G * (v / T - 1)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function vn() {
|
|
||||||
var l = cn, h = yn, z = H(0), E = null, v = gn, A = mn, I = pn, a = null, B = ln(i);
|
|
||||||
function i() {
|
|
||||||
var n, m, r = +l.apply(this, arguments), s = +h.apply(this, arguments), f = v.apply(this, arguments) - rn, c = A.apply(this, arguments) - rn, O = un(c - f), o = c > f;
|
|
||||||
if (a || (a = n = B()), s < r && (m = s, s = r, r = m), !(s > y))
|
|
||||||
a.moveTo(0, 0);
|
|
||||||
else if (O > on - y)
|
|
||||||
a.moveTo(s * V(f), s * D(f)), a.arc(0, 0, s, f, c, !o), r > y && (a.moveTo(r * V(c), r * D(c)), a.arc(0, 0, r, c, f, o));
|
|
||||||
else {
|
|
||||||
var p = f, g = c, R = f, T = c, w = O, C = O, F = I.apply(this, arguments) / 2, G = F > y && (E ? +E.apply(this, arguments) : K(r * r + s * s)), P = _(un(s - r) / 2, +z.apply(this, arguments)), d = P, x = P, e, u;
|
|
||||||
if (G > y) {
|
|
||||||
var S = sn(G / r * D(F)), L = sn(G / s * D(F));
|
|
||||||
(w -= S * 2) > y ? (S *= o ? 1 : -1, R += S, T -= S) : (w = 0, R = T = (f + c) / 2), (C -= L * 2) > y ? (L *= o ? 1 : -1, p += L, g -= L) : (C = 0, p = g = (f + c) / 2);
|
|
||||||
}
|
|
||||||
var j = s * V(p), J = s * D(p), M = r * V(T), N = r * D(T);
|
|
||||||
if (P > y) {
|
|
||||||
var Q = s * V(g), U = s * D(g), X = r * V(R), Y = r * D(R), q;
|
|
||||||
if (O < an)
|
|
||||||
if (q = dn(j, J, X, Y, Q, U, M, N)) {
|
|
||||||
var Z = j - q[0], $ = J - q[1], k = Q - q[0], b = U - q[1], nn = 1 / D(tn((Z * k + $ * b) / (K(Z * Z + $ * $) * K(k * k + b * b))) / 2), en = K(q[0] * q[0] + q[1] * q[1]);
|
|
||||||
d = _(P, (r - en) / (nn - 1)), x = _(P, (s - en) / (nn + 1));
|
|
||||||
} else
|
|
||||||
d = x = 0;
|
|
||||||
}
|
|
||||||
C > y ? x > y ? (e = W(X, Y, j, J, s, x, o), u = W(Q, U, M, N, s, x, o), a.moveTo(e.cx + e.x01, e.cy + e.y01), x < P ? a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, s, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), !o), a.arc(u.cx, u.cy, x, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : (a.moveTo(j, J), a.arc(0, 0, s, p, g, !o)) : a.moveTo(j, J), !(r > y) || !(w > y) ? a.lineTo(M, N) : d > y ? (e = W(M, N, Q, U, r, -d, o), u = W(j, J, X, Y, r, -d, o), a.lineTo(e.cx + e.x01, e.cy + e.y01), d < P ? a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, r, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), o), a.arc(u.cx, u.cy, d, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : a.arc(0, 0, r, T, R, o);
|
|
||||||
}
|
|
||||||
if (a.closePath(), n)
|
|
||||||
return a = null, n + "" || null;
|
|
||||||
}
|
|
||||||
return i.centroid = function() {
|
|
||||||
var n = (+l.apply(this, arguments) + +h.apply(this, arguments)) / 2, m = (+v.apply(this, arguments) + +A.apply(this, arguments)) / 2 - an / 2;
|
|
||||||
return [V(m) * n, D(m) * n];
|
|
||||||
}, i.innerRadius = function(n) {
|
|
||||||
return arguments.length ? (l = typeof n == "function" ? n : H(+n), i) : l;
|
|
||||||
}, i.outerRadius = function(n) {
|
|
||||||
return arguments.length ? (h = typeof n == "function" ? n : H(+n), i) : h;
|
|
||||||
}, i.cornerRadius = function(n) {
|
|
||||||
return arguments.length ? (z = typeof n == "function" ? n : H(+n), i) : z;
|
|
||||||
}, i.padRadius = function(n) {
|
|
||||||
return arguments.length ? (E = n == null ? null : typeof n == "function" ? n : H(+n), i) : E;
|
|
||||||
}, i.startAngle = function(n) {
|
|
||||||
return arguments.length ? (v = typeof n == "function" ? n : H(+n), i) : v;
|
|
||||||
}, i.endAngle = function(n) {
|
|
||||||
return arguments.length ? (A = typeof n == "function" ? n : H(+n), i) : A;
|
|
||||||
}, i.padAngle = function(n) {
|
|
||||||
return arguments.length ? (I = typeof n == "function" ? n : H(+n), i) : I;
|
|
||||||
}, i.context = function(n) {
|
|
||||||
return arguments.length ? (a = n ?? null, i) : a;
|
|
||||||
}, i;
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
vn as d
|
|
||||||
};
|
|
|
@ -1,6 +0,0 @@
|
||||||
function t(r) {
|
|
||||||
return typeof r == "object" && "length" in r ? r : Array.from(r);
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
t as a
|
|
||||||
};
|
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"array-2ff2c7a6.js","sources":["../../../node_modules/.pnpm/d3-shape@3.1.0/node_modules/d3-shape/src/array.js"],"sourcesContent":["export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n"],"names":["array","x"],"mappings":"AAEe,SAAQA,EAACC,GAAG;AACzB,SAAO,OAAOA,KAAM,YAAY,YAAYA,IACxCA,IACA,MAAM,KAAKA,CAAC;AAClB;"}
|
|
|
@ -1,6 +0,0 @@
|
||||||
function array(x) {
|
|
||||||
return typeof x === "object" && "length" in x ? x : Array.from(x);
|
|
||||||
}
|
|
||||||
export {
|
|
||||||
array as a
|
|
||||||
};
|
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"array-b7dcf730.js","sources":["../../../node_modules/.pnpm/d3-shape@3.1.0/node_modules/d3-shape/src/array.js"],"sourcesContent":["export var slice = Array.prototype.slice;\n\nexport default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n"],"names":[],"mappings":"AAEe,SAAQ,MAAC,GAAG;AACzB,SAAO,OAAO,MAAM,YAAY,YAAY,IACxC,IACA,MAAM,KAAK,CAAC;AAClB;"}
|
|
30
assets/lib/mermaid/assignWithDepth.d.ts
vendored
30
assets/lib/mermaid/assignWithDepth.d.ts
vendored
|
@ -1,30 +0,0 @@
|
||||||
/**
|
|
||||||
* assignWithDepth Extends the functionality of {@link Object.assign} with the
|
|
||||||
* ability to merge arbitrary-depth objects For each key in src with path `k` (recursively)
|
|
||||||
* performs an Object.assign(dst[`k`], src[`k`]) with a slight change from the typical handling of
|
|
||||||
* undefined for dst[`k`]: instead of raising an error, dst[`k`] is auto-initialized to `{}` and
|
|
||||||
* effectively merged with src[`k`]<p> Additionally, dissimilar types will not clobber unless the
|
|
||||||
* config.clobber parameter === true. Example:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* const config_0 = { foo: { bar: 'bar' }, bar: 'foo' };
|
|
||||||
* const config_1 = { foo: 'foo', bar: 'bar' };
|
|
||||||
* const result = assignWithDepth(config_0, config_1);
|
|
||||||
* console.log(result);
|
|
||||||
* //-> result: { foo: { bar: 'bar' }, bar: 'bar' }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Traditional Object.assign would have clobbered foo in config_0 with foo in config_1. If src is a
|
|
||||||
* destructured array of objects and dst is not an array, assignWithDepth will apply each element
|
|
||||||
* of src to dst in order.
|
|
||||||
* @param dst - The destination of the merge
|
|
||||||
* @param src - The source object(s) to merge into destination
|
|
||||||
* @param config -
|
|
||||||
* * depth: depth to traverse within src and dst for merging
|
|
||||||
* * clobber: should dissimilar types clobber
|
|
||||||
*/
|
|
||||||
declare const assignWithDepth: (dst: any, src: any, { depth, clobber }?: {
|
|
||||||
depth?: number | undefined;
|
|
||||||
clobber?: boolean | undefined;
|
|
||||||
}) => any;
|
|
||||||
export default assignWithDepth;
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,5 +0,0 @@
|
||||||
import { aI as o, aJ as r } from "./mermaid-00886c59.js";
|
|
||||||
const s = (a, n) => o.lang.round(r.parse(a)[n]), e = s;
|
|
||||||
export {
|
|
||||||
e as c
|
|
||||||
};
|
|
|
@ -1,8 +0,0 @@
|
||||||
import { aI as _, aJ as Color } from "./mermaid-c5809711.js";
|
|
||||||
const channel = (color, channel2) => {
|
|
||||||
return _.lang.round(Color.parse(color)[channel2]);
|
|
||||||
};
|
|
||||||
const channel$1 = channel;
|
|
||||||
export {
|
|
||||||
channel$1 as c
|
|
||||||
};
|
|
|
@ -1,5 +0,0 @@
|
||||||
import { aI as o, aJ as r } from "./mermaid-9f2aa176.js";
|
|
||||||
const s = (a, n) => o.lang.round(r.parse(a)[n]), e = s;
|
|
||||||
export {
|
|
||||||
e as c
|
|
||||||
};
|
|
|
@ -1,8 +0,0 @@
|
||||||
import { aI as _, aJ as Color } from "./mermaid-dcacb631.js";
|
|
||||||
const channel = (color, channel2) => {
|
|
||||||
return _.lang.round(Color.parse(color)[channel2]);
|
|
||||||
};
|
|
||||||
const channel$1 = channel;
|
|
||||||
export {
|
|
||||||
channel$1 as c
|
|
||||||
};
|
|
|
@ -1,97 +0,0 @@
|
||||||
import { p as W, d as M, s as H } from "./styles-55d85316.js";
|
|
||||||
import { g as S, l as d, f as u } from "./config-e567ef17.js";
|
|
||||||
import { G as X, l as Y } from "./layout-d6d8be39.js";
|
|
||||||
import { s as l } from "./svgDraw-c034b55e.js";
|
|
||||||
import { c as Z } from "./setupGraphViewbox-a4603a92.js";
|
|
||||||
import "./utils-aa888deb.js";
|
|
||||||
import "./commonDb-4dc3d465.js";
|
|
||||||
import "./mermaidAPI-04b5c286.js";
|
|
||||||
import "./errorRenderer-a3c4bedb.js";
|
|
||||||
import "./isPlainObject-a5cb4071.js";
|
|
||||||
import "./array-2ff2c7a6.js";
|
|
||||||
import "./constant-2fe7eae5.js";
|
|
||||||
let h = {};
|
|
||||||
const g = 20, p = function(e) {
|
|
||||||
const s = Object.entries(h).find((k) => k[1].label === e);
|
|
||||||
if (s)
|
|
||||||
return s[0];
|
|
||||||
}, D = function(e) {
|
|
||||||
e.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), e.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), e.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), e.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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
}, $ = function(e, s, k, a) {
|
|
||||||
const f = S().class;
|
|
||||||
h = {}, d.info("Rendering diagram " + e);
|
|
||||||
const L = S().securityLevel;
|
|
||||||
let y;
|
|
||||||
L === "sandbox" && (y = u("#i" + s));
|
|
||||||
const x = L === "sandbox" ? u(y.nodes()[0].contentDocument.body) : u("body"), n = x.select(`[id='${s}']`);
|
|
||||||
D(n);
|
|
||||||
const r = new X({
|
|
||||||
multigraph: !0
|
|
||||||
});
|
|
||||||
r.setGraph({
|
|
||||||
isMultiGraph: !0
|
|
||||||
}), r.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const m = a.db.getClasses(), N = Object.keys(m);
|
|
||||||
for (const t of N) {
|
|
||||||
const o = m[t], i = l.drawClass(n, o, f, a);
|
|
||||||
h[i.id] = i, r.setNode(i.id, i), d.info("Org height: " + i.height);
|
|
||||||
}
|
|
||||||
a.db.getRelations().forEach(function(t) {
|
|
||||||
d.info(
|
|
||||||
"tjoho" + p(t.id1) + p(t.id2) + JSON.stringify(t)
|
|
||||||
), r.setEdge(
|
|
||||||
p(t.id1),
|
|
||||||
p(t.id2),
|
|
||||||
{
|
|
||||||
relation: t
|
|
||||||
},
|
|
||||||
t.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
}), a.db.getNotes().forEach(function(t) {
|
|
||||||
d.debug(`Adding note: ${JSON.stringify(t)}`);
|
|
||||||
const o = l.drawNote(n, t, f, a);
|
|
||||||
h[o.id] = o, r.setNode(o.id, o), t.class && t.class in m && r.setEdge(
|
|
||||||
t.id,
|
|
||||||
p(t.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: t.id,
|
|
||||||
id2: t.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}), Y(r), r.nodes().forEach(function(t) {
|
|
||||||
t !== void 0 && r.node(t) !== void 0 && (d.debug("Node " + t + ": " + JSON.stringify(r.node(t))), x.select("#" + (a.db.lookUpDomId(t) || t)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (r.node(t).x - r.node(t).width / 2) + "," + (r.node(t).y - r.node(t).height / 2) + " )"
|
|
||||||
));
|
|
||||||
}), r.edges().forEach(function(t) {
|
|
||||||
t !== void 0 && r.edge(t) !== void 0 && (d.debug("Edge " + t.v + " -> " + t.w + ": " + JSON.stringify(r.edge(t))), l.drawEdge(n, r.edge(t), r.edge(t).relation, f, a));
|
|
||||||
});
|
|
||||||
const c = n.node().getBBox(), E = c.width + g * 2, b = c.height + g * 2;
|
|
||||||
Z(n, b, E, f.useMaxWidth);
|
|
||||||
const w = `${c.x - g} ${c.y - g} ${E} ${b}`;
|
|
||||||
d.debug(`viewBox ${w}`), n.attr("viewBox", w);
|
|
||||||
}, B = {
|
|
||||||
draw: $
|
|
||||||
}, q = {
|
|
||||||
parser: W,
|
|
||||||
db: M,
|
|
||||||
renderer: B,
|
|
||||||
styles: H,
|
|
||||||
init: (e) => {
|
|
||||||
e.class || (e.class = {}), e.class.arrowMarkerAbsolute = e.arrowMarkerAbsolute, M.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
q as diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-17eafd8a.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,363 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-991ebdfc.js";
|
|
||||||
import { line, curveBasis, select } from "d3";
|
|
||||||
import { layout } from "dagre-d3-es/src/dagre/index.js";
|
|
||||||
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
|
|
||||||
import { u as utils, l as log, x as parseGenericTypes, c as getConfig, i as configureSvgSize } from "./mermaid-f47111a7.js";
|
|
||||||
import "ts-dedent";
|
|
||||||
import "dayjs";
|
|
||||||
import "@braintree/sanitize-url";
|
|
||||||
import "dompurify";
|
|
||||||
import "khroma";
|
|
||||||
import "lodash-es/memoize.js";
|
|
||||||
import "lodash-es/merge.js";
|
|
||||||
import "stylis";
|
|
||||||
import "lodash-es/isEmpty.js";
|
|
||||||
let edgeCount = 0;
|
|
||||||
const drawEdge = function(elem, path, relation, conf, diagObj) {
|
|
||||||
const getRelationType = function(type) {
|
|
||||||
switch (type) {
|
|
||||||
case diagObj.db.relationType.AGGREGATION:
|
|
||||||
return "aggregation";
|
|
||||||
case diagObj.db.relationType.EXTENSION:
|
|
||||||
return "extension";
|
|
||||||
case diagObj.db.relationType.COMPOSITION:
|
|
||||||
return "composition";
|
|
||||||
case diagObj.db.relationType.DEPENDENCY:
|
|
||||||
return "dependency";
|
|
||||||
case diagObj.db.relationType.LOLLIPOP:
|
|
||||||
return "lollipop";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
path.points = path.points.filter((p) => !Number.isNaN(p.y));
|
|
||||||
const lineData = path.points;
|
|
||||||
const lineFunction = line().x(function(d) {
|
|
||||||
return d.x;
|
|
||||||
}).y(function(d) {
|
|
||||||
return d.y;
|
|
||||||
}).curve(curveBasis);
|
|
||||||
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "relation");
|
|
||||||
let url = "";
|
|
||||||
if (conf.arrowMarkerAbsolute) {
|
|
||||||
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
|
|
||||||
url = url.replace(/\(/g, "\\(");
|
|
||||||
url = url.replace(/\)/g, "\\)");
|
|
||||||
}
|
|
||||||
if (relation.relation.lineType == 1) {
|
|
||||||
svgPath.attr("class", "relation dashed-line");
|
|
||||||
}
|
|
||||||
if (relation.relation.lineType == 10) {
|
|
||||||
svgPath.attr("class", "relation dotted-line");
|
|
||||||
}
|
|
||||||
if (relation.relation.type1 !== "none") {
|
|
||||||
svgPath.attr(
|
|
||||||
"marker-start",
|
|
||||||
"url(" + url + "#" + getRelationType(relation.relation.type1) + "Start)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (relation.relation.type2 !== "none") {
|
|
||||||
svgPath.attr(
|
|
||||||
"marker-end",
|
|
||||||
"url(" + url + "#" + getRelationType(relation.relation.type2) + "End)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
let x, y;
|
|
||||||
const l = path.points.length;
|
|
||||||
let labelPosition = utils.calcLabelPosition(path.points);
|
|
||||||
x = labelPosition.x;
|
|
||||||
y = labelPosition.y;
|
|
||||||
let p1_card_x, p1_card_y;
|
|
||||||
let p2_card_x, p2_card_y;
|
|
||||||
if (l % 2 !== 0 && l > 1) {
|
|
||||||
let cardinality_1_point = utils.calcCardinalityPosition(
|
|
||||||
relation.relation.type1 !== "none",
|
|
||||||
path.points,
|
|
||||||
path.points[0]
|
|
||||||
);
|
|
||||||
let cardinality_2_point = utils.calcCardinalityPosition(
|
|
||||||
relation.relation.type2 !== "none",
|
|
||||||
path.points,
|
|
||||||
path.points[l - 1]
|
|
||||||
);
|
|
||||||
log.debug("cardinality_1_point " + JSON.stringify(cardinality_1_point));
|
|
||||||
log.debug("cardinality_2_point " + JSON.stringify(cardinality_2_point));
|
|
||||||
p1_card_x = cardinality_1_point.x;
|
|
||||||
p1_card_y = cardinality_1_point.y;
|
|
||||||
p2_card_x = cardinality_2_point.x;
|
|
||||||
p2_card_y = cardinality_2_point.y;
|
|
||||||
}
|
|
||||||
if (relation.title !== void 0) {
|
|
||||||
const g = elem.append("g").attr("class", "classLabel");
|
|
||||||
const label = g.append("text").attr("class", "label").attr("x", x).attr("y", y).attr("fill", "red").attr("text-anchor", "middle").text(relation.title);
|
|
||||||
window.label = label;
|
|
||||||
const bounds = label.node().getBBox();
|
|
||||||
g.insert("rect", ":first-child").attr("class", "box").attr("x", bounds.x - conf.padding / 2).attr("y", bounds.y - conf.padding / 2).attr("width", bounds.width + conf.padding).attr("height", bounds.height + conf.padding);
|
|
||||||
}
|
|
||||||
log.info("Rendering relation " + JSON.stringify(relation));
|
|
||||||
if (relation.relationTitle1 !== void 0 && relation.relationTitle1 !== "none") {
|
|
||||||
const g = elem.append("g").attr("class", "cardinality");
|
|
||||||
g.append("text").attr("class", "type1").attr("x", p1_card_x).attr("y", p1_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle1);
|
|
||||||
}
|
|
||||||
if (relation.relationTitle2 !== void 0 && relation.relationTitle2 !== "none") {
|
|
||||||
const g = elem.append("g").attr("class", "cardinality");
|
|
||||||
g.append("text").attr("class", "type2").attr("x", p2_card_x).attr("y", p2_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle2);
|
|
||||||
}
|
|
||||||
edgeCount++;
|
|
||||||
};
|
|
||||||
const drawClass = function(elem, classDef, conf, diagObj) {
|
|
||||||
log.debug("Rendering class ", classDef, conf);
|
|
||||||
const id = classDef.id;
|
|
||||||
const classInfo = {
|
|
||||||
id,
|
|
||||||
label: classDef.id,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
};
|
|
||||||
const g = elem.append("g").attr("id", diagObj.db.lookUpDomId(id)).attr("class", "classGroup");
|
|
||||||
let title;
|
|
||||||
if (classDef.link) {
|
|
||||||
title = g.append("svg:a").attr("xlink:href", classDef.link).attr("target", classDef.linkTarget).append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
} else {
|
|
||||||
title = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
}
|
|
||||||
let isFirst = true;
|
|
||||||
classDef.annotations.forEach(function(member) {
|
|
||||||
const titleText2 = title.append("tspan").text("«" + member + "»");
|
|
||||||
if (!isFirst) {
|
|
||||||
titleText2.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
let classTitleString = getClassTitleString(classDef);
|
|
||||||
const classTitle = title.append("tspan").text(classTitleString).attr("class", "title");
|
|
||||||
if (!isFirst) {
|
|
||||||
classTitle.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
const titleHeight = title.node().getBBox().height;
|
|
||||||
let membersLine;
|
|
||||||
let membersBox;
|
|
||||||
let methodsLine;
|
|
||||||
if (classDef.members.length > 0) {
|
|
||||||
membersLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin / 2).attr("y2", conf.padding + titleHeight + conf.dividerMargin / 2);
|
|
||||||
const members = g.append("text").attr("x", conf.padding).attr("y", titleHeight + conf.dividerMargin + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
isFirst = true;
|
|
||||||
classDef.members.forEach(function(member) {
|
|
||||||
addTspan(members, member, isFirst, conf);
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
membersBox = members.node().getBBox();
|
|
||||||
}
|
|
||||||
if (classDef.methods.length > 0) {
|
|
||||||
methodsLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr("y2", conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
|
|
||||||
const methods = g.append("text").attr("x", conf.padding).attr("y", titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
isFirst = true;
|
|
||||||
classDef.methods.forEach(function(method) {
|
|
||||||
addTspan(methods, method, isFirst, conf);
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const classBox = g.node().getBBox();
|
|
||||||
var cssClassStr = " ";
|
|
||||||
if (classDef.cssClasses.length > 0) {
|
|
||||||
cssClassStr = cssClassStr + classDef.cssClasses.join(" ");
|
|
||||||
}
|
|
||||||
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", classBox.width + 2 * conf.padding).attr("height", classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr("class", cssClassStr);
|
|
||||||
const rectWidth = rect.node().getBBox().width;
|
|
||||||
title.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
|
||||||
});
|
|
||||||
if (classDef.tooltip) {
|
|
||||||
title.insert("title").text(classDef.tooltip);
|
|
||||||
}
|
|
||||||
if (membersLine) {
|
|
||||||
membersLine.attr("x2", rectWidth);
|
|
||||||
}
|
|
||||||
if (methodsLine) {
|
|
||||||
methodsLine.attr("x2", rectWidth);
|
|
||||||
}
|
|
||||||
classInfo.width = rectWidth;
|
|
||||||
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
|
||||||
return classInfo;
|
|
||||||
};
|
|
||||||
const getClassTitleString = function(classDef) {
|
|
||||||
let classTitleString = classDef.id;
|
|
||||||
if (classDef.type) {
|
|
||||||
classTitleString += "<" + parseGenericTypes(classDef.type) + ">";
|
|
||||||
}
|
|
||||||
return classTitleString;
|
|
||||||
};
|
|
||||||
const drawNote = function(elem, note, conf, diagObj) {
|
|
||||||
log.debug("Rendering note ", note, conf);
|
|
||||||
const id = note.id;
|
|
||||||
const noteInfo = {
|
|
||||||
id,
|
|
||||||
text: note.text,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
};
|
|
||||||
const g = elem.append("g").attr("id", id).attr("class", "classGroup");
|
|
||||||
let text = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
const lines = JSON.parse(`"${note.text}"`).split("\n");
|
|
||||||
lines.forEach(function(line2) {
|
|
||||||
log.debug(`Adding line: ${line2}`);
|
|
||||||
text.append("tspan").text(line2).attr("class", "title").attr("dy", conf.textHeight);
|
|
||||||
});
|
|
||||||
const noteBox = g.node().getBBox();
|
|
||||||
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", noteBox.width + 2 * conf.padding).attr(
|
|
||||||
"height",
|
|
||||||
noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin
|
|
||||||
);
|
|
||||||
const rectWidth = rect.node().getBBox().width;
|
|
||||||
text.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
|
||||||
});
|
|
||||||
noteInfo.width = rectWidth;
|
|
||||||
noteInfo.height = noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin;
|
|
||||||
return noteInfo;
|
|
||||||
};
|
|
||||||
const addTspan = function(textEl, member, isFirst, conf) {
|
|
||||||
const { displayText, cssStyle } = member.getDisplayDetails();
|
|
||||||
const tSpan = textEl.append("tspan").attr("x", conf.padding).text(displayText);
|
|
||||||
if (cssStyle !== "") {
|
|
||||||
tSpan.attr("style", member.cssStyle);
|
|
||||||
}
|
|
||||||
if (!isFirst) {
|
|
||||||
tSpan.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const svgDraw = {
|
|
||||||
getClassTitleString,
|
|
||||||
drawClass,
|
|
||||||
drawEdge,
|
|
||||||
drawNote
|
|
||||||
};
|
|
||||||
let idCache = {};
|
|
||||||
const padding = 20;
|
|
||||||
const getGraphId = function(label) {
|
|
||||||
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
|
||||||
if (foundEntry) {
|
|
||||||
return foundEntry[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const insertMarkers = function(elem) {
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
const conf = getConfig().class;
|
|
||||||
idCache = {};
|
|
||||||
log.info("Rendering diagram " + text);
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
|
||||||
const diagram2 = root.select(`[id='${id}']`);
|
|
||||||
insertMarkers(diagram2);
|
|
||||||
const g = new graphlib.Graph({
|
|
||||||
multigraph: true
|
|
||||||
});
|
|
||||||
g.setGraph({
|
|
||||||
isMultiGraph: true
|
|
||||||
});
|
|
||||||
g.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
for (const key of keys) {
|
|
||||||
const classDef = classes[key];
|
|
||||||
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
log.info("Org height: " + node.height);
|
|
||||||
}
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
relations.forEach(function(relation) {
|
|
||||||
log.info(
|
|
||||||
// cspell:ignore tjoho
|
|
||||||
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
|
||||||
);
|
|
||||||
g.setEdge(
|
|
||||||
getGraphId(relation.id1),
|
|
||||||
getGraphId(relation.id2),
|
|
||||||
{
|
|
||||||
relation
|
|
||||||
},
|
|
||||||
relation.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
notes.forEach(function(note) {
|
|
||||||
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
|
||||||
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
if (note.class && note.class in classes) {
|
|
||||||
g.setEdge(
|
|
||||||
note.id,
|
|
||||||
getGraphId(note.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: note.id,
|
|
||||||
id2: note.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layout(g);
|
|
||||||
g.nodes().forEach(function(v) {
|
|
||||||
if (v !== void 0 && g.node(v) !== void 0) {
|
|
||||||
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
|
||||||
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
g.edges().forEach(function(e) {
|
|
||||||
if (e !== void 0 && g.edge(e) !== void 0) {
|
|
||||||
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
|
||||||
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const svgBounds = diagram2.node().getBBox();
|
|
||||||
const width = svgBounds.width + padding * 2;
|
|
||||||
const height = svgBounds.height + padding * 2;
|
|
||||||
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
|
||||||
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
|
||||||
log.debug(`viewBox ${vBox}`);
|
|
||||||
diagram2.attr("viewBox", vBox);
|
|
||||||
};
|
|
||||||
const renderer = {
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
|
@ -1,356 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-d48462a7.js";
|
|
||||||
import { F as curveBasis, A as utils, l as log, G as parseGenericTypes, c as getConfig, j as d3select, k as configureSvgSize } from "./mermaid-c5809711.js";
|
|
||||||
import { G as Graph } from "./graph-af3d5df6.js";
|
|
||||||
import { l as layout } from "./layout-6685625a.js";
|
|
||||||
import { l as line } from "./line-65d70945.js";
|
|
||||||
import "./array-b7dcf730.js";
|
|
||||||
import "./path-39bad7e2.js";
|
|
||||||
let edgeCount = 0;
|
|
||||||
const drawEdge = function(elem, path, relation, conf, diagObj) {
|
|
||||||
const getRelationType = function(type) {
|
|
||||||
switch (type) {
|
|
||||||
case diagObj.db.relationType.AGGREGATION:
|
|
||||||
return "aggregation";
|
|
||||||
case diagObj.db.relationType.EXTENSION:
|
|
||||||
return "extension";
|
|
||||||
case diagObj.db.relationType.COMPOSITION:
|
|
||||||
return "composition";
|
|
||||||
case diagObj.db.relationType.DEPENDENCY:
|
|
||||||
return "dependency";
|
|
||||||
case diagObj.db.relationType.LOLLIPOP:
|
|
||||||
return "lollipop";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
path.points = path.points.filter((p) => !Number.isNaN(p.y));
|
|
||||||
const lineData = path.points;
|
|
||||||
const lineFunction = line().x(function(d) {
|
|
||||||
return d.x;
|
|
||||||
}).y(function(d) {
|
|
||||||
return d.y;
|
|
||||||
}).curve(curveBasis);
|
|
||||||
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "relation");
|
|
||||||
let url = "";
|
|
||||||
if (conf.arrowMarkerAbsolute) {
|
|
||||||
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
|
|
||||||
url = url.replace(/\(/g, "\\(");
|
|
||||||
url = url.replace(/\)/g, "\\)");
|
|
||||||
}
|
|
||||||
if (relation.relation.lineType == 1) {
|
|
||||||
svgPath.attr("class", "relation dashed-line");
|
|
||||||
}
|
|
||||||
if (relation.relation.lineType == 10) {
|
|
||||||
svgPath.attr("class", "relation dotted-line");
|
|
||||||
}
|
|
||||||
if (relation.relation.type1 !== "none") {
|
|
||||||
svgPath.attr(
|
|
||||||
"marker-start",
|
|
||||||
"url(" + url + "#" + getRelationType(relation.relation.type1) + "Start)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (relation.relation.type2 !== "none") {
|
|
||||||
svgPath.attr(
|
|
||||||
"marker-end",
|
|
||||||
"url(" + url + "#" + getRelationType(relation.relation.type2) + "End)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
let x, y;
|
|
||||||
const l = path.points.length;
|
|
||||||
let labelPosition = utils.calcLabelPosition(path.points);
|
|
||||||
x = labelPosition.x;
|
|
||||||
y = labelPosition.y;
|
|
||||||
let p1_card_x, p1_card_y;
|
|
||||||
let p2_card_x, p2_card_y;
|
|
||||||
if (l % 2 !== 0 && l > 1) {
|
|
||||||
let cardinality_1_point = utils.calcCardinalityPosition(
|
|
||||||
relation.relation.type1 !== "none",
|
|
||||||
path.points,
|
|
||||||
path.points[0]
|
|
||||||
);
|
|
||||||
let cardinality_2_point = utils.calcCardinalityPosition(
|
|
||||||
relation.relation.type2 !== "none",
|
|
||||||
path.points,
|
|
||||||
path.points[l - 1]
|
|
||||||
);
|
|
||||||
log.debug("cardinality_1_point " + JSON.stringify(cardinality_1_point));
|
|
||||||
log.debug("cardinality_2_point " + JSON.stringify(cardinality_2_point));
|
|
||||||
p1_card_x = cardinality_1_point.x;
|
|
||||||
p1_card_y = cardinality_1_point.y;
|
|
||||||
p2_card_x = cardinality_2_point.x;
|
|
||||||
p2_card_y = cardinality_2_point.y;
|
|
||||||
}
|
|
||||||
if (relation.title !== void 0) {
|
|
||||||
const g = elem.append("g").attr("class", "classLabel");
|
|
||||||
const label = g.append("text").attr("class", "label").attr("x", x).attr("y", y).attr("fill", "red").attr("text-anchor", "middle").text(relation.title);
|
|
||||||
window.label = label;
|
|
||||||
const bounds = label.node().getBBox();
|
|
||||||
g.insert("rect", ":first-child").attr("class", "box").attr("x", bounds.x - conf.padding / 2).attr("y", bounds.y - conf.padding / 2).attr("width", bounds.width + conf.padding).attr("height", bounds.height + conf.padding);
|
|
||||||
}
|
|
||||||
log.info("Rendering relation " + JSON.stringify(relation));
|
|
||||||
if (relation.relationTitle1 !== void 0 && relation.relationTitle1 !== "none") {
|
|
||||||
const g = elem.append("g").attr("class", "cardinality");
|
|
||||||
g.append("text").attr("class", "type1").attr("x", p1_card_x).attr("y", p1_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle1);
|
|
||||||
}
|
|
||||||
if (relation.relationTitle2 !== void 0 && relation.relationTitle2 !== "none") {
|
|
||||||
const g = elem.append("g").attr("class", "cardinality");
|
|
||||||
g.append("text").attr("class", "type2").attr("x", p2_card_x).attr("y", p2_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle2);
|
|
||||||
}
|
|
||||||
edgeCount++;
|
|
||||||
};
|
|
||||||
const drawClass = function(elem, classDef, conf, diagObj) {
|
|
||||||
log.debug("Rendering class ", classDef, conf);
|
|
||||||
const id = classDef.id;
|
|
||||||
const classInfo = {
|
|
||||||
id,
|
|
||||||
label: classDef.id,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
};
|
|
||||||
const g = elem.append("g").attr("id", diagObj.db.lookUpDomId(id)).attr("class", "classGroup");
|
|
||||||
let title;
|
|
||||||
if (classDef.link) {
|
|
||||||
title = g.append("svg:a").attr("xlink:href", classDef.link).attr("target", classDef.linkTarget).append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
} else {
|
|
||||||
title = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
}
|
|
||||||
let isFirst = true;
|
|
||||||
classDef.annotations.forEach(function(member) {
|
|
||||||
const titleText2 = title.append("tspan").text("«" + member + "»");
|
|
||||||
if (!isFirst) {
|
|
||||||
titleText2.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
let classTitleString = getClassTitleString(classDef);
|
|
||||||
const classTitle = title.append("tspan").text(classTitleString).attr("class", "title");
|
|
||||||
if (!isFirst) {
|
|
||||||
classTitle.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
const titleHeight = title.node().getBBox().height;
|
|
||||||
let membersLine;
|
|
||||||
let membersBox;
|
|
||||||
let methodsLine;
|
|
||||||
if (classDef.members.length > 0) {
|
|
||||||
membersLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin / 2).attr("y2", conf.padding + titleHeight + conf.dividerMargin / 2);
|
|
||||||
const members = g.append("text").attr("x", conf.padding).attr("y", titleHeight + conf.dividerMargin + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
isFirst = true;
|
|
||||||
classDef.members.forEach(function(member) {
|
|
||||||
addTspan(members, member, isFirst, conf);
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
membersBox = members.node().getBBox();
|
|
||||||
}
|
|
||||||
if (classDef.methods.length > 0) {
|
|
||||||
methodsLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr("y2", conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
|
|
||||||
const methods = g.append("text").attr("x", conf.padding).attr("y", titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
isFirst = true;
|
|
||||||
classDef.methods.forEach(function(method) {
|
|
||||||
addTspan(methods, method, isFirst, conf);
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const classBox = g.node().getBBox();
|
|
||||||
var cssClassStr = " ";
|
|
||||||
if (classDef.cssClasses.length > 0) {
|
|
||||||
cssClassStr = cssClassStr + classDef.cssClasses.join(" ");
|
|
||||||
}
|
|
||||||
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", classBox.width + 2 * conf.padding).attr("height", classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr("class", cssClassStr);
|
|
||||||
const rectWidth = rect.node().getBBox().width;
|
|
||||||
title.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
|
||||||
});
|
|
||||||
if (classDef.tooltip) {
|
|
||||||
title.insert("title").text(classDef.tooltip);
|
|
||||||
}
|
|
||||||
if (membersLine) {
|
|
||||||
membersLine.attr("x2", rectWidth);
|
|
||||||
}
|
|
||||||
if (methodsLine) {
|
|
||||||
methodsLine.attr("x2", rectWidth);
|
|
||||||
}
|
|
||||||
classInfo.width = rectWidth;
|
|
||||||
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
|
||||||
return classInfo;
|
|
||||||
};
|
|
||||||
const getClassTitleString = function(classDef) {
|
|
||||||
let classTitleString = classDef.id;
|
|
||||||
if (classDef.type) {
|
|
||||||
classTitleString += "<" + parseGenericTypes(classDef.type) + ">";
|
|
||||||
}
|
|
||||||
return classTitleString;
|
|
||||||
};
|
|
||||||
const drawNote = function(elem, note, conf, diagObj) {
|
|
||||||
log.debug("Rendering note ", note, conf);
|
|
||||||
const id = note.id;
|
|
||||||
const noteInfo = {
|
|
||||||
id,
|
|
||||||
text: note.text,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
};
|
|
||||||
const g = elem.append("g").attr("id", id).attr("class", "classGroup");
|
|
||||||
let text = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
const lines = JSON.parse(`"${note.text}"`).split("\n");
|
|
||||||
lines.forEach(function(line2) {
|
|
||||||
log.debug(`Adding line: ${line2}`);
|
|
||||||
text.append("tspan").text(line2).attr("class", "title").attr("dy", conf.textHeight);
|
|
||||||
});
|
|
||||||
const noteBox = g.node().getBBox();
|
|
||||||
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", noteBox.width + 2 * conf.padding).attr(
|
|
||||||
"height",
|
|
||||||
noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin
|
|
||||||
);
|
|
||||||
const rectWidth = rect.node().getBBox().width;
|
|
||||||
text.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
|
||||||
});
|
|
||||||
noteInfo.width = rectWidth;
|
|
||||||
noteInfo.height = noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin;
|
|
||||||
return noteInfo;
|
|
||||||
};
|
|
||||||
const addTspan = function(textEl, member, isFirst, conf) {
|
|
||||||
const { displayText, cssStyle } = member.getDisplayDetails();
|
|
||||||
const tSpan = textEl.append("tspan").attr("x", conf.padding).text(displayText);
|
|
||||||
if (cssStyle !== "") {
|
|
||||||
tSpan.attr("style", member.cssStyle);
|
|
||||||
}
|
|
||||||
if (!isFirst) {
|
|
||||||
tSpan.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const svgDraw = {
|
|
||||||
getClassTitleString,
|
|
||||||
drawClass,
|
|
||||||
drawEdge,
|
|
||||||
drawNote
|
|
||||||
};
|
|
||||||
let idCache = {};
|
|
||||||
const padding = 20;
|
|
||||||
const getGraphId = function(label) {
|
|
||||||
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
|
||||||
if (foundEntry) {
|
|
||||||
return foundEntry[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const insertMarkers = function(elem) {
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
const conf = getConfig().class;
|
|
||||||
idCache = {};
|
|
||||||
log.info("Rendering diagram " + text);
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = d3select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
|
|
||||||
const diagram2 = root.select(`[id='${id}']`);
|
|
||||||
insertMarkers(diagram2);
|
|
||||||
const g = new Graph({
|
|
||||||
multigraph: true
|
|
||||||
});
|
|
||||||
g.setGraph({
|
|
||||||
isMultiGraph: true
|
|
||||||
});
|
|
||||||
g.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
for (const key of keys) {
|
|
||||||
const classDef = classes[key];
|
|
||||||
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
log.info("Org height: " + node.height);
|
|
||||||
}
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
relations.forEach(function(relation) {
|
|
||||||
log.info(
|
|
||||||
// cspell:ignore tjoho
|
|
||||||
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
|
||||||
);
|
|
||||||
g.setEdge(
|
|
||||||
getGraphId(relation.id1),
|
|
||||||
getGraphId(relation.id2),
|
|
||||||
{
|
|
||||||
relation
|
|
||||||
},
|
|
||||||
relation.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
notes.forEach(function(note) {
|
|
||||||
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
|
||||||
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
if (note.class && note.class in classes) {
|
|
||||||
g.setEdge(
|
|
||||||
note.id,
|
|
||||||
getGraphId(note.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: note.id,
|
|
||||||
id2: note.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layout(g);
|
|
||||||
g.nodes().forEach(function(v) {
|
|
||||||
if (v !== void 0 && g.node(v) !== void 0) {
|
|
||||||
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
|
||||||
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
g.edges().forEach(function(e) {
|
|
||||||
if (e !== void 0 && g.edge(e) !== void 0) {
|
|
||||||
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
|
||||||
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const svgBounds = diagram2.node().getBBox();
|
|
||||||
const width = svgBounds.width + padding * 2;
|
|
||||||
const height = svgBounds.height + padding * 2;
|
|
||||||
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
|
||||||
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
|
||||||
log.debug(`viewBox ${vBox}`);
|
|
||||||
diagram2.attr("viewBox", vBox);
|
|
||||||
};
|
|
||||||
const renderer = {
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
|
@ -1,143 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-d6ad8edb.js";
|
|
||||||
import { g as getConfig, l as log, f as select } from "./config-b4fa35bb.js";
|
|
||||||
import { G as Graph, l as layout } from "./layout-4663fc19.js";
|
|
||||||
import { s as svgDraw } from "./svgDraw-9e97e6db.js";
|
|
||||||
import { c as configureSvgSize } from "./setupGraphViewbox-16a0ba81.js";
|
|
||||||
import "./utils-872dfc50.js";
|
|
||||||
import "./commonDb-7f40ab5a.js";
|
|
||||||
import "./mermaidAPI-6f22a815.js";
|
|
||||||
import "./errorRenderer-ebf63d74.js";
|
|
||||||
import "./isPlainObject-91dd8bc9.js";
|
|
||||||
import "./array-b7dcf730.js";
|
|
||||||
import "./constant-b644328d.js";
|
|
||||||
let idCache = {};
|
|
||||||
const padding = 20;
|
|
||||||
const getGraphId = function(label) {
|
|
||||||
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
|
||||||
if (foundEntry) {
|
|
||||||
return foundEntry[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const insertMarkers = function(elem) {
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
const conf = getConfig().class;
|
|
||||||
idCache = {};
|
|
||||||
log.info("Rendering diagram " + text);
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
|
||||||
const diagram2 = root.select(`[id='${id}']`);
|
|
||||||
insertMarkers(diagram2);
|
|
||||||
const g = new Graph({
|
|
||||||
multigraph: true
|
|
||||||
});
|
|
||||||
g.setGraph({
|
|
||||||
isMultiGraph: true
|
|
||||||
});
|
|
||||||
g.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
for (const key of keys) {
|
|
||||||
const classDef = classes[key];
|
|
||||||
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
log.info("Org height: " + node.height);
|
|
||||||
}
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
relations.forEach(function(relation) {
|
|
||||||
log.info(
|
|
||||||
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
|
||||||
);
|
|
||||||
g.setEdge(
|
|
||||||
getGraphId(relation.id1),
|
|
||||||
getGraphId(relation.id2),
|
|
||||||
{
|
|
||||||
relation
|
|
||||||
},
|
|
||||||
relation.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
notes.forEach(function(note) {
|
|
||||||
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
|
||||||
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
if (note.class && note.class in classes) {
|
|
||||||
g.setEdge(
|
|
||||||
note.id,
|
|
||||||
getGraphId(note.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: note.id,
|
|
||||||
id2: note.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layout(g);
|
|
||||||
g.nodes().forEach(function(v) {
|
|
||||||
if (v !== void 0 && g.node(v) !== void 0) {
|
|
||||||
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
|
||||||
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
g.edges().forEach(function(e) {
|
|
||||||
if (e !== void 0 && g.edge(e) !== void 0) {
|
|
||||||
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
|
||||||
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const svgBounds = diagram2.node().getBBox();
|
|
||||||
const width = svgBounds.width + padding * 2;
|
|
||||||
const height = svgBounds.height + padding * 2;
|
|
||||||
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
|
||||||
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
|
||||||
log.debug(`viewBox ${vBox}`);
|
|
||||||
diagram2.attr("viewBox", vBox);
|
|
||||||
};
|
|
||||||
const renderer = {
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-3ab3550d.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,149 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-0dd3ba1e.js";
|
|
||||||
import { select } from "d3";
|
|
||||||
import { layout } from "dagre-d3-es/src/dagre/index.js";
|
|
||||||
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
|
|
||||||
import { g as getConfig, l as log } from "./config-389b86ff.js";
|
|
||||||
import { s as svgDraw } from "./svgDraw-6a237a99.js";
|
|
||||||
import { c as configureSvgSize } from "./setupGraphViewbox-e35e4124.js";
|
|
||||||
import "./utils-d5eeff82.js";
|
|
||||||
import "@braintree/sanitize-url";
|
|
||||||
import "./commonDb-2ace122b.js";
|
|
||||||
import "lodash-es/memoize.js";
|
|
||||||
import "./mermaidAPI-0716c7c2.js";
|
|
||||||
import "stylis";
|
|
||||||
import "./errorRenderer-d05351b9.js";
|
|
||||||
import "dompurify";
|
|
||||||
import "lodash-es/isEmpty.js";
|
|
||||||
import "dayjs";
|
|
||||||
import "khroma";
|
|
||||||
let idCache = {};
|
|
||||||
const padding = 20;
|
|
||||||
const getGraphId = function(label) {
|
|
||||||
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
|
||||||
if (foundEntry) {
|
|
||||||
return foundEntry[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const insertMarkers = function(elem) {
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
const conf = getConfig().class;
|
|
||||||
idCache = {};
|
|
||||||
log.info("Rendering diagram " + text);
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
|
||||||
const diagram2 = root.select(`[id='${id}']`);
|
|
||||||
insertMarkers(diagram2);
|
|
||||||
const g = new graphlib.Graph({
|
|
||||||
multigraph: true
|
|
||||||
});
|
|
||||||
g.setGraph({
|
|
||||||
isMultiGraph: true
|
|
||||||
});
|
|
||||||
g.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
for (const key of keys) {
|
|
||||||
const classDef = classes[key];
|
|
||||||
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
log.info("Org height: " + node.height);
|
|
||||||
}
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
relations.forEach(function(relation) {
|
|
||||||
log.info(
|
|
||||||
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
|
||||||
);
|
|
||||||
g.setEdge(
|
|
||||||
getGraphId(relation.id1),
|
|
||||||
getGraphId(relation.id2),
|
|
||||||
{
|
|
||||||
relation
|
|
||||||
},
|
|
||||||
relation.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
notes.forEach(function(note) {
|
|
||||||
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
|
||||||
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
if (note.class && note.class in classes) {
|
|
||||||
g.setEdge(
|
|
||||||
note.id,
|
|
||||||
getGraphId(note.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: note.id,
|
|
||||||
id2: note.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layout(g);
|
|
||||||
g.nodes().forEach(function(v) {
|
|
||||||
if (v !== void 0 && g.node(v) !== void 0) {
|
|
||||||
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
|
||||||
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
g.edges().forEach(function(e) {
|
|
||||||
if (e !== void 0 && g.edge(e) !== void 0) {
|
|
||||||
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
|
||||||
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const svgBounds = diagram2.node().getBBox();
|
|
||||||
const width = svgBounds.width + padding * 2;
|
|
||||||
const height = svgBounds.height + padding * 2;
|
|
||||||
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
|
||||||
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
|
||||||
log.debug(`viewBox ${vBox}`);
|
|
||||||
diagram2.attr("viewBox", vBox);
|
|
||||||
};
|
|
||||||
const renderer = {
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-4456d403.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,356 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-36a1a2e8.js";
|
|
||||||
import { F as curveBasis, A as utils, l as log, G as parseGenericTypes, c as getConfig, j as d3select, k as configureSvgSize } from "./mermaid-dcacb631.js";
|
|
||||||
import { G as Graph } from "./graph-fe24fab6.js";
|
|
||||||
import { l as layout } from "./layout-163b9689.js";
|
|
||||||
import { l as line } from "./line-87f517ef.js";
|
|
||||||
import "./array-b7dcf730.js";
|
|
||||||
import "./path-39bad7e2.js";
|
|
||||||
let edgeCount = 0;
|
|
||||||
const drawEdge = function(elem, path, relation, conf, diagObj) {
|
|
||||||
const getRelationType = function(type) {
|
|
||||||
switch (type) {
|
|
||||||
case diagObj.db.relationType.AGGREGATION:
|
|
||||||
return "aggregation";
|
|
||||||
case diagObj.db.relationType.EXTENSION:
|
|
||||||
return "extension";
|
|
||||||
case diagObj.db.relationType.COMPOSITION:
|
|
||||||
return "composition";
|
|
||||||
case diagObj.db.relationType.DEPENDENCY:
|
|
||||||
return "dependency";
|
|
||||||
case diagObj.db.relationType.LOLLIPOP:
|
|
||||||
return "lollipop";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
path.points = path.points.filter((p) => !Number.isNaN(p.y));
|
|
||||||
const lineData = path.points;
|
|
||||||
const lineFunction = line().x(function(d) {
|
|
||||||
return d.x;
|
|
||||||
}).y(function(d) {
|
|
||||||
return d.y;
|
|
||||||
}).curve(curveBasis);
|
|
||||||
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "relation");
|
|
||||||
let url = "";
|
|
||||||
if (conf.arrowMarkerAbsolute) {
|
|
||||||
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
|
|
||||||
url = url.replace(/\(/g, "\\(");
|
|
||||||
url = url.replace(/\)/g, "\\)");
|
|
||||||
}
|
|
||||||
if (relation.relation.lineType == 1) {
|
|
||||||
svgPath.attr("class", "relation dashed-line");
|
|
||||||
}
|
|
||||||
if (relation.relation.lineType == 10) {
|
|
||||||
svgPath.attr("class", "relation dotted-line");
|
|
||||||
}
|
|
||||||
if (relation.relation.type1 !== "none") {
|
|
||||||
svgPath.attr(
|
|
||||||
"marker-start",
|
|
||||||
"url(" + url + "#" + getRelationType(relation.relation.type1) + "Start)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (relation.relation.type2 !== "none") {
|
|
||||||
svgPath.attr(
|
|
||||||
"marker-end",
|
|
||||||
"url(" + url + "#" + getRelationType(relation.relation.type2) + "End)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
let x, y;
|
|
||||||
const l = path.points.length;
|
|
||||||
let labelPosition = utils.calcLabelPosition(path.points);
|
|
||||||
x = labelPosition.x;
|
|
||||||
y = labelPosition.y;
|
|
||||||
let p1_card_x, p1_card_y;
|
|
||||||
let p2_card_x, p2_card_y;
|
|
||||||
if (l % 2 !== 0 && l > 1) {
|
|
||||||
let cardinality_1_point = utils.calcCardinalityPosition(
|
|
||||||
relation.relation.type1 !== "none",
|
|
||||||
path.points,
|
|
||||||
path.points[0]
|
|
||||||
);
|
|
||||||
let cardinality_2_point = utils.calcCardinalityPosition(
|
|
||||||
relation.relation.type2 !== "none",
|
|
||||||
path.points,
|
|
||||||
path.points[l - 1]
|
|
||||||
);
|
|
||||||
log.debug("cardinality_1_point " + JSON.stringify(cardinality_1_point));
|
|
||||||
log.debug("cardinality_2_point " + JSON.stringify(cardinality_2_point));
|
|
||||||
p1_card_x = cardinality_1_point.x;
|
|
||||||
p1_card_y = cardinality_1_point.y;
|
|
||||||
p2_card_x = cardinality_2_point.x;
|
|
||||||
p2_card_y = cardinality_2_point.y;
|
|
||||||
}
|
|
||||||
if (relation.title !== void 0) {
|
|
||||||
const g = elem.append("g").attr("class", "classLabel");
|
|
||||||
const label = g.append("text").attr("class", "label").attr("x", x).attr("y", y).attr("fill", "red").attr("text-anchor", "middle").text(relation.title);
|
|
||||||
window.label = label;
|
|
||||||
const bounds = label.node().getBBox();
|
|
||||||
g.insert("rect", ":first-child").attr("class", "box").attr("x", bounds.x - conf.padding / 2).attr("y", bounds.y - conf.padding / 2).attr("width", bounds.width + conf.padding).attr("height", bounds.height + conf.padding);
|
|
||||||
}
|
|
||||||
log.info("Rendering relation " + JSON.stringify(relation));
|
|
||||||
if (relation.relationTitle1 !== void 0 && relation.relationTitle1 !== "none") {
|
|
||||||
const g = elem.append("g").attr("class", "cardinality");
|
|
||||||
g.append("text").attr("class", "type1").attr("x", p1_card_x).attr("y", p1_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle1);
|
|
||||||
}
|
|
||||||
if (relation.relationTitle2 !== void 0 && relation.relationTitle2 !== "none") {
|
|
||||||
const g = elem.append("g").attr("class", "cardinality");
|
|
||||||
g.append("text").attr("class", "type2").attr("x", p2_card_x).attr("y", p2_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle2);
|
|
||||||
}
|
|
||||||
edgeCount++;
|
|
||||||
};
|
|
||||||
const drawClass = function(elem, classDef, conf, diagObj) {
|
|
||||||
log.debug("Rendering class ", classDef, conf);
|
|
||||||
const id = classDef.id;
|
|
||||||
const classInfo = {
|
|
||||||
id,
|
|
||||||
label: classDef.id,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
};
|
|
||||||
const g = elem.append("g").attr("id", diagObj.db.lookUpDomId(id)).attr("class", "classGroup");
|
|
||||||
let title;
|
|
||||||
if (classDef.link) {
|
|
||||||
title = g.append("svg:a").attr("xlink:href", classDef.link).attr("target", classDef.linkTarget).append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
} else {
|
|
||||||
title = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
}
|
|
||||||
let isFirst = true;
|
|
||||||
classDef.annotations.forEach(function(member) {
|
|
||||||
const titleText2 = title.append("tspan").text("«" + member + "»");
|
|
||||||
if (!isFirst) {
|
|
||||||
titleText2.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
let classTitleString = getClassTitleString(classDef);
|
|
||||||
const classTitle = title.append("tspan").text(classTitleString).attr("class", "title");
|
|
||||||
if (!isFirst) {
|
|
||||||
classTitle.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
const titleHeight = title.node().getBBox().height;
|
|
||||||
let membersLine;
|
|
||||||
let membersBox;
|
|
||||||
let methodsLine;
|
|
||||||
if (classDef.members.length > 0) {
|
|
||||||
membersLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin / 2).attr("y2", conf.padding + titleHeight + conf.dividerMargin / 2);
|
|
||||||
const members = g.append("text").attr("x", conf.padding).attr("y", titleHeight + conf.dividerMargin + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
isFirst = true;
|
|
||||||
classDef.members.forEach(function(member) {
|
|
||||||
addTspan(members, member, isFirst, conf);
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
membersBox = members.node().getBBox();
|
|
||||||
}
|
|
||||||
if (classDef.methods.length > 0) {
|
|
||||||
methodsLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr("y2", conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
|
|
||||||
const methods = g.append("text").attr("x", conf.padding).attr("y", titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
isFirst = true;
|
|
||||||
classDef.methods.forEach(function(method) {
|
|
||||||
addTspan(methods, method, isFirst, conf);
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const classBox = g.node().getBBox();
|
|
||||||
var cssClassStr = " ";
|
|
||||||
if (classDef.cssClasses.length > 0) {
|
|
||||||
cssClassStr = cssClassStr + classDef.cssClasses.join(" ");
|
|
||||||
}
|
|
||||||
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", classBox.width + 2 * conf.padding).attr("height", classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr("class", cssClassStr);
|
|
||||||
const rectWidth = rect.node().getBBox().width;
|
|
||||||
title.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
|
||||||
});
|
|
||||||
if (classDef.tooltip) {
|
|
||||||
title.insert("title").text(classDef.tooltip);
|
|
||||||
}
|
|
||||||
if (membersLine) {
|
|
||||||
membersLine.attr("x2", rectWidth);
|
|
||||||
}
|
|
||||||
if (methodsLine) {
|
|
||||||
methodsLine.attr("x2", rectWidth);
|
|
||||||
}
|
|
||||||
classInfo.width = rectWidth;
|
|
||||||
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
|
||||||
return classInfo;
|
|
||||||
};
|
|
||||||
const getClassTitleString = function(classDef) {
|
|
||||||
let classTitleString = classDef.id;
|
|
||||||
if (classDef.type) {
|
|
||||||
classTitleString += "<" + parseGenericTypes(classDef.type) + ">";
|
|
||||||
}
|
|
||||||
return classTitleString;
|
|
||||||
};
|
|
||||||
const drawNote = function(elem, note, conf, diagObj) {
|
|
||||||
log.debug("Rendering note ", note, conf);
|
|
||||||
const id = note.id;
|
|
||||||
const noteInfo = {
|
|
||||||
id,
|
|
||||||
text: note.text,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
};
|
|
||||||
const g = elem.append("g").attr("id", id).attr("class", "classGroup");
|
|
||||||
let text = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
const lines = JSON.parse(`"${note.text}"`).split("\n");
|
|
||||||
lines.forEach(function(line2) {
|
|
||||||
log.debug(`Adding line: ${line2}`);
|
|
||||||
text.append("tspan").text(line2).attr("class", "title").attr("dy", conf.textHeight);
|
|
||||||
});
|
|
||||||
const noteBox = g.node().getBBox();
|
|
||||||
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", noteBox.width + 2 * conf.padding).attr(
|
|
||||||
"height",
|
|
||||||
noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin
|
|
||||||
);
|
|
||||||
const rectWidth = rect.node().getBBox().width;
|
|
||||||
text.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
|
||||||
});
|
|
||||||
noteInfo.width = rectWidth;
|
|
||||||
noteInfo.height = noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin;
|
|
||||||
return noteInfo;
|
|
||||||
};
|
|
||||||
const addTspan = function(textEl, member, isFirst, conf) {
|
|
||||||
const { displayText, cssStyle } = member.getDisplayDetails();
|
|
||||||
const tSpan = textEl.append("tspan").attr("x", conf.padding).text(displayText);
|
|
||||||
if (cssStyle !== "") {
|
|
||||||
tSpan.attr("style", member.cssStyle);
|
|
||||||
}
|
|
||||||
if (!isFirst) {
|
|
||||||
tSpan.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const svgDraw = {
|
|
||||||
getClassTitleString,
|
|
||||||
drawClass,
|
|
||||||
drawEdge,
|
|
||||||
drawNote
|
|
||||||
};
|
|
||||||
let idCache = {};
|
|
||||||
const padding = 20;
|
|
||||||
const getGraphId = function(label) {
|
|
||||||
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
|
||||||
if (foundEntry) {
|
|
||||||
return foundEntry[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const insertMarkers = function(elem) {
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
const conf = getConfig().class;
|
|
||||||
idCache = {};
|
|
||||||
log.info("Rendering diagram " + text);
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = d3select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
|
|
||||||
const diagram2 = root.select(`[id='${id}']`);
|
|
||||||
insertMarkers(diagram2);
|
|
||||||
const g = new Graph({
|
|
||||||
multigraph: true
|
|
||||||
});
|
|
||||||
g.setGraph({
|
|
||||||
isMultiGraph: true
|
|
||||||
});
|
|
||||||
g.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
for (const key of keys) {
|
|
||||||
const classDef = classes[key];
|
|
||||||
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
log.info("Org height: " + node.height);
|
|
||||||
}
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
relations.forEach(function(relation) {
|
|
||||||
log.info(
|
|
||||||
// cspell:ignore tjoho
|
|
||||||
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
|
||||||
);
|
|
||||||
g.setEdge(
|
|
||||||
getGraphId(relation.id1),
|
|
||||||
getGraphId(relation.id2),
|
|
||||||
{
|
|
||||||
relation
|
|
||||||
},
|
|
||||||
relation.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
notes.forEach(function(note) {
|
|
||||||
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
|
||||||
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
if (note.class && note.class in classes) {
|
|
||||||
g.setEdge(
|
|
||||||
note.id,
|
|
||||||
getGraphId(note.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: note.id,
|
|
||||||
id2: note.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layout(g);
|
|
||||||
g.nodes().forEach(function(v) {
|
|
||||||
if (v !== void 0 && g.node(v) !== void 0) {
|
|
||||||
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
|
||||||
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
g.edges().forEach(function(e) {
|
|
||||||
if (e !== void 0 && g.edge(e) !== void 0) {
|
|
||||||
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
|
||||||
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const svgBounds = diagram2.node().getBBox();
|
|
||||||
const width = svgBounds.width + padding * 2;
|
|
||||||
const height = svgBounds.height + padding * 2;
|
|
||||||
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
|
||||||
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
|
||||||
log.debug(`viewBox ${vBox}`);
|
|
||||||
diagram2.attr("viewBox", vBox);
|
|
||||||
};
|
|
||||||
const renderer = {
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
|
@ -1,220 +0,0 @@
|
||||||
import { p as A, d as S, s as G } from "./styles-4bdb8b48.js";
|
|
||||||
import { F as W, A as B, l as u, G as I, c as H, j as M, k as O } from "./mermaid-00886c59.js";
|
|
||||||
import { G as P } from "./graph-dee88f0d.js";
|
|
||||||
import { l as X } from "./layout-03086fc5.js";
|
|
||||||
import { l as Y } from "./line-79437661.js";
|
|
||||||
import "./array-2ff2c7a6.js";
|
|
||||||
import "./path-428ebac9.js";
|
|
||||||
let _ = 0;
|
|
||||||
const $ = function(i, a, t, o, p) {
|
|
||||||
const g = function(e) {
|
|
||||||
switch (e) {
|
|
||||||
case p.db.relationType.AGGREGATION:
|
|
||||||
return "aggregation";
|
|
||||||
case p.db.relationType.EXTENSION:
|
|
||||||
return "extension";
|
|
||||||
case p.db.relationType.COMPOSITION:
|
|
||||||
return "composition";
|
|
||||||
case p.db.relationType.DEPENDENCY:
|
|
||||||
return "dependency";
|
|
||||||
case p.db.relationType.LOLLIPOP:
|
|
||||||
return "lollipop";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
a.points = a.points.filter((e) => !Number.isNaN(e.y));
|
|
||||||
const s = a.points, c = Y().x(function(e) {
|
|
||||||
return e.x;
|
|
||||||
}).y(function(e) {
|
|
||||||
return e.y;
|
|
||||||
}).curve(W), n = i.append("path").attr("d", c(s)).attr("id", "edge" + _).attr("class", "relation");
|
|
||||||
let r = "";
|
|
||||||
o.arrowMarkerAbsolute && (r = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, r = r.replace(/\(/g, "\\("), r = r.replace(/\)/g, "\\)")), t.relation.lineType == 1 && n.attr("class", "relation dashed-line"), t.relation.lineType == 10 && n.attr("class", "relation dotted-line"), t.relation.type1 !== "none" && n.attr(
|
|
||||||
"marker-start",
|
|
||||||
"url(" + r + "#" + g(t.relation.type1) + "Start)"
|
|
||||||
), t.relation.type2 !== "none" && n.attr(
|
|
||||||
"marker-end",
|
|
||||||
"url(" + r + "#" + g(t.relation.type2) + "End)"
|
|
||||||
);
|
|
||||||
let f, h;
|
|
||||||
const x = a.points.length;
|
|
||||||
let k = B.calcLabelPosition(a.points);
|
|
||||||
f = k.x, h = k.y;
|
|
||||||
let y, m, w, b;
|
|
||||||
if (x % 2 !== 0 && x > 1) {
|
|
||||||
let e = B.calcCardinalityPosition(
|
|
||||||
t.relation.type1 !== "none",
|
|
||||||
a.points,
|
|
||||||
a.points[0]
|
|
||||||
), d = B.calcCardinalityPosition(
|
|
||||||
t.relation.type2 !== "none",
|
|
||||||
a.points,
|
|
||||||
a.points[x - 1]
|
|
||||||
);
|
|
||||||
u.debug("cardinality_1_point " + JSON.stringify(e)), u.debug("cardinality_2_point " + JSON.stringify(d)), y = e.x, m = e.y, w = d.x, b = d.y;
|
|
||||||
}
|
|
||||||
if (t.title !== void 0) {
|
|
||||||
const e = i.append("g").attr("class", "classLabel"), d = e.append("text").attr("class", "label").attr("x", f).attr("y", h).attr("fill", "red").attr("text-anchor", "middle").text(t.title);
|
|
||||||
window.label = d;
|
|
||||||
const l = d.node().getBBox();
|
|
||||||
e.insert("rect", ":first-child").attr("class", "box").attr("x", l.x - o.padding / 2).attr("y", l.y - o.padding / 2).attr("width", l.width + o.padding).attr("height", l.height + o.padding);
|
|
||||||
}
|
|
||||||
u.info("Rendering relation " + JSON.stringify(t)), t.relationTitle1 !== void 0 && t.relationTitle1 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type1").attr("x", y).attr("y", m).attr("fill", "black").attr("font-size", "6").text(t.relationTitle1), t.relationTitle2 !== void 0 && t.relationTitle2 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type2").attr("x", w).attr("y", b).attr("fill", "black").attr("font-size", "6").text(t.relationTitle2), _++;
|
|
||||||
}, J = function(i, a, t, o) {
|
|
||||||
u.debug("Rendering class ", a, t);
|
|
||||||
const p = a.id, g = {
|
|
||||||
id: p,
|
|
||||||
label: a.id,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
}, s = i.append("g").attr("id", o.db.lookUpDomId(p)).attr("class", "classGroup");
|
|
||||||
let c;
|
|
||||||
a.link ? c = s.append("svg:a").attr("xlink:href", a.link).attr("target", a.linkTarget).append("text").attr("y", t.textHeight + t.padding).attr("x", 0) : c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
|
||||||
let n = !0;
|
|
||||||
a.annotations.forEach(function(d) {
|
|
||||||
const l = c.append("tspan").text("«" + d + "»");
|
|
||||||
n || l.attr("dy", t.textHeight), n = !1;
|
|
||||||
});
|
|
||||||
let r = C(a);
|
|
||||||
const f = c.append("tspan").text(r).attr("class", "title");
|
|
||||||
n || f.attr("dy", t.textHeight);
|
|
||||||
const h = c.node().getBBox().height;
|
|
||||||
let x, k, y;
|
|
||||||
if (a.members.length > 0) {
|
|
||||||
x = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin / 2).attr("y2", t.padding + h + t.dividerMargin / 2);
|
|
||||||
const d = s.append("text").attr("x", t.padding).attr("y", h + t.dividerMargin + t.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
n = !0, a.members.forEach(function(l) {
|
|
||||||
v(d, l, n, t), n = !1;
|
|
||||||
}), k = d.node().getBBox();
|
|
||||||
}
|
|
||||||
if (a.methods.length > 0) {
|
|
||||||
y = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin + k.height).attr("y2", t.padding + h + t.dividerMargin + k.height);
|
|
||||||
const d = s.append("text").attr("x", t.padding).attr("y", h + 2 * t.dividerMargin + k.height + t.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
n = !0, a.methods.forEach(function(l) {
|
|
||||||
v(d, l, n, t), n = !1;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const m = s.node().getBBox();
|
|
||||||
var w = " ";
|
|
||||||
a.cssClasses.length > 0 && (w = w + a.cssClasses.join(" "));
|
|
||||||
const e = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", m.width + 2 * t.padding).attr("height", m.height + t.padding + 0.5 * t.dividerMargin).attr("class", w).node().getBBox().width;
|
|
||||||
return c.node().childNodes.forEach(function(d) {
|
|
||||||
d.setAttribute("x", (e - d.getBBox().width) / 2);
|
|
||||||
}), a.tooltip && c.insert("title").text(a.tooltip), x && x.attr("x2", e), y && y.attr("x2", e), g.width = e, g.height = m.height + t.padding + 0.5 * t.dividerMargin, g;
|
|
||||||
}, C = function(i) {
|
|
||||||
let a = i.id;
|
|
||||||
return i.type && (a += "<" + I(i.type) + ">"), a;
|
|
||||||
}, Z = function(i, a, t, o) {
|
|
||||||
u.debug("Rendering note ", a, t);
|
|
||||||
const p = a.id, g = {
|
|
||||||
id: p,
|
|
||||||
text: a.text,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
}, s = i.append("g").attr("id", p).attr("class", "classGroup");
|
|
||||||
let c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
|
||||||
const n = JSON.parse(`"${a.text}"`).split(`
|
|
||||||
`);
|
|
||||||
n.forEach(function(x) {
|
|
||||||
u.debug(`Adding line: ${x}`), c.append("tspan").text(x).attr("class", "title").attr("dy", t.textHeight);
|
|
||||||
});
|
|
||||||
const r = s.node().getBBox(), h = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", r.width + 2 * t.padding).attr(
|
|
||||||
"height",
|
|
||||||
r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin
|
|
||||||
).node().getBBox().width;
|
|
||||||
return c.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (h - x.getBBox().width) / 2);
|
|
||||||
}), g.width = h, g.height = r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin, g;
|
|
||||||
}, v = function(i, a, t, o) {
|
|
||||||
const { displayText: p, cssStyle: g } = a.getDisplayDetails(), s = i.append("tspan").attr("x", o.padding).text(p);
|
|
||||||
g !== "" && s.attr("style", a.cssStyle), t || s.attr("dy", o.textHeight);
|
|
||||||
}, N = {
|
|
||||||
getClassTitleString: C,
|
|
||||||
drawClass: J,
|
|
||||||
drawEdge: $,
|
|
||||||
drawNote: Z
|
|
||||||
};
|
|
||||||
let T = {};
|
|
||||||
const E = 20, L = function(i) {
|
|
||||||
const a = Object.entries(T).find((t) => t[1].label === i);
|
|
||||||
if (a)
|
|
||||||
return a[0];
|
|
||||||
}, R = function(i) {
|
|
||||||
i.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), i.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), i.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), i.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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
}, F = function(i, a, t, o) {
|
|
||||||
const p = H().class;
|
|
||||||
T = {}, u.info("Rendering diagram " + i);
|
|
||||||
const g = H().securityLevel;
|
|
||||||
let s;
|
|
||||||
g === "sandbox" && (s = M("#i" + a));
|
|
||||||
const c = g === "sandbox" ? M(s.nodes()[0].contentDocument.body) : M("body"), n = c.select(`[id='${a}']`);
|
|
||||||
R(n);
|
|
||||||
const r = new P({
|
|
||||||
multigraph: !0
|
|
||||||
});
|
|
||||||
r.setGraph({
|
|
||||||
isMultiGraph: !0
|
|
||||||
}), r.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const f = o.db.getClasses(), h = Object.keys(f);
|
|
||||||
for (const e of h) {
|
|
||||||
const d = f[e], l = N.drawClass(n, d, p, o);
|
|
||||||
T[l.id] = l, r.setNode(l.id, l), u.info("Org height: " + l.height);
|
|
||||||
}
|
|
||||||
o.db.getRelations().forEach(function(e) {
|
|
||||||
u.info(
|
|
||||||
// cspell:ignore tjoho
|
|
||||||
"tjoho" + L(e.id1) + L(e.id2) + JSON.stringify(e)
|
|
||||||
), r.setEdge(
|
|
||||||
L(e.id1),
|
|
||||||
L(e.id2),
|
|
||||||
{
|
|
||||||
relation: e
|
|
||||||
},
|
|
||||||
e.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
}), o.db.getNotes().forEach(function(e) {
|
|
||||||
u.debug(`Adding note: ${JSON.stringify(e)}`);
|
|
||||||
const d = N.drawNote(n, e, p, o);
|
|
||||||
T[d.id] = d, r.setNode(d.id, d), e.class && e.class in f && r.setEdge(
|
|
||||||
e.id,
|
|
||||||
L(e.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: e.id,
|
|
||||||
id2: e.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}), X(r), r.nodes().forEach(function(e) {
|
|
||||||
e !== void 0 && r.node(e) !== void 0 && (u.debug("Node " + e + ": " + JSON.stringify(r.node(e))), c.select("#" + (o.db.lookUpDomId(e) || e)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
|
|
||||||
));
|
|
||||||
}), r.edges().forEach(function(e) {
|
|
||||||
e !== void 0 && r.edge(e) !== void 0 && (u.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(r.edge(e))), N.drawEdge(n, r.edge(e), r.edge(e).relation, p, o));
|
|
||||||
});
|
|
||||||
const y = n.node().getBBox(), m = y.width + E * 2, w = y.height + E * 2;
|
|
||||||
O(n, w, m, p.useMaxWidth);
|
|
||||||
const b = `${y.x - E} ${y.y - E} ${m} ${w}`;
|
|
||||||
u.debug(`viewBox ${b}`), n.attr("viewBox", b);
|
|
||||||
}, U = {
|
|
||||||
draw: F
|
|
||||||
}, tt = {
|
|
||||||
parser: A,
|
|
||||||
db: S,
|
|
||||||
renderer: U,
|
|
||||||
styles: G,
|
|
||||||
init: (i) => {
|
|
||||||
i.class || (i.class = {}), i.class.arrowMarkerAbsolute = i.arrowMarkerAbsolute, S.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
tt as diagram
|
|
||||||
};
|
|
|
@ -1,149 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-b8bd0053.js";
|
|
||||||
import { select } from "d3";
|
|
||||||
import { layout } from "dagre-d3-es/src/dagre/index.js";
|
|
||||||
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
|
|
||||||
import { g as getConfig, l as log } from "./config-389b86ff.js";
|
|
||||||
import { s as svgDraw } from "./svgDraw-6a237a99.js";
|
|
||||||
import { c as configureSvgSize } from "./setupGraphViewbox-e35e4124.js";
|
|
||||||
import "./utils-d5eeff82.js";
|
|
||||||
import "@braintree/sanitize-url";
|
|
||||||
import "./commonDb-2ace122b.js";
|
|
||||||
import "lodash-es/memoize.js";
|
|
||||||
import "./mermaidAPI-b17c596d.js";
|
|
||||||
import "stylis";
|
|
||||||
import "./errorRenderer-d05351b9.js";
|
|
||||||
import "dompurify";
|
|
||||||
import "lodash-es/isEmpty.js";
|
|
||||||
import "dayjs";
|
|
||||||
import "khroma";
|
|
||||||
let idCache = {};
|
|
||||||
const padding = 20;
|
|
||||||
const getGraphId = function(label) {
|
|
||||||
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
|
||||||
if (foundEntry) {
|
|
||||||
return foundEntry[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const insertMarkers = function(elem) {
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
const conf = getConfig().class;
|
|
||||||
idCache = {};
|
|
||||||
log.info("Rendering diagram " + text);
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
|
||||||
const diagram2 = root.select(`[id='${id}']`);
|
|
||||||
insertMarkers(diagram2);
|
|
||||||
const g = new graphlib.Graph({
|
|
||||||
multigraph: true
|
|
||||||
});
|
|
||||||
g.setGraph({
|
|
||||||
isMultiGraph: true
|
|
||||||
});
|
|
||||||
g.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
for (const key of keys) {
|
|
||||||
const classDef = classes[key];
|
|
||||||
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
log.info("Org height: " + node.height);
|
|
||||||
}
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
relations.forEach(function(relation) {
|
|
||||||
log.info(
|
|
||||||
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
|
||||||
);
|
|
||||||
g.setEdge(
|
|
||||||
getGraphId(relation.id1),
|
|
||||||
getGraphId(relation.id2),
|
|
||||||
{
|
|
||||||
relation
|
|
||||||
},
|
|
||||||
relation.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
notes.forEach(function(note) {
|
|
||||||
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
|
||||||
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
if (note.class && note.class in classes) {
|
|
||||||
g.setEdge(
|
|
||||||
note.id,
|
|
||||||
getGraphId(note.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: note.id,
|
|
||||||
id2: note.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layout(g);
|
|
||||||
g.nodes().forEach(function(v) {
|
|
||||||
if (v !== void 0 && g.node(v) !== void 0) {
|
|
||||||
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
|
||||||
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
g.edges().forEach(function(e) {
|
|
||||||
if (e !== void 0 && g.edge(e) !== void 0) {
|
|
||||||
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
|
||||||
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const svgBounds = diagram2.node().getBBox();
|
|
||||||
const width = svgBounds.width + padding * 2;
|
|
||||||
const height = svgBounds.height + padding * 2;
|
|
||||||
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
|
||||||
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
|
||||||
log.debug(`viewBox ${vBox}`);
|
|
||||||
diagram2.attr("viewBox", vBox);
|
|
||||||
};
|
|
||||||
const renderer = {
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-ef563e47.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,97 +0,0 @@
|
||||||
import { p as W, d as M, s as H } from "./styles-e9bde71f.js";
|
|
||||||
import { g as S, l as d, f as u } from "./config-e567ef17.js";
|
|
||||||
import { G as X, l as Y } from "./layout-10a68736.js";
|
|
||||||
import { s as l } from "./svgDraw-c2c52520.js";
|
|
||||||
import { c as Z } from "./setupGraphViewbox-a4603a92.js";
|
|
||||||
import "./utils-aa888deb.js";
|
|
||||||
import "./commonDb-4dc3d465.js";
|
|
||||||
import "./mermaidAPI-51c0c26b.js";
|
|
||||||
import "./errorRenderer-a3c4bedb.js";
|
|
||||||
import "./isPlainObject-bb374f45.js";
|
|
||||||
import "./array-2ff2c7a6.js";
|
|
||||||
import "./constant-2fe7eae5.js";
|
|
||||||
let h = {};
|
|
||||||
const g = 20, p = function(e) {
|
|
||||||
const s = Object.entries(h).find((k) => k[1].label === e);
|
|
||||||
if (s)
|
|
||||||
return s[0];
|
|
||||||
}, D = function(e) {
|
|
||||||
e.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), e.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), e.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), e.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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
}, $ = function(e, s, k, a) {
|
|
||||||
const f = S().class;
|
|
||||||
h = {}, d.info("Rendering diagram " + e);
|
|
||||||
const L = S().securityLevel;
|
|
||||||
let y;
|
|
||||||
L === "sandbox" && (y = u("#i" + s));
|
|
||||||
const x = L === "sandbox" ? u(y.nodes()[0].contentDocument.body) : u("body"), n = x.select(`[id='${s}']`);
|
|
||||||
D(n);
|
|
||||||
const r = new X({
|
|
||||||
multigraph: !0
|
|
||||||
});
|
|
||||||
r.setGraph({
|
|
||||||
isMultiGraph: !0
|
|
||||||
}), r.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const m = a.db.getClasses(), N = Object.keys(m);
|
|
||||||
for (const t of N) {
|
|
||||||
const o = m[t], i = l.drawClass(n, o, f, a);
|
|
||||||
h[i.id] = i, r.setNode(i.id, i), d.info("Org height: " + i.height);
|
|
||||||
}
|
|
||||||
a.db.getRelations().forEach(function(t) {
|
|
||||||
d.info(
|
|
||||||
"tjoho" + p(t.id1) + p(t.id2) + JSON.stringify(t)
|
|
||||||
), r.setEdge(
|
|
||||||
p(t.id1),
|
|
||||||
p(t.id2),
|
|
||||||
{
|
|
||||||
relation: t
|
|
||||||
},
|
|
||||||
t.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
}), a.db.getNotes().forEach(function(t) {
|
|
||||||
d.debug(`Adding note: ${JSON.stringify(t)}`);
|
|
||||||
const o = l.drawNote(n, t, f, a);
|
|
||||||
h[o.id] = o, r.setNode(o.id, o), t.class && t.class in m && r.setEdge(
|
|
||||||
t.id,
|
|
||||||
p(t.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: t.id,
|
|
||||||
id2: t.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}), Y(r), r.nodes().forEach(function(t) {
|
|
||||||
t !== void 0 && r.node(t) !== void 0 && (d.debug("Node " + t + ": " + JSON.stringify(r.node(t))), x.select("#" + (a.db.lookUpDomId(t) || t)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (r.node(t).x - r.node(t).width / 2) + "," + (r.node(t).y - r.node(t).height / 2) + " )"
|
|
||||||
));
|
|
||||||
}), r.edges().forEach(function(t) {
|
|
||||||
t !== void 0 && r.edge(t) !== void 0 && (d.debug("Edge " + t.v + " -> " + t.w + ": " + JSON.stringify(r.edge(t))), l.drawEdge(n, r.edge(t), r.edge(t).relation, f, a));
|
|
||||||
});
|
|
||||||
const c = n.node().getBBox(), E = c.width + g * 2, b = c.height + g * 2;
|
|
||||||
Z(n, b, E, f.useMaxWidth);
|
|
||||||
const w = `${c.x - g} ${c.y - g} ${E} ${b}`;
|
|
||||||
d.debug(`viewBox ${w}`), n.attr("viewBox", w);
|
|
||||||
}, B = {
|
|
||||||
draw: $
|
|
||||||
}, q = {
|
|
||||||
parser: W,
|
|
||||||
db: M,
|
|
||||||
renderer: B,
|
|
||||||
styles: H,
|
|
||||||
init: (e) => {
|
|
||||||
e.class || (e.class = {}), e.class.arrowMarkerAbsolute = e.arrowMarkerAbsolute, M.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
q as diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-f04b3d8f.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,220 +0,0 @@
|
||||||
import { p as A, d as S, s as G } from "./styles-11e81fdd.js";
|
|
||||||
import { F as W, A as B, l as u, G as I, c as H, j as M, k as O } from "./mermaid-9f2aa176.js";
|
|
||||||
import { G as P } from "./graph-0ee63739.js";
|
|
||||||
import { l as X } from "./layout-fd473db2.js";
|
|
||||||
import { l as Y } from "./line-24d93f1b.js";
|
|
||||||
import "./array-2ff2c7a6.js";
|
|
||||||
import "./path-428ebac9.js";
|
|
||||||
let _ = 0;
|
|
||||||
const $ = function(i, a, t, o, p) {
|
|
||||||
const g = function(e) {
|
|
||||||
switch (e) {
|
|
||||||
case p.db.relationType.AGGREGATION:
|
|
||||||
return "aggregation";
|
|
||||||
case p.db.relationType.EXTENSION:
|
|
||||||
return "extension";
|
|
||||||
case p.db.relationType.COMPOSITION:
|
|
||||||
return "composition";
|
|
||||||
case p.db.relationType.DEPENDENCY:
|
|
||||||
return "dependency";
|
|
||||||
case p.db.relationType.LOLLIPOP:
|
|
||||||
return "lollipop";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
a.points = a.points.filter((e) => !Number.isNaN(e.y));
|
|
||||||
const s = a.points, c = Y().x(function(e) {
|
|
||||||
return e.x;
|
|
||||||
}).y(function(e) {
|
|
||||||
return e.y;
|
|
||||||
}).curve(W), n = i.append("path").attr("d", c(s)).attr("id", "edge" + _).attr("class", "relation");
|
|
||||||
let r = "";
|
|
||||||
o.arrowMarkerAbsolute && (r = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, r = r.replace(/\(/g, "\\("), r = r.replace(/\)/g, "\\)")), t.relation.lineType == 1 && n.attr("class", "relation dashed-line"), t.relation.lineType == 10 && n.attr("class", "relation dotted-line"), t.relation.type1 !== "none" && n.attr(
|
|
||||||
"marker-start",
|
|
||||||
"url(" + r + "#" + g(t.relation.type1) + "Start)"
|
|
||||||
), t.relation.type2 !== "none" && n.attr(
|
|
||||||
"marker-end",
|
|
||||||
"url(" + r + "#" + g(t.relation.type2) + "End)"
|
|
||||||
);
|
|
||||||
let f, h;
|
|
||||||
const x = a.points.length;
|
|
||||||
let k = B.calcLabelPosition(a.points);
|
|
||||||
f = k.x, h = k.y;
|
|
||||||
let y, m, w, b;
|
|
||||||
if (x % 2 !== 0 && x > 1) {
|
|
||||||
let e = B.calcCardinalityPosition(
|
|
||||||
t.relation.type1 !== "none",
|
|
||||||
a.points,
|
|
||||||
a.points[0]
|
|
||||||
), d = B.calcCardinalityPosition(
|
|
||||||
t.relation.type2 !== "none",
|
|
||||||
a.points,
|
|
||||||
a.points[x - 1]
|
|
||||||
);
|
|
||||||
u.debug("cardinality_1_point " + JSON.stringify(e)), u.debug("cardinality_2_point " + JSON.stringify(d)), y = e.x, m = e.y, w = d.x, b = d.y;
|
|
||||||
}
|
|
||||||
if (t.title !== void 0) {
|
|
||||||
const e = i.append("g").attr("class", "classLabel"), d = e.append("text").attr("class", "label").attr("x", f).attr("y", h).attr("fill", "red").attr("text-anchor", "middle").text(t.title);
|
|
||||||
window.label = d;
|
|
||||||
const l = d.node().getBBox();
|
|
||||||
e.insert("rect", ":first-child").attr("class", "box").attr("x", l.x - o.padding / 2).attr("y", l.y - o.padding / 2).attr("width", l.width + o.padding).attr("height", l.height + o.padding);
|
|
||||||
}
|
|
||||||
u.info("Rendering relation " + JSON.stringify(t)), t.relationTitle1 !== void 0 && t.relationTitle1 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type1").attr("x", y).attr("y", m).attr("fill", "black").attr("font-size", "6").text(t.relationTitle1), t.relationTitle2 !== void 0 && t.relationTitle2 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type2").attr("x", w).attr("y", b).attr("fill", "black").attr("font-size", "6").text(t.relationTitle2), _++;
|
|
||||||
}, J = function(i, a, t, o) {
|
|
||||||
u.debug("Rendering class ", a, t);
|
|
||||||
const p = a.id, g = {
|
|
||||||
id: p,
|
|
||||||
label: a.id,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
}, s = i.append("g").attr("id", o.db.lookUpDomId(p)).attr("class", "classGroup");
|
|
||||||
let c;
|
|
||||||
a.link ? c = s.append("svg:a").attr("xlink:href", a.link).attr("target", a.linkTarget).append("text").attr("y", t.textHeight + t.padding).attr("x", 0) : c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
|
||||||
let n = !0;
|
|
||||||
a.annotations.forEach(function(d) {
|
|
||||||
const l = c.append("tspan").text("«" + d + "»");
|
|
||||||
n || l.attr("dy", t.textHeight), n = !1;
|
|
||||||
});
|
|
||||||
let r = C(a);
|
|
||||||
const f = c.append("tspan").text(r).attr("class", "title");
|
|
||||||
n || f.attr("dy", t.textHeight);
|
|
||||||
const h = c.node().getBBox().height;
|
|
||||||
let x, k, y;
|
|
||||||
if (a.members.length > 0) {
|
|
||||||
x = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin / 2).attr("y2", t.padding + h + t.dividerMargin / 2);
|
|
||||||
const d = s.append("text").attr("x", t.padding).attr("y", h + t.dividerMargin + t.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
n = !0, a.members.forEach(function(l) {
|
|
||||||
v(d, l, n, t), n = !1;
|
|
||||||
}), k = d.node().getBBox();
|
|
||||||
}
|
|
||||||
if (a.methods.length > 0) {
|
|
||||||
y = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin + k.height).attr("y2", t.padding + h + t.dividerMargin + k.height);
|
|
||||||
const d = s.append("text").attr("x", t.padding).attr("y", h + 2 * t.dividerMargin + k.height + t.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
n = !0, a.methods.forEach(function(l) {
|
|
||||||
v(d, l, n, t), n = !1;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const m = s.node().getBBox();
|
|
||||||
var w = " ";
|
|
||||||
a.cssClasses.length > 0 && (w = w + a.cssClasses.join(" "));
|
|
||||||
const e = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", m.width + 2 * t.padding).attr("height", m.height + t.padding + 0.5 * t.dividerMargin).attr("class", w).node().getBBox().width;
|
|
||||||
return c.node().childNodes.forEach(function(d) {
|
|
||||||
d.setAttribute("x", (e - d.getBBox().width) / 2);
|
|
||||||
}), a.tooltip && c.insert("title").text(a.tooltip), x && x.attr("x2", e), y && y.attr("x2", e), g.width = e, g.height = m.height + t.padding + 0.5 * t.dividerMargin, g;
|
|
||||||
}, C = function(i) {
|
|
||||||
let a = i.id;
|
|
||||||
return i.type && (a += "<" + I(i.type) + ">"), a;
|
|
||||||
}, Z = function(i, a, t, o) {
|
|
||||||
u.debug("Rendering note ", a, t);
|
|
||||||
const p = a.id, g = {
|
|
||||||
id: p,
|
|
||||||
text: a.text,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
}, s = i.append("g").attr("id", p).attr("class", "classGroup");
|
|
||||||
let c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
|
||||||
const n = JSON.parse(`"${a.text}"`).split(`
|
|
||||||
`);
|
|
||||||
n.forEach(function(x) {
|
|
||||||
u.debug(`Adding line: ${x}`), c.append("tspan").text(x).attr("class", "title").attr("dy", t.textHeight);
|
|
||||||
});
|
|
||||||
const r = s.node().getBBox(), h = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", r.width + 2 * t.padding).attr(
|
|
||||||
"height",
|
|
||||||
r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin
|
|
||||||
).node().getBBox().width;
|
|
||||||
return c.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (h - x.getBBox().width) / 2);
|
|
||||||
}), g.width = h, g.height = r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin, g;
|
|
||||||
}, v = function(i, a, t, o) {
|
|
||||||
const { displayText: p, cssStyle: g } = a.getDisplayDetails(), s = i.append("tspan").attr("x", o.padding).text(p);
|
|
||||||
g !== "" && s.attr("style", a.cssStyle), t || s.attr("dy", o.textHeight);
|
|
||||||
}, N = {
|
|
||||||
getClassTitleString: C,
|
|
||||||
drawClass: J,
|
|
||||||
drawEdge: $,
|
|
||||||
drawNote: Z
|
|
||||||
};
|
|
||||||
let T = {};
|
|
||||||
const E = 20, L = function(i) {
|
|
||||||
const a = Object.entries(T).find((t) => t[1].label === i);
|
|
||||||
if (a)
|
|
||||||
return a[0];
|
|
||||||
}, R = function(i) {
|
|
||||||
i.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), i.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), i.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), i.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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
}, F = function(i, a, t, o) {
|
|
||||||
const p = H().class;
|
|
||||||
T = {}, u.info("Rendering diagram " + i);
|
|
||||||
const g = H().securityLevel;
|
|
||||||
let s;
|
|
||||||
g === "sandbox" && (s = M("#i" + a));
|
|
||||||
const c = g === "sandbox" ? M(s.nodes()[0].contentDocument.body) : M("body"), n = c.select(`[id='${a}']`);
|
|
||||||
R(n);
|
|
||||||
const r = new P({
|
|
||||||
multigraph: !0
|
|
||||||
});
|
|
||||||
r.setGraph({
|
|
||||||
isMultiGraph: !0
|
|
||||||
}), r.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const f = o.db.getClasses(), h = Object.keys(f);
|
|
||||||
for (const e of h) {
|
|
||||||
const d = f[e], l = N.drawClass(n, d, p, o);
|
|
||||||
T[l.id] = l, r.setNode(l.id, l), u.info("Org height: " + l.height);
|
|
||||||
}
|
|
||||||
o.db.getRelations().forEach(function(e) {
|
|
||||||
u.info(
|
|
||||||
// cspell:ignore tjoho
|
|
||||||
"tjoho" + L(e.id1) + L(e.id2) + JSON.stringify(e)
|
|
||||||
), r.setEdge(
|
|
||||||
L(e.id1),
|
|
||||||
L(e.id2),
|
|
||||||
{
|
|
||||||
relation: e
|
|
||||||
},
|
|
||||||
e.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
}), o.db.getNotes().forEach(function(e) {
|
|
||||||
u.debug(`Adding note: ${JSON.stringify(e)}`);
|
|
||||||
const d = N.drawNote(n, e, p, o);
|
|
||||||
T[d.id] = d, r.setNode(d.id, d), e.class && e.class in f && r.setEdge(
|
|
||||||
e.id,
|
|
||||||
L(e.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: e.id,
|
|
||||||
id2: e.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}), X(r), r.nodes().forEach(function(e) {
|
|
||||||
e !== void 0 && r.node(e) !== void 0 && (u.debug("Node " + e + ": " + JSON.stringify(r.node(e))), c.select("#" + (o.db.lookUpDomId(e) || e)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
|
|
||||||
));
|
|
||||||
}), r.edges().forEach(function(e) {
|
|
||||||
e !== void 0 && r.edge(e) !== void 0 && (u.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(r.edge(e))), N.drawEdge(n, r.edge(e), r.edge(e).relation, p, o));
|
|
||||||
});
|
|
||||||
const y = n.node().getBBox(), m = y.width + E * 2, w = y.height + E * 2;
|
|
||||||
O(n, w, m, p.useMaxWidth);
|
|
||||||
const b = `${y.x - E} ${y.y - E} ${m} ${w}`;
|
|
||||||
u.debug(`viewBox ${b}`), n.attr("viewBox", b);
|
|
||||||
}, U = {
|
|
||||||
draw: F
|
|
||||||
}, tt = {
|
|
||||||
parser: A,
|
|
||||||
db: S,
|
|
||||||
renderer: U,
|
|
||||||
styles: G,
|
|
||||||
init: (i) => {
|
|
||||||
i.class || (i.class = {}), i.class.arrowMarkerAbsolute = i.arrowMarkerAbsolute, S.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
tt as diagram
|
|
||||||
};
|
|
|
@ -1,363 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-b83b31c9.js";
|
|
||||||
import { line, curveBasis, select } from "d3";
|
|
||||||
import { layout } from "dagre-d3-es/src/dagre/index.js";
|
|
||||||
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
|
|
||||||
import { u as utils, l as log, x as parseGenericTypes, c as getConfig, i as configureSvgSize } from "./mermaid-6dc72991.js";
|
|
||||||
import "ts-dedent";
|
|
||||||
import "dayjs";
|
|
||||||
import "@braintree/sanitize-url";
|
|
||||||
import "dompurify";
|
|
||||||
import "khroma";
|
|
||||||
import "lodash-es/memoize.js";
|
|
||||||
import "lodash-es/merge.js";
|
|
||||||
import "stylis";
|
|
||||||
import "lodash-es/isEmpty.js";
|
|
||||||
let edgeCount = 0;
|
|
||||||
const drawEdge = function(elem, path, relation, conf, diagObj) {
|
|
||||||
const getRelationType = function(type) {
|
|
||||||
switch (type) {
|
|
||||||
case diagObj.db.relationType.AGGREGATION:
|
|
||||||
return "aggregation";
|
|
||||||
case diagObj.db.relationType.EXTENSION:
|
|
||||||
return "extension";
|
|
||||||
case diagObj.db.relationType.COMPOSITION:
|
|
||||||
return "composition";
|
|
||||||
case diagObj.db.relationType.DEPENDENCY:
|
|
||||||
return "dependency";
|
|
||||||
case diagObj.db.relationType.LOLLIPOP:
|
|
||||||
return "lollipop";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
path.points = path.points.filter((p) => !Number.isNaN(p.y));
|
|
||||||
const lineData = path.points;
|
|
||||||
const lineFunction = line().x(function(d) {
|
|
||||||
return d.x;
|
|
||||||
}).y(function(d) {
|
|
||||||
return d.y;
|
|
||||||
}).curve(curveBasis);
|
|
||||||
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "relation");
|
|
||||||
let url = "";
|
|
||||||
if (conf.arrowMarkerAbsolute) {
|
|
||||||
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
|
|
||||||
url = url.replace(/\(/g, "\\(");
|
|
||||||
url = url.replace(/\)/g, "\\)");
|
|
||||||
}
|
|
||||||
if (relation.relation.lineType == 1) {
|
|
||||||
svgPath.attr("class", "relation dashed-line");
|
|
||||||
}
|
|
||||||
if (relation.relation.lineType == 10) {
|
|
||||||
svgPath.attr("class", "relation dotted-line");
|
|
||||||
}
|
|
||||||
if (relation.relation.type1 !== "none") {
|
|
||||||
svgPath.attr(
|
|
||||||
"marker-start",
|
|
||||||
"url(" + url + "#" + getRelationType(relation.relation.type1) + "Start)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (relation.relation.type2 !== "none") {
|
|
||||||
svgPath.attr(
|
|
||||||
"marker-end",
|
|
||||||
"url(" + url + "#" + getRelationType(relation.relation.type2) + "End)"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
let x, y;
|
|
||||||
const l = path.points.length;
|
|
||||||
let labelPosition = utils.calcLabelPosition(path.points);
|
|
||||||
x = labelPosition.x;
|
|
||||||
y = labelPosition.y;
|
|
||||||
let p1_card_x, p1_card_y;
|
|
||||||
let p2_card_x, p2_card_y;
|
|
||||||
if (l % 2 !== 0 && l > 1) {
|
|
||||||
let cardinality_1_point = utils.calcCardinalityPosition(
|
|
||||||
relation.relation.type1 !== "none",
|
|
||||||
path.points,
|
|
||||||
path.points[0]
|
|
||||||
);
|
|
||||||
let cardinality_2_point = utils.calcCardinalityPosition(
|
|
||||||
relation.relation.type2 !== "none",
|
|
||||||
path.points,
|
|
||||||
path.points[l - 1]
|
|
||||||
);
|
|
||||||
log.debug("cardinality_1_point " + JSON.stringify(cardinality_1_point));
|
|
||||||
log.debug("cardinality_2_point " + JSON.stringify(cardinality_2_point));
|
|
||||||
p1_card_x = cardinality_1_point.x;
|
|
||||||
p1_card_y = cardinality_1_point.y;
|
|
||||||
p2_card_x = cardinality_2_point.x;
|
|
||||||
p2_card_y = cardinality_2_point.y;
|
|
||||||
}
|
|
||||||
if (relation.title !== void 0) {
|
|
||||||
const g = elem.append("g").attr("class", "classLabel");
|
|
||||||
const label = g.append("text").attr("class", "label").attr("x", x).attr("y", y).attr("fill", "red").attr("text-anchor", "middle").text(relation.title);
|
|
||||||
window.label = label;
|
|
||||||
const bounds = label.node().getBBox();
|
|
||||||
g.insert("rect", ":first-child").attr("class", "box").attr("x", bounds.x - conf.padding / 2).attr("y", bounds.y - conf.padding / 2).attr("width", bounds.width + conf.padding).attr("height", bounds.height + conf.padding);
|
|
||||||
}
|
|
||||||
log.info("Rendering relation " + JSON.stringify(relation));
|
|
||||||
if (relation.relationTitle1 !== void 0 && relation.relationTitle1 !== "none") {
|
|
||||||
const g = elem.append("g").attr("class", "cardinality");
|
|
||||||
g.append("text").attr("class", "type1").attr("x", p1_card_x).attr("y", p1_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle1);
|
|
||||||
}
|
|
||||||
if (relation.relationTitle2 !== void 0 && relation.relationTitle2 !== "none") {
|
|
||||||
const g = elem.append("g").attr("class", "cardinality");
|
|
||||||
g.append("text").attr("class", "type2").attr("x", p2_card_x).attr("y", p2_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle2);
|
|
||||||
}
|
|
||||||
edgeCount++;
|
|
||||||
};
|
|
||||||
const drawClass = function(elem, classDef, conf, diagObj) {
|
|
||||||
log.debug("Rendering class ", classDef, conf);
|
|
||||||
const id = classDef.id;
|
|
||||||
const classInfo = {
|
|
||||||
id,
|
|
||||||
label: classDef.id,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
};
|
|
||||||
const g = elem.append("g").attr("id", diagObj.db.lookUpDomId(id)).attr("class", "classGroup");
|
|
||||||
let title;
|
|
||||||
if (classDef.link) {
|
|
||||||
title = g.append("svg:a").attr("xlink:href", classDef.link).attr("target", classDef.linkTarget).append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
} else {
|
|
||||||
title = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
}
|
|
||||||
let isFirst = true;
|
|
||||||
classDef.annotations.forEach(function(member) {
|
|
||||||
const titleText2 = title.append("tspan").text("«" + member + "»");
|
|
||||||
if (!isFirst) {
|
|
||||||
titleText2.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
let classTitleString = getClassTitleString(classDef);
|
|
||||||
const classTitle = title.append("tspan").text(classTitleString).attr("class", "title");
|
|
||||||
if (!isFirst) {
|
|
||||||
classTitle.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
const titleHeight = title.node().getBBox().height;
|
|
||||||
let membersLine;
|
|
||||||
let membersBox;
|
|
||||||
let methodsLine;
|
|
||||||
if (classDef.members.length > 0) {
|
|
||||||
membersLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin / 2).attr("y2", conf.padding + titleHeight + conf.dividerMargin / 2);
|
|
||||||
const members = g.append("text").attr("x", conf.padding).attr("y", titleHeight + conf.dividerMargin + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
isFirst = true;
|
|
||||||
classDef.members.forEach(function(member) {
|
|
||||||
addTspan(members, member, isFirst, conf);
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
membersBox = members.node().getBBox();
|
|
||||||
}
|
|
||||||
if (classDef.methods.length > 0) {
|
|
||||||
methodsLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr("y2", conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
|
|
||||||
const methods = g.append("text").attr("x", conf.padding).attr("y", titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
|
||||||
isFirst = true;
|
|
||||||
classDef.methods.forEach(function(method) {
|
|
||||||
addTspan(methods, method, isFirst, conf);
|
|
||||||
isFirst = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const classBox = g.node().getBBox();
|
|
||||||
var cssClassStr = " ";
|
|
||||||
if (classDef.cssClasses.length > 0) {
|
|
||||||
cssClassStr = cssClassStr + classDef.cssClasses.join(" ");
|
|
||||||
}
|
|
||||||
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", classBox.width + 2 * conf.padding).attr("height", classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr("class", cssClassStr);
|
|
||||||
const rectWidth = rect.node().getBBox().width;
|
|
||||||
title.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
|
||||||
});
|
|
||||||
if (classDef.tooltip) {
|
|
||||||
title.insert("title").text(classDef.tooltip);
|
|
||||||
}
|
|
||||||
if (membersLine) {
|
|
||||||
membersLine.attr("x2", rectWidth);
|
|
||||||
}
|
|
||||||
if (methodsLine) {
|
|
||||||
methodsLine.attr("x2", rectWidth);
|
|
||||||
}
|
|
||||||
classInfo.width = rectWidth;
|
|
||||||
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
|
||||||
return classInfo;
|
|
||||||
};
|
|
||||||
const getClassTitleString = function(classDef) {
|
|
||||||
let classTitleString = classDef.id;
|
|
||||||
if (classDef.type) {
|
|
||||||
classTitleString += "<" + parseGenericTypes(classDef.type) + ">";
|
|
||||||
}
|
|
||||||
return classTitleString;
|
|
||||||
};
|
|
||||||
const drawNote = function(elem, note, conf, diagObj) {
|
|
||||||
log.debug("Rendering note ", note, conf);
|
|
||||||
const id = note.id;
|
|
||||||
const noteInfo = {
|
|
||||||
id,
|
|
||||||
text: note.text,
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
};
|
|
||||||
const g = elem.append("g").attr("id", id).attr("class", "classGroup");
|
|
||||||
let text = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
|
||||||
const lines = JSON.parse(`"${note.text}"`).split("\n");
|
|
||||||
lines.forEach(function(line2) {
|
|
||||||
log.debug(`Adding line: ${line2}`);
|
|
||||||
text.append("tspan").text(line2).attr("class", "title").attr("dy", conf.textHeight);
|
|
||||||
});
|
|
||||||
const noteBox = g.node().getBBox();
|
|
||||||
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", noteBox.width + 2 * conf.padding).attr(
|
|
||||||
"height",
|
|
||||||
noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin
|
|
||||||
);
|
|
||||||
const rectWidth = rect.node().getBBox().width;
|
|
||||||
text.node().childNodes.forEach(function(x) {
|
|
||||||
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
|
||||||
});
|
|
||||||
noteInfo.width = rectWidth;
|
|
||||||
noteInfo.height = noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin;
|
|
||||||
return noteInfo;
|
|
||||||
};
|
|
||||||
const addTspan = function(textEl, member, isFirst, conf) {
|
|
||||||
const { displayText, cssStyle } = member.getDisplayDetails();
|
|
||||||
const tSpan = textEl.append("tspan").attr("x", conf.padding).text(displayText);
|
|
||||||
if (cssStyle !== "") {
|
|
||||||
tSpan.attr("style", member.cssStyle);
|
|
||||||
}
|
|
||||||
if (!isFirst) {
|
|
||||||
tSpan.attr("dy", conf.textHeight);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const svgDraw = {
|
|
||||||
getClassTitleString,
|
|
||||||
drawClass,
|
|
||||||
drawEdge,
|
|
||||||
drawNote
|
|
||||||
};
|
|
||||||
let idCache = {};
|
|
||||||
const padding = 20;
|
|
||||||
const getGraphId = function(label) {
|
|
||||||
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
|
||||||
if (foundEntry) {
|
|
||||||
return foundEntry[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const insertMarkers = function(elem) {
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
const conf = getConfig().class;
|
|
||||||
idCache = {};
|
|
||||||
log.info("Rendering diagram " + text);
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
|
||||||
const diagram2 = root.select(`[id='${id}']`);
|
|
||||||
insertMarkers(diagram2);
|
|
||||||
const g = new graphlib.Graph({
|
|
||||||
multigraph: true
|
|
||||||
});
|
|
||||||
g.setGraph({
|
|
||||||
isMultiGraph: true
|
|
||||||
});
|
|
||||||
g.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
for (const key of keys) {
|
|
||||||
const classDef = classes[key];
|
|
||||||
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
log.info("Org height: " + node.height);
|
|
||||||
}
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
relations.forEach(function(relation) {
|
|
||||||
log.info(
|
|
||||||
// cspell:ignore tjoho
|
|
||||||
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
|
||||||
);
|
|
||||||
g.setEdge(
|
|
||||||
getGraphId(relation.id1),
|
|
||||||
getGraphId(relation.id2),
|
|
||||||
{
|
|
||||||
relation
|
|
||||||
},
|
|
||||||
relation.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
notes.forEach(function(note) {
|
|
||||||
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
|
||||||
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
if (note.class && note.class in classes) {
|
|
||||||
g.setEdge(
|
|
||||||
note.id,
|
|
||||||
getGraphId(note.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: note.id,
|
|
||||||
id2: note.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layout(g);
|
|
||||||
g.nodes().forEach(function(v) {
|
|
||||||
if (v !== void 0 && g.node(v) !== void 0) {
|
|
||||||
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
|
||||||
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
g.edges().forEach(function(e) {
|
|
||||||
if (e !== void 0 && g.edge(e) !== void 0) {
|
|
||||||
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
|
||||||
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const svgBounds = diagram2.node().getBBox();
|
|
||||||
const width = svgBounds.width + padding * 2;
|
|
||||||
const height = svgBounds.height + padding * 2;
|
|
||||||
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
|
||||||
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
|
||||||
log.debug(`viewBox ${vBox}`);
|
|
||||||
diagram2.attr("viewBox", vBox);
|
|
||||||
};
|
|
||||||
const renderer = {
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
|
@ -1,143 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-ee347520.js";
|
|
||||||
import { g as getConfig, l as log, f as select } from "./config-b4fa35bb.js";
|
|
||||||
import { G as Graph, l as layout } from "./layout-47a4d1ce.js";
|
|
||||||
import { s as svgDraw } from "./svgDraw-aae20718.js";
|
|
||||||
import { c as configureSvgSize } from "./setupGraphViewbox-16a0ba81.js";
|
|
||||||
import "./utils-872dfc50.js";
|
|
||||||
import "./commonDb-7f40ab5a.js";
|
|
||||||
import "./mermaidAPI-a31c2c80.js";
|
|
||||||
import "./errorRenderer-ebf63d74.js";
|
|
||||||
import "./isPlainObject-53794b96.js";
|
|
||||||
import "./array-b7dcf730.js";
|
|
||||||
import "./constant-b644328d.js";
|
|
||||||
let idCache = {};
|
|
||||||
const padding = 20;
|
|
||||||
const getGraphId = function(label) {
|
|
||||||
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
|
||||||
if (foundEntry) {
|
|
||||||
return foundEntry[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const insertMarkers = function(elem) {
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
|
||||||
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 18,7 L9,13 L14,7 L9,1 Z");
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
const conf = getConfig().class;
|
|
||||||
idCache = {};
|
|
||||||
log.info("Rendering diagram " + text);
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
|
||||||
const diagram2 = root.select(`[id='${id}']`);
|
|
||||||
insertMarkers(diagram2);
|
|
||||||
const g = new Graph({
|
|
||||||
multigraph: true
|
|
||||||
});
|
|
||||||
g.setGraph({
|
|
||||||
isMultiGraph: true
|
|
||||||
});
|
|
||||||
g.setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
for (const key of keys) {
|
|
||||||
const classDef = classes[key];
|
|
||||||
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
log.info("Org height: " + node.height);
|
|
||||||
}
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
relations.forEach(function(relation) {
|
|
||||||
log.info(
|
|
||||||
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
|
||||||
);
|
|
||||||
g.setEdge(
|
|
||||||
getGraphId(relation.id1),
|
|
||||||
getGraphId(relation.id2),
|
|
||||||
{
|
|
||||||
relation
|
|
||||||
},
|
|
||||||
relation.title || "DEFAULT"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
notes.forEach(function(note) {
|
|
||||||
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
|
||||||
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
|
||||||
idCache[node.id] = node;
|
|
||||||
g.setNode(node.id, node);
|
|
||||||
if (note.class && note.class in classes) {
|
|
||||||
g.setEdge(
|
|
||||||
note.id,
|
|
||||||
getGraphId(note.class),
|
|
||||||
{
|
|
||||||
relation: {
|
|
||||||
id1: note.id,
|
|
||||||
id2: note.class,
|
|
||||||
relation: {
|
|
||||||
type1: "none",
|
|
||||||
type2: "none",
|
|
||||||
lineType: 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"DEFAULT"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
layout(g);
|
|
||||||
g.nodes().forEach(function(v) {
|
|
||||||
if (v !== void 0 && g.node(v) !== void 0) {
|
|
||||||
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
|
||||||
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
|
||||||
"transform",
|
|
||||||
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
g.edges().forEach(function(e) {
|
|
||||||
if (e !== void 0 && g.edge(e) !== void 0) {
|
|
||||||
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
|
||||||
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const svgBounds = diagram2.node().getBBox();
|
|
||||||
const width = svgBounds.width + padding * 2;
|
|
||||||
const height = svgBounds.height + padding * 2;
|
|
||||||
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
|
||||||
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
|
||||||
log.debug(`viewBox ${vBox}`);
|
|
||||||
diagram2.attr("viewBox", vBox);
|
|
||||||
};
|
|
||||||
const renderer = {
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-ffa2ea72.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,200 +0,0 @@
|
||||||
import { p as M, d as k, s as R } from "./styles-55d85316.js";
|
|
||||||
import { l as p, g as r, f as v, e as C } from "./config-e567ef17.js";
|
|
||||||
import { G as B } from "./layout-d6d8be39.js";
|
|
||||||
import { r as G } from "./index-e6caf2ad.js";
|
|
||||||
import { u as I, z as D, x as E, y as _ } from "./utils-aa888deb.js";
|
|
||||||
import { s as z } from "./setupGraphViewbox-a4603a92.js";
|
|
||||||
import "./mermaidAPI-04b5c286.js";
|
|
||||||
import "./errorRenderer-a3c4bedb.js";
|
|
||||||
import "./commonDb-4dc3d465.js";
|
|
||||||
import "./isPlainObject-a5cb4071.js";
|
|
||||||
import "./array-2ff2c7a6.js";
|
|
||||||
import "./constant-2fe7eae5.js";
|
|
||||||
import "./edges-0979260b.js";
|
|
||||||
import "./svgDraw-c034b55e.js";
|
|
||||||
const A = (l) => C.sanitizeText(l, r());
|
|
||||||
let S = {
|
|
||||||
dividerMargin: 10,
|
|
||||||
padding: 5,
|
|
||||||
textHeight: 10,
|
|
||||||
curve: void 0
|
|
||||||
};
|
|
||||||
const $ = function(l, o, b, a) {
|
|
||||||
const e = Object.keys(l);
|
|
||||||
p.info("keys:", e), p.info(l), e.forEach(function(s) {
|
|
||||||
var y, m;
|
|
||||||
const t = l[s];
|
|
||||||
let i = "";
|
|
||||||
t.cssClasses.length > 0 && (i = i + " " + t.cssClasses.join(" "));
|
|
||||||
const n = { labelStyle: "", style: "" }, f = t.label ?? t.id, c = 0, u = "class_box", d = {
|
|
||||||
labelStyle: n.labelStyle,
|
|
||||||
shape: u,
|
|
||||||
labelText: A(f),
|
|
||||||
classData: t,
|
|
||||||
rx: c,
|
|
||||||
ry: c,
|
|
||||||
class: i,
|
|
||||||
style: n.style,
|
|
||||||
id: t.id,
|
|
||||||
domId: t.domId,
|
|
||||||
tooltip: a.db.getTooltip(t.id) || "",
|
|
||||||
haveCallback: t.haveCallback,
|
|
||||||
link: t.link,
|
|
||||||
width: t.type === "group" ? 500 : void 0,
|
|
||||||
type: t.type,
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((y = r().flowchart) == null ? void 0 : y.padding) ?? ((m = r().class) == null ? void 0 : m.padding)
|
|
||||||
};
|
|
||||||
o.setNode(t.id, d), p.info("setNode", d);
|
|
||||||
});
|
|
||||||
}, q = function(l, o, b, a) {
|
|
||||||
p.info(l), l.forEach(function(e, s) {
|
|
||||||
var x, h;
|
|
||||||
const t = e, i = "", n = { labelStyle: "", style: "" }, f = t.text, c = 0, u = "note", d = {
|
|
||||||
labelStyle: n.labelStyle,
|
|
||||||
shape: u,
|
|
||||||
labelText: A(f),
|
|
||||||
noteData: t,
|
|
||||||
rx: c,
|
|
||||||
ry: c,
|
|
||||||
class: i,
|
|
||||||
style: n.style,
|
|
||||||
id: t.id,
|
|
||||||
domId: t.id,
|
|
||||||
tooltip: "",
|
|
||||||
type: "note",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((x = r().flowchart) == null ? void 0 : x.padding) ?? ((h = r().class) == null ? void 0 : h.padding)
|
|
||||||
};
|
|
||||||
if (o.setNode(t.id, d), p.info("setNode", d), !t.class || !(t.class in a))
|
|
||||||
return;
|
|
||||||
const y = b + s, m = {
|
|
||||||
id: `edgeNote${y}`,
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: "dotted",
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: "none",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: "",
|
|
||||||
endLabelLeft: "",
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: "none",
|
|
||||||
arrowTypeEnd: "none",
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: D(S.curve, E)
|
|
||||||
};
|
|
||||||
o.setEdge(t.id, t.class, m, y);
|
|
||||||
});
|
|
||||||
}, F = function(l, o) {
|
|
||||||
const b = r().flowchart;
|
|
||||||
let a = 0;
|
|
||||||
l.forEach(function(e) {
|
|
||||||
var t;
|
|
||||||
a++;
|
|
||||||
const s = {
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: e.relation.lineType == 1 ? "dashed" : "solid",
|
|
||||||
id: "id" + a,
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: e.type === "arrow_open" ? "none" : "normal",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: e.relationTitle1 === "none" ? "" : e.relationTitle1,
|
|
||||||
endLabelLeft: e.relationTitle2 === "none" ? "" : e.relationTitle2,
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: L(e.relation.type1),
|
|
||||||
arrowTypeEnd: L(e.relation.type2),
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: D(b == null ? void 0 : b.curve, E)
|
|
||||||
};
|
|
||||||
if (p.info(s, e), e.style !== void 0) {
|
|
||||||
const i = _(e.style);
|
|
||||||
s.style = i.style, s.labelStyle = i.labelStyle;
|
|
||||||
}
|
|
||||||
e.text = e.title, e.text === void 0 ? e.style !== void 0 && (s.arrowheadStyle = "fill: #333") : (s.arrowheadStyle = "fill: #333", s.labelpos = "c", ((t = r().flowchart) == null ? void 0 : t.htmlLabels) ?? r().htmlLabels ? (s.labelType = "html", s.label = '<span class="edgeLabel">' + e.text + "</span>") : (s.labelType = "text", s.label = e.text.replace(C.lineBreakRegex, `
|
|
||||||
`), e.style === void 0 && (s.style = s.style || "stroke: #333; stroke-width: 1.5px;fill:none"), s.labelStyle = s.labelStyle.replace("color:", "fill:"))), o.setEdge(e.id1, e.id2, s, a);
|
|
||||||
});
|
|
||||||
}, H = function(l) {
|
|
||||||
S = {
|
|
||||||
...S,
|
|
||||||
...l
|
|
||||||
};
|
|
||||||
}, P = function(l, o, b, a) {
|
|
||||||
p.info("Drawing class - ", o);
|
|
||||||
const e = r().flowchart ?? r().class, s = r().securityLevel;
|
|
||||||
p.info("config:", e);
|
|
||||||
const t = (e == null ? void 0 : e.nodeSpacing) ?? 50, i = (e == null ? void 0 : e.rankSpacing) ?? 50, n = new B({
|
|
||||||
multigraph: !0,
|
|
||||||
compound: !0
|
|
||||||
}).setGraph({
|
|
||||||
rankdir: a.db.getDirection(),
|
|
||||||
nodesep: t,
|
|
||||||
ranksep: i,
|
|
||||||
marginx: 8,
|
|
||||||
marginy: 8
|
|
||||||
}).setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
}), f = a.db.getClasses(), c = a.db.getRelations(), u = a.db.getNotes();
|
|
||||||
p.info(c), $(f, n, o, a), F(c, n), q(u, n, c.length + 1, f);
|
|
||||||
let d;
|
|
||||||
s === "sandbox" && (d = v("#i" + o));
|
|
||||||
const y = s === "sandbox" ? (
|
|
||||||
// @ts-ignore Ignore type error for now
|
|
||||||
v(d.nodes()[0].contentDocument.body)
|
|
||||||
) : v("body"), m = y.select(`[id="${o}"]`), x = y.select("#" + o + " g");
|
|
||||||
if (G(
|
|
||||||
x,
|
|
||||||
n,
|
|
||||||
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
||||||
"classDiagram",
|
|
||||||
o
|
|
||||||
), I.insertTitle(m, "classTitleText", (e == null ? void 0 : e.titleTopMargin) ?? 5, a.db.getDiagramTitle()), z(n, m, e == null ? void 0 : e.diagramPadding, e == null ? void 0 : e.useMaxWidth), !(e != null && e.htmlLabels)) {
|
|
||||||
const h = s === "sandbox" ? d.nodes()[0].contentDocument : document, N = h.querySelectorAll('[id="' + o + '"] .edgeLabel .label');
|
|
||||||
for (const w of N) {
|
|
||||||
const T = w.getBBox(), g = h.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
||||||
g.setAttribute("rx", 0), g.setAttribute("ry", 0), g.setAttribute("width", T.width), g.setAttribute("height", T.height), w.insertBefore(g, w.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function L(l) {
|
|
||||||
let o;
|
|
||||||
switch (l) {
|
|
||||||
case 0:
|
|
||||||
o = "aggregation";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
o = "extension";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
o = "composition";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
o = "dependency";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
o = "lollipop";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
o = "none";
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
const V = {
|
|
||||||
setConf: H,
|
|
||||||
draw: P
|
|
||||||
}, le = {
|
|
||||||
parser: M,
|
|
||||||
db: k,
|
|
||||||
renderer: V,
|
|
||||||
styles: R,
|
|
||||||
init: (l) => {
|
|
||||||
l.class || (l.class = {}), l.class.arrowMarkerAbsolute = l.arrowMarkerAbsolute, k.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
le as diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-v2-146d8a48.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,290 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-d48462a7.js";
|
|
||||||
import { l as log, c as getConfig, j as d3select, A as utils, t as setupGraphViewbox, o as getStylesFromArray, q as interpolateToCurve, n as curveLinear, f as common } from "./mermaid-c5809711.js";
|
|
||||||
import { G as Graph } from "./graph-af3d5df6.js";
|
|
||||||
import { r as render } from "./index-c8395ba2.js";
|
|
||||||
import "./layout-6685625a.js";
|
|
||||||
import "./clone-d2e37f8c.js";
|
|
||||||
import "./edges-1e1ebc73.js";
|
|
||||||
import "./createText-f6615236.js";
|
|
||||||
import "./line-65d70945.js";
|
|
||||||
import "./array-b7dcf730.js";
|
|
||||||
import "./path-39bad7e2.js";
|
|
||||||
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
|
|
||||||
let conf = {
|
|
||||||
dividerMargin: 10,
|
|
||||||
padding: 5,
|
|
||||||
textHeight: 10,
|
|
||||||
curve: void 0
|
|
||||||
};
|
|
||||||
const addNamespaces = function(namespaces, g, _id, diagObj) {
|
|
||||||
const keys = Object.keys(namespaces);
|
|
||||||
log.info("keys:", keys);
|
|
||||||
log.info(namespaces);
|
|
||||||
keys.forEach(function(id) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = namespaces[id];
|
|
||||||
const shape = "rect";
|
|
||||||
const node = {
|
|
||||||
shape,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.domId,
|
|
||||||
labelText: sanitizeText(vertex.id),
|
|
||||||
labelStyle: "",
|
|
||||||
style: "fill: none; stroke: black",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
addClasses(vertex.classes, g, _id, diagObj, vertex.id);
|
|
||||||
log.info("setNode", node);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addClasses = function(classes, g, _id, diagObj, parent) {
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
log.info("keys:", keys);
|
|
||||||
log.info(classes);
|
|
||||||
keys.filter((id) => classes[id].parent == parent).forEach(function(id) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = classes[id];
|
|
||||||
const cssClassStr = vertex.cssClasses.join(" ");
|
|
||||||
const styles2 = getStylesFromArray(vertex.styles);
|
|
||||||
const vertexText = vertex.label ?? vertex.id;
|
|
||||||
const radius = 0;
|
|
||||||
const shape = "class_box";
|
|
||||||
const node = {
|
|
||||||
labelStyle: styles2.labelStyle,
|
|
||||||
shape,
|
|
||||||
labelText: sanitizeText(vertexText),
|
|
||||||
classData: vertex,
|
|
||||||
rx: radius,
|
|
||||||
ry: radius,
|
|
||||||
class: cssClassStr,
|
|
||||||
style: styles2.style,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.domId,
|
|
||||||
tooltip: diagObj.db.getTooltip(vertex.id, parent) || "",
|
|
||||||
haveCallback: vertex.haveCallback,
|
|
||||||
link: vertex.link,
|
|
||||||
width: vertex.type === "group" ? 500 : void 0,
|
|
||||||
type: vertex.type,
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
if (parent) {
|
|
||||||
g.setParent(vertex.id, parent);
|
|
||||||
}
|
|
||||||
log.info("setNode", node);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addNotes = function(notes, g, startEdgeId, classes) {
|
|
||||||
log.info(notes);
|
|
||||||
notes.forEach(function(note, i) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = note;
|
|
||||||
const cssNoteStr = "";
|
|
||||||
const styles2 = { labelStyle: "", style: "" };
|
|
||||||
const vertexText = vertex.text;
|
|
||||||
const radius = 0;
|
|
||||||
const shape = "note";
|
|
||||||
const node = {
|
|
||||||
labelStyle: styles2.labelStyle,
|
|
||||||
shape,
|
|
||||||
labelText: sanitizeText(vertexText),
|
|
||||||
noteData: vertex,
|
|
||||||
rx: radius,
|
|
||||||
ry: radius,
|
|
||||||
class: cssNoteStr,
|
|
||||||
style: styles2.style,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.id,
|
|
||||||
tooltip: "",
|
|
||||||
type: "note",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
log.info("setNode", node);
|
|
||||||
if (!vertex.class || !(vertex.class in classes)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const edgeId = startEdgeId + i;
|
|
||||||
const edgeData = {
|
|
||||||
id: `edgeNote${edgeId}`,
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: "dotted",
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: "none",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: "",
|
|
||||||
endLabelLeft: "",
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: "none",
|
|
||||||
arrowTypeEnd: "none",
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: interpolateToCurve(conf.curve, curveLinear)
|
|
||||||
};
|
|
||||||
g.setEdge(vertex.id, vertex.class, edgeData, edgeId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addRelations = function(relations, g) {
|
|
||||||
const conf2 = getConfig().flowchart;
|
|
||||||
let cnt = 0;
|
|
||||||
relations.forEach(function(edge) {
|
|
||||||
var _a;
|
|
||||||
cnt++;
|
|
||||||
const edgeData = {
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: edge.relation.lineType == 1 ? "dashed" : "solid",
|
|
||||||
id: `id_${edge.id1}_${edge.id2}_${cnt}`,
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: edge.type === "arrow_open" ? "none" : "normal",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1,
|
|
||||||
endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2,
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: getArrowMarker(edge.relation.type1),
|
|
||||||
arrowTypeEnd: getArrowMarker(edge.relation.type2),
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear)
|
|
||||||
};
|
|
||||||
log.info(edgeData, edge);
|
|
||||||
if (edge.style !== void 0) {
|
|
||||||
const styles2 = getStylesFromArray(edge.style);
|
|
||||||
edgeData.style = styles2.style;
|
|
||||||
edgeData.labelStyle = styles2.labelStyle;
|
|
||||||
}
|
|
||||||
edge.text = edge.title;
|
|
||||||
if (edge.text === void 0) {
|
|
||||||
if (edge.style !== void 0) {
|
|
||||||
edgeData.arrowheadStyle = "fill: #333";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
edgeData.arrowheadStyle = "fill: #333";
|
|
||||||
edgeData.labelpos = "c";
|
|
||||||
if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) {
|
|
||||||
edgeData.labelType = "html";
|
|
||||||
edgeData.label = '<span class="edgeLabel">' + edge.text + "</span>";
|
|
||||||
} else {
|
|
||||||
edgeData.labelType = "text";
|
|
||||||
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
|
|
||||||
if (edge.style === void 0) {
|
|
||||||
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
|
|
||||||
}
|
|
||||||
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g.setEdge(edge.id1, edge.id2, edgeData, cnt);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const setConf = function(cnf) {
|
|
||||||
conf = {
|
|
||||||
...conf,
|
|
||||||
...cnf
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const draw = async function(text, id, _version, diagObj) {
|
|
||||||
log.info("Drawing class - ", id);
|
|
||||||
const conf2 = getConfig().flowchart ?? getConfig().class;
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
log.info("config:", conf2);
|
|
||||||
const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50;
|
|
||||||
const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50;
|
|
||||||
const g = new Graph({
|
|
||||||
multigraph: true,
|
|
||||||
compound: true
|
|
||||||
}).setGraph({
|
|
||||||
rankdir: diagObj.db.getDirection(),
|
|
||||||
nodesep: nodeSpacing,
|
|
||||||
ranksep: rankSpacing,
|
|
||||||
marginx: 8,
|
|
||||||
marginy: 8
|
|
||||||
}).setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const namespaces = diagObj.db.getNamespaces();
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
log.info(relations);
|
|
||||||
addNamespaces(namespaces, g, id, diagObj);
|
|
||||||
addClasses(classes, g, id, diagObj);
|
|
||||||
addRelations(relations, g);
|
|
||||||
addNotes(notes, g, relations.length + 1, classes);
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = d3select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
|
|
||||||
const svg = root.select(`[id="${id}"]`);
|
|
||||||
const element = root.select("#" + id + " g");
|
|
||||||
await render(
|
|
||||||
element,
|
|
||||||
g,
|
|
||||||
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
||||||
"classDiagram",
|
|
||||||
id
|
|
||||||
);
|
|
||||||
utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle());
|
|
||||||
setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth);
|
|
||||||
if (!(conf2 == null ? void 0 : conf2.htmlLabels)) {
|
|
||||||
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
|
|
||||||
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
|
||||||
for (const label of labels) {
|
|
||||||
const dim = label.getBBox();
|
|
||||||
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
||||||
rect.setAttribute("rx", 0);
|
|
||||||
rect.setAttribute("ry", 0);
|
|
||||||
rect.setAttribute("width", dim.width);
|
|
||||||
rect.setAttribute("height", dim.height);
|
|
||||||
label.insertBefore(rect, label.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function getArrowMarker(type) {
|
|
||||||
let marker;
|
|
||||||
switch (type) {
|
|
||||||
case 0:
|
|
||||||
marker = "aggregation";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
marker = "extension";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
marker = "composition";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
marker = "dependency";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
marker = "lollipop";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
marker = "none";
|
|
||||||
}
|
|
||||||
return marker;
|
|
||||||
}
|
|
||||||
const renderer = {
|
|
||||||
setConf,
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
|
@ -1,279 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-0dd3ba1e.js";
|
|
||||||
import { select, curveLinear } from "d3";
|
|
||||||
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
|
|
||||||
import { l as log, g as getConfig, d as common } from "./config-389b86ff.js";
|
|
||||||
import { r as render } from "./index-f9d09cc9.js";
|
|
||||||
import { u as utils, n as interpolateToCurve, m as getStylesFromArray } from "./utils-d5eeff82.js";
|
|
||||||
import { s as setupGraphViewbox } from "./setupGraphViewbox-e35e4124.js";
|
|
||||||
import "./mermaidAPI-0716c7c2.js";
|
|
||||||
import "stylis";
|
|
||||||
import "./errorRenderer-d05351b9.js";
|
|
||||||
import "dompurify";
|
|
||||||
import "lodash-es/isEmpty.js";
|
|
||||||
import "./commonDb-2ace122b.js";
|
|
||||||
import "dayjs";
|
|
||||||
import "khroma";
|
|
||||||
import "dagre-d3-es/src/dagre/index.js";
|
|
||||||
import "dagre-d3-es/src/graphlib/json.js";
|
|
||||||
import "./edges-65da65dc.js";
|
|
||||||
import "./svgDraw-6a237a99.js";
|
|
||||||
import "@braintree/sanitize-url";
|
|
||||||
import "lodash-es/memoize.js";
|
|
||||||
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
|
|
||||||
let conf = {
|
|
||||||
dividerMargin: 10,
|
|
||||||
padding: 5,
|
|
||||||
textHeight: 10,
|
|
||||||
curve: void 0
|
|
||||||
};
|
|
||||||
const addClasses = function(classes, g, _id, diagObj) {
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
log.info("keys:", keys);
|
|
||||||
log.info(classes);
|
|
||||||
keys.forEach(function(id) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = classes[id];
|
|
||||||
let cssClassStr = "";
|
|
||||||
if (vertex.cssClasses.length > 0) {
|
|
||||||
cssClassStr = cssClassStr + " " + vertex.cssClasses.join(" ");
|
|
||||||
}
|
|
||||||
const styles2 = { labelStyle: "", style: "" };
|
|
||||||
const vertexText = vertex.label ?? vertex.id;
|
|
||||||
const radius = 0;
|
|
||||||
const shape = "class_box";
|
|
||||||
const node = {
|
|
||||||
labelStyle: styles2.labelStyle,
|
|
||||||
shape,
|
|
||||||
labelText: sanitizeText(vertexText),
|
|
||||||
classData: vertex,
|
|
||||||
rx: radius,
|
|
||||||
ry: radius,
|
|
||||||
class: cssClassStr,
|
|
||||||
style: styles2.style,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.domId,
|
|
||||||
tooltip: diagObj.db.getTooltip(vertex.id) || "",
|
|
||||||
haveCallback: vertex.haveCallback,
|
|
||||||
link: vertex.link,
|
|
||||||
width: vertex.type === "group" ? 500 : void 0,
|
|
||||||
type: vertex.type,
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
log.info("setNode", node);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addNotes = function(notes, g, startEdgeId, classes) {
|
|
||||||
log.info(notes);
|
|
||||||
notes.forEach(function(note, i) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = note;
|
|
||||||
const cssNoteStr = "";
|
|
||||||
const styles2 = { labelStyle: "", style: "" };
|
|
||||||
const vertexText = vertex.text;
|
|
||||||
const radius = 0;
|
|
||||||
const shape = "note";
|
|
||||||
const node = {
|
|
||||||
labelStyle: styles2.labelStyle,
|
|
||||||
shape,
|
|
||||||
labelText: sanitizeText(vertexText),
|
|
||||||
noteData: vertex,
|
|
||||||
rx: radius,
|
|
||||||
ry: radius,
|
|
||||||
class: cssNoteStr,
|
|
||||||
style: styles2.style,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.id,
|
|
||||||
tooltip: "",
|
|
||||||
type: "note",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
log.info("setNode", node);
|
|
||||||
if (!vertex.class || !(vertex.class in classes)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const edgeId = startEdgeId + i;
|
|
||||||
const edgeData = {
|
|
||||||
id: `edgeNote${edgeId}`,
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: "dotted",
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: "none",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: "",
|
|
||||||
endLabelLeft: "",
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: "none",
|
|
||||||
arrowTypeEnd: "none",
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: interpolateToCurve(conf.curve, curveLinear)
|
|
||||||
};
|
|
||||||
g.setEdge(vertex.id, vertex.class, edgeData, edgeId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addRelations = function(relations, g) {
|
|
||||||
const conf2 = getConfig().flowchart;
|
|
||||||
let cnt = 0;
|
|
||||||
relations.forEach(function(edge) {
|
|
||||||
var _a;
|
|
||||||
cnt++;
|
|
||||||
const edgeData = {
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: edge.relation.lineType == 1 ? "dashed" : "solid",
|
|
||||||
id: "id" + cnt,
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: edge.type === "arrow_open" ? "none" : "normal",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1,
|
|
||||||
endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2,
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: getArrowMarker(edge.relation.type1),
|
|
||||||
arrowTypeEnd: getArrowMarker(edge.relation.type2),
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear)
|
|
||||||
};
|
|
||||||
log.info(edgeData, edge);
|
|
||||||
if (edge.style !== void 0) {
|
|
||||||
const styles2 = getStylesFromArray(edge.style);
|
|
||||||
edgeData.style = styles2.style;
|
|
||||||
edgeData.labelStyle = styles2.labelStyle;
|
|
||||||
}
|
|
||||||
edge.text = edge.title;
|
|
||||||
if (edge.text === void 0) {
|
|
||||||
if (edge.style !== void 0) {
|
|
||||||
edgeData.arrowheadStyle = "fill: #333";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
edgeData.arrowheadStyle = "fill: #333";
|
|
||||||
edgeData.labelpos = "c";
|
|
||||||
if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) {
|
|
||||||
edgeData.labelType = "html";
|
|
||||||
edgeData.label = '<span class="edgeLabel">' + edge.text + "</span>";
|
|
||||||
} else {
|
|
||||||
edgeData.labelType = "text";
|
|
||||||
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
|
|
||||||
if (edge.style === void 0) {
|
|
||||||
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
|
|
||||||
}
|
|
||||||
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g.setEdge(edge.id1, edge.id2, edgeData, cnt);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const setConf = function(cnf) {
|
|
||||||
conf = {
|
|
||||||
...conf,
|
|
||||||
...cnf
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
log.info("Drawing class - ", id);
|
|
||||||
const conf2 = getConfig().flowchart ?? getConfig().class;
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
log.info("config:", conf2);
|
|
||||||
const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50;
|
|
||||||
const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50;
|
|
||||||
const g = new graphlib.Graph({
|
|
||||||
multigraph: true,
|
|
||||||
compound: true
|
|
||||||
}).setGraph({
|
|
||||||
rankdir: diagObj.db.getDirection(),
|
|
||||||
nodesep: nodeSpacing,
|
|
||||||
ranksep: rankSpacing,
|
|
||||||
marginx: 8,
|
|
||||||
marginy: 8
|
|
||||||
}).setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
log.info(relations);
|
|
||||||
addClasses(classes, g, id, diagObj);
|
|
||||||
addRelations(relations, g);
|
|
||||||
addNotes(notes, g, relations.length + 1, classes);
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? (
|
|
||||||
// @ts-ignore Ignore type error for now
|
|
||||||
select(sandboxElement.nodes()[0].contentDocument.body)
|
|
||||||
) : select("body");
|
|
||||||
const svg = root.select(`[id="${id}"]`);
|
|
||||||
const element = root.select("#" + id + " g");
|
|
||||||
render(
|
|
||||||
element,
|
|
||||||
g,
|
|
||||||
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
||||||
"classDiagram",
|
|
||||||
id
|
|
||||||
);
|
|
||||||
utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle());
|
|
||||||
setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth);
|
|
||||||
if (!(conf2 == null ? void 0 : conf2.htmlLabels)) {
|
|
||||||
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
|
|
||||||
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
|
||||||
for (const label of labels) {
|
|
||||||
const dim = label.getBBox();
|
|
||||||
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
||||||
rect.setAttribute("rx", 0);
|
|
||||||
rect.setAttribute("ry", 0);
|
|
||||||
rect.setAttribute("width", dim.width);
|
|
||||||
rect.setAttribute("height", dim.height);
|
|
||||||
label.insertBefore(rect, label.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function getArrowMarker(type) {
|
|
||||||
let marker;
|
|
||||||
switch (type) {
|
|
||||||
case 0:
|
|
||||||
marker = "aggregation";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
marker = "extension";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
marker = "composition";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
marker = "dependency";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
marker = "lollipop";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
marker = "none";
|
|
||||||
}
|
|
||||||
return marker;
|
|
||||||
}
|
|
||||||
const renderer = {
|
|
||||||
setConf,
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-v2-539b00ca.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,206 +0,0 @@
|
||||||
import { p as R, d as N, s as $ } from "./styles-11e81fdd.js";
|
|
||||||
import { l as c, c as r, j as k, A as B, t as G, o as E, q as A, n as C, f as _ } from "./mermaid-9f2aa176.js";
|
|
||||||
import { G as q } from "./graph-0ee63739.js";
|
|
||||||
import { r as z } from "./index-bb6d8841.js";
|
|
||||||
import "./layout-fd473db2.js";
|
|
||||||
import "./clone-afc2f047.js";
|
|
||||||
import "./edges-16357fde.js";
|
|
||||||
import "./createText-03b82060.js";
|
|
||||||
import "./line-24d93f1b.js";
|
|
||||||
import "./array-2ff2c7a6.js";
|
|
||||||
import "./path-428ebac9.js";
|
|
||||||
const S = (o) => _.sanitizeText(o, r());
|
|
||||||
let v = {
|
|
||||||
dividerMargin: 10,
|
|
||||||
padding: 5,
|
|
||||||
textHeight: 10,
|
|
||||||
curve: void 0
|
|
||||||
};
|
|
||||||
const P = function(o, e, p, n) {
|
|
||||||
const t = Object.keys(o);
|
|
||||||
c.info("keys:", t), c.info(o), t.forEach(function(s) {
|
|
||||||
var y, d;
|
|
||||||
const l = o[s], i = {
|
|
||||||
shape: "rect",
|
|
||||||
id: l.id,
|
|
||||||
domId: l.domId,
|
|
||||||
labelText: S(l.id),
|
|
||||||
labelStyle: "",
|
|
||||||
style: "fill: none; stroke: black",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((y = r().flowchart) == null ? void 0 : y.padding) ?? ((d = r().class) == null ? void 0 : d.padding)
|
|
||||||
};
|
|
||||||
e.setNode(l.id, i), I(l.classes, e, p, n, l.id), c.info("setNode", i);
|
|
||||||
});
|
|
||||||
}, I = function(o, e, p, n, t) {
|
|
||||||
const s = Object.keys(o);
|
|
||||||
c.info("keys:", s), c.info(o), s.filter((l) => o[l].parent == t).forEach(function(l) {
|
|
||||||
var u, m;
|
|
||||||
const a = o[l], i = a.cssClasses.join(" "), y = E(a.styles), d = a.label ?? a.id, f = 0, h = "class_box", b = {
|
|
||||||
labelStyle: y.labelStyle,
|
|
||||||
shape: h,
|
|
||||||
labelText: S(d),
|
|
||||||
classData: a,
|
|
||||||
rx: f,
|
|
||||||
ry: f,
|
|
||||||
class: i,
|
|
||||||
style: y.style,
|
|
||||||
id: a.id,
|
|
||||||
domId: a.domId,
|
|
||||||
tooltip: n.db.getTooltip(a.id, t) || "",
|
|
||||||
haveCallback: a.haveCallback,
|
|
||||||
link: a.link,
|
|
||||||
width: a.type === "group" ? 500 : void 0,
|
|
||||||
type: a.type,
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((u = r().flowchart) == null ? void 0 : u.padding) ?? ((m = r().class) == null ? void 0 : m.padding)
|
|
||||||
};
|
|
||||||
e.setNode(a.id, b), t && e.setParent(a.id, t), c.info("setNode", b);
|
|
||||||
});
|
|
||||||
}, F = function(o, e, p, n) {
|
|
||||||
c.info(o), o.forEach(function(t, s) {
|
|
||||||
var m, g;
|
|
||||||
const l = t, a = "", i = { labelStyle: "", style: "" }, y = l.text, d = 0, f = "note", h = {
|
|
||||||
labelStyle: i.labelStyle,
|
|
||||||
shape: f,
|
|
||||||
labelText: S(y),
|
|
||||||
noteData: l,
|
|
||||||
rx: d,
|
|
||||||
ry: d,
|
|
||||||
class: a,
|
|
||||||
style: i.style,
|
|
||||||
id: l.id,
|
|
||||||
domId: l.id,
|
|
||||||
tooltip: "",
|
|
||||||
type: "note",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((m = r().flowchart) == null ? void 0 : m.padding) ?? ((g = r().class) == null ? void 0 : g.padding)
|
|
||||||
};
|
|
||||||
if (e.setNode(l.id, h), c.info("setNode", h), !l.class || !(l.class in n))
|
|
||||||
return;
|
|
||||||
const b = p + s, u = {
|
|
||||||
id: `edgeNote${b}`,
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: "dotted",
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: "none",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: "",
|
|
||||||
endLabelLeft: "",
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: "none",
|
|
||||||
arrowTypeEnd: "none",
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: A(v.curve, C)
|
|
||||||
};
|
|
||||||
e.setEdge(l.id, l.class, u, b);
|
|
||||||
});
|
|
||||||
}, H = function(o, e) {
|
|
||||||
const p = r().flowchart;
|
|
||||||
let n = 0;
|
|
||||||
o.forEach(function(t) {
|
|
||||||
var l;
|
|
||||||
n++;
|
|
||||||
const s = {
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: t.relation.lineType == 1 ? "dashed" : "solid",
|
|
||||||
id: `id_${t.id1}_${t.id2}_${n}`,
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: t.type === "arrow_open" ? "none" : "normal",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: t.relationTitle1 === "none" ? "" : t.relationTitle1,
|
|
||||||
endLabelLeft: t.relationTitle2 === "none" ? "" : t.relationTitle2,
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: D(t.relation.type1),
|
|
||||||
arrowTypeEnd: D(t.relation.type2),
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: A(p == null ? void 0 : p.curve, C)
|
|
||||||
};
|
|
||||||
if (c.info(s, t), t.style !== void 0) {
|
|
||||||
const a = E(t.style);
|
|
||||||
s.style = a.style, s.labelStyle = a.labelStyle;
|
|
||||||
}
|
|
||||||
t.text = t.title, t.text === void 0 ? t.style !== void 0 && (s.arrowheadStyle = "fill: #333") : (s.arrowheadStyle = "fill: #333", s.labelpos = "c", ((l = r().flowchart) == null ? void 0 : l.htmlLabels) ?? r().htmlLabels ? (s.labelType = "html", s.label = '<span class="edgeLabel">' + t.text + "</span>") : (s.labelType = "text", s.label = t.text.replace(_.lineBreakRegex, `
|
|
||||||
`), t.style === void 0 && (s.style = s.style || "stroke: #333; stroke-width: 1.5px;fill:none"), s.labelStyle = s.labelStyle.replace("color:", "fill:"))), e.setEdge(t.id1, t.id2, s, n);
|
|
||||||
});
|
|
||||||
}, V = function(o) {
|
|
||||||
v = {
|
|
||||||
...v,
|
|
||||||
...o
|
|
||||||
};
|
|
||||||
}, W = async function(o, e, p, n) {
|
|
||||||
c.info("Drawing class - ", e);
|
|
||||||
const t = r().flowchart ?? r().class, s = r().securityLevel;
|
|
||||||
c.info("config:", t);
|
|
||||||
const l = (t == null ? void 0 : t.nodeSpacing) ?? 50, a = (t == null ? void 0 : t.rankSpacing) ?? 50, i = new q({
|
|
||||||
multigraph: !0,
|
|
||||||
compound: !0
|
|
||||||
}).setGraph({
|
|
||||||
rankdir: n.db.getDirection(),
|
|
||||||
nodesep: l,
|
|
||||||
ranksep: a,
|
|
||||||
marginx: 8,
|
|
||||||
marginy: 8
|
|
||||||
}).setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
}), y = n.db.getNamespaces(), d = n.db.getClasses(), f = n.db.getRelations(), h = n.db.getNotes();
|
|
||||||
c.info(f), P(y, i, e, n), I(d, i, e, n), H(f, i), F(h, i, f.length + 1, d);
|
|
||||||
let b;
|
|
||||||
s === "sandbox" && (b = k("#i" + e));
|
|
||||||
const u = s === "sandbox" ? k(b.nodes()[0].contentDocument.body) : k("body"), m = u.select(`[id="${e}"]`), g = u.select("#" + e + " g");
|
|
||||||
if (await z(
|
|
||||||
g,
|
|
||||||
i,
|
|
||||||
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
||||||
"classDiagram",
|
|
||||||
e
|
|
||||||
), B.insertTitle(m, "classTitleText", (t == null ? void 0 : t.titleTopMargin) ?? 5, n.db.getDiagramTitle()), G(i, m, t == null ? void 0 : t.diagramPadding, t == null ? void 0 : t.useMaxWidth), !(t != null && t.htmlLabels)) {
|
|
||||||
const T = s === "sandbox" ? b.nodes()[0].contentDocument : document, M = T.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
|
|
||||||
for (const w of M) {
|
|
||||||
const L = w.getBBox(), x = T.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
||||||
x.setAttribute("rx", 0), x.setAttribute("ry", 0), x.setAttribute("width", L.width), x.setAttribute("height", L.height), w.insertBefore(x, w.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function D(o) {
|
|
||||||
let e;
|
|
||||||
switch (o) {
|
|
||||||
case 0:
|
|
||||||
e = "aggregation";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
e = "extension";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
e = "composition";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
e = "dependency";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
e = "lollipop";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
e = "none";
|
|
||||||
}
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
const J = {
|
|
||||||
setConf: V,
|
|
||||||
draw: W
|
|
||||||
}, ot = {
|
|
||||||
parser: R,
|
|
||||||
db: N,
|
|
||||||
renderer: J,
|
|
||||||
styles: $,
|
|
||||||
init: (o) => {
|
|
||||||
o.class || (o.class = {}), o.class.arrowMarkerAbsolute = o.arrowMarkerAbsolute, N.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
ot as diagram
|
|
||||||
};
|
|
|
@ -1,200 +0,0 @@
|
||||||
import { p as M, d as k, s as R } from "./styles-e9bde71f.js";
|
|
||||||
import { l as p, g as r, f as v, e as C } from "./config-e567ef17.js";
|
|
||||||
import { G as B } from "./layout-10a68736.js";
|
|
||||||
import { r as G } from "./index-f4462e28.js";
|
|
||||||
import { u as I, z as D, x as E, y as _ } from "./utils-aa888deb.js";
|
|
||||||
import { s as z } from "./setupGraphViewbox-a4603a92.js";
|
|
||||||
import "./mermaidAPI-51c0c26b.js";
|
|
||||||
import "./errorRenderer-a3c4bedb.js";
|
|
||||||
import "./commonDb-4dc3d465.js";
|
|
||||||
import "./isPlainObject-bb374f45.js";
|
|
||||||
import "./array-2ff2c7a6.js";
|
|
||||||
import "./constant-2fe7eae5.js";
|
|
||||||
import "./edges-a2733861.js";
|
|
||||||
import "./svgDraw-c2c52520.js";
|
|
||||||
const A = (l) => C.sanitizeText(l, r());
|
|
||||||
let S = {
|
|
||||||
dividerMargin: 10,
|
|
||||||
padding: 5,
|
|
||||||
textHeight: 10,
|
|
||||||
curve: void 0
|
|
||||||
};
|
|
||||||
const $ = function(l, o, b, a) {
|
|
||||||
const e = Object.keys(l);
|
|
||||||
p.info("keys:", e), p.info(l), e.forEach(function(s) {
|
|
||||||
var y, m;
|
|
||||||
const t = l[s];
|
|
||||||
let i = "";
|
|
||||||
t.cssClasses.length > 0 && (i = i + " " + t.cssClasses.join(" "));
|
|
||||||
const n = { labelStyle: "", style: "" }, f = t.label ?? t.id, c = 0, u = "class_box", d = {
|
|
||||||
labelStyle: n.labelStyle,
|
|
||||||
shape: u,
|
|
||||||
labelText: A(f),
|
|
||||||
classData: t,
|
|
||||||
rx: c,
|
|
||||||
ry: c,
|
|
||||||
class: i,
|
|
||||||
style: n.style,
|
|
||||||
id: t.id,
|
|
||||||
domId: t.domId,
|
|
||||||
tooltip: a.db.getTooltip(t.id) || "",
|
|
||||||
haveCallback: t.haveCallback,
|
|
||||||
link: t.link,
|
|
||||||
width: t.type === "group" ? 500 : void 0,
|
|
||||||
type: t.type,
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((y = r().flowchart) == null ? void 0 : y.padding) ?? ((m = r().class) == null ? void 0 : m.padding)
|
|
||||||
};
|
|
||||||
o.setNode(t.id, d), p.info("setNode", d);
|
|
||||||
});
|
|
||||||
}, q = function(l, o, b, a) {
|
|
||||||
p.info(l), l.forEach(function(e, s) {
|
|
||||||
var x, h;
|
|
||||||
const t = e, i = "", n = { labelStyle: "", style: "" }, f = t.text, c = 0, u = "note", d = {
|
|
||||||
labelStyle: n.labelStyle,
|
|
||||||
shape: u,
|
|
||||||
labelText: A(f),
|
|
||||||
noteData: t,
|
|
||||||
rx: c,
|
|
||||||
ry: c,
|
|
||||||
class: i,
|
|
||||||
style: n.style,
|
|
||||||
id: t.id,
|
|
||||||
domId: t.id,
|
|
||||||
tooltip: "",
|
|
||||||
type: "note",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((x = r().flowchart) == null ? void 0 : x.padding) ?? ((h = r().class) == null ? void 0 : h.padding)
|
|
||||||
};
|
|
||||||
if (o.setNode(t.id, d), p.info("setNode", d), !t.class || !(t.class in a))
|
|
||||||
return;
|
|
||||||
const y = b + s, m = {
|
|
||||||
id: `edgeNote${y}`,
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: "dotted",
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: "none",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: "",
|
|
||||||
endLabelLeft: "",
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: "none",
|
|
||||||
arrowTypeEnd: "none",
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: D(S.curve, E)
|
|
||||||
};
|
|
||||||
o.setEdge(t.id, t.class, m, y);
|
|
||||||
});
|
|
||||||
}, F = function(l, o) {
|
|
||||||
const b = r().flowchart;
|
|
||||||
let a = 0;
|
|
||||||
l.forEach(function(e) {
|
|
||||||
var t;
|
|
||||||
a++;
|
|
||||||
const s = {
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: e.relation.lineType == 1 ? "dashed" : "solid",
|
|
||||||
id: "id" + a,
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: e.type === "arrow_open" ? "none" : "normal",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: e.relationTitle1 === "none" ? "" : e.relationTitle1,
|
|
||||||
endLabelLeft: e.relationTitle2 === "none" ? "" : e.relationTitle2,
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: L(e.relation.type1),
|
|
||||||
arrowTypeEnd: L(e.relation.type2),
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: D(b == null ? void 0 : b.curve, E)
|
|
||||||
};
|
|
||||||
if (p.info(s, e), e.style !== void 0) {
|
|
||||||
const i = _(e.style);
|
|
||||||
s.style = i.style, s.labelStyle = i.labelStyle;
|
|
||||||
}
|
|
||||||
e.text = e.title, e.text === void 0 ? e.style !== void 0 && (s.arrowheadStyle = "fill: #333") : (s.arrowheadStyle = "fill: #333", s.labelpos = "c", ((t = r().flowchart) == null ? void 0 : t.htmlLabels) ?? r().htmlLabels ? (s.labelType = "html", s.label = '<span class="edgeLabel">' + e.text + "</span>") : (s.labelType = "text", s.label = e.text.replace(C.lineBreakRegex, `
|
|
||||||
`), e.style === void 0 && (s.style = s.style || "stroke: #333; stroke-width: 1.5px;fill:none"), s.labelStyle = s.labelStyle.replace("color:", "fill:"))), o.setEdge(e.id1, e.id2, s, a);
|
|
||||||
});
|
|
||||||
}, H = function(l) {
|
|
||||||
S = {
|
|
||||||
...S,
|
|
||||||
...l
|
|
||||||
};
|
|
||||||
}, P = function(l, o, b, a) {
|
|
||||||
p.info("Drawing class - ", o);
|
|
||||||
const e = r().flowchart ?? r().class, s = r().securityLevel;
|
|
||||||
p.info("config:", e);
|
|
||||||
const t = (e == null ? void 0 : e.nodeSpacing) ?? 50, i = (e == null ? void 0 : e.rankSpacing) ?? 50, n = new B({
|
|
||||||
multigraph: !0,
|
|
||||||
compound: !0
|
|
||||||
}).setGraph({
|
|
||||||
rankdir: a.db.getDirection(),
|
|
||||||
nodesep: t,
|
|
||||||
ranksep: i,
|
|
||||||
marginx: 8,
|
|
||||||
marginy: 8
|
|
||||||
}).setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
}), f = a.db.getClasses(), c = a.db.getRelations(), u = a.db.getNotes();
|
|
||||||
p.info(c), $(f, n, o, a), F(c, n), q(u, n, c.length + 1, f);
|
|
||||||
let d;
|
|
||||||
s === "sandbox" && (d = v("#i" + o));
|
|
||||||
const y = s === "sandbox" ? (
|
|
||||||
// @ts-ignore Ignore type error for now
|
|
||||||
v(d.nodes()[0].contentDocument.body)
|
|
||||||
) : v("body"), m = y.select(`[id="${o}"]`), x = y.select("#" + o + " g");
|
|
||||||
if (G(
|
|
||||||
x,
|
|
||||||
n,
|
|
||||||
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
||||||
"classDiagram",
|
|
||||||
o
|
|
||||||
), I.insertTitle(m, "classTitleText", (e == null ? void 0 : e.titleTopMargin) ?? 5, a.db.getDiagramTitle()), z(n, m, e == null ? void 0 : e.diagramPadding, e == null ? void 0 : e.useMaxWidth), !(e != null && e.htmlLabels)) {
|
|
||||||
const h = s === "sandbox" ? d.nodes()[0].contentDocument : document, N = h.querySelectorAll('[id="' + o + '"] .edgeLabel .label');
|
|
||||||
for (const w of N) {
|
|
||||||
const T = w.getBBox(), g = h.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
||||||
g.setAttribute("rx", 0), g.setAttribute("ry", 0), g.setAttribute("width", T.width), g.setAttribute("height", T.height), w.insertBefore(g, w.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function L(l) {
|
|
||||||
let o;
|
|
||||||
switch (l) {
|
|
||||||
case 0:
|
|
||||||
o = "aggregation";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
o = "extension";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
o = "composition";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
o = "dependency";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
o = "lollipop";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
o = "none";
|
|
||||||
}
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
const V = {
|
|
||||||
setConf: H,
|
|
||||||
draw: P
|
|
||||||
}, le = {
|
|
||||||
parser: M,
|
|
||||||
db: k,
|
|
||||||
renderer: V,
|
|
||||||
styles: R,
|
|
||||||
init: (l) => {
|
|
||||||
l.class || (l.class = {}), l.class.arrowMarkerAbsolute = l.arrowMarkerAbsolute, k.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
le as diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-v2-6bb7b84a.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,272 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-d6ad8edb.js";
|
|
||||||
import { l as log, g as getConfig, f as select, e as common } from "./config-b4fa35bb.js";
|
|
||||||
import { G as Graph } from "./layout-4663fc19.js";
|
|
||||||
import { r as render } from "./index-a1a98052.js";
|
|
||||||
import { u as utils, z as interpolateToCurve, x as curveLinear, y as getStylesFromArray } from "./utils-872dfc50.js";
|
|
||||||
import { s as setupGraphViewbox } from "./setupGraphViewbox-16a0ba81.js";
|
|
||||||
import "./mermaidAPI-6f22a815.js";
|
|
||||||
import "./errorRenderer-ebf63d74.js";
|
|
||||||
import "./commonDb-7f40ab5a.js";
|
|
||||||
import "./isPlainObject-91dd8bc9.js";
|
|
||||||
import "./array-b7dcf730.js";
|
|
||||||
import "./constant-b644328d.js";
|
|
||||||
import "./edges-62a01f73.js";
|
|
||||||
import "./svgDraw-9e97e6db.js";
|
|
||||||
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
|
|
||||||
let conf = {
|
|
||||||
dividerMargin: 10,
|
|
||||||
padding: 5,
|
|
||||||
textHeight: 10,
|
|
||||||
curve: void 0
|
|
||||||
};
|
|
||||||
const addClasses = function(classes, g, _id, diagObj) {
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
log.info("keys:", keys);
|
|
||||||
log.info(classes);
|
|
||||||
keys.forEach(function(id) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = classes[id];
|
|
||||||
let cssClassStr = "";
|
|
||||||
if (vertex.cssClasses.length > 0) {
|
|
||||||
cssClassStr = cssClassStr + " " + vertex.cssClasses.join(" ");
|
|
||||||
}
|
|
||||||
const styles2 = { labelStyle: "", style: "" };
|
|
||||||
const vertexText = vertex.label ?? vertex.id;
|
|
||||||
const radius = 0;
|
|
||||||
const shape = "class_box";
|
|
||||||
const node = {
|
|
||||||
labelStyle: styles2.labelStyle,
|
|
||||||
shape,
|
|
||||||
labelText: sanitizeText(vertexText),
|
|
||||||
classData: vertex,
|
|
||||||
rx: radius,
|
|
||||||
ry: radius,
|
|
||||||
class: cssClassStr,
|
|
||||||
style: styles2.style,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.domId,
|
|
||||||
tooltip: diagObj.db.getTooltip(vertex.id) || "",
|
|
||||||
haveCallback: vertex.haveCallback,
|
|
||||||
link: vertex.link,
|
|
||||||
width: vertex.type === "group" ? 500 : void 0,
|
|
||||||
type: vertex.type,
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
log.info("setNode", node);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addNotes = function(notes, g, startEdgeId, classes) {
|
|
||||||
log.info(notes);
|
|
||||||
notes.forEach(function(note, i) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = note;
|
|
||||||
const cssNoteStr = "";
|
|
||||||
const styles2 = { labelStyle: "", style: "" };
|
|
||||||
const vertexText = vertex.text;
|
|
||||||
const radius = 0;
|
|
||||||
const shape = "note";
|
|
||||||
const node = {
|
|
||||||
labelStyle: styles2.labelStyle,
|
|
||||||
shape,
|
|
||||||
labelText: sanitizeText(vertexText),
|
|
||||||
noteData: vertex,
|
|
||||||
rx: radius,
|
|
||||||
ry: radius,
|
|
||||||
class: cssNoteStr,
|
|
||||||
style: styles2.style,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.id,
|
|
||||||
tooltip: "",
|
|
||||||
type: "note",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
log.info("setNode", node);
|
|
||||||
if (!vertex.class || !(vertex.class in classes)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const edgeId = startEdgeId + i;
|
|
||||||
const edgeData = {
|
|
||||||
id: `edgeNote${edgeId}`,
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: "dotted",
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: "none",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: "",
|
|
||||||
endLabelLeft: "",
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: "none",
|
|
||||||
arrowTypeEnd: "none",
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: interpolateToCurve(conf.curve, curveLinear)
|
|
||||||
};
|
|
||||||
g.setEdge(vertex.id, vertex.class, edgeData, edgeId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addRelations = function(relations, g) {
|
|
||||||
const conf2 = getConfig().flowchart;
|
|
||||||
let cnt = 0;
|
|
||||||
relations.forEach(function(edge) {
|
|
||||||
var _a;
|
|
||||||
cnt++;
|
|
||||||
const edgeData = {
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: edge.relation.lineType == 1 ? "dashed" : "solid",
|
|
||||||
id: "id" + cnt,
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: edge.type === "arrow_open" ? "none" : "normal",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1,
|
|
||||||
endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2,
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: getArrowMarker(edge.relation.type1),
|
|
||||||
arrowTypeEnd: getArrowMarker(edge.relation.type2),
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear)
|
|
||||||
};
|
|
||||||
log.info(edgeData, edge);
|
|
||||||
if (edge.style !== void 0) {
|
|
||||||
const styles2 = getStylesFromArray(edge.style);
|
|
||||||
edgeData.style = styles2.style;
|
|
||||||
edgeData.labelStyle = styles2.labelStyle;
|
|
||||||
}
|
|
||||||
edge.text = edge.title;
|
|
||||||
if (edge.text === void 0) {
|
|
||||||
if (edge.style !== void 0) {
|
|
||||||
edgeData.arrowheadStyle = "fill: #333";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
edgeData.arrowheadStyle = "fill: #333";
|
|
||||||
edgeData.labelpos = "c";
|
|
||||||
if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) {
|
|
||||||
edgeData.labelType = "html";
|
|
||||||
edgeData.label = '<span class="edgeLabel">' + edge.text + "</span>";
|
|
||||||
} else {
|
|
||||||
edgeData.labelType = "text";
|
|
||||||
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
|
|
||||||
if (edge.style === void 0) {
|
|
||||||
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
|
|
||||||
}
|
|
||||||
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g.setEdge(edge.id1, edge.id2, edgeData, cnt);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const setConf = function(cnf) {
|
|
||||||
conf = {
|
|
||||||
...conf,
|
|
||||||
...cnf
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const draw = function(text, id, _version, diagObj) {
|
|
||||||
log.info("Drawing class - ", id);
|
|
||||||
const conf2 = getConfig().flowchart ?? getConfig().class;
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
log.info("config:", conf2);
|
|
||||||
const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50;
|
|
||||||
const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50;
|
|
||||||
const g = new Graph({
|
|
||||||
multigraph: true,
|
|
||||||
compound: true
|
|
||||||
}).setGraph({
|
|
||||||
rankdir: diagObj.db.getDirection(),
|
|
||||||
nodesep: nodeSpacing,
|
|
||||||
ranksep: rankSpacing,
|
|
||||||
marginx: 8,
|
|
||||||
marginy: 8
|
|
||||||
}).setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
log.info(relations);
|
|
||||||
addClasses(classes, g, id, diagObj);
|
|
||||||
addRelations(relations, g);
|
|
||||||
addNotes(notes, g, relations.length + 1, classes);
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? (
|
|
||||||
// @ts-ignore Ignore type error for now
|
|
||||||
select(sandboxElement.nodes()[0].contentDocument.body)
|
|
||||||
) : select("body");
|
|
||||||
const svg = root.select(`[id="${id}"]`);
|
|
||||||
const element = root.select("#" + id + " g");
|
|
||||||
render(
|
|
||||||
element,
|
|
||||||
g,
|
|
||||||
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
||||||
"classDiagram",
|
|
||||||
id
|
|
||||||
);
|
|
||||||
utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle());
|
|
||||||
setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth);
|
|
||||||
if (!(conf2 == null ? void 0 : conf2.htmlLabels)) {
|
|
||||||
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
|
|
||||||
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
|
||||||
for (const label of labels) {
|
|
||||||
const dim = label.getBBox();
|
|
||||||
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
||||||
rect.setAttribute("rx", 0);
|
|
||||||
rect.setAttribute("ry", 0);
|
|
||||||
rect.setAttribute("width", dim.width);
|
|
||||||
rect.setAttribute("height", dim.height);
|
|
||||||
label.insertBefore(rect, label.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function getArrowMarker(type) {
|
|
||||||
let marker;
|
|
||||||
switch (type) {
|
|
||||||
case 0:
|
|
||||||
marker = "aggregation";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
marker = "extension";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
marker = "composition";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
marker = "dependency";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
marker = "lollipop";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
marker = "none";
|
|
||||||
}
|
|
||||||
return marker;
|
|
||||||
}
|
|
||||||
const renderer = {
|
|
||||||
setConf,
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=classDiagram-v2-8096aa52.js.map
|
|
File diff suppressed because one or more lines are too long
|
@ -1,206 +0,0 @@
|
||||||
import { p as R, d as N, s as $ } from "./styles-4bdb8b48.js";
|
|
||||||
import { l as c, c as r, j as k, A as B, t as G, o as E, q as A, n as C, f as _ } from "./mermaid-00886c59.js";
|
|
||||||
import { G as q } from "./graph-dee88f0d.js";
|
|
||||||
import { r as z } from "./index-14a831a4.js";
|
|
||||||
import "./layout-03086fc5.js";
|
|
||||||
import "./clone-a4e35854.js";
|
|
||||||
import "./edges-4734986e.js";
|
|
||||||
import "./createText-0ee50ac4.js";
|
|
||||||
import "./line-79437661.js";
|
|
||||||
import "./array-2ff2c7a6.js";
|
|
||||||
import "./path-428ebac9.js";
|
|
||||||
const S = (o) => _.sanitizeText(o, r());
|
|
||||||
let v = {
|
|
||||||
dividerMargin: 10,
|
|
||||||
padding: 5,
|
|
||||||
textHeight: 10,
|
|
||||||
curve: void 0
|
|
||||||
};
|
|
||||||
const P = function(o, e, p, n) {
|
|
||||||
const t = Object.keys(o);
|
|
||||||
c.info("keys:", t), c.info(o), t.forEach(function(s) {
|
|
||||||
var y, d;
|
|
||||||
const l = o[s], i = {
|
|
||||||
shape: "rect",
|
|
||||||
id: l.id,
|
|
||||||
domId: l.domId,
|
|
||||||
labelText: S(l.id),
|
|
||||||
labelStyle: "",
|
|
||||||
style: "fill: none; stroke: black",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((y = r().flowchart) == null ? void 0 : y.padding) ?? ((d = r().class) == null ? void 0 : d.padding)
|
|
||||||
};
|
|
||||||
e.setNode(l.id, i), I(l.classes, e, p, n, l.id), c.info("setNode", i);
|
|
||||||
});
|
|
||||||
}, I = function(o, e, p, n, t) {
|
|
||||||
const s = Object.keys(o);
|
|
||||||
c.info("keys:", s), c.info(o), s.filter((l) => o[l].parent == t).forEach(function(l) {
|
|
||||||
var u, m;
|
|
||||||
const a = o[l], i = a.cssClasses.join(" "), y = E(a.styles), d = a.label ?? a.id, f = 0, h = "class_box", b = {
|
|
||||||
labelStyle: y.labelStyle,
|
|
||||||
shape: h,
|
|
||||||
labelText: S(d),
|
|
||||||
classData: a,
|
|
||||||
rx: f,
|
|
||||||
ry: f,
|
|
||||||
class: i,
|
|
||||||
style: y.style,
|
|
||||||
id: a.id,
|
|
||||||
domId: a.domId,
|
|
||||||
tooltip: n.db.getTooltip(a.id, t) || "",
|
|
||||||
haveCallback: a.haveCallback,
|
|
||||||
link: a.link,
|
|
||||||
width: a.type === "group" ? 500 : void 0,
|
|
||||||
type: a.type,
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((u = r().flowchart) == null ? void 0 : u.padding) ?? ((m = r().class) == null ? void 0 : m.padding)
|
|
||||||
};
|
|
||||||
e.setNode(a.id, b), t && e.setParent(a.id, t), c.info("setNode", b);
|
|
||||||
});
|
|
||||||
}, F = function(o, e, p, n) {
|
|
||||||
c.info(o), o.forEach(function(t, s) {
|
|
||||||
var m, g;
|
|
||||||
const l = t, a = "", i = { labelStyle: "", style: "" }, y = l.text, d = 0, f = "note", h = {
|
|
||||||
labelStyle: i.labelStyle,
|
|
||||||
shape: f,
|
|
||||||
labelText: S(y),
|
|
||||||
noteData: l,
|
|
||||||
rx: d,
|
|
||||||
ry: d,
|
|
||||||
class: a,
|
|
||||||
style: i.style,
|
|
||||||
id: l.id,
|
|
||||||
domId: l.id,
|
|
||||||
tooltip: "",
|
|
||||||
type: "note",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((m = r().flowchart) == null ? void 0 : m.padding) ?? ((g = r().class) == null ? void 0 : g.padding)
|
|
||||||
};
|
|
||||||
if (e.setNode(l.id, h), c.info("setNode", h), !l.class || !(l.class in n))
|
|
||||||
return;
|
|
||||||
const b = p + s, u = {
|
|
||||||
id: `edgeNote${b}`,
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: "dotted",
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: "none",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: "",
|
|
||||||
endLabelLeft: "",
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: "none",
|
|
||||||
arrowTypeEnd: "none",
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: A(v.curve, C)
|
|
||||||
};
|
|
||||||
e.setEdge(l.id, l.class, u, b);
|
|
||||||
});
|
|
||||||
}, H = function(o, e) {
|
|
||||||
const p = r().flowchart;
|
|
||||||
let n = 0;
|
|
||||||
o.forEach(function(t) {
|
|
||||||
var l;
|
|
||||||
n++;
|
|
||||||
const s = {
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: t.relation.lineType == 1 ? "dashed" : "solid",
|
|
||||||
id: `id_${t.id1}_${t.id2}_${n}`,
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: t.type === "arrow_open" ? "none" : "normal",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: t.relationTitle1 === "none" ? "" : t.relationTitle1,
|
|
||||||
endLabelLeft: t.relationTitle2 === "none" ? "" : t.relationTitle2,
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: D(t.relation.type1),
|
|
||||||
arrowTypeEnd: D(t.relation.type2),
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: A(p == null ? void 0 : p.curve, C)
|
|
||||||
};
|
|
||||||
if (c.info(s, t), t.style !== void 0) {
|
|
||||||
const a = E(t.style);
|
|
||||||
s.style = a.style, s.labelStyle = a.labelStyle;
|
|
||||||
}
|
|
||||||
t.text = t.title, t.text === void 0 ? t.style !== void 0 && (s.arrowheadStyle = "fill: #333") : (s.arrowheadStyle = "fill: #333", s.labelpos = "c", ((l = r().flowchart) == null ? void 0 : l.htmlLabels) ?? r().htmlLabels ? (s.labelType = "html", s.label = '<span class="edgeLabel">' + t.text + "</span>") : (s.labelType = "text", s.label = t.text.replace(_.lineBreakRegex, `
|
|
||||||
`), t.style === void 0 && (s.style = s.style || "stroke: #333; stroke-width: 1.5px;fill:none"), s.labelStyle = s.labelStyle.replace("color:", "fill:"))), e.setEdge(t.id1, t.id2, s, n);
|
|
||||||
});
|
|
||||||
}, V = function(o) {
|
|
||||||
v = {
|
|
||||||
...v,
|
|
||||||
...o
|
|
||||||
};
|
|
||||||
}, W = async function(o, e, p, n) {
|
|
||||||
c.info("Drawing class - ", e);
|
|
||||||
const t = r().flowchart ?? r().class, s = r().securityLevel;
|
|
||||||
c.info("config:", t);
|
|
||||||
const l = (t == null ? void 0 : t.nodeSpacing) ?? 50, a = (t == null ? void 0 : t.rankSpacing) ?? 50, i = new q({
|
|
||||||
multigraph: !0,
|
|
||||||
compound: !0
|
|
||||||
}).setGraph({
|
|
||||||
rankdir: n.db.getDirection(),
|
|
||||||
nodesep: l,
|
|
||||||
ranksep: a,
|
|
||||||
marginx: 8,
|
|
||||||
marginy: 8
|
|
||||||
}).setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
}), y = n.db.getNamespaces(), d = n.db.getClasses(), f = n.db.getRelations(), h = n.db.getNotes();
|
|
||||||
c.info(f), P(y, i, e, n), I(d, i, e, n), H(f, i), F(h, i, f.length + 1, d);
|
|
||||||
let b;
|
|
||||||
s === "sandbox" && (b = k("#i" + e));
|
|
||||||
const u = s === "sandbox" ? k(b.nodes()[0].contentDocument.body) : k("body"), m = u.select(`[id="${e}"]`), g = u.select("#" + e + " g");
|
|
||||||
if (await z(
|
|
||||||
g,
|
|
||||||
i,
|
|
||||||
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
||||||
"classDiagram",
|
|
||||||
e
|
|
||||||
), B.insertTitle(m, "classTitleText", (t == null ? void 0 : t.titleTopMargin) ?? 5, n.db.getDiagramTitle()), G(i, m, t == null ? void 0 : t.diagramPadding, t == null ? void 0 : t.useMaxWidth), !(t != null && t.htmlLabels)) {
|
|
||||||
const T = s === "sandbox" ? b.nodes()[0].contentDocument : document, M = T.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
|
|
||||||
for (const w of M) {
|
|
||||||
const L = w.getBBox(), x = T.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
||||||
x.setAttribute("rx", 0), x.setAttribute("ry", 0), x.setAttribute("width", L.width), x.setAttribute("height", L.height), w.insertBefore(x, w.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function D(o) {
|
|
||||||
let e;
|
|
||||||
switch (o) {
|
|
||||||
case 0:
|
|
||||||
e = "aggregation";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
e = "extension";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
e = "composition";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
e = "dependency";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
e = "lollipop";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
e = "none";
|
|
||||||
}
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
const J = {
|
|
||||||
setConf: V,
|
|
||||||
draw: W
|
|
||||||
}, ot = {
|
|
||||||
parser: R,
|
|
||||||
db: N,
|
|
||||||
renderer: J,
|
|
||||||
styles: $,
|
|
||||||
init: (o) => {
|
|
||||||
o.class || (o.class = {}), o.class.arrowMarkerAbsolute = o.arrowMarkerAbsolute, N.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
ot as diagram
|
|
||||||
};
|
|
|
@ -1,298 +0,0 @@
|
||||||
import { p as parser, d as db, s as styles } from "./styles-b83b31c9.js";
|
|
||||||
import { select, curveLinear } from "d3";
|
|
||||||
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
|
|
||||||
import { l as log, c as getConfig, u as utils, o as setupGraphViewbox, k as getStylesFromArray, n as interpolateToCurve, e as common } from "./mermaid-6dc72991.js";
|
|
||||||
import { r as render } from "./index-01f381cb.js";
|
|
||||||
import "ts-dedent";
|
|
||||||
import "dayjs";
|
|
||||||
import "@braintree/sanitize-url";
|
|
||||||
import "dompurify";
|
|
||||||
import "khroma";
|
|
||||||
import "lodash-es/memoize.js";
|
|
||||||
import "lodash-es/merge.js";
|
|
||||||
import "stylis";
|
|
||||||
import "lodash-es/isEmpty.js";
|
|
||||||
import "dagre-d3-es/src/dagre/index.js";
|
|
||||||
import "dagre-d3-es/src/graphlib/json.js";
|
|
||||||
import "./edges-066a5561.js";
|
|
||||||
import "./createText-ca0c5216.js";
|
|
||||||
import "mdast-util-from-markdown";
|
|
||||||
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
|
|
||||||
let conf = {
|
|
||||||
dividerMargin: 10,
|
|
||||||
padding: 5,
|
|
||||||
textHeight: 10,
|
|
||||||
curve: void 0
|
|
||||||
};
|
|
||||||
const addNamespaces = function(namespaces, g, _id, diagObj) {
|
|
||||||
const keys = Object.keys(namespaces);
|
|
||||||
log.info("keys:", keys);
|
|
||||||
log.info(namespaces);
|
|
||||||
keys.forEach(function(id) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = namespaces[id];
|
|
||||||
const shape = "rect";
|
|
||||||
const node = {
|
|
||||||
shape,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.domId,
|
|
||||||
labelText: sanitizeText(vertex.id),
|
|
||||||
labelStyle: "",
|
|
||||||
style: "fill: none; stroke: black",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
addClasses(vertex.classes, g, _id, diagObj, vertex.id);
|
|
||||||
log.info("setNode", node);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addClasses = function(classes, g, _id, diagObj, parent) {
|
|
||||||
const keys = Object.keys(classes);
|
|
||||||
log.info("keys:", keys);
|
|
||||||
log.info(classes);
|
|
||||||
keys.filter((id) => classes[id].parent == parent).forEach(function(id) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = classes[id];
|
|
||||||
const cssClassStr = vertex.cssClasses.join(" ");
|
|
||||||
const styles2 = getStylesFromArray(vertex.styles);
|
|
||||||
const vertexText = vertex.label ?? vertex.id;
|
|
||||||
const radius = 0;
|
|
||||||
const shape = "class_box";
|
|
||||||
const node = {
|
|
||||||
labelStyle: styles2.labelStyle,
|
|
||||||
shape,
|
|
||||||
labelText: sanitizeText(vertexText),
|
|
||||||
classData: vertex,
|
|
||||||
rx: radius,
|
|
||||||
ry: radius,
|
|
||||||
class: cssClassStr,
|
|
||||||
style: styles2.style,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.domId,
|
|
||||||
tooltip: diagObj.db.getTooltip(vertex.id, parent) || "",
|
|
||||||
haveCallback: vertex.haveCallback,
|
|
||||||
link: vertex.link,
|
|
||||||
width: vertex.type === "group" ? 500 : void 0,
|
|
||||||
type: vertex.type,
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
if (parent) {
|
|
||||||
g.setParent(vertex.id, parent);
|
|
||||||
}
|
|
||||||
log.info("setNode", node);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addNotes = function(notes, g, startEdgeId, classes) {
|
|
||||||
log.info(notes);
|
|
||||||
notes.forEach(function(note, i) {
|
|
||||||
var _a, _b;
|
|
||||||
const vertex = note;
|
|
||||||
const cssNoteStr = "";
|
|
||||||
const styles2 = { labelStyle: "", style: "" };
|
|
||||||
const vertexText = vertex.text;
|
|
||||||
const radius = 0;
|
|
||||||
const shape = "note";
|
|
||||||
const node = {
|
|
||||||
labelStyle: styles2.labelStyle,
|
|
||||||
shape,
|
|
||||||
labelText: sanitizeText(vertexText),
|
|
||||||
noteData: vertex,
|
|
||||||
rx: radius,
|
|
||||||
ry: radius,
|
|
||||||
class: cssNoteStr,
|
|
||||||
style: styles2.style,
|
|
||||||
id: vertex.id,
|
|
||||||
domId: vertex.id,
|
|
||||||
tooltip: "",
|
|
||||||
type: "note",
|
|
||||||
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
||||||
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
|
||||||
};
|
|
||||||
g.setNode(vertex.id, node);
|
|
||||||
log.info("setNode", node);
|
|
||||||
if (!vertex.class || !(vertex.class in classes)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const edgeId = startEdgeId + i;
|
|
||||||
const edgeData = {
|
|
||||||
id: `edgeNote${edgeId}`,
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: "dotted",
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: "none",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: "",
|
|
||||||
endLabelLeft: "",
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: "none",
|
|
||||||
arrowTypeEnd: "none",
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: interpolateToCurve(conf.curve, curveLinear)
|
|
||||||
};
|
|
||||||
g.setEdge(vertex.id, vertex.class, edgeData, edgeId);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const addRelations = function(relations, g) {
|
|
||||||
const conf2 = getConfig().flowchart;
|
|
||||||
let cnt = 0;
|
|
||||||
relations.forEach(function(edge) {
|
|
||||||
var _a;
|
|
||||||
cnt++;
|
|
||||||
const edgeData = {
|
|
||||||
//Set relationship style and line type
|
|
||||||
classes: "relation",
|
|
||||||
pattern: edge.relation.lineType == 1 ? "dashed" : "solid",
|
|
||||||
id: `id_${edge.id1}_${edge.id2}_${cnt}`,
|
|
||||||
// Set link type for rendering
|
|
||||||
arrowhead: edge.type === "arrow_open" ? "none" : "normal",
|
|
||||||
//Set edge extra labels
|
|
||||||
startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1,
|
|
||||||
endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2,
|
|
||||||
//Set relation arrow types
|
|
||||||
arrowTypeStart: getArrowMarker(edge.relation.type1),
|
|
||||||
arrowTypeEnd: getArrowMarker(edge.relation.type2),
|
|
||||||
style: "fill:none",
|
|
||||||
labelStyle: "",
|
|
||||||
curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear)
|
|
||||||
};
|
|
||||||
log.info(edgeData, edge);
|
|
||||||
if (edge.style !== void 0) {
|
|
||||||
const styles2 = getStylesFromArray(edge.style);
|
|
||||||
edgeData.style = styles2.style;
|
|
||||||
edgeData.labelStyle = styles2.labelStyle;
|
|
||||||
}
|
|
||||||
edge.text = edge.title;
|
|
||||||
if (edge.text === void 0) {
|
|
||||||
if (edge.style !== void 0) {
|
|
||||||
edgeData.arrowheadStyle = "fill: #333";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
edgeData.arrowheadStyle = "fill: #333";
|
|
||||||
edgeData.labelpos = "c";
|
|
||||||
if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) {
|
|
||||||
edgeData.labelType = "html";
|
|
||||||
edgeData.label = '<span class="edgeLabel">' + edge.text + "</span>";
|
|
||||||
} else {
|
|
||||||
edgeData.labelType = "text";
|
|
||||||
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
|
|
||||||
if (edge.style === void 0) {
|
|
||||||
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
|
|
||||||
}
|
|
||||||
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g.setEdge(edge.id1, edge.id2, edgeData, cnt);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const setConf = function(cnf) {
|
|
||||||
conf = {
|
|
||||||
...conf,
|
|
||||||
...cnf
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const draw = async function(text, id, _version, diagObj) {
|
|
||||||
log.info("Drawing class - ", id);
|
|
||||||
const conf2 = getConfig().flowchart ?? getConfig().class;
|
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
log.info("config:", conf2);
|
|
||||||
const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50;
|
|
||||||
const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50;
|
|
||||||
const g = new graphlib.Graph({
|
|
||||||
multigraph: true,
|
|
||||||
compound: true
|
|
||||||
}).setGraph({
|
|
||||||
rankdir: diagObj.db.getDirection(),
|
|
||||||
nodesep: nodeSpacing,
|
|
||||||
ranksep: rankSpacing,
|
|
||||||
marginx: 8,
|
|
||||||
marginy: 8
|
|
||||||
}).setDefaultEdgeLabel(function() {
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
const namespaces = diagObj.db.getNamespaces();
|
|
||||||
const classes = diagObj.db.getClasses();
|
|
||||||
const relations = diagObj.db.getRelations();
|
|
||||||
const notes = diagObj.db.getNotes();
|
|
||||||
log.info(relations);
|
|
||||||
addNamespaces(namespaces, g, id, diagObj);
|
|
||||||
addClasses(classes, g, id, diagObj);
|
|
||||||
addRelations(relations, g);
|
|
||||||
addNotes(notes, g, relations.length + 1, classes);
|
|
||||||
let sandboxElement;
|
|
||||||
if (securityLevel === "sandbox") {
|
|
||||||
sandboxElement = select("#i" + id);
|
|
||||||
}
|
|
||||||
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
|
||||||
const svg = root.select(`[id="${id}"]`);
|
|
||||||
const element = root.select("#" + id + " g");
|
|
||||||
await render(
|
|
||||||
element,
|
|
||||||
g,
|
|
||||||
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
||||||
"classDiagram",
|
|
||||||
id
|
|
||||||
);
|
|
||||||
utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle());
|
|
||||||
setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth);
|
|
||||||
if (!(conf2 == null ? void 0 : conf2.htmlLabels)) {
|
|
||||||
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
|
|
||||||
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
|
||||||
for (const label of labels) {
|
|
||||||
const dim = label.getBBox();
|
|
||||||
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
||||||
rect.setAttribute("rx", 0);
|
|
||||||
rect.setAttribute("ry", 0);
|
|
||||||
rect.setAttribute("width", dim.width);
|
|
||||||
rect.setAttribute("height", dim.height);
|
|
||||||
label.insertBefore(rect, label.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function getArrowMarker(type) {
|
|
||||||
let marker;
|
|
||||||
switch (type) {
|
|
||||||
case 0:
|
|
||||||
marker = "aggregation";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
marker = "extension";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
marker = "composition";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
marker = "dependency";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
marker = "lollipop";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
marker = "none";
|
|
||||||
}
|
|
||||||
return marker;
|
|
||||||
}
|
|
||||||
const renderer = {
|
|
||||||
setConf,
|
|
||||||
draw
|
|
||||||
};
|
|
||||||
const diagram = {
|
|
||||||
parser,
|
|
||||||
db,
|
|
||||||
renderer,
|
|
||||||
styles,
|
|
||||||
init: (cnf) => {
|
|
||||||
if (!cnf.class) {
|
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
|
||||||
db.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
diagram
|
|
||||||
};
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue