@likec4/generators 1.55.1 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ //#region \0rolldown/runtime.js
1
2
  var __defProp = Object.defineProperty;
2
3
  var __exportAll = (all, no_symbols) => {
3
4
  let target = {};
@@ -8,4 +9,5 @@ var __exportAll = (all, no_symbols) => {
8
9
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
9
10
  return target;
10
11
  };
12
+ //#endregion
11
13
  export { __exportAll as t };
package/dist/index.mjs CHANGED
@@ -5,6 +5,7 @@ import { RichText, flattenMarkdownOrString } from "@likec4/core/types";
5
5
  import pako from "pako";
6
6
  import JSON5 from "json5";
7
7
  import { compareNatural, invariant as invariant$1, sortNaturalByFqn } from "@likec4/core/utils";
8
+ //#region src/d2/generate-d2.ts
8
9
  const capitalizeFirstLetter$2 = (value) => value.charAt(0).toLocaleUpperCase() + value.slice(1);
9
10
  const fqnName$2 = (nodeId) => nodeId.split(".").map(capitalizeFirstLetter$2).join("");
10
11
  const nodeName$2 = (node) => {
@@ -52,6 +53,8 @@ function generateD2(viewmodel) {
52
53
  };
53
54
  return toString(new CompositeGeneratorNode().append("direction: ", d2direction(view), NL, NL).append(joinToNode(nodes.filter((n) => isNullish(n.parent)), (n) => printNode(n), { appendNewLineIfNotEmpty: true })).appendIf(edges.length > 0, NL, joinToNode(edges, (e) => printEdge(e), { appendNewLineIfNotEmpty: true })));
54
55
  }
56
+ //#endregion
57
+ //#region src/drawio/constants.ts
55
58
  /**
56
59
  * DrawIO protocol and layout constants. Single source of truth so export/parse
57
60
  * stay in sync and magic numbers are named for readability.
@@ -60,47 +63,19 @@ function generateD2(viewmodel) {
60
63
  const DRAWIO_PAGE_LINK_PREFIX = "data:page/id,likec4-";
61
64
  /** Diagram (tab) id inside mxfile; we use "likec4-<viewId>" so Draw.io opens the correct tab. */
62
65
  const DRAWIO_DIAGRAM_ID_PREFIX = "likec4-";
63
- /** Fixed canvas size so the diagram opens centered in Draw.io (layout bounds often equal content). */
64
- const DEFAULT_CANVAS_WIDTH = 800;
65
- const DEFAULT_CANVAS_HEIGHT = 600;
66
- /** Default node bbox when layout has no position (used to detect "unlaid" nodes for spread/wrap). */
67
- const DEFAULT_NODE_WIDTH = 120;
68
- const DEFAULT_NODE_HEIGHT = 60;
69
- /** Vertical gap when spreading multiple nodes that share the same default bbox. */
70
- const NODES_SPREAD_GAP = 24;
71
66
  /** First id assigned to container title cells (incremented per container). */
72
67
  const CONTAINER_TITLE_CELL_ID_START = 1e4;
73
- /** Container title text cell: min/max width (px), approximate width per character, height, inset from container edge. */
74
- const CONTAINER_TITLE_MIN_WIDTH_PX = 60;
75
- const CONTAINER_TITLE_MAX_WIDTH_PX = 260;
76
- const CONTAINER_TITLE_CHAR_WIDTH_PX = 8;
77
- const CONTAINER_TITLE_HEIGHT_PX = 18;
78
- const CONTAINER_TITLE_INSET_X = 8;
79
- const CONTAINER_TITLE_INSET_Y = 8;
80
- /** Max height (px) for container title area when matching title cell to container (parse). */
81
- const CONTAINER_TITLE_AREA_MAX_HEIGHT_PX = 40;
82
68
  /** Ratio of container height used for title area when matching (parse). */
83
69
  const CONTAINER_TITLE_AREA_HEIGHT_RATIO = .5;
84
- /** Tolerance (px) for title cell position inside container bounds (parse). */
85
- const CONTAINER_TITLE_AREA_TOLERANCE = 2;
86
- /** Default container fill opacity (0–100) when not set in style. */
87
- const DEFAULT_CONTAINER_OPACITY = 15;
88
- /** Default node fill/stroke/font when no theme color (hex). */
89
- const DEFAULT_NODE_FILL_HEX = "#dae8fc";
90
- const DEFAULT_NODE_STROKE_HEX = "#2563eb";
91
- const DEFAULT_NODE_FONT_HEX = "#1e40af";
92
- /** mxGraphModel page dimensions (draw.io default A4-like). */
93
- const MXGRAPH_PAGE_WIDTH = 827;
94
70
  const MXGRAPH_PAGE_HEIGHT = 1169;
95
- /** mxGraphModel default grid origin (dx, dy) in mxGraphModel attribute. */
96
- const MXGRAPH_DEFAULT_DX = 800;
97
- const MXGRAPH_DEFAULT_DY = 800;
98
71
  /** Default filename when exporting all views into one .drawio file (CLI and playground). */
99
72
  const DEFAULT_DRAWIO_ALL_FILENAME = "diagrams.drawio";
100
73
  /** LikeC4 app font (matches --mantine-font-family / --likec4-app-font-default). Used in generate-drawio for cell text. */
101
74
  const LIKEC4_FONT_FAMILY = "'IBM Plex Sans Variable',ui-sans-serif,system-ui,sans-serif";
102
75
  /** Container title color in diagram (matches LikeC4 diagram compound title). Used in generate-drawio for container title cell. */
103
76
  const CONTAINER_TITLE_COLOR = "#74c0fc";
77
+ //#endregion
78
+ //#region src/drawio/xml-utils.ts
104
79
  /**
105
80
  * Shared XML escape/decode for DrawIO generate and parse.
106
81
  * Single place so escaping rules stay in sync (Clean Code 8.5.2).
@@ -121,6 +96,8 @@ function escapeXml(unsafe) {
121
96
  function decodeXmlEntities(s) {
122
97
  return s.replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&quot;", "\"").replaceAll("&apos;", "'").replaceAll("&amp;", "&");
123
98
  }
99
+ //#endregion
100
+ //#region src/drawio/parse-drawio.ts
124
101
  /**
125
102
  * Parse DrawIO (mxGraph) XML and generate LikeC4 source code.
126
103
  * Extracts vertices as elements and edges as relations; preserves colors, descriptions,
@@ -713,8 +690,8 @@ function computeContainerTitles(vertices) {
713
690
  const containerCells = vertices.filter((v) => v.style?.toLowerCase().includes("container=1") && v.x != null && v.y != null && v.width != null && v.height != null);
714
691
  for (const cont of containerCells) {
715
692
  const cw = cont.width, ch = cont.height;
716
- const titleAreaHeight = Math.min(CONTAINER_TITLE_AREA_MAX_HEIGHT_PX, ch * CONTAINER_TITLE_AREA_HEIGHT_RATIO) + CONTAINER_TITLE_AREA_TOLERANCE;
717
- const best = vertices.find((v) => v.id !== cont.id && v.parent === cont.id && (v.style?.toLowerCase().includes("shape=text") || v.style?.toLowerCase().includes("text;")) && v.x != null && v.y != null && v.x >= -CONTAINER_TITLE_AREA_TOLERANCE && v.x <= cw + CONTAINER_TITLE_AREA_TOLERANCE && v.y >= -CONTAINER_TITLE_AREA_TOLERANCE && v.y <= titleAreaHeight);
693
+ const titleAreaHeight = Math.min(40, ch * CONTAINER_TITLE_AREA_HEIGHT_RATIO) + 2;
694
+ const best = vertices.find((v) => v.id !== cont.id && v.parent === cont.id && (v.style?.toLowerCase().includes("shape=text") || v.style?.toLowerCase().includes("text;")) && v.x != null && v.y != null && v.x >= -2 && v.x <= cw + 2 && v.y >= -2 && v.y <= titleAreaHeight);
718
695
  if (best) {
719
696
  const raw = (best.value ?? "").trim();
720
697
  if (raw) {
@@ -1068,7 +1045,7 @@ function decompressDrawioDiagram(base64Content) {
1068
1045
  function getFirstDiagram(fullXml) {
1069
1046
  return getAllDiagrams(fullXml)[0] ?? {
1070
1047
  name: "index",
1071
- id: `${DRAWIO_DIAGRAM_ID_PREFIX}index`,
1048
+ id: `likec4-index`,
1072
1049
  content: ""
1073
1050
  };
1074
1051
  }
@@ -1092,7 +1069,7 @@ function getAllDiagrams(fullXml) {
1092
1069
  if (closeStart === -1) break;
1093
1070
  const inner = fullXml.slice(endOpen + 1, closeStart);
1094
1071
  const name = getAttr(attrs, "name") ?? (results.length === 0 ? "index" : `diagram_${results.length + 1}`);
1095
- const id = getAttr(attrs, "id") ?? `${DRAWIO_DIAGRAM_ID_PREFIX}${name}`;
1072
+ const id = getAttr(attrs, "id") ?? `likec4-${name}`;
1096
1073
  let content;
1097
1074
  if (inner.includes("<mxGraphModel")) content = inner;
1098
1075
  else if (inner.trim() === "") content = inner;
@@ -1506,6 +1483,8 @@ function parseDrawioRoundtripComments(c4Source) {
1506
1483
  };
1507
1484
  return null;
1508
1485
  }
1486
+ //#endregion
1487
+ //#region src/drawio/generate-drawio.ts
1509
1488
  /**
1510
1489
  * DrawIO diagram generator.
1511
1490
  *
@@ -1615,7 +1594,7 @@ function getDefaultStrokeWidth(borderVal, isContainer) {
1615
1594
  /** Apply stroke color override to base element colors (KISS: named function instead of IIFE). */
1616
1595
  function applyStrokeColorOverride(base, override) {
1617
1596
  return {
1618
- fill: base?.fill ?? DEFAULT_NODE_FILL_HEX,
1597
+ fill: base?.fill ?? "#dae8fc",
1619
1598
  stroke: override,
1620
1599
  font: base?.font ?? override
1621
1600
  };
@@ -1662,21 +1641,21 @@ function drawioShape(shape) {
1662
1641
  function getElementColors(viewmodel, color) {
1663
1642
  const elementColors = getThemeColorValues(viewmodel, color, "primary").elements;
1664
1643
  return {
1665
- fill: String(elementColors.fill ?? DEFAULT_NODE_FILL_HEX),
1666
- stroke: String(elementColors.stroke ?? DEFAULT_NODE_STROKE_HEX),
1667
- font: String(elementColors.hiContrast ?? elementColors.stroke ?? DEFAULT_NODE_FONT_HEX)
1644
+ fill: String(elementColors.fill ?? "#dae8fc"),
1645
+ stroke: String(elementColors.stroke ?? "#2563eb"),
1646
+ font: String(elementColors.hiContrast ?? elementColors.stroke ?? "#1e40af")
1668
1647
  };
1669
1648
  }
1670
1649
  /** Edge stroke (line) color from theme RelationshipColorValues.line. */
1671
1650
  function getEdgeStrokeColor(viewmodel, color) {
1672
1651
  const values = getThemeColorValues(viewmodel, color ?? "gray", "gray");
1673
- return String(values.relationships?.line ?? DEFAULT_NODE_FONT_HEX);
1652
+ return String(values.relationships?.line ?? "#1e40af");
1674
1653
  }
1675
1654
  /** Edge label font and background from theme (RelationshipColorValues.label, labelBg) for readable connector text. */
1676
1655
  function getEdgeLabelColors(viewmodel, color) {
1677
1656
  const rel = getThemeColorValues(viewmodel, color ?? "gray", "gray").relationships;
1678
1657
  return {
1679
- font: String(rel?.label ?? rel?.line ?? DEFAULT_NODE_FONT_HEX),
1658
+ font: String(rel?.label ?? rel?.line ?? "#1e40af"),
1680
1659
  background: String(rel?.labelBg ?? "#ffffff")
1681
1660
  };
1682
1661
  }
@@ -1895,9 +1874,9 @@ function computeNodeStylePartsAndValue(node, layout, options, viewmodel) {
1895
1874
  const strokeColorOverride = strokeColorByNodeId?.[node.id];
1896
1875
  const strokeWidthOverride = strokeWidthByNodeId?.[node.id];
1897
1876
  const elemColors = strokeColorOverride ? applyStrokeColorOverride(getElementColors(viewmodel, node.color), strokeColorOverride) : getElementColors(viewmodel, node.color);
1898
- const fillHex = elemColors?.fill ?? DEFAULT_NODE_FILL_HEX;
1899
- const strokeHex = elemColors?.stroke ?? DEFAULT_NODE_STROKE_HEX;
1900
- const fontHex = elemColors?.font ?? elemColors?.stroke ?? DEFAULT_NODE_FONT_HEX;
1877
+ const fillHex = elemColors?.fill ?? "#dae8fc";
1878
+ const strokeHex = elemColors?.stroke ?? "#2563eb";
1879
+ const fontHex = elemColors?.font ?? elemColors?.stroke ?? "#1e40af";
1901
1880
  const colorStyle = `fillColor=${fillHex};strokeColor=${strokeHex};fontColor=${fontHex};`;
1902
1881
  const nodeStyle = node.style;
1903
1882
  const fontSizePx = effectiveStyles.fontSize(nodeStyle?.textSize);
@@ -1906,7 +1885,7 @@ function computeNodeStylePartsAndValue(node, layout, options, viewmodel) {
1906
1885
  const strokeWidth = strokeWidthOverride ?? getDefaultStrokeWidth(borderVal, isContainer);
1907
1886
  const strokeWidthStyle = strokeWidth !== "" ? `strokeWidth=${strokeWidth};` : "";
1908
1887
  const containerDashed = getContainerDashedStyle(isContainer, borderVal);
1909
- const containerOpacityNum = isContainer === true ? nodeStyle?.opacity ?? DEFAULT_CONTAINER_OPACITY : void 0;
1888
+ const containerOpacityNum = isContainer === true ? nodeStyle?.opacity ?? 15 : void 0;
1910
1889
  const fillOpacityStyle = containerOpacityNum != null && isContainer === true ? `fillOpacity=${Math.min(100, Math.max(0, containerOpacityNum))};` : "";
1911
1890
  const likec4StyleWithBridge = buildLikec4StyleForNode({
1912
1891
  desc,
@@ -1971,17 +1950,17 @@ function buildNodeCellXml(data) {
1971
1950
  };
1972
1951
  return {
1973
1952
  vertexXml: cellXml,
1974
- titleCellXml: buildContainerTitleCellXml(data.title ?? "", data.titleCellId ?? data.id, data.navTo, data.id, data.fontFamily, data.containerTitleFontSizePx ?? 12, data.containerTitleColor ?? CONTAINER_TITLE_COLOR),
1953
+ titleCellXml: buildContainerTitleCellXml(data.title ?? "", data.titleCellId ?? data.id, data.navTo, data.id, data.fontFamily, data.containerTitleFontSizePx ?? 12, data.containerTitleColor ?? "#74c0fc"),
1975
1954
  isContainer: true
1976
1955
  };
1977
1956
  }
1978
1957
  /** Build container title cell XML (child of container, relative position CONTAINER_TITLE_INSET_*). */
1979
1958
  function buildContainerTitleCellXml(title, titleId, navTo, containerId, fontFamily, fontSizePx, colorHex) {
1980
1959
  const titleValue = escapeXml(title);
1981
- const titleWidth = Math.max(CONTAINER_TITLE_MIN_WIDTH_PX, Math.min(CONTAINER_TITLE_MAX_WIDTH_PX, title.length * CONTAINER_TITLE_CHAR_WIDTH_PX));
1982
- const titleHeight = CONTAINER_TITLE_HEIGHT_PX;
1983
- const titleX = CONTAINER_TITLE_INSET_X;
1984
- const titleY = CONTAINER_TITLE_INSET_Y;
1960
+ const titleWidth = Math.max(60, Math.min(260, title.length * 8));
1961
+ const titleHeight = 18;
1962
+ const titleX = 8;
1963
+ const titleY = 8;
1985
1964
  const navLinkStyle = buildNavLinkStyle(navTo);
1986
1965
  const titleStyle = `shape=text;html=1;fillColor=none;strokeColor=none;align=left;verticalAlign=top;fontSize=${fontSizePx};fontStyle=1;fontColor=${colorHex};fontFamily=${encodeURIComponent(fontFamily)};${navLinkStyle}`;
1987
1966
  if (navTo === "") return `<mxCell id="${titleId}" value="${titleValue}" style="${titleStyle}" vertex="1" parent="${containerId}">\n <mxGeometry x="${Math.round(titleX)}" y="${Math.round(titleY)}" width="${titleWidth}" height="${titleHeight}" as="geometry" />\n</mxCell>`;
@@ -2043,8 +2022,8 @@ function drawioArrow(arrow) {
2043
2022
  const DEFAULT_BBOX = {
2044
2023
  x: 0,
2045
2024
  y: 0,
2046
- width: DEFAULT_NODE_WIDTH,
2047
- height: DEFAULT_NODE_HEIGHT
2025
+ width: 120,
2026
+ height: 60
2048
2027
  };
2049
2028
  /** True when bbox equals default (unlaid) dimensions. */
2050
2029
  function isDefaultBbox(b) {
@@ -2071,7 +2050,7 @@ function spreadUnlaidNodesOverVertical(bboxes, sortedNodes, containerNodeIds) {
2071
2050
  bboxes.set(node.id, {
2072
2051
  ...firstBbox,
2073
2052
  x: firstBbox.x,
2074
- y: firstBbox.y + i * (firstBbox.height + NODES_SPREAD_GAP)
2053
+ y: firstBbox.y + i * (firstBbox.height + 24)
2075
2054
  });
2076
2055
  });
2077
2056
  }
@@ -2111,15 +2090,15 @@ function computeContentBoundsAndOffsets(bboxes) {
2111
2090
  }
2112
2091
  if (contentMinX === Infinity) contentMinX = 0;
2113
2092
  if (contentMinY === Infinity) contentMinY = 0;
2114
- if (contentMaxX === -Infinity) contentMaxX = contentMinX + DEFAULT_CANVAS_WIDTH;
2115
- if (contentMaxY === -Infinity) contentMaxY = contentMinY + DEFAULT_CANVAS_HEIGHT;
2093
+ if (contentMaxX === -Infinity) contentMaxX = contentMinX + 800;
2094
+ if (contentMaxY === -Infinity) contentMaxY = contentMinY + 600;
2116
2095
  const contentCx = contentMinX + (contentMaxX - contentMinX) / 2;
2117
2096
  const contentCy = contentMinY + (contentMaxY - contentMinY) / 2;
2118
2097
  return {
2119
- offsetX: DEFAULT_CANVAS_WIDTH / 2 - contentCx,
2120
- offsetY: DEFAULT_CANVAS_HEIGHT / 2 - contentCy,
2121
- canvasWidth: DEFAULT_CANVAS_WIDTH,
2122
- canvasHeight: DEFAULT_CANVAS_HEIGHT
2098
+ offsetX: 800 / 2 - contentCx,
2099
+ offsetY: 600 / 2 - contentCy,
2100
+ canvasWidth: 800,
2101
+ canvasHeight: 600
2123
2102
  };
2124
2103
  }
2125
2104
  /**
@@ -2146,8 +2125,8 @@ function computeDiagramLayout(viewmodel, options) {
2146
2125
  return {
2147
2126
  x: typeof d.x === "number" ? d.x : Array.isArray(d.position) ? d.position[0] : 0,
2148
2127
  y: typeof d.y === "number" ? d.y : Array.isArray(d.position) ? d.position[1] : 0,
2149
- width: typeof d.width === "number" ? d.width : d.size?.width ?? DEFAULT_NODE_WIDTH,
2150
- height: typeof d.height === "number" ? d.height : d.size?.height ?? DEFAULT_NODE_HEIGHT
2128
+ width: typeof d.width === "number" ? d.width : d.size?.width ?? 120,
2129
+ height: typeof d.height === "number" ? d.height : d.size?.height ?? 60
2151
2130
  };
2152
2131
  };
2153
2132
  const bboxes = /* @__PURE__ */ new Map();
@@ -2200,7 +2179,7 @@ function generateDiagramContent(viewmodel, options) {
2200
2179
  const getCellId = (nodeId) => {
2201
2180
  let id = nodeIds.get(nodeId);
2202
2181
  if (!id) {
2203
- if (cellId >= CONTAINER_TITLE_CELL_ID_START) throw new Error("DrawIO cell ID range exhausted");
2182
+ if (cellId >= 1e4) throw new Error("DrawIO cell ID range exhausted");
2204
2183
  id = String(cellId++);
2205
2184
  nodeIds.set(nodeId, id);
2206
2185
  }
@@ -2219,7 +2198,7 @@ function generateDiagramContent(viewmodel, options) {
2219
2198
  } else vertexCells.push(result.vertexXml);
2220
2199
  }
2221
2200
  for (const edge of edges) {
2222
- if (cellId >= CONTAINER_TITLE_CELL_ID_START) throw new Error("DrawIO cell ID range exhausted");
2201
+ if (cellId >= 1e4) throw new Error("DrawIO cell ID range exhausted");
2223
2202
  const edgeId = String(cellId++);
2224
2203
  edgeCells.push(buildEdgeCellXml(edge, layout, options, viewmodel, getCellId, edgeId));
2225
2204
  }
@@ -2232,7 +2211,7 @@ function generateDiagramContent(viewmodel, options) {
2232
2211
  ...edgeCells
2233
2212
  ].join("\n");
2234
2213
  const diagramName = (getViewTitle(view) ?? view.id).trim() || view.id;
2235
- const mxGraphModelXml = `<mxGraphModel dx="${MXGRAPH_DEFAULT_DX}" dy="${MXGRAPH_DEFAULT_DY}" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="${MXGRAPH_PAGE_WIDTH}" pageHeight="${MXGRAPH_PAGE_HEIGHT}" math="0" shadow="0">
2214
+ const mxGraphModelXml = `<mxGraphModel dx="800" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="${MXGRAPH_PAGE_HEIGHT}" math="0" shadow="0">
2236
2215
  <root>
2237
2216
  <mxCell id="${rootId}" />
2238
2217
  ${allCells}
@@ -2342,6 +2321,8 @@ function generateDrawioEditUrl(xml) {
2342
2321
  });
2343
2322
  return "https://app.diagrams.net/#create=" + encodeURIComponent(createObj);
2344
2323
  }
2324
+ //#endregion
2325
+ //#region src/mmd/generate-mmd.ts
2345
2326
  const capitalizeFirstLetter$1 = (value) => value.charAt(0).toLocaleUpperCase() + value.slice(1);
2346
2327
  const fqnName$1 = (nodeId) => nodeId.split(".").map(capitalizeFirstLetter$1).join("");
2347
2328
  const nodeName$1 = (node) => {
@@ -2392,6 +2373,8 @@ function generateMermaid(viewmodel) {
2392
2373
  indentation: 2
2393
2374
  }));
2394
2375
  }
2376
+ //#endregion
2377
+ //#region src/model/generate-aux.ts
2395
2378
  function toUnion(elements) {
2396
2379
  if (elements.length === 0) return "never";
2397
2380
  return elements.sort(compareNatural).map((v) => ` | ${JSON.stringify(v)}`).join("\n").trimStart();
@@ -2444,6 +2427,8 @@ export type $Tags = readonly $Aux['Tag'][]
2444
2427
  export type $MetadataKey = $Aux['MetadataKey']
2445
2428
  `.trimStart();
2446
2429
  }
2430
+ //#endregion
2431
+ //#region src/model/generate-likec4-model.ts
2447
2432
  function generateLikeC4Model(model, options = {}) {
2448
2433
  const aux = generateAux(model, options);
2449
2434
  const { useCorePackage = false } = options;
@@ -2467,6 +2452,8 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(${JSON5.stringify(
2467
2452
  /* prettier-ignore-end */
2468
2453
  `.trimStart();
2469
2454
  }
2455
+ //#endregion
2456
+ //#region src/puml/generate-puml.ts
2470
2457
  const capitalizeFirstLetter = (value) => value.charAt(0).toLocaleUpperCase() + value.slice(1);
2471
2458
  const fqnName = (nodeId) => {
2472
2459
  return nodeId.split(/[.-]/).map(capitalizeFirstLetter).join("");
@@ -2562,9 +2549,13 @@ function generatePuml(viewmodel) {
2562
2549
  };
2563
2550
  return toString(new CompositeGeneratorNode().append("@startuml", NL).append(printHeader(), NL).append(printTheme(), NL).append(joinToNode(nodes.filter((n) => n.children.length == 0), (n) => printStereotypes(n), { appendNewLineIfNotEmpty: true })).append(joinToNode(nodes.filter((n) => isNullish(n.parent)), (n) => n.children.length > 0 ? printBoundary(n) : printNode(n), { appendNewLineIfNotEmpty: true })).appendIf(edges.length > 0, NL, joinToNode(edges, (e) => printEdge(e), { appendNewLineIfNotEmpty: true })).append(`@enduml`, NL));
2564
2551
  }
2552
+ //#endregion
2553
+ //#region src/views-data-ts/generateViewId.ts
2565
2554
  function generateViewId(views) {
2566
2555
  return joinToNode(views, (view) => expandToNode`${JSON5.stringify(view.id)}`, { separator: " | " });
2567
2556
  }
2557
+ //#endregion
2558
+ //#region src/views-data-ts/generate-views-data.ts
2568
2559
  /**
2569
2560
  * Generate *.js file with views data
2570
2561
  */
@@ -2687,6 +2678,8 @@ function generateViewsDataDTs(diagrams) {
2687
2678
  `.append(NL);
2688
2679
  return toString(out);
2689
2680
  }
2681
+ //#endregion
2682
+ //#region src/react-next/generate-react-next.ts
2690
2683
  /**
2691
2684
  * @deprecated in favor packages/likec4/src/cli/codegen/react/index.ts
2692
2685
  */
@@ -2790,6 +2783,8 @@ function generateIndex() {
2790
2783
  dts: toString(dts)
2791
2784
  };
2792
2785
  }
2786
+ //#endregion
2787
+ //#region src/react/generate-react-types.ts
2793
2788
  function generateReactTypes(model, options = {}) {
2794
2789
  const { useCorePackage = false } = options;
2795
2790
  invariant$1(!model.isParsed(), "can not generate react types for parsed model");
@@ -2852,4 +2847,5 @@ export {
2852
2847
  /* prettier-ignore-end */
2853
2848
  `.trimStart();
2854
2849
  }
2850
+ //#endregion
2855
2851
  export { DEFAULT_DRAWIO_ALL_FILENAME, buildDrawioExportOptionsForViews, buildDrawioExportOptionsFromSource, decompressDrawioDiagram, generateD2, generateDrawio, generateDrawioEditUrl, generateDrawioMulti, generateLikeC4Model, generateMermaid, generatePuml, generateReactNext, generateReactTypes, generateViewsDataDTs, generateViewsDataJs, generateViewsDataTs, getAllDiagrams, parseDrawioRoundtripComments, parseDrawioToLikeC4, parseDrawioToLikeC4Multi };
@@ -8,7 +8,7 @@ import * as z4 from "zod/v4/core";
8
8
 
9
9
  //#region src/likec4/operators/base.d.ts
10
10
  declare namespace base_d_exports {
11
- export { AnyCtx, AnyOp, Ctx, CtxOp, InferOp, Op, Ops, Output, body, ctxOf, eachOnFresh, eq, executeOnCtx, executeOnFresh, foreach, foreachNewLine, fresh, guard, indent, inlineText, join, lazy, lines, markdown, markdownOrString, materialize, merge, newline, noop, operation, print$1 as print, printProperty, property, select, separateComma, separateNewLine, separateWith, space, spaceBetween, text, when, withctx, zodOp };
11
+ export { AnyCtx, AnyOp, Ctx, CtxOp, InferOp, Op, Ops, Output, body, ctxOf, eachOnFresh, eq, executeOnCtx, executeOnFresh, foreach, foreachNewLine, fresh, guard, indent, inlineText, join, lazy, lines, markdown, markdownOrString, materialize, merge, newline, noop, operation, print, printProperty, property, select, separateComma, separateNewLine, separateWith, space, spaceBetween, text, when, withctx, zodOp };
12
12
  }
13
13
  type Output = CompositeGeneratorNode;
14
14
  /**
@@ -90,9 +90,9 @@ declare function operation<A>(name: string, fn: (input: Ctx<A>) => any): Op<A>;
90
90
  * // Output: #one
91
91
  * ```
92
92
  */
93
- declare function print$1<A extends string | number | boolean>(): Op<A>;
94
- declare function print$1<A>(format: (value: A) => string): Op<A>;
95
- declare function print$1(value: string | number | boolean): InferOp;
93
+ declare function print<A extends string | number | boolean>(): Op<A>;
94
+ declare function print<A>(format: (value: A) => string): Op<A>;
95
+ declare function print(value: string | number | boolean): InferOp;
96
96
  declare const eq: () => InferOp;
97
97
  declare const space: () => InferOp;
98
98
  declare function noop(): <A>(input: A) => A;
@@ -6184,7 +6184,7 @@ declare const schema: z$1.ZodObject<{
6184
6184
  }>>>, z$1.ZodPipe<z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<any, string>>>, z$1.ZodTransform<Record<any, Record<string, any>>, any[]>>]>>;
6185
6185
  }, z$1.core.$strip>;
6186
6186
  declare namespace views_d_exports$1 {
6187
- export { ViewRuleGroupInput, ViewRuleGroupOutput, anyView$1 as anyView, autoLayoutDirection, deploymentView$1 as deploymentView, deploymentViewRule$1 as deploymentViewRule, dynamicStep$1 as dynamicStep, dynamicStepsParallel$1 as dynamicStepsParallel, dynamicStepsSeries$1 as dynamicStepsSeries, dynamicView$1 as dynamicView, dynamicViewIncludeRule$1 as dynamicViewIncludeRule, dynamicViewRule$1 as dynamicViewRule, dynamicViewStep$1 as dynamicViewStep, dynamicViewVariant, elementView$1 as elementView, elementViewRule$1 as elementViewRule, viewRuleAutoLayout$1 as viewRuleAutoLayout, viewRuleExclude, viewRuleGlobalPredicate$1 as viewRuleGlobalPredicate, viewRuleGlobalStyle$1 as viewRuleGlobalStyle, viewRuleGroup$1 as viewRuleGroup, viewRuleInclude, viewRulePredicate$1 as viewRulePredicate, viewRuleRank$1 as viewRuleRank, viewRuleStyle$1 as viewRuleStyle, views$1 as views };
6187
+ export { ViewRuleGroupInput, ViewRuleGroupOutput, anyView$1 as anyView, autoLayoutDirection, deploymentView$1 as deploymentView, deploymentViewRule$1 as deploymentViewRule, deploymentViewRuleIncludeAncestors$1 as deploymentViewRuleIncludeAncestors, dynamicStep$1 as dynamicStep, dynamicStepsParallel$1 as dynamicStepsParallel, dynamicStepsSeries$1 as dynamicStepsSeries, dynamicView$1 as dynamicView, dynamicViewIncludeRule$1 as dynamicViewIncludeRule, dynamicViewRule$1 as dynamicViewRule, dynamicViewStep$1 as dynamicViewStep, dynamicViewVariant, elementView$1 as elementView, elementViewRule$1 as elementViewRule, viewRuleAutoLayout$1 as viewRuleAutoLayout, viewRuleExclude, viewRuleGlobalPredicate$1 as viewRuleGlobalPredicate, viewRuleGlobalStyle$1 as viewRuleGlobalStyle, viewRuleGroup$1 as viewRuleGroup, viewRuleInclude, viewRulePredicate$1 as viewRulePredicate, viewRuleRank$1 as viewRuleRank, viewRuleStyle$1 as viewRuleStyle, views$1 as views };
6188
6188
  }
6189
6189
  declare const autoLayoutDirection: z$1.ZodLiteral<"TB" | "BT" | "LR" | "RL">;
6190
6190
  declare const viewRuleAutoLayout$1: z$1.ZodPipe<z$1.ZodObject<{
@@ -6196,6 +6196,9 @@ declare const viewRuleAutoLayout$1: z$1.ZodPipe<z$1.ZodObject<{
6196
6196
  nodeSep?: number | undefined;
6197
6197
  rankSep?: number | undefined;
6198
6198
  }>>;
6199
+ declare const deploymentViewRuleIncludeAncestors$1: z$1.ZodObject<{
6200
+ includeAncestors: z$1.ZodBoolean;
6201
+ }, z$1.core.$strict>;
6199
6202
  declare const viewRuleInclude: z$1.ZodObject<{
6200
6203
  include: z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodUnion<readonly [z$1.ZodObject<{
6201
6204
  wildcard: z$1.ZodLiteral<true>;
@@ -41987,7 +41990,9 @@ declare const deploymentViewRule$1: z$1.ZodUnion<readonly [z$1.ZodPipe<z$1.ZodUn
41987
41990
  predicateId: z$1.ZodString;
41988
41991
  }, z$1.core.$strip>, z$1.ZodTransform<any, {
41989
41992
  predicateId: string;
41990
- }>>]>;
41993
+ }>>, z$1.ZodObject<{
41994
+ includeAncestors: z$1.ZodBoolean;
41995
+ }, z$1.core.$strict>]>;
41991
41996
  /**
41992
41997
  * Replicates ParsedElementView from the core,
41993
41998
  * less strict, as the generator should be able to handle missing fields and provide defaults.
@@ -50466,7 +50471,9 @@ declare const deploymentView$1: z$1.ZodObject<{
50466
50471
  predicateId: z$1.ZodString;
50467
50472
  }, z$1.core.$strip>, z$1.ZodTransform<any, {
50468
50473
  predicateId: string;
50469
- }>>]>>>>;
50474
+ }>>, z$1.ZodObject<{
50475
+ includeAncestors: z$1.ZodBoolean;
50476
+ }, z$1.core.$strict>]>>>>;
50470
50477
  }, z$1.core.$strip>;
50471
50478
  declare const dynamicStep$1: z$1.ZodPipe<z$1.ZodReadonly<z$1.ZodObject<{
50472
50479
  source: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<any, string>>;
@@ -70577,7 +70584,9 @@ declare const anyView$1: z$1.ZodUnion<readonly [z$1.ZodObject<{
70577
70584
  predicateId: z$1.ZodString;
70578
70585
  }, z$1.core.$strip>, z$1.ZodTransform<any, {
70579
70586
  predicateId: string;
70580
- }>>]>>>>;
70587
+ }>>, z$1.ZodObject<{
70588
+ includeAncestors: z$1.ZodBoolean;
70589
+ }, z$1.core.$strict>]>>>>;
70581
70590
  }, z$1.core.$strip>, z$1.ZodObject<{
70582
70591
  id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<any, string>>;
70583
70592
  _stage: z$1.ZodDefault<z$1.ZodLiteral<"parsed">>;
@@ -88650,7 +88659,9 @@ declare const views$1: z$1.ZodRecord<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform
88650
88659
  predicateId: z$1.ZodString;
88651
88660
  }, z$1.core.$strip>, z$1.ZodTransform<any, {
88652
88661
  predicateId: string;
88653
- }>>]>>>>;
88662
+ }>>, z$1.ZodObject<{
88663
+ includeAncestors: z$1.ZodBoolean;
88664
+ }, z$1.core.$strict>]>>>>;
88654
88665
  }, z$1.core.$strip>, z$1.ZodObject<{
88655
88666
  id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<any, string>>;
88656
88667
  _stage: z$1.ZodDefault<z$1.ZodLiteral<"parsed">>;
@@ -106733,7 +106744,9 @@ declare const schemas: {
106733
106744
  predicateId: z.ZodString;
106734
106745
  }, z.core.$strip>, z.ZodTransform<any, {
106735
106746
  predicateId: string;
106736
- }>>]>>>>;
106747
+ }>>, z.ZodObject<{
106748
+ includeAncestors: z.ZodBoolean;
106749
+ }, z.core.$strict>]>>>>;
106737
106750
  }, z.core.$strip>, z.ZodObject<{
106738
106751
  id: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
106739
106752
  _stage: z.ZodDefault<z.ZodLiteral<"parsed">>;
@@ -142042,6 +142055,8 @@ declare const likec4data: <A extends Readonly<{
142042
142055
  styleId: string;
142043
142056
  } | {
142044
142057
  predicateId: string;
142058
+ } | {
142059
+ includeAncestors: boolean;
142045
142060
  })[] | undefined;
142046
142061
  } | {
142047
142062
  id: string;
@@ -153296,6 +153311,8 @@ declare const likec4data: <A extends Readonly<{
153296
153311
  styleId: string;
153297
153312
  } | {
153298
153313
  predicateId: string;
153314
+ } | {
153315
+ includeAncestors: boolean;
153299
153316
  })[] | undefined;
153300
153317
  } | {
153301
153318
  id: string;
@@ -156957,7 +156974,7 @@ declare const specification: <A extends {
156957
156974
  }> | undefined;
156958
156975
  }>() => Op<A>;
156959
156976
  declare namespace views_d_exports {
156960
- export { anyView, deploymentView, deploymentViewRule, dynamicStep, dynamicStepsParallel, dynamicStepsSeries, dynamicView, dynamicViewIncludeRule, dynamicViewRule, dynamicViewStep, elementView, elementViewRule, viewRuleAutoLayout, viewRuleGlobalPredicate, viewRuleGlobalStyle, viewRuleGroup, viewRulePredicate, viewRuleRank, viewRuleStyle, views };
156977
+ export { anyView, deploymentView, deploymentViewRule, deploymentViewRuleIncludeAncestors, dynamicStep, dynamicStepsParallel, dynamicStepsSeries, dynamicView, dynamicViewIncludeRule, dynamicViewRule, dynamicViewStep, elementView, elementViewRule, viewRuleAutoLayout, viewRuleGlobalPredicate, viewRuleGlobalStyle, viewRuleGroup, viewRulePredicate, viewRuleRank, viewRuleStyle, views };
156961
156978
  }
156962
156979
  declare const viewRulePredicate: <A extends {
156963
156980
  include: ({
@@ -167925,6 +167942,11 @@ declare const viewRuleAutoLayout: <A extends {
167925
167942
  nodeSep?: number | undefined;
167926
167943
  rankSep?: number | undefined;
167927
167944
  }>() => Op<A>;
167945
+ declare const deploymentViewRuleIncludeAncestors: <A extends {
167946
+ includeAncestors: boolean;
167947
+ } = {
167948
+ includeAncestors: boolean;
167949
+ }>() => Op<A>;
167928
167950
  declare const viewRuleRank: <A extends {
167929
167951
  targets: ({
167930
167952
  wildcard: true;
@@ -194572,6 +194594,8 @@ declare const deploymentViewRule: <A extends {
194572
194594
  styleId: string;
194573
194595
  } | {
194574
194596
  predicateId: string;
194597
+ } | {
194598
+ includeAncestors: boolean;
194575
194599
  } = {
194576
194600
  include: ({
194577
194601
  wildcard: true;
@@ -200052,6 +200076,8 @@ declare const deploymentViewRule: <A extends {
200052
200076
  styleId: string;
200053
200077
  } | {
200054
200078
  predicateId: string;
200079
+ } | {
200080
+ includeAncestors: boolean;
200055
200081
  }>() => Op<A>;
200056
200082
  declare const deploymentView: <A extends {
200057
200083
  id: string;
@@ -205092,6 +205118,8 @@ declare const deploymentView: <A extends {
205092
205118
  styleId: string;
205093
205119
  } | {
205094
205120
  predicateId: string;
205121
+ } | {
205122
+ includeAncestors: boolean;
205095
205123
  })[] | undefined;
205096
205124
  } = {
205097
205125
  id: string;
@@ -210132,6 +210160,8 @@ declare const deploymentView: <A extends {
210132
210160
  styleId: string;
210133
210161
  } | {
210134
210162
  predicateId: string;
210163
+ } | {
210164
+ includeAncestors: boolean;
210135
210165
  })[] | undefined;
210136
210166
  }>() => Op<A>;
210137
210167
  declare const dynamicStep: <A extends Readonly<{
@@ -236478,6 +236508,8 @@ declare const anyView: <A extends {
236478
236508
  styleId: string;
236479
236509
  } | {
236480
236510
  predicateId: string;
236511
+ } | {
236512
+ includeAncestors: boolean;
236481
236513
  })[] | undefined;
236482
236514
  } | {
236483
236515
  id: string;
@@ -249160,6 +249192,8 @@ declare const anyView: <A extends {
249160
249192
  styleId: string;
249161
249193
  } | {
249162
249194
  predicateId: string;
249195
+ } | {
249196
+ includeAncestors: boolean;
249163
249197
  })[] | undefined;
249164
249198
  } | {
249165
249199
  id: string;
@@ -261843,6 +261877,8 @@ declare const views: <A extends Record<string, {
261843
261877
  styleId: string;
261844
261878
  } | {
261845
261879
  predicateId: string;
261880
+ } | {
261881
+ includeAncestors: boolean;
261846
261882
  })[] | undefined;
261847
261883
  } | {
261848
261884
  id: string;
@@ -274525,6 +274561,8 @@ declare const views: <A extends Record<string, {
274525
274561
  styleId: string;
274526
274562
  } | {
274527
274563
  predicateId: string;
274564
+ } | {
274565
+ includeAncestors: boolean;
274528
274566
  })[] | undefined;
274529
274567
  } | {
274530
274568
  id: string;
@@ -277119,11 +277157,11 @@ declare function generateLikeC4(input: schemas.likec4data.Input, params?: Params
277119
277157
  /**
277120
277158
  * Prints the result of an operation with the data
277121
277159
  *
277122
- * @see operators
277160
+ * @see ops
277123
277161
  *
277124
277162
  * @example
277125
277163
  * ```ts
277126
- * print(operators.expression, {
277164
+ * printOperation(ops.expression(), {
277127
277165
  * ref: {
277128
277166
  * model: 'some.el',
277129
277167
  * },
@@ -277134,7 +277172,7 @@ declare function generateLikeC4(input: schemas.likec4data.Input, params?: Params
277134
277172
  *
277135
277173
  * @example
277136
277174
  * ```ts
277137
- * print(operators.model, {
277175
+ * printOperation(ops.model(), {
277138
277176
  * elements: [
277139
277177
  * {
277140
277178
  * id: 'cloud',
@@ -277160,10 +277198,12 @@ declare function generateLikeC4(input: schemas.likec4data.Input, params?: Params
277160
277198
  * // }
277161
277199
  * ```
277162
277200
  */
277163
- declare function print<O extends () => AnyOp>(operator: O, data: ctxOf<O>, params?: Params): string;
277201
+ declare function printOperation<Operation extends AnyOp>(operation: Operation): string;
277202
+ declare function printOperation<Operation extends AnyOp>(operation: Operation, data: ctxOf<Operation>, params?: Params): string;
277164
277203
  /**
277165
- * Same as {@link print} but uses tab indentation
277204
+ * Same as {@link printOperation} but uses tab indentation
277166
277205
  */
277167
- declare function printTabIndent<O extends () => AnyOp>(operator: O, data: ctxOf<O>): string;
277206
+ declare function printWithTabIndent<Operation extends AnyOp>(operation: Operation): string;
277207
+ declare function printWithTabIndent<Operation extends AnyOp>(operation: Operation, data: ctxOf<Operation>): string;
277168
277208
  //#endregion
277169
- export { AnyCtx, AnyOp, Ctx, CtxOp, InferOp, Op, Ops, Output, body, ctxOf, eachOnFresh, eq, executeOnCtx, executeOnFresh, foreach, foreachNewLine, fresh, generateLikeC4 as generate, guard, indent, inlineText, join, lazy, lines, markdown, markdownOrString, materialize, merge, newline, noop, operation, index_d_exports as operators, print, printProperty, printTabIndent, property, type schemas, select, separateComma, separateNewLine, separateWith, space, spaceBetween, text, when, withctx, zodOp };
277209
+ export { AnyCtx, AnyOp, Ctx, CtxOp, InferOp, Op, Ops, Output, body, ctxOf, eachOnFresh, eq, executeOnCtx, executeOnFresh, foreach, foreachNewLine, fresh, generateLikeC4 as generate, guard, indent, inlineText, join, lazy, lines, markdown, markdownOrString, materialize, merge, newline, noop, operation, index_d_exports as ops, print, printOperation, printProperty, printWithTabIndent, property, type schemas, select, separateComma, separateNewLine, separateWith, space, spaceBetween, text, when, withctx, zodOp };