@uigraph/sdk 1.2.11 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +9 -9
- package/dist/index.cjs +19 -12
- package/dist/index.mjs +19 -12
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -5,10 +5,10 @@ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
|
5
5
|
|
|
6
6
|
Parameters
|
|
7
7
|
|
|
8
|
-
Licensor:
|
|
8
|
+
Licensor: UIGraph, Inc.
|
|
9
9
|
Licensed Work: The software made available under this License in this
|
|
10
10
|
repository (the "Licensed Work"). The Licensed Work is
|
|
11
|
-
(c)
|
|
11
|
+
(c) UIGraph, Inc.
|
|
12
12
|
Additional Use Grant: You may make non-production use of the Licensed Work
|
|
13
13
|
free of charge, including for development, testing,
|
|
14
14
|
evaluation, and internal proof-of-concept purposes.
|
package/README.md
CHANGED
|
@@ -54,14 +54,14 @@ const ast = new SqlToAstParser(dialect).parse(sql)
|
|
|
54
54
|
|
|
55
55
|
## Package entry points
|
|
56
56
|
|
|
57
|
-
| Import
|
|
58
|
-
|
|
59
|
-
| `@uigraph/sdk`
|
|
60
|
-
| `@uigraph/sdk/browser`
|
|
61
|
-
| `@uigraph/sdk/headless`
|
|
62
|
-
| `@uigraph/sdk/aws-icons`
|
|
63
|
-
| `@uigraph/sdk/azure-icons`
|
|
64
|
-
| `@uigraph/sdk/animated-nodes` | Animated node icon metadata
|
|
57
|
+
| Import | Use when |
|
|
58
|
+
| ----------------------------- | --------------------------------------- |
|
|
59
|
+
| `@uigraph/sdk` | Full SDK (Node.js or bundlers) |
|
|
60
|
+
| `@uigraph/sdk/browser` | Browser environments |
|
|
61
|
+
| `@uigraph/sdk/headless` | Server-side conversion without DOM APIs |
|
|
62
|
+
| `@uigraph/sdk/aws-icons` | AWS icon metadata |
|
|
63
|
+
| `@uigraph/sdk/azure-icons` | Azure icon metadata |
|
|
64
|
+
| `@uigraph/sdk/animated-nodes` | Animated node icon metadata |
|
|
65
65
|
|
|
66
66
|
```ts
|
|
67
67
|
import { convertMermaidToReactFlow } from '@uigraph/sdk/browser'
|
|
@@ -99,7 +99,7 @@ This project is licensed under the [Business Source License 1.1](LICENSE) (BUSL-
|
|
|
99
99
|
|
|
100
100
|
- **Source available today** — you can read, modify, and redistribute the code under the terms of the license.
|
|
101
101
|
- **Non-production use** — free for development, testing, evaluation, and internal proof-of-concept.
|
|
102
|
-
- **Production use** — requires a commercial license from
|
|
102
|
+
- **Production use** — requires a commercial license from UIGraph. Production use means any use that supports the ongoing operation of your business or organization.
|
|
103
103
|
- **Future open source** — each version automatically converts to [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) four years after it is first published under BUSL.
|
|
104
104
|
|
|
105
105
|
BUSL is not an OSI-approved open source license during the initial term. For commercial licensing questions, open an issue or contact the maintainers.
|
package/dist/index.cjs
CHANGED
|
@@ -2780,16 +2780,19 @@ const LAYOUT_SPACING = {
|
|
|
2780
2780
|
SUBGRAPH_HEADER_HEIGHT: 35,
|
|
2781
2781
|
SUBGRAPH_PADDING: 8,
|
|
2782
2782
|
SUBGRAPH_CONTENT_TOP_MARGIN: 10,
|
|
2783
|
-
NODE_SEPARATION_HORIZONTAL:
|
|
2784
|
-
NODE_SEPARATION_VERTICAL:
|
|
2785
|
-
CONTAINER_SEPARATION_HORIZONTAL:
|
|
2786
|
-
CONTAINER_SEPARATION_VERTICAL:
|
|
2787
|
-
NESTED_SUBGRAPH_SEPARATION_HORIZONTAL:
|
|
2788
|
-
NESTED_SUBGRAPH_SEPARATION_VERTICAL:
|
|
2783
|
+
NODE_SEPARATION_HORIZONTAL: 120,
|
|
2784
|
+
NODE_SEPARATION_VERTICAL: 180,
|
|
2785
|
+
CONTAINER_SEPARATION_HORIZONTAL: 180,
|
|
2786
|
+
CONTAINER_SEPARATION_VERTICAL: 280,
|
|
2787
|
+
NESTED_SUBGRAPH_SEPARATION_HORIZONTAL: 160,
|
|
2788
|
+
NESTED_SUBGRAPH_SEPARATION_VERTICAL: 220,
|
|
2789
|
+
MIN_SUBGRAPH_WIDTH_HORIZONTAL: 600,
|
|
2790
|
+
MIN_SUBGRAPH_WIDTH_VERTICAL: 240,
|
|
2791
|
+
MIN_SUBGRAPH_HEIGHT: 200,
|
|
2789
2792
|
META_GRAPH_MARGIN: 100,
|
|
2790
2793
|
NESTED_CONTENT_MARGIN: 40,
|
|
2791
|
-
MIXED_CONTENT_VERTICAL_SPACING:
|
|
2792
|
-
MIXED_CONTENT_HORIZONTAL_SPACING:
|
|
2794
|
+
MIXED_CONTENT_VERTICAL_SPACING: 180,
|
|
2795
|
+
MIXED_CONTENT_HORIZONTAL_SPACING: 160
|
|
2793
2796
|
};
|
|
2794
2797
|
const LAYOUT_RANKERS = {
|
|
2795
2798
|
NETWORK_SIMPLEX: "network-simplex",
|
|
@@ -3318,6 +3321,9 @@ const CONTAINER_SEPARATION_HORIZONTAL = LAYOUT_SPACING.CONTAINER_SEPARATION_HORI
|
|
|
3318
3321
|
const CONTAINER_SEPARATION_VERTICAL = LAYOUT_SPACING.CONTAINER_SEPARATION_VERTICAL;
|
|
3319
3322
|
const NESTED_SUBGRAPH_SEPARATION_HORIZONTAL = LAYOUT_SPACING.NESTED_SUBGRAPH_SEPARATION_HORIZONTAL;
|
|
3320
3323
|
const NESTED_SUBGRAPH_SEPARATION_VERTICAL = LAYOUT_SPACING.NESTED_SUBGRAPH_SEPARATION_VERTICAL;
|
|
3324
|
+
const MIN_SUBGRAPH_WIDTH_HORIZONTAL = LAYOUT_SPACING.MIN_SUBGRAPH_WIDTH_HORIZONTAL;
|
|
3325
|
+
const MIN_SUBGRAPH_WIDTH_VERTICAL = LAYOUT_SPACING.MIN_SUBGRAPH_WIDTH_VERTICAL;
|
|
3326
|
+
const MIN_SUBGRAPH_HEIGHT = LAYOUT_SPACING.MIN_SUBGRAPH_HEIGHT;
|
|
3321
3327
|
const META_GRAPH_MARGIN = LAYOUT_SPACING.META_GRAPH_MARGIN;
|
|
3322
3328
|
const NESTED_CONTENT_MARGIN = LAYOUT_SPACING.NESTED_CONTENT_MARGIN;
|
|
3323
3329
|
const MIXED_CONTENT_VERTICAL_SPACING = LAYOUT_SPACING.MIXED_CONTENT_VERTICAL_SPACING;
|
|
@@ -3404,6 +3410,7 @@ function processSubgraphsInHierarchicalOrder(subgraphs) {
|
|
|
3404
3410
|
}
|
|
3405
3411
|
function layoutSubgraphs(nodes, edges, subgraphs, direction) {
|
|
3406
3412
|
const subgraphLayouts = /* @__PURE__ */ new Map();
|
|
3413
|
+
const isHorizontal = direction === "LR" || direction === "RL";
|
|
3407
3414
|
const orderedSubgraphs = processSubgraphsInHierarchicalOrder(subgraphs);
|
|
3408
3415
|
debugLog(`Laying out ${orderedSubgraphs.length} subgraphs in hierarchical order`);
|
|
3409
3416
|
orderedSubgraphs.forEach((subgraph) => {
|
|
@@ -3476,8 +3483,8 @@ function layoutSubgraphs(nodes, edges, subgraphs, direction) {
|
|
|
3476
3483
|
validateNodeSpacing(nodePositions, subgraph.id);
|
|
3477
3484
|
const baseWidth = maxX - minX + SUBGRAPH_PADDING * 2;
|
|
3478
3485
|
const baseHeight = maxY - minY + SUBGRAPH_PADDING * 2 + SUBGRAPH_HEADER_HEIGHT + SUBGRAPH_CONTENT_TOP_MARGIN;
|
|
3479
|
-
const width = baseWidth +
|
|
3480
|
-
const height = baseHeight +
|
|
3486
|
+
const width = Math.max(baseWidth + SUBGRAPH_PADDING * 3, isHorizontal ? MIN_SUBGRAPH_WIDTH_HORIZONTAL : MIN_SUBGRAPH_WIDTH_VERTICAL);
|
|
3487
|
+
const height = Math.max(baseHeight + SUBGRAPH_PADDING * 2, MIN_SUBGRAPH_HEIGHT);
|
|
3481
3488
|
subgraphLayouts.set(subgraph.id, {
|
|
3482
3489
|
id: subgraph.id,
|
|
3483
3490
|
title: subgraph.title,
|
|
@@ -3587,8 +3594,8 @@ function adjustParentSizesAfterPositioning(subgraphLayouts, subgraphPositions, o
|
|
|
3587
3594
|
const contentMaxBottom = Math.max(maxNodeBottom, maxChildBottom);
|
|
3588
3595
|
const requiredWidth = contentMaxRight + (isHorizontal ? SUBGRAPH_PADDING * 4 : SUBGRAPH_PADDING * 3);
|
|
3589
3596
|
const requiredHeight = contentMaxBottom + SUBGRAPH_PADDING * 3;
|
|
3590
|
-
const newWidth = Math.max(layout.width, requiredWidth, isHorizontal ?
|
|
3591
|
-
const newHeight = Math.max(layout.height, requiredHeight,
|
|
3597
|
+
const newWidth = Math.max(layout.width, requiredWidth, isHorizontal ? MIN_SUBGRAPH_WIDTH_HORIZONTAL : MIN_SUBGRAPH_WIDTH_VERTICAL);
|
|
3598
|
+
const newHeight = Math.max(layout.height, requiredHeight, MIN_SUBGRAPH_HEIGHT);
|
|
3592
3599
|
if (newWidth > layout.width || newHeight > layout.height) {
|
|
3593
3600
|
debugLog(`Post-positioning resize (iter ${iterations}): ${subgraph.id} ${layout.width}x${layout.height} → ${newWidth}x${newHeight}`);
|
|
3594
3601
|
layout.width = newWidth;
|
package/dist/index.mjs
CHANGED
|
@@ -2774,16 +2774,19 @@ const LAYOUT_SPACING = {
|
|
|
2774
2774
|
SUBGRAPH_HEADER_HEIGHT: 35,
|
|
2775
2775
|
SUBGRAPH_PADDING: 8,
|
|
2776
2776
|
SUBGRAPH_CONTENT_TOP_MARGIN: 10,
|
|
2777
|
-
NODE_SEPARATION_HORIZONTAL:
|
|
2778
|
-
NODE_SEPARATION_VERTICAL:
|
|
2779
|
-
CONTAINER_SEPARATION_HORIZONTAL:
|
|
2780
|
-
CONTAINER_SEPARATION_VERTICAL:
|
|
2781
|
-
NESTED_SUBGRAPH_SEPARATION_HORIZONTAL:
|
|
2782
|
-
NESTED_SUBGRAPH_SEPARATION_VERTICAL:
|
|
2777
|
+
NODE_SEPARATION_HORIZONTAL: 120,
|
|
2778
|
+
NODE_SEPARATION_VERTICAL: 180,
|
|
2779
|
+
CONTAINER_SEPARATION_HORIZONTAL: 180,
|
|
2780
|
+
CONTAINER_SEPARATION_VERTICAL: 280,
|
|
2781
|
+
NESTED_SUBGRAPH_SEPARATION_HORIZONTAL: 160,
|
|
2782
|
+
NESTED_SUBGRAPH_SEPARATION_VERTICAL: 220,
|
|
2783
|
+
MIN_SUBGRAPH_WIDTH_HORIZONTAL: 600,
|
|
2784
|
+
MIN_SUBGRAPH_WIDTH_VERTICAL: 240,
|
|
2785
|
+
MIN_SUBGRAPH_HEIGHT: 200,
|
|
2783
2786
|
META_GRAPH_MARGIN: 100,
|
|
2784
2787
|
NESTED_CONTENT_MARGIN: 40,
|
|
2785
|
-
MIXED_CONTENT_VERTICAL_SPACING:
|
|
2786
|
-
MIXED_CONTENT_HORIZONTAL_SPACING:
|
|
2788
|
+
MIXED_CONTENT_VERTICAL_SPACING: 180,
|
|
2789
|
+
MIXED_CONTENT_HORIZONTAL_SPACING: 160
|
|
2787
2790
|
};
|
|
2788
2791
|
({
|
|
2789
2792
|
NETWORK_SIMPLEX: "network-simplex",
|
|
@@ -3311,6 +3314,9 @@ const CONTAINER_SEPARATION_HORIZONTAL = LAYOUT_SPACING.CONTAINER_SEPARATION_HORI
|
|
|
3311
3314
|
const CONTAINER_SEPARATION_VERTICAL = LAYOUT_SPACING.CONTAINER_SEPARATION_VERTICAL;
|
|
3312
3315
|
const NESTED_SUBGRAPH_SEPARATION_HORIZONTAL = LAYOUT_SPACING.NESTED_SUBGRAPH_SEPARATION_HORIZONTAL;
|
|
3313
3316
|
const NESTED_SUBGRAPH_SEPARATION_VERTICAL = LAYOUT_SPACING.NESTED_SUBGRAPH_SEPARATION_VERTICAL;
|
|
3317
|
+
const MIN_SUBGRAPH_WIDTH_HORIZONTAL = LAYOUT_SPACING.MIN_SUBGRAPH_WIDTH_HORIZONTAL;
|
|
3318
|
+
const MIN_SUBGRAPH_WIDTH_VERTICAL = LAYOUT_SPACING.MIN_SUBGRAPH_WIDTH_VERTICAL;
|
|
3319
|
+
const MIN_SUBGRAPH_HEIGHT = LAYOUT_SPACING.MIN_SUBGRAPH_HEIGHT;
|
|
3314
3320
|
const META_GRAPH_MARGIN = LAYOUT_SPACING.META_GRAPH_MARGIN;
|
|
3315
3321
|
const NESTED_CONTENT_MARGIN = LAYOUT_SPACING.NESTED_CONTENT_MARGIN;
|
|
3316
3322
|
const MIXED_CONTENT_VERTICAL_SPACING = LAYOUT_SPACING.MIXED_CONTENT_VERTICAL_SPACING;
|
|
@@ -3397,6 +3403,7 @@ function processSubgraphsInHierarchicalOrder(subgraphs) {
|
|
|
3397
3403
|
}
|
|
3398
3404
|
function layoutSubgraphs(nodes, edges, subgraphs, direction) {
|
|
3399
3405
|
const subgraphLayouts = /* @__PURE__ */ new Map();
|
|
3406
|
+
const isHorizontal = direction === "LR" || direction === "RL";
|
|
3400
3407
|
const orderedSubgraphs = processSubgraphsInHierarchicalOrder(subgraphs);
|
|
3401
3408
|
debugLog(`Laying out ${orderedSubgraphs.length} subgraphs in hierarchical order`);
|
|
3402
3409
|
orderedSubgraphs.forEach((subgraph) => {
|
|
@@ -3469,8 +3476,8 @@ function layoutSubgraphs(nodes, edges, subgraphs, direction) {
|
|
|
3469
3476
|
validateNodeSpacing(nodePositions, subgraph.id);
|
|
3470
3477
|
const baseWidth = maxX - minX + SUBGRAPH_PADDING * 2;
|
|
3471
3478
|
const baseHeight = maxY - minY + SUBGRAPH_PADDING * 2 + SUBGRAPH_HEADER_HEIGHT + SUBGRAPH_CONTENT_TOP_MARGIN;
|
|
3472
|
-
const width = baseWidth +
|
|
3473
|
-
const height = baseHeight +
|
|
3479
|
+
const width = Math.max(baseWidth + SUBGRAPH_PADDING * 3, isHorizontal ? MIN_SUBGRAPH_WIDTH_HORIZONTAL : MIN_SUBGRAPH_WIDTH_VERTICAL);
|
|
3480
|
+
const height = Math.max(baseHeight + SUBGRAPH_PADDING * 2, MIN_SUBGRAPH_HEIGHT);
|
|
3474
3481
|
subgraphLayouts.set(subgraph.id, {
|
|
3475
3482
|
id: subgraph.id,
|
|
3476
3483
|
title: subgraph.title,
|
|
@@ -3580,8 +3587,8 @@ function adjustParentSizesAfterPositioning(subgraphLayouts, subgraphPositions, o
|
|
|
3580
3587
|
const contentMaxBottom = Math.max(maxNodeBottom, maxChildBottom);
|
|
3581
3588
|
const requiredWidth = contentMaxRight + (isHorizontal ? SUBGRAPH_PADDING * 4 : SUBGRAPH_PADDING * 3);
|
|
3582
3589
|
const requiredHeight = contentMaxBottom + SUBGRAPH_PADDING * 3;
|
|
3583
|
-
const newWidth = Math.max(layout.width, requiredWidth, isHorizontal ?
|
|
3584
|
-
const newHeight = Math.max(layout.height, requiredHeight,
|
|
3590
|
+
const newWidth = Math.max(layout.width, requiredWidth, isHorizontal ? MIN_SUBGRAPH_WIDTH_HORIZONTAL : MIN_SUBGRAPH_WIDTH_VERTICAL);
|
|
3591
|
+
const newHeight = Math.max(layout.height, requiredHeight, MIN_SUBGRAPH_HEIGHT);
|
|
3585
3592
|
if (newWidth > layout.width || newHeight > layout.height) {
|
|
3586
3593
|
debugLog(`Post-positioning resize (iter ${iterations}): ${subgraph.id} ${layout.width}x${layout.height} → ${newWidth}x${newHeight}`);
|
|
3587
3594
|
layout.width = newWidth;
|