new: [UI] mermaid.js added
parent
b6458d862a
commit
a0fedb011c
|
@ -0,0 +1,33 @@
|
||||||
|
import type { DetailedError } from './utils.js';
|
||||||
|
import type { DiagramDefinition, DiagramMetadata } from './diagram-api/types.js';
|
||||||
|
export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;
|
||||||
|
/**
|
||||||
|
* An object representing a parsed mermaid diagram definition.
|
||||||
|
* @privateRemarks This is exported as part of the public mermaidAPI.
|
||||||
|
*/
|
||||||
|
export declare class Diagram {
|
||||||
|
text: string;
|
||||||
|
metadata: Pick<DiagramMetadata, 'title'>;
|
||||||
|
type: string;
|
||||||
|
parser: DiagramDefinition['parser'];
|
||||||
|
renderer: DiagramDefinition['renderer'];
|
||||||
|
db: DiagramDefinition['db'];
|
||||||
|
private init?;
|
||||||
|
private detectError?;
|
||||||
|
constructor(text: string, metadata?: Pick<DiagramMetadata, 'title'>);
|
||||||
|
parse(): void;
|
||||||
|
render(id: string, version: string): Promise<void>;
|
||||||
|
getParser(): import("./diagram-api/types.js").ParserDefinition;
|
||||||
|
getType(): string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Parse the text asynchronously and generate a Diagram object asynchronously.
|
||||||
|
* **Warning:** This function may be changed in the future.
|
||||||
|
* @alpha
|
||||||
|
* @param text - The mermaid diagram definition.
|
||||||
|
* @param metadata - Diagram metadata, defined in YAML.
|
||||||
|
* @returns A the Promise of a Diagram object.
|
||||||
|
* @throws {@link UnknownDiagramError} if the diagram type can not be found.
|
||||||
|
* @privateRemarks This is exported as part of the public mermaidAPI.
|
||||||
|
*/
|
||||||
|
export declare const getDiagramFromText: (text: string, metadata?: Pick<DiagramMetadata, 'title'>) => Promise<Diagram>;
|
|
@ -0,0 +1,13 @@
|
||||||
|
export declare const mermaidAPI: {
|
||||||
|
render: import("@vitest/spy").Mock<any, any>;
|
||||||
|
parse: (text: string, parseOptions?: import("../mermaidAPI.js").ParseOptions | undefined) => Promise<boolean>;
|
||||||
|
initialize: import("@vitest/spy").Mock<any, any>;
|
||||||
|
getConfig: () => import("../config.type.js").MermaidConfig;
|
||||||
|
setConfig: (conf: import("../config.type.js").MermaidConfig) => import("../config.type.js").MermaidConfig;
|
||||||
|
getSiteConfig: () => import("../config.type.js").MermaidConfig;
|
||||||
|
updateSiteConfig: (conf: import("../config.type.js").MermaidConfig) => import("../config.type.js").MermaidConfig;
|
||||||
|
reset: () => void;
|
||||||
|
globalReset: () => void;
|
||||||
|
defaultConfig: import("../config.type.js").MermaidConfig;
|
||||||
|
};
|
||||||
|
export default mermaidAPI;
|
|
@ -0,0 +1,27 @@
|
||||||
|
/**
|
||||||
|
* Accessibility (a11y) functions, types, helpers.
|
||||||
|
*
|
||||||
|
* @see https://www.w3.org/WAI/
|
||||||
|
* @see https://www.w3.org/TR/wai-aria-1.1/
|
||||||
|
* @see https://www.w3.org/TR/svg-aam-1.0/
|
||||||
|
*/
|
||||||
|
import type { D3Element } from './mermaidAPI.js';
|
||||||
|
/**
|
||||||
|
* Add role and aria-roledescription to the svg element.
|
||||||
|
*
|
||||||
|
* @param svg - d3 object that contains the SVG HTML element
|
||||||
|
* @param diagramType - diagram name for to the aria-roledescription
|
||||||
|
*/
|
||||||
|
export declare function setA11yDiagramInfo(svg: D3Element, diagramType: string): void;
|
||||||
|
/**
|
||||||
|
* Add an accessible title and/or description element to a chart.
|
||||||
|
* The title is usually not displayed and the description is never displayed.
|
||||||
|
*
|
||||||
|
* The following charts display their title as a visual and accessibility element: gantt.
|
||||||
|
*
|
||||||
|
* @param svg - d3 node to insert the a11y title and desc info
|
||||||
|
* @param a11yTitle - a11y title. undefined or empty strings mean to skip them
|
||||||
|
* @param a11yDesc - a11y description. undefined or empty strings mean to skip them
|
||||||
|
* @param baseId - id used to construct the a11y title and description id
|
||||||
|
*/
|
||||||
|
export declare function addSVGa11yTitleDescription(svg: D3Element, a11yTitle: string | undefined, a11yDesc: string | undefined, baseId: string): void;
|
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1,144 @@
|
||||||
|
import { c as constant, p as path } from "./constant-b644328d.js";
|
||||||
|
import { aW as pi, aX as cos, aY as sin, aZ as halfPi, a_ as epsilon, W as tau, a$ as sqrt, b0 as min, b1 as abs, b2 as atan2, b3 as asin, b4 as acos, b5 as max } from "./mermaid-491db2d9.js";
|
||||||
|
function arcInnerRadius(d) {
|
||||||
|
return d.innerRadius;
|
||||||
|
}
|
||||||
|
function arcOuterRadius(d) {
|
||||||
|
return d.outerRadius;
|
||||||
|
}
|
||||||
|
function arcStartAngle(d) {
|
||||||
|
return d.startAngle;
|
||||||
|
}
|
||||||
|
function arcEndAngle(d) {
|
||||||
|
return d.endAngle;
|
||||||
|
}
|
||||||
|
function arcPadAngle(d) {
|
||||||
|
return d && d.padAngle;
|
||||||
|
}
|
||||||
|
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
||||||
|
var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10;
|
||||||
|
if (t * t < epsilon)
|
||||||
|
return;
|
||||||
|
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
||||||
|
return [x0 + t * x10, y0 + t * y10];
|
||||||
|
}
|
||||||
|
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
||||||
|
var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
|
||||||
|
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1)
|
||||||
|
cx0 = cx1, cy0 = cy1;
|
||||||
|
return {
|
||||||
|
cx: cx0,
|
||||||
|
cy: cy0,
|
||||||
|
x01: -ox,
|
||||||
|
y01: -oy,
|
||||||
|
x11: cx0 * (r1 / r - 1),
|
||||||
|
y11: cy0 * (r1 / r - 1)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function d3arc() {
|
||||||
|
var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null;
|
||||||
|
function arc() {
|
||||||
|
var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
|
||||||
|
if (!context)
|
||||||
|
context = buffer = path();
|
||||||
|
if (r1 < r0)
|
||||||
|
r = r1, r1 = r0, r0 = r;
|
||||||
|
if (!(r1 > epsilon))
|
||||||
|
context.moveTo(0, 0);
|
||||||
|
else if (da > tau - epsilon) {
|
||||||
|
context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
||||||
|
context.arc(0, 0, r1, a0, a1, !cw);
|
||||||
|
if (r0 > epsilon) {
|
||||||
|
context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
||||||
|
context.arc(0, 0, r0, a1, a0, cw);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
|
||||||
|
if (rp > epsilon) {
|
||||||
|
var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
|
||||||
|
if ((da0 -= p0 * 2) > epsilon)
|
||||||
|
p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
|
||||||
|
else
|
||||||
|
da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
||||||
|
if ((da1 -= p1 * 2) > epsilon)
|
||||||
|
p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
|
||||||
|
else
|
||||||
|
da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
||||||
|
}
|
||||||
|
var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
|
||||||
|
if (rc > epsilon) {
|
||||||
|
var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
|
||||||
|
if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
|
||||||
|
var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
||||||
|
rc0 = min(rc, (r0 - lc) / (kc - 1));
|
||||||
|
rc1 = min(rc, (r1 - lc) / (kc + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!(da1 > epsilon))
|
||||||
|
context.moveTo(x01, y01);
|
||||||
|
else if (rc1 > epsilon) {
|
||||||
|
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
||||||
|
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
||||||
|
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
||||||
|
if (rc1 < rc)
|
||||||
|
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
||||||
|
else {
|
||||||
|
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
||||||
|
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
||||||
|
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
||||||
|
if (!(r0 > epsilon) || !(da0 > epsilon))
|
||||||
|
context.lineTo(x10, y10);
|
||||||
|
else if (rc0 > epsilon) {
|
||||||
|
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
||||||
|
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
||||||
|
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
||||||
|
if (rc0 < rc)
|
||||||
|
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
||||||
|
else {
|
||||||
|
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
||||||
|
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
||||||
|
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
context.arc(0, 0, r0, a10, a00, cw);
|
||||||
|
}
|
||||||
|
context.closePath();
|
||||||
|
if (buffer)
|
||||||
|
return context = null, buffer + "" || null;
|
||||||
|
}
|
||||||
|
arc.centroid = function() {
|
||||||
|
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
|
||||||
|
return [cos(a) * r, sin(a) * r];
|
||||||
|
};
|
||||||
|
arc.innerRadius = function(_) {
|
||||||
|
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
|
||||||
|
};
|
||||||
|
arc.outerRadius = function(_) {
|
||||||
|
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
|
||||||
|
};
|
||||||
|
arc.cornerRadius = function(_) {
|
||||||
|
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
|
||||||
|
};
|
||||||
|
arc.padRadius = function(_) {
|
||||||
|
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
|
||||||
|
};
|
||||||
|
arc.startAngle = function(_) {
|
||||||
|
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
|
||||||
|
};
|
||||||
|
arc.endAngle = function(_) {
|
||||||
|
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
|
||||||
|
};
|
||||||
|
arc.padAngle = function(_) {
|
||||||
|
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
|
||||||
|
};
|
||||||
|
arc.context = function(_) {
|
||||||
|
return arguments.length ? (context = _ == null ? null : _, arc) : context;
|
||||||
|
};
|
||||||
|
return arc;
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
d3arc as d
|
||||||
|
};
|
|
@ -0,0 +1,84 @@
|
||||||
|
import { c as X, p as sn } from "./constant-2fe7eae5.js";
|
||||||
|
import { aW as en, aX as j, aY as P, aZ as an, a_ as y, W as ln, a$ as C, b0 as k, b1 as rn, b2 as t, b3 as un, b4 as on, b5 as tn } from "./mermaid-e4a58915.js";
|
||||||
|
function fn(l) {
|
||||||
|
return l.innerRadius;
|
||||||
|
}
|
||||||
|
function cn(l) {
|
||||||
|
return l.outerRadius;
|
||||||
|
}
|
||||||
|
function yn(l) {
|
||||||
|
return l.startAngle;
|
||||||
|
}
|
||||||
|
function gn(l) {
|
||||||
|
return l.endAngle;
|
||||||
|
}
|
||||||
|
function mn(l) {
|
||||||
|
return l && l.padAngle;
|
||||||
|
}
|
||||||
|
function pn(l, x, w, W, h, v, Y, a) {
|
||||||
|
var s = w - l, n = W - x, m = Y - h, i = a - v, r = i * s - m * n;
|
||||||
|
if (!(r * r < y))
|
||||||
|
return r = (m * (x - v) - i * (l - h)) / r, [l + r * s, x + r * n];
|
||||||
|
}
|
||||||
|
function K(l, x, w, W, h, v, Y) {
|
||||||
|
var a = l - w, s = x - W, n = (Y ? v : -v) / C(a * a + s * s), m = n * s, i = -n * a, r = l + m, f = x + i, c = w + m, D = W + i, o = (r + c) / 2, E = (f + D) / 2, p = c - r, g = D - f, A = p * p + g * g, I = h - v, b = r * D - c * f, O = (g < 0 ? -1 : 1) * C(tn(0, I * I * A - b * b)), S = (b * g - p * O) / A, d = (-b * p - g * O) / A, R = (b * g + p * O) / A, T = (-b * p + g * O) / A, e = S - o, u = d - E, Z = R - o, $ = T - E;
|
||||||
|
return e * e + u * u > Z * Z + $ * $ && (S = R, d = T), {
|
||||||
|
cx: S,
|
||||||
|
cy: d,
|
||||||
|
x01: -m,
|
||||||
|
y01: -i,
|
||||||
|
x11: S * (h / I - 1),
|
||||||
|
y11: d * (h / I - 1)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function hn() {
|
||||||
|
var l = fn, x = cn, w = X(0), W = null, h = yn, v = gn, Y = mn, a = null;
|
||||||
|
function s() {
|
||||||
|
var n, m, i = +l.apply(this, arguments), r = +x.apply(this, arguments), f = h.apply(this, arguments) - an, c = v.apply(this, arguments) - an, D = rn(c - f), o = c > f;
|
||||||
|
if (a || (a = n = sn()), r < i && (m = r, r = i, i = m), !(r > y))
|
||||||
|
a.moveTo(0, 0);
|
||||||
|
else if (D > ln - y)
|
||||||
|
a.moveTo(r * j(f), r * P(f)), a.arc(0, 0, r, f, c, !o), i > y && (a.moveTo(i * j(c), i * P(c)), a.arc(0, 0, i, c, f, o));
|
||||||
|
else {
|
||||||
|
var E = f, p = c, g = f, A = c, I = D, b = D, O = Y.apply(this, arguments) / 2, S = O > y && (W ? +W.apply(this, arguments) : C(i * i + r * r)), d = k(rn(r - i) / 2, +w.apply(this, arguments)), R = d, T = d, e, u;
|
||||||
|
if (S > y) {
|
||||||
|
var Z = un(S / i * P(O)), $ = un(S / r * P(O));
|
||||||
|
(I -= Z * 2) > y ? (Z *= o ? 1 : -1, g += Z, A -= Z) : (I = 0, g = A = (f + c) / 2), (b -= $ * 2) > y ? ($ *= o ? 1 : -1, E += $, p -= $) : (b = 0, E = p = (f + c) / 2);
|
||||||
|
}
|
||||||
|
var z = r * j(E), B = r * P(E), F = i * j(A), G = i * P(A);
|
||||||
|
if (d > y) {
|
||||||
|
var H = r * j(p), J = r * P(p), L = i * j(g), M = i * P(g), q;
|
||||||
|
if (D < en && (q = pn(z, B, L, M, H, J, F, G))) {
|
||||||
|
var N = z - q[0], Q = B - q[1], U = H - q[0], V = J - q[1], _ = 1 / P(on((N * U + Q * V) / (C(N * N + Q * Q) * C(U * U + V * V))) / 2), nn = C(q[0] * q[0] + q[1] * q[1]);
|
||||||
|
R = k(d, (i - nn) / (_ - 1)), T = k(d, (r - nn) / (_ + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b > y ? T > y ? (e = K(L, M, z, B, r, T, o), u = K(H, J, F, G, r, T, o), a.moveTo(e.cx + e.x01, e.cy + e.y01), T < d ? a.arc(e.cx, e.cy, T, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, T, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, r, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), !o), a.arc(u.cx, u.cy, T, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : (a.moveTo(z, B), a.arc(0, 0, r, E, p, !o)) : a.moveTo(z, B), !(i > y) || !(I > y) ? a.lineTo(F, G) : R > y ? (e = K(F, G, H, J, i, -R, o), u = K(z, B, L, M, i, -R, o), a.lineTo(e.cx + e.x01, e.cy + e.y01), R < d ? a.arc(e.cx, e.cy, R, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, R, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, i, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), o), a.arc(u.cx, u.cy, R, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : a.arc(0, 0, i, A, g, o);
|
||||||
|
}
|
||||||
|
if (a.closePath(), n)
|
||||||
|
return a = null, n + "" || null;
|
||||||
|
}
|
||||||
|
return s.centroid = function() {
|
||||||
|
var n = (+l.apply(this, arguments) + +x.apply(this, arguments)) / 2, m = (+h.apply(this, arguments) + +v.apply(this, arguments)) / 2 - en / 2;
|
||||||
|
return [j(m) * n, P(m) * n];
|
||||||
|
}, s.innerRadius = function(n) {
|
||||||
|
return arguments.length ? (l = typeof n == "function" ? n : X(+n), s) : l;
|
||||||
|
}, s.outerRadius = function(n) {
|
||||||
|
return arguments.length ? (x = typeof n == "function" ? n : X(+n), s) : x;
|
||||||
|
}, s.cornerRadius = function(n) {
|
||||||
|
return arguments.length ? (w = typeof n == "function" ? n : X(+n), s) : w;
|
||||||
|
}, s.padRadius = function(n) {
|
||||||
|
return arguments.length ? (W = n == null ? null : typeof n == "function" ? n : X(+n), s) : W;
|
||||||
|
}, s.startAngle = function(n) {
|
||||||
|
return arguments.length ? (h = typeof n == "function" ? n : X(+n), s) : h;
|
||||||
|
}, s.endAngle = function(n) {
|
||||||
|
return arguments.length ? (v = typeof n == "function" ? n : X(+n), s) : v;
|
||||||
|
}, s.padAngle = function(n) {
|
||||||
|
return arguments.length ? (Y = typeof n == "function" ? n : X(+n), s) : Y;
|
||||||
|
}, s.context = function(n) {
|
||||||
|
return arguments.length ? (a = n ?? null, s) : a;
|
||||||
|
}, s;
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
hn as d
|
||||||
|
};
|
|
@ -0,0 +1,6 @@
|
||||||
|
function t(r) {
|
||||||
|
return typeof r == "object" && "length" in r ? r : Array.from(r);
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
t as a
|
||||||
|
};
|
|
@ -0,0 +1,6 @@
|
||||||
|
function array(x) {
|
||||||
|
return typeof x === "object" && "length" in x ? x : Array.from(x);
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
array as a
|
||||||
|
};
|
|
@ -0,0 +1,30 @@
|
||||||
|
/**
|
||||||
|
* assignWithDepth Extends the functionality of {@link Object.assign} with the
|
||||||
|
* ability to merge arbitrary-depth objects For each key in src with path `k` (recursively)
|
||||||
|
* performs an Object.assign(dst[`k`], src[`k`]) with a slight change from the typical handling of
|
||||||
|
* undefined for dst[`k`]: instead of raising an error, dst[`k`] is auto-initialized to `{}` and
|
||||||
|
* effectively merged with src[`k`]<p> Additionally, dissimilar types will not clobber unless the
|
||||||
|
* config.clobber parameter === true. Example:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* const config_0 = { foo: { bar: 'bar' }, bar: 'foo' };
|
||||||
|
* const config_1 = { foo: 'foo', bar: 'bar' };
|
||||||
|
* const result = assignWithDepth(config_0, config_1);
|
||||||
|
* console.log(result);
|
||||||
|
* //-> result: { foo: { bar: 'bar' }, bar: 'bar' }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Traditional Object.assign would have clobbered foo in config_0 with foo in config_1. If src is a
|
||||||
|
* destructured array of objects and dst is not an array, assignWithDepth will apply each element
|
||||||
|
* of src to dst in order.
|
||||||
|
* @param dst - The destination of the merge
|
||||||
|
* @param src - The source object(s) to merge into destination
|
||||||
|
* @param config -
|
||||||
|
* * depth: depth to traverse within src and dst for merging
|
||||||
|
* * clobber: should dissimilar types clobber
|
||||||
|
*/
|
||||||
|
declare const assignWithDepth: (dst: any, src: any, { depth, clobber }?: {
|
||||||
|
depth?: number | undefined;
|
||||||
|
clobber?: boolean | undefined;
|
||||||
|
}) => any;
|
||||||
|
export default assignWithDepth;
|
File diff suppressed because 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
|
@ -0,0 +1,362 @@
|
||||||
|
import { p as parser, d as db, s as styles } from "./styles-8b67d7cb.js";
|
||||||
|
import { line, curveBasis, select } from "d3";
|
||||||
|
import { layout } from "dagre-d3-es/src/dagre/index.js";
|
||||||
|
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
|
||||||
|
import { u as utils, l as log, v as parseGenericTypes, c as getConfig, i as configureSvgSize } from "./mermaid-0d192ec3.js";
|
||||||
|
import "ts-dedent";
|
||||||
|
import "dayjs";
|
||||||
|
import "@braintree/sanitize-url";
|
||||||
|
import "dompurify";
|
||||||
|
import "khroma";
|
||||||
|
import "lodash-es/memoize.js";
|
||||||
|
import "lodash-es/merge.js";
|
||||||
|
import "stylis";
|
||||||
|
import "lodash-es/isEmpty.js";
|
||||||
|
let edgeCount = 0;
|
||||||
|
const drawEdge = function(elem, path, relation, conf, diagObj) {
|
||||||
|
const getRelationType = function(type) {
|
||||||
|
switch (type) {
|
||||||
|
case diagObj.db.relationType.AGGREGATION:
|
||||||
|
return "aggregation";
|
||||||
|
case diagObj.db.relationType.EXTENSION:
|
||||||
|
return "extension";
|
||||||
|
case diagObj.db.relationType.COMPOSITION:
|
||||||
|
return "composition";
|
||||||
|
case diagObj.db.relationType.DEPENDENCY:
|
||||||
|
return "dependency";
|
||||||
|
case diagObj.db.relationType.LOLLIPOP:
|
||||||
|
return "lollipop";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
path.points = path.points.filter((p) => !Number.isNaN(p.y));
|
||||||
|
const lineData = path.points;
|
||||||
|
const lineFunction = line().x(function(d) {
|
||||||
|
return d.x;
|
||||||
|
}).y(function(d) {
|
||||||
|
return d.y;
|
||||||
|
}).curve(curveBasis);
|
||||||
|
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "relation");
|
||||||
|
let url = "";
|
||||||
|
if (conf.arrowMarkerAbsolute) {
|
||||||
|
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
|
||||||
|
url = url.replace(/\(/g, "\\(");
|
||||||
|
url = url.replace(/\)/g, "\\)");
|
||||||
|
}
|
||||||
|
if (relation.relation.lineType == 1) {
|
||||||
|
svgPath.attr("class", "relation dashed-line");
|
||||||
|
}
|
||||||
|
if (relation.relation.lineType == 10) {
|
||||||
|
svgPath.attr("class", "relation dotted-line");
|
||||||
|
}
|
||||||
|
if (relation.relation.type1 !== "none") {
|
||||||
|
svgPath.attr(
|
||||||
|
"marker-start",
|
||||||
|
"url(" + url + "#" + getRelationType(relation.relation.type1) + "Start)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (relation.relation.type2 !== "none") {
|
||||||
|
svgPath.attr(
|
||||||
|
"marker-end",
|
||||||
|
"url(" + url + "#" + getRelationType(relation.relation.type2) + "End)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let x, y;
|
||||||
|
const l = path.points.length;
|
||||||
|
let labelPosition = utils.calcLabelPosition(path.points);
|
||||||
|
x = labelPosition.x;
|
||||||
|
y = labelPosition.y;
|
||||||
|
let p1_card_x, p1_card_y;
|
||||||
|
let p2_card_x, p2_card_y;
|
||||||
|
if (l % 2 !== 0 && l > 1) {
|
||||||
|
let cardinality_1_point = utils.calcCardinalityPosition(
|
||||||
|
relation.relation.type1 !== "none",
|
||||||
|
path.points,
|
||||||
|
path.points[0]
|
||||||
|
);
|
||||||
|
let cardinality_2_point = utils.calcCardinalityPosition(
|
||||||
|
relation.relation.type2 !== "none",
|
||||||
|
path.points,
|
||||||
|
path.points[l - 1]
|
||||||
|
);
|
||||||
|
log.debug("cardinality_1_point " + JSON.stringify(cardinality_1_point));
|
||||||
|
log.debug("cardinality_2_point " + JSON.stringify(cardinality_2_point));
|
||||||
|
p1_card_x = cardinality_1_point.x;
|
||||||
|
p1_card_y = cardinality_1_point.y;
|
||||||
|
p2_card_x = cardinality_2_point.x;
|
||||||
|
p2_card_y = cardinality_2_point.y;
|
||||||
|
}
|
||||||
|
if (relation.title !== void 0) {
|
||||||
|
const g = elem.append("g").attr("class", "classLabel");
|
||||||
|
const label = g.append("text").attr("class", "label").attr("x", x).attr("y", y).attr("fill", "red").attr("text-anchor", "middle").text(relation.title);
|
||||||
|
window.label = label;
|
||||||
|
const bounds = label.node().getBBox();
|
||||||
|
g.insert("rect", ":first-child").attr("class", "box").attr("x", bounds.x - conf.padding / 2).attr("y", bounds.y - conf.padding / 2).attr("width", bounds.width + conf.padding).attr("height", bounds.height + conf.padding);
|
||||||
|
}
|
||||||
|
log.info("Rendering relation " + JSON.stringify(relation));
|
||||||
|
if (relation.relationTitle1 !== void 0 && relation.relationTitle1 !== "none") {
|
||||||
|
const g = elem.append("g").attr("class", "cardinality");
|
||||||
|
g.append("text").attr("class", "type1").attr("x", p1_card_x).attr("y", p1_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle1);
|
||||||
|
}
|
||||||
|
if (relation.relationTitle2 !== void 0 && relation.relationTitle2 !== "none") {
|
||||||
|
const g = elem.append("g").attr("class", "cardinality");
|
||||||
|
g.append("text").attr("class", "type2").attr("x", p2_card_x).attr("y", p2_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle2);
|
||||||
|
}
|
||||||
|
edgeCount++;
|
||||||
|
};
|
||||||
|
const drawClass = function(elem, classDef, conf, diagObj) {
|
||||||
|
log.debug("Rendering class ", classDef, conf);
|
||||||
|
const id = classDef.id;
|
||||||
|
const classInfo = {
|
||||||
|
id,
|
||||||
|
label: classDef.id,
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
};
|
||||||
|
const g = elem.append("g").attr("id", diagObj.db.lookUpDomId(id)).attr("class", "classGroup");
|
||||||
|
let title;
|
||||||
|
if (classDef.link) {
|
||||||
|
title = g.append("svg:a").attr("xlink:href", classDef.link).attr("target", classDef.linkTarget).append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
||||||
|
} else {
|
||||||
|
title = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
||||||
|
}
|
||||||
|
let isFirst = true;
|
||||||
|
classDef.annotations.forEach(function(member) {
|
||||||
|
const titleText2 = title.append("tspan").text("«" + member + "»");
|
||||||
|
if (!isFirst) {
|
||||||
|
titleText2.attr("dy", conf.textHeight);
|
||||||
|
}
|
||||||
|
isFirst = false;
|
||||||
|
});
|
||||||
|
let classTitleString = getClassTitleString(classDef);
|
||||||
|
const classTitle = title.append("tspan").text(classTitleString).attr("class", "title");
|
||||||
|
if (!isFirst) {
|
||||||
|
classTitle.attr("dy", conf.textHeight);
|
||||||
|
}
|
||||||
|
const titleHeight = title.node().getBBox().height;
|
||||||
|
let membersLine;
|
||||||
|
let membersBox;
|
||||||
|
let methodsLine;
|
||||||
|
if (classDef.members.length > 0) {
|
||||||
|
membersLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin / 2).attr("y2", conf.padding + titleHeight + conf.dividerMargin / 2);
|
||||||
|
const members = g.append("text").attr("x", conf.padding).attr("y", titleHeight + conf.dividerMargin + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
||||||
|
isFirst = true;
|
||||||
|
classDef.members.forEach(function(member) {
|
||||||
|
addTspan(members, member, isFirst, conf);
|
||||||
|
isFirst = false;
|
||||||
|
});
|
||||||
|
membersBox = members.node().getBBox();
|
||||||
|
}
|
||||||
|
if (classDef.methods.length > 0) {
|
||||||
|
methodsLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr("y2", conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
|
||||||
|
const methods = g.append("text").attr("x", conf.padding).attr("y", titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
||||||
|
isFirst = true;
|
||||||
|
classDef.methods.forEach(function(method) {
|
||||||
|
addTspan(methods, method, isFirst, conf);
|
||||||
|
isFirst = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const classBox = g.node().getBBox();
|
||||||
|
var cssClassStr = " ";
|
||||||
|
if (classDef.cssClasses.length > 0) {
|
||||||
|
cssClassStr = cssClassStr + classDef.cssClasses.join(" ");
|
||||||
|
}
|
||||||
|
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", classBox.width + 2 * conf.padding).attr("height", classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr("class", cssClassStr);
|
||||||
|
const rectWidth = rect.node().getBBox().width;
|
||||||
|
title.node().childNodes.forEach(function(x) {
|
||||||
|
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
||||||
|
});
|
||||||
|
if (classDef.tooltip) {
|
||||||
|
title.insert("title").text(classDef.tooltip);
|
||||||
|
}
|
||||||
|
if (membersLine) {
|
||||||
|
membersLine.attr("x2", rectWidth);
|
||||||
|
}
|
||||||
|
if (methodsLine) {
|
||||||
|
methodsLine.attr("x2", rectWidth);
|
||||||
|
}
|
||||||
|
classInfo.width = rectWidth;
|
||||||
|
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
||||||
|
return classInfo;
|
||||||
|
};
|
||||||
|
const getClassTitleString = function(classDef) {
|
||||||
|
let classTitleString = classDef.id;
|
||||||
|
if (classDef.type) {
|
||||||
|
classTitleString += "<" + parseGenericTypes(classDef.type) + ">";
|
||||||
|
}
|
||||||
|
return classTitleString;
|
||||||
|
};
|
||||||
|
const drawNote = function(elem, note, conf, diagObj) {
|
||||||
|
log.debug("Rendering note ", note, conf);
|
||||||
|
const id = note.id;
|
||||||
|
const noteInfo = {
|
||||||
|
id,
|
||||||
|
text: note.text,
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
};
|
||||||
|
const g = elem.append("g").attr("id", id).attr("class", "classGroup");
|
||||||
|
let text = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
||||||
|
const lines = JSON.parse(`"${note.text}"`).split("\n");
|
||||||
|
lines.forEach(function(line2) {
|
||||||
|
log.debug(`Adding line: ${line2}`);
|
||||||
|
text.append("tspan").text(line2).attr("class", "title").attr("dy", conf.textHeight);
|
||||||
|
});
|
||||||
|
const noteBox = g.node().getBBox();
|
||||||
|
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", noteBox.width + 2 * conf.padding).attr(
|
||||||
|
"height",
|
||||||
|
noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin
|
||||||
|
);
|
||||||
|
const rectWidth = rect.node().getBBox().width;
|
||||||
|
text.node().childNodes.forEach(function(x) {
|
||||||
|
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
||||||
|
});
|
||||||
|
noteInfo.width = rectWidth;
|
||||||
|
noteInfo.height = noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin;
|
||||||
|
return noteInfo;
|
||||||
|
};
|
||||||
|
const addTspan = function(textEl, member, isFirst, conf) {
|
||||||
|
const { displayText, cssStyle } = member.getDisplayDetails();
|
||||||
|
const tSpan = textEl.append("tspan").attr("x", conf.padding).text(displayText);
|
||||||
|
if (cssStyle !== "") {
|
||||||
|
tSpan.attr("style", member.cssStyle);
|
||||||
|
}
|
||||||
|
if (!isFirst) {
|
||||||
|
tSpan.attr("dy", conf.textHeight);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const svgDraw = {
|
||||||
|
getClassTitleString,
|
||||||
|
drawClass,
|
||||||
|
drawEdge,
|
||||||
|
drawNote
|
||||||
|
};
|
||||||
|
let idCache = {};
|
||||||
|
const padding = 20;
|
||||||
|
const getGraphId = function(label) {
|
||||||
|
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
||||||
|
if (foundEntry) {
|
||||||
|
return foundEntry[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const insertMarkers = function(elem) {
|
||||||
|
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
|
||||||
|
};
|
||||||
|
const draw = function(text, id, _version, diagObj) {
|
||||||
|
const conf = getConfig().class;
|
||||||
|
idCache = {};
|
||||||
|
log.info("Rendering diagram " + text);
|
||||||
|
const securityLevel = getConfig().securityLevel;
|
||||||
|
let sandboxElement;
|
||||||
|
if (securityLevel === "sandbox") {
|
||||||
|
sandboxElement = select("#i" + id);
|
||||||
|
}
|
||||||
|
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
||||||
|
const diagram2 = root.select(`[id='${id}']`);
|
||||||
|
insertMarkers(diagram2);
|
||||||
|
const g = new graphlib.Graph({
|
||||||
|
multigraph: true
|
||||||
|
});
|
||||||
|
g.setGraph({
|
||||||
|
isMultiGraph: true
|
||||||
|
});
|
||||||
|
g.setDefaultEdgeLabel(function() {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
const classes = diagObj.db.getClasses();
|
||||||
|
const keys = Object.keys(classes);
|
||||||
|
for (const key of keys) {
|
||||||
|
const classDef = classes[key];
|
||||||
|
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
||||||
|
idCache[node.id] = node;
|
||||||
|
g.setNode(node.id, node);
|
||||||
|
log.info("Org height: " + node.height);
|
||||||
|
}
|
||||||
|
const relations = diagObj.db.getRelations();
|
||||||
|
relations.forEach(function(relation) {
|
||||||
|
log.info(
|
||||||
|
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
||||||
|
);
|
||||||
|
g.setEdge(
|
||||||
|
getGraphId(relation.id1),
|
||||||
|
getGraphId(relation.id2),
|
||||||
|
{
|
||||||
|
relation
|
||||||
|
},
|
||||||
|
relation.title || "DEFAULT"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
const notes = diagObj.db.getNotes();
|
||||||
|
notes.forEach(function(note) {
|
||||||
|
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
||||||
|
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
||||||
|
idCache[node.id] = node;
|
||||||
|
g.setNode(node.id, node);
|
||||||
|
if (note.class && note.class in classes) {
|
||||||
|
g.setEdge(
|
||||||
|
note.id,
|
||||||
|
getGraphId(note.class),
|
||||||
|
{
|
||||||
|
relation: {
|
||||||
|
id1: note.id,
|
||||||
|
id2: note.class,
|
||||||
|
relation: {
|
||||||
|
type1: "none",
|
||||||
|
type2: "none",
|
||||||
|
lineType: 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"DEFAULT"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
layout(g);
|
||||||
|
g.nodes().forEach(function(v) {
|
||||||
|
if (v !== void 0 && g.node(v) !== void 0) {
|
||||||
|
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
||||||
|
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
||||||
|
"transform",
|
||||||
|
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
g.edges().forEach(function(e) {
|
||||||
|
if (e !== void 0 && g.edge(e) !== void 0) {
|
||||||
|
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
||||||
|
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const svgBounds = diagram2.node().getBBox();
|
||||||
|
const width = svgBounds.width + padding * 2;
|
||||||
|
const height = svgBounds.height + padding * 2;
|
||||||
|
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
||||||
|
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
||||||
|
log.debug(`viewBox ${vBox}`);
|
||||||
|
diagram2.attr("viewBox", vBox);
|
||||||
|
};
|
||||||
|
const renderer = {
|
||||||
|
draw
|
||||||
|
};
|
||||||
|
const diagram = {
|
||||||
|
parser,
|
||||||
|
db,
|
||||||
|
renderer,
|
||||||
|
styles,
|
||||||
|
init: (cnf) => {
|
||||||
|
if (!cnf.class) {
|
||||||
|
cnf.class = {};
|
||||||
|
}
|
||||||
|
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||||
|
db.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export {
|
||||||
|
diagram
|
||||||
|
};
|
|
@ -0,0 +1,354 @@
|
||||||
|
import { p as parser, d as db, s as styles } from "./styles-6e7f2b1b.js";
|
||||||
|
import { F as curveBasis, z as utils, l as log, G as parseGenericTypes, c as getConfig, j as d3select, k as configureSvgSize } from "./mermaid-491db2d9.js";
|
||||||
|
import { G as Graph, l as layout } from "./layout-a7b9ff07.js";
|
||||||
|
import { l as line } from "./line-8fd2bd69.js";
|
||||||
|
import "./array-b7dcf730.js";
|
||||||
|
import "./constant-b644328d.js";
|
||||||
|
let edgeCount = 0;
|
||||||
|
const drawEdge = function(elem, path, relation, conf, diagObj) {
|
||||||
|
const getRelationType = function(type) {
|
||||||
|
switch (type) {
|
||||||
|
case diagObj.db.relationType.AGGREGATION:
|
||||||
|
return "aggregation";
|
||||||
|
case diagObj.db.relationType.EXTENSION:
|
||||||
|
return "extension";
|
||||||
|
case diagObj.db.relationType.COMPOSITION:
|
||||||
|
return "composition";
|
||||||
|
case diagObj.db.relationType.DEPENDENCY:
|
||||||
|
return "dependency";
|
||||||
|
case diagObj.db.relationType.LOLLIPOP:
|
||||||
|
return "lollipop";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
path.points = path.points.filter((p) => !Number.isNaN(p.y));
|
||||||
|
const lineData = path.points;
|
||||||
|
const lineFunction = line().x(function(d) {
|
||||||
|
return d.x;
|
||||||
|
}).y(function(d) {
|
||||||
|
return d.y;
|
||||||
|
}).curve(curveBasis);
|
||||||
|
const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "relation");
|
||||||
|
let url = "";
|
||||||
|
if (conf.arrowMarkerAbsolute) {
|
||||||
|
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
|
||||||
|
url = url.replace(/\(/g, "\\(");
|
||||||
|
url = url.replace(/\)/g, "\\)");
|
||||||
|
}
|
||||||
|
if (relation.relation.lineType == 1) {
|
||||||
|
svgPath.attr("class", "relation dashed-line");
|
||||||
|
}
|
||||||
|
if (relation.relation.lineType == 10) {
|
||||||
|
svgPath.attr("class", "relation dotted-line");
|
||||||
|
}
|
||||||
|
if (relation.relation.type1 !== "none") {
|
||||||
|
svgPath.attr(
|
||||||
|
"marker-start",
|
||||||
|
"url(" + url + "#" + getRelationType(relation.relation.type1) + "Start)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (relation.relation.type2 !== "none") {
|
||||||
|
svgPath.attr(
|
||||||
|
"marker-end",
|
||||||
|
"url(" + url + "#" + getRelationType(relation.relation.type2) + "End)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let x, y;
|
||||||
|
const l = path.points.length;
|
||||||
|
let labelPosition = utils.calcLabelPosition(path.points);
|
||||||
|
x = labelPosition.x;
|
||||||
|
y = labelPosition.y;
|
||||||
|
let p1_card_x, p1_card_y;
|
||||||
|
let p2_card_x, p2_card_y;
|
||||||
|
if (l % 2 !== 0 && l > 1) {
|
||||||
|
let cardinality_1_point = utils.calcCardinalityPosition(
|
||||||
|
relation.relation.type1 !== "none",
|
||||||
|
path.points,
|
||||||
|
path.points[0]
|
||||||
|
);
|
||||||
|
let cardinality_2_point = utils.calcCardinalityPosition(
|
||||||
|
relation.relation.type2 !== "none",
|
||||||
|
path.points,
|
||||||
|
path.points[l - 1]
|
||||||
|
);
|
||||||
|
log.debug("cardinality_1_point " + JSON.stringify(cardinality_1_point));
|
||||||
|
log.debug("cardinality_2_point " + JSON.stringify(cardinality_2_point));
|
||||||
|
p1_card_x = cardinality_1_point.x;
|
||||||
|
p1_card_y = cardinality_1_point.y;
|
||||||
|
p2_card_x = cardinality_2_point.x;
|
||||||
|
p2_card_y = cardinality_2_point.y;
|
||||||
|
}
|
||||||
|
if (relation.title !== void 0) {
|
||||||
|
const g = elem.append("g").attr("class", "classLabel");
|
||||||
|
const label = g.append("text").attr("class", "label").attr("x", x).attr("y", y).attr("fill", "red").attr("text-anchor", "middle").text(relation.title);
|
||||||
|
window.label = label;
|
||||||
|
const bounds = label.node().getBBox();
|
||||||
|
g.insert("rect", ":first-child").attr("class", "box").attr("x", bounds.x - conf.padding / 2).attr("y", bounds.y - conf.padding / 2).attr("width", bounds.width + conf.padding).attr("height", bounds.height + conf.padding);
|
||||||
|
}
|
||||||
|
log.info("Rendering relation " + JSON.stringify(relation));
|
||||||
|
if (relation.relationTitle1 !== void 0 && relation.relationTitle1 !== "none") {
|
||||||
|
const g = elem.append("g").attr("class", "cardinality");
|
||||||
|
g.append("text").attr("class", "type1").attr("x", p1_card_x).attr("y", p1_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle1);
|
||||||
|
}
|
||||||
|
if (relation.relationTitle2 !== void 0 && relation.relationTitle2 !== "none") {
|
||||||
|
const g = elem.append("g").attr("class", "cardinality");
|
||||||
|
g.append("text").attr("class", "type2").attr("x", p2_card_x).attr("y", p2_card_y).attr("fill", "black").attr("font-size", "6").text(relation.relationTitle2);
|
||||||
|
}
|
||||||
|
edgeCount++;
|
||||||
|
};
|
||||||
|
const drawClass = function(elem, classDef, conf, diagObj) {
|
||||||
|
log.debug("Rendering class ", classDef, conf);
|
||||||
|
const id = classDef.id;
|
||||||
|
const classInfo = {
|
||||||
|
id,
|
||||||
|
label: classDef.id,
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
};
|
||||||
|
const g = elem.append("g").attr("id", diagObj.db.lookUpDomId(id)).attr("class", "classGroup");
|
||||||
|
let title;
|
||||||
|
if (classDef.link) {
|
||||||
|
title = g.append("svg:a").attr("xlink:href", classDef.link).attr("target", classDef.linkTarget).append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
||||||
|
} else {
|
||||||
|
title = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
||||||
|
}
|
||||||
|
let isFirst = true;
|
||||||
|
classDef.annotations.forEach(function(member) {
|
||||||
|
const titleText2 = title.append("tspan").text("«" + member + "»");
|
||||||
|
if (!isFirst) {
|
||||||
|
titleText2.attr("dy", conf.textHeight);
|
||||||
|
}
|
||||||
|
isFirst = false;
|
||||||
|
});
|
||||||
|
let classTitleString = getClassTitleString(classDef);
|
||||||
|
const classTitle = title.append("tspan").text(classTitleString).attr("class", "title");
|
||||||
|
if (!isFirst) {
|
||||||
|
classTitle.attr("dy", conf.textHeight);
|
||||||
|
}
|
||||||
|
const titleHeight = title.node().getBBox().height;
|
||||||
|
let membersLine;
|
||||||
|
let membersBox;
|
||||||
|
let methodsLine;
|
||||||
|
if (classDef.members.length > 0) {
|
||||||
|
membersLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin / 2).attr("y2", conf.padding + titleHeight + conf.dividerMargin / 2);
|
||||||
|
const members = g.append("text").attr("x", conf.padding).attr("y", titleHeight + conf.dividerMargin + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
||||||
|
isFirst = true;
|
||||||
|
classDef.members.forEach(function(member) {
|
||||||
|
addTspan(members, member, isFirst, conf);
|
||||||
|
isFirst = false;
|
||||||
|
});
|
||||||
|
membersBox = members.node().getBBox();
|
||||||
|
}
|
||||||
|
if (classDef.methods.length > 0) {
|
||||||
|
methodsLine = g.append("line").attr("x1", 0).attr("y1", conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr("y2", conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
|
||||||
|
const methods = g.append("text").attr("x", conf.padding).attr("y", titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr("fill", "white").attr("class", "classText");
|
||||||
|
isFirst = true;
|
||||||
|
classDef.methods.forEach(function(method) {
|
||||||
|
addTspan(methods, method, isFirst, conf);
|
||||||
|
isFirst = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const classBox = g.node().getBBox();
|
||||||
|
var cssClassStr = " ";
|
||||||
|
if (classDef.cssClasses.length > 0) {
|
||||||
|
cssClassStr = cssClassStr + classDef.cssClasses.join(" ");
|
||||||
|
}
|
||||||
|
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", classBox.width + 2 * conf.padding).attr("height", classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr("class", cssClassStr);
|
||||||
|
const rectWidth = rect.node().getBBox().width;
|
||||||
|
title.node().childNodes.forEach(function(x) {
|
||||||
|
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
||||||
|
});
|
||||||
|
if (classDef.tooltip) {
|
||||||
|
title.insert("title").text(classDef.tooltip);
|
||||||
|
}
|
||||||
|
if (membersLine) {
|
||||||
|
membersLine.attr("x2", rectWidth);
|
||||||
|
}
|
||||||
|
if (methodsLine) {
|
||||||
|
methodsLine.attr("x2", rectWidth);
|
||||||
|
}
|
||||||
|
classInfo.width = rectWidth;
|
||||||
|
classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
|
||||||
|
return classInfo;
|
||||||
|
};
|
||||||
|
const getClassTitleString = function(classDef) {
|
||||||
|
let classTitleString = classDef.id;
|
||||||
|
if (classDef.type) {
|
||||||
|
classTitleString += "<" + parseGenericTypes(classDef.type) + ">";
|
||||||
|
}
|
||||||
|
return classTitleString;
|
||||||
|
};
|
||||||
|
const drawNote = function(elem, note, conf, diagObj) {
|
||||||
|
log.debug("Rendering note ", note, conf);
|
||||||
|
const id = note.id;
|
||||||
|
const noteInfo = {
|
||||||
|
id,
|
||||||
|
text: note.text,
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
};
|
||||||
|
const g = elem.append("g").attr("id", id).attr("class", "classGroup");
|
||||||
|
let text = g.append("text").attr("y", conf.textHeight + conf.padding).attr("x", 0);
|
||||||
|
const lines = JSON.parse(`"${note.text}"`).split("\n");
|
||||||
|
lines.forEach(function(line2) {
|
||||||
|
log.debug(`Adding line: ${line2}`);
|
||||||
|
text.append("tspan").text(line2).attr("class", "title").attr("dy", conf.textHeight);
|
||||||
|
});
|
||||||
|
const noteBox = g.node().getBBox();
|
||||||
|
const rect = g.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", noteBox.width + 2 * conf.padding).attr(
|
||||||
|
"height",
|
||||||
|
noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin
|
||||||
|
);
|
||||||
|
const rectWidth = rect.node().getBBox().width;
|
||||||
|
text.node().childNodes.forEach(function(x) {
|
||||||
|
x.setAttribute("x", (rectWidth - x.getBBox().width) / 2);
|
||||||
|
});
|
||||||
|
noteInfo.width = rectWidth;
|
||||||
|
noteInfo.height = noteBox.height + lines.length * conf.textHeight + conf.padding + 0.5 * conf.dividerMargin;
|
||||||
|
return noteInfo;
|
||||||
|
};
|
||||||
|
const addTspan = function(textEl, member, isFirst, conf) {
|
||||||
|
const { displayText, cssStyle } = member.getDisplayDetails();
|
||||||
|
const tSpan = textEl.append("tspan").attr("x", conf.padding).text(displayText);
|
||||||
|
if (cssStyle !== "") {
|
||||||
|
tSpan.attr("style", member.cssStyle);
|
||||||
|
}
|
||||||
|
if (!isFirst) {
|
||||||
|
tSpan.attr("dy", conf.textHeight);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const svgDraw = {
|
||||||
|
getClassTitleString,
|
||||||
|
drawClass,
|
||||||
|
drawEdge,
|
||||||
|
drawNote
|
||||||
|
};
|
||||||
|
let idCache = {};
|
||||||
|
const padding = 20;
|
||||||
|
const getGraphId = function(label) {
|
||||||
|
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
||||||
|
if (foundEntry) {
|
||||||
|
return foundEntry[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const insertMarkers = function(elem) {
|
||||||
|
elem.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z");
|
||||||
|
elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
|
||||||
|
};
|
||||||
|
const draw = function(text, id, _version, diagObj) {
|
||||||
|
const conf = getConfig().class;
|
||||||
|
idCache = {};
|
||||||
|
log.info("Rendering diagram " + text);
|
||||||
|
const securityLevel = getConfig().securityLevel;
|
||||||
|
let sandboxElement;
|
||||||
|
if (securityLevel === "sandbox") {
|
||||||
|
sandboxElement = d3select("#i" + id);
|
||||||
|
}
|
||||||
|
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
|
||||||
|
const diagram2 = root.select(`[id='${id}']`);
|
||||||
|
insertMarkers(diagram2);
|
||||||
|
const g = new Graph({
|
||||||
|
multigraph: true
|
||||||
|
});
|
||||||
|
g.setGraph({
|
||||||
|
isMultiGraph: true
|
||||||
|
});
|
||||||
|
g.setDefaultEdgeLabel(function() {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
const classes = diagObj.db.getClasses();
|
||||||
|
const keys = Object.keys(classes);
|
||||||
|
for (const key of keys) {
|
||||||
|
const classDef = classes[key];
|
||||||
|
const node = svgDraw.drawClass(diagram2, classDef, conf, diagObj);
|
||||||
|
idCache[node.id] = node;
|
||||||
|
g.setNode(node.id, node);
|
||||||
|
log.info("Org height: " + node.height);
|
||||||
|
}
|
||||||
|
const relations = diagObj.db.getRelations();
|
||||||
|
relations.forEach(function(relation) {
|
||||||
|
log.info(
|
||||||
|
"tjoho" + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
|
||||||
|
);
|
||||||
|
g.setEdge(
|
||||||
|
getGraphId(relation.id1),
|
||||||
|
getGraphId(relation.id2),
|
||||||
|
{
|
||||||
|
relation
|
||||||
|
},
|
||||||
|
relation.title || "DEFAULT"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
const notes = diagObj.db.getNotes();
|
||||||
|
notes.forEach(function(note) {
|
||||||
|
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
||||||
|
const node = svgDraw.drawNote(diagram2, note, conf, diagObj);
|
||||||
|
idCache[node.id] = node;
|
||||||
|
g.setNode(node.id, node);
|
||||||
|
if (note.class && note.class in classes) {
|
||||||
|
g.setEdge(
|
||||||
|
note.id,
|
||||||
|
getGraphId(note.class),
|
||||||
|
{
|
||||||
|
relation: {
|
||||||
|
id1: note.id,
|
||||||
|
id2: note.class,
|
||||||
|
relation: {
|
||||||
|
type1: "none",
|
||||||
|
type2: "none",
|
||||||
|
lineType: 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"DEFAULT"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
layout(g);
|
||||||
|
g.nodes().forEach(function(v) {
|
||||||
|
if (v !== void 0 && g.node(v) !== void 0) {
|
||||||
|
log.debug("Node " + v + ": " + JSON.stringify(g.node(v)));
|
||||||
|
root.select("#" + (diagObj.db.lookUpDomId(v) || v)).attr(
|
||||||
|
"transform",
|
||||||
|
"translate(" + (g.node(v).x - g.node(v).width / 2) + "," + (g.node(v).y - g.node(v).height / 2) + " )"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
g.edges().forEach(function(e) {
|
||||||
|
if (e !== void 0 && g.edge(e) !== void 0) {
|
||||||
|
log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(g.edge(e)));
|
||||||
|
svgDraw.drawEdge(diagram2, g.edge(e), g.edge(e).relation, conf, diagObj);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const svgBounds = diagram2.node().getBBox();
|
||||||
|
const width = svgBounds.width + padding * 2;
|
||||||
|
const height = svgBounds.height + padding * 2;
|
||||||
|
configureSvgSize(diagram2, height, width, conf.useMaxWidth);
|
||||||
|
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;
|
||||||
|
log.debug(`viewBox ${vBox}`);
|
||||||
|
diagram2.attr("viewBox", vBox);
|
||||||
|
};
|
||||||
|
const renderer = {
|
||||||
|
draw
|
||||||
|
};
|
||||||
|
const diagram = {
|
||||||
|
parser,
|
||||||
|
db,
|
||||||
|
renderer,
|
||||||
|
styles,
|
||||||
|
init: (cnf) => {
|
||||||
|
if (!cnf.class) {
|
||||||
|
cnf.class = {};
|
||||||
|
}
|
||||||
|
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||||
|
db.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export {
|
||||||
|
diagram
|
||||||
|
};
|
|
@ -0,0 +1,218 @@
|
||||||
|
import { p as G, d as S, s as A } from "./styles-483f8ae9.js";
|
||||||
|
import { F as W, z as B, l as u, G as I, c as H, j as M, k as O } from "./mermaid-e4a58915.js";
|
||||||
|
import { G as P, l as X } from "./layout-545b2d5b.js";
|
||||||
|
import { l as Y } from "./line-4ba3c4fa.js";
|
||||||
|
import "./array-2ff2c7a6.js";
|
||||||
|
import "./constant-2fe7eae5.js";
|
||||||
|
let _ = 0;
|
||||||
|
const $ = function(i, a, t, o, p) {
|
||||||
|
const g = function(e) {
|
||||||
|
switch (e) {
|
||||||
|
case p.db.relationType.AGGREGATION:
|
||||||
|
return "aggregation";
|
||||||
|
case p.db.relationType.EXTENSION:
|
||||||
|
return "extension";
|
||||||
|
case p.db.relationType.COMPOSITION:
|
||||||
|
return "composition";
|
||||||
|
case p.db.relationType.DEPENDENCY:
|
||||||
|
return "dependency";
|
||||||
|
case p.db.relationType.LOLLIPOP:
|
||||||
|
return "lollipop";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
a.points = a.points.filter((e) => !Number.isNaN(e.y));
|
||||||
|
const s = a.points, c = Y().x(function(e) {
|
||||||
|
return e.x;
|
||||||
|
}).y(function(e) {
|
||||||
|
return e.y;
|
||||||
|
}).curve(W), n = i.append("path").attr("d", c(s)).attr("id", "edge" + _).attr("class", "relation");
|
||||||
|
let r = "";
|
||||||
|
o.arrowMarkerAbsolute && (r = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, r = r.replace(/\(/g, "\\("), r = r.replace(/\)/g, "\\)")), t.relation.lineType == 1 && n.attr("class", "relation dashed-line"), t.relation.lineType == 10 && n.attr("class", "relation dotted-line"), t.relation.type1 !== "none" && n.attr(
|
||||||
|
"marker-start",
|
||||||
|
"url(" + r + "#" + g(t.relation.type1) + "Start)"
|
||||||
|
), t.relation.type2 !== "none" && n.attr(
|
||||||
|
"marker-end",
|
||||||
|
"url(" + r + "#" + g(t.relation.type2) + "End)"
|
||||||
|
);
|
||||||
|
let f, h;
|
||||||
|
const x = a.points.length;
|
||||||
|
let k = B.calcLabelPosition(a.points);
|
||||||
|
f = k.x, h = k.y;
|
||||||
|
let y, m, w, b;
|
||||||
|
if (x % 2 !== 0 && x > 1) {
|
||||||
|
let e = B.calcCardinalityPosition(
|
||||||
|
t.relation.type1 !== "none",
|
||||||
|
a.points,
|
||||||
|
a.points[0]
|
||||||
|
), d = B.calcCardinalityPosition(
|
||||||
|
t.relation.type2 !== "none",
|
||||||
|
a.points,
|
||||||
|
a.points[x - 1]
|
||||||
|
);
|
||||||
|
u.debug("cardinality_1_point " + JSON.stringify(e)), u.debug("cardinality_2_point " + JSON.stringify(d)), y = e.x, m = e.y, w = d.x, b = d.y;
|
||||||
|
}
|
||||||
|
if (t.title !== void 0) {
|
||||||
|
const e = i.append("g").attr("class", "classLabel"), d = e.append("text").attr("class", "label").attr("x", f).attr("y", h).attr("fill", "red").attr("text-anchor", "middle").text(t.title);
|
||||||
|
window.label = d;
|
||||||
|
const l = d.node().getBBox();
|
||||||
|
e.insert("rect", ":first-child").attr("class", "box").attr("x", l.x - o.padding / 2).attr("y", l.y - o.padding / 2).attr("width", l.width + o.padding).attr("height", l.height + o.padding);
|
||||||
|
}
|
||||||
|
u.info("Rendering relation " + JSON.stringify(t)), t.relationTitle1 !== void 0 && t.relationTitle1 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type1").attr("x", y).attr("y", m).attr("fill", "black").attr("font-size", "6").text(t.relationTitle1), t.relationTitle2 !== void 0 && t.relationTitle2 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type2").attr("x", w).attr("y", b).attr("fill", "black").attr("font-size", "6").text(t.relationTitle2), _++;
|
||||||
|
}, J = function(i, a, t, o) {
|
||||||
|
u.debug("Rendering class ", a, t);
|
||||||
|
const p = a.id, g = {
|
||||||
|
id: p,
|
||||||
|
label: a.id,
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
}, s = i.append("g").attr("id", o.db.lookUpDomId(p)).attr("class", "classGroup");
|
||||||
|
let c;
|
||||||
|
a.link ? c = s.append("svg:a").attr("xlink:href", a.link).attr("target", a.linkTarget).append("text").attr("y", t.textHeight + t.padding).attr("x", 0) : c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
||||||
|
let n = !0;
|
||||||
|
a.annotations.forEach(function(d) {
|
||||||
|
const l = c.append("tspan").text("«" + d + "»");
|
||||||
|
n || l.attr("dy", t.textHeight), n = !1;
|
||||||
|
});
|
||||||
|
let r = C(a);
|
||||||
|
const f = c.append("tspan").text(r).attr("class", "title");
|
||||||
|
n || f.attr("dy", t.textHeight);
|
||||||
|
const h = c.node().getBBox().height;
|
||||||
|
let x, k, y;
|
||||||
|
if (a.members.length > 0) {
|
||||||
|
x = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin / 2).attr("y2", t.padding + h + t.dividerMargin / 2);
|
||||||
|
const d = s.append("text").attr("x", t.padding).attr("y", h + t.dividerMargin + t.textHeight).attr("fill", "white").attr("class", "classText");
|
||||||
|
n = !0, a.members.forEach(function(l) {
|
||||||
|
v(d, l, n, t), n = !1;
|
||||||
|
}), k = d.node().getBBox();
|
||||||
|
}
|
||||||
|
if (a.methods.length > 0) {
|
||||||
|
y = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin + k.height).attr("y2", t.padding + h + t.dividerMargin + k.height);
|
||||||
|
const d = s.append("text").attr("x", t.padding).attr("y", h + 2 * t.dividerMargin + k.height + t.textHeight).attr("fill", "white").attr("class", "classText");
|
||||||
|
n = !0, a.methods.forEach(function(l) {
|
||||||
|
v(d, l, n, t), n = !1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const m = s.node().getBBox();
|
||||||
|
var w = " ";
|
||||||
|
a.cssClasses.length > 0 && (w = w + a.cssClasses.join(" "));
|
||||||
|
const e = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", m.width + 2 * t.padding).attr("height", m.height + t.padding + 0.5 * t.dividerMargin).attr("class", w).node().getBBox().width;
|
||||||
|
return c.node().childNodes.forEach(function(d) {
|
||||||
|
d.setAttribute("x", (e - d.getBBox().width) / 2);
|
||||||
|
}), a.tooltip && c.insert("title").text(a.tooltip), x && x.attr("x2", e), y && y.attr("x2", e), g.width = e, g.height = m.height + t.padding + 0.5 * t.dividerMargin, g;
|
||||||
|
}, C = function(i) {
|
||||||
|
let a = i.id;
|
||||||
|
return i.type && (a += "<" + I(i.type) + ">"), a;
|
||||||
|
}, Z = function(i, a, t, o) {
|
||||||
|
u.debug("Rendering note ", a, t);
|
||||||
|
const p = a.id, g = {
|
||||||
|
id: p,
|
||||||
|
text: a.text,
|
||||||
|
width: 0,
|
||||||
|
height: 0
|
||||||
|
}, s = i.append("g").attr("id", p).attr("class", "classGroup");
|
||||||
|
let c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
||||||
|
const n = JSON.parse(`"${a.text}"`).split(`
|
||||||
|
`);
|
||||||
|
n.forEach(function(x) {
|
||||||
|
u.debug(`Adding line: ${x}`), c.append("tspan").text(x).attr("class", "title").attr("dy", t.textHeight);
|
||||||
|
});
|
||||||
|
const r = s.node().getBBox(), h = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", r.width + 2 * t.padding).attr(
|
||||||
|
"height",
|
||||||
|
r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin
|
||||||
|
).node().getBBox().width;
|
||||||
|
return c.node().childNodes.forEach(function(x) {
|
||||||
|
x.setAttribute("x", (h - x.getBBox().width) / 2);
|
||||||
|
}), g.width = h, g.height = r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin, g;
|
||||||
|
}, v = function(i, a, t, o) {
|
||||||
|
const { displayText: p, cssStyle: g } = a.getDisplayDetails(), s = i.append("tspan").attr("x", o.padding).text(p);
|
||||||
|
g !== "" && s.attr("style", a.cssStyle), t || s.attr("dy", o.textHeight);
|
||||||
|
}, N = {
|
||||||
|
getClassTitleString: C,
|
||||||
|
drawClass: J,
|
||||||
|
drawEdge: $,
|
||||||
|
drawNote: Z
|
||||||
|
};
|
||||||
|
let T = {};
|
||||||
|
const E = 20, L = function(i) {
|
||||||
|
const a = Object.entries(T).find((t) => t[1].label === i);
|
||||||
|
if (a)
|
||||||
|
return a[0];
|
||||||
|
}, R = function(i) {
|
||||||
|
i.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), i.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), i.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
|
||||||
|
}, F = function(i, a, t, o) {
|
||||||
|
const p = H().class;
|
||||||
|
T = {}, u.info("Rendering diagram " + i);
|
||||||
|
const g = H().securityLevel;
|
||||||
|
let s;
|
||||||
|
g === "sandbox" && (s = M("#i" + a));
|
||||||
|
const c = g === "sandbox" ? M(s.nodes()[0].contentDocument.body) : M("body"), n = c.select(`[id='${a}']`);
|
||||||
|
R(n);
|
||||||
|
const r = new P({
|
||||||
|
multigraph: !0
|
||||||
|
});
|
||||||
|
r.setGraph({
|
||||||
|
isMultiGraph: !0
|
||||||
|
}), r.setDefaultEdgeLabel(function() {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
const f = o.db.getClasses(), h = Object.keys(f);
|
||||||
|
for (const e of h) {
|
||||||
|
const d = f[e], l = N.drawClass(n, d, p, o);
|
||||||
|
T[l.id] = l, r.setNode(l.id, l), u.info("Org height: " + l.height);
|
||||||
|
}
|
||||||
|
o.db.getRelations().forEach(function(e) {
|
||||||
|
u.info(
|
||||||
|
"tjoho" + L(e.id1) + L(e.id2) + JSON.stringify(e)
|
||||||
|
), r.setEdge(
|
||||||
|
L(e.id1),
|
||||||
|
L(e.id2),
|
||||||
|
{
|
||||||
|
relation: e
|
||||||
|
},
|
||||||
|
e.title || "DEFAULT"
|
||||||
|
);
|
||||||
|
}), o.db.getNotes().forEach(function(e) {
|
||||||
|
u.debug(`Adding note: ${JSON.stringify(e)}`);
|
||||||
|
const d = N.drawNote(n, e, p, o);
|
||||||
|
T[d.id] = d, r.setNode(d.id, d), e.class && e.class in f && r.setEdge(
|
||||||
|
e.id,
|
||||||
|
L(e.class),
|
||||||
|
{
|
||||||
|
relation: {
|
||||||
|
id1: e.id,
|
||||||
|
id2: e.class,
|
||||||
|
relation: {
|
||||||
|
type1: "none",
|
||||||
|
type2: "none",
|
||||||
|
lineType: 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"DEFAULT"
|
||||||
|
);
|
||||||
|
}), X(r), r.nodes().forEach(function(e) {
|
||||||
|
e !== void 0 && r.node(e) !== void 0 && (u.debug("Node " + e + ": " + JSON.stringify(r.node(e))), c.select("#" + (o.db.lookUpDomId(e) || e)).attr(
|
||||||
|
"transform",
|
||||||
|
"translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
|
||||||
|
));
|
||||||
|
}), r.edges().forEach(function(e) {
|
||||||
|
e !== void 0 && r.edge(e) !== void 0 && (u.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(r.edge(e))), N.drawEdge(n, r.edge(e), r.edge(e).relation, p, o));
|
||||||
|
});
|
||||||
|
const y = n.node().getBBox(), m = y.width + E * 2, w = y.height + E * 2;
|
||||||
|
O(n, w, m, p.useMaxWidth);
|
||||||
|
const b = `${y.x - E} ${y.y - E} ${m} ${w}`;
|
||||||
|
u.debug(`viewBox ${b}`), n.attr("viewBox", b);
|
||||||
|
}, z = {
|
||||||
|
draw: F
|
||||||
|
}, D = {
|
||||||
|
parser: G,
|
||||||
|
db: S,
|
||||||
|
renderer: z,
|
||||||
|
styles: A,
|
||||||
|
init: (i) => {
|
||||||
|
i.class || (i.class = {}), i.class.arrowMarkerAbsolute = i.arrowMarkerAbsolute, S.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export {
|
||||||
|
D as diagram
|
||||||
|
};
|
|
@ -0,0 +1,288 @@
|
||||||
|
import { p as parser, d as db, s as styles } from "./styles-6e7f2b1b.js";
|
||||||
|
import { l as log, c as getConfig, j as d3select, z as utils, r as setupGraphViewbox, q as interpolateToCurve, n as curveLinear, o as getStylesFromArray, f as common } from "./mermaid-491db2d9.js";
|
||||||
|
import { G as Graph } from "./layout-a7b9ff07.js";
|
||||||
|
import { r as render } from "./index-cc269c15.js";
|
||||||
|
import "./edges-9bf94b2d.js";
|
||||||
|
import "./createText-2660bae1.js";
|
||||||
|
import "./line-8fd2bd69.js";
|
||||||
|
import "./array-b7dcf730.js";
|
||||||
|
import "./constant-b644328d.js";
|
||||||
|
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
|
||||||
|
let conf = {
|
||||||
|
dividerMargin: 10,
|
||||||
|
padding: 5,
|
||||||
|
textHeight: 10,
|
||||||
|
curve: void 0
|
||||||
|
};
|
||||||
|
const addNamespaces = function(namespaces, g, _id, diagObj) {
|
||||||
|
const keys = Object.keys(namespaces);
|
||||||
|
log.info("keys:", keys);
|
||||||
|
log.info(namespaces);
|
||||||
|
keys.forEach(function(id) {
|
||||||
|
var _a, _b;
|
||||||
|
const vertex = namespaces[id];
|
||||||
|
const shape = "rect";
|
||||||
|
const node = {
|
||||||
|
shape,
|
||||||
|
id: vertex.id,
|
||||||
|
domId: vertex.domId,
|
||||||
|
labelText: sanitizeText(vertex.id),
|
||||||
|
labelStyle: "",
|
||||||
|
style: "fill: none; stroke: black",
|
||||||
|
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
||||||
|
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
||||||
|
};
|
||||||
|
g.setNode(vertex.id, node);
|
||||||
|
addClasses(vertex.classes, g, _id, diagObj, vertex.id);
|
||||||
|
log.info("setNode", node);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const addClasses = function(classes, g, _id, diagObj, parent) {
|
||||||
|
const keys = Object.keys(classes);
|
||||||
|
log.info("keys:", keys);
|
||||||
|
log.info(classes);
|
||||||
|
keys.filter((id) => classes[id].parent == parent).forEach(function(id) {
|
||||||
|
var _a, _b;
|
||||||
|
const vertex = classes[id];
|
||||||
|
const cssClassStr = vertex.cssClasses.join(" ");
|
||||||
|
const styles2 = { labelStyle: "", style: "" };
|
||||||
|
const vertexText = vertex.label ?? vertex.id;
|
||||||
|
const radius = 0;
|
||||||
|
const shape = "class_box";
|
||||||
|
const node = {
|
||||||
|
labelStyle: styles2.labelStyle,
|
||||||
|
shape,
|
||||||
|
labelText: sanitizeText(vertexText),
|
||||||
|
classData: vertex,
|
||||||
|
rx: radius,
|
||||||
|
ry: radius,
|
||||||
|
class: cssClassStr,
|
||||||
|
style: styles2.style,
|
||||||
|
id: vertex.id,
|
||||||
|
domId: vertex.domId,
|
||||||
|
tooltip: diagObj.db.getTooltip(vertex.id, parent) || "",
|
||||||
|
haveCallback: vertex.haveCallback,
|
||||||
|
link: vertex.link,
|
||||||
|
width: vertex.type === "group" ? 500 : void 0,
|
||||||
|
type: vertex.type,
|
||||||
|
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
||||||
|
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
||||||
|
};
|
||||||
|
g.setNode(vertex.id, node);
|
||||||
|
if (parent) {
|
||||||
|
g.setParent(vertex.id, parent);
|
||||||
|
}
|
||||||
|
log.info("setNode", node);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const addNotes = function(notes, g, startEdgeId, classes) {
|
||||||
|
log.info(notes);
|
||||||
|
notes.forEach(function(note, i) {
|
||||||
|
var _a, _b;
|
||||||
|
const vertex = note;
|
||||||
|
const cssNoteStr = "";
|
||||||
|
const styles2 = { labelStyle: "", style: "" };
|
||||||
|
const vertexText = vertex.text;
|
||||||
|
const radius = 0;
|
||||||
|
const shape = "note";
|
||||||
|
const node = {
|
||||||
|
labelStyle: styles2.labelStyle,
|
||||||
|
shape,
|
||||||
|
labelText: sanitizeText(vertexText),
|
||||||
|
noteData: vertex,
|
||||||
|
rx: radius,
|
||||||
|
ry: radius,
|
||||||
|
class: cssNoteStr,
|
||||||
|
style: styles2.style,
|
||||||
|
id: vertex.id,
|
||||||
|
domId: vertex.id,
|
||||||
|
tooltip: "",
|
||||||
|
type: "note",
|
||||||
|
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
||||||
|
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
||||||
|
};
|
||||||
|
g.setNode(vertex.id, node);
|
||||||
|
log.info("setNode", node);
|
||||||
|
if (!vertex.class || !(vertex.class in classes)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const edgeId = startEdgeId + i;
|
||||||
|
const edgeData = {
|
||||||
|
id: `edgeNote${edgeId}`,
|
||||||
|
//Set relationship style and line type
|
||||||
|
classes: "relation",
|
||||||
|
pattern: "dotted",
|
||||||
|
// Set link type for rendering
|
||||||
|
arrowhead: "none",
|
||||||
|
//Set edge extra labels
|
||||||
|
startLabelRight: "",
|
||||||
|
endLabelLeft: "",
|
||||||
|
//Set relation arrow types
|
||||||
|
arrowTypeStart: "none",
|
||||||
|
arrowTypeEnd: "none",
|
||||||
|
style: "fill:none",
|
||||||
|
labelStyle: "",
|
||||||
|
curve: interpolateToCurve(conf.curve, curveLinear)
|
||||||
|
};
|
||||||
|
g.setEdge(vertex.id, vertex.class, edgeData, edgeId);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const addRelations = function(relations, g) {
|
||||||
|
const conf2 = getConfig().flowchart;
|
||||||
|
let cnt = 0;
|
||||||
|
relations.forEach(function(edge) {
|
||||||
|
var _a;
|
||||||
|
cnt++;
|
||||||
|
const edgeData = {
|
||||||
|
//Set relationship style and line type
|
||||||
|
classes: "relation",
|
||||||
|
pattern: edge.relation.lineType == 1 ? "dashed" : "solid",
|
||||||
|
id: "id" + cnt,
|
||||||
|
// Set link type for rendering
|
||||||
|
arrowhead: edge.type === "arrow_open" ? "none" : "normal",
|
||||||
|
//Set edge extra labels
|
||||||
|
startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1,
|
||||||
|
endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2,
|
||||||
|
//Set relation arrow types
|
||||||
|
arrowTypeStart: getArrowMarker(edge.relation.type1),
|
||||||
|
arrowTypeEnd: getArrowMarker(edge.relation.type2),
|
||||||
|
style: "fill:none",
|
||||||
|
labelStyle: "",
|
||||||
|
curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear)
|
||||||
|
};
|
||||||
|
log.info(edgeData, edge);
|
||||||
|
if (edge.style !== void 0) {
|
||||||
|
const styles2 = getStylesFromArray(edge.style);
|
||||||
|
edgeData.style = styles2.style;
|
||||||
|
edgeData.labelStyle = styles2.labelStyle;
|
||||||
|
}
|
||||||
|
edge.text = edge.title;
|
||||||
|
if (edge.text === void 0) {
|
||||||
|
if (edge.style !== void 0) {
|
||||||
|
edgeData.arrowheadStyle = "fill: #333";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
edgeData.arrowheadStyle = "fill: #333";
|
||||||
|
edgeData.labelpos = "c";
|
||||||
|
if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) {
|
||||||
|
edgeData.labelType = "html";
|
||||||
|
edgeData.label = '<span class="edgeLabel">' + edge.text + "</span>";
|
||||||
|
} else {
|
||||||
|
edgeData.labelType = "text";
|
||||||
|
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
|
||||||
|
if (edge.style === void 0) {
|
||||||
|
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
|
||||||
|
}
|
||||||
|
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.setEdge(edge.id1, edge.id2, edgeData, cnt);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const setConf = function(cnf) {
|
||||||
|
conf = {
|
||||||
|
...conf,
|
||||||
|
...cnf
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const draw = async function(text, id, _version, diagObj) {
|
||||||
|
log.info("Drawing class - ", id);
|
||||||
|
const conf2 = getConfig().flowchart ?? getConfig().class;
|
||||||
|
const securityLevel = getConfig().securityLevel;
|
||||||
|
log.info("config:", conf2);
|
||||||
|
const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50;
|
||||||
|
const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50;
|
||||||
|
const g = new Graph({
|
||||||
|
multigraph: true,
|
||||||
|
compound: true
|
||||||
|
}).setGraph({
|
||||||
|
rankdir: diagObj.db.getDirection(),
|
||||||
|
nodesep: nodeSpacing,
|
||||||
|
ranksep: rankSpacing,
|
||||||
|
marginx: 8,
|
||||||
|
marginy: 8
|
||||||
|
}).setDefaultEdgeLabel(function() {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
const namespaces = diagObj.db.getNamespaces();
|
||||||
|
const classes = diagObj.db.getClasses();
|
||||||
|
const relations = diagObj.db.getRelations();
|
||||||
|
const notes = diagObj.db.getNotes();
|
||||||
|
log.info(relations);
|
||||||
|
addNamespaces(namespaces, g, id, diagObj);
|
||||||
|
addClasses(classes, g, id, diagObj);
|
||||||
|
addRelations(relations, g);
|
||||||
|
addNotes(notes, g, relations.length + 1, classes);
|
||||||
|
let sandboxElement;
|
||||||
|
if (securityLevel === "sandbox") {
|
||||||
|
sandboxElement = d3select("#i" + id);
|
||||||
|
}
|
||||||
|
const root = securityLevel === "sandbox" ? d3select(sandboxElement.nodes()[0].contentDocument.body) : d3select("body");
|
||||||
|
const svg = root.select(`[id="${id}"]`);
|
||||||
|
const element = root.select("#" + id + " g");
|
||||||
|
await render(
|
||||||
|
element,
|
||||||
|
g,
|
||||||
|
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
||||||
|
"classDiagram",
|
||||||
|
id
|
||||||
|
);
|
||||||
|
utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle());
|
||||||
|
setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth);
|
||||||
|
if (!(conf2 == null ? void 0 : conf2.htmlLabels)) {
|
||||||
|
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
|
||||||
|
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
||||||
|
for (const label of labels) {
|
||||||
|
const dim = label.getBBox();
|
||||||
|
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||||
|
rect.setAttribute("rx", 0);
|
||||||
|
rect.setAttribute("ry", 0);
|
||||||
|
rect.setAttribute("width", dim.width);
|
||||||
|
rect.setAttribute("height", dim.height);
|
||||||
|
label.insertBefore(rect, label.firstChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function getArrowMarker(type) {
|
||||||
|
let marker;
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
marker = "aggregation";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
marker = "extension";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
marker = "composition";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
marker = "dependency";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
marker = "lollipop";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
marker = "none";
|
||||||
|
}
|
||||||
|
return marker;
|
||||||
|
}
|
||||||
|
const renderer = {
|
||||||
|
setConf,
|
||||||
|
draw
|
||||||
|
};
|
||||||
|
const diagram = {
|
||||||
|
parser,
|
||||||
|
db,
|
||||||
|
renderer,
|
||||||
|
styles,
|
||||||
|
init: (cnf) => {
|
||||||
|
if (!cnf.class) {
|
||||||
|
cnf.class = {};
|
||||||
|
}
|
||||||
|
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||||
|
db.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export {
|
||||||
|
diagram
|
||||||
|
};
|
|
@ -0,0 +1,204 @@
|
||||||
|
import { p as R, d as N, s as B } from "./styles-483f8ae9.js";
|
||||||
|
import { l as c, c as r, j as k, z as G, r as _, q as E, n as C, o as z, f as A } from "./mermaid-e4a58915.js";
|
||||||
|
import { G as q } from "./layout-545b2d5b.js";
|
||||||
|
import { r as P } from "./index-5f5016a9.js";
|
||||||
|
import "./edges-020bfa8c.js";
|
||||||
|
import "./createText-4be7776a.js";
|
||||||
|
import "./line-4ba3c4fa.js";
|
||||||
|
import "./array-2ff2c7a6.js";
|
||||||
|
import "./constant-2fe7eae5.js";
|
||||||
|
const S = (o) => A.sanitizeText(o, r());
|
||||||
|
let v = {
|
||||||
|
dividerMargin: 10,
|
||||||
|
padding: 5,
|
||||||
|
textHeight: 10,
|
||||||
|
curve: void 0
|
||||||
|
};
|
||||||
|
const $ = function(o, t, p, n) {
|
||||||
|
const e = Object.keys(o);
|
||||||
|
c.info("keys:", e), c.info(o), e.forEach(function(s) {
|
||||||
|
var y, d;
|
||||||
|
const l = o[s], i = {
|
||||||
|
shape: "rect",
|
||||||
|
id: l.id,
|
||||||
|
domId: l.domId,
|
||||||
|
labelText: S(l.id),
|
||||||
|
labelStyle: "",
|
||||||
|
style: "fill: none; stroke: black",
|
||||||
|
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
||||||
|
padding: ((y = r().flowchart) == null ? void 0 : y.padding) ?? ((d = r().class) == null ? void 0 : d.padding)
|
||||||
|
};
|
||||||
|
t.setNode(l.id, i), I(l.classes, t, p, n, l.id), c.info("setNode", i);
|
||||||
|
});
|
||||||
|
}, I = function(o, t, p, n, e) {
|
||||||
|
const s = Object.keys(o);
|
||||||
|
c.info("keys:", s), c.info(o), s.filter((l) => o[l].parent == e).forEach(function(l) {
|
||||||
|
var h, u;
|
||||||
|
const a = o[l], i = a.cssClasses.join(" "), y = { labelStyle: "", style: "" }, d = a.label ?? a.id, f = 0, m = "class_box", b = {
|
||||||
|
labelStyle: y.labelStyle,
|
||||||
|
shape: m,
|
||||||
|
labelText: S(d),
|
||||||
|
classData: a,
|
||||||
|
rx: f,
|
||||||
|
ry: f,
|
||||||
|
class: i,
|
||||||
|
style: y.style,
|
||||||
|
id: a.id,
|
||||||
|
domId: a.domId,
|
||||||
|
tooltip: n.db.getTooltip(a.id, e) || "",
|
||||||
|
haveCallback: a.haveCallback,
|
||||||
|
link: a.link,
|
||||||
|
width: a.type === "group" ? 500 : void 0,
|
||||||
|
type: a.type,
|
||||||
|
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
||||||
|
padding: ((h = r().flowchart) == null ? void 0 : h.padding) ?? ((u = r().class) == null ? void 0 : u.padding)
|
||||||
|
};
|
||||||
|
t.setNode(a.id, b), e && t.setParent(a.id, e), c.info("setNode", b);
|
||||||
|
});
|
||||||
|
}, F = function(o, t, p, n) {
|
||||||
|
c.info(o), o.forEach(function(e, s) {
|
||||||
|
var u, x;
|
||||||
|
const l = e, a = "", i = { labelStyle: "", style: "" }, y = l.text, d = 0, f = "note", m = {
|
||||||
|
labelStyle: i.labelStyle,
|
||||||
|
shape: f,
|
||||||
|
labelText: S(y),
|
||||||
|
noteData: l,
|
||||||
|
rx: d,
|
||||||
|
ry: d,
|
||||||
|
class: a,
|
||||||
|
style: i.style,
|
||||||
|
id: l.id,
|
||||||
|
domId: l.id,
|
||||||
|
tooltip: "",
|
||||||
|
type: "note",
|
||||||
|
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
||||||
|
padding: ((u = r().flowchart) == null ? void 0 : u.padding) ?? ((x = r().class) == null ? void 0 : x.padding)
|
||||||
|
};
|
||||||
|
if (t.setNode(l.id, m), c.info("setNode", m), !l.class || !(l.class in n))
|
||||||
|
return;
|
||||||
|
const b = p + s, h = {
|
||||||
|
id: `edgeNote${b}`,
|
||||||
|
//Set relationship style and line type
|
||||||
|
classes: "relation",
|
||||||
|
pattern: "dotted",
|
||||||
|
// Set link type for rendering
|
||||||
|
arrowhead: "none",
|
||||||
|
//Set edge extra labels
|
||||||
|
startLabelRight: "",
|
||||||
|
endLabelLeft: "",
|
||||||
|
//Set relation arrow types
|
||||||
|
arrowTypeStart: "none",
|
||||||
|
arrowTypeEnd: "none",
|
||||||
|
style: "fill:none",
|
||||||
|
labelStyle: "",
|
||||||
|
curve: E(v.curve, C)
|
||||||
|
};
|
||||||
|
t.setEdge(l.id, l.class, h, b);
|
||||||
|
});
|
||||||
|
}, H = function(o, t) {
|
||||||
|
const p = r().flowchart;
|
||||||
|
let n = 0;
|
||||||
|
o.forEach(function(e) {
|
||||||
|
var l;
|
||||||
|
n++;
|
||||||
|
const s = {
|
||||||
|
//Set relationship style and line type
|
||||||
|
classes: "relation",
|
||||||
|
pattern: e.relation.lineType == 1 ? "dashed" : "solid",
|
||||||
|
id: "id" + n,
|
||||||
|
// Set link type for rendering
|
||||||
|
arrowhead: e.type === "arrow_open" ? "none" : "normal",
|
||||||
|
//Set edge extra labels
|
||||||
|
startLabelRight: e.relationTitle1 === "none" ? "" : e.relationTitle1,
|
||||||
|
endLabelLeft: e.relationTitle2 === "none" ? "" : e.relationTitle2,
|
||||||
|
//Set relation arrow types
|
||||||
|
arrowTypeStart: D(e.relation.type1),
|
||||||
|
arrowTypeEnd: D(e.relation.type2),
|
||||||
|
style: "fill:none",
|
||||||
|
labelStyle: "",
|
||||||
|
curve: E(p == null ? void 0 : p.curve, C)
|
||||||
|
};
|
||||||
|
if (c.info(s, e), e.style !== void 0) {
|
||||||
|
const a = z(e.style);
|
||||||
|
s.style = a.style, s.labelStyle = a.labelStyle;
|
||||||
|
}
|
||||||
|
e.text = e.title, e.text === void 0 ? e.style !== void 0 && (s.arrowheadStyle = "fill: #333") : (s.arrowheadStyle = "fill: #333", s.labelpos = "c", ((l = r().flowchart) == null ? void 0 : l.htmlLabels) ?? r().htmlLabels ? (s.labelType = "html", s.label = '<span class="edgeLabel">' + e.text + "</span>") : (s.labelType = "text", s.label = e.text.replace(A.lineBreakRegex, `
|
||||||
|
`), e.style === void 0 && (s.style = s.style || "stroke: #333; stroke-width: 1.5px;fill:none"), s.labelStyle = s.labelStyle.replace("color:", "fill:"))), t.setEdge(e.id1, e.id2, s, n);
|
||||||
|
});
|
||||||
|
}, V = function(o) {
|
||||||
|
v = {
|
||||||
|
...v,
|
||||||
|
...o
|
||||||
|
};
|
||||||
|
}, W = async function(o, t, p, n) {
|
||||||
|
c.info("Drawing class - ", t);
|
||||||
|
const e = r().flowchart ?? r().class, s = r().securityLevel;
|
||||||
|
c.info("config:", e);
|
||||||
|
const l = (e == null ? void 0 : e.nodeSpacing) ?? 50, a = (e == null ? void 0 : e.rankSpacing) ?? 50, i = new q({
|
||||||
|
multigraph: !0,
|
||||||
|
compound: !0
|
||||||
|
}).setGraph({
|
||||||
|
rankdir: n.db.getDirection(),
|
||||||
|
nodesep: l,
|
||||||
|
ranksep: a,
|
||||||
|
marginx: 8,
|
||||||
|
marginy: 8
|
||||||
|
}).setDefaultEdgeLabel(function() {
|
||||||
|
return {};
|
||||||
|
}), y = n.db.getNamespaces(), d = n.db.getClasses(), f = n.db.getRelations(), m = n.db.getNotes();
|
||||||
|
c.info(f), $(y, i, t, n), I(d, i, t, n), H(f, i), F(m, i, f.length + 1, d);
|
||||||
|
let b;
|
||||||
|
s === "sandbox" && (b = k("#i" + t));
|
||||||
|
const h = s === "sandbox" ? k(b.nodes()[0].contentDocument.body) : k("body"), u = h.select(`[id="${t}"]`), x = h.select("#" + t + " g");
|
||||||
|
if (await P(
|
||||||
|
x,
|
||||||
|
i,
|
||||||
|
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
||||||
|
"classDiagram",
|
||||||
|
t
|
||||||
|
), G.insertTitle(u, "classTitleText", (e == null ? void 0 : e.titleTopMargin) ?? 5, n.db.getDiagramTitle()), _(i, u, e == null ? void 0 : e.diagramPadding, e == null ? void 0 : e.useMaxWidth), !(e != null && e.htmlLabels)) {
|
||||||
|
const T = s === "sandbox" ? b.nodes()[0].contentDocument : document, M = T.querySelectorAll('[id="' + t + '"] .edgeLabel .label');
|
||||||
|
for (const w of M) {
|
||||||
|
const L = w.getBBox(), g = T.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||||
|
g.setAttribute("rx", 0), g.setAttribute("ry", 0), g.setAttribute("width", L.width), g.setAttribute("height", L.height), w.insertBefore(g, w.firstChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function D(o) {
|
||||||
|
let t;
|
||||||
|
switch (o) {
|
||||||
|
case 0:
|
||||||
|
t = "aggregation";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
t = "extension";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
t = "composition";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
t = "dependency";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
t = "lollipop";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
t = "none";
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
const J = {
|
||||||
|
setConf: V,
|
||||||
|
draw: W
|
||||||
|
}, te = {
|
||||||
|
parser: R,
|
||||||
|
db: N,
|
||||||
|
renderer: J,
|
||||||
|
styles: B,
|
||||||
|
init: (o) => {
|
||||||
|
o.class || (o.class = {}), o.class.arrowMarkerAbsolute = o.arrowMarkerAbsolute, N.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export {
|
||||||
|
te as diagram
|
||||||
|
};
|
|
@ -0,0 +1,298 @@
|
||||||
|
import { p as parser, d as db, s as styles } from "./styles-8b67d7cb.js";
|
||||||
|
import { select, curveLinear } from "d3";
|
||||||
|
import * as graphlib from "dagre-d3-es/src/graphlib/index.js";
|
||||||
|
import { l as log, c as getConfig, u as utils, o as setupGraphViewbox, n as interpolateToCurve, k as getStylesFromArray, e as common } from "./mermaid-0d192ec3.js";
|
||||||
|
import { r as render } from "./index-f9462f3f.js";
|
||||||
|
import "ts-dedent";
|
||||||
|
import "dayjs";
|
||||||
|
import "@braintree/sanitize-url";
|
||||||
|
import "dompurify";
|
||||||
|
import "khroma";
|
||||||
|
import "lodash-es/memoize.js";
|
||||||
|
import "lodash-es/merge.js";
|
||||||
|
import "stylis";
|
||||||
|
import "lodash-es/isEmpty.js";
|
||||||
|
import "dagre-d3-es/src/dagre/index.js";
|
||||||
|
import "dagre-d3-es/src/graphlib/json.js";
|
||||||
|
import "./edges-f15a7e05.js";
|
||||||
|
import "./createText-80c3befb.js";
|
||||||
|
import "mdast-util-from-markdown";
|
||||||
|
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
|
||||||
|
let conf = {
|
||||||
|
dividerMargin: 10,
|
||||||
|
padding: 5,
|
||||||
|
textHeight: 10,
|
||||||
|
curve: void 0
|
||||||
|
};
|
||||||
|
const addNamespaces = function(namespaces, g, _id, diagObj) {
|
||||||
|
const keys = Object.keys(namespaces);
|
||||||
|
log.info("keys:", keys);
|
||||||
|
log.info(namespaces);
|
||||||
|
keys.forEach(function(id) {
|
||||||
|
var _a, _b;
|
||||||
|
const vertex = namespaces[id];
|
||||||
|
const shape = "rect";
|
||||||
|
const node = {
|
||||||
|
shape,
|
||||||
|
id: vertex.id,
|
||||||
|
domId: vertex.domId,
|
||||||
|
labelText: sanitizeText(vertex.id),
|
||||||
|
labelStyle: "",
|
||||||
|
style: "fill: none; stroke: black",
|
||||||
|
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
||||||
|
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
||||||
|
};
|
||||||
|
g.setNode(vertex.id, node);
|
||||||
|
addClasses(vertex.classes, g, _id, diagObj, vertex.id);
|
||||||
|
log.info("setNode", node);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const addClasses = function(classes, g, _id, diagObj, parent) {
|
||||||
|
const keys = Object.keys(classes);
|
||||||
|
log.info("keys:", keys);
|
||||||
|
log.info(classes);
|
||||||
|
keys.filter((id) => classes[id].parent == parent).forEach(function(id) {
|
||||||
|
var _a, _b;
|
||||||
|
const vertex = classes[id];
|
||||||
|
const cssClassStr = vertex.cssClasses.join(" ");
|
||||||
|
const styles2 = { labelStyle: "", style: "" };
|
||||||
|
const vertexText = vertex.label ?? vertex.id;
|
||||||
|
const radius = 0;
|
||||||
|
const shape = "class_box";
|
||||||
|
const node = {
|
||||||
|
labelStyle: styles2.labelStyle,
|
||||||
|
shape,
|
||||||
|
labelText: sanitizeText(vertexText),
|
||||||
|
classData: vertex,
|
||||||
|
rx: radius,
|
||||||
|
ry: radius,
|
||||||
|
class: cssClassStr,
|
||||||
|
style: styles2.style,
|
||||||
|
id: vertex.id,
|
||||||
|
domId: vertex.domId,
|
||||||
|
tooltip: diagObj.db.getTooltip(vertex.id, parent) || "",
|
||||||
|
haveCallback: vertex.haveCallback,
|
||||||
|
link: vertex.link,
|
||||||
|
width: vertex.type === "group" ? 500 : void 0,
|
||||||
|
type: vertex.type,
|
||||||
|
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
||||||
|
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
||||||
|
};
|
||||||
|
g.setNode(vertex.id, node);
|
||||||
|
if (parent) {
|
||||||
|
g.setParent(vertex.id, parent);
|
||||||
|
}
|
||||||
|
log.info("setNode", node);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const addNotes = function(notes, g, startEdgeId, classes) {
|
||||||
|
log.info(notes);
|
||||||
|
notes.forEach(function(note, i) {
|
||||||
|
var _a, _b;
|
||||||
|
const vertex = note;
|
||||||
|
const cssNoteStr = "";
|
||||||
|
const styles2 = { labelStyle: "", style: "" };
|
||||||
|
const vertexText = vertex.text;
|
||||||
|
const radius = 0;
|
||||||
|
const shape = "note";
|
||||||
|
const node = {
|
||||||
|
labelStyle: styles2.labelStyle,
|
||||||
|
shape,
|
||||||
|
labelText: sanitizeText(vertexText),
|
||||||
|
noteData: vertex,
|
||||||
|
rx: radius,
|
||||||
|
ry: radius,
|
||||||
|
class: cssNoteStr,
|
||||||
|
style: styles2.style,
|
||||||
|
id: vertex.id,
|
||||||
|
domId: vertex.id,
|
||||||
|
tooltip: "",
|
||||||
|
type: "note",
|
||||||
|
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
||||||
|
padding: ((_a = getConfig().flowchart) == null ? void 0 : _a.padding) ?? ((_b = getConfig().class) == null ? void 0 : _b.padding)
|
||||||
|
};
|
||||||
|
g.setNode(vertex.id, node);
|
||||||
|
log.info("setNode", node);
|
||||||
|
if (!vertex.class || !(vertex.class in classes)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const edgeId = startEdgeId + i;
|
||||||
|
const edgeData = {
|
||||||
|
id: `edgeNote${edgeId}`,
|
||||||
|
//Set relationship style and line type
|
||||||
|
classes: "relation",
|
||||||
|
pattern: "dotted",
|
||||||
|
// Set link type for rendering
|
||||||
|
arrowhead: "none",
|
||||||
|
//Set edge extra labels
|
||||||
|
startLabelRight: "",
|
||||||
|
endLabelLeft: "",
|
||||||
|
//Set relation arrow types
|
||||||
|
arrowTypeStart: "none",
|
||||||
|
arrowTypeEnd: "none",
|
||||||
|
style: "fill:none",
|
||||||
|
labelStyle: "",
|
||||||
|
curve: interpolateToCurve(conf.curve, curveLinear)
|
||||||
|
};
|
||||||
|
g.setEdge(vertex.id, vertex.class, edgeData, edgeId);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const addRelations = function(relations, g) {
|
||||||
|
const conf2 = getConfig().flowchart;
|
||||||
|
let cnt = 0;
|
||||||
|
relations.forEach(function(edge) {
|
||||||
|
var _a;
|
||||||
|
cnt++;
|
||||||
|
const edgeData = {
|
||||||
|
//Set relationship style and line type
|
||||||
|
classes: "relation",
|
||||||
|
pattern: edge.relation.lineType == 1 ? "dashed" : "solid",
|
||||||
|
id: "id" + cnt,
|
||||||
|
// Set link type for rendering
|
||||||
|
arrowhead: edge.type === "arrow_open" ? "none" : "normal",
|
||||||
|
//Set edge extra labels
|
||||||
|
startLabelRight: edge.relationTitle1 === "none" ? "" : edge.relationTitle1,
|
||||||
|
endLabelLeft: edge.relationTitle2 === "none" ? "" : edge.relationTitle2,
|
||||||
|
//Set relation arrow types
|
||||||
|
arrowTypeStart: getArrowMarker(edge.relation.type1),
|
||||||
|
arrowTypeEnd: getArrowMarker(edge.relation.type2),
|
||||||
|
style: "fill:none",
|
||||||
|
labelStyle: "",
|
||||||
|
curve: interpolateToCurve(conf2 == null ? void 0 : conf2.curve, curveLinear)
|
||||||
|
};
|
||||||
|
log.info(edgeData, edge);
|
||||||
|
if (edge.style !== void 0) {
|
||||||
|
const styles2 = getStylesFromArray(edge.style);
|
||||||
|
edgeData.style = styles2.style;
|
||||||
|
edgeData.labelStyle = styles2.labelStyle;
|
||||||
|
}
|
||||||
|
edge.text = edge.title;
|
||||||
|
if (edge.text === void 0) {
|
||||||
|
if (edge.style !== void 0) {
|
||||||
|
edgeData.arrowheadStyle = "fill: #333";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
edgeData.arrowheadStyle = "fill: #333";
|
||||||
|
edgeData.labelpos = "c";
|
||||||
|
if (((_a = getConfig().flowchart) == null ? void 0 : _a.htmlLabels) ?? getConfig().htmlLabels) {
|
||||||
|
edgeData.labelType = "html";
|
||||||
|
edgeData.label = '<span class="edgeLabel">' + edge.text + "</span>";
|
||||||
|
} else {
|
||||||
|
edgeData.labelType = "text";
|
||||||
|
edgeData.label = edge.text.replace(common.lineBreakRegex, "\n");
|
||||||
|
if (edge.style === void 0) {
|
||||||
|
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none";
|
||||||
|
}
|
||||||
|
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.setEdge(edge.id1, edge.id2, edgeData, cnt);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const setConf = function(cnf) {
|
||||||
|
conf = {
|
||||||
|
...conf,
|
||||||
|
...cnf
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const draw = async function(text, id, _version, diagObj) {
|
||||||
|
log.info("Drawing class - ", id);
|
||||||
|
const conf2 = getConfig().flowchart ?? getConfig().class;
|
||||||
|
const securityLevel = getConfig().securityLevel;
|
||||||
|
log.info("config:", conf2);
|
||||||
|
const nodeSpacing = (conf2 == null ? void 0 : conf2.nodeSpacing) ?? 50;
|
||||||
|
const rankSpacing = (conf2 == null ? void 0 : conf2.rankSpacing) ?? 50;
|
||||||
|
const g = new graphlib.Graph({
|
||||||
|
multigraph: true,
|
||||||
|
compound: true
|
||||||
|
}).setGraph({
|
||||||
|
rankdir: diagObj.db.getDirection(),
|
||||||
|
nodesep: nodeSpacing,
|
||||||
|
ranksep: rankSpacing,
|
||||||
|
marginx: 8,
|
||||||
|
marginy: 8
|
||||||
|
}).setDefaultEdgeLabel(function() {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
const namespaces = diagObj.db.getNamespaces();
|
||||||
|
const classes = diagObj.db.getClasses();
|
||||||
|
const relations = diagObj.db.getRelations();
|
||||||
|
const notes = diagObj.db.getNotes();
|
||||||
|
log.info(relations);
|
||||||
|
addNamespaces(namespaces, g, id, diagObj);
|
||||||
|
addClasses(classes, g, id, diagObj);
|
||||||
|
addRelations(relations, g);
|
||||||
|
addNotes(notes, g, relations.length + 1, classes);
|
||||||
|
let sandboxElement;
|
||||||
|
if (securityLevel === "sandbox") {
|
||||||
|
sandboxElement = select("#i" + id);
|
||||||
|
}
|
||||||
|
const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
|
||||||
|
const svg = root.select(`[id="${id}"]`);
|
||||||
|
const element = root.select("#" + id + " g");
|
||||||
|
await render(
|
||||||
|
element,
|
||||||
|
g,
|
||||||
|
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
||||||
|
"classDiagram",
|
||||||
|
id
|
||||||
|
);
|
||||||
|
utils.insertTitle(svg, "classTitleText", (conf2 == null ? void 0 : conf2.titleTopMargin) ?? 5, diagObj.db.getDiagramTitle());
|
||||||
|
setupGraphViewbox(g, svg, conf2 == null ? void 0 : conf2.diagramPadding, conf2 == null ? void 0 : conf2.useMaxWidth);
|
||||||
|
if (!(conf2 == null ? void 0 : conf2.htmlLabels)) {
|
||||||
|
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
|
||||||
|
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
||||||
|
for (const label of labels) {
|
||||||
|
const dim = label.getBBox();
|
||||||
|
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||||
|
rect.setAttribute("rx", 0);
|
||||||
|
rect.setAttribute("ry", 0);
|
||||||
|
rect.setAttribute("width", dim.width);
|
||||||
|
rect.setAttribute("height", dim.height);
|
||||||
|
label.insertBefore(rect, label.firstChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function getArrowMarker(type) {
|
||||||
|
let marker;
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
marker = "aggregation";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
marker = "extension";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
marker = "composition";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
marker = "dependency";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
marker = "lollipop";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
marker = "none";
|
||||||
|
}
|
||||||
|
return marker;
|
||||||
|
}
|
||||||
|
const renderer = {
|
||||||
|
setConf,
|
||||||
|
draw
|
||||||
|
};
|
||||||
|
const diagram = {
|
||||||
|
parser,
|
||||||
|
db,
|
||||||
|
renderer,
|
||||||
|
styles,
|
||||||
|
init: (cnf) => {
|
||||||
|
if (!cnf.class) {
|
||||||
|
cnf.class = {};
|
||||||
|
}
|
||||||
|
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||||
|
db.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export {
|
||||||
|
diagram
|
||||||
|
};
|
|
@ -0,0 +1,98 @@
|
||||||
|
import type { MermaidConfig } from './config.type.js';
|
||||||
|
export declare const defaultConfig: MermaidConfig;
|
||||||
|
export declare const updateCurrentConfig: (siteCfg: MermaidConfig, _directives: MermaidConfig[]) => MermaidConfig;
|
||||||
|
/**
|
||||||
|
* ## setSiteConfig
|
||||||
|
*
|
||||||
|
* | Function | Description | Type | Values |
|
||||||
|
* | ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
||||||
|
* | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
||||||
|
*
|
||||||
|
* **Notes:** Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls
|
||||||
|
* to reset() will reset the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig)
|
||||||
|
* will reset siteConfig and currentConfig to the defaultConfig Note: currentConfig is set in this
|
||||||
|
* function _Default value: At default, will mirror Global Config_
|
||||||
|
*
|
||||||
|
* @param conf - The base currentConfig to use as siteConfig
|
||||||
|
* @returns The new siteConfig
|
||||||
|
*/
|
||||||
|
export declare const setSiteConfig: (conf: MermaidConfig) => MermaidConfig;
|
||||||
|
export declare const saveConfigFromInitialize: (conf: MermaidConfig) => void;
|
||||||
|
export declare const updateSiteConfig: (conf: MermaidConfig) => MermaidConfig;
|
||||||
|
/**
|
||||||
|
* ## getSiteConfig
|
||||||
|
*
|
||||||
|
* | Function | Description | Type | Values |
|
||||||
|
* | ------------- | ------------------------------------------------- | ----------- | -------------------------------- |
|
||||||
|
* | setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig |
|
||||||
|
*
|
||||||
|
* **Notes**: Returns **any** values in siteConfig.
|
||||||
|
*
|
||||||
|
* @returns The siteConfig
|
||||||
|
*/
|
||||||
|
export declare const getSiteConfig: () => MermaidConfig;
|
||||||
|
/**
|
||||||
|
* ## setConfig
|
||||||
|
*
|
||||||
|
* | Function | Description | Type | Values |
|
||||||
|
* | ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
||||||
|
* | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
||||||
|
*
|
||||||
|
* **Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure
|
||||||
|
* keys. Any values found in conf with key found in siteConfig.secure will be replaced with the
|
||||||
|
* corresponding siteConfig value.
|
||||||
|
*
|
||||||
|
* @param conf - The potential currentConfig
|
||||||
|
* @returns The currentConfig merged with the sanitized conf
|
||||||
|
*/
|
||||||
|
export declare const setConfig: (conf: MermaidConfig) => MermaidConfig;
|
||||||
|
/**
|
||||||
|
* ## getConfig
|
||||||
|
*
|
||||||
|
* | Function | Description | Type | Return Values |
|
||||||
|
* | --------- | ------------------------- | ----------- | ------------------------------ |
|
||||||
|
* | getConfig | Obtains the currentConfig | Get Request | Any Values from current Config |
|
||||||
|
*
|
||||||
|
* **Notes**: Returns **any** the currentConfig
|
||||||
|
*
|
||||||
|
* @returns The currentConfig
|
||||||
|
*/
|
||||||
|
export declare const getConfig: () => MermaidConfig;
|
||||||
|
/**
|
||||||
|
* ## sanitize
|
||||||
|
*
|
||||||
|
* | Function | Description | Type | Values |
|
||||||
|
* | -------- | -------------------------------------- | ----------- | ------ |
|
||||||
|
* | sanitize | Sets the siteConfig to desired values. | Put Request | None |
|
||||||
|
*
|
||||||
|
* Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies
|
||||||
|
* options in-place
|
||||||
|
*
|
||||||
|
* @param options - The potential setConfig parameter
|
||||||
|
*/
|
||||||
|
export declare const sanitize: (options: any) => void;
|
||||||
|
/**
|
||||||
|
* Pushes in a directive to the configuration
|
||||||
|
*
|
||||||
|
* @param directive - The directive to push in
|
||||||
|
*/
|
||||||
|
export declare const addDirective: (directive: MermaidConfig) => void;
|
||||||
|
/**
|
||||||
|
* ## reset
|
||||||
|
*
|
||||||
|
* | Function | Description | Type | Required | Values |
|
||||||
|
* | -------- | ---------------------------- | ----------- | -------- | ------ |
|
||||||
|
* | reset | Resets currentConfig to conf | Put Request | Required | None |
|
||||||
|
*
|
||||||
|
* ## conf
|
||||||
|
*
|
||||||
|
* | Parameter | Description | Type | Required | Values |
|
||||||
|
* | --------- | -------------------------------------------------------------- | ---------- | -------- | -------------------------------------------- |
|
||||||
|
* | conf | base set of values, which currentConfig could be **reset** to. | Dictionary | Required | Any Values, with respect to the secure Array |
|
||||||
|
*
|
||||||
|
* **Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`)
|
||||||
|
*
|
||||||
|
* @param config - base set of values, which currentConfig could be **reset** to.
|
||||||
|
* Defaults to the current siteConfig (e.g returned by {@link getSiteConfig}).
|
||||||
|
*/
|
||||||
|
export declare const reset: (config?: MermaidConfig) => void;
|
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,63 @@
|
||||||
|
const p = Math.PI, v = 2 * p, c = 1e-6, q = v - c;
|
||||||
|
function y() {
|
||||||
|
this._x0 = this._y0 = // start of current subpath
|
||||||
|
this._x1 = this._y1 = null, this._ = "";
|
||||||
|
}
|
||||||
|
function C() {
|
||||||
|
return new y();
|
||||||
|
}
|
||||||
|
y.prototype = C.prototype = {
|
||||||
|
constructor: y,
|
||||||
|
moveTo: function(i, s) {
|
||||||
|
this._ += "M" + (this._x0 = this._x1 = +i) + "," + (this._y0 = this._y1 = +s);
|
||||||
|
},
|
||||||
|
closePath: function() {
|
||||||
|
this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
|
||||||
|
},
|
||||||
|
lineTo: function(i, s) {
|
||||||
|
this._ += "L" + (this._x1 = +i) + "," + (this._y1 = +s);
|
||||||
|
},
|
||||||
|
quadraticCurveTo: function(i, s, t, h) {
|
||||||
|
this._ += "Q" + +i + "," + +s + "," + (this._x1 = +t) + "," + (this._y1 = +h);
|
||||||
|
},
|
||||||
|
bezierCurveTo: function(i, s, t, h, _, e) {
|
||||||
|
this._ += "C" + +i + "," + +s + "," + +t + "," + +h + "," + (this._x1 = +_) + "," + (this._y1 = +e);
|
||||||
|
},
|
||||||
|
arcTo: function(i, s, t, h, _) {
|
||||||
|
i = +i, s = +s, t = +t, h = +h, _ = +_;
|
||||||
|
var e = this._x1, r = this._y1, f = t - i, a = h - s, n = e - i, u = r - s, o = n * n + u * u;
|
||||||
|
if (_ < 0)
|
||||||
|
throw new Error("negative radius: " + _);
|
||||||
|
if (this._x1 === null)
|
||||||
|
this._ += "M" + (this._x1 = i) + "," + (this._y1 = s);
|
||||||
|
else if (o > c)
|
||||||
|
if (!(Math.abs(u * f - a * n) > c) || !_)
|
||||||
|
this._ += "L" + (this._x1 = i) + "," + (this._y1 = s);
|
||||||
|
else {
|
||||||
|
var M = t - e, l = h - r, d = f * f + a * a, g = M * M + l * l, b = Math.sqrt(d), T = Math.sqrt(o), A = _ * Math.tan((p - Math.acos((d + o - g) / (2 * b * T))) / 2), x = A / T, L = A / b;
|
||||||
|
Math.abs(x - 1) > c && (this._ += "L" + (i + x * n) + "," + (s + x * u)), this._ += "A" + _ + "," + _ + ",0,0," + +(u * M > n * l) + "," + (this._x1 = i + L * f) + "," + (this._y1 = s + L * a);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
arc: function(i, s, t, h, _, e) {
|
||||||
|
i = +i, s = +s, t = +t, e = !!e;
|
||||||
|
var r = t * Math.cos(h), f = t * Math.sin(h), a = i + r, n = s + f, u = 1 ^ e, o = e ? h - _ : _ - h;
|
||||||
|
if (t < 0)
|
||||||
|
throw new Error("negative radius: " + t);
|
||||||
|
this._x1 === null ? this._ += "M" + a + "," + n : (Math.abs(this._x1 - a) > c || Math.abs(this._y1 - n) > c) && (this._ += "L" + a + "," + n), t && (o < 0 && (o = o % v + v), o > q ? this._ += "A" + t + "," + t + ",0,1," + u + "," + (i - r) + "," + (s - f) + "A" + t + "," + t + ",0,1," + u + "," + (this._x1 = a) + "," + (this._y1 = n) : o > c && (this._ += "A" + t + "," + t + ",0," + +(o >= p) + "," + u + "," + (this._x1 = i + t * Math.cos(_)) + "," + (this._y1 = s + t * Math.sin(_))));
|
||||||
|
},
|
||||||
|
rect: function(i, s, t, h) {
|
||||||
|
this._ += "M" + (this._x0 = this._x1 = +i) + "," + (this._y0 = this._y1 = +s) + "h" + +t + "v" + +h + "h" + -t + "Z";
|
||||||
|
},
|
||||||
|
toString: function() {
|
||||||
|
return this._;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function E(i) {
|
||||||
|
return function() {
|
||||||
|
return i;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
E as c,
|
||||||
|
C as p
|
||||||
|
};
|
|
@ -0,0 +1,84 @@
|
||||||
|
const pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon;
|
||||||
|
function Path() {
|
||||||
|
this._x0 = this._y0 = // start of current subpath
|
||||||
|
this._x1 = this._y1 = null;
|
||||||
|
this._ = "";
|
||||||
|
}
|
||||||
|
function path() {
|
||||||
|
return new Path();
|
||||||
|
}
|
||||||
|
Path.prototype = path.prototype = {
|
||||||
|
constructor: Path,
|
||||||
|
moveTo: function(x, y) {
|
||||||
|
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
|
||||||
|
},
|
||||||
|
closePath: function() {
|
||||||
|
if (this._x1 !== null) {
|
||||||
|
this._x1 = this._x0, this._y1 = this._y0;
|
||||||
|
this._ += "Z";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lineTo: function(x, y) {
|
||||||
|
this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
|
||||||
|
},
|
||||||
|
quadraticCurveTo: function(x1, y1, x, y) {
|
||||||
|
this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
||||||
|
},
|
||||||
|
bezierCurveTo: function(x1, y1, x2, y2, x, y) {
|
||||||
|
this._ += "C" + +x1 + "," + +y1 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
||||||
|
},
|
||||||
|
arcTo: function(x1, y1, x2, y2, r) {
|
||||||
|
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
||||||
|
var x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
|
||||||
|
if (r < 0)
|
||||||
|
throw new Error("negative radius: " + r);
|
||||||
|
if (this._x1 === null) {
|
||||||
|
this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
|
||||||
|
} else if (!(l01_2 > epsilon))
|
||||||
|
;
|
||||||
|
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
|
||||||
|
this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
|
||||||
|
} else {
|
||||||
|
var x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
|
||||||
|
if (Math.abs(t01 - 1) > epsilon) {
|
||||||
|
this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
|
||||||
|
}
|
||||||
|
this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
arc: function(x, y, r, a0, a1, ccw) {
|
||||||
|
x = +x, y = +y, r = +r, ccw = !!ccw;
|
||||||
|
var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
|
||||||
|
if (r < 0)
|
||||||
|
throw new Error("negative radius: " + r);
|
||||||
|
if (this._x1 === null) {
|
||||||
|
this._ += "M" + x0 + "," + y0;
|
||||||
|
} else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
|
||||||
|
this._ += "L" + x0 + "," + y0;
|
||||||
|
}
|
||||||
|
if (!r)
|
||||||
|
return;
|
||||||
|
if (da < 0)
|
||||||
|
da = da % tau + tau;
|
||||||
|
if (da > tauEpsilon) {
|
||||||
|
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
|
||||||
|
} else if (da > epsilon) {
|
||||||
|
this._ += "A" + r + "," + r + ",0," + +(da >= pi) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rect: function(x, y, w, h) {
|
||||||
|
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z";
|
||||||
|
},
|
||||||
|
toString: function() {
|
||||||
|
return this._;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function constant(x) {
|
||||||
|
return function constant2() {
|
||||||
|
return x;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export {
|
||||||
|
constant as c,
|
||||||
|
path as p
|
||||||
|
};
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,238 @@
|
||||||
|
import { l as log, J as decodeEntities } from "./mermaid-0d192ec3.js";
|
||||||
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
||||||
|
import { dedent } from "ts-dedent";
|
||||||
|
function preprocessMarkdown(markdown) {
|
||||||
|
const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, "\n");
|
||||||
|
const withoutExtraSpaces = dedent(withoutMultipleNewlines);
|
||||||
|
return withoutExtraSpaces;
|
||||||
|
}
|
||||||
|
function markdownToLines(markdown) {
|
||||||
|
const preprocessedMarkdown = preprocessMarkdown(markdown);
|
||||||
|
const { children } = fromMarkdown(preprocessedMarkdown);
|
||||||
|
const lines = [[]];
|
||||||
|
let currentLine = 0;
|
||||||
|
function processNode(node, parentType = "normal") {
|
||||||
|
if (node.type === "text") {
|
||||||
|
const textLines = node.value.split("\n");
|
||||||
|
textLines.forEach((textLine, index) => {
|
||||||
|
if (index !== 0) {
|
||||||
|
currentLine++;
|
||||||
|
lines.push([]);
|
||||||
|
}
|
||||||
|
textLine.split(" ").forEach((word) => {
|
||||||
|
if (word) {
|
||||||
|
lines[currentLine].push({ content: word, type: parentType });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else if (node.type === "strong" || node.type === "emphasis") {
|
||||||
|
node.children.forEach((contentNode) => {
|
||||||
|
processNode(contentNode, node.type);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
children.forEach((treeNode) => {
|
||||||
|
if (treeNode.type === "paragraph") {
|
||||||
|
treeNode.children.forEach((contentNode) => {
|
||||||
|
processNode(contentNode);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
function markdownToHTML(markdown) {
|
||||||
|
const { children } = fromMarkdown(markdown);
|
||||||
|
function output(node) {
|
||||||
|
if (node.type === "text") {
|
||||||
|
return node.value.replace(/\n/g, "<br/>");
|
||||||
|
} else if (node.type === "strong") {
|
||||||
|
return `<strong>${node.children.map(output).join("")}</strong>`;
|
||||||
|
} else if (node.type === "emphasis") {
|
||||||
|
return `<em>${node.children.map(output).join("")}</em>`;
|
||||||
|
} else if (node.type === "paragraph") {
|
||||||
|
return `<p>${node.children.map(output).join("")}</p>`;
|
||||||
|
}
|
||||||
|
return `Unsupported markdown: ${node.type}`;
|
||||||
|
}
|
||||||
|
return children.map(output).join("");
|
||||||
|
}
|
||||||
|
function splitTextToChars(text) {
|
||||||
|
if (Intl.Segmenter) {
|
||||||
|
return [...new Intl.Segmenter().segment(text)].map((s) => s.segment);
|
||||||
|
}
|
||||||
|
return [...text];
|
||||||
|
}
|
||||||
|
function splitWordToFitWidth(checkFit, word) {
|
||||||
|
const characters = splitTextToChars(word.content);
|
||||||
|
return splitWordToFitWidthRecursion(checkFit, [], characters, word.type);
|
||||||
|
}
|
||||||
|
function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type) {
|
||||||
|
if (remainingChars.length === 0) {
|
||||||
|
return [
|
||||||
|
{ content: usedChars.join(""), type },
|
||||||
|
{ content: "", type }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
const [nextChar, ...rest] = remainingChars;
|
||||||
|
const newWord = [...usedChars, nextChar];
|
||||||
|
if (checkFit([{ content: newWord.join(""), type }])) {
|
||||||
|
return splitWordToFitWidthRecursion(checkFit, newWord, rest, type);
|
||||||
|
}
|
||||||
|
if (usedChars.length === 0 && nextChar) {
|
||||||
|
usedChars.push(nextChar);
|
||||||
|
remainingChars.shift();
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{ content: usedChars.join(""), type },
|
||||||
|
{ content: remainingChars.join(""), type }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
function splitLineToFitWidth(line, checkFit) {
|
||||||
|
if (line.some(({ content }) => content.includes("\n"))) {
|
||||||
|
throw new Error("splitLineToFitWidth does not support newlines in the line");
|
||||||
|
}
|
||||||
|
return splitLineToFitWidthRecursion(line, checkFit);
|
||||||
|
}
|
||||||
|
function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = []) {
|
||||||
|
if (words.length === 0) {
|
||||||
|
if (newLine.length > 0) {
|
||||||
|
lines.push(newLine);
|
||||||
|
}
|
||||||
|
return lines.length > 0 ? lines : [];
|
||||||
|
}
|
||||||
|
let joiner = "";
|
||||||
|
if (words[0].content === " ") {
|
||||||
|
joiner = " ";
|
||||||
|
words.shift();
|
||||||
|
}
|
||||||
|
const nextWord = words.shift() ?? { content: " ", type: "normal" };
|
||||||
|
const lineWithNextWord = [...newLine];
|
||||||
|
if (joiner !== "") {
|
||||||
|
lineWithNextWord.push({ content: joiner, type: "normal" });
|
||||||
|
}
|
||||||
|
lineWithNextWord.push(nextWord);
|
||||||
|
if (checkFit(lineWithNextWord)) {
|
||||||
|
return splitLineToFitWidthRecursion(words, checkFit, lines, lineWithNextWord);
|
||||||
|
}
|
||||||
|
if (newLine.length > 0) {
|
||||||
|
lines.push(newLine);
|
||||||
|
words.unshift(nextWord);
|
||||||
|
} else if (nextWord.content) {
|
||||||
|
const [line, rest] = splitWordToFitWidth(checkFit, nextWord);
|
||||||
|
lines.push([line]);
|
||||||
|
if (rest.content) {
|
||||||
|
words.unshift(rest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return splitLineToFitWidthRecursion(words, checkFit, lines);
|
||||||
|
}
|
||||||
|
function applyStyle(dom, styleFn) {
|
||||||
|
if (styleFn) {
|
||||||
|
dom.attr("style", styleFn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function addHtmlSpan(element, node, width, classes, addBackground = false) {
|
||||||
|
const fo = element.append("foreignObject");
|
||||||
|
const div = fo.append("xhtml:div");
|
||||||
|
const label = node.label;
|
||||||
|
const labelClass = node.isNode ? "nodeLabel" : "edgeLabel";
|
||||||
|
div.html(
|
||||||
|
`
|
||||||
|
<span class="${labelClass} ${classes}" ` + (node.labelStyle ? 'style="' + node.labelStyle + '"' : "") + ">" + label + "</span>"
|
||||||
|
);
|
||||||
|
applyStyle(div, node.labelStyle);
|
||||||
|
div.style("display", "table-cell");
|
||||||
|
div.style("white-space", "nowrap");
|
||||||
|
div.style("max-width", width + "px");
|
||||||
|
div.attr("xmlns", "http://www.w3.org/1999/xhtml");
|
||||||
|
if (addBackground) {
|
||||||
|
div.attr("class", "labelBkg");
|
||||||
|
}
|
||||||
|
let bbox = div.node().getBoundingClientRect();
|
||||||
|
if (bbox.width === width) {
|
||||||
|
div.style("display", "table");
|
||||||
|
div.style("white-space", "break-spaces");
|
||||||
|
div.style("width", width + "px");
|
||||||
|
bbox = div.node().getBoundingClientRect();
|
||||||
|
}
|
||||||
|
fo.style("width", bbox.width);
|
||||||
|
fo.style("height", bbox.height);
|
||||||
|
return fo.node();
|
||||||
|
}
|
||||||
|
function createTspan(textElement, lineIndex, lineHeight) {
|
||||||
|
return textElement.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", lineIndex * lineHeight - 0.1 + "em").attr("dy", lineHeight + "em");
|
||||||
|
}
|
||||||
|
function computeWidthOfText(parentNode, lineHeight, line) {
|
||||||
|
const testElement = parentNode.append("text");
|
||||||
|
const testSpan = createTspan(testElement, 1, lineHeight);
|
||||||
|
updateTextContentAndStyles(testSpan, line);
|
||||||
|
const textLength = testSpan.node().getComputedTextLength();
|
||||||
|
testElement.remove();
|
||||||
|
return textLength;
|
||||||
|
}
|
||||||
|
function createFormattedText(width, g, structuredText, addBackground = false) {
|
||||||
|
const lineHeight = 1.1;
|
||||||
|
const labelGroup = g.append("g");
|
||||||
|
const bkg = labelGroup.insert("rect").attr("class", "background");
|
||||||
|
const textElement = labelGroup.append("text").attr("y", "-10.1");
|
||||||
|
let lineIndex = 0;
|
||||||
|
for (const line of structuredText) {
|
||||||
|
const checkWidth = (line2) => computeWidthOfText(labelGroup, lineHeight, line2) <= width;
|
||||||
|
const linesUnderWidth = checkWidth(line) ? [line] : splitLineToFitWidth(line, checkWidth);
|
||||||
|
for (const preparedLine of linesUnderWidth) {
|
||||||
|
const tspan = createTspan(textElement, lineIndex, lineHeight);
|
||||||
|
updateTextContentAndStyles(tspan, preparedLine);
|
||||||
|
lineIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (addBackground) {
|
||||||
|
const bbox = textElement.node().getBBox();
|
||||||
|
const padding = 2;
|
||||||
|
bkg.attr("x", -padding).attr("y", -padding).attr("width", bbox.width + 2 * padding).attr("height", bbox.height + 2 * padding);
|
||||||
|
return labelGroup.node();
|
||||||
|
} else {
|
||||||
|
return textElement.node();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function updateTextContentAndStyles(tspan, wrappedLine) {
|
||||||
|
tspan.text("");
|
||||||
|
wrappedLine.forEach((word, index) => {
|
||||||
|
const innerTspan = tspan.append("tspan").attr("font-style", word.type === "emphasis" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal");
|
||||||
|
if (index === 0) {
|
||||||
|
innerTspan.text(word.content);
|
||||||
|
} else {
|
||||||
|
innerTspan.text(" " + word.content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const createText = (el, text = "", {
|
||||||
|
style = "",
|
||||||
|
isTitle = false,
|
||||||
|
classes = "",
|
||||||
|
useHtmlLabels = true,
|
||||||
|
isNode = true,
|
||||||
|
width = 200,
|
||||||
|
addSvgBackground = false
|
||||||
|
} = {}) => {
|
||||||
|
log.info("createText", text, style, isTitle, classes, useHtmlLabels, isNode, addSvgBackground);
|
||||||
|
if (useHtmlLabels) {
|
||||||
|
const htmlText = markdownToHTML(text);
|
||||||
|
const node = {
|
||||||
|
isNode,
|
||||||
|
label: decodeEntities(htmlText).replace(
|
||||||
|
/fa[blrs]?:fa-[\w-]+/g,
|
||||||
|
(s) => `<i class='${s.replace(":", " ")}'></i>`
|
||||||
|
),
|
||||||
|
labelStyle: style.replace("fill:", "color:")
|
||||||
|
};
|
||||||
|
const vertexNode = addHtmlSpan(el, node, width, classes, addSvgBackground);
|
||||||
|
return vertexNode;
|
||||||
|
} else {
|
||||||
|
const structuredText = markdownToLines(text);
|
||||||
|
const svgLabel = createFormattedText(width, el, structuredText, addSvgBackground);
|
||||||
|
return svgLabel;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export {
|
||||||
|
createText as c
|
||||||
|
};
|
|
@ -0,0 +1,4 @@
|
||||||
|
export function insertCluster(elem: any, node: any): void;
|
||||||
|
export function getClusterTitleWidth(elem: any, node: any): number;
|
||||||
|
export function clear(): void;
|
||||||
|
export function positionCluster(node: any): void;
|
9
webroot/js/node_modules/mermaid/dist/dagre-wrapper/createLabel.d.ts
generated
vendored
Normal file
9
webroot/js/node_modules/mermaid/dist/dagre-wrapper/createLabel.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
export default createLabel;
|
||||||
|
/**
|
||||||
|
* @param _vertexText
|
||||||
|
* @param style
|
||||||
|
* @param isTitle
|
||||||
|
* @param isNode
|
||||||
|
* @deprecated svg-util/createText instead
|
||||||
|
*/
|
||||||
|
declare function createLabel(_vertexText: any, style: any, isTitle: any, isNode: any): SVGTextElement | SVGForeignObjectElement;
|
|
@ -0,0 +1,14 @@
|
||||||
|
export function clear(): void;
|
||||||
|
export function insertEdgeLabel(elem: any, edge: any): any;
|
||||||
|
export function positionEdgeLabel(edge: any, paths: any): void;
|
||||||
|
export function intersection(node: any, outsidePoint: any, insidePoint: any): {
|
||||||
|
x: any;
|
||||||
|
y: number;
|
||||||
|
} | {
|
||||||
|
x: number;
|
||||||
|
y: any;
|
||||||
|
};
|
||||||
|
export function insertEdge(elem: any, e: any, edge: any, clusterDb: any, diagramType: any, graph: any, id: any): {
|
||||||
|
updatedPath: any;
|
||||||
|
originalPath: any;
|
||||||
|
};
|
|
@ -0,0 +1 @@
|
||||||
|
export function render(elem: any, graph: any, markers: any, diagramtype: any, id: any): Promise<void>;
|
13
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/index.d.ts
generated
vendored
Normal file
13
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
declare namespace _default {
|
||||||
|
export { node };
|
||||||
|
export { circle };
|
||||||
|
export { ellipse };
|
||||||
|
export { polygon };
|
||||||
|
export { rect };
|
||||||
|
}
|
||||||
|
export default _default;
|
||||||
|
import node from './intersect-node.js';
|
||||||
|
import circle from './intersect-circle.js';
|
||||||
|
import ellipse from './intersect-ellipse.js';
|
||||||
|
import polygon from './intersect-polygon.js';
|
||||||
|
import rect from './intersect-rect.js';
|
10
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-circle.d.ts
generated
vendored
Normal file
10
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-circle.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
export default intersectCircle;
|
||||||
|
/**
|
||||||
|
* @param node
|
||||||
|
* @param rx
|
||||||
|
* @param point
|
||||||
|
*/
|
||||||
|
declare function intersectCircle(node: any, rx: any, point: any): {
|
||||||
|
x: any;
|
||||||
|
y: any;
|
||||||
|
};
|
11
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-ellipse.d.ts
generated
vendored
Normal file
11
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-ellipse.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
export default intersectEllipse;
|
||||||
|
/**
|
||||||
|
* @param node
|
||||||
|
* @param rx
|
||||||
|
* @param ry
|
||||||
|
* @param point
|
||||||
|
*/
|
||||||
|
declare function intersectEllipse(node: any, rx: any, ry: any, point: any): {
|
||||||
|
x: any;
|
||||||
|
y: any;
|
||||||
|
};
|
13
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-line.d.ts
generated
vendored
Normal file
13
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-line.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
export default intersectLine;
|
||||||
|
/**
|
||||||
|
* Returns the point at which two lines, p and q, intersect or returns undefined if they do not intersect.
|
||||||
|
*
|
||||||
|
* @param p1
|
||||||
|
* @param p2
|
||||||
|
* @param q1
|
||||||
|
* @param q2
|
||||||
|
*/
|
||||||
|
declare function intersectLine(p1: any, p2: any, q1: any, q2: any): {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
} | undefined;
|
6
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-node.d.ts
generated
vendored
Normal file
6
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-node.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export default intersectNode;
|
||||||
|
/**
|
||||||
|
* @param node
|
||||||
|
* @param point
|
||||||
|
*/
|
||||||
|
declare function intersectNode(node: any, point: any): any;
|
10
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-polygon.d.ts
generated
vendored
Normal file
10
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-polygon.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
export default intersectPolygon;
|
||||||
|
/**
|
||||||
|
* Returns the point ({x, y}) at which the point argument intersects with the node argument assuming
|
||||||
|
* that it has the shape specified by polygon.
|
||||||
|
*
|
||||||
|
* @param node
|
||||||
|
* @param polyPoints
|
||||||
|
* @param point
|
||||||
|
*/
|
||||||
|
declare function intersectPolygon(node: any, polyPoints: any, point: any): any;
|
5
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-rect.d.ts
generated
vendored
Normal file
5
webroot/js/node_modules/mermaid/dist/dagre-wrapper/intersect/intersect-rect.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export default intersectRect;
|
||||||
|
declare function intersectRect(node: any, point: any): {
|
||||||
|
x: any;
|
||||||
|
y: any;
|
||||||
|
};
|
|
@ -0,0 +1,2 @@
|
||||||
|
export default insertMarkers;
|
||||||
|
declare function insertMarkers(elem: any, markerArray: any, type: any, id: any): void;
|
8
webroot/js/node_modules/mermaid/dist/dagre-wrapper/mermaid-graphlib.d.ts
generated
vendored
Normal file
8
webroot/js/node_modules/mermaid/dist/dagre-wrapper/mermaid-graphlib.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
export let clusterDb: {};
|
||||||
|
export function clear(): void;
|
||||||
|
export function extractDescendants(id: any, graph: any): any[];
|
||||||
|
export function validate(graph: any): boolean;
|
||||||
|
export function findNonClusterChild(id: any, graph: any): any;
|
||||||
|
export function adjustClustersAndEdges(graph: any, depth: any): void;
|
||||||
|
export function extractor(graph: any, depth: any): void;
|
||||||
|
export function sortNodesByHierarchy(graph: any): any;
|
|
@ -0,0 +1,4 @@
|
||||||
|
export function insertNode(elem: any, node: any, dir: any): Promise<any>;
|
||||||
|
export function setNodeElem(elem: any, node: any): void;
|
||||||
|
export function clear(): void;
|
||||||
|
export function positionNode(node: any): any;
|
2
webroot/js/node_modules/mermaid/dist/dagre-wrapper/shapes/note.d.ts
generated
vendored
Normal file
2
webroot/js/node_modules/mermaid/dist/dagre-wrapper/shapes/note.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export default note;
|
||||||
|
declare function note(parent: any, node: any): Promise<any>;
|
14
webroot/js/node_modules/mermaid/dist/dagre-wrapper/shapes/util.d.ts
generated
vendored
Normal file
14
webroot/js/node_modules/mermaid/dist/dagre-wrapper/shapes/util.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/**
|
||||||
|
* @param parent
|
||||||
|
* @param w
|
||||||
|
* @param h
|
||||||
|
* @param points
|
||||||
|
*/
|
||||||
|
export function insertPolygonShape(parent: any, w: any, h: any, points: any): any;
|
||||||
|
export function labelHelper(parent: any, node: any, _classes: any, isNode: any): Promise<{
|
||||||
|
shapeSvg: any;
|
||||||
|
bbox: any;
|
||||||
|
halfPadding: number;
|
||||||
|
label: any;
|
||||||
|
}>;
|
||||||
|
export function updateNodeBounds(node: any, element: any): void;
|
|
@ -0,0 +1,12 @@
|
||||||
|
import type { RequiredDeep } from 'type-fest';
|
||||||
|
import type { MermaidConfig } from './config.type.js';
|
||||||
|
/**
|
||||||
|
* Default mermaid configuration options.
|
||||||
|
*
|
||||||
|
* Please see the Mermaid config JSON Schema for the default JSON values.
|
||||||
|
* Non-JSON JS default values are listed in this file, e.g. functions, or
|
||||||
|
* `undefined` (explicitly set so that `configKeys` finds them).
|
||||||
|
*/
|
||||||
|
declare const config: RequiredDeep<MermaidConfig>;
|
||||||
|
export declare const configKeys: Set<string>;
|
||||||
|
export default config;
|
|
@ -0,0 +1,6 @@
|
||||||
|
/**
|
||||||
|
* Remove all lines starting with `%%` from the text that don't contain a `%%{`
|
||||||
|
* @param text - The text to remove comments from
|
||||||
|
* @returns cleaned text
|
||||||
|
*/
|
||||||
|
export declare const cleanupComments: (text: string) => string;
|
1
webroot/js/node_modules/mermaid/dist/diagram-api/comments.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagram-api/comments.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1,42 @@
|
||||||
|
import type { MermaidConfig } from '../config.type.js';
|
||||||
|
import type { DetectorRecord, DiagramDetector, DiagramLoader, ExternalDiagramDefinition } from './types.js';
|
||||||
|
export declare const detectors: Record<string, DetectorRecord>;
|
||||||
|
/**
|
||||||
|
* Detects the type of the graph text.
|
||||||
|
*
|
||||||
|
* Takes into consideration the possible existence of an `%%init` directive
|
||||||
|
*
|
||||||
|
* @param text - The text defining the graph. For example:
|
||||||
|
*
|
||||||
|
* ```mermaid
|
||||||
|
* %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
|
||||||
|
* graph LR
|
||||||
|
* a-->b
|
||||||
|
* b-->c
|
||||||
|
* c-->d
|
||||||
|
* d-->e
|
||||||
|
* e-->f
|
||||||
|
* f-->g
|
||||||
|
* g-->h
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param config - The mermaid config.
|
||||||
|
* @returns A graph definition key
|
||||||
|
*/
|
||||||
|
export declare const detectType: (text: string, config?: MermaidConfig) => string;
|
||||||
|
/**
|
||||||
|
* Registers lazy-loaded diagrams to Mermaid.
|
||||||
|
*
|
||||||
|
* The diagram function is loaded asynchronously, so that diagrams are only loaded
|
||||||
|
* if the diagram is detected.
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* Please note that the order of diagram detectors is important.
|
||||||
|
* The first detector to return `true` is the diagram that will be loaded
|
||||||
|
* and used, so put more specific detectors at the beginning!
|
||||||
|
*
|
||||||
|
* @param diagrams - Diagrams to lazy load, and their detectors, in order of importance.
|
||||||
|
*/
|
||||||
|
export declare const registerLazyLoadedDiagrams: (...diagrams: ExternalDiagramDefinition[]) => void;
|
||||||
|
export declare const addDetector: (key: string, detector: DiagramDetector, loader?: DiagramLoader) => void;
|
||||||
|
export declare const getDiagramLoader: (key: string) => DiagramLoader | undefined;
|
1
webroot/js/node_modules/mermaid/dist/diagram-api/diagram-orchestration.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagram-api/diagram-orchestration.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export declare const addDiagrams: () => void;
|
1
webroot/js/node_modules/mermaid/dist/diagram-api/diagram-orchestration.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagram-api/diagram-orchestration.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1,28 @@
|
||||||
|
import type { DiagramDefinition, DiagramDetector } from './types.js';
|
||||||
|
import * as _commonDb from '../diagrams/common/commonDb.js';
|
||||||
|
export declare const log: Record<import("../logger.js").LogLevel, {
|
||||||
|
(...data: any[]): void;
|
||||||
|
(message?: any, ...optionalParams: any[]): void;
|
||||||
|
}>;
|
||||||
|
export declare const setLogLevel: (level?: string | number) => void;
|
||||||
|
export declare const getConfig: () => import("../config.type.js").MermaidConfig;
|
||||||
|
export declare const sanitizeText: (text: string) => string;
|
||||||
|
export declare const setupGraphViewbox: (graph: any, svgElem: any, padding: any, useMaxWidth: any) => void;
|
||||||
|
export declare const getCommonDb: () => typeof _commonDb;
|
||||||
|
export interface Detectors {
|
||||||
|
[key: string]: DiagramDetector;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Registers the given diagram with Mermaid.
|
||||||
|
*
|
||||||
|
* Can be used for third-party custom diagrams.
|
||||||
|
*
|
||||||
|
* @param id - A unique ID for the given diagram.
|
||||||
|
* @param diagram - The diagram definition.
|
||||||
|
* @param detector - Function that returns `true` if a given mermaid text is this diagram definition.
|
||||||
|
*/
|
||||||
|
export declare const registerDiagram: (id: string, diagram: DiagramDefinition, detector?: DiagramDetector) => void;
|
||||||
|
export declare const getDiagram: (name: string) => DiagramDefinition;
|
||||||
|
export declare class DiagramNotFoundError extends Error {
|
||||||
|
constructor(name: string);
|
||||||
|
}
|
1
webroot/js/node_modules/mermaid/dist/diagram-api/diagramAPI.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagram-api/diagramAPI.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1,18 @@
|
||||||
|
import type { MermaidConfig } from '../config.type.js';
|
||||||
|
interface FrontMatterMetadata {
|
||||||
|
title?: string;
|
||||||
|
displayMode?: string;
|
||||||
|
config?: MermaidConfig;
|
||||||
|
}
|
||||||
|
export interface FrontMatterResult {
|
||||||
|
text: string;
|
||||||
|
metadata: FrontMatterMetadata;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Extract and parse frontmatter from text, if present, and sets appropriate
|
||||||
|
* properties in the provided db.
|
||||||
|
* @param text - The text that may have a YAML frontmatter.
|
||||||
|
* @returns text with frontmatter stripped out
|
||||||
|
*/
|
||||||
|
export declare function extractFrontMatter(text: string): FrontMatterResult;
|
||||||
|
export {};
|
1
webroot/js/node_modules/mermaid/dist/diagram-api/frontmatter.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagram-api/frontmatter.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1 @@
|
||||||
|
export declare const loadRegisteredDiagrams: () => Promise<void>;
|
|
@ -0,0 +1,3 @@
|
||||||
|
export declare const frontMatterRegex: RegExp;
|
||||||
|
export declare const directiveRegex: RegExp;
|
||||||
|
export declare const anyCommentRegex: RegExp;
|
|
@ -0,0 +1,84 @@
|
||||||
|
import type { Diagram } from '../Diagram.js';
|
||||||
|
import type { BaseDiagramConfig, MermaidConfig } from '../config.type.js';
|
||||||
|
import type * as d3 from 'd3';
|
||||||
|
export interface DiagramMetadata {
|
||||||
|
title?: string;
|
||||||
|
config?: MermaidConfig;
|
||||||
|
}
|
||||||
|
export interface InjectUtils {
|
||||||
|
_log: any;
|
||||||
|
_setLogLevel: any;
|
||||||
|
_getConfig: any;
|
||||||
|
_sanitizeText: any;
|
||||||
|
_setupGraphViewbox: any;
|
||||||
|
_commonDb: any;
|
||||||
|
/** @deprecated as directives will be pre-processed since https://github.com/mermaid-js/mermaid/pull/4759 */
|
||||||
|
_parseDirective: any;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generic Diagram DB that may apply to any diagram type.
|
||||||
|
*/
|
||||||
|
export interface DiagramDB {
|
||||||
|
getConfig?: () => BaseDiagramConfig | undefined;
|
||||||
|
clear?: () => void;
|
||||||
|
setDiagramTitle?: (title: string) => void;
|
||||||
|
getDiagramTitle?: () => string;
|
||||||
|
setAccTitle?: (title: string) => void;
|
||||||
|
getAccTitle?: () => string;
|
||||||
|
setAccDescription?: (describetion: string) => void;
|
||||||
|
getAccDescription?: () => string;
|
||||||
|
setDisplayMode?: (title: string) => void;
|
||||||
|
bindFunctions?: (element: Element) => void;
|
||||||
|
}
|
||||||
|
export interface DiagramStyleClassDef {
|
||||||
|
id: string;
|
||||||
|
styles?: string[];
|
||||||
|
textStyles?: string[];
|
||||||
|
}
|
||||||
|
export interface DiagramRenderer {
|
||||||
|
draw: DrawDefinition;
|
||||||
|
getClasses?: (text: string, diagram: Pick<DiagramDefinition, 'db'>) => Record<string, DiagramStyleClassDef>;
|
||||||
|
}
|
||||||
|
export interface DiagramDefinition {
|
||||||
|
db: DiagramDB;
|
||||||
|
renderer: DiagramRenderer;
|
||||||
|
parser: ParserDefinition;
|
||||||
|
styles?: any;
|
||||||
|
init?: (config: MermaidConfig) => void;
|
||||||
|
injectUtils?: (_log: InjectUtils['_log'], _setLogLevel: InjectUtils['_setLogLevel'], _getConfig: InjectUtils['_getConfig'], _sanitizeText: InjectUtils['_sanitizeText'], _setupGraphViewbox: InjectUtils['_setupGraphViewbox'], _commonDb: InjectUtils['_commonDb'],
|
||||||
|
/** @deprecated as directives will be pre-processed since https://github.com/mermaid-js/mermaid/pull/4759 */
|
||||||
|
_parseDirective: InjectUtils['_parseDirective']) => void;
|
||||||
|
}
|
||||||
|
export interface DetectorRecord {
|
||||||
|
detector: DiagramDetector;
|
||||||
|
loader?: DiagramLoader;
|
||||||
|
}
|
||||||
|
export interface ExternalDiagramDefinition {
|
||||||
|
id: string;
|
||||||
|
detector: DiagramDetector;
|
||||||
|
loader: DiagramLoader;
|
||||||
|
}
|
||||||
|
export type DiagramDetector = (text: string, config?: MermaidConfig) => boolean;
|
||||||
|
export type DiagramLoader = () => Promise<{
|
||||||
|
id: string;
|
||||||
|
diagram: DiagramDefinition;
|
||||||
|
}>;
|
||||||
|
/**
|
||||||
|
* Type for function draws diagram in the tag with id: id based on the graph definition in text.
|
||||||
|
*
|
||||||
|
* @param text - The text of the diagram.
|
||||||
|
* @param id - The id of the diagram which will be used as a DOM element id.
|
||||||
|
* @param version - MermaidJS version from package.json.
|
||||||
|
* @param diagramObject - A standard diagram containing the DB and the text and type etc of the diagram.
|
||||||
|
*/
|
||||||
|
export type DrawDefinition = (text: string, id: string, version: string, diagramObject: Diagram) => void | Promise<void>;
|
||||||
|
export interface ParserDefinition {
|
||||||
|
parse: (text: string) => void;
|
||||||
|
parser: {
|
||||||
|
yy: DiagramDB;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export type HTML = d3.Selection<HTMLIFrameElement, unknown, Element | null, unknown>;
|
||||||
|
export type SVG = d3.Selection<SVGSVGElement, unknown, Element | null, unknown>;
|
||||||
|
export type Group = d3.Selection<SVGGElement, unknown, Element | null, unknown>;
|
||||||
|
export type DiagramStylesProvider = (options?: any) => string;
|
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1,114 @@
|
||||||
|
export function getC4Type(): any;
|
||||||
|
export function setC4Type(c4TypeParam: any): void;
|
||||||
|
export function addRel(type: any, from: any, to: any, label: any, techn: any, descr: any, sprite: any, tags: any, link: any): void;
|
||||||
|
export function addPersonOrSystem(typeC4Shape: any, alias: any, label: any, descr: any, sprite: any, tags: any, link: any): void;
|
||||||
|
export function addContainer(typeC4Shape: any, alias: any, label: any, techn: any, descr: any, sprite: any, tags: any, link: any): void;
|
||||||
|
export function addComponent(typeC4Shape: any, alias: any, label: any, techn: any, descr: any, sprite: any, tags: any, link: any): void;
|
||||||
|
export function addPersonOrSystemBoundary(alias: any, label: any, type: any, tags: any, link: any): void;
|
||||||
|
export function addContainerBoundary(alias: any, label: any, type: any, tags: any, link: any): void;
|
||||||
|
export function addDeploymentNode(nodeType: any, alias: any, label: any, type: any, descr: any, sprite: any, tags: any, link: any): void;
|
||||||
|
export function popBoundaryParseStack(): void;
|
||||||
|
export function updateElStyle(typeC4Shape: any, elementName: any, bgColor: any, fontColor: any, borderColor: any, shadowing: any, shape: any, sprite: any, techn: any, legendText: any, legendSprite: any): void;
|
||||||
|
export function updateRelStyle(typeC4Shape: any, from: any, to: any, textColor: any, lineColor: any, offsetX: any, offsetY: any): void;
|
||||||
|
export function updateLayoutConfig(typeC4Shape: any, c4ShapeInRowParam: any, c4BoundaryInRowParam: any): void;
|
||||||
|
export function getC4ShapeInRow(): number;
|
||||||
|
export function getC4BoundaryInRow(): number;
|
||||||
|
export function getCurrentBoundaryParse(): string;
|
||||||
|
export function getParentBoundaryParse(): string;
|
||||||
|
export function getC4ShapeArray(parentBoundary: any): any[];
|
||||||
|
export function getC4Shape(alias: any): any;
|
||||||
|
export function getC4ShapeKeys(parentBoundary: any): string[];
|
||||||
|
export function getBoundarys(parentBoundary: any): {
|
||||||
|
alias: string;
|
||||||
|
label: {
|
||||||
|
text: string;
|
||||||
|
};
|
||||||
|
type: {
|
||||||
|
text: string;
|
||||||
|
};
|
||||||
|
tags: null;
|
||||||
|
link: null;
|
||||||
|
parentBoundary: string;
|
||||||
|
}[];
|
||||||
|
export function getRels(): any[];
|
||||||
|
export function getTitle(): string;
|
||||||
|
export function setWrap(wrapSetting: any): void;
|
||||||
|
export function autoWrap(): boolean;
|
||||||
|
export function clear(): void;
|
||||||
|
export namespace LINETYPE {
|
||||||
|
let SOLID: number;
|
||||||
|
let DOTTED: number;
|
||||||
|
let NOTE: number;
|
||||||
|
let SOLID_CROSS: number;
|
||||||
|
let DOTTED_CROSS: number;
|
||||||
|
let SOLID_OPEN: number;
|
||||||
|
let DOTTED_OPEN: number;
|
||||||
|
let LOOP_START: number;
|
||||||
|
let LOOP_END: number;
|
||||||
|
let ALT_START: number;
|
||||||
|
let ALT_ELSE: number;
|
||||||
|
let ALT_END: number;
|
||||||
|
let OPT_START: number;
|
||||||
|
let OPT_END: number;
|
||||||
|
let ACTIVE_START: number;
|
||||||
|
let ACTIVE_END: number;
|
||||||
|
let PAR_START: number;
|
||||||
|
let PAR_AND: number;
|
||||||
|
let PAR_END: number;
|
||||||
|
let RECT_START: number;
|
||||||
|
let RECT_END: number;
|
||||||
|
let SOLID_POINT: number;
|
||||||
|
let DOTTED_POINT: number;
|
||||||
|
}
|
||||||
|
export namespace ARROWTYPE {
|
||||||
|
let FILLED: number;
|
||||||
|
let OPEN: number;
|
||||||
|
}
|
||||||
|
export namespace PLACEMENT {
|
||||||
|
let LEFTOF: number;
|
||||||
|
let RIGHTOF: number;
|
||||||
|
let OVER: number;
|
||||||
|
}
|
||||||
|
export function setTitle(txt: any): void;
|
||||||
|
declare namespace _default {
|
||||||
|
export { addPersonOrSystem };
|
||||||
|
export { addPersonOrSystemBoundary };
|
||||||
|
export { addContainer };
|
||||||
|
export { addContainerBoundary };
|
||||||
|
export { addComponent };
|
||||||
|
export { addDeploymentNode };
|
||||||
|
export { popBoundaryParseStack };
|
||||||
|
export { addRel };
|
||||||
|
export { updateElStyle };
|
||||||
|
export { updateRelStyle };
|
||||||
|
export { updateLayoutConfig };
|
||||||
|
export { autoWrap };
|
||||||
|
export { setWrap };
|
||||||
|
export { getC4ShapeArray };
|
||||||
|
export { getC4Shape };
|
||||||
|
export { getC4ShapeKeys };
|
||||||
|
export { getBoundarys };
|
||||||
|
export { getCurrentBoundaryParse };
|
||||||
|
export { getParentBoundaryParse };
|
||||||
|
export { getRels };
|
||||||
|
export { getTitle };
|
||||||
|
export { getC4Type };
|
||||||
|
export { getC4ShapeInRow };
|
||||||
|
export { getC4BoundaryInRow };
|
||||||
|
export { setAccTitle };
|
||||||
|
export { getAccTitle };
|
||||||
|
export { getAccDescription };
|
||||||
|
export { setAccDescription };
|
||||||
|
export function getConfig(): import("../../config.type.js").C4DiagramConfig | undefined;
|
||||||
|
export { clear };
|
||||||
|
export { LINETYPE };
|
||||||
|
export { ARROWTYPE };
|
||||||
|
export { PLACEMENT };
|
||||||
|
export { setTitle };
|
||||||
|
export { setC4Type };
|
||||||
|
}
|
||||||
|
export default _default;
|
||||||
|
import { setAccTitle } from '../common/commonDb.js';
|
||||||
|
import { getAccTitle } from '../common/commonDb.js';
|
||||||
|
import { getAccDescription } from '../common/commonDb.js';
|
||||||
|
import { setAccDescription } from '../common/commonDb.js';
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
declare const plugin: ExternalDiagramDefinition;
|
||||||
|
export default plugin;
|
|
@ -0,0 +1,2 @@
|
||||||
|
import type { DiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
export declare const diagram: DiagramDefinition;
|
|
@ -0,0 +1,12 @@
|
||||||
|
export function setConf(cnf: any): void;
|
||||||
|
export function drawBoundary(diagram: any, boundary: any, bounds: any): void;
|
||||||
|
export function drawC4ShapeArray(currentBounds: any, diagram: any, c4ShapeArray: any, c4ShapeKeys: any): void;
|
||||||
|
export function drawRels(diagram: any, rels: any, getC4ShapeObj: any, diagObj: any): void;
|
||||||
|
export function draw(_text: any, id: any, _version: any, diagObj: any): void;
|
||||||
|
declare namespace _default {
|
||||||
|
export { drawC4ShapeArray as drawPersonOrSystemArray };
|
||||||
|
export { drawBoundary };
|
||||||
|
export { setConf };
|
||||||
|
export { draw };
|
||||||
|
}
|
||||||
|
export default _default;
|
|
@ -0,0 +1,2 @@
|
||||||
|
export default getStyles;
|
||||||
|
declare function getStyles(options: any): string;
|
|
@ -0,0 +1,36 @@
|
||||||
|
export function drawRect(elem: any, rectData: any): import("../common/commonTypes.js").D3RectElement;
|
||||||
|
export function drawImage(elem: any, width: any, height: any, x: any, y: any, link: any): void;
|
||||||
|
export function drawRels(elem: any, rels: any, conf: any): void;
|
||||||
|
export function drawC4Shape(elem: any, c4Shape: any, conf: any): any;
|
||||||
|
export function insertDatabaseIcon(elem: any): void;
|
||||||
|
export function insertComputerIcon(elem: any): void;
|
||||||
|
export function insertClockIcon(elem: any): void;
|
||||||
|
export function insertArrowHead(elem: any): void;
|
||||||
|
export function insertArrowEnd(elem: any): void;
|
||||||
|
export function insertArrowFilledHead(elem: any): void;
|
||||||
|
export function insertDynamicNumber(elem: any): void;
|
||||||
|
export function insertArrowCrossHead(elem: any): void;
|
||||||
|
declare namespace _default {
|
||||||
|
export { drawRect };
|
||||||
|
export { drawBoundary };
|
||||||
|
export { drawC4Shape };
|
||||||
|
export { drawRels };
|
||||||
|
export { drawImage };
|
||||||
|
export { insertArrowHead };
|
||||||
|
export { insertArrowEnd };
|
||||||
|
export { insertArrowFilledHead };
|
||||||
|
export { insertDynamicNumber };
|
||||||
|
export { insertArrowCrossHead };
|
||||||
|
export { insertDatabaseIcon };
|
||||||
|
export { insertComputerIcon };
|
||||||
|
export { insertClockIcon };
|
||||||
|
}
|
||||||
|
export default _default;
|
||||||
|
/**
|
||||||
|
* Draws an boundary in the diagram
|
||||||
|
*
|
||||||
|
* @param {any} elem - The diagram we'll draw to.
|
||||||
|
* @param {any} boundary - The boundary to draw.
|
||||||
|
* @param {any} conf - DrawText implementation discriminator object
|
||||||
|
*/
|
||||||
|
declare function drawBoundary(elem: any, boundary: any, conf: any): void;
|
|
@ -0,0 +1,142 @@
|
||||||
|
import type { ClassRelation, ClassNode, ClassNote, ClassMap, NamespaceMap, NamespaceNode } from './classTypes.js';
|
||||||
|
export declare const setClassLabel: (_id: string, label: string) => void;
|
||||||
|
/**
|
||||||
|
* Function called by parser when a node definition has been found.
|
||||||
|
*
|
||||||
|
* @param id - Id of the class to add
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export declare const addClass: (_id: string) => void;
|
||||||
|
/**
|
||||||
|
* Function to lookup domId from id in the graph definition.
|
||||||
|
*
|
||||||
|
* @param id - class ID to lookup
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export declare const lookUpDomId: (_id: string) => string;
|
||||||
|
export declare const clear: () => void;
|
||||||
|
export declare const getClass: (id: string) => ClassNode;
|
||||||
|
export declare const getClasses: () => ClassMap;
|
||||||
|
export declare const getRelations: () => ClassRelation[];
|
||||||
|
export declare const getNotes: () => ClassNote[];
|
||||||
|
export declare const addRelation: (relation: ClassRelation) => void;
|
||||||
|
/**
|
||||||
|
* Adds an annotation to the specified class Annotations mark special properties of the given type
|
||||||
|
* (like 'interface' or 'service')
|
||||||
|
*
|
||||||
|
* @param className - The class name
|
||||||
|
* @param annotation - The name of the annotation without any brackets
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export declare const addAnnotation: (className: string, annotation: string) => void;
|
||||||
|
/**
|
||||||
|
* Adds a member to the specified class
|
||||||
|
*
|
||||||
|
* @param className - The class name
|
||||||
|
* @param member - The full name of the member. If the member is enclosed in `<<brackets>>` it is
|
||||||
|
* treated as an annotation If the member is ending with a closing bracket ) it is treated as a
|
||||||
|
* method Otherwise the member will be treated as a normal property
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export declare const addMember: (className: string, member: string) => void;
|
||||||
|
export declare const addMembers: (className: string, members: string[]) => void;
|
||||||
|
export declare const addNote: (text: string, className: string) => void;
|
||||||
|
export declare const cleanupLabel: (label: string) => string;
|
||||||
|
/**
|
||||||
|
* Called by parser when a special node is found, e.g. a clickable element.
|
||||||
|
*
|
||||||
|
* @param ids - Comma separated list of ids
|
||||||
|
* @param className - Class to add
|
||||||
|
*/
|
||||||
|
export declare const setCssClass: (ids: string, className: string) => void;
|
||||||
|
export declare const getTooltip: (id: string, namespace?: string) => string | undefined;
|
||||||
|
/**
|
||||||
|
* Called by parser when a link is found. Adds the URL to the vertex data.
|
||||||
|
*
|
||||||
|
* @param ids - Comma separated list of ids
|
||||||
|
* @param linkStr - URL to create a link for
|
||||||
|
* @param target - Target of the link, _blank by default as originally defined in the svgDraw.js file
|
||||||
|
*/
|
||||||
|
export declare const setLink: (ids: string, linkStr: string, target: string) => void;
|
||||||
|
/**
|
||||||
|
* Called by parser when a click definition is found. Registers an event handler.
|
||||||
|
*
|
||||||
|
* @param ids - Comma separated list of ids
|
||||||
|
* @param functionName - Function to be called on click
|
||||||
|
* @param functionArgs - Function args the function should be called with
|
||||||
|
*/
|
||||||
|
export declare const setClickEvent: (ids: string, functionName: string, functionArgs: string) => void;
|
||||||
|
export declare const bindFunctions: (element: Element) => void;
|
||||||
|
export declare const lineType: {
|
||||||
|
LINE: number;
|
||||||
|
DOTTED_LINE: number;
|
||||||
|
};
|
||||||
|
export declare const relationType: {
|
||||||
|
AGGREGATION: number;
|
||||||
|
EXTENSION: number;
|
||||||
|
COMPOSITION: number;
|
||||||
|
DEPENDENCY: number;
|
||||||
|
LOLLIPOP: number;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Function called by parser when a namespace definition has been found.
|
||||||
|
*
|
||||||
|
* @param id - Id of the namespace to add
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export declare const addNamespace: (id: string) => void;
|
||||||
|
/**
|
||||||
|
* Function called by parser when a namespace definition has been found.
|
||||||
|
*
|
||||||
|
* @param id - Id of the namespace to add
|
||||||
|
* @param classNames - Ids of the class to add
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export declare const addClassesToNamespace: (id: string, classNames: string[]) => void;
|
||||||
|
declare const _default: {
|
||||||
|
setAccTitle: (txt: string) => void;
|
||||||
|
getAccTitle: () => string;
|
||||||
|
getAccDescription: () => string;
|
||||||
|
setAccDescription: (txt: string) => void;
|
||||||
|
getConfig: () => import("../../config.type.js").ClassDiagramConfig | undefined;
|
||||||
|
addClass: (_id: string) => void;
|
||||||
|
bindFunctions: (element: Element) => void;
|
||||||
|
clear: () => void;
|
||||||
|
getClass: (id: string) => ClassNode;
|
||||||
|
getClasses: () => ClassMap;
|
||||||
|
getNotes: () => ClassNote[];
|
||||||
|
addAnnotation: (className: string, annotation: string) => void;
|
||||||
|
addNote: (text: string, className: string) => void;
|
||||||
|
getRelations: () => ClassRelation[];
|
||||||
|
addRelation: (relation: ClassRelation) => void;
|
||||||
|
getDirection: () => string;
|
||||||
|
setDirection: (dir: string) => void;
|
||||||
|
addMember: (className: string, member: string) => void;
|
||||||
|
addMembers: (className: string, members: string[]) => void;
|
||||||
|
cleanupLabel: (label: string) => string;
|
||||||
|
lineType: {
|
||||||
|
LINE: number;
|
||||||
|
DOTTED_LINE: number;
|
||||||
|
};
|
||||||
|
relationType: {
|
||||||
|
AGGREGATION: number;
|
||||||
|
EXTENSION: number;
|
||||||
|
COMPOSITION: number;
|
||||||
|
DEPENDENCY: number;
|
||||||
|
LOLLIPOP: number;
|
||||||
|
};
|
||||||
|
setClickEvent: (ids: string, functionName: string, functionArgs: string) => void;
|
||||||
|
setCssClass: (ids: string, className: string) => void;
|
||||||
|
setLink: (ids: string, linkStr: string, target: string) => void;
|
||||||
|
getTooltip: (id: string, namespace?: string | undefined) => string | undefined;
|
||||||
|
setTooltip: (ids: string, tooltip?: string | undefined) => void;
|
||||||
|
lookUpDomId: (_id: string) => string;
|
||||||
|
setDiagramTitle: (txt: string) => void;
|
||||||
|
getDiagramTitle: () => string;
|
||||||
|
setClassLabel: (_id: string, label: string) => void;
|
||||||
|
addNamespace: (id: string) => void;
|
||||||
|
addClassesToNamespace: (id: string, classNames: string[]) => void;
|
||||||
|
getNamespace: (name: string) => NamespaceNode;
|
||||||
|
getNamespaces: () => NamespaceMap;
|
||||||
|
};
|
||||||
|
export default _default;
|
3
webroot/js/node_modules/mermaid/dist/diagrams/class/classDetector-V2.d.ts
generated
vendored
Normal file
3
webroot/js/node_modules/mermaid/dist/diagrams/class/classDetector-V2.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
declare const plugin: ExternalDiagramDefinition;
|
||||||
|
export default plugin;
|
3
webroot/js/node_modules/mermaid/dist/diagrams/class/classDetector.d.ts
generated
vendored
Normal file
3
webroot/js/node_modules/mermaid/dist/diagrams/class/classDetector.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
declare const plugin: ExternalDiagramDefinition;
|
||||||
|
export default plugin;
|
2
webroot/js/node_modules/mermaid/dist/diagrams/class/classDiagram-v2.d.ts
generated
vendored
Normal file
2
webroot/js/node_modules/mermaid/dist/diagrams/class/classDiagram-v2.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
import type { DiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
export declare const diagram: DiagramDefinition;
|
2
webroot/js/node_modules/mermaid/dist/diagrams/class/classDiagram.d.ts
generated
vendored
Normal file
2
webroot/js/node_modules/mermaid/dist/diagrams/class/classDiagram.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
import type { DiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
export declare const diagram: DiagramDefinition;
|
1
webroot/js/node_modules/mermaid/dist/diagrams/class/classDiagram.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagrams/class/classDiagram.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
57
webroot/js/node_modules/mermaid/dist/diagrams/class/classRenderer-v2.d.ts
generated
vendored
Normal file
57
webroot/js/node_modules/mermaid/dist/diagrams/class/classRenderer-v2.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
|
||||||
|
import type { ClassRelation, ClassNote, ClassMap, NamespaceMap } from './classTypes.js';
|
||||||
|
/**
|
||||||
|
* Function that adds the vertices found during parsing to the graph to be rendered.
|
||||||
|
*
|
||||||
|
* @param namespaces - Object containing the vertices.
|
||||||
|
* @param g - The graph that is to be drawn.
|
||||||
|
* @param _id - id of the graph
|
||||||
|
* @param diagObj - The diagram object
|
||||||
|
*/
|
||||||
|
export declare const addNamespaces: (namespaces: NamespaceMap, g: graphlib.Graph, _id: string, diagObj: any) => void;
|
||||||
|
/**
|
||||||
|
* Function that adds the vertices found during parsing to the graph to be rendered.
|
||||||
|
*
|
||||||
|
* @param classes - Object containing the vertices.
|
||||||
|
* @param g - The graph that is to be drawn.
|
||||||
|
* @param _id - id of the graph
|
||||||
|
* @param diagObj - The diagram object
|
||||||
|
* @param parent - id of the parent namespace, if it exists
|
||||||
|
*/
|
||||||
|
export declare const addClasses: (classes: ClassMap, g: graphlib.Graph, _id: string, diagObj: any, parent?: string) => void;
|
||||||
|
/**
|
||||||
|
* Function that adds the additional vertices (notes) found during parsing to the graph to be rendered.
|
||||||
|
*
|
||||||
|
* @param notes - Object containing the additional vertices (notes).
|
||||||
|
* @param g - The graph that is to be drawn.
|
||||||
|
* @param startEdgeId - starting index for note edge
|
||||||
|
* @param classes - Classes
|
||||||
|
*/
|
||||||
|
export declare const addNotes: (notes: ClassNote[], g: graphlib.Graph, startEdgeId: number, classes: ClassMap) => void;
|
||||||
|
/**
|
||||||
|
* Add edges to graph based on parsed graph definition
|
||||||
|
*
|
||||||
|
* @param relations -
|
||||||
|
* @param g - The graph object
|
||||||
|
*/
|
||||||
|
export declare const addRelations: (relations: ClassRelation[], g: graphlib.Graph) => void;
|
||||||
|
/**
|
||||||
|
* Merges the value of `conf` with the passed `cnf`
|
||||||
|
*
|
||||||
|
* @param cnf - Config to merge
|
||||||
|
*/
|
||||||
|
export declare const setConf: (cnf: any) => void;
|
||||||
|
/**
|
||||||
|
* Draws a class diagram in the tag with id: id based on the definition in text.
|
||||||
|
*
|
||||||
|
* @param text -
|
||||||
|
* @param id -
|
||||||
|
* @param _version -
|
||||||
|
* @param diagObj -
|
||||||
|
*/
|
||||||
|
export declare const draw: (text: string, id: string, _version: string, diagObj: any) => Promise<void>;
|
||||||
|
declare const _default: {
|
||||||
|
setConf: (cnf: any) => void;
|
||||||
|
draw: (text: string, id: string, _version: string, diagObj: any) => Promise<void>;
|
||||||
|
};
|
||||||
|
export default _default;
|
5
webroot/js/node_modules/mermaid/dist/diagrams/class/classRenderer.d.ts
generated
vendored
Normal file
5
webroot/js/node_modules/mermaid/dist/diagrams/class/classRenderer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export function draw(text: string, id: string, _version: any, diagObj: any): void;
|
||||||
|
declare namespace _default {
|
||||||
|
export { draw };
|
||||||
|
}
|
||||||
|
export default _default;
|
77
webroot/js/node_modules/mermaid/dist/diagrams/class/classTypes.d.ts
generated
vendored
Normal file
77
webroot/js/node_modules/mermaid/dist/diagrams/class/classTypes.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
export interface ClassNode {
|
||||||
|
id: string;
|
||||||
|
type: string;
|
||||||
|
label: string;
|
||||||
|
cssClasses: string[];
|
||||||
|
methods: ClassMember[];
|
||||||
|
members: ClassMember[];
|
||||||
|
annotations: string[];
|
||||||
|
domId: string;
|
||||||
|
parent?: string;
|
||||||
|
link?: string;
|
||||||
|
linkTarget?: string;
|
||||||
|
haveCallback?: boolean;
|
||||||
|
tooltip?: string;
|
||||||
|
}
|
||||||
|
export type Visibility = '#' | '+' | '~' | '-' | '';
|
||||||
|
export declare const visibilityValues: string[];
|
||||||
|
/**
|
||||||
|
* Parses and stores class diagram member variables/methods.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export declare class ClassMember {
|
||||||
|
id: string;
|
||||||
|
cssStyle: string;
|
||||||
|
memberType: 'method' | 'attribute';
|
||||||
|
visibility: Visibility;
|
||||||
|
/**
|
||||||
|
* denote if static or to determine which css class to apply to the node
|
||||||
|
* @defaultValue ''
|
||||||
|
*/
|
||||||
|
classifier: string;
|
||||||
|
/**
|
||||||
|
* parameters for method
|
||||||
|
* @defaultValue ''
|
||||||
|
*/
|
||||||
|
parameters: string;
|
||||||
|
/**
|
||||||
|
* return type for method
|
||||||
|
* @defaultValue ''
|
||||||
|
*/
|
||||||
|
returnType: string;
|
||||||
|
constructor(input: string, memberType: 'method' | 'attribute');
|
||||||
|
getDisplayDetails(): {
|
||||||
|
displayText: string;
|
||||||
|
cssStyle: string;
|
||||||
|
};
|
||||||
|
parseMember(input: string): void;
|
||||||
|
parseClassifier(): "" | "font-style:italic;" | "text-decoration:underline;";
|
||||||
|
}
|
||||||
|
export interface ClassNote {
|
||||||
|
id: string;
|
||||||
|
class: string;
|
||||||
|
text: string;
|
||||||
|
}
|
||||||
|
export type ClassRelation = {
|
||||||
|
id1: string;
|
||||||
|
id2: string;
|
||||||
|
relationTitle1: string;
|
||||||
|
relationTitle2: string;
|
||||||
|
type: string;
|
||||||
|
title: string;
|
||||||
|
text: string;
|
||||||
|
style: string[];
|
||||||
|
relation: {
|
||||||
|
type1: number;
|
||||||
|
type2: number;
|
||||||
|
lineType: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export interface NamespaceNode {
|
||||||
|
id: string;
|
||||||
|
domId: string;
|
||||||
|
classes: ClassMap;
|
||||||
|
children: NamespaceMap;
|
||||||
|
}
|
||||||
|
export type ClassMap = Record<string, ClassNode>;
|
||||||
|
export type NamespaceMap = Record<string, NamespaceNode>;
|
1
webroot/js/node_modules/mermaid/dist/diagrams/class/classTypes.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagrams/class/classTypes.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1,2 @@
|
||||||
|
export default getStyles;
|
||||||
|
declare function getStyles(options: any): string;
|
|
@ -0,0 +1,25 @@
|
||||||
|
export function drawEdge(elem: any, path: any, relation: any, conf: any, diagObj: any): void;
|
||||||
|
export function drawClass(elem: SVGSVGElement, classDef: any, conf: any, diagObj: any): {
|
||||||
|
id: any;
|
||||||
|
label: any;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
};
|
||||||
|
export function getClassTitleString(classDef: any): any;
|
||||||
|
export function drawNote(elem: SVGSVGElement, note: {
|
||||||
|
id: string;
|
||||||
|
text: string;
|
||||||
|
class: string;
|
||||||
|
}, conf: any, diagObj: any): {
|
||||||
|
id: string;
|
||||||
|
text: string;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
};
|
||||||
|
declare namespace _default {
|
||||||
|
export { getClassTitleString };
|
||||||
|
export { drawClass };
|
||||||
|
export { drawEdge };
|
||||||
|
export { drawNote };
|
||||||
|
}
|
||||||
|
export default _default;
|
|
@ -0,0 +1,82 @@
|
||||||
|
import type { MermaidConfig } from '../../config.type.js';
|
||||||
|
export declare const lineBreakRegex: RegExp;
|
||||||
|
/**
|
||||||
|
* Gets the rows of lines in a string
|
||||||
|
*
|
||||||
|
* @param s - The string to check the lines for
|
||||||
|
* @returns The rows in that string
|
||||||
|
*/
|
||||||
|
export declare const getRows: (s?: string) => string[];
|
||||||
|
/**
|
||||||
|
* Removes script tags from a text
|
||||||
|
*
|
||||||
|
* @param txt - The text to sanitize
|
||||||
|
* @returns The safer text
|
||||||
|
*/
|
||||||
|
export declare const removeScript: (txt: string) => string;
|
||||||
|
export declare const sanitizeText: (text: string, config: MermaidConfig) => string;
|
||||||
|
export declare const sanitizeTextOrArray: (a: string | string[] | string[][], config: MermaidConfig) => string | string[];
|
||||||
|
/**
|
||||||
|
* Whether or not a text has any line breaks
|
||||||
|
*
|
||||||
|
* @param text - The text to test
|
||||||
|
* @returns Whether or not the text has breaks
|
||||||
|
*/
|
||||||
|
export declare const hasBreaks: (text: string) => boolean;
|
||||||
|
/**
|
||||||
|
* Splits on <br> tags
|
||||||
|
*
|
||||||
|
* @param text - Text to split
|
||||||
|
* @returns List of lines as strings
|
||||||
|
*/
|
||||||
|
export declare const splitBreaks: (text: string) => string[];
|
||||||
|
/**
|
||||||
|
* Converts a string/boolean into a boolean
|
||||||
|
*
|
||||||
|
* @param val - String or boolean to convert
|
||||||
|
* @returns The result from the input
|
||||||
|
*/
|
||||||
|
export declare const evaluate: (val?: string | boolean) => boolean;
|
||||||
|
/**
|
||||||
|
* Wrapper around Math.max which removes non-numeric values
|
||||||
|
* Returns the larger of a set of supplied numeric expressions.
|
||||||
|
* @param values - Numeric expressions to be evaluated
|
||||||
|
* @returns The smaller value
|
||||||
|
*/
|
||||||
|
export declare const getMax: (...values: number[]) => number;
|
||||||
|
/**
|
||||||
|
* Wrapper around Math.min which removes non-numeric values
|
||||||
|
* Returns the smaller of a set of supplied numeric expressions.
|
||||||
|
* @param values - Numeric expressions to be evaluated
|
||||||
|
* @returns The smaller value
|
||||||
|
*/
|
||||||
|
export declare const getMin: (...values: number[]) => number;
|
||||||
|
/**
|
||||||
|
* Makes generics in typescript syntax
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* Array of array of strings in typescript syntax
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // returns "Array<Array<string>>"
|
||||||
|
* parseGenericTypes('Array~Array~string~~');
|
||||||
|
* ```
|
||||||
|
* @param text - The text to convert
|
||||||
|
* @returns The converted string
|
||||||
|
*/
|
||||||
|
export declare const parseGenericTypes: (input: string) => string;
|
||||||
|
export declare const countOccurrence: (string: string, substring: string) => number;
|
||||||
|
declare const _default: {
|
||||||
|
getRows: (s?: string | undefined) => string[];
|
||||||
|
sanitizeText: (text: string, config: MermaidConfig) => string;
|
||||||
|
sanitizeTextOrArray: (a: string | string[] | string[][], config: MermaidConfig) => string | string[];
|
||||||
|
hasBreaks: (text: string) => boolean;
|
||||||
|
splitBreaks: (text: string) => string[];
|
||||||
|
lineBreakRegex: RegExp;
|
||||||
|
removeScript: (txt: string) => string;
|
||||||
|
getUrl: (useAbsolute: boolean) => string;
|
||||||
|
evaluate: (val?: string | boolean | undefined) => boolean;
|
||||||
|
getMax: (...values: number[]) => number;
|
||||||
|
getMin: (...values: number[]) => number;
|
||||||
|
};
|
||||||
|
export default _default;
|
1
webroot/js/node_modules/mermaid/dist/diagrams/common/common.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagrams/common/common.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1,7 @@
|
||||||
|
export declare const clear: () => void;
|
||||||
|
export declare const setAccTitle: (txt: string) => void;
|
||||||
|
export declare const getAccTitle: () => string;
|
||||||
|
export declare const setAccDescription: (txt: string) => void;
|
||||||
|
export declare const getAccDescription: () => string;
|
||||||
|
export declare const setDiagramTitle: (txt: string) => void;
|
||||||
|
export declare const getDiagramTitle: () => string;
|
50
webroot/js/node_modules/mermaid/dist/diagrams/common/commonTypes.d.ts
generated
vendored
Normal file
50
webroot/js/node_modules/mermaid/dist/diagrams/common/commonTypes.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
export interface RectData {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
fill: string;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
stroke: string;
|
||||||
|
class?: string;
|
||||||
|
color?: string;
|
||||||
|
rx?: number;
|
||||||
|
ry?: number;
|
||||||
|
attrs?: Record<string, string | number>;
|
||||||
|
anchor?: string;
|
||||||
|
}
|
||||||
|
export interface Bound {
|
||||||
|
startx: number;
|
||||||
|
stopx: number;
|
||||||
|
starty: number;
|
||||||
|
stopy: number;
|
||||||
|
fill: string;
|
||||||
|
stroke: string;
|
||||||
|
}
|
||||||
|
export interface TextData {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
anchor: string;
|
||||||
|
text: string;
|
||||||
|
textMargin: number;
|
||||||
|
class?: string;
|
||||||
|
}
|
||||||
|
export interface TextObject {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
fill?: string;
|
||||||
|
anchor?: string;
|
||||||
|
'text-anchor': string;
|
||||||
|
style: string;
|
||||||
|
textMargin: number;
|
||||||
|
rx: number;
|
||||||
|
ry: number;
|
||||||
|
tspan: boolean;
|
||||||
|
valign?: string;
|
||||||
|
}
|
||||||
|
export type D3RectElement = d3.Selection<SVGRectElement, unknown, Element | null, unknown>;
|
||||||
|
export type D3UseElement = d3.Selection<SVGUseElement, unknown, Element | null, unknown>;
|
||||||
|
export type D3ImageElement = d3.Selection<SVGImageElement, unknown, Element | null, unknown>;
|
||||||
|
export type D3TextElement = d3.Selection<SVGTextElement, unknown, Element | null, unknown>;
|
||||||
|
export type D3TSpanElement = d3.Selection<SVGTSpanElement, unknown, Element | null, unknown>;
|
15
webroot/js/node_modules/mermaid/dist/diagrams/common/svgDrawCommon.d.ts
generated
vendored
Normal file
15
webroot/js/node_modules/mermaid/dist/diagrams/common/svgDrawCommon.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import type { Group, SVG } from '../../diagram-api/types.js';
|
||||||
|
import type { Bound, D3RectElement, D3TextElement, RectData, TextData, TextObject } from './commonTypes.js';
|
||||||
|
export declare const drawRect: (element: SVG | Group, rectData: RectData) => D3RectElement;
|
||||||
|
/**
|
||||||
|
* Draws a background rectangle
|
||||||
|
*
|
||||||
|
* @param element - Diagram (reference for bounds)
|
||||||
|
* @param bounds - Shape of the rectangle
|
||||||
|
*/
|
||||||
|
export declare const drawBackgroundRect: (element: SVG | Group, bounds: Bound) => void;
|
||||||
|
export declare const drawText: (element: SVG | Group, textData: TextData) => D3TextElement;
|
||||||
|
export declare const drawImage: (elem: SVG | Group, x: number, y: number, link: string) => void;
|
||||||
|
export declare const drawEmbeddedImage: (element: SVG | Group, x: number, y: number, link: string) => void;
|
||||||
|
export declare const getNoteRect: () => RectData;
|
||||||
|
export declare const getTextObj: () => TextObject;
|
|
@ -0,0 +1,49 @@
|
||||||
|
declare namespace _default {
|
||||||
|
export { Cardinality };
|
||||||
|
export { Identification };
|
||||||
|
export function getConfig(): import("../../config.type.js").ErDiagramConfig | undefined;
|
||||||
|
export { addEntity };
|
||||||
|
export { addAttributes };
|
||||||
|
export { getEntities };
|
||||||
|
export { addRelationship };
|
||||||
|
export { getRelationships };
|
||||||
|
export { clear };
|
||||||
|
export { setAccTitle };
|
||||||
|
export { getAccTitle };
|
||||||
|
export { setAccDescription };
|
||||||
|
export { getAccDescription };
|
||||||
|
export { setDiagramTitle };
|
||||||
|
export { getDiagramTitle };
|
||||||
|
}
|
||||||
|
export default _default;
|
||||||
|
declare namespace Cardinality {
|
||||||
|
let ZERO_OR_ONE: string;
|
||||||
|
let ZERO_OR_MORE: string;
|
||||||
|
let ONE_OR_MORE: string;
|
||||||
|
let ONLY_ONE: string;
|
||||||
|
let MD_PARENT: string;
|
||||||
|
}
|
||||||
|
declare namespace Identification {
|
||||||
|
let NON_IDENTIFYING: string;
|
||||||
|
let IDENTIFYING: string;
|
||||||
|
}
|
||||||
|
declare function addEntity(name: any, alias?: undefined): any;
|
||||||
|
declare function addAttributes(entityName: any, attribs: any): void;
|
||||||
|
declare function getEntities(): {};
|
||||||
|
/**
|
||||||
|
* Add a relationship
|
||||||
|
*
|
||||||
|
* @param entA The first entity in the relationship
|
||||||
|
* @param rolA The role played by the first entity in relation to the second
|
||||||
|
* @param entB The second entity in the relationship
|
||||||
|
* @param rSpec The details of the relationship between the two entities
|
||||||
|
*/
|
||||||
|
declare function addRelationship(entA: any, rolA: any, entB: any, rSpec: any): void;
|
||||||
|
declare function getRelationships(): any[];
|
||||||
|
declare function clear(): void;
|
||||||
|
import { setAccTitle } from '../common/commonDb.js';
|
||||||
|
import { getAccTitle } from '../common/commonDb.js';
|
||||||
|
import { setAccDescription } from '../common/commonDb.js';
|
||||||
|
import { getAccDescription } from '../common/commonDb.js';
|
||||||
|
import { setDiagramTitle } from '../common/commonDb.js';
|
||||||
|
import { getDiagramTitle } from '../common/commonDb.js';
|
|
@ -0,0 +1,3 @@
|
||||||
|
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
declare const plugin: ExternalDiagramDefinition;
|
||||||
|
export default plugin;
|
|
@ -0,0 +1,34 @@
|
||||||
|
export declare const diagram: {
|
||||||
|
parser: any;
|
||||||
|
db: {
|
||||||
|
Cardinality: {
|
||||||
|
ZERO_OR_ONE: string;
|
||||||
|
ZERO_OR_MORE: string;
|
||||||
|
ONE_OR_MORE: string;
|
||||||
|
ONLY_ONE: string;
|
||||||
|
MD_PARENT: string;
|
||||||
|
};
|
||||||
|
Identification: {
|
||||||
|
NON_IDENTIFYING: string;
|
||||||
|
IDENTIFYING: string;
|
||||||
|
};
|
||||||
|
getConfig: () => import("../../config.type.js").ErDiagramConfig | undefined;
|
||||||
|
addEntity: (name: any, alias?: undefined) => any;
|
||||||
|
addAttributes: (entityName: any, attribs: any) => void;
|
||||||
|
getEntities: () => {};
|
||||||
|
addRelationship: (entA: any, rolA: any, entB: any, rSpec: any) => void;
|
||||||
|
getRelationships: () => any[];
|
||||||
|
clear: () => void;
|
||||||
|
setAccTitle: (txt: string) => void;
|
||||||
|
getAccTitle: () => string;
|
||||||
|
setAccDescription: (txt: string) => void;
|
||||||
|
getAccDescription: () => string;
|
||||||
|
setDiagramTitle: (txt: string) => void;
|
||||||
|
getDiagramTitle: () => string;
|
||||||
|
};
|
||||||
|
renderer: {
|
||||||
|
setConf: (cnf: any) => void;
|
||||||
|
draw: (text: any, id: any, _version: any, diagObj: any) => void;
|
||||||
|
};
|
||||||
|
styles: (options: any) => string;
|
||||||
|
};
|
|
@ -0,0 +1,24 @@
|
||||||
|
declare namespace _default {
|
||||||
|
export { ERMarkers };
|
||||||
|
export { insertMarkers };
|
||||||
|
}
|
||||||
|
export default _default;
|
||||||
|
declare namespace ERMarkers {
|
||||||
|
let ONLY_ONE_START: string;
|
||||||
|
let ONLY_ONE_END: string;
|
||||||
|
let ZERO_OR_ONE_START: string;
|
||||||
|
let ZERO_OR_ONE_END: string;
|
||||||
|
let ONE_OR_MORE_START: string;
|
||||||
|
let ONE_OR_MORE_END: string;
|
||||||
|
let ZERO_OR_MORE_START: string;
|
||||||
|
let ZERO_OR_MORE_END: string;
|
||||||
|
let MD_PARENT_END: string;
|
||||||
|
let MD_PARENT_START: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Put the markers into the svg DOM for later use with edge paths
|
||||||
|
*
|
||||||
|
* @param elem
|
||||||
|
* @param conf
|
||||||
|
*/
|
||||||
|
declare function insertMarkers(elem: any, conf: any): void;
|
|
@ -0,0 +1,19 @@
|
||||||
|
/**
|
||||||
|
* Return a unique id based on the given string. Start with the prefix, then a hyphen, then the
|
||||||
|
* simplified str, then a hyphen, then a unique uuid based on the str. (Hyphens are only included if needed.)
|
||||||
|
* Although the official XML standard for ids says that many more characters are valid in the id,
|
||||||
|
* this keeps things simple by accepting only A-Za-z0-9.
|
||||||
|
*
|
||||||
|
* @param {string} str Given string to use as the basis for the id. Default is `''`
|
||||||
|
* @param {string} prefix String to put at the start, followed by '-'. Default is `''`
|
||||||
|
* @returns {string}
|
||||||
|
* @see https://www.w3.org/TR/xml/#NT-Name
|
||||||
|
*/
|
||||||
|
export function generateId(str?: string, prefix?: string): string;
|
||||||
|
export function setConf(cnf: any): void;
|
||||||
|
export function draw(text: any, id: any, _version: any, diagObj: any): void;
|
||||||
|
declare namespace _default {
|
||||||
|
export { setConf };
|
||||||
|
export { draw };
|
||||||
|
}
|
||||||
|
export default _default;
|
1
webroot/js/node_modules/mermaid/dist/diagrams/er/erRenderer.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagrams/er/erRenderer.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
|
@ -0,0 +1,2 @@
|
||||||
|
export default getStyles;
|
||||||
|
declare function getStyles(options: any): string;
|
3
webroot/js/node_modules/mermaid/dist/diagrams/error/errorDiagram.d.ts
generated
vendored
Normal file
3
webroot/js/node_modules/mermaid/dist/diagrams/error/errorDiagram.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import type { DiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
declare const diagram: DiagramDefinition;
|
||||||
|
export default diagram;
|
12
webroot/js/node_modules/mermaid/dist/diagrams/error/errorRenderer.d.ts
generated
vendored
Normal file
12
webroot/js/node_modules/mermaid/dist/diagrams/error/errorRenderer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/**
|
||||||
|
* Draws a an info picture in the tag with id: id based on the graph definition in text.
|
||||||
|
*
|
||||||
|
* @param _text - Mermaid graph definition.
|
||||||
|
* @param id - The text for the error
|
||||||
|
* @param version - The version
|
||||||
|
*/
|
||||||
|
export declare const draw: (_text: string, id: string, version: string) => void;
|
||||||
|
export declare const renderer: {
|
||||||
|
draw: (_text: string, id: string, version: string) => void;
|
||||||
|
};
|
||||||
|
export default renderer;
|
3
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/detector.d.ts
generated
vendored
Normal file
3
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/detector.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import type { ExternalDiagramDefinition } from '../../../diagram-api/types.js';
|
||||||
|
declare const plugin: ExternalDiagramDefinition;
|
||||||
|
export default plugin;
|
1
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/detector.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/detector.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
10
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/flowRenderer-elk.d.ts
generated
vendored
Normal file
10
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/flowRenderer-elk.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
export function setConf(cnf: any): void;
|
||||||
|
export function addVertices(vert: any, svgId: any, root: any, doc: any, diagObj: any, parentLookupDb: any, graph: any): Promise<any>;
|
||||||
|
export function addEdges(edges: object, diagObj: any, graph: any, svg: any): any;
|
||||||
|
export function getClasses(text: any, diagObj: any): Record<string, import('../../../diagram-api/types.js').DiagramStyleClassDef>;
|
||||||
|
export function draw(text: any, id: any, _version: any, diagObj: any): Promise<void>;
|
||||||
|
declare namespace _default {
|
||||||
|
export { getClasses };
|
||||||
|
export { draw };
|
||||||
|
}
|
||||||
|
export default _default;
|
10
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/flowchart-elk-definition.d.ts
generated
vendored
Normal file
10
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/flowchart-elk-definition.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import * as db from '../flowDb.js';
|
||||||
|
export declare const diagram: {
|
||||||
|
db: typeof db;
|
||||||
|
renderer: {
|
||||||
|
getClasses: (text: any, diagObj: any) => Record<string, import("../../../diagram-api/types.js").DiagramStyleClassDef>;
|
||||||
|
draw: (text: any, id: any, _version: any, diagObj: any) => Promise<void>;
|
||||||
|
};
|
||||||
|
parser: any;
|
||||||
|
styles: (options: import("./styles.js").FlowChartStyleOptions) => string;
|
||||||
|
};
|
5
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/render-utils.d.ts
generated
vendored
Normal file
5
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/render-utils.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export interface TreeData {
|
||||||
|
parentById: Record<string, string>;
|
||||||
|
childrenById: Record<string, string[]>;
|
||||||
|
}
|
||||||
|
export declare const findCommonAncestor: (id1: string, id2: string, treeData: TreeData) => string;
|
1
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/render-utils.spec.d.ts
generated
vendored
Normal file
1
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/render-utils.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
19
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/styles.d.ts
generated
vendored
Normal file
19
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/elk/styles.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/** Returns the styles given options */
|
||||||
|
export interface FlowChartStyleOptions {
|
||||||
|
arrowheadColor: string;
|
||||||
|
border2: string;
|
||||||
|
clusterBkg: string;
|
||||||
|
clusterBorder: string;
|
||||||
|
edgeLabelBackground: string;
|
||||||
|
fontFamily: string;
|
||||||
|
lineColor: string;
|
||||||
|
mainBkg: string;
|
||||||
|
nodeBorder: string;
|
||||||
|
nodeTextColor: string;
|
||||||
|
tertiaryColor: string;
|
||||||
|
textColor: string;
|
||||||
|
titleColor: string;
|
||||||
|
[key: string]: string;
|
||||||
|
}
|
||||||
|
declare const getStyles: (options: FlowChartStyleOptions) => string;
|
||||||
|
export default getStyles;
|
9
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowChartShapes.d.ts
generated
vendored
Normal file
9
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowChartShapes.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/** @param render */
|
||||||
|
export function addToRender(render: any): void;
|
||||||
|
/** @param addShape */
|
||||||
|
export function addToRenderV2(addShape: any): void;
|
||||||
|
declare namespace _default {
|
||||||
|
export { addToRender };
|
||||||
|
export { addToRenderV2 };
|
||||||
|
}
|
||||||
|
export default _default;
|
87
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowDb.d.ts
generated
vendored
Normal file
87
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowDb.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
export function lookUpDomId(id: any): any;
|
||||||
|
export function addVertex(_id: any, textObj: any, type: any, style: any, classes: any, dir: any, props?: {}): void;
|
||||||
|
export function addSingleLink(_start: any, _end: any, type: any): void;
|
||||||
|
export function addLink(_start: any, _end: any, type: any): void;
|
||||||
|
export function updateLinkInterpolate(positions: any, interp: any): void;
|
||||||
|
export function updateLink(positions: any, style: any): void;
|
||||||
|
export function addClass(ids: any, style: any): void;
|
||||||
|
export function setDirection(dir: any): void;
|
||||||
|
export function setClass(ids: any, className: any): void;
|
||||||
|
export function setLink(ids: any, linkStr: any, target: any): void;
|
||||||
|
export function getTooltip(id: any): any;
|
||||||
|
export function setClickEvent(ids: any, functionName: any, functionArgs: any): void;
|
||||||
|
export function bindFunctions(element: any): void;
|
||||||
|
export function getDirection(): any;
|
||||||
|
export function getVertices(): {} | any | any;
|
||||||
|
export function getEdges(): {} | any | any[];
|
||||||
|
export function getClasses(): {} | any | any;
|
||||||
|
export function clear(ver?: string): void;
|
||||||
|
export function setGen(ver: any): void;
|
||||||
|
export function defaultStyle(): string;
|
||||||
|
export function addSubGraph(_id: any, list: any, _title: any): any;
|
||||||
|
export function getDepthFirstPos(pos: any): any;
|
||||||
|
export function indexNodes(): void;
|
||||||
|
export function getSubGraphs(): any[];
|
||||||
|
export function firstGraph(): boolean;
|
||||||
|
export function destructLink(_str: any, _startStr: any): {
|
||||||
|
type: string;
|
||||||
|
stroke: string;
|
||||||
|
};
|
||||||
|
export namespace lex {
|
||||||
|
export { firstGraph };
|
||||||
|
}
|
||||||
|
declare namespace _default {
|
||||||
|
export function defaultConfig(): import("../../config.type.js").FlowchartDiagramConfig | undefined;
|
||||||
|
export { setAccTitle };
|
||||||
|
export { getAccTitle };
|
||||||
|
export { getAccDescription };
|
||||||
|
export { setAccDescription };
|
||||||
|
export { addVertex };
|
||||||
|
export { lookUpDomId };
|
||||||
|
export { addLink };
|
||||||
|
export { updateLinkInterpolate };
|
||||||
|
export { updateLink };
|
||||||
|
export { addClass };
|
||||||
|
export { setDirection };
|
||||||
|
export { setClass };
|
||||||
|
export { setTooltip };
|
||||||
|
export { getTooltip };
|
||||||
|
export { setClickEvent };
|
||||||
|
export { setLink };
|
||||||
|
export { bindFunctions };
|
||||||
|
export { getDirection };
|
||||||
|
export { getVertices };
|
||||||
|
export { getEdges };
|
||||||
|
export { getClasses };
|
||||||
|
export { clear };
|
||||||
|
export { setGen };
|
||||||
|
export { defaultStyle };
|
||||||
|
export { addSubGraph };
|
||||||
|
export { getDepthFirstPos };
|
||||||
|
export { indexNodes };
|
||||||
|
export { getSubGraphs };
|
||||||
|
export { destructLink };
|
||||||
|
export { lex };
|
||||||
|
export { exists };
|
||||||
|
export { makeUniq };
|
||||||
|
export { setDiagramTitle };
|
||||||
|
export { getDiagramTitle };
|
||||||
|
}
|
||||||
|
export default _default;
|
||||||
|
import { setAccTitle } from '../common/commonDb.js';
|
||||||
|
import { getAccTitle } from '../common/commonDb.js';
|
||||||
|
import { getAccDescription } from '../common/commonDb.js';
|
||||||
|
import { setAccDescription } from '../common/commonDb.js';
|
||||||
|
declare function setTooltip(ids: any, tooltip: any): void;
|
||||||
|
declare function exists(allSgs: any, _id: any): boolean;
|
||||||
|
/**
|
||||||
|
* Deletes an id from all subgraphs
|
||||||
|
*
|
||||||
|
* @param sg
|
||||||
|
* @param allSubgraphs
|
||||||
|
*/
|
||||||
|
declare function makeUniq(sg: any, allSubgraphs: any): {
|
||||||
|
nodes: any[];
|
||||||
|
};
|
||||||
|
import { setDiagramTitle } from '../common/commonDb.js';
|
||||||
|
import { getDiagramTitle } from '../common/commonDb.js';
|
3
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowDetector-v2.d.ts
generated
vendored
Normal file
3
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowDetector-v2.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
declare const plugin: ExternalDiagramDefinition;
|
||||||
|
export default plugin;
|
3
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowDetector.d.ts
generated
vendored
Normal file
3
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowDetector.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
|
||||||
|
declare const plugin: ExternalDiagramDefinition;
|
||||||
|
export default plugin;
|
57
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowDiagram-v2.d.ts
generated
vendored
Normal file
57
webroot/js/node_modules/mermaid/dist/diagrams/flowchart/flowDiagram-v2.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
import type { MermaidConfig } from '../../config.type.js';
|
||||||
|
export declare const diagram: {
|
||||||
|
parser: any;
|
||||||
|
db: {
|
||||||
|
defaultConfig: () => import("../../config.type.js").FlowchartDiagramConfig | undefined;
|
||||||
|
setAccTitle: (txt: string) => void;
|
||||||
|
getAccTitle: () => string;
|
||||||
|
getAccDescription: () => string;
|
||||||
|
setAccDescription: (txt: string) => void;
|
||||||
|
addVertex: (_id: any, textObj: any, type: any, style: any, classes: any, dir: any, props?: {}) => void;
|
||||||
|
lookUpDomId: (id: any) => any;
|
||||||
|
addLink: (_start: any, _end: any, type: any) => void;
|
||||||
|
updateLinkInterpolate: (positions: any, interp: any) => void;
|
||||||
|
updateLink: (positions: any, style: any) => void;
|
||||||
|
addClass: (ids: any, style: any) => void;
|
||||||
|
setDirection: (dir: any) => void;
|
||||||
|
setClass: (ids: any, className: any) => void;
|
||||||
|
setTooltip: (ids: any, tooltip: any) => void;
|
||||||
|
getTooltip: (id: any) => any;
|
||||||
|
setClickEvent: (ids: any, functionName: any, functionArgs: any) => void;
|
||||||
|
setLink: (ids: any, linkStr: any, target: any) => void;
|
||||||
|
bindFunctions: (element: any) => void;
|
||||||
|
getDirection: () => any;
|
||||||
|
getVertices: () => any;
|
||||||
|
getEdges: () => any;
|
||||||
|
getClasses: () => any;
|
||||||
|
clear: (ver?: string) => void;
|
||||||
|
setGen: (ver: any) => void;
|
||||||
|
defaultStyle: () => string;
|
||||||
|
addSubGraph: (_id: any, list: any, _title: any) => any;
|
||||||
|
getDepthFirstPos: (pos: any) => any;
|
||||||
|
indexNodes: () => void;
|
||||||
|
getSubGraphs: () => any[];
|
||||||
|
destructLink: (_str: any, _startStr: any) => {
|
||||||
|
type: string;
|
||||||
|
stroke: string;
|
||||||
|
};
|
||||||
|
lex: {
|
||||||
|
firstGraph: () => boolean;
|
||||||
|
};
|
||||||
|
exists: (allSgs: any, _id: any) => boolean;
|
||||||
|
makeUniq: (sg: any, allSubgraphs: any) => {
|
||||||
|
nodes: any[];
|
||||||
|
};
|
||||||
|
setDiagramTitle: (txt: string) => void;
|
||||||
|
getDiagramTitle: () => string;
|
||||||
|
};
|
||||||
|
renderer: {
|
||||||
|
setConf: (cnf: any) => void;
|
||||||
|
addVertices: (vert: any, g: any, svgId: any, root: any, doc: any, diagObj: any) => void;
|
||||||
|
addEdges: (edges: object, g: object, diagObj: any) => void;
|
||||||
|
getClasses: (text: any, diagObj: any) => Record<string, import("../../diagram-api/types.js").DiagramStyleClassDef>;
|
||||||
|
draw: (text: any, id: any, _version: any, diagObj: any) => Promise<void>;
|
||||||
|
};
|
||||||
|
styles: (options: import("./styles.js").FlowChartStyleOptions) => string;
|
||||||
|
init: (cnf: MermaidConfig) => void;
|
||||||
|
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue