@zombie-mermaid/svg-renderer 4.2.2 → 4.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +13 -5
  4. package/dist/index.js.map +1 -1
  5. package/package.json +4 -3
  6. package/src/index.ts +34 -1
  7. package/src/__tests__/c4-label-clearance-1290.test.ts +0 -112
  8. package/src/__tests__/c4-line-ends-1208.test.ts +0 -52
  9. package/src/__tests__/c4-mermaid-reference.test.ts +0 -124
  10. package/src/__tests__/c4-svg.test.ts +0 -337
  11. package/src/__tests__/c4-text-width-1210.test.ts +0 -43
  12. package/src/__tests__/class-component-order-1249.test.ts +0 -40
  13. package/src/__tests__/class-diamond-markers-1232.test.ts +0 -59
  14. package/src/__tests__/class-member-right-padding-1238.test.ts +0 -43
  15. package/src/__tests__/class-namespace-1196.test.ts +0 -165
  16. package/src/__tests__/class-namespace-sparse-elk-1196.test.ts +0 -96
  17. package/src/__tests__/class-visibility-markers-1237.test.ts +0 -27
  18. package/src/__tests__/edge-jog-straightening-1388.test.ts +0 -57
  19. package/src/__tests__/elk-adapter-utils.test.ts +0 -166
  20. package/src/__tests__/er-attribute-right-padding-1262.test.ts +0 -47
  21. package/src/__tests__/er-cardinality-markers-1233.test.ts +0 -35
  22. package/src/__tests__/er-default-direction-1250.test.ts +0 -69
  23. package/src/__tests__/er-edge-label-contrast-1244.test.ts +0 -58
  24. package/src/__tests__/fixtures/c4-mermaid-reference.json +0 -626
  25. package/src/__tests__/flowchart-parallel-edge-lanes-1308.test.ts +0 -168
  26. package/src/__tests__/pie-layout.test.ts +0 -215
  27. package/src/__tests__/pie-svg.test.ts +0 -194
  28. package/src/__tests__/render-mermaid-svg.test.ts +0 -64
  29. package/src/__tests__/sequence-label-clearance-1242.test.ts +0 -162
  30. package/src/__tests__/sequence-nested-activation-1241.test.ts +0 -37
  31. package/src/__tests__/svg-edge-to-own-cluster-1310.test.ts +0 -32
  32. package/src/__tests__/xychart-smooth-curve.test.ts +0 -42
  33. package/src/__tests__/xychart-x-label-overlap-1243.test.ts +0 -62
package/dist/index.js CHANGED
@@ -4955,10 +4955,18 @@ function $o(e) {
4955
4955
  };
4956
4956
  }
4957
4957
  function es(e, t = {}) {
4958
- let n = ts(e, t);
4958
+ let n = ts(ns(e, t));
4959
4959
  return t.resolveColors ? ti(n, Zo(t)) : n;
4960
4960
  }
4961
- function ts(e, t) {
4961
+ function ts(e) {
4962
+ let t = new Set(Array.from(e.matchAll(/\sid="([^"]+)"/g), (e) => e[1] ?? ""));
4963
+ if (t.size === 0) return e;
4964
+ let n = 2166136261;
4965
+ for (let t = 0; t < e.length; t++) n = Math.imul(n ^ e.charCodeAt(t), 16777619);
4966
+ let r = `zm${(n >>> 0).toString(36)}-`, i = (e) => t.has(e) && !e.startsWith("zm-") ? r + e : e;
4967
+ return e.replace(/(\sid=")([^"]+)"/g, (e, t, n) => `${t}${i(n)}"`).replace(/url\(#([^)]+)\)/g, (e, t) => `url(#${i(t)})`).replace(/(href=")#([^"]+)"/g, (e, t, n) => `${t}#${i(n)}"`);
4968
+ }
4969
+ function ns(e, t) {
4962
4970
  let r = oe(e), i = Zo(t), a = t.font ?? "Inter";
4963
4971
  v(c(a));
4964
4972
  let o = t.transparent ?? !1, s = Te(t.fontSizes), l = n(r), u = t.embedSource ? e : void 0, d = t.title, f = t.decorative, p = $o(t), m = y(r), h = Xo[l], g = h.parse(m, r), _ = h.layoutForSvg(g, t), b = {
@@ -4973,11 +4981,11 @@ function ts(e, t) {
4973
4981
  };
4974
4982
  return h.renderSvg(_, b, t);
4975
4983
  }
4976
- async function ns(e, t = {}) {
4984
+ async function rs(e, t = {}) {
4977
4985
  return es(e, t);
4978
4986
  }
4979
- var rs = es, is = ns;
4987
+ var is = es, as = rs;
4980
4988
  //#endregion
4981
- export { Gi as ACTOR_LABEL_OFFSET, Oe as ARROW_HEAD, U as CLS, je as ELK_DIRECTION_FALLBACK, I as FONT_SIZES, L as FONT_WEIGHTS, Ee as GROUP_HEADER_CONTENT_PAD, Ie as INLINE_CENTERED_EDGE_LABEL, Ce as MONO_FONT, we as MONO_FONT_STACK, De as NODE_PADDING, X as PIE, R as STROKE_WIDTHS, z as TEXT_BASELINE_SHIFT, Pe as baseElkLayoutOptions, Wi as boxLabelHeight, Re as buildElkEdge, Le as buildElkEdgeLabel, Fe as buildElkLeafNode, ke as buildSvgStyleBlock, ni as classNoteId, ot as clipEdgeToShape, Pn as convertToElkFormat, ge as createLayoutCache, Me as directionToElk, ye as elkLayoutSync, Ne as elkPadding, Se as estimateMonoTextWidth, F as estimateTextWidth, Yr as evaluateCssColorValue, St as extractEdgeLabelPosition, xt as extractEdgePoints, ka as formatTickLabels, ci as layoutClassDiagramSync, ji as layoutErDiagramSync, Nn as layoutFlowchartSync, jn as layoutGraphSync, Wa as layoutPieChart, Yi as layoutSequenceDiagram, va as layoutXYChart, Oa as niceTickValues, Ga as pieColorValue, fe as pointsToPath, fi as renderClassSvg, Pi as renderErSvg, is as renderMermaid, es as renderMermaidSVG, ns as renderMermaidSVGAsync, rs as renderMermaidSync, qa as renderPieSvg, Xi as renderSequenceSvg, Wn as renderSvg, Ma as renderXYChartSvg, ti as resolveCssColors, Te as resolveFontSizes, Ia as smoothCurvePath, Qo as themeCssVariables, Br as withDataSrc, wa as xLabelStep };
4989
+ export { Gi as ACTOR_LABEL_OFFSET, Oe as ARROW_HEAD, U as CLS, je as ELK_DIRECTION_FALLBACK, I as FONT_SIZES, L as FONT_WEIGHTS, Ee as GROUP_HEADER_CONTENT_PAD, Ie as INLINE_CENTERED_EDGE_LABEL, Ce as MONO_FONT, we as MONO_FONT_STACK, De as NODE_PADDING, X as PIE, R as STROKE_WIDTHS, z as TEXT_BASELINE_SHIFT, Pe as baseElkLayoutOptions, Wi as boxLabelHeight, Re as buildElkEdge, Le as buildElkEdgeLabel, Fe as buildElkLeafNode, ke as buildSvgStyleBlock, ni as classNoteId, ot as clipEdgeToShape, Pn as convertToElkFormat, ge as createLayoutCache, Me as directionToElk, ye as elkLayoutSync, Ne as elkPadding, Se as estimateMonoTextWidth, F as estimateTextWidth, Yr as evaluateCssColorValue, St as extractEdgeLabelPosition, xt as extractEdgePoints, ka as formatTickLabels, ci as layoutClassDiagramSync, ji as layoutErDiagramSync, Nn as layoutFlowchartSync, jn as layoutGraphSync, Wa as layoutPieChart, Yi as layoutSequenceDiagram, va as layoutXYChart, Oa as niceTickValues, Ga as pieColorValue, fe as pointsToPath, fi as renderClassSvg, Pi as renderErSvg, as as renderMermaid, es as renderMermaidSVG, rs as renderMermaidSVGAsync, is as renderMermaidSync, qa as renderPieSvg, Xi as renderSequenceSvg, Wn as renderSvg, Ma as renderXYChartSvg, ti as resolveCssColors, Te as resolveFontSizes, Ia as smoothCurvePath, Qo as themeCssVariables, Br as withDataSrc, wa as xLabelStep };
4982
4990
 
4983
4991
  //# sourceMappingURL=index.js.map