完成世界书、骰子、apiconfig页面处理

This commit is contained in:
2026-04-30 01:35:10 +08:00
parent a3e3711b2b
commit ba9b925c32
4602 changed files with 785225 additions and 23 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../../../parser/dist/chunks/mermaid-parser.core/chunk-EGIJ26TM.mjs"],
"sourcesContent": ["import {\n AbstractMermaidTokenBuilder,\n CommonValueConverter,\n InfoGrammarGeneratedModule,\n MermaidGeneratedSharedModule,\n __name\n} from \"./chunk-XZSTWKYB.mjs\";\n\n// src/language/info/module.ts\nimport {\n EmptyFileSystem,\n createDefaultCoreModule,\n createDefaultSharedCoreModule,\n inject\n} from \"langium\";\n\n// src/language/info/tokenBuilder.ts\nvar InfoTokenBuilder = class extends AbstractMermaidTokenBuilder {\n static {\n __name(this, \"InfoTokenBuilder\");\n }\n constructor() {\n super([\"info\", \"showInfo\"]);\n }\n};\n\n// src/language/info/module.ts\nvar InfoModule = {\n parser: {\n TokenBuilder: /* @__PURE__ */ __name(() => new InfoTokenBuilder(), \"TokenBuilder\"),\n ValueConverter: /* @__PURE__ */ __name(() => new CommonValueConverter(), \"ValueConverter\")\n }\n};\nfunction createInfoServices(context = EmptyFileSystem) {\n const shared = inject(\n createDefaultSharedCoreModule(context),\n MermaidGeneratedSharedModule\n );\n const Info = inject(\n createDefaultCoreModule({ shared }),\n InfoGrammarGeneratedModule,\n InfoModule\n );\n shared.ServiceRegistry.register(Info);\n return { shared, Info };\n}\n__name(createInfoServices, \"createInfoServices\");\n\nexport {\n InfoModule,\n createInfoServices\n};\n"],
"mappings": ";;;;;;;;;;;;;;;;;AAiBA,IAAI,mBAAmB,cAAc,4BAA4B;AAAA,EAjBjE,OAiBiE;AAAA;AAAA;AAAA,EAC/D,OAAO;AACL,IAAAA,QAAO,MAAM,kBAAkB;AAAA,EACjC;AAAA,EACA,cAAc;AACZ,UAAM,CAAC,QAAQ,UAAU,CAAC;AAAA,EAC5B;AACF;AAGA,IAAI,aAAa;AAAA,EACf,QAAQ;AAAA,IACN,cAA8B,gBAAAA,QAAO,MAAM,IAAI,iBAAiB,GAAG,cAAc;AAAA,IACjF,gBAAgC,gBAAAA,QAAO,MAAM,IAAI,qBAAqB,GAAG,gBAAgB;AAAA,EAC3F;AACF;AACA,SAAS,mBAAmB,UAAU,iBAAiB;AACrD,QAAM,SAAS;AAAA,IACb,8BAA8B,OAAO;AAAA,IACrC;AAAA,EACF;AACA,QAAM,OAAO;AAAA,IACX,wBAAwB,EAAE,OAAO,CAAC;AAAA,IAClC;AAAA,IACA;AAAA,EACF;AACA,SAAO,gBAAgB,SAAS,IAAI;AACpC,SAAO,EAAE,QAAQ,KAAK;AACxB;AAZS;AAaTA,QAAO,oBAAoB,oBAAoB;",
"names": ["__name"]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,68 @@
import {
parseFontSize
} from "./chunk-XCSQNVCT.mjs";
import {
defaultConfig_default,
getConfig2 as getConfig
} from "./chunk-UKMXQNCB.mjs";
import {
__name
} from "./chunk-FQFHLQFH.mjs";
// src/utils/subGraphTitleMargins.ts
var getSubGraphTitleMargins = /* @__PURE__ */ __name(({
flowchart
}) => {
const subGraphTitleTopMargin = flowchart?.subGraphTitleMargin?.top ?? 0;
const subGraphTitleBottomMargin = flowchart?.subGraphTitleMargin?.bottom ?? 0;
const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin;
return {
subGraphTitleTopMargin,
subGraphTitleBottomMargin,
subGraphTitleTotalMargin
};
}, "getSubGraphTitleMargins");
// src/rendering-util/rendering-elements/shapes/labelImageUtils.ts
async function configureLabelImages(container, labelText) {
const images = container.getElementsByTagName("img");
if (!images || images.length === 0) {
return;
}
const noImgText = labelText.replace(/<img[^>]*>/g, "").trim() === "";
await Promise.all(
[...images].map(
(img) => new Promise((res) => {
function setupImage() {
img.style.display = "flex";
img.style.flexDirection = "column";
if (noImgText) {
const bodyFontSize = getConfig().fontSize ? getConfig().fontSize : window.getComputedStyle(document.body).fontSize;
const enlargingFactor = 5;
const [parsedBodyFontSize = defaultConfig_default.fontSize] = parseFontSize(bodyFontSize);
const width = parsedBodyFontSize * enlargingFactor + "px";
img.style.minWidth = width;
img.style.maxWidth = width;
} else {
img.style.width = "100%";
}
res(img);
}
__name(setupImage, "setupImage");
setTimeout(() => {
if (img.complete) {
setupImage();
}
});
img.addEventListener("error", setupImage);
img.addEventListener("load", setupImage);
})
)
);
}
__name(configureLabelImages, "configureLabelImages");
export {
configureLabelImages,
getSubGraphTitleMargins
};

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../../../parser/dist/chunks/mermaid-parser.core/chunk-L3YUKLVL.mjs"],
"sourcesContent": ["import {\n AbstractMermaidTokenBuilder,\n CommonValueConverter,\n MermaidGeneratedSharedModule,\n RadarGrammarGeneratedModule,\n __name\n} from \"./chunk-XZSTWKYB.mjs\";\n\n// src/language/radar/module.ts\nimport {\n EmptyFileSystem,\n createDefaultCoreModule,\n createDefaultSharedCoreModule,\n inject\n} from \"langium\";\n\n// src/language/radar/tokenBuilder.ts\nvar RadarTokenBuilder = class extends AbstractMermaidTokenBuilder {\n static {\n __name(this, \"RadarTokenBuilder\");\n }\n constructor() {\n super([\"radar-beta\"]);\n }\n};\n\n// src/language/radar/module.ts\nvar RadarModule = {\n parser: {\n TokenBuilder: /* @__PURE__ */ __name(() => new RadarTokenBuilder(), \"TokenBuilder\"),\n ValueConverter: /* @__PURE__ */ __name(() => new CommonValueConverter(), \"ValueConverter\")\n }\n};\nfunction createRadarServices(context = EmptyFileSystem) {\n const shared = inject(\n createDefaultSharedCoreModule(context),\n MermaidGeneratedSharedModule\n );\n const Radar = inject(\n createDefaultCoreModule({ shared }),\n RadarGrammarGeneratedModule,\n RadarModule\n );\n shared.ServiceRegistry.register(Radar);\n return { shared, Radar };\n}\n__name(createRadarServices, \"createRadarServices\");\n\nexport {\n RadarModule,\n createRadarServices\n};\n"],
"mappings": ";;;;;;;;;;;;;;;;;AAiBA,IAAI,oBAAoB,cAAc,4BAA4B;AAAA,EAjBlE,OAiBkE;AAAA;AAAA;AAAA,EAChE,OAAO;AACL,IAAAA,QAAO,MAAM,mBAAmB;AAAA,EAClC;AAAA,EACA,cAAc;AACZ,UAAM,CAAC,YAAY,CAAC;AAAA,EACtB;AACF;AAGA,IAAI,cAAc;AAAA,EAChB,QAAQ;AAAA,IACN,cAA8B,gBAAAA,QAAO,MAAM,IAAI,kBAAkB,GAAG,cAAc;AAAA,IAClF,gBAAgC,gBAAAA,QAAO,MAAM,IAAI,qBAAqB,GAAG,gBAAgB;AAAA,EAC3F;AACF;AACA,SAAS,oBAAoB,UAAU,iBAAiB;AACtD,QAAM,SAAS;AAAA,IACb,8BAA8B,OAAO;AAAA,IACrC;AAAA,EACF;AACA,QAAM,QAAQ;AAAA,IACZ,wBAAwB,EAAE,OAAO,CAAC;AAAA,IAClC;AAAA,IACA;AAAA,EACF;AACA,SAAO,gBAAgB,SAAS,KAAK;AACrC,SAAO,EAAE,QAAQ,MAAM;AACzB;AAZS;AAaTA,QAAO,qBAAqB,qBAAqB;",
"names": ["__name"]
}

View File

@@ -0,0 +1,54 @@
import {
AbstractMermaidTokenBuilder,
CommonValueConverter,
EmptyFileSystem,
GitGraphGrammarGeneratedModule,
MermaidGeneratedSharedModule,
__name as __name2,
createDefaultCoreModule,
createDefaultSharedCoreModule,
inject,
lib_exports
} from "./chunk-S3MDV2AR.mjs";
import {
__name
} from "./chunk-FQFHLQFH.mjs";
// ../parser/dist/chunks/mermaid-parser.core/chunk-7E7YKBS2.mjs
var GitGraphTokenBuilder = class extends AbstractMermaidTokenBuilder {
static {
__name(this, "GitGraphTokenBuilder");
}
static {
__name2(this, "GitGraphTokenBuilder");
}
constructor() {
super(["gitGraph"]);
}
};
var GitGraphModule = {
parser: {
TokenBuilder: /* @__PURE__ */ __name2(() => new GitGraphTokenBuilder(), "TokenBuilder"),
ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter")
}
};
function createGitGraphServices(context = EmptyFileSystem) {
const shared = inject(
createDefaultSharedCoreModule(context),
MermaidGeneratedSharedModule
);
const GitGraph = inject(
createDefaultCoreModule({ shared }),
GitGraphGrammarGeneratedModule,
GitGraphModule
);
shared.ServiceRegistry.register(GitGraph);
return { shared, GitGraph };
}
__name(createGitGraphServices, "createGitGraphServices");
__name2(createGitGraphServices, "createGitGraphServices");
export {
GitGraphModule,
createGitGraphServices
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,132 @@
import {
require_dist
} from "./chunk-3OTVAOVH.mjs";
import {
lineBreakRegex
} from "./chunk-UKMXQNCB.mjs";
import {
select_default
} from "./chunk-GRVEB7DL.mjs";
import {
__name,
__toESM
} from "./chunk-FQFHLQFH.mjs";
// src/diagrams/common/svgDrawCommon.ts
var import_sanitize_url = __toESM(require_dist(), 1);
var drawRect = /* @__PURE__ */ __name((element, rectData) => {
const rectElement = element.append("rect");
rectElement.attr("x", rectData.x);
rectElement.attr("y", rectData.y);
rectElement.attr("fill", rectData.fill);
rectElement.attr("stroke", rectData.stroke);
rectElement.attr("width", rectData.width);
rectElement.attr("height", rectData.height);
if (rectData.name) {
rectElement.attr("name", rectData.name);
}
if (rectData.rx) {
rectElement.attr("rx", rectData.rx);
}
if (rectData.ry) {
rectElement.attr("ry", rectData.ry);
}
if (rectData.attrs !== void 0) {
for (const attrKey in rectData.attrs) {
rectElement.attr(attrKey, rectData.attrs[attrKey]);
}
}
if (rectData.class) {
rectElement.attr("class", rectData.class);
}
return rectElement;
}, "drawRect");
var drawBackgroundRect = /* @__PURE__ */ __name((element, bounds) => {
const rectData = {
x: bounds.startx,
y: bounds.starty,
width: bounds.stopx - bounds.startx,
height: bounds.stopy - bounds.starty,
fill: bounds.fill,
stroke: bounds.stroke,
class: "rect"
};
const rectElement = drawRect(element, rectData);
rectElement.lower();
}, "drawBackgroundRect");
var drawText = /* @__PURE__ */ __name((element, textData) => {
const nText = textData.text.replace(lineBreakRegex, " ");
const textElem = element.append("text");
textElem.attr("x", textData.x);
textElem.attr("y", textData.y);
textElem.attr("class", "legend");
textElem.style("text-anchor", textData.anchor);
if (textData.class) {
textElem.attr("class", textData.class);
}
const tspan = textElem.append("tspan");
tspan.attr("x", textData.x + textData.textMargin * 2);
tspan.text(nText);
return textElem;
}, "drawText");
var drawImage = /* @__PURE__ */ __name((elem, x, y, link) => {
const imageElement = elem.append("image");
imageElement.attr("x", x);
imageElement.attr("y", y);
const sanitizedLink = (0, import_sanitize_url.sanitizeUrl)(link);
imageElement.attr("xlink:href", sanitizedLink);
}, "drawImage");
var drawEmbeddedImage = /* @__PURE__ */ __name((element, x, y, link) => {
const imageElement = element.append("use");
imageElement.attr("x", x);
imageElement.attr("y", y);
const sanitizedLink = (0, import_sanitize_url.sanitizeUrl)(link);
imageElement.attr("xlink:href", `#${sanitizedLink}`);
}, "drawEmbeddedImage");
var getNoteRect = /* @__PURE__ */ __name(() => {
const noteRectData = {
x: 0,
y: 0,
width: 100,
height: 100,
fill: "#EDF2AE",
stroke: "#666",
anchor: "start",
rx: 0,
ry: 0
};
return noteRectData;
}, "getNoteRect");
var getTextObj = /* @__PURE__ */ __name(() => {
const testObject = {
x: 0,
y: 0,
width: 100,
height: 100,
"text-anchor": "start",
style: "#666",
textMargin: 0,
rx: 0,
ry: 0,
tspan: true
};
return testObject;
}, "getTextObj");
var createTooltip = /* @__PURE__ */ __name(() => {
let tooltipElem = select_default(".mermaidTooltip");
if (tooltipElem.empty()) {
tooltipElem = select_default("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0).style("position", "absolute").style("text-align", "center").style("max-width", "200px").style("padding", "2px").style("font-size", "12px").style("background", "#ffffde").style("border", "1px solid #333").style("border-radius", "2px").style("pointer-events", "none").style("z-index", "100");
}
return tooltipElem;
}, "createTooltip");
export {
drawRect,
drawBackgroundRect,
drawText,
drawImage,
drawEmbeddedImage,
getNoteRect,
getTextObj,
createTooltip
};

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../../src/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.ts"],
"sourcesContent": ["import { getConfig } from '../../../diagram-api/diagramAPI.js';\nimport type { Node } from '../../types.js';\n\n// Striped fill like start or fork nodes in state diagrams\nexport const solidStateFill = (color: string) => {\n const { handDrawnSeed } = getConfig();\n return {\n fill: color,\n hachureAngle: 120, // angle of hachure,\n hachureGap: 4,\n fillWeight: 2,\n roughness: 0.7,\n stroke: color,\n seed: handDrawnSeed,\n };\n};\n\nexport const compileStyles = (node: Node) => {\n // node.cssCompiledStyles is an array of strings in the form of 'key: value' where key is the css property and value is the value\n // the array is the styles of node from the classes it is using\n // node.cssStyles is an array of styles directly set on the node\n // concat the arrays and remove duplicates such that the values from node.cssStyles are used if there are duplicates\n const stylesMap = styles2Map([\n ...(node.cssCompiledStyles || []),\n ...(node.cssStyles || []),\n ...(node.labelStyle || []),\n ]);\n return { stylesMap, stylesArray: [...stylesMap] };\n};\n\nexport const styles2Map = (styles: string[]) => {\n const styleMap = new Map<string, string>();\n styles.forEach((style) => {\n const [key, value] = style.split(':');\n styleMap.set(key.trim(), value?.trim());\n });\n return styleMap;\n};\nexport const isLabelStyle = (key: string) => {\n return (\n key === 'color' ||\n key === 'font-size' ||\n key === 'font-family' ||\n key === 'font-weight' ||\n key === 'font-style' ||\n key === 'text-decoration' ||\n key === 'text-align' ||\n key === 'text-transform' ||\n key === 'line-height' ||\n key === 'letter-spacing' ||\n key === 'word-spacing' ||\n key === 'text-shadow' ||\n key === 'text-overflow' ||\n key === 'white-space' ||\n key === 'word-wrap' ||\n key === 'word-break' ||\n key === 'overflow-wrap' ||\n key === 'hyphens'\n );\n};\nexport const styles2String = (node: Node) => {\n const { stylesArray } = compileStyles(node);\n const labelStyles: string[] = [];\n const nodeStyles: string[] = [];\n const borderStyles: string[] = [];\n const backgroundStyles: string[] = [];\n\n stylesArray.forEach((style) => {\n const key = style[0];\n if (isLabelStyle(key)) {\n labelStyles.push(style.join(':') + ' !important');\n } else {\n nodeStyles.push(style.join(':') + ' !important');\n if (key.includes('stroke')) {\n borderStyles.push(style.join(':') + ' !important');\n }\n if (key === 'fill') {\n backgroundStyles.push(style.join(':') + ' !important');\n }\n }\n });\n\n return {\n labelStyles: labelStyles.join(';'),\n nodeStyles: nodeStyles.join(';'),\n stylesArray,\n borderStyles,\n backgroundStyles,\n };\n};\n\n// Striped fill like start or fork nodes in state diagrams\n// TODO remove any\nexport const userNodeOverrides = (node: Node, options: any) => {\n const { themeVariables, handDrawnSeed } = getConfig();\n const { nodeBorder, mainBkg } = themeVariables;\n const { stylesMap } = compileStyles(node);\n\n // index the style array to a map object\n const result = Object.assign(\n {\n roughness: 0.7,\n fill: stylesMap.get('fill') || mainBkg,\n fillStyle: 'hachure', // solid fill\n fillWeight: 4,\n hachureGap: 5.2,\n stroke: stylesMap.get('stroke') || nodeBorder,\n seed: handDrawnSeed,\n strokeWidth: stylesMap.get('stroke-width')?.replace('px', '') || 1.3,\n fillLineDash: [0, 0],\n strokeLineDash: getStrokeDashArray(stylesMap.get('stroke-dasharray')),\n },\n options\n );\n return result;\n};\n\nconst getStrokeDashArray = (strokeDasharrayStyle?: string) => {\n if (!strokeDasharrayStyle) {\n return [0, 0];\n }\n const dashArray = strokeDasharrayStyle.trim().split(/\\s+/).map(Number);\n if (dashArray.length === 1) {\n const val = isNaN(dashArray[0]) ? 0 : dashArray[0];\n return [val, val];\n }\n const first = isNaN(dashArray[0]) ? 0 : dashArray[0];\n const second = isNaN(dashArray[1]) ? 0 : dashArray[1];\n return [first, second];\n};\n"],
"mappings": ";;;;;;;;AAIO,IAAM,iBAAiB,wBAAC,UAAkB;AAC/C,QAAM,EAAE,cAAc,IAAI,UAAU;AACpC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,cAAc;AAAA;AAAA,IACd,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AACF,GAX8B;AAavB,IAAM,gBAAgB,wBAAC,SAAe;AAK3C,QAAM,YAAY,WAAW;AAAA,IAC3B,GAAI,KAAK,qBAAqB,CAAC;AAAA,IAC/B,GAAI,KAAK,aAAa,CAAC;AAAA,IACvB,GAAI,KAAK,cAAc,CAAC;AAAA,EAC1B,CAAC;AACD,SAAO,EAAE,WAAW,aAAa,CAAC,GAAG,SAAS,EAAE;AAClD,GAX6B;AAatB,IAAM,aAAa,wBAAC,WAAqB;AAC9C,QAAM,WAAW,oBAAI,IAAoB;AACzC,SAAO,QAAQ,CAAC,UAAU;AACxB,UAAM,CAAC,KAAK,KAAK,IAAI,MAAM,MAAM,GAAG;AACpC,aAAS,IAAI,IAAI,KAAK,GAAG,OAAO,KAAK,CAAC;AAAA,EACxC,CAAC;AACD,SAAO;AACT,GAP0B;AAQnB,IAAM,eAAe,wBAAC,QAAgB;AAC3C,SACE,QAAQ,WACR,QAAQ,eACR,QAAQ,iBACR,QAAQ,iBACR,QAAQ,gBACR,QAAQ,qBACR,QAAQ,gBACR,QAAQ,oBACR,QAAQ,iBACR,QAAQ,oBACR,QAAQ,kBACR,QAAQ,iBACR,QAAQ,mBACR,QAAQ,iBACR,QAAQ,eACR,QAAQ,gBACR,QAAQ,mBACR,QAAQ;AAEZ,GArB4B;AAsBrB,IAAM,gBAAgB,wBAAC,SAAe;AAC3C,QAAM,EAAE,YAAY,IAAI,cAAc,IAAI;AAC1C,QAAM,cAAwB,CAAC;AAC/B,QAAM,aAAuB,CAAC;AAC9B,QAAM,eAAyB,CAAC;AAChC,QAAM,mBAA6B,CAAC;AAEpC,cAAY,QAAQ,CAAC,UAAU;AAC7B,UAAM,MAAM,MAAM,CAAC;AACnB,QAAI,aAAa,GAAG,GAAG;AACrB,kBAAY,KAAK,MAAM,KAAK,GAAG,IAAI,aAAa;AAAA,IAClD,OAAO;AACL,iBAAW,KAAK,MAAM,KAAK,GAAG,IAAI,aAAa;AAC/C,UAAI,IAAI,SAAS,QAAQ,GAAG;AAC1B,qBAAa,KAAK,MAAM,KAAK,GAAG,IAAI,aAAa;AAAA,MACnD;AACA,UAAI,QAAQ,QAAQ;AAClB,yBAAiB,KAAK,MAAM,KAAK,GAAG,IAAI,aAAa;AAAA,MACvD;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,aAAa,YAAY,KAAK,GAAG;AAAA,IACjC,YAAY,WAAW,KAAK,GAAG;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GA7B6B;AAiCtB,IAAM,oBAAoB,wBAAC,MAAY,YAAiB;AAC7D,QAAM,EAAE,gBAAgB,cAAc,IAAI,UAAU;AACpD,QAAM,EAAE,YAAY,QAAQ,IAAI;AAChC,QAAM,EAAE,UAAU,IAAI,cAAc,IAAI;AAGxC,QAAM,SAAS,OAAO;AAAA,IACpB;AAAA,MACE,WAAW;AAAA,MACX,MAAM,UAAU,IAAI,MAAM,KAAK;AAAA,MAC/B,WAAW;AAAA;AAAA,MACX,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,QAAQ,UAAU,IAAI,QAAQ,KAAK;AAAA,MACnC,MAAM;AAAA,MACN,aAAa,UAAU,IAAI,cAAc,GAAG,QAAQ,MAAM,EAAE,KAAK;AAAA,MACjE,cAAc,CAAC,GAAG,CAAC;AAAA,MACnB,gBAAgB,mBAAmB,UAAU,IAAI,kBAAkB,CAAC;AAAA,IACtE;AAAA,IACA;AAAA,EACF;AACA,SAAO;AACT,GAtBiC;AAwBjC,IAAM,qBAAqB,wBAAC,yBAAkC;AAC5D,MAAI,CAAC,sBAAsB;AACzB,WAAO,CAAC,GAAG,CAAC;AAAA,EACd;AACA,QAAM,YAAY,qBAAqB,KAAK,EAAE,MAAM,KAAK,EAAE,IAAI,MAAM;AACrE,MAAI,UAAU,WAAW,GAAG;AAC1B,UAAM,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC;AACjD,WAAO,CAAC,KAAK,GAAG;AAAA,EAClB;AACA,QAAM,QAAQ,MAAM,UAAU,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC;AACnD,QAAM,SAAS,MAAM,UAAU,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC;AACpD,SAAO,CAAC,OAAO,MAAM;AACvB,GAZ2B;",
"names": []
}

View File

@@ -0,0 +1,21 @@
import {
select_default
} from "./chunk-GRVEB7DL.mjs";
import {
__name
} from "./chunk-FQFHLQFH.mjs";
// src/rendering-util/insertElementsForSize.js
var getDiagramElement = /* @__PURE__ */ __name((id, securityLevel) => {
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = select_default("#i" + id);
}
const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
const svg = root.select(`[id="${id}"]`);
return svg;
}, "getDiagramElement");
export {
getDiagramElement
};

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
import {
ClassDB,
classDiagram_default,
classRenderer_v3_unified_default,
styles_default
} from "./chunk-2WLNDWH6.mjs";
import "./chunk-SXA26SXQ.mjs";
import "./chunk-SBHDPRHC.mjs";
import "./chunk-U2CUWHSV.mjs";
import "./chunk-M4FGLBOT.mjs";
import "./chunk-EKL7DDBO.mjs";
import "./chunk-TZW2344G.mjs";
import "./chunk-UYNZS3GD.mjs";
import "./chunk-UAL2TQZE.mjs";
import "./chunk-FWQXANIB.mjs";
import "./chunk-D2KOLKXV.mjs";
import "./chunk-TEV7DDKD.mjs";
import "./chunk-YHLHMBDM.mjs";
import "./chunk-XCSQNVCT.mjs";
import "./chunk-3OTVAOVH.mjs";
import "./chunk-UKMXQNCB.mjs";
import "./chunk-GRVEB7DL.mjs";
import "./chunk-3QJOF6JT.mjs";
import {
__name
} from "./chunk-FQFHLQFH.mjs";
// src/diagrams/class/classDiagram-v2.ts
var diagram = {
parser: classDiagram_default,
get db() {
return new ClassDB();
},
renderer: classRenderer_v3_unified_default,
styles: styles_default,
init: /* @__PURE__ */ __name((cnf) => {
if (!cnf.class) {
cnf.class = {};
}
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
}, "init")
};
export {
diagram
};

View File

@@ -0,0 +1,582 @@
import {
populateCommonDb
} from "./chunk-WASTHULE.mjs";
import {
parse
} from "./chunk-6OSLE3NY.mjs";
import "./chunk-OBMQL7OE.mjs";
import "./chunk-BDXV45HO.mjs";
import "./chunk-ALB5NAU3.mjs";
import "./chunk-LYCWX5BJ.mjs";
import "./chunk-LIIAENVV.mjs";
import "./chunk-NUOAVMUD.mjs";
import {
selectSvgElement
} from "./chunk-NWP4V2O6.mjs";
import {
setupViewPortForSVG
} from "./chunk-M4FGLBOT.mjs";
import {
isLabelStyle,
styles2String
} from "./chunk-TEV7DDKD.mjs";
import {
cleanAndMerge
} from "./chunk-XCSQNVCT.mjs";
import "./chunk-3OTVAOVH.mjs";
import {
clear,
configureSvgSize,
defaultConfig_default,
getAccDescription,
getAccTitle,
getConfig,
getDiagramTitle,
setAccDescription,
setAccTitle,
setDiagramTitle
} from "./chunk-UKMXQNCB.mjs";
import {
format,
hierarchy,
log,
ordinal,
select_default,
treemap_default
} from "./chunk-GRVEB7DL.mjs";
import "./chunk-75NCXSTK.mjs";
import "./chunk-S3MDV2AR.mjs";
import "./chunk-MFRUYFWM.mjs";
import "./chunk-UKL4YMJ2.mjs";
import "./chunk-3QJOF6JT.mjs";
import {
__name
} from "./chunk-FQFHLQFH.mjs";
// src/diagrams/treemap/db.ts
var TreeMapDB = class {
constructor() {
this.nodes = [];
this.levels = /* @__PURE__ */ new Map();
this.outerNodes = [];
this.classes = /* @__PURE__ */ new Map();
this.setAccTitle = setAccTitle;
this.getAccTitle = getAccTitle;
this.setDiagramTitle = setDiagramTitle;
this.getDiagramTitle = getDiagramTitle;
this.getAccDescription = getAccDescription;
this.setAccDescription = setAccDescription;
}
static {
__name(this, "TreeMapDB");
}
getNodes() {
return this.nodes;
}
getConfig() {
const defaultConfig = defaultConfig_default;
const userConfig = getConfig();
return cleanAndMerge({
...defaultConfig.treemap,
...userConfig.treemap ?? {}
});
}
addNode(node, level) {
this.nodes.push(node);
this.levels.set(node, level);
if (level === 0) {
this.outerNodes.push(node);
this.root ??= node;
}
}
getRoot() {
return { name: "", children: this.outerNodes };
}
addClass(id, _style) {
const styleClass = this.classes.get(id) ?? { id, styles: [], textStyles: [] };
const styles = _style.replace(/\\,/g, "\xA7\xA7\xA7").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
if (styles) {
styles.forEach((s) => {
if (isLabelStyle(s)) {
if (styleClass?.textStyles) {
styleClass.textStyles.push(s);
} else {
styleClass.textStyles = [s];
}
}
if (styleClass?.styles) {
styleClass.styles.push(s);
} else {
styleClass.styles = [s];
}
});
}
this.classes.set(id, styleClass);
}
getClasses() {
return this.classes;
}
getStylesForClass(classSelector) {
return this.classes.get(classSelector)?.styles ?? [];
}
clear() {
clear();
this.nodes = [];
this.levels = /* @__PURE__ */ new Map();
this.outerNodes = [];
this.classes = /* @__PURE__ */ new Map();
this.root = void 0;
}
};
// src/diagrams/treemap/utils.ts
function buildHierarchy(items) {
if (!items.length) {
return [];
}
const root = [];
const stack = [];
items.forEach((item) => {
const node = {
name: item.name,
children: item.type === "Leaf" ? void 0 : []
};
node.classSelector = item?.classSelector;
if (item?.cssCompiledStyles) {
node.cssCompiledStyles = item.cssCompiledStyles;
}
if (item.type === "Leaf" && item.value !== void 0) {
node.value = item.value;
}
while (stack.length > 0 && stack[stack.length - 1].level >= item.level) {
stack.pop();
}
if (stack.length === 0) {
root.push(node);
} else {
const parent = stack[stack.length - 1].node;
if (parent.children) {
parent.children.push(node);
} else {
parent.children = [node];
}
}
if (item.type !== "Leaf") {
stack.push({ node, level: item.level });
}
});
return root;
}
__name(buildHierarchy, "buildHierarchy");
// src/diagrams/treemap/parser.ts
var populate = /* @__PURE__ */ __name((ast, db) => {
populateCommonDb(ast, db);
const items = [];
for (const row of ast.TreemapRows ?? []) {
if (row.$type === "ClassDefStatement") {
db.addClass(row.className ?? "", row.styleText ?? "");
}
}
for (const row of ast.TreemapRows ?? []) {
const item = row.item;
if (!item) {
continue;
}
const level = row.indent ? parseInt(row.indent) : 0;
const name = getItemName(item);
const styles = item.classSelector ? db.getStylesForClass(item.classSelector) : [];
const cssCompiledStyles = styles.length > 0 ? styles : void 0;
const itemData = {
level,
name,
type: item.$type,
value: item.value,
classSelector: item.classSelector,
cssCompiledStyles
};
items.push(itemData);
}
const hierarchyNodes = buildHierarchy(items);
const addNodesRecursively = /* @__PURE__ */ __name((nodes, level) => {
for (const node of nodes) {
db.addNode(node, level);
if (node.children && node.children.length > 0) {
addNodesRecursively(node.children, level + 1);
}
}
}, "addNodesRecursively");
addNodesRecursively(hierarchyNodes, 0);
}, "populate");
var getItemName = /* @__PURE__ */ __name((item) => {
return item.name ? String(item.name) : "";
}, "getItemName");
var parser = {
// @ts-expect-error - TreeMapDB is not assignable to DiagramDB
parser: { yy: void 0 },
parse: /* @__PURE__ */ __name(async (text) => {
try {
const parseFunc = parse;
const ast = await parseFunc("treemap", text);
log.debug("Treemap AST:", ast);
const db = parser.parser?.yy;
if (!(db instanceof TreeMapDB)) {
throw new Error(
"parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
);
}
populate(ast, db);
} catch (error) {
log.error("Error parsing treemap:", error);
throw error;
}
}, "parse")
};
// src/diagrams/treemap/renderer.ts
var DEFAULT_INNER_PADDING = 10;
var SECTION_INNER_PADDING = 10;
var SECTION_HEADER_HEIGHT = 25;
var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
const treemapDb = diagram2.db;
const config = treemapDb.getConfig();
const treemapInnerPadding = config.padding ?? DEFAULT_INNER_PADDING;
const title = treemapDb.getDiagramTitle();
const root = treemapDb.getRoot();
const { themeVariables } = getConfig();
if (!root) {
return;
}
const titleHeight = title ? 30 : 0;
const svg = selectSvgElement(id);
const width = config.nodeWidth ? config.nodeWidth * SECTION_INNER_PADDING : 960;
const height = config.nodeHeight ? config.nodeHeight * SECTION_INNER_PADDING : 500;
const svgWidth = width;
const svgHeight = height + titleHeight;
svg.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
configureSvgSize(svg, svgHeight, svgWidth, config.useMaxWidth);
let valueFormat;
try {
const formatStr = config.valueFormat || ",";
if (formatStr === "$0,0") {
valueFormat = /* @__PURE__ */ __name((value) => "$" + format(",")(value), "valueFormat");
} else if (formatStr.startsWith("$") && formatStr.includes(",")) {
const precision = /\.\d+/.exec(formatStr);
const precisionStr = precision ? precision[0] : "";
valueFormat = /* @__PURE__ */ __name((value) => "$" + format("," + precisionStr)(value), "valueFormat");
} else if (formatStr.startsWith("$")) {
const restOfFormat = formatStr.substring(1);
valueFormat = /* @__PURE__ */ __name((value) => "$" + format(restOfFormat || "")(value), "valueFormat");
} else {
valueFormat = format(formatStr);
}
} catch (error) {
log.error("Error creating format function:", error);
valueFormat = format(",");
}
const colorScale = ordinal().range([
"transparent",
themeVariables.cScale0,
themeVariables.cScale1,
themeVariables.cScale2,
themeVariables.cScale3,
themeVariables.cScale4,
themeVariables.cScale5,
themeVariables.cScale6,
themeVariables.cScale7,
themeVariables.cScale8,
themeVariables.cScale9,
themeVariables.cScale10,
themeVariables.cScale11
]);
const colorScalePeer = ordinal().range([
"transparent",
themeVariables.cScalePeer0,
themeVariables.cScalePeer1,
themeVariables.cScalePeer2,
themeVariables.cScalePeer3,
themeVariables.cScalePeer4,
themeVariables.cScalePeer5,
themeVariables.cScalePeer6,
themeVariables.cScalePeer7,
themeVariables.cScalePeer8,
themeVariables.cScalePeer9,
themeVariables.cScalePeer10,
themeVariables.cScalePeer11
]);
const colorScaleLabel = ordinal().range([
themeVariables.cScaleLabel0,
themeVariables.cScaleLabel1,
themeVariables.cScaleLabel2,
themeVariables.cScaleLabel3,
themeVariables.cScaleLabel4,
themeVariables.cScaleLabel5,
themeVariables.cScaleLabel6,
themeVariables.cScaleLabel7,
themeVariables.cScaleLabel8,
themeVariables.cScaleLabel9,
themeVariables.cScaleLabel10,
themeVariables.cScaleLabel11
]);
if (title) {
svg.append("text").attr("x", svgWidth / 2).attr("y", titleHeight / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title);
}
const g = svg.append("g").attr("transform", `translate(0, ${titleHeight})`).attr("class", "treemapContainer");
const hierarchyRoot = hierarchy(root).sum((d) => d.value ?? 0).sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
const treemapLayout = treemap_default().size([width, height]).paddingTop(
(d) => d.children && d.children.length > 0 ? SECTION_HEADER_HEIGHT + SECTION_INNER_PADDING : 0
).paddingInner(treemapInnerPadding).paddingLeft((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingRight((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingBottom((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).round(true);
const treemapData = treemapLayout(hierarchyRoot);
const branchNodes = treemapData.descendants().filter((d) => d.children && d.children.length > 0);
const sections = g.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class", "treemapSection").attr("transform", (d) => `translate(${d.x0},${d.y0})`);
sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", SECTION_HEADER_HEIGHT).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (d) => {
if (d.depth === 0) {
return "display: none;";
}
return "";
});
sections.append("clipPath").attr("id", (_d, i) => `clip-section-${id}-${i}`).append("rect").attr("width", (d) => Math.max(0, d.x1 - d.x0 - 12)).attr("height", SECTION_HEADER_HEIGHT);
sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", (_d, i) => {
return `treemapSection section${i}`;
}).attr("fill", (d) => colorScale(d.data.name)).attr("fill-opacity", 0.6).attr("stroke", (d) => colorScalePeer(d.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (d) => {
if (d.depth === 0) {
return "display: none;";
}
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
return styles.nodeStyles + ";" + styles.borderStyles.join(";");
});
sections.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", SECTION_HEADER_HEIGHT / 2).attr("dominant-baseline", "middle").text((d) => d.depth === 0 ? "" : d.data.name).attr("font-weight", "bold").attr("style", (d) => {
if (d.depth === 0) {
return "display: none;";
}
const labelStyles = "dominant-baseline: middle; font-size: 12px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
return labelStyles + styles.labelStyles.replace("color:", "fill:");
}).each(function(d) {
if (d.depth === 0) {
return;
}
const self = select_default(this);
const originalText = d.data.name;
self.text(originalText);
const totalHeaderWidth = d.x1 - d.x0;
const labelXPosition = 6;
let spaceForTextContent;
if (config.showValues !== false && d.value) {
const valueEndsAtXRelative = totalHeaderWidth - 10;
const estimatedValueTextActualWidth = 30;
const gapBetweenLabelAndValue = 10;
const labelMustEndBeforeX = valueEndsAtXRelative - estimatedValueTextActualWidth - gapBetweenLabelAndValue;
spaceForTextContent = labelMustEndBeforeX - labelXPosition;
} else {
const labelOwnRightPadding = 6;
spaceForTextContent = totalHeaderWidth - labelXPosition - labelOwnRightPadding;
}
const minimumWidthToDisplay = 15;
const actualAvailableWidth = Math.max(minimumWidthToDisplay, spaceForTextContent);
const textNode = self.node();
const currentTextContentLength = textNode.getComputedTextLength();
if (currentTextContentLength > actualAvailableWidth) {
const ellipsis = "...";
let currentTruncatedText = originalText;
while (currentTruncatedText.length > 0) {
currentTruncatedText = originalText.substring(0, currentTruncatedText.length - 1);
if (currentTruncatedText.length === 0) {
self.text(ellipsis);
if (textNode.getComputedTextLength() > actualAvailableWidth) {
self.text("");
}
break;
}
self.text(currentTruncatedText + ellipsis);
if (textNode.getComputedTextLength() <= actualAvailableWidth) {
break;
}
}
}
});
if (config.showValues !== false) {
sections.append("text").attr("class", "treemapSectionValue").attr("x", (d) => d.x1 - d.x0 - 10).attr("y", SECTION_HEADER_HEIGHT / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((d) => d.value ? valueFormat(d.value) : "").attr("font-style", "italic").attr("style", (d) => {
if (d.depth === 0) {
return "display: none;";
}
const labelStyles = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
return labelStyles + styles.labelStyles.replace("color:", "fill:");
});
}
const leafNodes = treemapData.leaves();
const cell = g.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class", (d, i) => {
return `treemapNode treemapLeafGroup leaf${i}${d.data.classSelector ? ` ${d.data.classSelector}` : ""}x`;
}).attr("transform", (d) => `translate(${d.x0},${d.y0})`);
cell.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", "treemapLeaf").attr("fill", (d) => {
return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
}).attr("style", (d) => {
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
return styles.nodeStyles;
}).attr("fill-opacity", 0.3).attr("stroke", (d) => {
return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
}).attr("stroke-width", 3);
cell.append("clipPath").attr("id", (_d, i) => `clip-${id}-${i}`).append("rect").attr("width", (d) => Math.max(0, d.x1 - d.x0 - 4)).attr("height", (d) => Math.max(0, d.y1 - d.y0 - 4));
const leafLabels = cell.append("text").attr("class", "treemapLabel").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", (d) => (d.y1 - d.y0) / 2).attr("style", (d) => {
const labelStyles = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + colorScaleLabel(d.data.name) + ";";
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
return labelStyles + styles.labelStyles.replace("color:", "fill:");
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.data.name);
leafLabels.each(function(d) {
const self = select_default(this);
const nodeWidth = d.x1 - d.x0;
const nodeHeight = d.y1 - d.y0;
const textNode = self.node();
const padding = 4;
const availableWidth = nodeWidth - 2 * padding;
const availableHeight = nodeHeight - 2 * padding;
if (availableWidth < 10 || availableHeight < 10) {
self.style("display", "none");
return;
}
let currentLabelFontSize = parseInt(self.style("font-size"), 10);
const minLabelFontSize = 8;
const originalValueRelFontSize = 28;
const valueScaleFactor = 0.6;
const minValueFontSize = 6;
const spacingBetweenLabelAndValue = 2;
while (textNode.getComputedTextLength() > availableWidth && currentLabelFontSize > minLabelFontSize) {
currentLabelFontSize--;
self.style("font-size", `${currentLabelFontSize}px`);
}
let prospectiveValueFontSize = Math.max(
minValueFontSize,
Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
);
let combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
while (combinedHeight > availableHeight && currentLabelFontSize > minLabelFontSize) {
currentLabelFontSize--;
prospectiveValueFontSize = Math.max(
minValueFontSize,
Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
);
if (prospectiveValueFontSize < minValueFontSize && currentLabelFontSize === minLabelFontSize) {
break;
}
self.style("font-size", `${currentLabelFontSize}px`);
combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
if (prospectiveValueFontSize <= minValueFontSize && combinedHeight > availableHeight) {
}
}
self.style("font-size", `${currentLabelFontSize}px`);
if (textNode.getComputedTextLength() > availableWidth || currentLabelFontSize < minLabelFontSize || availableHeight < currentLabelFontSize) {
self.style("display", "none");
}
});
if (config.showValues !== false) {
const leafValues = cell.append("text").attr("class", "treemapValue").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", function(d) {
return (d.y1 - d.y0) / 2;
}).attr("style", (d) => {
const labelStyles = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + colorScaleLabel(d.data.name) + ";";
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
return labelStyles + styles.labelStyles.replace("color:", "fill:");
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.value ? valueFormat(d.value) : "");
leafValues.each(function(d) {
const valueTextElement = select_default(this);
const parentCellNode = this.parentNode;
if (!parentCellNode) {
valueTextElement.style("display", "none");
return;
}
const labelElement = select_default(parentCellNode).select(".treemapLabel");
if (labelElement.empty() || labelElement.style("display") === "none") {
valueTextElement.style("display", "none");
return;
}
const finalLabelFontSize = parseFloat(labelElement.style("font-size"));
const originalValueFontSize = 28;
const valueScaleFactor = 0.6;
const minValueFontSize = 6;
const spacingBetweenLabelAndValue = 2;
const actualValueFontSize = Math.max(
minValueFontSize,
Math.min(originalValueFontSize, Math.round(finalLabelFontSize * valueScaleFactor))
);
valueTextElement.style("font-size", `${actualValueFontSize}px`);
const labelCenterY = (d.y1 - d.y0) / 2;
const valueTopActualY = labelCenterY + finalLabelFontSize / 2 + spacingBetweenLabelAndValue;
valueTextElement.attr("y", valueTopActualY);
const nodeWidth = d.x1 - d.x0;
const nodeTotalHeight = d.y1 - d.y0;
const cellBottomPadding = 4;
const maxValueBottomY = nodeTotalHeight - cellBottomPadding;
const availableWidthForValue = nodeWidth - 2 * 4;
if (valueTextElement.node().getComputedTextLength() > availableWidthForValue || valueTopActualY + actualValueFontSize > maxValueBottomY || actualValueFontSize < minValueFontSize) {
valueTextElement.style("display", "none");
} else {
valueTextElement.style("display", null);
}
});
}
const diagramPadding = config.diagramPadding ?? 8;
setupViewPortForSVG(svg, diagramPadding, "flowchart", config?.useMaxWidth || false);
}, "draw");
var getClasses = /* @__PURE__ */ __name(function(_text, diagramObj) {
return diagramObj.db.getClasses();
}, "getClasses");
var renderer = { draw, getClasses };
// src/diagrams/treemap/styles.ts
var defaultTreemapStyleOptions = {
sectionStrokeColor: "black",
sectionStrokeWidth: "1",
sectionFillColor: "#efefef",
leafStrokeColor: "black",
leafStrokeWidth: "1",
leafFillColor: "#efefef",
labelColor: "black",
labelFontSize: "12px",
valueFontSize: "10px",
valueColor: "black",
titleColor: "black",
titleFontSize: "14px"
};
var getStyles = /* @__PURE__ */ __name(({
treemap
} = {}) => {
const options = cleanAndMerge(defaultTreemapStyleOptions, treemap);
return `
.treemapNode.section {
stroke: ${options.sectionStrokeColor};
stroke-width: ${options.sectionStrokeWidth};
fill: ${options.sectionFillColor};
}
.treemapNode.leaf {
stroke: ${options.leafStrokeColor};
stroke-width: ${options.leafStrokeWidth};
fill: ${options.leafFillColor};
}
.treemapLabel {
fill: ${options.labelColor};
font-size: ${options.labelFontSize};
}
.treemapValue {
fill: ${options.valueColor};
font-size: ${options.valueFontSize};
}
.treemapTitle {
fill: ${options.titleColor};
font-size: ${options.titleFontSize};
}
`;
}, "getStyles");
var styles_default = getStyles;
// src/diagrams/treemap/diagram.ts
var diagram = {
parser,
get db() {
return new TreeMapDB();
},
renderer,
styles: styles_default
};
export {
diagram
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
import {
PacketModule,
createPacketServices
} from "./chunk-OBMQL7OE.mjs";
import "./chunk-S3MDV2AR.mjs";
import "./chunk-MFRUYFWM.mjs";
import "./chunk-UKL4YMJ2.mjs";
import "./chunk-3QJOF6JT.mjs";
import "./chunk-FQFHLQFH.mjs";
export {
PacketModule,
createPacketServices
};

View File

@@ -0,0 +1,236 @@
import {
populateCommonDb
} from "./chunk-WASTHULE.mjs";
import {
parse
} from "./chunk-6OSLE3NY.mjs";
import "./chunk-OBMQL7OE.mjs";
import "./chunk-BDXV45HO.mjs";
import "./chunk-ALB5NAU3.mjs";
import "./chunk-LYCWX5BJ.mjs";
import "./chunk-LIIAENVV.mjs";
import "./chunk-NUOAVMUD.mjs";
import {
selectSvgElement
} from "./chunk-NWP4V2O6.mjs";
import {
cleanAndMerge,
parseFontSize
} from "./chunk-XCSQNVCT.mjs";
import "./chunk-3OTVAOVH.mjs";
import {
clear,
configureSvgSize,
defaultConfig_default,
getAccDescription,
getAccTitle,
getConfig2 as getConfig,
getDiagramTitle,
setAccDescription,
setAccTitle,
setDiagramTitle
} from "./chunk-UKMXQNCB.mjs";
import {
arc_default,
log,
ordinal,
pie_default
} from "./chunk-GRVEB7DL.mjs";
import "./chunk-75NCXSTK.mjs";
import "./chunk-S3MDV2AR.mjs";
import "./chunk-MFRUYFWM.mjs";
import "./chunk-UKL4YMJ2.mjs";
import "./chunk-3QJOF6JT.mjs";
import {
__name
} from "./chunk-FQFHLQFH.mjs";
// src/diagrams/pie/pieDb.ts
var DEFAULT_PIE_CONFIG = defaultConfig_default.pie;
var DEFAULT_PIE_DB = {
sections: /* @__PURE__ */ new Map(),
showData: false,
config: DEFAULT_PIE_CONFIG
};
var sections = DEFAULT_PIE_DB.sections;
var showData = DEFAULT_PIE_DB.showData;
var config = structuredClone(DEFAULT_PIE_CONFIG);
var getConfig2 = /* @__PURE__ */ __name(() => structuredClone(config), "getConfig");
var clear2 = /* @__PURE__ */ __name(() => {
sections = /* @__PURE__ */ new Map();
showData = DEFAULT_PIE_DB.showData;
clear();
}, "clear");
var addSection = /* @__PURE__ */ __name(({ label, value }) => {
if (value < 0) {
throw new Error(
`"${label}" has invalid value: ${value}. Negative values are not allowed in pie charts. All slice values must be >= 0.`
);
}
if (!sections.has(label)) {
sections.set(label, value);
log.debug(`added new section: ${label}, with value: ${value}`);
}
}, "addSection");
var getSections = /* @__PURE__ */ __name(() => sections, "getSections");
var setShowData = /* @__PURE__ */ __name((toggle) => {
showData = toggle;
}, "setShowData");
var getShowData = /* @__PURE__ */ __name(() => showData, "getShowData");
var db = {
getConfig: getConfig2,
clear: clear2,
setDiagramTitle,
getDiagramTitle,
setAccTitle,
getAccTitle,
setAccDescription,
getAccDescription,
addSection,
getSections,
setShowData,
getShowData
};
// src/diagrams/pie/pieParser.ts
var populateDb = /* @__PURE__ */ __name((ast, db2) => {
populateCommonDb(ast, db2);
db2.setShowData(ast.showData);
ast.sections.map(db2.addSection);
}, "populateDb");
var parser = {
parse: /* @__PURE__ */ __name(async (input) => {
const ast = await parse("pie", input);
log.debug(ast);
populateDb(ast, db);
}, "parse")
};
// src/diagrams/pie/pieStyles.ts
var getStyles = /* @__PURE__ */ __name((options) => `
.pieCircle{
stroke: ${options.pieStrokeColor};
stroke-width : ${options.pieStrokeWidth};
opacity : ${options.pieOpacity};
}
.pieOuterCircle{
stroke: ${options.pieOuterStrokeColor};
stroke-width: ${options.pieOuterStrokeWidth};
fill: none;
}
.pieTitleText {
text-anchor: middle;
font-size: ${options.pieTitleTextSize};
fill: ${options.pieTitleTextColor};
font-family: ${options.fontFamily};
}
.slice {
font-family: ${options.fontFamily};
fill: ${options.pieSectionTextColor};
font-size:${options.pieSectionTextSize};
// fill: white;
}
.legend text {
fill: ${options.pieLegendTextColor};
font-family: ${options.fontFamily};
font-size: ${options.pieLegendTextSize};
}
`, "getStyles");
var pieStyles_default = getStyles;
// src/diagrams/pie/pieRenderer.ts
var createPieArcs = /* @__PURE__ */ __name((sections2) => {
const sum = [...sections2.values()].reduce((acc, val) => acc + val, 0);
const pieData = [...sections2.entries()].map(([label, value]) => ({ label, value })).filter((d) => d.value / sum * 100 >= 1).sort((a, b) => b.value - a.value);
const pie = pie_default().value((d) => d.value);
return pie(pieData);
}, "createPieArcs");
var draw = /* @__PURE__ */ __name((text, id, _version, diagObj) => {
log.debug("rendering pie chart\n" + text);
const db2 = diagObj.db;
const globalConfig = getConfig();
const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
const MARGIN = 40;
const LEGEND_RECT_SIZE = 18;
const LEGEND_SPACING = 4;
const height = 450;
const pieWidth = height;
const svg = selectSvgElement(id);
const group = svg.append("g");
group.attr("transform", "translate(" + pieWidth / 2 + "," + height / 2 + ")");
const { themeVariables } = globalConfig;
let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
outerStrokeWidth ??= 2;
const textPosition = pieConfig.textPosition;
const radius = Math.min(pieWidth, height) / 2 - MARGIN;
const arcGenerator = arc_default().innerRadius(0).outerRadius(radius);
const labelArcGenerator = arc_default().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
group.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
const sections2 = db2.getSections();
const arcs = createPieArcs(sections2);
const myGeneratedColors = [
themeVariables.pie1,
themeVariables.pie2,
themeVariables.pie3,
themeVariables.pie4,
themeVariables.pie5,
themeVariables.pie6,
themeVariables.pie7,
themeVariables.pie8,
themeVariables.pie9,
themeVariables.pie10,
themeVariables.pie11,
themeVariables.pie12
];
let sum = 0;
sections2.forEach((section) => {
sum += section;
});
const filteredArcs = arcs.filter((datum) => (datum.data.value / sum * 100).toFixed(0) !== "0");
const color = ordinal(myGeneratedColors);
group.selectAll("mySlices").data(filteredArcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
return color(datum.data.label);
}).attr("class", "pieCircle");
group.selectAll("mySlices").data(filteredArcs).enter().append("text").text((datum) => {
return (datum.data.value / sum * 100).toFixed(0) + "%";
}).attr("transform", (datum) => {
return "translate(" + labelArcGenerator.centroid(datum) + ")";
}).style("text-anchor", "middle").attr("class", "slice");
group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -(height - 50) / 2).attr("class", "pieTitleText");
const allSectionData = [...sections2.entries()].map(([label, value]) => ({
label,
value
}));
const legend = group.selectAll(".legend").data(allSectionData).enter().append("g").attr("class", "legend").attr("transform", (_datum, index) => {
const height2 = LEGEND_RECT_SIZE + LEGEND_SPACING;
const offset = height2 * allSectionData.length / 2;
const horizontal = 12 * LEGEND_RECT_SIZE;
const vertical = index * height2 - offset;
return "translate(" + horizontal + "," + vertical + ")";
});
legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", (d) => color(d.label)).style("stroke", (d) => color(d.label));
legend.append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((d) => {
if (db2.getShowData()) {
return `${d.label} [${d.value}]`;
}
return d.label;
});
const longestTextWidth = Math.max(
...legend.selectAll("text").nodes().map((node) => node?.getBoundingClientRect().width ?? 0)
);
const totalWidth = pieWidth + MARGIN + LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
svg.attr("viewBox", `0 0 ${totalWidth} ${height}`);
configureSvgSize(svg, height, totalWidth, pieConfig.useMaxWidth);
}, "draw");
var renderer = { draw };
// src/diagrams/pie/pieDiagram.ts
var diagram = {
parser,
db,
renderer,
styles: pieStyles_default
};
export {
diagram
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,498 @@
import {
StateDB,
stateDiagram_default,
styles_default
} from "./chunk-3VXWS7DV.mjs";
import {
layout
} from "./chunk-6JEIXYVA.mjs";
import {
Graph
} from "./chunk-KACY6BU5.mjs";
import "./chunk-U2CUWHSV.mjs";
import "./chunk-M4FGLBOT.mjs";
import "./chunk-EKL7DDBO.mjs";
import "./chunk-TZW2344G.mjs";
import "./chunk-UYNZS3GD.mjs";
import "./chunk-UAL2TQZE.mjs";
import "./chunk-FWQXANIB.mjs";
import "./chunk-D2KOLKXV.mjs";
import "./chunk-TEV7DDKD.mjs";
import "./chunk-YHLHMBDM.mjs";
import {
utils_default
} from "./chunk-XCSQNVCT.mjs";
import "./chunk-3OTVAOVH.mjs";
import {
common_default,
configureSvgSize,
getConfig2 as getConfig,
getUrl
} from "./chunk-UKMXQNCB.mjs";
import {
basis_default,
line_default,
log,
select_default
} from "./chunk-GRVEB7DL.mjs";
import "./chunk-MFRUYFWM.mjs";
import "./chunk-UKL4YMJ2.mjs";
import "./chunk-3QJOF6JT.mjs";
import {
__name
} from "./chunk-FQFHLQFH.mjs";
// src/diagrams/state/shapes.js
var drawStartState = /* @__PURE__ */ __name((g) => g.append("circle").attr("class", "start-state").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit), "drawStartState");
var drawDivider = /* @__PURE__ */ __name((g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig().state.textHeight).attr("class", "divider").attr("x2", getConfig().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
var drawSimpleState = /* @__PURE__ */ __name((g, stateDef) => {
const state = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 2 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
const classBox = state.node().getBBox();
g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", classBox.width + 2 * getConfig().state.padding).attr("height", classBox.height + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
return state;
}, "drawSimpleState");
var drawDescrState = /* @__PURE__ */ __name((g, stateDef) => {
const addTspan = /* @__PURE__ */ __name(function(textEl, txt, isFirst2) {
const tSpan = textEl.append("tspan").attr("x", 2 * getConfig().state.padding).text(txt);
if (!isFirst2) {
tSpan.attr("dy", getConfig().state.textHeight);
}
}, "addTspan");
const title = g.append("text").attr("x", 2 * getConfig().state.padding).attr("y", getConfig().state.textHeight + 1.3 * getConfig().state.padding).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
const titleBox = title.node().getBBox();
const titleHeight = titleBox.height;
const description = g.append("text").attr("x", getConfig().state.padding).attr(
"y",
titleHeight + getConfig().state.padding * 0.4 + getConfig().state.dividerMargin + getConfig().state.textHeight
).attr("class", "state-description");
let isFirst = true;
let isSecond = true;
stateDef.descriptions.forEach(function(descr) {
if (!isFirst) {
addTspan(description, descr, isSecond);
isSecond = false;
}
isFirst = false;
});
const descrLine = g.append("line").attr("x1", getConfig().state.padding).attr("y1", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("y2", getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2).attr("class", "descr-divider");
const descrBox = description.node().getBBox();
const width = Math.max(descrBox.width, titleBox.width);
descrLine.attr("x2", width + 3 * getConfig().state.padding);
g.insert("rect", ":first-child").attr("x", getConfig().state.padding).attr("y", getConfig().state.padding).attr("width", width + 2 * getConfig().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig().state.padding).attr("rx", getConfig().state.radius);
return g;
}, "drawDescrState");
var addTitleAndBox = /* @__PURE__ */ __name((g, stateDef, altBkg) => {
const pad = getConfig().state.padding;
const dblPad = 2 * getConfig().state.padding;
const orgBox = g.node().getBBox();
const orgWidth = orgBox.width;
const orgX = orgBox.x;
const title = g.append("text").attr("x", 0).attr("y", getConfig().state.titleShift).attr("font-size", getConfig().state.fontSize).attr("class", "state-title").text(stateDef.id);
const titleBox = title.node().getBBox();
const titleWidth = titleBox.width + dblPad;
let width = Math.max(titleWidth, orgWidth);
if (width === orgWidth) {
width = width + dblPad;
}
let startX;
const graphBox = g.node().getBBox();
if (stateDef.doc) {
}
startX = orgX - pad;
if (titleWidth > orgWidth) {
startX = (orgWidth - width) / 2 + pad;
}
if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
startX = orgX - (titleWidth - orgWidth) / 2;
}
const lineY = 1 - getConfig().state.textHeight;
g.insert("rect", ":first-child").attr("x", startX).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width).attr(
"height",
graphBox.height + getConfig().state.textHeight + getConfig().state.titleShift + 1
).attr("rx", "0");
title.attr("x", startX + pad);
if (titleWidth <= orgWidth) {
title.attr("x", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);
}
g.insert("rect", ":first-child").attr("x", startX).attr(
"y",
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
).attr("width", width).attr("height", getConfig().state.textHeight * 3).attr("rx", getConfig().state.radius);
g.insert("rect", ":first-child").attr("x", startX).attr(
"y",
getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding
).attr("width", width).attr("height", graphBox.height + 3 + 2 * getConfig().state.textHeight).attr("rx", getConfig().state.radius);
return g;
}, "addTitleAndBox");
var drawEndState = /* @__PURE__ */ __name((g) => {
g.append("circle").attr("class", "end-state-outer").attr("r", getConfig().state.sizeUnit + getConfig().state.miniPadding).attr(
"cx",
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
).attr(
"cy",
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
);
return g.append("circle").attr("class", "end-state-inner").attr("r", getConfig().state.sizeUnit).attr("cx", getConfig().state.padding + getConfig().state.sizeUnit + 2).attr("cy", getConfig().state.padding + getConfig().state.sizeUnit + 2);
}, "drawEndState");
var drawForkJoinState = /* @__PURE__ */ __name((g, stateDef) => {
let width = getConfig().state.forkWidth;
let height = getConfig().state.forkHeight;
if (stateDef.parentId) {
let tmp = width;
width = height;
height = tmp;
}
return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", getConfig().state.padding).attr("y", getConfig().state.padding);
}, "drawForkJoinState");
var _drawLongText = /* @__PURE__ */ __name((_text, x, y, g) => {
let textHeight = 0;
const textElem = g.append("text");
textElem.style("text-anchor", "start");
textElem.attr("class", "noteText");
let text = _text.replace(/\r\n/g, "<br/>");
text = text.replace(/\n/g, "<br/>");
const lines = text.split(common_default.lineBreakRegex);
let tHeight = 1.25 * getConfig().state.noteMargin;
for (const line of lines) {
const txt = line.trim();
if (txt.length > 0) {
const span = textElem.append("tspan");
span.text(txt);
if (tHeight === 0) {
const textBounds = span.node().getBBox();
tHeight += textBounds.height;
}
textHeight += tHeight;
span.attr("x", x + getConfig().state.noteMargin);
span.attr("y", y + textHeight + 1.25 * getConfig().state.noteMargin);
}
}
return { textWidth: textElem.node().getBBox().width, textHeight };
}, "_drawLongText");
var drawNote = /* @__PURE__ */ __name((text, g) => {
g.attr("class", "state-note");
const note = g.append("rect").attr("x", 0).attr("y", getConfig().state.padding);
const rectElem = g.append("g");
const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
note.attr("height", textHeight + 2 * getConfig().state.noteMargin);
note.attr("width", textWidth + getConfig().state.noteMargin * 2);
return note;
}, "drawNote");
var drawState = /* @__PURE__ */ __name(function(elem, stateDef) {
const id = stateDef.id;
const stateInfo = {
id,
label: stateDef.id,
width: 0,
height: 0
};
const g = elem.append("g").attr("id", id).attr("class", "stateGroup");
if (stateDef.type === "start") {
drawStartState(g);
}
if (stateDef.type === "end") {
drawEndState(g);
}
if (stateDef.type === "fork" || stateDef.type === "join") {
drawForkJoinState(g, stateDef);
}
if (stateDef.type === "note") {
drawNote(stateDef.note.text, g);
}
if (stateDef.type === "divider") {
drawDivider(g);
}
if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
drawSimpleState(g, stateDef);
}
if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
drawDescrState(g, stateDef);
}
const stateBox = g.node().getBBox();
stateInfo.width = stateBox.width + 2 * getConfig().state.padding;
stateInfo.height = stateBox.height + 2 * getConfig().state.padding;
return stateInfo;
}, "drawState");
var edgeCount = 0;
var drawEdge = /* @__PURE__ */ __name(function(elem, path, relation) {
const getRelationType = /* @__PURE__ */ __name(function(type) {
switch (type) {
case StateDB.relationType.AGGREGATION:
return "aggregation";
case StateDB.relationType.EXTENSION:
return "extension";
case StateDB.relationType.COMPOSITION:
return "composition";
case StateDB.relationType.DEPENDENCY:
return "dependency";
}
}, "getRelationType");
path.points = path.points.filter((p) => !Number.isNaN(p.y));
const lineData = path.points;
const lineFunction = line_default().x(function(d) {
return d.x;
}).y(function(d) {
return d.y;
}).curve(basis_default);
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
let url = "";
if (getConfig().state.arrowMarkerAbsolute) {
url = getUrl(true);
}
svgPath.attr(
"marker-end",
"url(" + url + "#" + getRelationType(StateDB.relationType.DEPENDENCY) + "End)"
);
if (relation.title !== void 0) {
const label = elem.append("g").attr("class", "stateLabel");
const { x, y } = utils_default.calcLabelPosition(path.points);
const rows = common_default.getRows(relation.title);
let titleHeight = 0;
const titleRows = [];
let maxWidth = 0;
let minX = 0;
for (let i = 0; i <= rows.length; i++) {
const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
const boundsTmp = title.node().getBBox();
maxWidth = Math.max(maxWidth, boundsTmp.width);
minX = Math.min(minX, boundsTmp.x);
log.info(boundsTmp.x, x, y + titleHeight);
if (titleHeight === 0) {
const titleBox = title.node().getBBox();
titleHeight = titleBox.height;
log.info("Title height", titleHeight, y);
}
titleRows.push(title);
}
let boxHeight = titleHeight * rows.length;
if (rows.length > 1) {
const heightAdj = (rows.length - 1) * titleHeight * 0.5;
titleRows.forEach((title, i) => title.attr("y", y + i * titleHeight - heightAdj));
boxHeight = titleHeight * rows.length;
}
const bounds = label.node().getBBox();
label.insert("rect", ":first-child").attr("class", "box").attr("x", x - maxWidth / 2 - getConfig().state.padding / 2).attr("y", y - boxHeight / 2 - getConfig().state.padding / 2 - 3.5).attr("width", maxWidth + getConfig().state.padding).attr("height", boxHeight + getConfig().state.padding);
log.info(bounds);
}
edgeCount++;
}, "drawEdge");
// src/diagrams/state/stateRenderer.js
var conf;
var transformationLog = {};
var setConf = /* @__PURE__ */ __name(function() {
}, "setConf");
var insertMarkers = /* @__PURE__ */ __name(function(elem) {
elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
}, "insertMarkers");
var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
conf = getConfig().state;
const securityLevel = getConfig().securityLevel;
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = select_default("#i" + id);
}
const root = securityLevel === "sandbox" ? select_default(sandboxElement.nodes()[0].contentDocument.body) : select_default("body");
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
log.debug("Rendering diagram " + text);
const diagram2 = root.select(`[id='${id}']`);
insertMarkers(diagram2);
const rootDoc = diagObj.db.getRootDoc();
renderDoc(rootDoc, diagram2, void 0, false, root, doc, diagObj);
const padding = conf.padding;
const bounds = diagram2.node().getBBox();
const width = bounds.width + padding * 2;
const height = bounds.height + padding * 2;
const svgWidth = width * 1.75;
configureSvgSize(diagram2, height, svgWidth, conf.useMaxWidth);
diagram2.attr(
"viewBox",
`${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + " " + height
);
}, "draw");
var getLabelWidth = /* @__PURE__ */ __name((text) => {
return text ? text.length * conf.fontSizeFactor : 1;
}, "getLabelWidth");
var renderDoc = /* @__PURE__ */ __name((doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
const graph = new Graph({
compound: true,
multigraph: true
});
let i;
let edgeFreeDoc = true;
for (i = 0; i < doc.length; i++) {
if (doc[i].stmt === "relation") {
edgeFreeDoc = false;
break;
}
}
if (parentId) {
graph.setGraph({
rankdir: "LR",
multigraph: true,
compound: true,
// acyclicer: 'greedy',
ranker: "tight-tree",
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
nodeSep: edgeFreeDoc ? 1 : 50,
isMultiGraph: true
// ranksep: 5,
// nodesep: 1
});
} else {
graph.setGraph({
rankdir: "TB",
multigraph: true,
compound: true,
// isCompound: true,
// acyclicer: 'greedy',
// ranker: 'longest-path'
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
nodeSep: edgeFreeDoc ? 1 : 50,
ranker: "tight-tree",
// ranker: 'network-simplex'
isMultiGraph: true
});
}
graph.setDefaultEdgeLabel(function() {
return {};
});
const states = diagObj.db.getStates();
const relations = diagObj.db.getRelations();
const keys = Object.keys(states);
let first = true;
for (const key of keys) {
const stateDef = states[key];
if (parentId) {
stateDef.parentId = parentId;
}
let node;
if (stateDef.doc) {
let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
if (first) {
sub = addTitleAndBox(sub, stateDef, altBkg);
let boxBounds = sub.node().getBBox();
node.width = boxBounds.width;
node.height = boxBounds.height + conf.padding / 2;
transformationLog[stateDef.id] = { y: conf.compositTitleSize };
} else {
let boxBounds = sub.node().getBBox();
node.width = boxBounds.width;
node.height = boxBounds.height;
}
} else {
node = drawState(diagram2, stateDef, graph);
}
if (stateDef.note) {
const noteDef = {
descriptions: [],
id: stateDef.id + "-note",
note: stateDef.note,
type: "note"
};
const note = drawState(diagram2, noteDef, graph);
if (stateDef.note.position === "left of") {
graph.setNode(node.id + "-note", note);
graph.setNode(node.id, node);
} else {
graph.setNode(node.id, node);
graph.setNode(node.id + "-note", note);
}
graph.setParent(node.id, node.id + "-group");
graph.setParent(node.id + "-note", node.id + "-group");
} else {
graph.setNode(node.id, node);
}
}
log.debug("Count=", graph.nodeCount(), graph);
let cnt = 0;
relations.forEach(function(relation) {
cnt++;
log.debug("Setting edge", relation);
graph.setEdge(
relation.id1,
relation.id2,
{
relation,
width: getLabelWidth(relation.title),
height: conf.labelHeight * common_default.getRows(relation.title).length,
labelpos: "c"
},
"id" + cnt
);
});
layout(graph);
log.debug("Graph after layout", graph.nodes());
const svgElem = diagram2.node();
graph.nodes().forEach(function(v) {
if (v !== void 0 && graph.node(v) !== void 0) {
log.warn("Node " + v + ": " + JSON.stringify(graph.node(v)));
root.select("#" + svgElem.id + " #" + v).attr(
"transform",
"translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + " )"
);
root.select("#" + svgElem.id + " #" + v).attr("data-x-shift", graph.node(v).x - graph.node(v).width / 2);
const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v + " .divider");
dividers.forEach((divider) => {
const parent = divider.parentElement;
let pWidth = 0;
let pShift = 0;
if (parent) {
if (parent.parentElement) {
pWidth = parent.parentElement.getBBox().width;
}
pShift = parseInt(parent.getAttribute("data-x-shift"), 10);
if (Number.isNaN(pShift)) {
pShift = 0;
}
}
divider.setAttribute("x1", 0 - pShift + 8);
divider.setAttribute("x2", pWidth - pShift - 8);
});
} else {
log.debug("No Node " + v + ": " + JSON.stringify(graph.node(v)));
}
});
let stateBox = svgElem.getBBox();
graph.edges().forEach(function(e) {
if (e !== void 0 && graph.edge(e) !== void 0) {
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
drawEdge(diagram2, graph.edge(e), graph.edge(e).relation);
}
});
stateBox = svgElem.getBBox();
const stateInfo = {
id: parentId ? parentId : "root",
label: parentId ? parentId : "root",
width: 0,
height: 0
};
stateInfo.width = stateBox.width + 2 * conf.padding;
stateInfo.height = stateBox.height + 2 * conf.padding;
log.debug("Doc rendered", stateInfo, graph);
return stateInfo;
}, "renderDoc");
var stateRenderer_default = {
setConf,
draw
};
// src/diagrams/state/stateDiagram.ts
var diagram = {
parser: stateDiagram_default,
get db() {
return new StateDB(1);
},
renderer: stateRenderer_default,
styles: styles_default,
init: /* @__PURE__ */ __name((cnf) => {
if (!cnf.state) {
cnf.state = {};
}
cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
}, "init")
};
export {
diagram
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
import {
TreemapModule,
createTreemapServices
} from "./chunk-NUOAVMUD.mjs";
import "./chunk-S3MDV2AR.mjs";
import "./chunk-MFRUYFWM.mjs";
import "./chunk-UKL4YMJ2.mjs";
import "./chunk-3QJOF6JT.mjs";
import "./chunk-FQFHLQFH.mjs";
export {
TreemapModule,
createTreemapServices
};

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

File diff suppressed because one or more lines are too long