vue3-network-graph 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +72 -1
- package/README.md +71 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.mjs +3 -1
- package/dist/index.umd.cjs +2 -2
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -35,8 +35,10 @@ A lightweight network topology component implemented with pure SVG, providing th
|
|
|
35
35
|
- **Smart Multi-line Handling**: Multiple connections between the same pair of nodes automatically prevent overlap, staying parallel in any mode
|
|
36
36
|
- **Upright Connection Text**: `fromText` / `centerText` / `toText` rotate along the path tangentially, automatically flipping when exceeding ±90° to maintain readability
|
|
37
37
|
- **Rich Node Types**: 8 icon nodes + text nodes + border-only nodes
|
|
38
|
+
- **Image Nodes**: photo / avatar / bitmap nodes, fitted at their real aspect ratio (fully contained or cover-cropped, never stretched)
|
|
38
39
|
- **2D/3D Views**: Supports both 2D plane and 2.5D card styles
|
|
39
40
|
- **Flow Animations**: Dashed流光 + particle effects, with per-connection animation control
|
|
41
|
+
- **Edges never get swallowed**: nodes are painted in two passes (plate below, icon / label above), so a line crossing a node — or two overlapping nodes — stays visible; the selected path is promoted to the very top
|
|
40
42
|
|
|
41
43
|
### Interaction Capabilities
|
|
42
44
|
|
|
@@ -363,6 +365,12 @@ const handleMethods = () => {
|
|
|
363
365
|
| `fxGlowMaxEdges` | `Number` | `500` | Edge count above which edge glow auto-disables |
|
|
364
366
|
| `fxBreatheMaxNodes` | `Number` | `300` | Node count above which breathing rings auto-disable |
|
|
365
367
|
| `enableZOrder` | `Boolean` | `false` | **Enable Z-axis layer sorting**: After enabling, nodes render according to `zIndex` property, supporting layer operation API, right-click menu and keyboard shortcuts |
|
|
368
|
+
| `enableDeleteKey` | `Boolean` | `true` | Delete / Backspace removes the current selection (requires `editable`); when the parent listens to `delete-request` the component only emits the event |
|
|
369
|
+
| `imageFit` | `"contain" \| "cover"` | `"contain"` | How image nodes fill their box: `contain` keeps the whole picture inside the box (centred, letterboxed, never cropped); `cover` fills the box and crops the overflow. Both scale uniformly — the picture is never stretched |
|
|
370
|
+
| `imageNodeBySource` | `Boolean` | `false` | **Global image-node rule**: when `true`, any node carrying a picture source is rendered as an image node (its `nodeType` is ignored); text and border-only nodes are unaffected |
|
|
371
|
+
| `edgeLayer` | `"split" \| "below"` | `"split"` | Paint order of nodes vs edges: `split` paints each node in two passes — plate + border below, icon / image / label above, with edges in between (a line crossing a node stays visible); `below` is the classic "all edges under all nodes" |
|
|
372
|
+
| `highlightEdgeOnTop` | `Boolean` | `true` | Selected edges are re-painted above the node layer so the highlighted path is never hidden by a node plate or icon (decoration only — it never captures clicks) |
|
|
373
|
+
| `edgeCasingColor` | `String` | `#0a0e1a` | Casing color drawn under a promoted (selected) edge so the line stays readable on any node artwork |
|
|
366
374
|
|
|
367
375
|
### radialGradient Configuration
|
|
368
376
|
|
|
@@ -395,6 +403,7 @@ radialGradient: {
|
|
|
395
403
|
| `id` | `String` | ✅ | - | Unique node identifier |
|
|
396
404
|
| `label` | `String \| null` | ❌ | `null` | Node display text (supports `\n` newline), border-only and text nodes can be empty |
|
|
397
405
|
| `nodeType` | `String` | ❌ | `"server"` | Node type (see types list below) |
|
|
406
|
+
| `image` | `String` | ❌ | - | Picture URL; aliases `src` / `img` / `imageUrl` (see "Image Nodes" below) |
|
|
398
407
|
| `state` | `String` | ❌ | `"none"` | Node status (see status list below) |
|
|
399
408
|
| `x` | `Number` | ✅ | - | Node X coordinate (SVG coordinate system) |
|
|
400
409
|
| `y` | `Number` | ✅ | - | Node Y coordinate (SVG coordinate system) |
|
|
@@ -406,7 +415,7 @@ radialGradient: {
|
|
|
406
415
|
| `fontWeight` | `Number \| String` | ❌ | `500` | Font weight (100–900) |
|
|
407
416
|
| `borderColor` | `String` | ❌ | `"#94a3b8"` | Border color |
|
|
408
417
|
| `borderWidth` | `Number` | ❌ | `0` | Border width (0 means no border) |
|
|
409
|
-
| `borderStyle` | `"dashed" \| ""`
|
|
418
|
+
| `borderStyle` | `"full" \| "dashed" \| "none"` | ❌ | `"full"` | Border style: `"full"` solid, `"dashed"` dashed, `"none"` no border |
|
|
410
419
|
| `background` | `String` | ❌ | `"#0f1729"` | Background color |
|
|
411
420
|
| `borderRadius` | `Number` | ❌ | `6` | Corner radius (px) |
|
|
412
421
|
| `labelPosition` | `"top" \| "center" \| "bottom"` | ❌ | `"bottom"` | Label position |
|
|
@@ -427,6 +436,54 @@ radialGradient: {
|
|
|
427
436
|
| `"text"` | Text lines | Pure text node |
|
|
428
437
|
| `"border-only"` | Hollow rectangle | Border-only node (only border outline displayed) |
|
|
429
438
|
|
|
439
|
+
### Image Nodes
|
|
440
|
+
|
|
441
|
+
A node can be rendered with a picture (photo / avatar / bitmap icon). The component always scales it uniformly — it is never stretched.
|
|
442
|
+
|
|
443
|
+
**Detection rules** (any one makes it an image node):
|
|
444
|
+
|
|
445
|
+
| Condition | Example |
|
|
446
|
+
| --------- | ------- |
|
|
447
|
+
| `nodeType` is `"image"` / `"img"` / `"picture"` (case-insensitive) | `{ nodeType: "image", image: "/a.png" }` |
|
|
448
|
+
| No `nodeType` at all, and a picture source is present | `{ image: "/a.png" }` |
|
|
449
|
+
| `config.imageNodeBySource` is on and a picture source is present (`nodeType` ignored) | `{ nodeType: "server", image: "/a.png" }` |
|
|
450
|
+
|
|
451
|
+
- The source is taken from the first non-empty field of **`image` → `src` → `img` → `imageUrl`**; it must be a non-empty (trimmed) string.
|
|
452
|
+
- Text (`"text"`) and border-only (`"border-only"`) nodes always keep their own rendering.
|
|
453
|
+
- A node with a `nodeType` is **not** an image node by default (its icon follows `nodeType`). For a fully photo-based graph, switch `imageNodeBySource: true`.
|
|
454
|
+
|
|
455
|
+
**Filling**: `config.imageFit`
|
|
456
|
+
|
|
457
|
+
| Value | Effect |
|
|
458
|
+
| ----- | ------ |
|
|
459
|
+
| `"contain"` (default) | The whole picture fits inside the node box, centred and letterboxed — never cropped |
|
|
460
|
+
| `"cover"` | Fills the box along its shortest edge; the overflow on the long edge is cropped |
|
|
461
|
+
|
|
462
|
+
**Slot props**: `#node-icon` receives
|
|
463
|
+
|
|
464
|
+
| prop | Description |
|
|
465
|
+
| ---- | ----------- |
|
|
466
|
+
| `isImage` | Whether this node is treated as an image node |
|
|
467
|
+
| `image` | Picture source (may be an empty string) |
|
|
468
|
+
| `fit` | `"contain"` / `"cover"` |
|
|
469
|
+
| `imageWidth` / `imageHeight` | Aspect-correct draw size for the picture (centre it on the node box) |
|
|
470
|
+
| `width` / `height` | Node box size |
|
|
471
|
+
|
|
472
|
+
```vue
|
|
473
|
+
<Topology :nodes="nodes" :edges="edges" :config="{ imageFit: 'contain' }">
|
|
474
|
+
<template #node-icon="{ isImage, image, imageWidth, imageHeight }">
|
|
475
|
+
<image
|
|
476
|
+
v-if="isImage"
|
|
477
|
+
:href="image"
|
|
478
|
+
:x="-imageWidth / 2"
|
|
479
|
+
:y="-imageHeight / 2"
|
|
480
|
+
:width="imageWidth"
|
|
481
|
+
:height="imageHeight"
|
|
482
|
+
/>
|
|
483
|
+
</template>
|
|
484
|
+
</Topology>
|
|
485
|
+
```
|
|
486
|
+
|
|
430
487
|
### Node Status (state)
|
|
431
488
|
|
|
432
489
|
| Status | Color | Description |
|
|
@@ -619,6 +676,8 @@ const methods = () => {
|
|
|
619
676
|
### Interaction Priority Notes
|
|
620
677
|
|
|
621
678
|
- **Node and connection overlap**: Click/drag acts on **node**; connections normally clickable where not occluded—nodes always selectable and draggable in dense graphics
|
|
679
|
+
- **Border-only node exception**: such a node is an empty frame — only its **border stroke** and **label text** are clickable, so the empty interior passes clicks through to the connections / canvas underneath (a line running through the frame stays selectable). Drag it by its border or label
|
|
680
|
+
- **The promoted-edge layer never captures clicks**: `highlightEdgeOnTop` re-paints selected edges above the nodes for visual clarity only; it does not steal clicks from nodes or anything else
|
|
622
681
|
- **Click vs drag distinction**: Left-click on blank distinguishes by small threshold (pan 4px / box select 3px / node drag 3px): below threshold treated as click (clear or toggle selection), above threshold enters drag mode
|
|
623
682
|
|
|
624
683
|
---
|
|
@@ -631,6 +690,18 @@ const methods = () => {
|
|
|
631
690
|
|
|
632
691
|
When loading a complete new dataset, first update your `nodes` / `edges`, then call `setData()` to clean up component internal residual state.
|
|
633
692
|
|
|
693
|
+
### Node / Edge Paint Order
|
|
694
|
+
|
|
695
|
+
With the default `config.edgeLayer: "split"` the paint order is:
|
|
696
|
+
|
|
697
|
+
```
|
|
698
|
+
group boxes → node plate (background + border) → edges (base / glow / particles / text) → node content (icon / image / label / status dot)
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
An edge crossing a node — or a node overlapping another node — therefore keeps running **across the node plate**, and is only partly covered by the icon itself instead of disappearing. Set `edgeLayer: "below"` for the classic "all edges under all nodes" order.
|
|
702
|
+
|
|
703
|
+
With `config.highlightEdgeOnTop` (default `true`) selected edges are additionally painted above the node content, with a dark casing (`edgeCasingColor`), so the path under inspection is never hidden.
|
|
704
|
+
|
|
634
705
|
### TypeScript Support
|
|
635
706
|
|
|
636
707
|
```typescript
|
package/README.md
CHANGED
|
@@ -35,8 +35,10 @@
|
|
|
35
35
|
- **智能多线处理**:同一对节点的多条连线自动防重叠,任何模式下都保持平行
|
|
36
36
|
- **连线文字直立**:`fromText` / `centerText` / `toText` 沿路径切向旋转,超过±90° 自动翻转保持可读
|
|
37
37
|
- **丰富的节点类型**:8 种图标节点 + 文本节点 + 纯边框节点
|
|
38
|
+
- **图片节点**:照片 / 头像 / 位图节点,按真实比例等比适配(整图完整显示或铺满裁剪,永不拉伸)
|
|
38
39
|
- **2D/3D 视图**:支持 2D 平面和 2.5D 卡片风格
|
|
39
40
|
- **流向动画**:虚线流光 + 粒子效果,可单独控制每条连线的动画开关
|
|
41
|
+
- **连线不被节点吃掉**:节点分层绘制(底板在下、图标/标签在上),连线穿过节点或节点重叠时依然连续可见;选中链路自动提升到最上层
|
|
40
42
|
|
|
41
43
|
### 交互能力
|
|
42
44
|
|
|
@@ -363,6 +365,12 @@ const handleMethods = () => {
|
|
|
363
365
|
| `fxGlowMaxEdges` | `Number` | `500` | 连线发光自动关闭的连线数阈值 |
|
|
364
366
|
| `fxBreatheMaxNodes` | `Number` | `300` | 呼吸灯自动关闭的节点数阈值 |
|
|
365
367
|
| `enableZOrder` | `Boolean` | `false` | **启用 Z 轴层级排序**:启用后节点按 `zIndex` 属性渲染,支持图层操作 API、右键菜单和快捷键 |
|
|
368
|
+
| `enableDeleteKey` | `Boolean` | `true` | Delete / Backspace 删除当前选中(需 `editable`);父级监听 `delete-request` 时只抛事件、不直接删除 |
|
|
369
|
+
| `imageFit` | `"contain" \| "cover"` | `"contain"` | 图片节点填充方式:`contain` 整图完整显示在节点框内(居中留白、不裁剪);`cover` 铺满节点框并裁掉溢出。两者都等比缩放,不会拉伸变形 |
|
|
370
|
+
| `imageNodeBySource` | `Boolean` | `false` | **图片节点全局判定**:`true` 时节点只要带图片地址就按图片节点渲染(忽略 `nodeType`);文本节点、纯边框节点不受影响 |
|
|
371
|
+
| `edgeLayer` | `"split" \| "below"` | `"split"` | 节点与连线的绘制顺序:`split` 把节点拆两层——底板+边框在下、图标/图片/标签在上,连线夹在中间(线穿过节点不再被整块盖住);`below` 为传统的「所有连线在所有节点之下」 |
|
|
372
|
+
| `highlightEdgeOnTop` | `Boolean` | `true` | 选中的连线额外绘制在节点层之上,避免高亮链路被节点底板或图标遮挡(纯装饰层,不参与点击命中) |
|
|
373
|
+
| `edgeCasingColor` | `String` | `#0a0e1a` | 提升到节点之上的连线外描边(casing)颜色,保证线压在任何节点图形上都清晰可读 |
|
|
366
374
|
|
|
367
375
|
### radialGradient 配置
|
|
368
376
|
|
|
@@ -395,6 +403,7 @@ radialGradient: {
|
|
|
395
403
|
| `id` | `String` | ✅ | - | 节点唯一标识 |
|
|
396
404
|
| `label` | `String \| null` | ❌ | `null` | 节点显示文本(支持 `\n` 换行),纯边框节点和文本节点可设为空 |
|
|
397
405
|
| `nodeType` | `String` | ❌ | `"server"` | 节点类型(见下方类型列表) |
|
|
406
|
+
| `image` | `String` | ❌ | - | 图片地址,也可用别名 `src` / `img` / `imageUrl`(见下方「图片节点」) |
|
|
398
407
|
| `state` | `String` | ❌ | `"none"` | 节点状态(见下方状态列表) |
|
|
399
408
|
| `x` | `Number` | ✅ | - | 节点 X 坐标(SVG 坐标系) |
|
|
400
409
|
| `y` | `Number` | ✅ | - | 节点 Y 坐标(SVG 坐标系) |
|
|
@@ -427,6 +436,54 @@ radialGradient: {
|
|
|
427
436
|
| `"text"` | 文本行 | 纯文本节点 |
|
|
428
437
|
| `"border-only"` | 空心矩形 | 纯边框节点(仅显示边框轮廓) |
|
|
429
438
|
|
|
439
|
+
### 图片节点
|
|
440
|
+
|
|
441
|
+
节点可以用图片(照片 / 头像 / 位图图标)渲染,组件会**等比缩放**它,不会出现拉伸变形。
|
|
442
|
+
|
|
443
|
+
**判定规则**(满足任一即为图片节点):
|
|
444
|
+
|
|
445
|
+
| 条件 | 示例 |
|
|
446
|
+
| ---- | ---- |
|
|
447
|
+
| `nodeType` 为 `"image"` / `"img"` / `"picture"`(大小写不敏感) | `{ nodeType: "image", image: "/a.png" }` |
|
|
448
|
+
| 没有 `nodeType`,且带图片地址 | `{ image: "/a.png" }` |
|
|
449
|
+
| 开启 `config.imageNodeBySource`,且带图片地址(忽略 `nodeType`) | `{ nodeType: "server", image: "/a.png" }` |
|
|
450
|
+
|
|
451
|
+
- 图片地址按 **`image` → `src` → `img` → `imageUrl`** 顺序取第一个有值的字段;必须是 trim 后非空的字符串。
|
|
452
|
+
- 文本节点(`nodeType: "text"`)与纯边框节点(`"border-only"`)始终按各自类型渲染,不会被转成图片。
|
|
453
|
+
- 带 `nodeType` 的节点**默认不会**变成图片节点(图标按 `nodeType` 渲染);整个图都是照片时,用 `imageNodeBySource: true` 一次性放开。
|
|
454
|
+
|
|
455
|
+
**填充方式**:`config.imageFit`
|
|
456
|
+
|
|
457
|
+
| 值 | 效果 |
|
|
458
|
+
| -- | ---- |
|
|
459
|
+
| `"contain"`(默认) | 整张图完整落在节点框内,居中留白(letterbox),**不裁剪** |
|
|
460
|
+
| `"cover"` | 按最短边铺满节点框,长边超出的部分被裁掉 |
|
|
461
|
+
|
|
462
|
+
**自定义插槽**:`#node-icon` 会收到以下 props,可自行决定画什么——
|
|
463
|
+
|
|
464
|
+
| prop | 说明 |
|
|
465
|
+
| ---- | ---- |
|
|
466
|
+
| `isImage` | 当前节点是否被判为图片节点 |
|
|
467
|
+
| `image` | 图片地址(可能为空串) |
|
|
468
|
+
| `fit` | `"contain"` / `"cover"` |
|
|
469
|
+
| `imageWidth` / `imageHeight` | 已按图片真实比例算好的绘制尺寸(图片节点才有,衬在节点框中心即可) |
|
|
470
|
+
| `width` / `height` | 节点框尺寸 |
|
|
471
|
+
|
|
472
|
+
```vue
|
|
473
|
+
<Topology :nodes="nodes" :edges="edges" :config="{ imageFit: 'contain' }">
|
|
474
|
+
<template #node-icon="{ isImage, image, imageWidth, imageHeight }">
|
|
475
|
+
<image
|
|
476
|
+
v-if="isImage"
|
|
477
|
+
:href="image"
|
|
478
|
+
:x="-imageWidth / 2"
|
|
479
|
+
:y="-imageHeight / 2"
|
|
480
|
+
:width="imageWidth"
|
|
481
|
+
:height="imageHeight"
|
|
482
|
+
/>
|
|
483
|
+
</template>
|
|
484
|
+
</Topology>
|
|
485
|
+
```
|
|
486
|
+
|
|
430
487
|
### 节点状态(state)
|
|
431
488
|
|
|
432
489
|
| 状态 | 颜色 | 说明 |
|
|
@@ -619,6 +676,8 @@ const methods = () => {
|
|
|
619
676
|
### 交互优先级说明
|
|
620
677
|
|
|
621
678
|
- **节点与连线重叠处**:点击/拖动作用于**节点**;连线在未被遮挡处正常点击——密集图形下节点始终可选中、可拖动
|
|
679
|
+
- **纯边框节点例外**:这类节点内部是空的,只有**框线**和**标签文字**响应点击(内部空白会让位给下面的连线与画布)——所以从框中穿过的连线依然可以单击选中;拖动纯边框节点请按住框线或标签
|
|
680
|
+
- **选中连线的提升层不参与命中**:`highlightEdgeOnTop` 把选中线画在节点之上纯属视觉,不会抢走节点或其它元素的点击
|
|
622
681
|
- **点击与拖动区分**:左键在空白处的「点击」与「拖动」按小阈值区分(平移 4px / 框选 3px / 节点拖动 3px):小于阈值仍视为点击(清空或切换选中),超过阈值才进入拖动
|
|
623
682
|
|
|
624
683
|
---
|
|
@@ -631,6 +690,18 @@ const methods = () => {
|
|
|
631
690
|
|
|
632
691
|
加载一整套新数据时,先更新你的 `nodes` / `edges`,再调用 `setData()` 清理组件内残留状态。
|
|
633
692
|
|
|
693
|
+
### 连线与节点的图层顺序
|
|
694
|
+
|
|
695
|
+
默认 `config.edgeLayer: "split"`,绘制顺序为:
|
|
696
|
+
|
|
697
|
+
```
|
|
698
|
+
分组框 → 节点底板(背景 + 边框) → 连线(基色/光效/粒子/文字) → 节点内容(图标/图片/标签/状态点)
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
这样连线穿过节点——或节点互相重叠时——会**压在节点底板上继续可见**,只被图标本体局部遮挡,不会整段消失。若需要传统的「所有连线都在所有节点之下」,设 `edgeLayer: "below"`。
|
|
702
|
+
|
|
703
|
+
配合 `config.highlightEdgeOnTop`(默认 `true`),被选中的连线还会在节点内容之上再画一遍(外描边取 `edgeCasingColor`),保证正在查看的链路永远不会被节点挡住。
|
|
704
|
+
|
|
634
705
|
### TypeScript 支持
|
|
635
706
|
|
|
636
707
|
```typescript
|
package/dist/index.d.ts
CHANGED
|
@@ -138,6 +138,15 @@ export interface TopologyConfig {
|
|
|
138
138
|
* deforms the picture.
|
|
139
139
|
*/
|
|
140
140
|
imageFit?: "cover" | "contain";
|
|
141
|
+
/**
|
|
142
|
+
* Global image-node switch. When true, ANY node carrying a picture source
|
|
143
|
+
* (`image` / `src` / `img` / `imageUrl`, non-empty string) is rendered as an
|
|
144
|
+
* image node — its `nodeType` is ignored, so a whole photo/avatar graph does
|
|
145
|
+
* not need explicit `nodeType: "image"`. Text and border-only nodes keep
|
|
146
|
+
* their own rendering. Default false (opt-in), which keeps the original rule:
|
|
147
|
+
* image node = `nodeType` image/img/picture, or no `nodeType` + picture.
|
|
148
|
+
*/
|
|
149
|
+
imageNodeBySource?: boolean;
|
|
141
150
|
/**
|
|
142
151
|
* Node / edge paint order.
|
|
143
152
|
* - "split" (default): every node is painted in two passes — background
|
package/dist/index.mjs
CHANGED
|
@@ -608,7 +608,7 @@ var x = {
|
|
|
608
608
|
if (!e) return "";
|
|
609
609
|
let t = e.image ?? e.src ?? e.img ?? e.imageUrl;
|
|
610
610
|
return typeof t == "string" && t.trim() ? t.trim() : "";
|
|
611
|
-
}, zn = (e) => e ? Ln.includes(String(e.nodeType ?? "").toLowerCase()) ? !0 : !e.nodeType && !!Rn(e) : !1, Bn = t(() => y.config?.imageFit === "cover" ? "cover" : "contain"), Vn = t(() => Bn.value === "contain" ? "xMidYMid meet" : "xMidYMid slice"), Hn = `-30 -30 ${S} ${S}`, Un = /* @__PURE__ */ new Map(), Wn = f(0), Gn = (e) => {
|
|
611
|
+
}, zn = (e) => e ? Ln.includes(String(e.nodeType ?? "").toLowerCase()) ? !0 : (y.config?.imageNodeBySource || !e.nodeType) && !!Rn(e) : !1, Bn = t(() => y.config?.imageFit === "cover" ? "cover" : "contain"), Vn = t(() => Bn.value === "contain" ? "xMidYMid meet" : "xMidYMid slice"), Hn = `-30 -30 ${S} ${S}`, Un = /* @__PURE__ */ new Map(), Wn = f(0), Gn = (e) => {
|
|
612
612
|
if (!e || Un.has(e) || typeof Image > "u") return;
|
|
613
613
|
Un.set(e, null);
|
|
614
614
|
let t = new Image();
|
|
@@ -2061,6 +2061,7 @@ var x = {
|
|
|
2061
2061
|
node: a,
|
|
2062
2062
|
color: F(a),
|
|
2063
2063
|
viewMode: v.viewMode,
|
|
2064
|
+
isImage: !0,
|
|
2064
2065
|
image: Rn(a),
|
|
2065
2066
|
fit: Bn.value,
|
|
2066
2067
|
imageWidth: Kn(a).w,
|
|
@@ -2081,6 +2082,7 @@ var x = {
|
|
|
2081
2082
|
node: a,
|
|
2082
2083
|
color: F(a),
|
|
2083
2084
|
viewMode: v.viewMode,
|
|
2085
|
+
isImage: !1,
|
|
2084
2086
|
image: Rn(a),
|
|
2085
2087
|
fit: Bn.value,
|
|
2086
2088
|
width: L(a).width,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue")):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Vue3NetworkGraph={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));function r(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+`-`+n[e[t+4]]+n[e[t+5]]+`-`+n[e[t+6]]+n[e[t+7]]+`-`+n[e[t+8]]+n[e[t+9]]+`-`+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}var i=new Uint8Array(16);function a(){return crypto.getRandomValues(i)}function o(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():s(e,t,n)}function s(e,t,n){e||={};let i=e.random??e.rng?.()??a();if(i.length<16)throw Error(`Random bytes length must be >= 16`);if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=i[e];return t}return r(i)}var c={normal:{color:`#4ade80`,label:`Running`},dormant:{color:`#909399`,label:`Dormant`},awakened:{color:`#409eff`,label:`Awakened`},adept:{color:`#e6a23c`,label:`Adept`},advanced:{color:`#ee7b0e`,label:`Advanced`},expert:{color:`#f56c6c`,label:`Expert`},master:{color:`#ff0000`,label:`Master`},warning:{color:`#facc15`,label:`Warning`},error:{color:`#f43f5e`,label:`Error`},idle:{color:`#64748b`,label:`Idle`}},l={core:`#00f0ff`,firewall:`#ff6b35`,loadbalancer:`#a855f7`,database:`#22d3ee`,server:`#4ade80`,cdn:`#facc15`,cache:`#f43f5e`,queue:`#fb923c`,text:`#94a3b8`},u=[`viewBox`],d=[`cx`,`cy`,`r`],f=[`offset`,`stop-color`,`stop-opacity`],p=[`id`],ee=[`stop-color`],te=[`stop-color`],ne=[`stop-color`],re=[`id`],ie=[`fill`],ae=[`id`],oe=[`fill`],se=[`width`,`height`,`x`,`y`],ce=[`width`,`height`],le=[`d`,`stroke`],ue=[`width`,`height`,`x`,`y`,`opacity`],de={key:1,class:`center-crosshair`},fe=[`x`,`y`,`width`,`height`,`fill`],pe=[`x`,`y`,`width`,`height`,`stroke`],me=[`cx`,`cy`,`fill`],he=[`cx`,`cy`,`fill`],ge=[`cx`,`cy`,`fill`],_e=[`cx`,`cy`,`fill`],ve=[`x`,`y`,`transform`,`fill`],ye={key:2,class:`node-base-layer`,"pointer-events":`none`},be=[`transform`],xe=[`x`,`y`,`width`,`height`,`rx`,`fill`],Se=[`x`,`y`,`width`,`height`,`rx`,`stroke`,`stroke-width`,`stroke-dasharray`],Ce=[`d`,`marker-end`],we=[`d`,`stroke`],Te=[`d`,`stroke`],Ee={key:0},De=[`d`,`stroke`],Oe=[`dur`],ke=[`d`,`stroke`],Ae=[`dur`],je=[`d`,`stroke`],Me=[`dur`],Ne={key:0},Pe=[`fill`],Fe=[`path`,`dur`],Ie=[`fill`],Le=[`path`,`dur`],Re=[`transform`],ze=[`y`,`height`,`stroke`],Be=[`font-size`,`fill`],Ve={key:1},He=[`transform`],Ue=[`x`,`y`,`width`,`height`,`fill`,`stroke`],We=[`font-size`,`fill`],Ge=[`transform`],Ke=[`x`,`y`,`width`,`height`,`fill`,`stroke`],qe=[`font-size`,`fill`],Je=[`transform`],Ye=[`x`,`y`,`width`,`height`,`fill`,`stroke`],Xe=[`font-size`,`fill`],Ze={key:3},Qe=[`x1`,`y1`,`x2`,`y2`,`stroke`],$e=[`cx`,`cy`,`fill`],et=[`x`,`y`,`width`,`height`,`stroke`],tt=[`d`,`onClick`],nt=[`transform`,`onMousedown`,`onClick`],rt=[`x`,`y`,`width`,`height`,`rx`,`stroke-width`],it=[`x`,`y`,`width`,`height`],at=[`x`,`y`,`width`,`height`,`rx`,`fill`],ot=[`x`,`y`,`width`,`height`,`rx`,`stroke`,`stroke-width`,`stroke-dasharray`],st=[`x`,`y`,`width`,`height`,`rx`,`stroke`],ct=[`transform`,`fill`,`font-size`],lt=[`dy`],ut=[`r`,`stroke`],dt=[`values`],ft=[`x`,`y`,`width`,`height`,`preserveAspectRatio`],pt=[`href`,`x`,`y`,`width`,`height`],mt=[`transform`],ht=[`fill`],gt=[`transform`],_t=[`fill`],vt=[`y`,`transform`,`fill`,`font-size`,`font-weight`],yt=[`dy`],bt={key:8,class:`node-handles`},xt=[`cx`,`cy`,`stroke`,`onPointerdown`],St={key:4,class:`node-resize-layer`},Ct=[`x`,`y`,`onMousedown`],wt={key:0,"pointer-events":`none`},Tt=[`d`,`stroke`],Et=[`d`,`stroke`,`marker-end`],Dt=[`x`,`y`,`width`,`height`],Ot=6,kt=14,At=3,m=60,jt=.2,Mt=5,Nt=160,Pt=140,Ft=12,It=4e3,Lt=12,Rt=4e3,zt={__name:`Topology`,props:{nodes:{type:Array,default:()=>[]},edges:{type:Array,default:()=>[]},groups:{type:Array,default:()=>[]},width:{type:Number,default:void 0},height:{type:Number,default:void 0},lineMode:{type:String,default:`curve`},viewMode:{type:String,default:`2d`},editable:{type:Boolean,default:!1},config:{type:Object,default:()=>({})}},emits:[`update:nodes`,`update:lineMode`,`update:viewMode`,`node-click`,`node-select`,`edge-select`,`edge-create`,`edge-update`,`edge-remove`,`selection-change`,`data-change`,`node-drag-start`,`node-drag-end`,`node-resize-start`,`node-resize-end`,`delete-request`],setup(e,{expose:n,emit:r}){let i=e,a=r,s=0,zt=()=>{s++},h=e=>e&&typeof e==`object`?{text:e.text,rotation:e.rotation||0,fontSize:e.fontSize,color:e.color}:{text:e,rotation:0,fontSize:void 0,color:void 0},Bt=(e,t=11)=>e.fontSize||t,Vt=e=>e.fontColor||`#000000`,Ht=(e,t=500)=>e.fontWeight||t,g=(e,t)=>e.fontSize||h(t).fontSize||8,_=(e,t)=>e.fontColor||h(t).color||`#000000`,v=(0,t.ref)(i.nodes.map(e=>({...e}))),Ut=null,y=()=>{Ut=v.value,a(`update:nodes`,v.value)};(0,t.watch)(()=>i.nodes,e=>{let t=Array.isArray(e)?e:[];if(t===Ut)return;let n=null,r=null;try{n=JSON.stringify(t),r=JSON.stringify(v.value)}catch{n=null}(n===null||n!==r)&&(zt(),v.value=t.map(e=>({...e})))},{deep:!0});let Wt=(0,t.ref)(i.lineMode);(0,t.watch)(()=>i.lineMode,e=>{Wt.value=e});let b=(0,t.computed)({get:()=>Wt.value,set:e=>{Wt.value=e,a(`update:lineMode`,e)}}),x=(0,t.ref)(null),S=(0,t.ref)(null),Gt=(0,t.ref)({x:0,y:0}),Kt=(0,t.ref)(null),qt=null,Jt=!1,Yt=!1,C=(0,t.ref)([]),w=(0,t.ref)(new Map),T=(0,t.ref)(new Set),E=(0,t.computed)(()=>{let e=i.edges,t=[];if(C.value.length){let n=new Set(e.map(e=>e.id));t=C.value.filter(e=>!n.has(e.id))}let n=t.length?[...e,...t]:e,r=w.value;r.size&&(n=n.map(e=>r.has(e.id)?{...e,...r.get(e.id)}:e));let a=new Set(v.value.map(e=>e.id)),o=T.value;return n.filter(e=>!o.has(e.id)&&a.has(e.from)&&a.has(e.to))}),Xt=(0,t.computed)(()=>i.config.watchDataChanges===!0),Zt=(0,t.ref)({nodes:[],edges:[]}),Qt=``,D=null,$t=()=>JSON.parse(JSON.stringify({nodes:v.value,edges:E.value})),en=(e,t)=>{let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e]));return{added:t.filter(e=>!n.has(e.id)).map(e=>e.id),removed:e.filter(e=>!r.has(e.id)).map(e=>e.id),updated:t.filter(e=>n.has(e.id)&&JSON.stringify(n.get(e.id))!==JSON.stringify(e)).map(e=>e.id)}},tn=e=>({nodes:en(Zt.value.nodes,e.nodes),edges:en(Zt.value.edges,e.edges)}),nn=()=>{if(D=null,!Xt.value)return;let e=$t(),t=JSON.stringify(e);if(t===Qt)return;let n=tn(e),r=n.nodes.added.length+n.nodes.removed.length+n.nodes.updated.length+n.edges.added.length+n.edges.removed.length+n.edges.updated.length;Qt=t,r&&a(`data-change`,{nodes:e.nodes,edges:e.edges,summary:n})},rn=()=>{Xt.value&&(D&&clearTimeout(D),D=setTimeout(nn,300))},an=()=>{D&&=(clearTimeout(D),null),Zt.value=$t(),Qt=``};(0,t.watch)([v,C,T,w],()=>rn(),{deep:!0}),(0,t.watch)(Xt,e=>{e?an():D&&=(clearTimeout(D),null)}),(0,t.onMounted)(()=>{Xt.value&&an()});let on=()=>$t(),sn=()=>{let e=new Set(I.value),t=new Set(L.value);return{nodeIds:e,nodes:v.value.filter(t=>e.has(t.id)),edges:E.value.filter(n=>t.has(n.id)||e.has(n.from)||e.has(n.to))}},cn=()=>{let{nodeIds:e,nodes:t,edges:n}=sn();return!t.length&&!n.length?{nodes:[],edges:[]}:(t.length&&(v.value=v.value.filter(t=>!e.has(t.id)),y()),n.length&&(T.value=new Set([...T.value,...n.map(e=>e.id)]),C.value=C.value.filter(e=>!T.value.has(e.id)),a(`edge-remove`,n.map(e=>JSON.parse(JSON.stringify(e))))),I.value=[],L.value=[],a(`node-select`,null),a(`edge-select`,null),R(),JSON.parse(JSON.stringify({nodes:t,edges:n})))},ln=e=>{let t=e.target;if(!t||t===document.body)return!1;let n=String(t.tagName||``).toLowerCase();return n===`input`||n===`textarea`||n===`select`||t.isContentEditable},un=(0,t.getCurrentInstance)(),dn=()=>{let e=un?.vnode?.props;return!!e&&`onDeleteRequest`in e},fn=()=>{let{nodes:e,edges:t}=sn();a(`delete-request`,JSON.parse(JSON.stringify({nodes:e,edges:t})))},pn=e=>{(e.key===`Delete`||e.key===`Backspace`)&&(e.isComposing||e.ctrlKey||e.metaKey||e.altKey||i.config?.enableDeleteKey!==!1&&i.editable&&(ln(e)||(I.value.length||L.value.length)&&(x.value||J.value||Y.value||(e.preventDefault(),dn()?fn():cn()))))};(0,t.onMounted)(()=>window.addEventListener(`keydown`,pn)),(0,t.onBeforeUnmount)(()=>window.removeEventListener(`keydown`,pn));let mn=e=>{let t=(Array.isArray(e)?e:[e]).filter(e=>e&&typeof e==`object`),n=new Set(v.value.map(e=>e.id)),r=[];for(let e of t){let t=JSON.parse(JSON.stringify(e));if(t.id==null)t.id=o();else if(n.has(t.id))continue;n.add(t.id),r.push(t)}return r.length?(v.value=[...v.value,...r],y(),JSON.parse(JSON.stringify(r))):[]},hn=e=>{let t=(Array.isArray(e)?e:[e]).filter(e=>e&&typeof e==`object`),n=new Set(E.value.map(e=>e.id)),r=[];for(let e of t){let t=JSON.parse(JSON.stringify(e));if(t.from!=null&&t.to!=null){if(t.id==null)t.id=o();else if(n.has(t.id))continue;n.add(t.id),r.push(t)}}if(!r.length)return[];let i=r.filter(e=>T.value.has(e.id));if(i.length){let e=new Set(i.map(e=>e.id));T.value=new Set([...T.value].filter(t=>!e.has(t)))}return C.value=[...C.value,...r],r.forEach(e=>a(`edge-create`,JSON.parse(JSON.stringify(e)))),JSON.parse(JSON.stringify(r))},gn=e=>{let t=(Array.isArray(e)?e:[e]).filter(e=>e&&e.id!=null);if(!t.length)return[];let n=new Map;for(let e of t){let{id:t,...r}=e,i={};for(let[e,t]of Object.entries(r))t!==void 0&&(i[e]=t);n.set(t,{...n.get(t)||{},...i})}let r=[];return v.value=v.value.map(e=>{let t=n.get(e.id);if(!t)return e;let i={...e,...t};return r.push(i),i}),r.length?(y(),JSON.parse(JSON.stringify(r))):[]},_n=e=>{let t=(Array.isArray(e)?e:[e]).filter(e=>e&&e.id!=null);if(!t.length)return[];let n=new Set(E.value.map(e=>e.id)),r=new Map(w.value),i=[];for(let e of t){let{id:t,...a}=e;if(!n.has(t))continue;let o={};for(let[e,t]of Object.entries(a))t!==void 0&&(o[e]=t);let s={...r.get(t)||{},...o};r.set(t,s);let c=E.value.find(e=>e.id===t);i.push({...c,...s})}return i.length?(w.value=r,a(`edge-update`,JSON.parse(JSON.stringify(i))),JSON.parse(JSON.stringify(i))):[]},vn=e=>{let t=e&&typeof e==`object`?e:null;return C.value=[],T.value=new Set,w.value=new Map,t&&Array.isArray(t.nodes)?(v.value=JSON.parse(JSON.stringify(t.nodes)),y()):(v.value=(Array.isArray(i.nodes)?i.nodes:[]).map(e=>({...e})),Ut=v.value),I.value=[],L.value=[],a(`node-select`,null),a(`edge-select`,null),R(),an(),$t()};(0,t.watch)(()=>i.edges,e=>{zt();let t=Array.isArray(e)?e:[],n=new Set(t.map(e=>e.id));if(C.value.length){let e=C.value.filter(e=>!n.has(e.id));e.length!==C.value.length&&(C.value=e)}if(w.value.size){let e=new Map(w.value),n=new Set(C.value.map(e=>e.id)),r=!1;for(let[i,a]of e){let o=t.find(e=>e.id===i);o?Object.entries(a).every(([e,t])=>JSON.stringify(o[e]??null)===JSON.stringify(t??null))&&(e.delete(i),r=!0):n.has(i)||(e.delete(i),r=!0)}r&&(w.value=e)}},{deep:!0});let O=(0,t.computed)(()=>{let e={};E.value.forEach(t=>{let n=[t.from,t.to].sort().join(`__`);e[n]||(e[n]=[]),e[n].push(t)});let t={};return Object.entries(e).forEach(([e,n])=>{let r=n.length;r>Ot?n.forEach((n,i)=>{t[n.id]=i===0?{key:e,index:0,total:1,count:r,merged:!0,representative:!0,hidden:!1}:{key:e,index:i,total:r,count:r,merged:!0,representative:!1,hidden:!0}}):n.forEach((n,i)=>{t[n.id]={key:e,index:i,total:r,merged:!1,representative:!1,hidden:!1}})}),t}),yn=(0,t.computed)(()=>{let e=new Map;for(let t of v.value)e.set(t.id,t);return e}),k=e=>yn.value.get(e),A=e=>e.state!=`none`&&c[e.state]&&c[e.state].color||`#00f0ff`,bn=e=>c[e.state]||c.normal,xn=e=>e.nodeType===`text`,Sn=e=>e.nodeType===`border-only`,Cn=[`image`,`img`,`picture`],j=e=>{if(!e)return``;let t=e.image??e.src??e.img??e.imageUrl;return typeof t==`string`&&t.trim()?t.trim():``},wn=e=>e?Cn.includes(String(e.nodeType??``).toLowerCase())?!0:!e.nodeType&&!!j(e):!1,Tn=(0,t.computed)(()=>i.config?.imageFit===`cover`?`cover`:`contain`),En=(0,t.computed)(()=>Tn.value===`contain`?`xMidYMid meet`:`xMidYMid slice`),Dn=`-30 -30 ${m} ${m}`,On=new Map,kn=(0,t.ref)(0),An=e=>{if(!e||On.has(e)||typeof Image>`u`)return;On.set(e,null);let t=new Image;t.onload=()=>{On.set(e,{w:t.naturalWidth||1,h:t.naturalHeight||1}),kn.value++},t.onerror=()=>{On.set(e,{w:1,h:1}),kn.value++},t.src=e},M=e=>{kn.value;let t=j(e),n=t?On.get(t):null,{w:r,h:i}=N(e);if(!n)return{w:r,h:i};let a=n.w,o=n.h,s;if(Tn.value===`contain`)s=Math.min(m/a,m/o);else{let e=Math.max(r,i)/m;s=Math.max(r/e/a,i/e/o)}return{w:a*s,h:o*s}};(0,t.watchEffect)(()=>{for(let e of v.value)wn(e)&&An(j(e))});let jn=(e,t)=>{let n=Number(e);return Number.isFinite(n)&&n>0?n:t},Mn=e=>{let t=jn(e.width,m),n=jn(e.height,m);return{sx:t/m,sy:n/m}},Nn=e=>{let t=Math.max(e.width,e.height);return isNaN(t)?30:t/2},Pn=e=>{let{sx:t,sy:n}=Mn(e);return t===1&&n===1?``:`scale(${t}, ${n})`},Fn=e=>{let{w:t,h:n}=N(e),r=Math.min(10,t*.3),i=Math.min(10,n*.3);return`translate(${t/2-r}, ${-(n/2-i)})`},In=(0,t.computed)(()=>{let e=Number(i.config.labelGap);return Number.isFinite(e)&&e>=0?e:18}),Ln=e=>{if(xn(e))return 4;let{h:t}=N(e);return e.labelPosition===`top`?-(t/2+In.value):e.labelPosition===`center`?0:t/2+In.value},Rn=e=>{let t=P(e);if(xn(e)||!e.label)return t;let n=Bt(e),r=Ln(e);if(e.labelPosition===`top`){let e=r-n-4;e<t.y&&(t.height+=t.y-e,t.y=e)}else if(e.labelPosition!==`center`){let i=r+(String(e.label).split(`
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue")):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Vue3NetworkGraph={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));function r(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+`-`+n[e[t+4]]+n[e[t+5]]+`-`+n[e[t+6]]+n[e[t+7]]+`-`+n[e[t+8]]+n[e[t+9]]+`-`+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}var i=new Uint8Array(16);function a(){return crypto.getRandomValues(i)}function o(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():s(e,t,n)}function s(e,t,n){e||={};let i=e.random??e.rng?.()??a();if(i.length<16)throw Error(`Random bytes length must be >= 16`);if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=i[e];return t}return r(i)}var c={normal:{color:`#4ade80`,label:`Running`},dormant:{color:`#909399`,label:`Dormant`},awakened:{color:`#409eff`,label:`Awakened`},adept:{color:`#e6a23c`,label:`Adept`},advanced:{color:`#ee7b0e`,label:`Advanced`},expert:{color:`#f56c6c`,label:`Expert`},master:{color:`#ff0000`,label:`Master`},warning:{color:`#facc15`,label:`Warning`},error:{color:`#f43f5e`,label:`Error`},idle:{color:`#64748b`,label:`Idle`}},l={core:`#00f0ff`,firewall:`#ff6b35`,loadbalancer:`#a855f7`,database:`#22d3ee`,server:`#4ade80`,cdn:`#facc15`,cache:`#f43f5e`,queue:`#fb923c`,text:`#94a3b8`},u=[`viewBox`],d=[`cx`,`cy`,`r`],f=[`offset`,`stop-color`,`stop-opacity`],p=[`id`],ee=[`stop-color`],te=[`stop-color`],ne=[`stop-color`],re=[`id`],ie=[`fill`],ae=[`id`],oe=[`fill`],se=[`width`,`height`,`x`,`y`],ce=[`width`,`height`],le=[`d`,`stroke`],ue=[`width`,`height`,`x`,`y`,`opacity`],de={key:1,class:`center-crosshair`},fe=[`x`,`y`,`width`,`height`,`fill`],pe=[`x`,`y`,`width`,`height`,`stroke`],me=[`cx`,`cy`,`fill`],he=[`cx`,`cy`,`fill`],ge=[`cx`,`cy`,`fill`],_e=[`cx`,`cy`,`fill`],ve=[`x`,`y`,`transform`,`fill`],ye={key:2,class:`node-base-layer`,"pointer-events":`none`},be=[`transform`],xe=[`x`,`y`,`width`,`height`,`rx`,`fill`],Se=[`x`,`y`,`width`,`height`,`rx`,`stroke`,`stroke-width`,`stroke-dasharray`],Ce=[`d`,`marker-end`],we=[`d`,`stroke`],Te=[`d`,`stroke`],Ee={key:0},De=[`d`,`stroke`],Oe=[`dur`],ke=[`d`,`stroke`],Ae=[`dur`],je=[`d`,`stroke`],Me=[`dur`],Ne={key:0},Pe=[`fill`],Fe=[`path`,`dur`],Ie=[`fill`],Le=[`path`,`dur`],Re=[`transform`],ze=[`y`,`height`,`stroke`],Be=[`font-size`,`fill`],Ve={key:1},He=[`transform`],Ue=[`x`,`y`,`width`,`height`,`fill`,`stroke`],We=[`font-size`,`fill`],Ge=[`transform`],Ke=[`x`,`y`,`width`,`height`,`fill`,`stroke`],qe=[`font-size`,`fill`],Je=[`transform`],Ye=[`x`,`y`,`width`,`height`,`fill`,`stroke`],Xe=[`font-size`,`fill`],Ze={key:3},Qe=[`x1`,`y1`,`x2`,`y2`,`stroke`],$e=[`cx`,`cy`,`fill`],et=[`x`,`y`,`width`,`height`,`stroke`],tt=[`d`,`onClick`],nt=[`transform`,`onMousedown`,`onClick`],rt=[`x`,`y`,`width`,`height`,`rx`,`stroke-width`],it=[`x`,`y`,`width`,`height`],at=[`x`,`y`,`width`,`height`,`rx`,`fill`],ot=[`x`,`y`,`width`,`height`,`rx`,`stroke`,`stroke-width`,`stroke-dasharray`],st=[`x`,`y`,`width`,`height`,`rx`,`stroke`],ct=[`transform`,`fill`,`font-size`],lt=[`dy`],ut=[`r`,`stroke`],dt=[`values`],ft=[`x`,`y`,`width`,`height`,`preserveAspectRatio`],pt=[`href`,`x`,`y`,`width`,`height`],mt=[`transform`],ht=[`fill`],gt=[`transform`],_t=[`fill`],vt=[`y`,`transform`,`fill`,`font-size`,`font-weight`],yt=[`dy`],bt={key:8,class:`node-handles`},xt=[`cx`,`cy`,`stroke`,`onPointerdown`],St={key:4,class:`node-resize-layer`},Ct=[`x`,`y`,`onMousedown`],wt={key:0,"pointer-events":`none`},Tt=[`d`,`stroke`],Et=[`d`,`stroke`,`marker-end`],Dt=[`x`,`y`,`width`,`height`],Ot=6,kt=14,At=3,m=60,jt=.2,Mt=5,Nt=160,Pt=140,Ft=12,It=4e3,Lt=12,Rt=4e3,zt={__name:`Topology`,props:{nodes:{type:Array,default:()=>[]},edges:{type:Array,default:()=>[]},groups:{type:Array,default:()=>[]},width:{type:Number,default:void 0},height:{type:Number,default:void 0},lineMode:{type:String,default:`curve`},viewMode:{type:String,default:`2d`},editable:{type:Boolean,default:!1},config:{type:Object,default:()=>({})}},emits:[`update:nodes`,`update:lineMode`,`update:viewMode`,`node-click`,`node-select`,`edge-select`,`edge-create`,`edge-update`,`edge-remove`,`selection-change`,`data-change`,`node-drag-start`,`node-drag-end`,`node-resize-start`,`node-resize-end`,`delete-request`],setup(e,{expose:n,emit:r}){let i=e,a=r,s=0,zt=()=>{s++},h=e=>e&&typeof e==`object`?{text:e.text,rotation:e.rotation||0,fontSize:e.fontSize,color:e.color}:{text:e,rotation:0,fontSize:void 0,color:void 0},Bt=(e,t=11)=>e.fontSize||t,Vt=e=>e.fontColor||`#000000`,Ht=(e,t=500)=>e.fontWeight||t,g=(e,t)=>e.fontSize||h(t).fontSize||8,_=(e,t)=>e.fontColor||h(t).color||`#000000`,v=(0,t.ref)(i.nodes.map(e=>({...e}))),Ut=null,y=()=>{Ut=v.value,a(`update:nodes`,v.value)};(0,t.watch)(()=>i.nodes,e=>{let t=Array.isArray(e)?e:[];if(t===Ut)return;let n=null,r=null;try{n=JSON.stringify(t),r=JSON.stringify(v.value)}catch{n=null}(n===null||n!==r)&&(zt(),v.value=t.map(e=>({...e})))},{deep:!0});let Wt=(0,t.ref)(i.lineMode);(0,t.watch)(()=>i.lineMode,e=>{Wt.value=e});let b=(0,t.computed)({get:()=>Wt.value,set:e=>{Wt.value=e,a(`update:lineMode`,e)}}),x=(0,t.ref)(null),S=(0,t.ref)(null),Gt=(0,t.ref)({x:0,y:0}),Kt=(0,t.ref)(null),qt=null,Jt=!1,Yt=!1,C=(0,t.ref)([]),w=(0,t.ref)(new Map),T=(0,t.ref)(new Set),E=(0,t.computed)(()=>{let e=i.edges,t=[];if(C.value.length){let n=new Set(e.map(e=>e.id));t=C.value.filter(e=>!n.has(e.id))}let n=t.length?[...e,...t]:e,r=w.value;r.size&&(n=n.map(e=>r.has(e.id)?{...e,...r.get(e.id)}:e));let a=new Set(v.value.map(e=>e.id)),o=T.value;return n.filter(e=>!o.has(e.id)&&a.has(e.from)&&a.has(e.to))}),Xt=(0,t.computed)(()=>i.config.watchDataChanges===!0),Zt=(0,t.ref)({nodes:[],edges:[]}),Qt=``,D=null,$t=()=>JSON.parse(JSON.stringify({nodes:v.value,edges:E.value})),en=(e,t)=>{let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e]));return{added:t.filter(e=>!n.has(e.id)).map(e=>e.id),removed:e.filter(e=>!r.has(e.id)).map(e=>e.id),updated:t.filter(e=>n.has(e.id)&&JSON.stringify(n.get(e.id))!==JSON.stringify(e)).map(e=>e.id)}},tn=e=>({nodes:en(Zt.value.nodes,e.nodes),edges:en(Zt.value.edges,e.edges)}),nn=()=>{if(D=null,!Xt.value)return;let e=$t(),t=JSON.stringify(e);if(t===Qt)return;let n=tn(e),r=n.nodes.added.length+n.nodes.removed.length+n.nodes.updated.length+n.edges.added.length+n.edges.removed.length+n.edges.updated.length;Qt=t,r&&a(`data-change`,{nodes:e.nodes,edges:e.edges,summary:n})},rn=()=>{Xt.value&&(D&&clearTimeout(D),D=setTimeout(nn,300))},an=()=>{D&&=(clearTimeout(D),null),Zt.value=$t(),Qt=``};(0,t.watch)([v,C,T,w],()=>rn(),{deep:!0}),(0,t.watch)(Xt,e=>{e?an():D&&=(clearTimeout(D),null)}),(0,t.onMounted)(()=>{Xt.value&&an()});let on=()=>$t(),sn=()=>{let e=new Set(I.value),t=new Set(L.value);return{nodeIds:e,nodes:v.value.filter(t=>e.has(t.id)),edges:E.value.filter(n=>t.has(n.id)||e.has(n.from)||e.has(n.to))}},cn=()=>{let{nodeIds:e,nodes:t,edges:n}=sn();return!t.length&&!n.length?{nodes:[],edges:[]}:(t.length&&(v.value=v.value.filter(t=>!e.has(t.id)),y()),n.length&&(T.value=new Set([...T.value,...n.map(e=>e.id)]),C.value=C.value.filter(e=>!T.value.has(e.id)),a(`edge-remove`,n.map(e=>JSON.parse(JSON.stringify(e))))),I.value=[],L.value=[],a(`node-select`,null),a(`edge-select`,null),R(),JSON.parse(JSON.stringify({nodes:t,edges:n})))},ln=e=>{let t=e.target;if(!t||t===document.body)return!1;let n=String(t.tagName||``).toLowerCase();return n===`input`||n===`textarea`||n===`select`||t.isContentEditable},un=(0,t.getCurrentInstance)(),dn=()=>{let e=un?.vnode?.props;return!!e&&`onDeleteRequest`in e},fn=()=>{let{nodes:e,edges:t}=sn();a(`delete-request`,JSON.parse(JSON.stringify({nodes:e,edges:t})))},pn=e=>{(e.key===`Delete`||e.key===`Backspace`)&&(e.isComposing||e.ctrlKey||e.metaKey||e.altKey||i.config?.enableDeleteKey!==!1&&i.editable&&(ln(e)||(I.value.length||L.value.length)&&(x.value||J.value||Y.value||(e.preventDefault(),dn()?fn():cn()))))};(0,t.onMounted)(()=>window.addEventListener(`keydown`,pn)),(0,t.onBeforeUnmount)(()=>window.removeEventListener(`keydown`,pn));let mn=e=>{let t=(Array.isArray(e)?e:[e]).filter(e=>e&&typeof e==`object`),n=new Set(v.value.map(e=>e.id)),r=[];for(let e of t){let t=JSON.parse(JSON.stringify(e));if(t.id==null)t.id=o();else if(n.has(t.id))continue;n.add(t.id),r.push(t)}return r.length?(v.value=[...v.value,...r],y(),JSON.parse(JSON.stringify(r))):[]},hn=e=>{let t=(Array.isArray(e)?e:[e]).filter(e=>e&&typeof e==`object`),n=new Set(E.value.map(e=>e.id)),r=[];for(let e of t){let t=JSON.parse(JSON.stringify(e));if(t.from!=null&&t.to!=null){if(t.id==null)t.id=o();else if(n.has(t.id))continue;n.add(t.id),r.push(t)}}if(!r.length)return[];let i=r.filter(e=>T.value.has(e.id));if(i.length){let e=new Set(i.map(e=>e.id));T.value=new Set([...T.value].filter(t=>!e.has(t)))}return C.value=[...C.value,...r],r.forEach(e=>a(`edge-create`,JSON.parse(JSON.stringify(e)))),JSON.parse(JSON.stringify(r))},gn=e=>{let t=(Array.isArray(e)?e:[e]).filter(e=>e&&e.id!=null);if(!t.length)return[];let n=new Map;for(let e of t){let{id:t,...r}=e,i={};for(let[e,t]of Object.entries(r))t!==void 0&&(i[e]=t);n.set(t,{...n.get(t)||{},...i})}let r=[];return v.value=v.value.map(e=>{let t=n.get(e.id);if(!t)return e;let i={...e,...t};return r.push(i),i}),r.length?(y(),JSON.parse(JSON.stringify(r))):[]},_n=e=>{let t=(Array.isArray(e)?e:[e]).filter(e=>e&&e.id!=null);if(!t.length)return[];let n=new Set(E.value.map(e=>e.id)),r=new Map(w.value),i=[];for(let e of t){let{id:t,...a}=e;if(!n.has(t))continue;let o={};for(let[e,t]of Object.entries(a))t!==void 0&&(o[e]=t);let s={...r.get(t)||{},...o};r.set(t,s);let c=E.value.find(e=>e.id===t);i.push({...c,...s})}return i.length?(w.value=r,a(`edge-update`,JSON.parse(JSON.stringify(i))),JSON.parse(JSON.stringify(i))):[]},vn=e=>{let t=e&&typeof e==`object`?e:null;return C.value=[],T.value=new Set,w.value=new Map,t&&Array.isArray(t.nodes)?(v.value=JSON.parse(JSON.stringify(t.nodes)),y()):(v.value=(Array.isArray(i.nodes)?i.nodes:[]).map(e=>({...e})),Ut=v.value),I.value=[],L.value=[],a(`node-select`,null),a(`edge-select`,null),R(),an(),$t()};(0,t.watch)(()=>i.edges,e=>{zt();let t=Array.isArray(e)?e:[],n=new Set(t.map(e=>e.id));if(C.value.length){let e=C.value.filter(e=>!n.has(e.id));e.length!==C.value.length&&(C.value=e)}if(w.value.size){let e=new Map(w.value),n=new Set(C.value.map(e=>e.id)),r=!1;for(let[i,a]of e){let o=t.find(e=>e.id===i);o?Object.entries(a).every(([e,t])=>JSON.stringify(o[e]??null)===JSON.stringify(t??null))&&(e.delete(i),r=!0):n.has(i)||(e.delete(i),r=!0)}r&&(w.value=e)}},{deep:!0});let O=(0,t.computed)(()=>{let e={};E.value.forEach(t=>{let n=[t.from,t.to].sort().join(`__`);e[n]||(e[n]=[]),e[n].push(t)});let t={};return Object.entries(e).forEach(([e,n])=>{let r=n.length;r>Ot?n.forEach((n,i)=>{t[n.id]=i===0?{key:e,index:0,total:1,count:r,merged:!0,representative:!0,hidden:!1}:{key:e,index:i,total:r,count:r,merged:!0,representative:!1,hidden:!0}}):n.forEach((n,i)=>{t[n.id]={key:e,index:i,total:r,merged:!1,representative:!1,hidden:!1}})}),t}),yn=(0,t.computed)(()=>{let e=new Map;for(let t of v.value)e.set(t.id,t);return e}),k=e=>yn.value.get(e),A=e=>e.state!=`none`&&c[e.state]&&c[e.state].color||`#00f0ff`,bn=e=>c[e.state]||c.normal,xn=e=>e.nodeType===`text`,Sn=e=>e.nodeType===`border-only`,Cn=[`image`,`img`,`picture`],j=e=>{if(!e)return``;let t=e.image??e.src??e.img??e.imageUrl;return typeof t==`string`&&t.trim()?t.trim():``},wn=e=>e?Cn.includes(String(e.nodeType??``).toLowerCase())?!0:(i.config?.imageNodeBySource||!e.nodeType)&&!!j(e):!1,Tn=(0,t.computed)(()=>i.config?.imageFit===`cover`?`cover`:`contain`),En=(0,t.computed)(()=>Tn.value===`contain`?`xMidYMid meet`:`xMidYMid slice`),Dn=`-30 -30 ${m} ${m}`,On=new Map,kn=(0,t.ref)(0),An=e=>{if(!e||On.has(e)||typeof Image>`u`)return;On.set(e,null);let t=new Image;t.onload=()=>{On.set(e,{w:t.naturalWidth||1,h:t.naturalHeight||1}),kn.value++},t.onerror=()=>{On.set(e,{w:1,h:1}),kn.value++},t.src=e},M=e=>{kn.value;let t=j(e),n=t?On.get(t):null,{w:r,h:i}=N(e);if(!n)return{w:r,h:i};let a=n.w,o=n.h,s;if(Tn.value===`contain`)s=Math.min(m/a,m/o);else{let e=Math.max(r,i)/m;s=Math.max(r/e/a,i/e/o)}return{w:a*s,h:o*s}};(0,t.watchEffect)(()=>{for(let e of v.value)wn(e)&&An(j(e))});let jn=(e,t)=>{let n=Number(e);return Number.isFinite(n)&&n>0?n:t},Mn=e=>{let t=jn(e.width,m),n=jn(e.height,m);return{sx:t/m,sy:n/m}},Nn=e=>{let t=Math.max(e.width,e.height);return isNaN(t)?30:t/2},Pn=e=>{let{sx:t,sy:n}=Mn(e);return t===1&&n===1?``:`scale(${t}, ${n})`},Fn=e=>{let{w:t,h:n}=N(e),r=Math.min(10,t*.3),i=Math.min(10,n*.3);return`translate(${t/2-r}, ${-(n/2-i)})`},In=(0,t.computed)(()=>{let e=Number(i.config.labelGap);return Number.isFinite(e)&&e>=0?e:18}),Ln=e=>{if(xn(e))return 4;let{h:t}=N(e);return e.labelPosition===`top`?-(t/2+In.value):e.labelPosition===`center`?0:t/2+In.value},Rn=e=>{let t=P(e);if(xn(e)||!e.label)return t;let n=Bt(e),r=Ln(e);if(e.labelPosition===`top`){let e=r-n-4;e<t.y&&(t.height+=t.y-e,t.y=e)}else if(e.labelPosition!==`center`){let i=r+(String(e.label).split(`
|
|
2
2
|
`).length-1)*1.2*n+n+4;i>t.y+t.height&&(t.height=i-t.y)}return t},zn=e=>e.borderStyle!==`none`&&(e.borderColor!==void 0||e.borderWidth!==void 0||e.borderStyle!==void 0),N=e=>{let t=xn(e),n=Sn(e);return{w:jn(e.width,t?Math.max(60,String(e.label).length*7+16):n?Math.max(80,String(e.label).length*8+24):m),h:jn(e.height,t?26:n?40:m)}},P=e=>{let{w:t,h:n}=N(e);return{x:-t/2,y:-n/2,width:t,height:n}},F=e=>zn(e)?P(e):null,Bn=e=>e.background&&e.background!==`none`?e.background:null,I=(0,t.ref)([]),L=(0,t.ref)([]);(0,t.computed)(()=>I.value.length===1?I.value[0]:null),(0,t.computed)(()=>L.value.length===1?L.value[0]:null);let Vn=e=>I.value.includes(e.id),Hn=e=>L.value.includes(e.id),R=()=>{a(`selection-change`,{nodes:v.value.filter(e=>I.value.includes(e.id)),edges:E.value.filter(e=>L.value.includes(e.id))})},Un=e=>typeof e==`number`?Number.isFinite(e)&&e>=0?Math.floor(e):1/0:typeof e==`string`&&/^\d+$/.test(e.trim())?parseInt(e.trim(),10):1/0,Wn=(0,t.computed)(()=>Un(i.config.maxSelectNodes)),Gn=(0,t.computed)(()=>Un(i.config.maxSelectEdges)),z=(e,t,n)=>{let r=new Set(e),i=[];for(let e of t)r.has(e)||(r.add(e),i.push(e));if(n===1/0)return[...e,...i];let a=Math.max(0,n-e.length);return[...e,...i.slice(0,a)]};(0,t.watch)([Wn,Gn],([e,t])=>{let n=!1;I.value.length>e&&(I.value=I.value.slice(0,e),n=!0),L.value.length>t&&(L.value=L.value.slice(0,t),n=!0),n&&R()});let Kn=(0,t.computed)(()=>i.config.selectedBorderColor||`#fbbf24`),qn=(0,t.computed)(()=>i.config?.edgeLayer!==`below`),Jn=(0,t.computed)(()=>i.config?.highlightEdgeOnTop!==!1),Yn=(0,t.computed)(()=>i.config?.edgeCasingColor||`#0a0e1a`),Xn=(e,t)=>{if(!or()){if(t&&(t.ctrlKey||t.metaKey)){let t=I.value.indexOf(e.id);t>=0?I.value.splice(t,1):I.value=z(I.value,[e.id],Wn.value)}else{let t=I.value.length===1&&I.value[0]===e.id;I.value=t?[]:z([],[e.id],Wn.value),L.value=[]}a(`node-click`,e),a(`node-select`,Vn(e)?e:null),R()}},Zn=e=>{let t=v.value.find(t=>t.id===e);if(!t||i.config.enableZOrder===!1)return!1;let n=t.zIndex??0,r=v.value.filter(e=>(e.zIndex??0)>n);return r.length!==0&&(t.zIndex=Math.min(...r.map(e=>e.zIndex??0)),!0)},Qn=e=>{let t=v.value.find(t=>t.id===e);if(!t||i.config.enableZOrder===!1)return!1;let n=t.zIndex??0,r=v.value.filter(e=>(e.zIndex??0)<n);return r.length!==0&&(t.zIndex=Math.max(...r.map(e=>e.zIndex??0)),!0)},$n=e=>{let t=v.value.find(t=>t.id===e);return!t||i.config.enableZOrder===!1?!1:(t.zIndex=Math.max(...v.value.map(e=>e.zIndex??0),0)+1,!0)},er=e=>{let t=v.value.find(t=>t.id===e);return!t||i.config.enableZOrder===!1?!1:(t.zIndex=Math.min(...v.value.map(e=>e.zIndex??0),0)-1,!0)},tr=()=>{if(!S.value)return;let e=S.value.cloneNode(!0);e.querySelectorAll(`animate, animateMotion, animateTransform, set`).forEach(e=>e.remove()),e.querySelectorAll(`.center-crosshair`).forEach(e=>e.remove()),e.setAttribute(`width`,B.value||`800`),e.setAttribute(`height`,V.value||`600`);let t=new XMLSerializer().serializeToString(e);t=`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
3
|
`+t;let n=new Blob([t],{type:`image/svg+xml;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`topology-${new Date().toISOString().slice(0,10)}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},nr=(0,t.computed)(()=>i.config.selectedLineColor||`#fbbf24`),rr=(e,t)=>{if(or())return;let n=O.value[e.id],r=!!(n&&n.merged&&n.representative),i=r?E.value.filter(e=>{let t=O.value[e.id];return t&&t.key===n.key}):null,o=r?i.map(e=>e.id):[e.id],s=r?{...e,bundleEdges:i}:e;if(t&&(t.ctrlKey||t.metaKey))o.every(e=>L.value.includes(e))?L.value=L.value.filter(e=>!o.includes(e)):L.value=z(L.value,o,Gn.value);else{let e=o.length===L.value.length&&o.every(e=>L.value.includes(e));L.value=e?[]:z([],o,Gn.value),I.value=[]}a(`edge-select`,Hn(e)?s:null),R()},ir=0,ar=(e=200)=>{ir=performance.now()+e},or=()=>performance.now()<ir,sr=()=>{I.value=[],L.value=[],a(`node-select`,null),a(`edge-select`,null),R()},cr=e=>{if(or())return;let t=e.target;t&&t.closest&&(t.closest(`.topology-node`)||t.closest(`.node-resize-layer`)||t.closest(`.node-handles`))||sr()},lr=(0,t.ref)({width:1e3,height:650}),ur=(0,t.ref)(1),dr=(0,t.ref)(0),fr=(0,t.ref)(0),pr=(0,t.computed)(()=>-hr.value/2+dr.value),mr=(0,t.computed)(()=>-gr.value/2+fr.value),hr=(0,t.computed)(()=>i.width??lr.value.width),gr=(0,t.computed)(()=>i.height??lr.value.height),_r=null;(0,t.onMounted)(()=>{let e=S.value;if(e){let t=e.getBoundingClientRect();t.width>0&&t.height>0&&(lr.value={width:t.width,height:t.height})}e&&typeof ResizeObserver<`u`&&(_r=new ResizeObserver(()=>{let t=e.getBoundingClientRect();t.width>0&&t.height>0&&(lr.value={width:t.width,height:t.height})}),_r.observe(e))}),(0,t.onBeforeUnmount)(()=>{_r&&=(_r.disconnect(),null),q&&=(cancelAnimationFrame(q),0),G&&=(cancelAnimationFrame(G),0),Z&&=(cancelAnimationFrame(Z),0),Di(),Ir()});let B=(0,t.computed)(()=>hr.value/ur.value),V=(0,t.computed)(()=>gr.value/ur.value),vr=(0,t.computed)(()=>({x0:pr.value-Nt,y0:mr.value-Nt,x1:pr.value+B.value+Nt,y1:mr.value+V.value+Nt})),yr=(0,t.computed)(()=>{let e=vr.value,t=v.value.filter(t=>{let{w:n,h:r}=N(t);return t.x+n/2>=e.x0&&t.x-n/2<=e.x1&&t.y+r/2>=e.y0&&t.y-r/2<=e.y1});return i.config.enableZOrder!==!1&&t.sort((e,t)=>(e.zIndex??0)-(t.zIndex??0)),t}),H=(0,t.computed)(()=>{let e=vr.value;return E.value.filter(t=>{if(!Ui(t))return!1;let n=k(t.from),r=k(t.to);if(!n||!r)return!1;let i=N(n).w/2,a=N(n).h/2,o=N(r).w/2,s=N(r).h/2;return Math.min(n.x-i,r.x-o)-Pt<=e.x1&&Math.max(n.x+i,r.x+o)+Pt>=e.x0&&Math.min(n.y-a,r.y-s)-Pt<=e.y1&&Math.max(n.y+a,r.y+s)+Pt>=e.y0})}),br=e=>{if(i.config.enableZoom===!1)return;e.preventDefault();let t=S.value.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,a=n/t.width,o=r/t.height,s=B.value,c=V.value,l=e.deltaY>0?.9:1.1,u=Math.min(Mt,Math.max(jt,ur.value*l)),d=hr.value/u,f=gr.value/u;dr.value+=(s-d)*a,fr.value+=(c-f)*o,ur.value=u},U=(0,t.ref)(null),W=(0,t.ref)(null),xr=e=>{let t=S.value,n=t?t.getBoundingClientRect():null;U.value={startX:e.clientX,startY:e.clientY,lastX:e.clientX,lastY:e.clientY,moved:!1,rectWidth:n&&n.width?n.width:0,rectHeight:n&&n.height?n.height:0},Fr()},Sr=e=>{let t=U.value,n=S.value;if(!t||!n)return;let r=t.rectWidth,i=t.rectHeight;if(!r||!i)return;if(!t.moved){if(Math.hypot(e.clientX-t.startX,e.clientY-t.startY)<4)return;t.moved=!0,t.lastX=e.clientX,t.lastY=e.clientY;return}let a=e.clientX-t.lastX,o=e.clientY-t.lastY;t.lastX=e.clientX,t.lastY=e.clientY,dr.value-=a*(B.value/r),fr.value-=o*(V.value/i)},Cr=()=>{let e=U.value;U.value=null,e&&e.moved&&ar(),Lr()},wr=e=>{let t=X(e);W.value={start:{x:t.x,y:t.y},current:{x:t.x,y:t.y},startClientX:e.clientX,startClientY:e.clientY,moved:!1},Fr()},Tr=e=>{let t=W.value;if(!t)return;let n=X(e);t.current={x:n.x,y:n.y},!t.moved&&Math.hypot(e.clientX-t.startClientX,e.clientY-t.startClientY)>3&&(t.moved=!0)},Er=(0,t.computed)(()=>{let e=W.value;return e?{x:Math.min(e.start.x,e.current.x),y:Math.min(e.start.y,e.current.y),width:Math.abs(e.current.x-e.start.x),height:Math.abs(e.current.y-e.start.y)}:{x:0,y:0,width:0,height:0}}),Dr=()=>{let e=W.value;if(W.value=null,e&&e.moved){let t={x:Math.min(e.start.x,e.current.x),y:Math.min(e.start.y,e.current.y),w:Math.abs(e.current.x-e.start.x),h:Math.abs(e.current.y-e.start.y)},n=v.value.filter(e=>{let n=P(e),r=e.x+n.x,i=e.y+n.y;return!(r+n.width<t.x||r>t.x+t.w||i+n.height<t.y||i>t.y+t.h)});n.length&&(I.value=z(I.value,n.map(e=>e.id),Wn.value),R()),ar()}Lr()},Or=e=>!e||typeof e.closest!=`function`?!1:!!(e.closest(`.topology-node`)||e.closest(`.node-handles`)||e.closest(`.node-resize-layer`)),kr=e=>{if(S.value){if(e.button===1){if(i.config.enablePan===!1)return;e.preventDefault(),xr(e);return}if(e.button===0&&!Or(e.target)){if(e.ctrlKey||e.metaKey){if(i.config.enableMarquee===!1)return;e.preventDefault(),wr(e);return}i.config.enablePan!==!1&&(e.preventDefault(),xr(e))}}},Ar=!1,G=0,jr=null,Mr=()=>{G=0;let e=jr;jr=null,e&&(U.value?Sr(e):W.value&&Tr(e))},Nr=e=>{jr=e,G||=requestAnimationFrame(Mr)},Pr=()=>{G&&(cancelAnimationFrame(G),Mr()),U.value&&Cr(),W.value&&Dr()},Fr=()=>{Ar||(Ar=!0,window.addEventListener(`mousemove`,Nr,!0),window.addEventListener(`mouseup`,Pr,!0))},Ir=()=>{Ar&&(Ar=!1,window.removeEventListener(`mousemove`,Nr,!0),window.removeEventListener(`mouseup`,Pr,!0))},Lr=()=>{!U.value&&!W.value&&Ir()},Rr=(0,t.computed)(()=>{if(J.value&&J.value.side)return{cursor:di(J.value.side)};if(W.value)return{cursor:`crosshair`};if(U.value&&U.value.moved)return{cursor:`grabbing`}}),zr=(0,t.computed)(()=>i.config.showGrid!==!1),Br=(0,t.computed)(()=>i.config.gridColor||`#1a2240`),Vr=(0,t.computed)(()=>{let e=Number(i.config.gridStep);return(Number.isFinite(e)&&e>0?e:40)/ur.value}),Hr=(0,t.computed)(()=>{let e=Number(i.config.gridOpacity);return Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5}),Ur=(0,t.computed)(()=>{let e=i.config.radialGradient&&typeof i.config.radialGradient==`object`?i.config.radialGradient:{},t=Array.isArray(e.stops)&&e.stops.length?e.stops.filter(e=>e&&e.color).map((e,t)=>({offset:e.offset==null?t===0?`0%`:`100%`:e.offset,color:e.color,opacity:e.opacity})):null,n=t&&t.length?t:[{offset:`0%`,color:e.startColor||`#0f1729`,opacity:e.startOpacity},{offset:`100%`,color:e.endColor||`#060a14`,opacity:e.endOpacity}];return{cx:e.cx||`50%`,cy:e.cy||`50%`,r:e.r||`60%`,stops:n}}),Wr=(0,t.computed)(()=>i.config.showCenterPoint===!0),Gr=(0,t.computed)(()=>i.config.showEdgeTextBg===!0),Kr=(0,t.computed)(()=>i.config.edgeTextBgColor||`#0a0e1a`),qr=(0,t.computed)(()=>i.config.showNodeHandles===!0),Jr=(0,t.computed)(()=>i.config.showStatusDot!==!1),Yr=(e,t)=>{let n=Number(e);return Number.isFinite(n)&&n>=0?n:t},Xr=(0,t.computed)(()=>{let e=i.config.motionFx??i.config.fx;return typeof e==`boolean`?e?`all`:`none`:[`none`,`flow`,`particle`,`all`].includes(e)?e:E.value.length<=Yr(i.config.fxMotionMaxEdges,200)?`all`:`none`}),Zr=(0,t.computed)(()=>{let e=i.config.glowFx??i.config.fx;return typeof e==`boolean`?e:E.value.length<=Yr(i.config.fxGlowMaxEdges,500)}),Qr=(0,t.computed)(()=>{let e=i.config.breatheFx??i.config.fx;return typeof e==`boolean`?e:v.value.length<=Yr(i.config.fxBreatheMaxNodes,300)}),$r=e=>{if(e.animatedMode!==void 0){let t=e.animatedMode;return!t||t===`all`?Xr.value:t===`none`?`none`:t}return e.animated===void 0||e.animated?Xr.value:`none`},ei=e=>e.borderColor||A(e)||`#94a3b8`,ti=e=>e.borderWidth||0,ni=e=>e.borderStyle===`dashed`?`8 5`:void 0,K=e=>{let t=e.borderRadius;if(t==null||t===``)return 6;let n=Number(t);return Number.isFinite(n)&&n>=0?n:6},ri=(e,t)=>{if(e.button!==0||!i.editable||i.config.nodeDraggable===!1)return;e.stopPropagation();let n=k(t),r=X(e);if(Gt.value={x:r.x-n.x,y:r.y-n.y},qt={x:e.clientX,y:e.clientY},Jt=!1,Yt=!!(e.ctrlKey||e.metaKey),I.value.length>1&&I.value.includes(t)){let e={};I.value.forEach(t=>{let n=k(t);n&&(e[t]={x:n.x,y:n.y})}),Kt.value={origins:e,start:{x:r.x,y:r.y}}}else Kt.value=null;x.value=t,a(`node-drag-start`,n)},q=0,ii=null,ai=()=>{q=0;let e=ii;ii=null,e&&si(e)},oi=e=>{(J.value||x.value)&&(ii={clientX:e.clientX,clientY:e.clientY},q||=requestAnimationFrame(ai))},si=e=>{if(J.value){pi(e);return}if(!x.value)return;let t=X(e);!Jt&&qt&&Math.hypot(e.clientX-qt.x,e.clientY-qt.y)>At&&(Jt=!0,!Yt&&!I.value.includes(x.value)&&(I.value=z([],[x.value],Wn.value),L.value=[],a(`node-select`,I.value.includes(x.value)?k(x.value):null),R()));let n=Kt.value;if(n){let e=t.x-n.start.x,r=t.y-n.start.y;v.value=v.value.map(t=>n.origins[t.id]?{...t,x:n.origins[t.id].x+e,y:n.origins[t.id].y+r}:t)}else v.value=v.value.map(e=>e.id===x.value?{...e,x:t.x-Gt.value.x,y:t.y-Gt.value.y}:e);y()},ci=()=>{if(q&&(cancelAnimationFrame(q),ai()),J.value){mi();return}x.value&&(Jt&&ar(),x.value=null,Kt.value=null,qt=null,Jt=!1,a(`node-drag-end`))},J=(0,t.ref)(null),li=(e,t,n)=>Math.min(n,Math.max(t,e)),ui=e=>{let t=P(e),n=t.x,r=t.y,i=t.x+t.width,a=t.y+t.height;return[{side:`nw`,x:n,y:r},{side:`n`,x:0,y:r},{side:`ne`,x:i,y:r},{side:`e`,x:i,y:0},{side:`se`,x:i,y:a},{side:`s`,x:0,y:a},{side:`sw`,x:n,y:a},{side:`w`,x:n,y:0}]},di=e=>e===`nw`||e===`se`?`nwse-resize`:e===`ne`||e===`sw`?`nesw-resize`:e===`n`||e===`s`?`ns-resize`:`ew-resize`,fi=(e,t,n)=>{if(!i.editable||i.config.nodeResizable===!1||!t)return;let{w:r,h:o}=N(t);J.value={id:t.id,side:n,anchorX:n.includes(`e`)?t.x-r/2:n.includes(`w`)?t.x+r/2:null,anchorY:n.includes(`s`)?t.y-o/2:n.includes(`n`)?t.y+o/2:null,startW:r,startH:o},a(`node-resize-start`,t)},pi=e=>{let t=J.value;if(!t)return;let n=k(t.id);if(!n)return;let r=X(e),i=t.startW,a=t.startH,o=n.x,s=n.y;if(t.anchorX!==null){let e=t.side.includes(`e`);i=li(e?r.x-t.anchorX:t.anchorX-r.x,Ft,It),o=e?t.anchorX+i/2:t.anchorX-i/2}if(t.anchorY!==null){let e=t.side.includes(`s`);a=li(e?r.y-t.anchorY:t.anchorY-r.y,Lt,Rt),s=e?t.anchorY+a/2:t.anchorY-a/2}v.value=v.value.map(e=>e.id===t.id?{...e,x:o,y:s,width:i,height:a}:e),y()},mi=()=>{let e=J.value;J.value=null,e&&(ar(),a(`node-resize-end`,k(e.id)||null))},hi=(0,t.computed)(()=>i.editable&&i.config.nodeResizable!==!1),gi=(0,t.computed)(()=>{if(!hi.value)return null;let e=I.value;return e.length===1&&k(e[0])||null}),Y=(0,t.ref)(null),_i=e=>{let t=P(e);return[{side:`top`,x:0,y:t.y},{side:`bottom`,x:0,y:t.y+t.height},{side:`left`,x:t.x,y:0},{side:`right`,x:t.x+t.width,y:0}]},vi=(e,t)=>{let n=S.value;if(!n)return null;let r=e,i=t;if(e&&typeof e==`object`&&(r=e.clientX,i=e.clientY),r==null||i==null)return null;let a=n.createSVGPoint();a.x=r,a.y=i;let o=n.getScreenCTM();if(!o)return null;let s=a.matrixTransform(o.inverse());return{x:s.x,y:s.y}},yi=(e,t)=>{let n=S.value;if(!n)return null;let r=n.createSVGPoint();r.x=Number(e)||0,r.y=Number(t)||0;let i=n.getScreenCTM();if(!i)return null;let a=r.matrixTransform(i);return{x:a.x,y:a.y}},X=e=>vi(e)??{x:0,y:0},bi=(e,t,n)=>{let r=k(t);if(!r||!S.value)return;let i=X(e);Y.value={fromId:t,side:n.side,ax:r.x+n.x,ay:r.y+n.y,px:i.x,py:i.y,overId:null};try{e.target.setPointerCapture?.(e.pointerId)}catch{}Ei()},Z=0,xi=null,Si=()=>{Z=0;let e=xi;xi=null,e&&Y.value&&ki(e)},Ci=e=>{Y.value&&(xi={clientX:e.clientX,clientY:e.clientY},Z||=requestAnimationFrame(Si))},wi=()=>{Z&&(cancelAnimationFrame(Z),Si()),Y.value&&Ai()},Ti=!1,Ei=()=>{Ti||(Ti=!0,window.addEventListener(`mousemove`,Ci,!0),window.addEventListener(`mouseup`,wi,!0))},Di=()=>{Ti&&(Ti=!1,window.removeEventListener(`mousemove`,Ci,!0),window.removeEventListener(`mouseup`,wi,!0))},Oi=(e,t,n)=>{let r=v.value;for(let i=r.length-1;i>=0;i--){let a=r[i];if(a.id===n)continue;let o=P(a);if(e>=a.x+o.x-2&&e<=a.x+o.x+o.width+2&&t>=a.y+o.y-2&&t<=a.y+o.y+o.height+2)return a}return null},ki=e=>{let t=Y.value;if(!t)return;let n=X(e);t.px=n.x,t.py=n.y;let r=Oi(n.x,n.y,t.fromId);t.overId=r?r.id:null},Ai=()=>{Di();let e=Y.value;if(Y.value=null,!e||!e.overId||e.overId===e.fromId)return;let t={id:`${o()}`,from:e.fromId,to:e.overId,speed:1,fromAnchor:`edge`,toAnchor:`edge`};C.value.push(t),a(`edge-create`,t)},ji=(e,t,n)=>{let r=e.x,i=e.y,a=t.x-r,o=t.y-i,{w:s,h:c}=N(e);if(!n||n===`center`||a===0&&o===0)return{x:r,y:i};let l=s/2,u=c/2,d=Math.abs(a),f=Math.abs(o),p=1;return d>.001&&(p=Math.min(p,l/d)),f>.001&&(p=Math.min(p,u/f)),{x:r+a*p,y:i+o*p}},Mi=(0,t.computed)(()=>{let e=new Map;E.value.forEach(t=>{let n=O.value[t.id];n&&!n.hidden&&(e.has(n.key)||e.set(n.key,[]),e.get(n.key).push(t))});let t={};return e.forEach((e,n)=>{let[r,i]=n.split(`__`),a=k(r),o=k(i);if(!a||!o)return;let s=o.x-a.x,c=o.y-a.y,l=Math.sqrt(s*s+c*c)||1,u=s/l,d=c/l,f=-d,p=u,ee=e.length,te=kt;if(ee>1){let e=(ee-1)/2*kt,t=e=>{let{w:t,h:n}=N(e);return Math.max(4,(Math.abs(f)*t+Math.abs(p)*n)/2-6)},n=Math.min(1,t(a)/e,t(o)/e);te=kt*Math.max(.35,n)}let ne={};e.forEach((e,t)=>{ne[e.id]=ee>1?t-(ee-1)/2:0}),t[n]={key:n,nx:f,ny:p,dist:l,gap:te,slots:ne,dominant:Math.abs(u)>=Math.abs(d)?`h`:`v`,bulge:Math.min(l*.15,50)}}),t}),Ni=e=>{let t=O.value[e.id],n=t&&Mi.value[t.key];if(!n)return null;let r=k(e.from),i=k(e.to);if(!r||!i)return null;let a=n.slots[e.id]||0,o=a*n.gap,s=ji(r,i,e.fromAnchor),c=ji(i,r,e.toAnchor);return{frame:n,slot:a,from:{x:s.x+n.nx*o,y:s.y+n.ny*o},to:{x:c.x+n.nx*o,y:c.y+n.ny*o}}},Pi=e=>{let t=Ni(e);if(!t)return``;let{from:n,to:r,frame:i,slot:a}=t,o=a*i.gap;if(b.value===`straight`)return`M ${n.x} ${n.y} L ${r.x} ${r.y}`;if(b.value===`polyline`){if(i.dominant===`v`){let e=(n.y+r.y)/2+o;return`M ${n.x} ${n.y} L ${n.x} ${e} L ${r.x} ${e} L ${r.x} ${r.y}`}let e=(n.x+r.x)/2+o;return`M ${n.x} ${n.y} L ${e} ${n.y} L ${e} ${r.y} L ${r.x} ${r.y}`}let s=(n.x+r.x)/2+i.nx*i.bulge,c=(n.y+r.y)/2+i.ny*i.bulge;return`M ${n.x} ${n.y} Q ${s} ${c} ${r.x} ${r.y}`},Fi=(e,t)=>{let n=Ni(e);if(!n)return{x:0,y:0};let{from:r,to:i,frame:a,slot:o}=n,s=o*a.gap;if(b.value===`straight`)return{x:r.x+(i.x-r.x)*t,y:r.y+(i.y-r.y)*t};if(b.value===`polyline`){if(a.dominant===`v`){let e=(r.y+i.y)/2+s,n=Math.abs(e-r.y),a=Math.abs(i.x-r.x),o=Math.abs(i.y-e),c=t*(n+a+o||1);return c<=n?{x:r.x,y:r.y+Math.sign(e-r.y||1)*c}:c<=n+a?{x:r.x+Math.sign(i.x-r.x||1)*(c-n),y:e}:{x:i.x,y:e+Math.sign(i.y-e||1)*(c-n-a)}}let e=(r.x+i.x)/2+s,n=Math.abs(e-r.x),o=Math.abs(i.y-r.y),c=Math.abs(i.x-e),l=t*(n+o+c||1);return l<=n?{x:r.x+Math.sign(e-r.x||1)*l,y:r.y}:l<=n+o?{x:e,y:r.y+Math.sign(i.y-r.y||1)*(l-n)}:{x:e+Math.sign(i.x-e||1)*(l-n-o),y:i.y}}let c=(r.x+i.x)/2+a.nx*a.bulge,l=(r.y+i.y)/2+a.ny*a.bulge;return{x:(1-t)*(1-t)*r.x+2*(1-t)*t*c+t*t*i.x,y:(1-t)*(1-t)*r.y+2*(1-t)*t*l+t*t*i.y}},Ii=(0,t.computed)(()=>Y.value?k(Y.value.fromId):null),Li=(0,t.computed)(()=>Y.value&&Y.value.overId?k(Y.value.overId):null),Ri=(0,t.computed)(()=>Ii.value?A(Ii.value):`#00f0ff`),zi=(0,t.computed)(()=>{let e=Y.value;if(!e)return{x:0,y:0};let t=Li.value;return t&&Ii.value?ji(t,Ii.value,`edge`):{x:e.px,y:e.py}}),Bi=(0,t.computed)(()=>{let e=Li.value;if(!e)return null;let t=P(e);return{x:e.x+t.x-4,y:e.y+t.y-4,w:t.width+8,h:t.height+8}}),Vi=e=>{let t=e.nodeIds.map(e=>k(e)).filter(Boolean);if(t.length===0)return null;let n=e.padding,r=Math.min(...t.map(e=>e.x))-n,i=Math.min(...t.map(e=>e.y))-n,a=Math.max(...t.map(e=>e.x))+n,o=Math.max(...t.map(e=>e.y))+n;return{x:r,y:i,width:a-r,height:o-i}},Hi=(0,t.computed)(()=>i.groups.map(e=>({...e,rect:Vi(e)})).filter(e=>e.rect)),Q=e=>Hn(e)?nr.value:(k(e.from),e.centerText&&e.centerText.color||`#00f0ff`),Ui=e=>{let t=O.value[e.id];return!!t&&!t.hidden},Wi=(0,t.computed)(()=>[...new Set(E.value.map(Q))].map(e=>({key:String(e).replace(`#`,``),color:e}))),Gi=e=>{let t=e.endMarker;if(!t||t===`none`)return``;let n=Q(e)||`#00f0ff`,r=String(n).replace(`#`,``);return`url(#${t===`dot`?`edge-dot`:`edge-arrow`}-${r})`},Ki=new Map,qi={nodes:null,edges:null,mode:null,epoch:-1},Ji=()=>{let e=qi;(e.nodes!==v.value||e.edges!==E.value||e.mode!==b.value||e.epoch!==s)&&(qi={nodes:v.value,edges:E.value,mode:b.value,epoch:s},Ki=new Map)},$=e=>{Ji();let t=Ki.get(e.id);return t===void 0&&(t=Pi(e),Ki.set(e.id,t)),t},Yi=(e,t=1)=>`${2/e.speed*t}s`,Xi=e=>`${3/e.speed}s`,Zi=e=>{let t=$r(e);return t===`flow`||t===`all`},Qi=e=>{let t=$r(e);return t===`particle`||t===`all`},$i=e=>h(e).text,ea=e=>!!e&&String(h(e).text??``).trim()!==``,ta=(e,t)=>{if(!e)return null;let n=h(e),r=Number(t.fontSize)||Number(n.fontSize)||8,i=String(n.text??``),a=0;for(let e of i)a+=e.charCodeAt(0)>11904?1:.62;return{w:Math.max(14,a*r+8),h:Math.max(12,r+6)}},na=(e,t)=>{let n=Fi(e,Math.max(0,t-.005)),r=Fi(e,Math.min(1,t+.005));return Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI},ra=e=>{let t=e%180;return t>90&&(t-=180),t<-90&&(t+=180),t},ia=(e,t,n)=>`translate(${t.x}, ${t.y}) rotate(${(h(e).rotation||0)+(n||0)})`,aa=(0,t.computed)(()=>{let e=[];for(let t of H.value){let n=O.value[t.id];if(!n)continue;let r=n.merged&&n.representative,i=!n.merged&&(t.fromText||t.centerText||t.toText);if(!r&&!i)continue;let a=k(t.from),o=k(t.to);a&&o&&e.push({id:t.id,edge:t,info:n,color:a&&l[a.nodeType]||`#00f0ff`,start:Fi(t,.28),center:Fi(t,.5),end:Fi(t,.72),startAngle:ra(na(t,.28)),centerAngle:ra(na(t,.5)),endAngle:ra(na(t,.72)),fromBox:ta(t.fromText,t),centerBox:ta(t.centerText,t),toBox:ta(t.toText,t)})}return e});return n({resetDataBaseline:an,getData:on,setData:vn,removeSelected:cn,addNodes:mn,addEdges:hn,updateNodes:gn,updateEdges:_n,clientToSvg:vi,svgToClient:yi,moveLayerUp:Zn,moveLayerDown:Qn,moveToFront:$n,moveToBack:er,downloadSVG:tr}),(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,{ref_key:`svgRef`,ref:S,class:`topology-svg`,style:(0,t.normalizeStyle)(Rr.value),viewBox:`${pr.value} ${mr.value} ${B.value} ${V.value}`,onMousedown:kr,onMousemove:oi,onMouseup:ci,onMouseleave:ci,onClick:cr,onWheel:(0,t.withModifiers)(br,[`prevent`])},[(0,t.createElementVNode)(`defs`,null,[r[3]||=(0,t.createStaticVNode)(`<linearGradient id="glassHighlight" x1="0%" y1="0%" x2="60%" y2="100%"><stop offset="0%" stop-color="rgba(255,255,255,0.9)"></stop><stop offset="30%" stop-color="rgba(255,255,255,0.25)"></stop><stop offset="100%" stop-color="rgba(255,255,255,0)"></stop></linearGradient><filter id="glow-core" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur in="SourceGraphic" stdDeviation="3" result="blur"></feGaussianBlur><feMerge><feMergeNode in="blur"></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter><filter id="glow-strong" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur in="SourceGraphic" stdDeviation="6" result="blur"></feGaussianBlur><feMerge><feMergeNode in="blur"></feMergeNode><feMergeNode in="blur"></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter>`,3),(0,t.createElementVNode)(`radialGradient`,{id:`bg-grid`,cx:Ur.value.cx,cy:Ur.value.cy,r:Ur.value.r},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Ur.value.stops,(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`stop`,{key:`bg-stop-${n}`,offset:e.offset,"stop-color":e.color,"stop-opacity":e.opacity},null,8,f))),128))],8,d),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(c),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`radialGradient`,{key:`breath-${n}`,id:`breath-grad-${n}`},[(0,t.createElementVNode)(`stop`,{offset:`0%`,"stop-color":e.color,"stop-opacity":`1`},null,8,ee),(0,t.createElementVNode)(`stop`,{offset:`40%`,"stop-color":e.color,"stop-opacity":`0.5`},null,8,te),(0,t.createElementVNode)(`stop`,{offset:`100%`,"stop-color":e.color,"stop-opacity":`0`},null,8,ne)],8,p))),128)),r[4]||=(0,t.createStaticVNode)(`<linearGradient id="flow-grad-1" gradientUnits="userSpaceOnUse"><stop offset="0%" stop-color="#00f0ff" stop-opacity="0"></stop><stop offset="40%" stop-color="#00f0ff" stop-opacity="1"></stop><stop offset="60%" stop-color="#00f0ff" stop-opacity="1"></stop><stop offset="100%" stop-color="#00f0ff" stop-opacity="0"></stop></linearGradient>`,1),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Wi.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`marker`,{key:`m-arrow-${e.key}`,id:`edge-arrow-${e.key}`,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`10`,markerHeight:`10`,orient:`auto`,markerUnits:`userSpaceOnUse`},[(0,t.createElementVNode)(`path`,{d:`M1,2.5 L9,5 L1,7.5 Z`,fill:e.color},null,8,ie)],8,re))),128)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Wi.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`marker`,{key:`m-dot-${e.key}`,id:`edge-dot-${e.key}`,viewBox:`0 0 10 10`,refX:`5`,refY:`5`,markerWidth:`10`,markerHeight:`10`,orient:`auto`,markerUnits:`userSpaceOnUse`},[(0,t.createElementVNode)(`circle`,{cx:`5`,cy:`5`,r:`4`,fill:e.color},null,8,oe)],8,ae))),128))]),(0,t.createElementVNode)(`rect`,{width:B.value,height:V.value,x:pr.value,y:mr.value,fill:`url(#bg-grid)`},null,8,se),zr.value?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createElementVNode)(`pattern`,{id:`grid`,width:Vr.value,height:Vr.value,patternUnits:`userSpaceOnUse`},[(0,t.createElementVNode)(`path`,{d:`M ${Vr.value} 0 L 0 0 0 ${Vr.value}`,fill:`none`,stroke:Br.value,"stroke-width":`0.5`},null,8,le)],8,ce),(0,t.createElementVNode)(`rect`,{width:B.value,height:V.value,x:pr.value,y:mr.value,fill:`url(#grid)`,opacity:Hr.value},null,8,ue)],64)):(0,t.createCommentVNode)(``,!0),Wr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,de,[...r[5]||=[(0,t.createElementVNode)(`line`,{x1:`-22`,y1:`0`,x2:`22`,y2:`0`,stroke:`#3b82f6`,"stroke-width":`1`,opacity:`0.6`},null,-1),(0,t.createElementVNode)(`line`,{x1:`0`,y1:`-22`,x2:`0`,y2:`22`,stroke:`#3b82f6`,"stroke-width":`1`,opacity:`0.6`},null,-1),(0,t.createElementVNode)(`circle`,{r:`3`,fill:`none`,stroke:`#3b82f6`,"stroke-width":`1`,opacity:`0.6`},null,-1),(0,t.createElementVNode)(`circle`,{r:`1`,fill:`#3b82f6`,opacity:`0.8`},null,-1)]])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Hi.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:e.id},[(0,t.createElementVNode)(`rect`,{x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height,rx:`16`,fill:e.color,opacity:`0.03`},null,8,fe),(0,t.createElementVNode)(`rect`,{x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height,rx:`16`,fill:`none`,stroke:e.color,"stroke-width":`1.5`,"stroke-dasharray":`8 5`,opacity:`0.35`},null,8,pe),(0,t.createElementVNode)(`circle`,{cx:e.rect.x+4,cy:e.rect.y+4,r:`3`,fill:e.color,opacity:`0.5`},null,8,me),(0,t.createElementVNode)(`circle`,{cx:e.rect.x+e.rect.width-4,cy:e.rect.y+4,r:`3`,fill:e.color,opacity:`0.5`},null,8,he),(0,t.createElementVNode)(`circle`,{cx:e.rect.x+4,cy:e.rect.y+e.rect.height-4,r:`3`,fill:e.color,opacity:`0.5`},null,8,ge),(0,t.createElementVNode)(`circle`,{cx:e.rect.x+e.rect.width-4,cy:e.rect.y+e.rect.height-4,r:`3`,fill:e.color,opacity:`0.5`},null,8,_e),(0,t.createElementVNode)(`text`,{x:e.rect.x+14,y:e.rect.y+20,transform:`rotate(${e.rotation||0} ${e.rect.x+14} ${e.rect.y+20})`,fill:e.color,"font-size":`12`,"font-family":`'SF Mono', 'Cascadia Code', 'Consolas', monospace`,"font-weight":`600`,opacity:`0.7`,"letter-spacing":`0.5`},(0,t.toDisplayString)(e.label),9,ve)]))),128)),qn.value?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,ye,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(yr.value,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:`node-base-${n.id}`,transform:`translate(${n.x}, ${n.y})`},[Bn(n)&&e.viewMode!==`3d`?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:0,x:P(n).x,y:P(n).y,width:P(n).width,height:P(n).height,rx:K(n),fill:Bn(n),opacity:`0.15`},null,8,xe)):(0,t.createCommentVNode)(``,!0),F(n)&&e.viewMode!==`3d`?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:1,x:F(n).x,y:F(n).y,width:F(n).width,height:F(n).height,rx:K(n),fill:`none`,stroke:ei(n),"stroke-width":ti(n),"stroke-dasharray":ni(n),opacity:`0.8`},null,8,Se)):(0,t.createCommentVNode)(``,!0)],8,be))),128))])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(H.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`path`,{key:`base-${e.id}`,d:$(e),fill:`none`,stroke:`#1a2744`,"stroke-width":`2`,"stroke-linecap":`round`,"marker-end":Gi(e)},null,8,Ce))),128)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(H.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:`glow-${e.id}`},[Zr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`path`,{key:0,d:$(e),fill:`none`,stroke:Q(e),"stroke-width":`2`,"stroke-linecap":`round`,opacity:`0.15`,filter:`url(#glow-strong)`},null,8,we)):(0,t.createCommentVNode)(``,!0)],64))),128)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(H.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:`sel-${e.id}`},[Hn(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`path`,{key:0,d:$(e),fill:`none`,stroke:nr.value,"stroke-width":`4`,opacity:`0.35`,filter:`url(#glow-strong)`},null,8,Te)):(0,t.createCommentVNode)(``,!0)],64))),128)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(H.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:`flow-${e.id}`},[Zi(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,Ee,[(0,t.createElementVNode)(`path`,{d:$(e),fill:`none`,stroke:Q(e),"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-dasharray":`12 40`,opacity:`0.9`},[(0,t.createElementVNode)(`animate`,{attributeName:`stroke-dashoffset`,from:`0`,to:`-52`,dur:Yi(e),repeatCount:`indefinite`},null,8,Oe)],8,De),(0,t.createElementVNode)(`path`,{d:$(e),fill:`none`,stroke:Q(e),"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-dasharray":`6 60`,opacity:`0.5`},[(0,t.createElementVNode)(`animate`,{attributeName:`stroke-dashoffset`,from:`-30`,to:`-82`,dur:Yi(e,1.3),repeatCount:`indefinite`},null,8,Ae)],8,ke),(0,t.createElementVNode)(`path`,{d:$(e),fill:`none`,stroke:Q(e),"stroke-width":`6`,"stroke-linecap":`round`,"stroke-dasharray":`4 80`,opacity:`0.3`,filter:`url(#glow-core)`},[(0,t.createElementVNode)(`animate`,{attributeName:`stroke-dashoffset`,from:`0`,to:`-84`,dur:Yi(e,.8),repeatCount:`indefinite`},null,8,Me)],8,je)])):(0,t.createCommentVNode)(``,!0)],64))),128)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(H.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:`particle-${e.id}`},[Qi(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,Ne,[(0,t.createElementVNode)(`circle`,{r:`3`,fill:Q(e),opacity:`0.9`,filter:`url(#glow-core)`},[(0,t.createElementVNode)(`animateMotion`,{path:$(e),dur:Xi(e),repeatCount:`indefinite`},null,8,Fe)],8,Pe),(0,t.createElementVNode)(`circle`,{r:`8`,fill:Q(e),opacity:`0.2`,filter:`url(#glow-strong)`},[(0,t.createElementVNode)(`animateMotion`,{path:$(e),dur:Xi(e),repeatCount:`indefinite`},null,8,Le)],8,Ie)])):(0,t.createCommentVNode)(``,!0)],64))),128)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(aa.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:`text-${e.id}`},[e.info.merged&&e.info.representative?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:0,transform:`translate(${e.center.x}, ${e.center.y}) rotate(${e.centerAngle})`},[(0,t.createElementVNode)(`rect`,{x:`-7`,y:-g(e.edge,null)/2,width:14,height:g(e.edge,null),rx:`2`,fill:`#FFFFFF`,opacity:`0.9`,stroke:e.color,"stroke-width":`0.6`},null,8,ze),(0,t.createElementVNode)(`text`,{y:`0`,"dominant-baseline":`central`,"text-anchor":`middle`,"font-size":g(e.edge,null),fill:_(e.edge,null),"font-family":`'SF Mono', monospace`,opacity:`1`},(0,t.toDisplayString)(e.info.count),9,Be)],8,Re)):e.info.merged?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`g`,Ve,[ea(e.edge.fromText)?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:0,transform:ia(e.edge.fromText,e.start,e.startAngle)},[Gr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:0,x:-e.fromBox.w/2,y:-e.fromBox.h/2,width:e.fromBox.w,height:e.fromBox.h,rx:`3`,fill:Kr.value,opacity:`0.92`,stroke:_(e.edge,e.edge.fromText),"stroke-opacity":`0.35`,"stroke-width":`0.6`},null,8,Ue)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`text`,{y:`0`,"dominant-baseline":`central`,"text-anchor":`middle`,"font-size":g(e.edge,e.edge.fromText),fill:_(e.edge,e.edge.fromText),"font-family":`'SF Mono', monospace`,"font-weight":`500`,opacity:`0.9`},(0,t.toDisplayString)($i(e.edge.fromText)),9,We)],8,He)):(0,t.createCommentVNode)(``,!0),ea(e.edge.centerText)?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:1,transform:ia(e.edge.centerText,e.center,e.centerAngle)},[Gr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:0,x:-e.centerBox.w/2,y:-e.centerBox.h/2,width:e.centerBox.w,height:e.centerBox.h,rx:`3`,fill:Kr.value,opacity:`0.92`,stroke:_(e.edge,e.edge.centerText),"stroke-opacity":`0.35`,"stroke-width":`0.6`},null,8,Ke)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`text`,{y:`0`,"dominant-baseline":`central`,"text-anchor":`middle`,"font-size":g(e.edge,e.edge.centerText),fill:_(e.edge,e.edge.centerText),"font-family":`'SF Mono', monospace`,"font-weight":`600`,opacity:`1`},(0,t.toDisplayString)($i(e.edge.centerText)),9,qe)],8,Ge)):(0,t.createCommentVNode)(``,!0),ea(e.edge.toText)?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:2,transform:ia(e.edge.toText,e.end,e.endAngle)},[Gr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:0,x:-e.toBox.w/2,y:-e.toBox.h/2,width:e.toBox.w,height:e.toBox.h,rx:`3`,fill:Kr.value,opacity:`0.92`,stroke:_(e.edge,e.edge.toText),"stroke-opacity":`0.35`,"stroke-width":`0.6`},null,8,Ye)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`text`,{y:`0`,"dominant-baseline":`central`,"text-anchor":`middle`,"font-size":g(e.edge,e.edge.toText),fill:_(e.edge,e.edge.toText),"font-family":`'SF Mono', monospace`,"font-weight":`500`,opacity:`0.9`},(0,t.toDisplayString)($i(e.edge.toText)),9,Xe)],8,Je)):(0,t.createCommentVNode)(``,!0)]))],64))),128)),Y.value?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,Ze,[(0,t.createElementVNode)(`line`,{x1:Y.value.ax,y1:Y.value.ay,x2:zi.value.x,y2:zi.value.y,stroke:Ri.value,"stroke-width":`2`,"stroke-dasharray":`6 6`,"stroke-linecap":`round`,opacity:`0.9`},null,8,Qe),(0,t.createElementVNode)(`circle`,{cx:Y.value.px,cy:Y.value.py,r:`3.5`,fill:Ri.value,opacity:`0.9`},null,8,$e),Y.value.overId&&Bi.value?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:0,x:Bi.value.x,y:Bi.value.y,width:Bi.value.w,height:Bi.value.h,rx:`6`,fill:`none`,stroke:Ri.value,"stroke-width":`1.5`,"stroke-dasharray":`6 4`,opacity:`0.9`},null,8,et)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(H.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`path`,{key:`hit-${e.id}`,d:$(e),fill:`none`,stroke:`transparent`,"stroke-width":`14`,style:{"pointer-events":`stroke`,cursor:`pointer`},onClick:(0,t.withModifiers)(t=>rr(e,t),[`stop`])},null,8,tt))),128)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(yr.value,a=>((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:a.id,transform:`translate(${a.x}, ${a.y})`,class:(0,t.normalizeClass)([`topology-node`,x.value===a.id?`dragging`:``]),onMousedown:e=>ri(e,a.id),onClick:e=>Xn(a,e),style:(0,t.normalizeStyle)({cursor:i.editable&&i.config.nodeDraggable!==!1?`grab`:`default`,color:A(a)})},[Sn(a)?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:0,class:`node-hit-area node-hit-frame`,x:P(a).x,y:P(a).y,width:P(a).width,height:P(a).height,rx:K(a),fill:`none`,stroke:`transparent`,"stroke-width":Math.max(ti(a),12),"pointer-events":`stroke`},null,8,rt)):((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:1,class:`node-hit-area`,x:Rn(a).x,y:Rn(a).y,width:Rn(a).width,height:Rn(a).height,fill:`transparent`,"pointer-events":`all`},null,8,it)),!qn.value&&Bn(a)&&e.viewMode!==`3d`?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:2,x:P(a).x,y:P(a).y,width:P(a).width,height:P(a).height,rx:K(a),fill:Bn(a),opacity:`0.15`},null,8,at)):(0,t.createCommentVNode)(``,!0),!qn.value&&F(a)&&e.viewMode!==`3d`?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:3,x:F(a).x,y:F(a).y,width:F(a).width,height:F(a).height,rx:K(a),fill:`none`,stroke:ei(a),"stroke-width":ti(a),"stroke-dasharray":ni(a),opacity:`0.8`},null,8,ot)):(0,t.createCommentVNode)(``,!0),Vn(a)&&e.viewMode!==`3d`?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:4,x:P(a).x,y:P(a).y,width:P(a).width,height:P(a).height,rx:K(a),fill:`none`,stroke:Kn.value,"stroke-width":`2.5`,transform:`scale(1.1)`,style:{"pointer-events":`none`}},null,8,st)):(0,t.createCommentVNode)(``,!0),xn(a)?((0,t.openBlock)(),(0,t.createElementBlock)(`text`,{key:5,y:`4`,transform:`rotate(${a.rotation||0} 0 4)`,"text-anchor":`middle`,fill:Vt(a)||A(a)||bn(a).color,"font-size":Bt(a,12),"font-family":`'SF Mono', monospace`,"font-weight":`600`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(String(a.label??``).split(`
|
|
4
|
-
`),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`tspan`,{key:n,x:`0`,dy:n===0?0:`1.2em`},(0,t.toDisplayString)(e),9,lt))),128))],8,ct)):Sn(a)?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:6},[],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:7},[a.state!==`none`&&Qr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`circle`,{key:0,r:Nn(a),fill:`none`,stroke:bn(a).color,"stroke-width":`2.5`,opacity:`0`},[(0,t.createElementVNode)(`animate`,{attributeName:`r`,values:`${Nn(a)};${Nn(a)*1.6};${Nn(a)}`,dur:`2s`,repeatCount:`indefinite`},null,8,dt),r[6]||=(0,t.createElementVNode)(`animate`,{attributeName:`opacity`,values:`0.4;0.05;0.4`,dur:`2s`,repeatCount:`indefinite`},null,-1)],8,ut)):(0,t.createCommentVNode)(``,!0),wn(a)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,{key:1,class:`node-icon`,x:P(a).x,y:P(a).y,width:P(a).width,height:P(a).height,viewBox:Dn,preserveAspectRatio:En.value},[(0,t.renderSlot)(n.$slots,`node-icon`,{node:a,color:A(a),viewMode:e.viewMode,image:j(a),fit:Tn.value,imageWidth:M(a).w,imageHeight:M(a).h,width:P(a).width,height:P(a).height},()=>[(0,t.createElementVNode)(`image`,{href:j(a),x:-M(a).w/2,y:-M(a).h/2,width:M(a).w,height:M(a).h},null,8,pt)])],8,ft)):((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:2,class:`node-icon`,transform:Pn(a)},[(0,t.renderSlot)(n.$slots,`node-icon`,{node:a,color:A(a),viewMode:e.viewMode,image:j(a),fit:Tn.value,width:P(a).width,height:P(a).height},()=>[(0,t.createElementVNode)(`rect`,{x:`-18`,y:`-18`,width:`36`,height:`36`,rx:`6`,fill:A(a),opacity:`0.9`},null,8,ht)])],8,mt)),Jr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:3,transform:Fn(a)},[(0,t.createElementVNode)(`circle`,{r:`4`,fill:bn(a).color,stroke:`#0a0e1a`,"stroke-width":`2`},null,8,_t)],8,gt)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`text`,{y:Ln(a),transform:`rotate(${a.rotation||0} 0 ${Ln(a)})`,"text-anchor":`middle`,fill:Vt(a),"font-size":Bt(a),"font-weight":Ht(a),"font-family":`'Segoe UI', system-ui, sans-serif`,opacity:`0.9`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(String(a.label??``).split(`
|
|
4
|
+
`),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`tspan`,{key:n,x:`0`,dy:n===0?0:`1.2em`},(0,t.toDisplayString)(e),9,lt))),128))],8,ct)):Sn(a)?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:6},[],64)):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:7},[a.state!==`none`&&Qr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`circle`,{key:0,r:Nn(a),fill:`none`,stroke:bn(a).color,"stroke-width":`2.5`,opacity:`0`},[(0,t.createElementVNode)(`animate`,{attributeName:`r`,values:`${Nn(a)};${Nn(a)*1.6};${Nn(a)}`,dur:`2s`,repeatCount:`indefinite`},null,8,dt),r[6]||=(0,t.createElementVNode)(`animate`,{attributeName:`opacity`,values:`0.4;0.05;0.4`,dur:`2s`,repeatCount:`indefinite`},null,-1)],8,ut)):(0,t.createCommentVNode)(``,!0),wn(a)?((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,{key:1,class:`node-icon`,x:P(a).x,y:P(a).y,width:P(a).width,height:P(a).height,viewBox:Dn,preserveAspectRatio:En.value},[(0,t.renderSlot)(n.$slots,`node-icon`,{node:a,color:A(a),viewMode:e.viewMode,isImage:!0,image:j(a),fit:Tn.value,imageWidth:M(a).w,imageHeight:M(a).h,width:P(a).width,height:P(a).height},()=>[(0,t.createElementVNode)(`image`,{href:j(a),x:-M(a).w/2,y:-M(a).h/2,width:M(a).w,height:M(a).h},null,8,pt)])],8,ft)):((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:2,class:`node-icon`,transform:Pn(a)},[(0,t.renderSlot)(n.$slots,`node-icon`,{node:a,color:A(a),viewMode:e.viewMode,isImage:!1,image:j(a),fit:Tn.value,width:P(a).width,height:P(a).height},()=>[(0,t.createElementVNode)(`rect`,{x:`-18`,y:`-18`,width:`36`,height:`36`,rx:`6`,fill:A(a),opacity:`0.9`},null,8,ht)])],8,mt)),Jr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{key:3,transform:Fn(a)},[(0,t.createElementVNode)(`circle`,{r:`4`,fill:bn(a).color,stroke:`#0a0e1a`,"stroke-width":`2`},null,8,_t)],8,gt)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`text`,{y:Ln(a),transform:`rotate(${a.rotation||0} 0 ${Ln(a)})`,"text-anchor":`middle`,fill:Vt(a),"font-size":Bt(a),"font-weight":Ht(a),"font-family":`'Segoe UI', system-ui, sans-serif`,opacity:`0.9`},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(String(a.label??``).split(`
|
|
5
5
|
`),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`tspan`,{key:n,x:`0`,dy:n===0?0:`1.2em`},(0,t.toDisplayString)(e),9,yt))),128))],8,vt)],64)),qr.value?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,bt,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(_i(a),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`circle`,{key:e.side,cx:e.x,cy:e.y,r:`4.5`,class:`node-handle`,fill:`#0a0e1a`,stroke:A(a),"stroke-width":`1.5`,onPointerdown:(0,t.withModifiers)(t=>bi(t,a.id,e),[`stop`,`prevent`]),onPointermove:(0,t.withModifiers)(ki,[`stop`]),onPointerup:(0,t.withModifiers)(Ai,[`stop`]),onPointercancel:(0,t.withModifiers)(Ai,[`stop`]),onLostpointercapture:Ai,onMousedown:r[0]||=(0,t.withModifiers)(()=>{},[`stop`,`prevent`]),onClick:r[1]||=(0,t.withModifiers)(()=>{},[`stop`])},null,40,xt))),128))])):(0,t.createCommentVNode)(``,!0)],46,nt))),128)),gi.value?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,St,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ui(gi.value),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:e.side,x:gi.value.x+e.x-4.5,y:gi.value.y+e.y-4.5,width:`9`,height:`9`,rx:`2`,class:(0,t.normalizeClass)([`node-resize-handle`,`rt-${e.side}`]),onMousedown:(0,t.withModifiers)(t=>fi(t,gi.value,e.side),[`stop`,`prevent`]),onClick:r[2]||=(0,t.withModifiers)(()=>{},[`stop`])},null,42,Ct))),128))])):(0,t.createCommentVNode)(``,!0),Jn.value?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:5},(0,t.renderList)(H.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:`front-${e.id}`},[Hn(e)?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,wt,[(0,t.createElementVNode)(`path`,{d:$(e),fill:`none`,stroke:Yn.value,"stroke-width":`7`,"stroke-linecap":`round`,opacity:`0.9`},null,8,Tt),(0,t.createElementVNode)(`path`,{d:$(e),fill:`none`,stroke:Q(e),"stroke-width":`2.5`,"stroke-linecap":`round`,"marker-end":Gi(e)},null,8,Et)])):(0,t.createCommentVNode)(``,!0)],64))),128)):(0,t.createCommentVNode)(``,!0),W.value?((0,t.openBlock)(),(0,t.createElementBlock)(`rect`,{key:6,class:`marquee-box`,x:Er.value.x,y:Er.value.y,width:Er.value.width,height:Er.value.height,rx:`2`,"vector-effect":`non-scaling-stroke`},null,8,Dt)):(0,t.createCommentVNode)(``,!0)],44,u))}};e.Topology=zt,e.default={install(e){e.component(`Topology`,zt)}},e.nodeColors=l,e.nodeStates=c});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue3-network-graph",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "A Vue 3 + SVG network topology graph component: node dragging, infinite pan & zoom, Ctrl-drag marquee multi-select, mouse-to-SVG coordinate APIs. Supports 8 icon node types + text nodes + border-only nodes. No third-party chart dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|