@umami/shiso 1.12.0 → 1.13.0
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/dist/chunks/App.js +76 -49
- package/dist/chunks/abnfDiagram-VCTEODGH.js +109 -0
- package/dist/chunks/arc.js +130 -0
- package/dist/chunks/architecture-7GRP2DOG.js +4 -0
- package/dist/chunks/architectureDiagram-5GKGNRK7.js +7466 -0
- package/dist/chunks/array.js +8 -0
- package/dist/chunks/blockDiagram-I7D4REHJ.js +2546 -0
- package/dist/chunks/c4Diagram-7LVT6UL2.js +3654 -0
- package/dist/chunks/channel.js +9 -0
- package/dist/chunks/chunk-2Q5K7J3B.js +21 -0
- package/dist/chunks/chunk-4HAMMTFA.js +6106 -0
- package/dist/chunks/chunk-5VM5RSS4.js +21 -0
- package/dist/chunks/chunk-75Z2AOVW.js +2185 -0
- package/dist/chunks/chunk-DU6HZSFF.js +8729 -0
- package/dist/chunks/chunk-F27PBJKO.js +95 -0
- package/dist/chunks/chunk-FOHPRMQF.js +27162 -0
- package/dist/chunks/chunk-GMAD6QVW.js +2369 -0
- package/dist/chunks/chunk-GVQU2GXP.js +58 -0
- package/dist/chunks/chunk-IMKFNOWR.js +2593 -0
- package/dist/chunks/chunk-JWPE2WC7.js +12 -0
- package/dist/chunks/chunk-L3NEJ4N5.js +420 -0
- package/dist/chunks/chunk-OSK3NFVY.js +1029 -0
- package/dist/chunks/chunk-P2QGCYS3.js +95 -0
- package/dist/chunks/chunk-POPQ4Y6H.js +33 -0
- package/dist/chunks/chunk-PWAF6VOD.js +467 -0
- package/dist/chunks/chunk-SHT3W25Y.js +4813 -0
- package/dist/chunks/chunk-SVP7TREG.js +686 -0
- package/dist/chunks/chunk-TICWLB2K.js +3800 -0
- package/dist/chunks/chunk-XXDRQBXY.js +12 -0
- package/dist/chunks/chunk-Y2CYZVJY.js +15 -0
- package/dist/chunks/classDiagram-ZZMXUADV.js +33 -0
- package/dist/chunks/classDiagram-v2-VYDZK3BY.js +33 -0
- package/dist/chunks/cose-bilkent-JH36ORCC.js +4268 -0
- package/dist/chunks/cynefin-OW5HDTMX.js +4 -0
- package/dist/chunks/cynefinDiagram-5FMLGOSQ.js +482 -0
- package/dist/chunks/cytoscape.esm.js +28282 -0
- package/dist/chunks/dagre-GXQ25YYZ.js +583 -0
- package/dist/chunks/dagre.js +4235 -0
- package/dist/chunks/defaultLocale.js +246 -0
- package/dist/chunks/diagram-S7CK7UJ4.js +402 -0
- package/dist/chunks/diagram-UQ7AKVKN.js +291 -0
- package/dist/chunks/diagram-VSXAHHWV.js +553 -0
- package/dist/chunks/diagram-VX7I27RA.js +798 -0
- package/dist/chunks/diagram-Z3DM3KII.js +186 -0
- package/dist/chunks/dist.js +92 -0
- package/dist/chunks/docs.js +987 -91
- package/dist/chunks/ebnfDiagram-PWID7BFC.js +123 -0
- package/dist/chunks/erDiagram-RLTQ6QDP.js +2295 -0
- package/dist/chunks/eventmodeling-NTZA5JFV.js +4 -0
- package/dist/chunks/flowDiagram-HODETNUW.js +17 -0
- package/dist/chunks/ganttDiagram-EL5Y4UJY.js +3928 -0
- package/dist/chunks/gitGraph-4MIJSDKK.js +4 -0
- package/dist/chunks/gitGraphDiagram-WWUBYQGX.js +1153 -0
- package/dist/chunks/graphlib.js +4194 -0
- package/dist/chunks/info-A6RAGUB7.js +4 -0
- package/dist/chunks/infoDiagram-27XIBGKW.js +25 -0
- package/dist/chunks/init.js +14 -0
- package/dist/chunks/ishikawaDiagram-5VMMS53U.js +971 -0
- package/dist/chunks/journeyDiagram-3NMN7TZE.js +1226 -0
- package/dist/chunks/kanban-definition-UXKFOSKX.js +1241 -0
- package/dist/chunks/katex.js +26463 -0
- package/dist/chunks/line.js +48 -0
- package/dist/chunks/linear.js +391 -0
- package/dist/chunks/mermaid-parser.core.js +754 -0
- package/dist/chunks/mermaid.core.js +4898 -0
- package/dist/chunks/mindmap-definition-YA3MSWOX.js +1309 -0
- package/dist/chunks/ordinal.js +84 -0
- package/dist/chunks/packet-AYTQ26CC.js +4 -0
- package/dist/chunks/path.js +106 -0
- package/dist/chunks/pegDiagram-XKGWAZYB.js +115 -0
- package/dist/chunks/pie-WAS4IAKB.js +4 -0
- package/dist/chunks/pieDiagram-E7YTZNPT.js +297 -0
- package/dist/chunks/quadrantDiagram-AXDQQJYC.js +2234 -0
- package/dist/chunks/radar-RG4KPBEZ.js +4 -0
- package/dist/chunks/railroad-74A4TZTK.js +4 -0
- package/dist/chunks/railroad-abnf-HS5TGJTU.js +4 -0
- package/dist/chunks/railroad-ebnf-LZEXJU2U.js +4 -0
- package/dist/chunks/railroad-peg-WCYAUIDC.js +4 -0
- package/dist/chunks/railroadDiagram-O6MQD6OU.js +89 -0
- package/dist/chunks/requirementDiagram-BXWQKSXE.js +2464 -0
- package/dist/chunks/rough.esm.js +1396 -0
- package/dist/chunks/sankeyDiagram-P5KCCOFB.js +1308 -0
- package/dist/chunks/sequenceDiagram-WJ2MYXX4.js +5445 -0
- package/dist/chunks/sizeCapture-INFHLROL.js +56 -0
- package/dist/chunks/src.js +2653 -0
- package/dist/chunks/stateDiagram-D77RDMKH.js +368 -0
- package/dist/chunks/stateDiagram-v2-MP3YSRHH.js +33 -0
- package/dist/chunks/swimlanes-42K2YHIH.js +6925 -0
- package/dist/chunks/swimlanesDiagram-VR7AAH4N.js +32 -0
- package/dist/chunks/timeline-definition-24CTP7MA.js +1507 -0
- package/dist/chunks/treeView-Q6P3EWNA.js +4 -0
- package/dist/chunks/treemap-WGGIJYW6.js +4 -0
- package/dist/chunks/vennDiagram-4TSXK5OY.js +2803 -0
- package/dist/chunks/wardley-WFR3VGLG.js +4 -0
- package/dist/chunks/wardleyDiagram-VM6X3IG4.js +877 -0
- package/dist/chunks/xychartDiagram-S5SC5T6Z.js +2698 -0
- package/dist/components.js +2 -2
- package/dist/entry-client.js +1 -1
- package/dist/entry-server.js +1 -1
- package/docs.schema.json +1 -1
- package/package.json +2 -1
- package/scripts/expand-navigation-globs.mjs +77 -8
- package/src/components/CodeBlock.tsx +36 -0
- package/src/components/Docs.tsx +44 -21
- package/src/components/OpenApiOperation.tsx +28 -20
- package/src/components/SideNav.tsx +8 -3
- package/src/components/docs/Changelog.tsx +163 -0
- package/src/components/docs/Mermaid.tsx +164 -0
- package/src/components/docs/Panel.tsx +23 -0
- package/src/components/docs/ParamField.tsx +17 -5
- package/src/components/docs/PropertiesTable.tsx +2 -2
- package/src/components/docs/ResponseField.tsx +17 -5
- package/src/components/docs/Tiles.tsx +59 -0
- package/src/components/docs/Tree.tsx +359 -0
- package/src/components/docs/Update.tsx +72 -0
- package/src/components/docs/index.ts +7 -0
- package/src/components/docs/panel-context.tsx +25 -0
- package/src/components/docs/styles.ts +49 -0
- package/src/components/icons/index.ts +4 -0
- package/src/lib/rehype-shiki.ts +18 -1
- package/types/components.d.ts +79 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { n as __name } from "./chunk-Y2CYZVJY.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JWPE2WC7.mjs
|
|
4
|
+
function populateCommonDb(ast, db) {
|
|
5
|
+
if (ast.accDescr) db.setAccDescription?.(ast.accDescr);
|
|
6
|
+
if (ast.accTitle) db.setAccTitle?.(ast.accTitle);
|
|
7
|
+
if (ast.title) db.setDiagramTitle?.(ast.title);
|
|
8
|
+
}
|
|
9
|
+
__name(populateCommonDb, "populateCommonDb");
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { populateCommonDb as t };
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { n as __name } from "./chunk-Y2CYZVJY.js";
|
|
2
|
+
import { m as log, p as select_default } from "./src.js";
|
|
3
|
+
import { T as getEffectiveHtmlLabels, g as evaluate, x as getConfig2 } from "./chunk-DU6HZSFF.js";
|
|
4
|
+
import { n as createText } from "./chunk-GMAD6QVW.js";
|
|
5
|
+
import { a as userNodeOverrides, i as styles2String } from "./chunk-P2QGCYS3.js";
|
|
6
|
+
import { t as at } from "./rough.esm.js";
|
|
7
|
+
import { n as createRoundedRectPathD, r as intersect_rect_default, t as createLabel_default } from "./chunk-4HAMMTFA.js";
|
|
8
|
+
import { n as getSubGraphTitleMargins } from "./chunk-GVQU2GXP.js";
|
|
9
|
+
|
|
10
|
+
//#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/chunk-L3NEJ4N5.mjs
|
|
11
|
+
var swimlane = /* @__PURE__ */ __name(async (parent, node) => {
|
|
12
|
+
const siteConfig = getConfig2();
|
|
13
|
+
const { themeVariables, handDrawnSeed } = siteConfig;
|
|
14
|
+
const { clusterBkg, clusterBorder } = themeVariables;
|
|
15
|
+
const laneStroke = clusterBorder;
|
|
16
|
+
const { labelStyles, nodeStyles, borderStyles, backgroundStyles } = styles2String(node);
|
|
17
|
+
const shapeSvg = parent.insert("g").attr("class", "cluster swimlane " + (node.cssClasses || "")).attr("id", node.id).attr("data-id", node.id).attr("data-et", "cluster").attr("data-look", node.look);
|
|
18
|
+
const useHtmlLabels = evaluate(siteConfig.flowchart.htmlLabels);
|
|
19
|
+
const isLR = node.direction === "LR";
|
|
20
|
+
const labelEl = shapeSvg.insert("g").attr("class", "cluster-label swimlane-label");
|
|
21
|
+
const text = await createText(labelEl, node.label, {
|
|
22
|
+
style: node.labelStyle,
|
|
23
|
+
useHtmlLabels,
|
|
24
|
+
isNode: true,
|
|
25
|
+
width: node.width
|
|
26
|
+
});
|
|
27
|
+
let bbox = text.getBBox();
|
|
28
|
+
if (useHtmlLabels) {
|
|
29
|
+
const div = text.children[0];
|
|
30
|
+
const dv = select_default(text);
|
|
31
|
+
bbox = div.getBoundingClientRect();
|
|
32
|
+
dv.attr("width", bbox.width);
|
|
33
|
+
dv.attr("height", bbox.height);
|
|
34
|
+
}
|
|
35
|
+
const padding = node.padding ?? 0;
|
|
36
|
+
const width = node.width <= bbox.width + padding ? bbox.width + padding : node.width;
|
|
37
|
+
if (node.width <= bbox.width + padding) node.diff = (width - node.width) / 2 - padding;
|
|
38
|
+
else node.diff = -padding;
|
|
39
|
+
const height = node.height;
|
|
40
|
+
const laneTop = node.y - height / 2;
|
|
41
|
+
const laneBottom = node.y + height / 2;
|
|
42
|
+
const laneLeft = node.x - width / 2;
|
|
43
|
+
const contentTop = node.swimlaneContentTop !== void 0 ? node.swimlaneContentTop : laneTop + height / 3;
|
|
44
|
+
const titlePaddingY = isLR ? 4 : 0;
|
|
45
|
+
const desiredTitleSize = bbox.height + 2 * titlePaddingY;
|
|
46
|
+
let titleRect;
|
|
47
|
+
let bodyRect;
|
|
48
|
+
if (isLR) {
|
|
49
|
+
const titleWidth = Math.max(desiredTitleSize, bbox.height + 2 * titlePaddingY);
|
|
50
|
+
const bodyX = laneLeft + titleWidth;
|
|
51
|
+
const bodyWidth = Math.max(0, width - titleWidth);
|
|
52
|
+
if (node.look === "handDrawn") {
|
|
53
|
+
const rc = at.svg(shapeSvg);
|
|
54
|
+
const titleOptions = userNodeOverrides(node, {
|
|
55
|
+
roughness: .7,
|
|
56
|
+
fill: clusterBkg,
|
|
57
|
+
stroke: laneStroke,
|
|
58
|
+
fillWeight: 3,
|
|
59
|
+
seed: handDrawnSeed
|
|
60
|
+
});
|
|
61
|
+
const bodyOptions = userNodeOverrides(node, {
|
|
62
|
+
roughness: .7,
|
|
63
|
+
fill: "none",
|
|
64
|
+
stroke: laneStroke,
|
|
65
|
+
seed: handDrawnSeed
|
|
66
|
+
});
|
|
67
|
+
const roughTitle = rc.rectangle(laneLeft, laneTop, titleWidth, height, titleOptions);
|
|
68
|
+
titleRect = shapeSvg.insert(() => roughTitle, ":first-child");
|
|
69
|
+
const roughBody = rc.rectangle(bodyX, laneTop, bodyWidth, height, bodyOptions);
|
|
70
|
+
bodyRect = shapeSvg.insert(() => roughBody, ":first-child");
|
|
71
|
+
titleRect.select("path:nth-child(2)").attr("style", borderStyles.join(";"));
|
|
72
|
+
titleRect.select("path").attr("style", backgroundStyles.join(";").replace("fill", "stroke"));
|
|
73
|
+
} else {
|
|
74
|
+
titleRect = shapeSvg.insert("rect", ":first-child");
|
|
75
|
+
bodyRect = shapeSvg.insert("rect", ":first-child");
|
|
76
|
+
titleRect.attr("class", "swimlane-title").attr("style", nodeStyles).attr("x", laneLeft).attr("y", laneTop).attr("width", titleWidth).attr("height", height).attr("fill", clusterBkg).attr("stroke", laneStroke);
|
|
77
|
+
bodyRect.attr("class", "swimlane-body").attr("style", nodeStyles).attr("x", bodyX).attr("y", laneTop).attr("width", bodyWidth).attr("height", height).attr("fill", "none").attr("stroke", laneStroke);
|
|
78
|
+
}
|
|
79
|
+
const labelCenterX = laneLeft + titleWidth / 2;
|
|
80
|
+
const labelCenterY = node.y;
|
|
81
|
+
labelEl.attr("transform", `translate(${labelCenterX}, ${labelCenterY}) rotate(-90) translate(${-bbox.width / 2}, ${-bbox.height / 2})`);
|
|
82
|
+
} else {
|
|
83
|
+
const headerMaxHeight = Math.max(0, contentTop - laneTop);
|
|
84
|
+
const titleHeight = Math.min(desiredTitleSize, headerMaxHeight);
|
|
85
|
+
const bodyY = laneTop + titleHeight;
|
|
86
|
+
const contentHeight = Math.max(0, laneBottom - bodyY);
|
|
87
|
+
const x = node.x - width / 2;
|
|
88
|
+
if (node.look === "handDrawn") {
|
|
89
|
+
const rc = at.svg(shapeSvg);
|
|
90
|
+
const titleOptions = userNodeOverrides(node, {
|
|
91
|
+
roughness: .7,
|
|
92
|
+
fill: clusterBkg,
|
|
93
|
+
stroke: laneStroke,
|
|
94
|
+
fillWeight: 3,
|
|
95
|
+
seed: handDrawnSeed
|
|
96
|
+
});
|
|
97
|
+
const bodyOptions = userNodeOverrides(node, {
|
|
98
|
+
roughness: .7,
|
|
99
|
+
fill: "none",
|
|
100
|
+
stroke: laneStroke,
|
|
101
|
+
seed: handDrawnSeed
|
|
102
|
+
});
|
|
103
|
+
const roughTitle = rc.rectangle(x, laneTop, width, titleHeight, titleOptions);
|
|
104
|
+
titleRect = shapeSvg.insert(() => roughTitle, ":first-child");
|
|
105
|
+
const roughBody = rc.rectangle(x, bodyY, width, contentHeight, bodyOptions);
|
|
106
|
+
bodyRect = shapeSvg.insert(() => roughBody, ":first-child");
|
|
107
|
+
titleRect.select("path:nth-child(2)").attr("style", borderStyles.join(";"));
|
|
108
|
+
titleRect.select("path").attr("style", backgroundStyles.join(";").replace("fill", "stroke"));
|
|
109
|
+
} else {
|
|
110
|
+
titleRect = shapeSvg.insert("rect", ":first-child");
|
|
111
|
+
bodyRect = shapeSvg.insert("rect", ":first-child");
|
|
112
|
+
titleRect.attr("class", "swimlane-title").attr("style", nodeStyles).attr("x", x).attr("y", laneTop).attr("width", width).attr("height", titleHeight).attr("fill", clusterBkg).attr("stroke", laneStroke);
|
|
113
|
+
bodyRect.attr("class", "swimlane-body").attr("style", nodeStyles).attr("x", x).attr("y", bodyY).attr("width", width).attr("height", contentHeight).attr("fill", "none").attr("stroke", laneStroke);
|
|
114
|
+
}
|
|
115
|
+
const labelX = node.x - bbox.width / 2;
|
|
116
|
+
const labelY = laneTop + (titleHeight - bbox.height) / 2;
|
|
117
|
+
labelEl.attr("transform", `translate(${labelX}, ${labelY})`);
|
|
118
|
+
}
|
|
119
|
+
log.trace("Swimlane data ", node, JSON.stringify(node));
|
|
120
|
+
if (labelStyles) {
|
|
121
|
+
const span = labelEl.select("span");
|
|
122
|
+
if (span) span.attr("style", labelStyles);
|
|
123
|
+
}
|
|
124
|
+
node.offsetX = 0;
|
|
125
|
+
node.width = width;
|
|
126
|
+
node.height = height;
|
|
127
|
+
node.offsetY = bbox.height - padding / 2;
|
|
128
|
+
node.intersect = function(point) {
|
|
129
|
+
return intersect_rect_default(node, point);
|
|
130
|
+
};
|
|
131
|
+
return {
|
|
132
|
+
cluster: shapeSvg,
|
|
133
|
+
labelBBox: bbox
|
|
134
|
+
};
|
|
135
|
+
}, "swimlane");
|
|
136
|
+
var rect = /* @__PURE__ */ __name(async (parent, node) => {
|
|
137
|
+
log.info("Creating subgraph rect for ", node.id, node);
|
|
138
|
+
const siteConfig = getConfig2();
|
|
139
|
+
const { themeVariables, handDrawnSeed } = siteConfig;
|
|
140
|
+
const { clusterBkg, clusterBorder } = themeVariables;
|
|
141
|
+
const { labelStyles, nodeStyles, borderStyles, backgroundStyles } = styles2String(node);
|
|
142
|
+
const shapeSvg = parent.insert("g").attr("class", "cluster " + node.cssClasses).attr("id", node.domId).attr("data-look", node.look);
|
|
143
|
+
const useHtmlLabels = getEffectiveHtmlLabels(siteConfig);
|
|
144
|
+
const labelEl = shapeSvg.insert("g").attr("class", "cluster-label ");
|
|
145
|
+
let text;
|
|
146
|
+
if (node.labelType === "markdown") text = await createText(labelEl, node.label, {
|
|
147
|
+
style: node.labelStyle,
|
|
148
|
+
useHtmlLabels,
|
|
149
|
+
isNode: true,
|
|
150
|
+
width: node.width
|
|
151
|
+
});
|
|
152
|
+
else text = await createLabel_default(labelEl, node.label, node.labelStyle || "", false, true);
|
|
153
|
+
let bbox = text.getBBox();
|
|
154
|
+
if (getEffectiveHtmlLabels(siteConfig)) {
|
|
155
|
+
const div = text.children[0];
|
|
156
|
+
const dv = select_default(text);
|
|
157
|
+
bbox = div.getBoundingClientRect();
|
|
158
|
+
dv.attr("width", bbox.width);
|
|
159
|
+
dv.attr("height", bbox.height);
|
|
160
|
+
}
|
|
161
|
+
const width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;
|
|
162
|
+
if (node.width <= bbox.width + node.padding) node.diff = (width - node.width) / 2 - node.padding;
|
|
163
|
+
else node.diff = -node.padding;
|
|
164
|
+
const height = node.height;
|
|
165
|
+
const x = node.x - width / 2;
|
|
166
|
+
const y = node.y - height / 2;
|
|
167
|
+
log.trace("Data ", node, JSON.stringify(node));
|
|
168
|
+
let rect2;
|
|
169
|
+
if (node.look === "handDrawn") {
|
|
170
|
+
const rc = at.svg(shapeSvg);
|
|
171
|
+
const options = userNodeOverrides(node, {
|
|
172
|
+
roughness: .7,
|
|
173
|
+
fill: clusterBkg,
|
|
174
|
+
stroke: clusterBorder,
|
|
175
|
+
fillWeight: 3,
|
|
176
|
+
seed: handDrawnSeed
|
|
177
|
+
});
|
|
178
|
+
const roughNode = rc.path(createRoundedRectPathD(x, y, width, height, 0), options);
|
|
179
|
+
rect2 = shapeSvg.insert(() => {
|
|
180
|
+
log.debug("Rough node insert CXC", roughNode);
|
|
181
|
+
return roughNode;
|
|
182
|
+
}, ":first-child");
|
|
183
|
+
rect2.select("path:nth-child(2)").attr("style", borderStyles.join(";"));
|
|
184
|
+
rect2.select("path").attr("style", backgroundStyles.join(";").replace("fill", "stroke"));
|
|
185
|
+
} else {
|
|
186
|
+
rect2 = shapeSvg.insert("rect", ":first-child");
|
|
187
|
+
rect2.attr("style", nodeStyles).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", width).attr("height", height);
|
|
188
|
+
}
|
|
189
|
+
const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);
|
|
190
|
+
labelEl.attr("transform", `translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`);
|
|
191
|
+
if (labelStyles) {
|
|
192
|
+
const span = labelEl.select("span");
|
|
193
|
+
if (span) span.attr("style", labelStyles);
|
|
194
|
+
}
|
|
195
|
+
const rectBox = rect2.node().getBBox();
|
|
196
|
+
node.offsetX = 0;
|
|
197
|
+
node.width = rectBox.width;
|
|
198
|
+
node.height = rectBox.height;
|
|
199
|
+
node.offsetY = bbox.height - node.padding / 2;
|
|
200
|
+
node.intersect = function(point) {
|
|
201
|
+
return intersect_rect_default(node, point);
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
cluster: shapeSvg,
|
|
205
|
+
labelBBox: bbox
|
|
206
|
+
};
|
|
207
|
+
}, "rect");
|
|
208
|
+
var shapes = {
|
|
209
|
+
rect,
|
|
210
|
+
squareRect: rect,
|
|
211
|
+
roundedWithTitle: /* @__PURE__ */ __name(async (parent, node) => {
|
|
212
|
+
const siteConfig = getConfig2();
|
|
213
|
+
const { themeVariables, handDrawnSeed } = siteConfig;
|
|
214
|
+
const { altBackground, compositeBackground, compositeTitleBackground, nodeBorder } = themeVariables;
|
|
215
|
+
const shapeSvg = parent.insert("g").attr("class", node.cssClasses).attr("id", node.domId).attr("data-id", node.id).attr("data-look", node.look);
|
|
216
|
+
const outerRectG = shapeSvg.insert("g", ":first-child");
|
|
217
|
+
const label = shapeSvg.insert("g").attr("class", "cluster-label");
|
|
218
|
+
let innerRect = shapeSvg.append("rect");
|
|
219
|
+
const text = await createLabel_default(label, node.label, node.labelStyle, void 0, true);
|
|
220
|
+
let bbox = text.getBBox();
|
|
221
|
+
if (getEffectiveHtmlLabels(siteConfig)) {
|
|
222
|
+
const div = text.children[0];
|
|
223
|
+
const dv = select_default(text);
|
|
224
|
+
bbox = div.getBoundingClientRect();
|
|
225
|
+
dv.attr("width", bbox.width);
|
|
226
|
+
dv.attr("height", bbox.height);
|
|
227
|
+
}
|
|
228
|
+
const padding = 0 * node.padding;
|
|
229
|
+
const halfPadding = padding / 2;
|
|
230
|
+
const width = (node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width) + padding;
|
|
231
|
+
if (node.width <= bbox.width + node.padding) node.diff = (width - node.width) / 2 - node.padding;
|
|
232
|
+
else node.diff = -node.padding;
|
|
233
|
+
const height = node.height + padding;
|
|
234
|
+
const innerHeight = node.height + padding - bbox.height - 6;
|
|
235
|
+
const x = node.x - width / 2;
|
|
236
|
+
const y = node.y - height / 2;
|
|
237
|
+
node.width = width;
|
|
238
|
+
const innerY = node.y - node.height / 2 - halfPadding + bbox.height + 2;
|
|
239
|
+
let rect2;
|
|
240
|
+
if (node.look === "handDrawn") {
|
|
241
|
+
const isAlt = node.cssClasses.includes("statediagram-cluster-alt");
|
|
242
|
+
const rc = at.svg(shapeSvg);
|
|
243
|
+
const roughOuterNode = node.rx || node.ry ? rc.path(createRoundedRectPathD(x, y, width, height, 10), {
|
|
244
|
+
roughness: .7,
|
|
245
|
+
fill: compositeTitleBackground,
|
|
246
|
+
fillStyle: "solid",
|
|
247
|
+
stroke: nodeBorder,
|
|
248
|
+
seed: handDrawnSeed
|
|
249
|
+
}) : rc.rectangle(x, y, width, height, { seed: handDrawnSeed });
|
|
250
|
+
rect2 = shapeSvg.insert(() => roughOuterNode, ":first-child");
|
|
251
|
+
const roughInnerNode = rc.rectangle(x, innerY, width, innerHeight, {
|
|
252
|
+
fill: isAlt ? altBackground : compositeBackground,
|
|
253
|
+
fillStyle: isAlt ? "hachure" : "solid",
|
|
254
|
+
stroke: nodeBorder,
|
|
255
|
+
seed: handDrawnSeed
|
|
256
|
+
});
|
|
257
|
+
rect2 = shapeSvg.insert(() => roughOuterNode, ":first-child");
|
|
258
|
+
innerRect = shapeSvg.insert(() => roughInnerNode);
|
|
259
|
+
} else {
|
|
260
|
+
rect2 = outerRectG.insert("rect", ":first-child");
|
|
261
|
+
rect2.attr("class", "outer").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("data-look", node.look);
|
|
262
|
+
innerRect.attr("class", "inner").attr("x", x).attr("y", innerY).attr("width", width).attr("height", innerHeight);
|
|
263
|
+
}
|
|
264
|
+
label.attr("transform", `translate(${node.x - bbox.width / 2}, ${y + 1 - (getEffectiveHtmlLabels(siteConfig) ? 0 : 3)})`);
|
|
265
|
+
node.height = rect2.node().getBBox().height;
|
|
266
|
+
node.offsetX = 0;
|
|
267
|
+
node.offsetY = bbox.height - node.padding / 2;
|
|
268
|
+
node.labelBBox = bbox;
|
|
269
|
+
node.intersect = function(point) {
|
|
270
|
+
return intersect_rect_default(node, point);
|
|
271
|
+
};
|
|
272
|
+
return {
|
|
273
|
+
cluster: shapeSvg,
|
|
274
|
+
labelBBox: bbox
|
|
275
|
+
};
|
|
276
|
+
}, "roundedWithTitle"),
|
|
277
|
+
noteGroup: /* @__PURE__ */ __name((parent, node) => {
|
|
278
|
+
const shapeSvg = parent.insert("g").attr("class", "note-cluster").attr("id", node.domId);
|
|
279
|
+
const rect2 = shapeSvg.insert("rect", ":first-child");
|
|
280
|
+
const padding = 0 * node.padding;
|
|
281
|
+
const halfPadding = padding / 2;
|
|
282
|
+
rect2.attr("rx", node.rx).attr("ry", node.ry).attr("x", node.x - node.width / 2 - halfPadding).attr("y", node.y - node.height / 2 - halfPadding).attr("width", node.width + padding).attr("height", node.height + padding).attr("fill", "none");
|
|
283
|
+
const rectBox = rect2.node().getBBox();
|
|
284
|
+
node.width = rectBox.width;
|
|
285
|
+
node.height = rectBox.height;
|
|
286
|
+
node.intersect = function(point) {
|
|
287
|
+
return intersect_rect_default(node, point);
|
|
288
|
+
};
|
|
289
|
+
return {
|
|
290
|
+
cluster: shapeSvg,
|
|
291
|
+
labelBBox: {
|
|
292
|
+
width: 0,
|
|
293
|
+
height: 0
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
}, "noteGroup"),
|
|
297
|
+
divider: /* @__PURE__ */ __name((parent, node) => {
|
|
298
|
+
const { themeVariables, handDrawnSeed } = getConfig2();
|
|
299
|
+
const { nodeBorder } = themeVariables;
|
|
300
|
+
const shapeSvg = parent.insert("g").attr("class", node.cssClasses).attr("id", node.domId).attr("data-look", node.look);
|
|
301
|
+
const outerRectG = shapeSvg.insert("g", ":first-child");
|
|
302
|
+
const padding = 0 * node.padding;
|
|
303
|
+
const width = node.width + padding;
|
|
304
|
+
node.diff = -node.padding;
|
|
305
|
+
const height = node.height + padding;
|
|
306
|
+
const x = node.x - width / 2;
|
|
307
|
+
const y = node.y - height / 2;
|
|
308
|
+
node.width = width;
|
|
309
|
+
let rect2;
|
|
310
|
+
if (node.look === "handDrawn") {
|
|
311
|
+
const roughOuterNode = at.svg(shapeSvg).rectangle(x, y, width, height, {
|
|
312
|
+
fill: "lightgrey",
|
|
313
|
+
roughness: .5,
|
|
314
|
+
strokeLineDash: [5],
|
|
315
|
+
stroke: nodeBorder,
|
|
316
|
+
seed: handDrawnSeed
|
|
317
|
+
});
|
|
318
|
+
rect2 = shapeSvg.insert(() => roughOuterNode, ":first-child");
|
|
319
|
+
} else {
|
|
320
|
+
rect2 = outerRectG.insert("rect", ":first-child");
|
|
321
|
+
let outerRectClass = "outer";
|
|
322
|
+
if (node.look === "neo") outerRectClass = "divider";
|
|
323
|
+
else outerRectClass = "divider";
|
|
324
|
+
rect2.attr("class", outerRectClass).attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("data-look", node.look);
|
|
325
|
+
}
|
|
326
|
+
node.height = rect2.node().getBBox().height;
|
|
327
|
+
node.offsetX = 0;
|
|
328
|
+
node.offsetY = 0;
|
|
329
|
+
node.intersect = function(point) {
|
|
330
|
+
return intersect_rect_default(node, point);
|
|
331
|
+
};
|
|
332
|
+
return {
|
|
333
|
+
cluster: shapeSvg,
|
|
334
|
+
labelBBox: {}
|
|
335
|
+
};
|
|
336
|
+
}, "divider"),
|
|
337
|
+
kanbanSection: /* @__PURE__ */ __name(async (parent, node) => {
|
|
338
|
+
log.info("Creating subgraph rect for ", node.id, node);
|
|
339
|
+
const siteConfig = getConfig2();
|
|
340
|
+
const { themeVariables, handDrawnSeed } = siteConfig;
|
|
341
|
+
const { clusterBkg, clusterBorder } = themeVariables;
|
|
342
|
+
const { labelStyles, nodeStyles, borderStyles, backgroundStyles } = styles2String(node);
|
|
343
|
+
const shapeSvg = parent.insert("g").attr("class", "cluster " + node.cssClasses).attr("id", node.domId).attr("data-look", node.look);
|
|
344
|
+
const useHtmlLabels = getEffectiveHtmlLabels(siteConfig);
|
|
345
|
+
const labelEl = shapeSvg.insert("g").attr("class", "cluster-label ");
|
|
346
|
+
const text = await createText(labelEl, node.label, {
|
|
347
|
+
style: node.labelStyle,
|
|
348
|
+
useHtmlLabels,
|
|
349
|
+
isNode: true,
|
|
350
|
+
width: node.width
|
|
351
|
+
});
|
|
352
|
+
let bbox = text.getBBox();
|
|
353
|
+
if (getEffectiveHtmlLabels(siteConfig)) {
|
|
354
|
+
const div = text.children[0];
|
|
355
|
+
const dv = select_default(text);
|
|
356
|
+
bbox = div.getBoundingClientRect();
|
|
357
|
+
dv.attr("width", bbox.width);
|
|
358
|
+
dv.attr("height", bbox.height);
|
|
359
|
+
}
|
|
360
|
+
const width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;
|
|
361
|
+
if (node.width <= bbox.width + node.padding) node.diff = (width - node.width) / 2 - node.padding;
|
|
362
|
+
else node.diff = -node.padding;
|
|
363
|
+
const height = node.height;
|
|
364
|
+
const x = node.x - width / 2;
|
|
365
|
+
const y = node.y - height / 2;
|
|
366
|
+
log.trace("Data ", node, JSON.stringify(node));
|
|
367
|
+
let rect2;
|
|
368
|
+
if (node.look === "handDrawn") {
|
|
369
|
+
const rc = at.svg(shapeSvg);
|
|
370
|
+
const options = userNodeOverrides(node, {
|
|
371
|
+
roughness: .7,
|
|
372
|
+
fill: clusterBkg,
|
|
373
|
+
stroke: clusterBorder,
|
|
374
|
+
fillWeight: 4,
|
|
375
|
+
seed: handDrawnSeed
|
|
376
|
+
});
|
|
377
|
+
const roughNode = rc.path(createRoundedRectPathD(x, y, width, height, node.rx), options);
|
|
378
|
+
rect2 = shapeSvg.insert(() => {
|
|
379
|
+
log.debug("Rough node insert CXC", roughNode);
|
|
380
|
+
return roughNode;
|
|
381
|
+
}, ":first-child");
|
|
382
|
+
rect2.select("path:nth-child(2)").attr("style", borderStyles.join(";"));
|
|
383
|
+
rect2.select("path").attr("style", backgroundStyles.join(";").replace("fill", "stroke"));
|
|
384
|
+
} else {
|
|
385
|
+
rect2 = shapeSvg.insert("rect", ":first-child");
|
|
386
|
+
rect2.attr("style", nodeStyles).attr("rx", node.rx).attr("ry", node.ry).attr("x", x).attr("y", y).attr("width", width).attr("height", height);
|
|
387
|
+
}
|
|
388
|
+
const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig);
|
|
389
|
+
labelEl.attr("transform", `translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`);
|
|
390
|
+
if (labelStyles) {
|
|
391
|
+
const span = labelEl.select("span");
|
|
392
|
+
if (span) span.attr("style", labelStyles);
|
|
393
|
+
}
|
|
394
|
+
const rectBox = rect2.node().getBBox();
|
|
395
|
+
node.offsetX = 0;
|
|
396
|
+
node.width = rectBox.width;
|
|
397
|
+
node.height = rectBox.height;
|
|
398
|
+
node.offsetY = bbox.height - node.padding / 2;
|
|
399
|
+
node.intersect = function(point) {
|
|
400
|
+
return intersect_rect_default(node, point);
|
|
401
|
+
};
|
|
402
|
+
return {
|
|
403
|
+
cluster: shapeSvg,
|
|
404
|
+
labelBBox: bbox
|
|
405
|
+
};
|
|
406
|
+
}, "kanbanSection"),
|
|
407
|
+
swimlane
|
|
408
|
+
};
|
|
409
|
+
var clusterElems = /* @__PURE__ */ new Map();
|
|
410
|
+
var insertCluster = /* @__PURE__ */ __name(async (elem, node) => {
|
|
411
|
+
const cluster = await shapes[node.shape || "rect"](elem, node);
|
|
412
|
+
clusterElems.set(node.id, cluster);
|
|
413
|
+
return cluster;
|
|
414
|
+
}, "insertCluster");
|
|
415
|
+
var clear = /* @__PURE__ */ __name(() => {
|
|
416
|
+
clusterElems = /* @__PURE__ */ new Map();
|
|
417
|
+
}, "clear");
|
|
418
|
+
|
|
419
|
+
//#endregion
|
|
420
|
+
export { insertCluster as n, clear as t };
|