@likec4/core 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.
Files changed (96) hide show
  1. package/dist/builder/index.d.mts +6 -4
  2. package/dist/builder/index.mjs +45 -13
  3. package/dist/compute-view/index.d.mts +6 -4
  4. package/dist/compute-view/index.mjs +33 -10
  5. package/dist/compute-view/relationships-view/index.d.mts +6 -4
  6. package/dist/compute-view/relationships-view/index.mjs +6 -3
  7. package/dist/index.d.mts +9 -138
  8. package/dist/index.mjs +31 -3712
  9. package/dist/model/connection/deployment/index.d.mts +10 -0
  10. package/dist/model/connection/deployment/index.mjs +18 -0
  11. package/dist/model/connection/index.d.mts +70 -0
  12. package/dist/model/connection/index.mjs +23 -0
  13. package/dist/model/connection/model/index.d.mts +10 -0
  14. package/dist/model/connection/model/index.mjs +11 -0
  15. package/dist/model/index.d.mts +14 -256
  16. package/dist/model/index.mjs +27 -5
  17. package/dist/shared/{core.Bdz6fBF1.d.mts → core.1pNeDdRk.d.mts} +92 -81
  18. package/dist/shared/{core.BuO4ncfY.d.mts → core.668kXpZq.d.mts} +42 -52
  19. package/dist/shared/core.8KM0D6va.mjs +33 -0
  20. package/dist/shared/core.B0oEIXqd.mjs +47 -0
  21. package/dist/shared/core.BH9nN-_I.mjs +22 -0
  22. package/dist/shared/core.BMCb0wJI.mjs +177 -0
  23. package/dist/shared/core.BTnf14gD.mjs +331 -0
  24. package/dist/shared/core.BgvIuGGU.mjs +3 -0
  25. package/dist/shared/core.BoyJPEen.mjs +21 -0
  26. package/dist/shared/{core.CUYDgv2-.mjs → core.Br7Fab9l.mjs} +12 -15
  27. package/dist/shared/{core.BrCnZFTn.mjs → core.Btl47GOn.mjs} +3 -3
  28. package/dist/shared/core.ByrmCl9I.mjs +5 -0
  29. package/dist/shared/core.C80Z37Eu.mjs +29 -0
  30. package/dist/shared/{core.Pf5I9o0e.d.mts → core.CF82MWyh.d.mts} +1 -1
  31. package/dist/shared/{core.rmvsy0n3.mjs → core.C_C-3c1S.mjs} +5 -198
  32. package/dist/shared/core.CeQbbp7K.d.mts +41 -0
  33. package/dist/shared/{core.DoK86JEe.mjs → core.CpwrZi3D.mjs} +2 -73
  34. package/dist/shared/{core.CpXlRyE5.mjs → core.CtKXPqN_.mjs} +5 -36
  35. package/dist/shared/core.CxGKeL-L.mjs +144 -0
  36. package/dist/shared/core.CzdwsPmY.d.mts +69 -0
  37. package/dist/shared/{core.Cy9smucx.mjs → core.D4npX2q8.mjs} +1 -3
  38. package/dist/shared/core.D56nCp7e.mjs +168 -0
  39. package/dist/shared/core.D5qVzkws.mjs +724 -0
  40. package/dist/shared/core.DDAPzd3T.d.mts +87 -0
  41. package/dist/shared/{core.CBpKAlhj.mjs → core.DDynPqbh.mjs} +96 -56
  42. package/dist/shared/{core.Bk7wEZFG.mjs → core.DXRAwwDB.mjs} +3 -2
  43. package/dist/shared/core.DcS-0zys.mjs +10 -0
  44. package/dist/shared/{core.CBxTtXMi.d.mts → core.De___iBS.d.mts} +3 -2
  45. package/dist/shared/core.DsMrjY2q.mjs +34 -0
  46. package/dist/shared/core.DuSLYTG6.d.mts +57 -0
  47. package/dist/shared/core.Dy-F3xRP.d.mts +83 -0
  48. package/dist/shared/{core.DaAyklhe.d.mts → core.OLInHaJx.d.mts} +30 -22
  49. package/dist/shared/core.XptQjhMA.mjs +1295 -0
  50. package/dist/shared/{core.cbA9VZ02.mjs → core.hoq9W4rW.mjs} +28 -1073
  51. package/dist/shared/core.zLlww-07.mjs +3 -0
  52. package/dist/theme/index.d.mts +134 -0
  53. package/dist/theme/index.mjs +3709 -0
  54. package/dist/types/aux.d.mts +3 -2
  55. package/dist/types/index.d.mts +9 -5
  56. package/dist/types/index.mjs +17 -146
  57. package/dist/utils/index.d.mts +15 -100
  58. package/dist/utils/index.mjs +25 -1315
  59. package/dist/utils/iterable/index.d.mts +100 -0
  60. package/dist/utils/iterable/index.mjs +24 -0
  61. package/package.json +23 -7
  62. package/src/builder/Builder.ts +13 -4
  63. package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +0 -13
  64. package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +2 -6
  65. package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +0 -7
  66. package/src/compute-view/deployment-view/__test__/fixture.ts +15 -5
  67. package/src/compute-view/deployment-view/utils.ts +13 -13
  68. package/src/compute-view/dynamic-view/compute.ts +2 -1
  69. package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +2 -2
  70. package/src/compute-view/relationships-view/layout.ts +1 -1
  71. package/src/compute-view/utils/applyCustomElementProperties.ts +8 -0
  72. package/src/compute-view/utils/applyCustomRelationProperties.ts +2 -0
  73. package/src/compute-view/utils/buildComputedNodes.ts +4 -3
  74. package/src/compute-view/utils/merge-props-from-relationships.ts +6 -5
  75. package/src/compute-view/utils/view-hash.ts +24 -3
  76. package/src/model/DeploymentElementModel.ts +20 -16
  77. package/src/model/ElementModel.ts +9 -3
  78. package/src/model/RelationModel.ts +19 -16
  79. package/src/model/index.ts +2 -0
  80. package/src/model/types.ts +1 -0
  81. package/src/model/view/EdgeModel.ts +4 -3
  82. package/src/model/view/LikeC4ViewModel.ts +5 -0
  83. package/src/model/view/NodeModel.ts +4 -2
  84. package/src/theme/index.ts +12 -5
  85. package/src/types/RichText.ts +200 -0
  86. package/src/types/index.ts +2 -0
  87. package/src/types/model-deployment.ts +4 -3
  88. package/src/types/model-logical.ts +3 -3
  89. package/src/types/scalar.ts +47 -2
  90. package/src/types/view-common.ts +1 -1
  91. package/src/types/view-computed.ts +2 -4
  92. package/src/types/view-layouted.ts +9 -0
  93. package/src/utils/index.ts +4 -9
  94. package/src/utils/markdown/index.ts +2 -0
  95. package/src/utils/markdown/to-html.ts +32 -0
  96. package/src/utils/markdown/to-text.ts +14 -0
@@ -0,0 +1,100 @@
1
+ import { I as IteratorLike } from '../../shared/core.DuSLYTG6.mjs';
2
+ import 'type-fest';
3
+
4
+ declare function isIterable<T, I extends Iterable<T>>(something: I | unknown): something is Iterable<T>;
5
+
6
+ /**
7
+ * Filters an iterable based on a predicate.
8
+ * Composabel first version of `ifilter`.
9
+ * @signature
10
+ * ifilter(predicate)(data)
11
+ */
12
+ declare function ifilter<T, S extends T>(predicate: (v: T) => v is S): (iterable: Iterable<T>) => IteratorLike<S>;
13
+ declare function ifilter<T>(predicate: (v: T) => boolean): (iterable: Iterable<T>) => IteratorLike<T>;
14
+ /**
15
+ * Filters an iterable based on a predicate.
16
+ * Data first version of `ifilter`.
17
+ * @signature
18
+ * ifilter(data, predicate)
19
+ * @example
20
+ * ifilter(new Set([1, 2, 3]), x => x % 2 === 1) // => Iterable<[1, 3]>
21
+ */
22
+ declare function ifilter<T, S extends T>(iterable: Iterable<T>, predicate: (v: T) => v is S): IteratorLike<S>;
23
+ declare function ifilter<T>(iterable: Iterable<T>, predicate: (v: T) => boolean): IteratorLike<T>;
24
+
25
+ /**
26
+ * Finds the first element in the iterable that satisfies the predicate.
27
+ * Composable first version of `find`.
28
+ * @signature
29
+ * ifind(predicate)(data)
30
+ */
31
+ declare function ifind<T, S extends T>(predicate: (item: T) => item is S): (iterable: Iterable<T>) => S | undefined;
32
+ declare function ifind<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => T | undefined;
33
+ /**
34
+ * Finds the first element in the iterable that satisfies the predicate.
35
+ * Data first version of `find`.
36
+ * @signature
37
+ * ifind(data, predicate)
38
+ */
39
+ declare function ifind<T, S extends T>(iterable: Iterable<T>, predicate: (item: T) => item is S): S | undefined;
40
+ declare function ifind<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): T | undefined;
41
+
42
+ declare function iflat(): <T>(iterable: Iterable<IteratorLike<T>>) => IteratorLike<T>;
43
+ declare function iflat<T>(iterable: Iterable<IteratorLike<T>>): IteratorLike<T>;
44
+
45
+ declare function ihead<T>(): (iterable: Iterable<T>) => T | undefined;
46
+ /**
47
+ * Finds the first element in the iterable that satisfies the predicate.
48
+ * Data first version of `find`.
49
+ * @signature
50
+ * ifind(data, predicate)
51
+ */
52
+ declare function ihead<T>(iterable: Iterable<T>): T | undefined;
53
+
54
+ type MapFunction<T, S> = (item: T) => S;
55
+ /**
56
+ * Maps an iterable using a mapper function.
57
+ * Composable first version of `imap`.
58
+ * @signature
59
+ * imap(mapper)(data)
60
+ */
61
+ declare function imap<T, S>(mapper: MapFunction<T, S>): (iterable: Iterable<T>) => IteratorLike<S>;
62
+ /**
63
+ * Maps an iterable using a mapper function.
64
+ * Data first version of `imap`.
65
+ * @signature
66
+ * imap(data, mapper)
67
+ */
68
+ declare function imap<T, S>(iterable: Iterable<T>, mapper: MapFunction<T, S>): IteratorLike<S>;
69
+
70
+ declare function ireduce<T, R>(reducer: (acc: R, item: T) => R, initialValue: R): (iterable: Iterable<T>) => R;
71
+ declare function ireduce<T, R>(iterable: Iterable<T>, reducer: (acc: R, item: T) => R, initialValue: R): R;
72
+
73
+ /**
74
+ * Checks if at least one element in the iterable satisfies the predicate.
75
+ * Composable first version of `some`.
76
+ * @signature
77
+ * isome(predicate)(data)
78
+ */
79
+ declare function isome<T>(predicate: (item: T) => boolean): (iterable: Iterable<T>) => boolean;
80
+ /**
81
+ * Checks if at least one element in the iterable satisfies the predicate.
82
+ * Data first version of `some`.
83
+ * @signature
84
+ * isome(data, predicate)
85
+ */
86
+ declare function isome<T>(iterable: Iterable<T>, predicate: (item: T) => boolean): boolean;
87
+
88
+ declare function toArray(): <T>(iterable: Iterable<T> | ArrayLike<T>) => T[];
89
+ declare function toArray<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
90
+ declare function toSet(): <T>(iterable: Iterable<T>) => Set<T>;
91
+ declare function toSet<T>(iterable: Iterable<T>): Set<T>;
92
+
93
+ /**
94
+ * Returns an iterable that yields only unique values.
95
+ * It uses a Set to keep track of the values.
96
+ */
97
+ declare function iunique(): <T>(iterable: Iterable<T>) => IteratorLike<T>;
98
+ declare function iunique<T>(iterable: Iterable<T>): IteratorLike<T>;
99
+
100
+ export { ifilter, ifind, iflat, ihead, imap, ireduce, isIterable, isome, iunique, toArray, toSet };
@@ -0,0 +1,24 @@
1
+ import { n } from '../../shared/core.8KM0D6va.mjs';
2
+ export { i as iflat, a as isIterable, b as iunique } from '../../shared/core.8KM0D6va.mjs';
3
+ import { t } from '../../shared/core.BH9nN-_I.mjs';
4
+ export { i as ifilter } from '../../shared/core.BH9nN-_I.mjs';
5
+ export { i as ifind, a as ihead } from '../../shared/core.DsMrjY2q.mjs';
6
+ export { i as imap, t as toArray, a as toSet } from '../../shared/core.Btl47GOn.mjs';
7
+ import { i as invariant } from '../../shared/core.D4npX2q8.mjs';
8
+ export { i as isome } from '../../shared/core.BoyJPEen.mjs';
9
+
10
+ function ireduce(arg1, arg2, arg3) {
11
+ const reducer = n(arg3) ? arg2 : arg1;
12
+ const initialValue = arg3 ?? arg2;
13
+ invariant(t(reducer));
14
+ function _reduce(iter) {
15
+ let acc = initialValue;
16
+ for (const value of iter) {
17
+ acc = reducer(acc, value);
18
+ }
19
+ return acc;
20
+ }
21
+ return n(arg3) ? _reduce(arg1) : _reduce;
22
+ }
23
+
24
+ export { ireduce };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/core",
3
- "version": "1.32.2",
3
+ "version": "1.33.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://likec4.dev",
6
6
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -93,16 +93,31 @@
93
93
  "access": "public"
94
94
  },
95
95
  "dependencies": {
96
- "type-fest": "^4.41.0"
96
+ "mdast-util-from-markdown": "^2.0.2",
97
+ "mdast-util-to-string": "^4.0.0",
98
+ "rehype-format": "5.0.1",
99
+ "rehype-raw": "7.0.0",
100
+ "rehype-sanitize": "^6.0.0",
101
+ "rehype-stringify": "10.0.1",
102
+ "remark-gfm": "4.0.1",
103
+ "remark-parse": "11.0.0",
104
+ "remark-rehype": "11.1.2",
105
+ "type-fest": "^4.41.0",
106
+ "unified": "11.0.5"
97
107
  },
98
108
  "devDependencies": {
99
109
  "@dagrejs/dagre": "1.1.4",
100
- "@mantine/colors-generator": "8.1.0",
110
+ "@mantine/colors-generator": "8.1.1",
111
+ "@types/extend": "3.0.0",
112
+ "@types/hast": "3.0.0",
113
+ "@types/mdast": "4.0.0",
101
114
  "@types/natural-compare-lite": "^1.4.2",
102
115
  "@types/object-hash": "^3.0.6",
116
+ "@types/unist": "3.0.0",
117
+ "@types/node": "~20.19.1",
103
118
  "chroma-js": "^3.1.2",
104
119
  "defu": "^6.1.4",
105
- "fdir": "^6.4.4",
120
+ "fdir": "6.4.6",
106
121
  "graphology": "^0.25.4",
107
122
  "graphology-dag": "^0.4.1",
108
123
  "graphology-types": "^0.24.8",
@@ -110,17 +125,18 @@
110
125
  "natural-compare-lite": "^1.4.0",
111
126
  "object-hash": "^3.0.0",
112
127
  "obliterator": "^2.0.5",
113
- "remeda": "^2.23.0",
128
+ "remeda": "^2.23.1",
114
129
  "turbo": "2.5.4",
115
130
  "typescript": "5.8.3",
116
131
  "unbuild": "3.5.0",
117
- "vitest": "3.2.3",
118
- "@likec4/tsconfig": "1.32.2"
132
+ "vitest": "3.2.4",
133
+ "@likec4/tsconfig": "1.33.0"
119
134
  },
120
135
  "scripts": {
121
136
  "typecheck": "tsc -b --verbose",
122
137
  "build": "unbuild",
123
138
  "lint": "run -T eslint src/ --fix",
139
+ "lint:package": "pnpx publint ./package.tgz",
124
140
  "test": "vitest run --no-isolate",
125
141
  "test:watch": "vitest",
126
142
  "clean": "pnpm rimraf dist lib",
@@ -275,11 +275,10 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
275
275
  return [{
276
276
  id: id as any,
277
277
  title,
278
- description,
278
+ description: description ? { txt: description } : null,
279
279
  tags,
280
280
  links,
281
281
  _stage: 'parsed',
282
- // customColorDefinitions: {},
283
282
  ...props,
284
283
  }, builder]
285
284
  }
@@ -438,6 +437,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
438
437
  const {
439
438
  title = '',
440
439
  links: _links = [],
440
+ description = null,
441
441
  ...props
442
442
  } = defu(
443
443
  typeof _props === 'string' ? { title: _props } : { ..._props },
@@ -452,6 +452,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
452
452
  model: target,
453
453
  },
454
454
  title,
455
+ ...(description && { description: { txt: description } }),
455
456
  ...(links && { links }),
456
457
  ...props,
457
458
  })
@@ -463,6 +464,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
463
464
  const {
464
465
  title = '',
465
466
  links: _links = [],
467
+ description = null,
466
468
  ...props
467
469
  } = defu(
468
470
  typeof _props === 'string' ? { title: _props } : { ..._props },
@@ -474,6 +476,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
474
476
  model: target,
475
477
  },
476
478
  title,
479
+ ...(description && { description: { txt: description } }),
477
480
  ...(links && { links }),
478
481
  ...props,
479
482
  })
@@ -493,6 +496,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
493
496
  icon: _icon,
494
497
  style,
495
498
  title,
499
+ description = null,
496
500
  ...props
497
501
  } = typeof _props === 'string' ? { title: _props } : { ..._props }
498
502
 
@@ -506,7 +510,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
506
510
  id: _id,
507
511
  kind: kind as any,
508
512
  title: title ?? nameFromFqn(_id),
509
- description: null,
513
+ ...(description && { description: { txt: description } }),
510
514
  technology: null,
511
515
  tags: [],
512
516
  color: specStyle?.color ?? DefaultThemeColor as Color,
@@ -686,6 +690,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
686
690
  const {
687
691
  links,
688
692
  title,
693
+ description = null,
689
694
  ...props
690
695
  } = typeof _props === 'string' ? { title: _props } : { ..._props }
691
696
  const _id = b.__deploymentFqn(id)
@@ -694,6 +699,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
694
699
  id: _id,
695
700
  element: target as Fqn,
696
701
  ...title && { title },
702
+ ...(description && { description: { txt: description } }),
697
703
  ...links && { links: mapLinks(links) },
698
704
  ...props,
699
705
  } as DeployedInstance)
@@ -705,6 +711,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
705
711
  const {
706
712
  title = null,
707
713
  links,
714
+ description = null,
708
715
  ...props
709
716
  } = typeof _props === 'string' ? { title: _props } : { ..._props }
710
717
 
@@ -716,6 +723,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
716
723
  deployment: target as any,
717
724
  },
718
725
  title,
726
+ ...description && { description: { txt: description } },
719
727
  ...links && { links: mapLinks(links) },
720
728
  ...props,
721
729
  })
@@ -735,6 +743,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
735
743
  icon: _icon,
736
744
  style,
737
745
  title,
746
+ description = null,
738
747
  ...props
739
748
  } = typeof _props === 'string' ? { title: _props } : { ..._props }
740
749
 
@@ -746,7 +755,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
746
755
  id: _id,
747
756
  kind: kind as any,
748
757
  title: title ?? nameFromFqn(_id),
749
- description: null,
758
+ ...(description && { description: { txt: description } }),
750
759
  technology: null,
751
760
  tags: null,
752
761
  style: {
@@ -10,7 +10,6 @@ exports[`Builder (style1) > should build nested elements and relTo 1`] = `
10
10
  "elements": {
11
11
  "s1": {
12
12
  "color": "green",
13
- "description": null,
14
13
  "id": "s1",
15
14
  "kind": "system",
16
15
  "links": null,
@@ -25,7 +24,6 @@ exports[`Builder (style1) > should build nested elements and relTo 1`] = `
25
24
  },
26
25
  "s1.c1": {
27
26
  "color": "primary",
28
- "description": null,
29
27
  "id": "s1.c1",
30
28
  "kind": "component",
31
29
  "links": null,
@@ -39,7 +37,6 @@ exports[`Builder (style1) > should build nested elements and relTo 1`] = `
39
37
  },
40
38
  "s2": {
41
39
  "color": "green",
42
- "description": null,
43
40
  "id": "s2",
44
41
  "kind": "system",
45
42
  "links": null,
@@ -54,7 +51,6 @@ exports[`Builder (style1) > should build nested elements and relTo 1`] = `
54
51
  },
55
52
  "s2.c1": {
56
53
  "color": "primary",
57
- "description": null,
58
54
  "id": "s2.c1",
59
55
  "kind": "component",
60
56
  "links": null,
@@ -68,7 +64,6 @@ exports[`Builder (style1) > should build nested elements and relTo 1`] = `
68
64
  },
69
65
  "s2.c1.c2": {
70
66
  "color": "primary",
71
- "description": null,
72
67
  "id": "s2.c1.c2",
73
68
  "kind": "component",
74
69
  "links": null,
@@ -82,7 +77,6 @@ exports[`Builder (style1) > should build nested elements and relTo 1`] = `
82
77
  },
83
78
  "s2.c1.c2.c3": {
84
79
  "color": "primary",
85
- "description": null,
86
80
  "id": "s2.c1.c2.c3",
87
81
  "kind": "component",
88
82
  "links": null,
@@ -176,7 +170,6 @@ exports[`Builder (style1) > should build view 1`] = `
176
170
  "elements": {
177
171
  "c1": {
178
172
  "color": "primary",
179
- "description": null,
180
173
  "id": "c1",
181
174
  "kind": "component",
182
175
  "links": null,
@@ -188,7 +181,6 @@ exports[`Builder (style1) > should build view 1`] = `
188
181
  },
189
182
  "c2": {
190
183
  "color": "primary",
191
- "description": null,
192
184
  "id": "c2",
193
185
  "kind": "component",
194
186
  "links": null,
@@ -200,7 +192,6 @@ exports[`Builder (style1) > should build view 1`] = `
200
192
  },
201
193
  "c3": {
202
194
  "color": "primary",
203
- "description": null,
204
195
  "id": "c3",
205
196
  "kind": "component",
206
197
  "links": null,
@@ -310,7 +301,6 @@ exports[`Builder (style1) > should build viewOf 1`] = `
310
301
  "elements": {
311
302
  "c1": {
312
303
  "color": "primary",
313
- "description": null,
314
304
  "id": "c1",
315
305
  "kind": "component",
316
306
  "links": null,
@@ -322,7 +312,6 @@ exports[`Builder (style1) > should build viewOf 1`] = `
322
312
  },
323
313
  "c2": {
324
314
  "color": "primary",
325
- "description": null,
326
315
  "id": "c2",
327
316
  "kind": "component",
328
317
  "links": null,
@@ -334,7 +323,6 @@ exports[`Builder (style1) > should build viewOf 1`] = `
334
323
  },
335
324
  "c2.c3": {
336
325
  "color": "primary",
337
- "description": null,
338
326
  "id": "c2.c3",
339
327
  "kind": "component",
340
328
  "links": null,
@@ -346,7 +334,6 @@ exports[`Builder (style1) > should build viewOf 1`] = `
346
334
  },
347
335
  "c2.c3.c4": {
348
336
  "color": "primary",
349
- "description": null,
350
337
  "id": "c2.c3.c4",
351
338
  "kind": "component",
352
339
  "links": null,
@@ -7,7 +7,6 @@
7
7
  "elements": {
8
8
  "cloud": {
9
9
  "color": "primary",
10
- "description": null,
11
10
  "id": "cloud",
12
11
  "kind": "system",
13
12
  "links": null,
@@ -22,7 +21,6 @@
22
21
  },
23
22
  "cloud.api": {
24
23
  "color": "primary",
25
- "description": null,
26
24
  "id": "cloud.api",
27
25
  "kind": "component",
28
26
  "links": null,
@@ -34,7 +32,6 @@
34
32
  },
35
33
  "cloud.ui": {
36
34
  "color": "primary",
37
- "description": null,
38
35
  "id": "cloud.ui",
39
36
  "kind": "component",
40
37
  "links": null,
@@ -46,7 +43,6 @@
46
43
  },
47
44
  "customer": {
48
45
  "color": "primary",
49
- "description": null,
50
46
  "id": "customer",
51
47
  "kind": "actor",
52
48
  "links": null,
@@ -167,7 +163,7 @@
167
163
  "target": "cloud.api",
168
164
  },
169
165
  ],
170
- "hash": "e2efe9f71b40357a84c900d60e5332c97d0af742",
166
+ "hash": "f58aa16b81d32de0caf9a0de33a3abc82b18475f",
171
167
  "id": "cloudui",
172
168
  "links": null,
173
169
  "nodes": [
@@ -262,7 +258,7 @@
262
258
  "target": "cloud",
263
259
  },
264
260
  ],
265
- "hash": "717ea7de18ab0b5f85bb78a612ad1644052ad367",
261
+ "hash": "31dda554df38c831c5949a7a9e8add1e0810ca18",
266
262
  "id": "index",
267
263
  "links": null,
268
264
  "nodes": [
@@ -6,7 +6,6 @@ exports[`Builder (style 2) > should build 1`] = `
6
6
  "deployments": {
7
7
  "elements": {
8
8
  "dev": {
9
- "description": null,
10
9
  "id": "dev",
11
10
  "kind": "env",
12
11
  "style": {
@@ -19,7 +18,6 @@ exports[`Builder (style 2) > should build 1`] = `
19
18
  "title": "dev",
20
19
  },
21
20
  "dev.local": {
22
- "description": null,
23
21
  "id": "dev.local",
24
22
  "kind": "node",
25
23
  "style": {
@@ -31,7 +29,6 @@ exports[`Builder (style 2) > should build 1`] = `
31
29
  "title": "local",
32
30
  },
33
31
  "prod": {
34
- "description": null,
35
32
  "id": "prod",
36
33
  "kind": "env",
37
34
  "style": {
@@ -44,7 +41,6 @@ exports[`Builder (style 2) > should build 1`] = `
44
41
  "title": "prod",
45
42
  },
46
43
  "prod.eu": {
47
- "description": null,
48
44
  "id": "prod.eu",
49
45
  "kind": "node",
50
46
  "style": {
@@ -65,7 +61,6 @@ exports[`Builder (style 2) > should build 1`] = `
65
61
  "elements": {
66
62
  "cloud": {
67
63
  "color": "primary",
68
- "description": null,
69
64
  "id": "cloud",
70
65
  "kind": "system",
71
66
  "links": null,
@@ -80,7 +75,6 @@ exports[`Builder (style 2) > should build 1`] = `
80
75
  },
81
76
  "cloud.ui": {
82
77
  "color": "primary",
83
- "description": null,
84
78
  "id": "cloud.ui",
85
79
  "kind": "component",
86
80
  "links": null,
@@ -92,7 +86,6 @@ exports[`Builder (style 2) > should build 1`] = `
92
86
  },
93
87
  "customer": {
94
88
  "color": "primary",
95
- "description": null,
96
89
  "id": "customer",
97
90
  "kind": "actor",
98
91
  "links": null,
@@ -79,8 +79,12 @@ export const builder = b
79
79
  }),
80
80
  system('cloud').with(
81
81
  component('frontend').with(
82
- webapp('dashboard'),
83
- mobile('mobile'),
82
+ webapp('dashboard', {
83
+ title: 'Dashboard',
84
+ }),
85
+ mobile('mobile', {
86
+ title: 'Mobile',
87
+ }),
84
88
  ),
85
89
  component('auth'),
86
90
  component('backend').with(
@@ -140,11 +144,15 @@ export const builder = b
140
144
  zone('eu').with(
141
145
  zone('zone1').with(
142
146
  instanceOf('api', 'cloud.backend.api'),
143
- instanceOf('ui', 'cloud.frontend.dashboard'),
147
+ instanceOf('ui', 'cloud.frontend.dashboard', {
148
+ title: 'prod.eu.zone1/dashboard',
149
+ }),
144
150
  ),
145
151
  zone('zone2').with(
146
152
  instanceOf('api', 'cloud.backend.api'),
147
- instanceOf('ui', 'cloud.frontend.dashboard'),
153
+ instanceOf('ui', 'cloud.frontend.dashboard', {
154
+ title: 'prod.eu.zone2/dashboard',
155
+ }),
148
156
  ),
149
157
  instanceOf('auth', 'cloud.auth'),
150
158
  instanceOf('media', 'cloud.media'),
@@ -153,7 +161,9 @@ export const builder = b
153
161
  zone('us').with(
154
162
  zone('zone1').with(
155
163
  instanceOf('api', 'cloud.backend.api'),
156
- instanceOf('ui', 'cloud.frontend.dashboard'),
164
+ instanceOf('ui', 'cloud.frontend.dashboard', {
165
+ title: 'prod.us.zone1/dashboard',
166
+ }),
157
167
  ),
158
168
  instanceOf('db', 'aws.rds'),
159
169
  ),
@@ -140,16 +140,18 @@ export function toNodeSource<A extends AnyAux>(
140
140
  ): ComputedNodeSource<A> {
141
141
  if (el.isDeploymentNode()) {
142
142
  const onlyOneInstance = el.onlyOneInstance()
143
- let { title, kind, id, ...$node } = el.$node
143
+ let { title, kind, id, description, ...$node } = el.$node
144
144
  const { icon, color, shape, ...style } = el.$node.style ?? {}
145
145
  let tags = [...el.tags]
146
+ // let description
146
147
  // If there is only one instance
147
148
  if (onlyOneInstance) {
148
149
  tags = unique([...tags, ...onlyOneInstance.tags])
149
- // If title was not overriden
150
+ // If title was not overriden, take title from the instance
150
151
  if (title === nameFromFqn(el.id)) {
151
152
  title = onlyOneInstance.title
152
153
  }
154
+ description = onlyOneInstance.description.$source ?? description
153
155
  }
154
156
 
155
157
  return {
@@ -162,6 +164,7 @@ export function toNodeSource<A extends AnyAux>(
162
164
  ...(icon && { icon }),
163
165
  ...(color && { color }),
164
166
  ...(shape && { shape }),
167
+ ...(description && { description }),
165
168
  tags,
166
169
  style: {
167
170
  ...style,
@@ -174,10 +177,7 @@ export function toNodeSource<A extends AnyAux>(
174
177
  invariant(el.isInstance(), 'Expected Instance')
175
178
  const instance = el.$instance
176
179
  const element = el.element
177
-
178
- const icon = instance.style?.icon ?? element.icon
179
- const color = instance.style?.color ?? element.color
180
- const shape = instance.style?.shape ?? element.shape
180
+ const { icon, color, shape, ...style } = el.style
181
181
 
182
182
  const links = [
183
183
  ...element.links,
@@ -191,21 +191,21 @@ export function toNodeSource<A extends AnyAux>(
191
191
 
192
192
  const notation = instance.notation ?? element.$element.notation
193
193
 
194
+ let description = el.description.$source
195
+ let technology = instance.technology ?? element.technology
196
+
194
197
  return {
195
198
  id: el.id as scalar.NodeId,
196
199
  kind: 'instance' as unknown as aux.DeploymentKind<A>,
197
- title: instance.title ?? element.title,
198
- description: instance.description ?? element.description,
199
- technology: instance.technology ?? element.technology,
200
+ title: el.title,
201
+ ...(description && { description }),
202
+ ...(technology && { technology }),
200
203
  tags: [...el.tags],
201
204
  links: hasAtLeast(links, 1) ? links : null,
202
205
  ...icon && { icon },
203
206
  ...color && { color },
204
207
  ...shape && { shape },
205
- style: {
206
- ...element.style,
207
- ...instance.style,
208
- },
208
+ style,
209
209
  deploymentRef: instance.id,
210
210
  modelRef: element.id,
211
211
  ...notation && { notation },
@@ -154,7 +154,7 @@ class DynamicViewCompute<A extends AnyAux> {
154
154
  [...this.explicits].map(elementModelToNodeSource),
155
155
  )
156
156
 
157
- const edges = this.steps.map(({ id, source, target, relations, title, isBackward, tags, ...step }) => {
157
+ const edges = this.steps.map(({ id, source, target, relations, title, description, isBackward, tags, ...step }) => {
158
158
  const sourceNode = nonNullable(nodesMap.get(source.id as scalar.NodeId), `Source node ${source.id} not found`)
159
159
  const targetNode = nonNullable(nodesMap.get(target.id as scalar.NodeId), `Target node ${target.id} not found`)
160
160
  const edge: ComputedEdge<A> = {
@@ -164,6 +164,7 @@ class DynamicViewCompute<A extends AnyAux> {
164
164
  target: targetNode.id,
165
165
  label: title,
166
166
  relations,
167
+ description: description ? { txt: description } : null,
167
168
  color: DefaultRelationshipColor,
168
169
  line: DefaultLineStyle,
169
170
  head: DefaultArrowType,
@@ -76,7 +76,7 @@ exports[`compute-element-view > view of cloud 1`] = `
76
76
  "target": "amazon",
77
77
  },
78
78
  ],
79
- "hash": "6df052156ae59d91622677537c2d657e4946d803",
79
+ "hash": "222934c5cc26fad8c43658376bc4e475e47c666f",
80
80
  "id": "index",
81
81
  "links": null,
82
82
  "nodes": [
@@ -308,7 +308,7 @@ exports[`compute-element-view > view of cloud.frontend 1`] = `
308
308
  "target": "cloud.backend",
309
309
  },
310
310
  ],
311
- "hash": "388ed63a4179b91d2953e5c4908c651e3e826eb0",
311
+ "hash": "3d2473dacefacc5be93c73cfe3b1c20824c1b57f",
312
312
  "id": "index",
313
313
  "links": null,
314
314
  "nodes": [
@@ -317,7 +317,7 @@ export function layoutRelationshipsView(data: RelationshipsViewData): Pick<Diagr
317
317
  title: element.title,
318
318
  ...position,
319
319
  position: [position.x, position.y],
320
- description: element.description,
320
+ description: element.description?.$source ?? null,
321
321
  technology: element.technology,
322
322
  tags: [],
323
323
  links: null,