@likec4/generators 1.53.0 → 1.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -2
- package/dist/index.mjs +9 -5
- package/dist/likec4/index.d.mts +35778 -35778
- package/dist/likec4/index.mjs +0 -1
- package/package.json +9 -9
- package/src/drawio/generate-drawio.ts +5 -5
- package/src/drawio/parse-drawio.ts +4 -0
- package/src/likec4/schemas/likec4data.ts +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -45,7 +45,7 @@ type GenerateDrawioOptions = {
|
|
|
45
45
|
* Generate a single DrawIO file from one view.
|
|
46
46
|
*
|
|
47
47
|
* @param viewmodel - Layouted LikeC4 view model (from model.view(id))
|
|
48
|
-
* @param options - Optional overrides for layout/colors (round-trip from comment blocks)
|
|
48
|
+
* @param options - Optional overrides for layout/colors (round-trip from comment blocks); profile `leanix` adds bridge-managed metadata for LeanIX (see GenerateDrawioOptions).
|
|
49
49
|
* @returns DrawIO .drawio XML string
|
|
50
50
|
*/
|
|
51
51
|
declare function generateDrawio(viewmodel: DrawioViewModelLike, options?: GenerateDrawioOptions): string;
|
|
@@ -55,7 +55,7 @@ declare function generateDrawio(viewmodel: DrawioViewModelLike, options?: Genera
|
|
|
55
55
|
* so all views open in one file with one tab per view.
|
|
56
56
|
*
|
|
57
57
|
* @param viewmodels - Layouted view models (e.g. from model.views())
|
|
58
|
-
* @param optionsByViewId - Optional per-view options (
|
|
58
|
+
* @param optionsByViewId - Optional per-view options (layout, compressed, profile leanix, etc.)
|
|
59
59
|
* @param modified - Optional ISO timestamp for mxfile modified attribute (for deterministic output)
|
|
60
60
|
* @returns DrawIO .drawio XML string with multiple <diagram> elements
|
|
61
61
|
*/
|
|
@@ -115,6 +115,8 @@ declare function getAllDiagrams(fullXml: string): DiagramInfo[];
|
|
|
115
115
|
/**
|
|
116
116
|
* Convert DrawIO XML to LikeC4 source (.c4) string.
|
|
117
117
|
* Vertices → model elements (actor/container); edges → relations (->). Uses first diagram only.
|
|
118
|
+
* Preserves likec4Id / likec4RelationId from leanix-profile exports when present on cells.
|
|
119
|
+
*
|
|
118
120
|
* @param xml - Full .drawio mxfile XML (single or multi-tab).
|
|
119
121
|
* @returns LikeC4 .c4 source string (model + views + round-trip comments).
|
|
120
122
|
*/
|
|
@@ -122,6 +124,8 @@ declare function parseDrawioToLikeC4(xml: string): string;
|
|
|
122
124
|
/**
|
|
123
125
|
* Convert DrawIO XML to LikeC4 source when file has multiple diagrams (tabs).
|
|
124
126
|
* Merges elements by FQN and relations by (source, target); one view per diagram.
|
|
127
|
+
* Same leanix bridge style fields as parseDrawioToLikeC4 when present.
|
|
128
|
+
*
|
|
125
129
|
* @param xml - Full .drawio mxfile XML with multiple <diagram> elements.
|
|
126
130
|
* @returns LikeC4 .c4 source string (model + views + round-trip comments).
|
|
127
131
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1221,6 +1221,8 @@ function emitLikeC4SourceFromSingleState(state) {
|
|
|
1221
1221
|
/**
|
|
1222
1222
|
* Convert DrawIO XML to LikeC4 source (.c4) string.
|
|
1223
1223
|
* Vertices → model elements (actor/container); edges → relations (->). Uses first diagram only.
|
|
1224
|
+
* Preserves likec4Id / likec4RelationId from leanix-profile exports when present on cells.
|
|
1225
|
+
*
|
|
1224
1226
|
* @param xml - Full .drawio mxfile XML (single or multi-tab).
|
|
1225
1227
|
* @returns LikeC4 .c4 source string (model + views + round-trip comments).
|
|
1226
1228
|
*/
|
|
@@ -1348,6 +1350,8 @@ function emitMultiDiagramModel(lines, merged, rootsFromMap, rootFqns) {
|
|
|
1348
1350
|
/**
|
|
1349
1351
|
* Convert DrawIO XML to LikeC4 source when file has multiple diagrams (tabs).
|
|
1350
1352
|
* Merges elements by FQN and relations by (source, target); one view per diagram.
|
|
1353
|
+
* Same leanix bridge style fields as parseDrawioToLikeC4 when present.
|
|
1354
|
+
*
|
|
1351
1355
|
* @param xml - Full .drawio mxfile XML with multiple <diagram> elements.
|
|
1352
1356
|
* @returns LikeC4 .c4 source string (model + views + round-trip comments).
|
|
1353
1357
|
*/
|
|
@@ -1762,7 +1766,7 @@ function buildLikec4StyleForNode(params) {
|
|
|
1762
1766
|
pushStylePart(parts, "likec4Notation", params.nodeNotation ?? void 0);
|
|
1763
1767
|
return parts.length > 0 ? parts.join(";") + ";" : "";
|
|
1764
1768
|
}
|
|
1765
|
-
/** Bridge-managed style
|
|
1769
|
+
/** Bridge-managed style for leanix profile (vertex): likec4Id, likec4Kind, likec4ViewId, projectId, leanixFactSheetType. */
|
|
1766
1770
|
function buildBridgeManagedStyleForNode(nodeId, nodeKind, viewId, options) {
|
|
1767
1771
|
if (options?.profile !== "leanix") return "";
|
|
1768
1772
|
const parts = [
|
|
@@ -1776,7 +1780,7 @@ function buildBridgeManagedStyleForNode(nodeId, nodeKind, viewId, options) {
|
|
|
1776
1780
|
if (factSheetType != null && factSheetType !== "") parts.push(`leanixFactSheetType=${encodeURIComponent(factSheetType)}`);
|
|
1777
1781
|
return parts.join(";") + ";";
|
|
1778
1782
|
}
|
|
1779
|
-
/** Bridge-managed style
|
|
1783
|
+
/** Bridge-managed style for leanix profile (edge): likec4RelationId, bridgeManaged. */
|
|
1780
1784
|
function buildBridgeManagedStyleForEdge(relationId, options) {
|
|
1781
1785
|
if (options?.profile !== "leanix") return "";
|
|
1782
1786
|
return `bridgeManaged=true;likec4RelationId=${encodeURIComponent(relationId)};`;
|
|
@@ -1996,7 +2000,7 @@ function getViewDescriptionString(view) {
|
|
|
1996
2000
|
if (typeof raw === "string") return raw;
|
|
1997
2001
|
return "";
|
|
1998
2002
|
}
|
|
1999
|
-
/**
|
|
2003
|
+
/** Root-cell style tokens for leanix profile (bridgeManaged, likec4ViewId, likec4ProjectId). */
|
|
2000
2004
|
function getLeanixRootStyleParts(view, options) {
|
|
2001
2005
|
const parts = ["bridgeManaged=true;", `likec4ViewId=${encodeURIComponent(view.id)};`];
|
|
2002
2006
|
if (options.projectId != null && options.projectId !== "") parts.push(`likec4ProjectId=${encodeURIComponent(options.projectId)};`);
|
|
@@ -2258,7 +2262,7 @@ ${diagrams.map((d) => ` <diagram name="${escapeXml(d.name)}" id="${DRAWIO_DIAGR
|
|
|
2258
2262
|
* Generate a single DrawIO file from one view.
|
|
2259
2263
|
*
|
|
2260
2264
|
* @param viewmodel - Layouted LikeC4 view model (from model.view(id))
|
|
2261
|
-
* @param options - Optional overrides for layout/colors (round-trip from comment blocks)
|
|
2265
|
+
* @param options - Optional overrides for layout/colors (round-trip from comment blocks); profile `leanix` adds bridge-managed metadata for LeanIX (see GenerateDrawioOptions).
|
|
2262
2266
|
* @returns DrawIO .drawio XML string
|
|
2263
2267
|
*/
|
|
2264
2268
|
function generateDrawio(viewmodel, options) {
|
|
@@ -2270,7 +2274,7 @@ function generateDrawio(viewmodel, options) {
|
|
|
2270
2274
|
* so all views open in one file with one tab per view.
|
|
2271
2275
|
*
|
|
2272
2276
|
* @param viewmodels - Layouted view models (e.g. from model.views())
|
|
2273
|
-
* @param optionsByViewId - Optional per-view options (
|
|
2277
|
+
* @param optionsByViewId - Optional per-view options (layout, compressed, profile leanix, etc.)
|
|
2274
2278
|
* @param modified - Optional ISO timestamp for mxfile modified attribute (for deterministic output)
|
|
2275
2279
|
* @returns DrawIO .drawio XML string with multiple <diagram> elements
|
|
2276
2280
|
*/
|