@likec4/generators 1.32.2 → 1.33.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,6 @@
1
+ import {
2
+ RichText
3
+ } from "@likec4/core/types";
1
4
  import { CompositeGeneratorNode, joinToNode, NL, toString } from "langium/generate";
2
5
  import { isNullish as isNil } from "remeda";
3
6
  const capitalizeFirstLetter = (value) => value.charAt(0).toLocaleUpperCase() + value.slice(1);
@@ -113,7 +116,8 @@ export function generatePuml(viewmodel) {
113
116
  const label = escapeLabel(node.title) || nodeName(node);
114
117
  const tech = escapeLabel(node.technology);
115
118
  names.set(node.id, fqn);
116
- return new CompositeGeneratorNode().append(shape, " ").append('"').append("==", label).appendIf(!!tech, "\\n", "<size:10>[", tech, "]</size>").appendIf(!!node.description, "\\n\\n", escapeLabel(node.description)).append('"', " <<", fqn, ">> ", "as ", fqn, NL);
119
+ const description = RichText.from(node.description);
120
+ return new CompositeGeneratorNode().append(shape, " ").append('"').append("==", label).appendIf(!!tech, "\\n", "<size:10>[", tech, "]</size>").appendIf(description.nonEmpty, "\\n\\n", escapeLabel(description.text)).append('"', " <<", fqn, ">> ", "as ", fqn, NL);
117
121
  };
118
122
  const printBoundary = (node) => {
119
123
  const label = escapeLabel(node.title) || nodeName(node);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/generators",
3
- "version": "1.32.2",
3
+ "version": "1.33.0",
4
4
  "license": "MIT",
5
5
  "bugs": "https://github.com/likec4/likec4/issues",
6
6
  "homepage": "https://likec4.dev",
@@ -33,15 +33,15 @@
33
33
  "dependencies": {
34
34
  "json5": "^2.2.3",
35
35
  "langium": "3.5.0",
36
- "remeda": "^2.23.0",
37
- "@likec4/core": "1.32.2"
36
+ "remeda": "^2.23.1",
37
+ "@likec4/core": "1.33.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/node": "~20.19.0",
40
+ "@types/node": "~20.19.1",
41
41
  "typescript": "5.8.3",
42
42
  "unbuild": "3.5.0",
43
- "vitest": "3.2.3",
44
- "@likec4/tsconfig": "1.32.2"
43
+ "vitest": "3.2.4",
44
+ "@likec4/tsconfig": "1.33.0"
45
45
  },
46
46
  "scripts": {
47
47
  "typecheck": "tsc -b --verbose",
@@ -130,7 +130,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
130
130
  id: 'customer',
131
131
  kind: 'person',
132
132
  title: 'customer',
133
- description: null,
134
133
  technology: null,
135
134
  tags: [],
136
135
  color: 'primary',
@@ -142,7 +141,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
142
141
  id: 'cloud',
143
142
  kind: 'system',
144
143
  title: 'cloud',
145
- description: null,
146
144
  technology: null,
147
145
  tags: [],
148
146
  color: 'primary',
@@ -154,7 +152,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
154
152
  id: 'cloud.frontend',
155
153
  kind: 'component',
156
154
  title: 'frontend',
157
- description: null,
158
155
  technology: null,
159
156
  tags: [],
160
157
  color: 'primary',
@@ -166,7 +163,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
166
163
  id: 'cloud.frontend.dashboard',
167
164
  kind: 'webapp',
168
165
  title: 'dashboard',
169
- description: null,
170
166
  technology: null,
171
167
  tags: [],
172
168
  color: 'primary',
@@ -178,7 +174,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
178
174
  id: 'cloud.frontend.mobile',
179
175
  kind: 'mobile',
180
176
  title: 'mobile',
181
- description: null,
182
177
  technology: null,
183
178
  tags: [],
184
179
  color: 'primary',
@@ -190,7 +185,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
190
185
  id: 'cloud.auth',
191
186
  kind: 'component',
192
187
  title: 'auth',
193
- description: null,
194
188
  technology: null,
195
189
  tags: [],
196
190
  color: 'primary',
@@ -202,7 +196,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
202
196
  id: 'cloud.backend',
203
197
  kind: 'component',
204
198
  title: 'backend',
205
- description: null,
206
199
  technology: null,
207
200
  tags: [
208
201
  'external',
@@ -219,7 +212,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
219
212
  id: 'cloud.backend.api',
220
213
  kind: 'component',
221
214
  title: 'api',
222
- description: null,
223
215
  technology: null,
224
216
  tags: [],
225
217
  color: 'primary',
@@ -231,7 +223,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
231
223
  id: 'cloud.backend.graphql',
232
224
  kind: 'component',
233
225
  title: 'graphql',
234
- description: null,
235
226
  technology: null,
236
227
  tags: [],
237
228
  color: 'primary',
@@ -243,7 +234,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
243
234
  id: 'cloud.media',
244
235
  kind: 'component',
245
236
  title: 'media',
246
- description: null,
247
237
  technology: null,
248
238
  tags: [
249
239
  'internal',
@@ -257,7 +247,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
257
247
  id: 'aws',
258
248
  kind: 'system',
259
249
  title: 'aws',
260
- description: null,
261
250
  technology: null,
262
251
  tags: [],
263
252
  color: 'primary',
@@ -269,7 +258,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
269
258
  id: 'aws.rds',
270
259
  kind: 'component',
271
260
  title: 'rds',
272
- description: null,
273
261
  technology: null,
274
262
  tags: [],
275
263
  color: 'primary',
@@ -281,7 +269,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
281
269
  id: 'aws.s3',
282
270
  kind: 'component',
283
271
  title: 's3',
284
- description: null,
285
272
  technology: null,
286
273
  tags: [],
287
274
  color: 'primary',
@@ -296,7 +283,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
296
283
  id: 'email',
297
284
  kind: 'system',
298
285
  title: 'email',
299
- description: null,
300
286
  technology: null,
301
287
  tags: [],
302
288
  color: 'primary',
@@ -474,7 +460,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
474
460
  id: 'customer',
475
461
  kind: 'node',
476
462
  title: 'customer',
477
- description: null,
478
463
  technology: null,
479
464
  tags: null,
480
465
  style: {
@@ -490,7 +475,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
490
475
  id: 'prod',
491
476
  kind: 'env',
492
477
  title: 'prod',
493
- description: null,
494
478
  technology: null,
495
479
  tags: null,
496
480
  style: {
@@ -502,7 +486,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
502
486
  id: 'prod.eu',
503
487
  kind: 'zone',
504
488
  title: 'eu',
505
- description: null,
506
489
  technology: null,
507
490
  tags: null,
508
491
  style: {
@@ -514,7 +497,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
514
497
  id: 'prod.eu.zone1',
515
498
  kind: 'zone',
516
499
  title: 'zone1',
517
- description: null,
518
500
  technology: null,
519
501
  tags: null,
520
502
  style: {
@@ -534,7 +516,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
534
516
  id: 'prod.eu.zone2',
535
517
  kind: 'zone',
536
518
  title: 'zone2',
537
- description: null,
538
519
  technology: null,
539
520
  tags: null,
540
521
  style: {
@@ -562,7 +543,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
562
543
  id: 'prod.us',
563
544
  kind: 'zone',
564
545
  title: 'us',
565
- description: null,
566
546
  technology: null,
567
547
  tags: null,
568
548
  style: {
@@ -601,7 +581,7 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
601
581
  autoLayout: {
602
582
  direction: 'TB',
603
583
  },
604
- hash: 'e83b636f6de8d6dc7fdb745349a384f8ebfad639',
584
+ hash: '35b5fd7db6a023b41072785020176c78dbe60fb0',
605
585
  edges: [
606
586
  {
607
587
  id: 'customer:cloud',
@@ -752,7 +732,7 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
752
732
  autoLayout: {
753
733
  direction: 'TB',
754
734
  },
755
- hash: '1a523d612d8c2ad78909f943d5abe155f185391a',
735
+ hash: '9f1ba774789e0a91843241f8a2e506f36012888c',
756
736
  edges: [
757
737
  {
758
738
  id: 'cloud.backend:cloud.auth',
@@ -1077,7 +1057,7 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ComputedLikeC4Mod
1077
1057
  autoLayout: {
1078
1058
  direction: 'TB',
1079
1059
  },
1080
- hash: '162fafc65660c3ffa0b88d2d4c5996b159aca805',
1060
+ hash: '44b32e42b6308fedcb2dbcc0f2b6c84276a3580b',
1081
1061
  edges: [
1082
1062
  {
1083
1063
  id: 'customer.instance:prod.eu.zone1.ui',
@@ -130,7 +130,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
130
130
  id: 'customer',
131
131
  kind: 'person',
132
132
  title: 'customer',
133
- description: null,
134
133
  technology: null,
135
134
  tags: [],
136
135
  color: 'primary',
@@ -142,7 +141,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
142
141
  id: 'cloud',
143
142
  kind: 'system',
144
143
  title: 'cloud',
145
- description: null,
146
144
  technology: null,
147
145
  tags: [],
148
146
  color: 'primary',
@@ -154,7 +152,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
154
152
  id: 'cloud.frontend',
155
153
  kind: 'component',
156
154
  title: 'frontend',
157
- description: null,
158
155
  technology: null,
159
156
  tags: [],
160
157
  color: 'primary',
@@ -166,7 +163,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
166
163
  id: 'cloud.frontend.dashboard',
167
164
  kind: 'webapp',
168
165
  title: 'dashboard',
169
- description: null,
170
166
  technology: null,
171
167
  tags: [],
172
168
  color: 'primary',
@@ -178,7 +174,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
178
174
  id: 'cloud.frontend.mobile',
179
175
  kind: 'mobile',
180
176
  title: 'mobile',
181
- description: null,
182
177
  technology: null,
183
178
  tags: [],
184
179
  color: 'primary',
@@ -190,7 +185,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
190
185
  id: 'cloud.auth',
191
186
  kind: 'component',
192
187
  title: 'auth',
193
- description: null,
194
188
  technology: null,
195
189
  tags: [],
196
190
  color: 'primary',
@@ -202,7 +196,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
202
196
  id: 'cloud.backend',
203
197
  kind: 'component',
204
198
  title: 'backend',
205
- description: null,
206
199
  technology: null,
207
200
  tags: [
208
201
  'external',
@@ -219,7 +212,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
219
212
  id: 'cloud.backend.api',
220
213
  kind: 'component',
221
214
  title: 'api',
222
- description: null,
223
215
  technology: null,
224
216
  tags: [],
225
217
  color: 'primary',
@@ -231,7 +223,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
231
223
  id: 'cloud.backend.graphql',
232
224
  kind: 'component',
233
225
  title: 'graphql',
234
- description: null,
235
226
  technology: null,
236
227
  tags: [],
237
228
  color: 'primary',
@@ -243,7 +234,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
243
234
  id: 'cloud.media',
244
235
  kind: 'component',
245
236
  title: 'media',
246
- description: null,
247
237
  technology: null,
248
238
  tags: [
249
239
  'internal',
@@ -257,7 +247,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
257
247
  id: 'aws',
258
248
  kind: 'system',
259
249
  title: 'aws',
260
- description: null,
261
250
  technology: null,
262
251
  tags: [],
263
252
  color: 'primary',
@@ -269,7 +258,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
269
258
  id: 'aws.rds',
270
259
  kind: 'component',
271
260
  title: 'rds',
272
- description: null,
273
261
  technology: null,
274
262
  tags: [],
275
263
  color: 'primary',
@@ -281,7 +269,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
281
269
  id: 'aws.s3',
282
270
  kind: 'component',
283
271
  title: 's3',
284
- description: null,
285
272
  technology: null,
286
273
  tags: [],
287
274
  color: 'primary',
@@ -296,7 +283,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
296
283
  id: 'email',
297
284
  kind: 'system',
298
285
  title: 'email',
299
- description: null,
300
286
  technology: null,
301
287
  tags: [],
302
288
  color: 'primary',
@@ -474,7 +460,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
474
460
  id: 'customer',
475
461
  kind: 'node',
476
462
  title: 'customer',
477
- description: null,
478
463
  technology: null,
479
464
  tags: null,
480
465
  style: {
@@ -490,7 +475,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
490
475
  id: 'prod',
491
476
  kind: 'env',
492
477
  title: 'prod',
493
- description: null,
494
478
  technology: null,
495
479
  tags: null,
496
480
  style: {
@@ -502,7 +486,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
502
486
  id: 'prod.eu',
503
487
  kind: 'zone',
504
488
  title: 'eu',
505
- description: null,
506
489
  technology: null,
507
490
  tags: null,
508
491
  style: {
@@ -514,7 +497,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
514
497
  id: 'prod.eu.zone1',
515
498
  kind: 'zone',
516
499
  title: 'zone1',
517
- description: null,
518
500
  technology: null,
519
501
  tags: null,
520
502
  style: {
@@ -534,7 +516,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
534
516
  id: 'prod.eu.zone2',
535
517
  kind: 'zone',
536
518
  title: 'zone2',
537
- description: null,
538
519
  technology: null,
539
520
  tags: null,
540
521
  style: {
@@ -562,7 +543,6 @@ export const likec4model: LikeC4Model<$Aux> = new LikeC4Model(<ParsedLikeC4Model
562
543
  id: 'prod.us',
563
544
  kind: 'zone',
564
545
  title: 'us',
565
- description: null,
566
546
  technology: null,
567
547
  tags: null,
568
548
  style: {
@@ -1,13 +1,14 @@
1
1
  import type { aux, LikeC4ViewModel } from '@likec4/core/model'
2
- import type {
3
- ComputedEdge,
4
- ComputedNode,
5
- ElementThemeColorValues,
6
- KeysOf,
7
- NodeId,
8
- ProcessedView,
9
- RelationshipThemeColorValues,
10
- ThemeColorValues,
2
+ import {
3
+ type ComputedEdge,
4
+ type ComputedNode,
5
+ type ElementThemeColorValues,
6
+ type KeysOf,
7
+ type NodeId,
8
+ type ProcessedView,
9
+ type RelationshipThemeColorValues,
10
+ type ThemeColorValues,
11
+ RichText,
11
12
  } from '@likec4/core/types'
12
13
  import { CompositeGeneratorNode, joinToNode, NL, toString } from 'langium/generate'
13
14
  import { isNullish as isNil } from 'remeda'
@@ -167,12 +168,14 @@ export function generatePuml(viewmodel: LikeC4ViewModel<aux.Unknown>) {
167
168
  const tech = escapeLabel(node.technology)
168
169
  names.set(node.id, fqn)
169
170
 
171
+ const description = RichText.from(node.description)
172
+
170
173
  return new CompositeGeneratorNode()
171
174
  .append(shape, ' ')
172
175
  .append('"')
173
176
  .append('==', label)
174
177
  .appendIf(!!tech, '\\n', '<size:10>[', tech!, ']</size>')
175
- .appendIf(!!node.description, '\\n\\n', escapeLabel(node.description)!)
178
+ .appendIf(description.nonEmpty, '\\n\\n', escapeLabel(description.text)!)
176
179
  .append('"', ' <<', fqn, '>> ', 'as ', fqn, NL)
177
180
  }
178
181