@likec4/core 1.40.0 → 1.42.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 (257) hide show
  1. package/builder/package.json +4 -0
  2. package/compute-view/package.json +4 -0
  3. package/compute-view/relationships/package.json +4 -0
  4. package/dist/builder/index.d.mts +83 -20
  5. package/dist/builder/index.mjs +210 -126
  6. package/dist/compute-view/index.d.mts +8 -7
  7. package/dist/compute-view/index.mjs +14 -11
  8. package/dist/compute-view/relationships-view/index.d.mts +9 -8
  9. package/dist/compute-view/relationships-view/index.mjs +6 -6
  10. package/dist/index.d.mts +7 -7
  11. package/dist/index.mjs +12 -12
  12. package/dist/model/connection/deployment/index.d.mts +11 -10
  13. package/dist/model/connection/deployment/index.mjs +2 -2
  14. package/dist/model/connection/index.d.mts +12 -11
  15. package/dist/model/connection/index.mjs +3 -3
  16. package/dist/model/connection/model/index.d.mts +11 -10
  17. package/dist/model/connection/model/index.mjs +2 -2
  18. package/dist/model/index.d.mts +14 -14
  19. package/dist/model/index.mjs +4 -5
  20. package/dist/shared/{core.DHQ32OHa.mjs → core.01VTr9qu.mjs} +10 -29
  21. package/dist/shared/core.1vX5a9AY.mjs +86 -0
  22. package/dist/shared/{core.BVNaR17u.mjs → core.B7KhhkRY.mjs} +1 -1
  23. package/dist/shared/core.B85MJLTf.mjs +5 -0
  24. package/dist/shared/{core.BIAlzwKc.mjs → core.BIqHjQiH.mjs} +85 -45
  25. package/dist/shared/core.BKlholso.mjs +3 -0
  26. package/dist/shared/core.BR4zXDH-.mjs +13 -0
  27. package/dist/shared/{core.yHe79zEl.mjs → core.BYNkXQ8A.mjs} +21 -12
  28. package/dist/shared/core.BazD6cot.mjs +14 -0
  29. package/dist/shared/{core.BuoXfSMj.mjs → core.BbE4y-yl.mjs} +1 -1
  30. package/dist/shared/core.BoYfZOBm.mjs +3 -0
  31. package/dist/shared/core.BsSXS-_R.mjs +7 -0
  32. package/dist/shared/{core.T-eLZTW_.mjs → core.BzTakU3I.mjs} +15 -7
  33. package/dist/shared/{core.4u1dVmfX.mjs → core.C2TiyjI6.mjs} +2 -2
  34. package/dist/shared/{core.DLpidoWc.mjs → core.C3JowhaZ.mjs} +3 -3
  35. package/dist/shared/{core.CNGyqkJh.mjs → core.C4x8aaWa.mjs} +3 -1
  36. package/dist/shared/{core.BB6zA-UU.mjs → core.C8YY6Uub.mjs} +38 -9
  37. package/dist/shared/{core.FPITT8Vx.mjs → core.C8sl5Y8Z.mjs} +144 -61
  38. package/dist/shared/{core.DuR3R-xJ.mjs → core.CNgZvKb8.mjs} +3 -5176
  39. package/dist/shared/{core.BbThmf6M.d.mts → core.CQngdcuj.d.mts} +85 -4
  40. package/dist/shared/{core.Be1n9a0i.mjs → core.C_Ni6yHl.mjs} +5 -4
  41. package/dist/shared/core.CbT8JVYL.mjs +5 -0
  42. package/dist/shared/core.CqAJJpK_.mjs +3 -0
  43. package/dist/shared/{core.CySf-2gP.d.mts → core.D0PjZzIS.d.mts} +52 -15
  44. package/dist/shared/{core.DrvfVXkh.d.mts → core.D5fzJWbF.d.mts} +11 -2
  45. package/dist/shared/{core.DrVOJuxX.d.mts → core.DACpKp35.d.mts} +5 -5
  46. package/dist/shared/core.DFi2dOTl.mjs +39548 -0
  47. package/dist/shared/{core.D704WZES.d.mts → core.DIol3syK.d.mts} +2 -2
  48. package/dist/shared/{core.DlG1xWt2.mjs → core.DMMOWQqc.mjs} +3 -2
  49. package/dist/shared/core.DNbUPnve.mjs +3990 -0
  50. package/dist/shared/{core.CCD1ID81.mjs → core.DRJma0Ol.mjs} +4 -3
  51. package/dist/shared/{core.DgttqsJc.mjs → core.DRhg-gVU.mjs} +9 -9
  52. package/dist/shared/core.DSO_rTC2.mjs +5322 -0
  53. package/dist/shared/{core.vWJTxpLV.d.mts → core.D_vkffV4.d.mts} +4 -2
  54. package/dist/shared/core.DdMJk7nx.d.mts +476 -0
  55. package/dist/shared/{core.D_fI5Lf6.d.mts → core.Dgs6-nuz.d.mts} +24 -4
  56. package/dist/shared/{core.Be4Jy9Qx.mjs → core.FZ305VYd.mjs} +2 -2
  57. package/dist/shared/core.OHD4KXm9.mjs +5 -0
  58. package/dist/shared/{core.GTgsmXS_.mjs → core.QJD_fcrc.mjs} +2 -2
  59. package/dist/shared/core.RfnaEmgA.mjs +7 -0
  60. package/dist/shared/core.fHR_8Tnq.d.mts +450 -0
  61. package/dist/shared/{core.D0EgVMQK.mjs → core.lRvxPoao.mjs} +14 -12
  62. package/dist/shared/{core.CaT0SUUK.mjs → core.rCeaAqgW.mjs} +1 -84
  63. package/dist/shared/{core.kxeJe0OY.d.mts → core.s9uwOt60.d.mts} +4 -4
  64. package/dist/shared/core.yna0OdV5.d.mts +98 -0
  65. package/dist/styles/index.d.mts +106 -0
  66. package/dist/styles/index.mjs +1 -0
  67. package/dist/types/_aux.d.mts +2 -2
  68. package/dist/types/_aux.mjs +1 -5
  69. package/dist/types/expression-model.d.mts +3 -4
  70. package/dist/types/expression.d.mts +3 -4
  71. package/dist/types/fqnRef.d.mts +2 -2
  72. package/dist/types/fqnRef.mjs +3 -3
  73. package/dist/types/index.d.mts +8 -8
  74. package/dist/types/index.mjs +151 -6
  75. package/dist/types/scalar.mjs +3 -2
  76. package/dist/utils/graphology/index.d.mts +1864 -0
  77. package/dist/utils/graphology/index.mjs +1 -0
  78. package/dist/utils/index.d.mts +11 -6
  79. package/dist/utils/index.mjs +21 -37
  80. package/dist/utils/iterable/index.d.mts +1 -1
  81. package/dist/utils/iterable/index.mjs +45 -7
  82. package/model/package.json +4 -0
  83. package/package.json +42 -24
  84. package/styles/package.json +4 -0
  85. package/types/package.json +4 -0
  86. package/utils/graphology/package.json +4 -0
  87. package/utils/package.json +4 -0
  88. package/dist/shared/core.6_Vp2iiN.mjs +0 -172
  89. package/dist/shared/core.Bpou6c2f.d.mts +0 -850
  90. package/dist/shared/core.CUw_2J9j.mjs +0 -47
  91. package/dist/shared/core.CzdwsPmY.d.mts +0 -69
  92. package/dist/shared/core.DoM6aM9N.mjs +0 -7
  93. package/dist/shared/core.ILwny7BV.mjs +0 -38
  94. package/dist/theme/index.d.mts +0 -11
  95. package/dist/theme/index.mjs +0 -232
  96. package/src/builder/Builder.deployment.ts +0 -224
  97. package/src/builder/Builder.deploymentModel.ts +0 -449
  98. package/src/builder/Builder.element.ts +0 -241
  99. package/src/builder/Builder.model.ts +0 -494
  100. package/src/builder/Builder.ts +0 -870
  101. package/src/builder/Builder.view-common.ts +0 -273
  102. package/src/builder/Builder.view-deployment.ts +0 -135
  103. package/src/builder/Builder.view-element.ts +0 -202
  104. package/src/builder/Builder.views.ts +0 -399
  105. package/src/builder/Builder.with.ts +0 -156
  106. package/src/builder/_types.ts +0 -320
  107. package/src/builder/index.ts +0 -11
  108. package/src/compute-view/compute-view.ts +0 -80
  109. package/src/compute-view/deployment-view/_types.ts +0 -38
  110. package/src/compute-view/deployment-view/clean-connections.ts +0 -236
  111. package/src/compute-view/deployment-view/compute.ts +0 -94
  112. package/src/compute-view/deployment-view/memory/index.ts +0 -9
  113. package/src/compute-view/deployment-view/memory/memory.ts +0 -96
  114. package/src/compute-view/deployment-view/predicates/deploymentRefs-where.ts +0 -18
  115. package/src/compute-view/deployment-view/predicates/deploymentRefs.ts +0 -154
  116. package/src/compute-view/deployment-view/predicates/index.ts +0 -8
  117. package/src/compute-view/deployment-view/predicates/relation-direct.ts +0 -243
  118. package/src/compute-view/deployment-view/predicates/relation-in-out.ts +0 -70
  119. package/src/compute-view/deployment-view/predicates/relation-incoming.ts +0 -101
  120. package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +0 -95
  121. package/src/compute-view/deployment-view/predicates/relation-where.ts +0 -18
  122. package/src/compute-view/deployment-view/predicates/utils.ts +0 -282
  123. package/src/compute-view/deployment-view/predicates/wildcard.ts +0 -41
  124. package/src/compute-view/deployment-view/stages/stage-exclude.ts +0 -5
  125. package/src/compute-view/deployment-view/stages/stage-final.ts +0 -245
  126. package/src/compute-view/deployment-view/stages/stage-include.ts +0 -95
  127. package/src/compute-view/deployment-view/utils.ts +0 -286
  128. package/src/compute-view/dynamic-view/compute.ts +0 -312
  129. package/src/compute-view/element-view/_types.ts +0 -47
  130. package/src/compute-view/element-view/clean-connections.ts +0 -117
  131. package/src/compute-view/element-view/compute.ts +0 -324
  132. package/src/compute-view/element-view/memory/NodeGroup.ts +0 -31
  133. package/src/compute-view/element-view/memory/index.ts +0 -10
  134. package/src/compute-view/element-view/memory/memory.ts +0 -178
  135. package/src/compute-view/element-view/memory/stage-exclude.ts +0 -59
  136. package/src/compute-view/element-view/memory/stage-final.ts +0 -129
  137. package/src/compute-view/element-view/memory/stage-include.ts +0 -130
  138. package/src/compute-view/element-view/predicates/_utils.ts +0 -91
  139. package/src/compute-view/element-view/predicates/element-expand.ts +0 -29
  140. package/src/compute-view/element-view/predicates/element-kind-tag.ts +0 -27
  141. package/src/compute-view/element-view/predicates/element-ref.ts +0 -24
  142. package/src/compute-view/element-view/predicates/relation-direct.ts +0 -321
  143. package/src/compute-view/element-view/predicates/relation-in-out.ts +0 -64
  144. package/src/compute-view/element-view/predicates/relation-in.ts +0 -115
  145. package/src/compute-view/element-view/predicates/relation-out.ts +0 -119
  146. package/src/compute-view/element-view/predicates/wildcard.ts +0 -88
  147. package/src/compute-view/element-view/utils.ts +0 -65
  148. package/src/compute-view/index.ts +0 -4
  149. package/src/compute-view/memory/AbstractMemory.ts +0 -45
  150. package/src/compute-view/memory/AbstractStageExclude.ts +0 -215
  151. package/src/compute-view/memory/AbstractStageInclude.ts +0 -200
  152. package/src/compute-view/memory/_types.ts +0 -148
  153. package/src/compute-view/memory/index.ts +0 -5
  154. package/src/compute-view/memory/ops.ts +0 -43
  155. package/src/compute-view/relationships-view/_types.ts +0 -16
  156. package/src/compute-view/relationships-view/compute.ts +0 -159
  157. package/src/compute-view/relationships-view/index.ts +0 -3
  158. package/src/compute-view/relationships-view/layout.ts +0 -357
  159. package/src/compute-view/relationships-view/utils.ts +0 -73
  160. package/src/compute-view/utils/ancestorsOfNode.ts +0 -19
  161. package/src/compute-view/utils/applyCustomElementProperties.ts +0 -107
  162. package/src/compute-view/utils/applyCustomRelationProperties.ts +0 -58
  163. package/src/compute-view/utils/applyViewRuleStyles.ts +0 -73
  164. package/src/compute-view/utils/buildComputedNodes.ts +0 -153
  165. package/src/compute-view/utils/buildElementNotations.ts +0 -63
  166. package/src/compute-view/utils/elementExpressionToPredicate.ts +0 -50
  167. package/src/compute-view/utils/link-nodes-with-edges.ts +0 -56
  168. package/src/compute-view/utils/merge-props-from-relationships.ts +0 -161
  169. package/src/compute-view/utils/relationExpressionToPredicates.ts +0 -55
  170. package/src/compute-view/utils/resolve-extended-views.ts +0 -85
  171. package/src/compute-view/utils/resolve-global-rules.ts +0 -88
  172. package/src/compute-view/utils/topological-sort.ts +0 -256
  173. package/src/compute-view/utils/view-hash.ts +0 -45
  174. package/src/compute-view/utils/with-readable-edges.ts +0 -40
  175. package/src/index.ts +0 -32
  176. package/src/model/DeploymentElementModel.ts +0 -682
  177. package/src/model/DeploymentModel.ts +0 -393
  178. package/src/model/ElementModel.ts +0 -293
  179. package/src/model/LikeC4Model.ts +0 -882
  180. package/src/model/RelationModel.ts +0 -152
  181. package/src/model/connection/Connection.ts +0 -72
  182. package/src/model/connection/deployment/DeploymentConnectionModel.ts +0 -185
  183. package/src/model/connection/deployment/find.ts +0 -120
  184. package/src/model/connection/deployment/index.ts +0 -8
  185. package/src/model/connection/index.ts +0 -22
  186. package/src/model/connection/model/ConnectionModel.ts +0 -158
  187. package/src/model/connection/model/find.ts +0 -117
  188. package/src/model/connection/model/index.ts +0 -8
  189. package/src/model/connection/ops.ts +0 -276
  190. package/src/model/guards.ts +0 -77
  191. package/src/model/index.ts +0 -72
  192. package/src/model/types.ts +0 -67
  193. package/src/model/utils.ts +0 -66
  194. package/src/model/view/EdgeModel.ts +0 -120
  195. package/src/model/view/LikeC4ViewModel.ts +0 -361
  196. package/src/model/view/LikeC4ViewsFolder.ts +0 -151
  197. package/src/model/view/NodeModel.ts +0 -247
  198. package/src/theme/element.ts +0 -61
  199. package/src/theme/index.ts +0 -127
  200. package/src/theme/relationships.ts +0 -54
  201. package/src/types/RichText.ts +0 -206
  202. package/src/types/_aux.ts +0 -291
  203. package/src/types/_common.ts +0 -80
  204. package/src/types/const.ts +0 -34
  205. package/src/types/expression-model.ts +0 -294
  206. package/src/types/expression.ts +0 -313
  207. package/src/types/fqnRef.ts +0 -91
  208. package/src/types/geometry.ts +0 -159
  209. package/src/types/global.ts +0 -21
  210. package/src/types/index.ts +0 -42
  211. package/src/types/model-data.ts +0 -77
  212. package/src/types/model-deployment.ts +0 -88
  213. package/src/types/model-dump.ts +0 -79
  214. package/src/types/model-logical.ts +0 -135
  215. package/src/types/model-spec.ts +0 -85
  216. package/src/types/operators.ts +0 -156
  217. package/src/types/project.ts +0 -14
  218. package/src/types/scalar.ts +0 -162
  219. package/src/types/styles.ts +0 -122
  220. package/src/types/view-changes.ts +0 -32
  221. package/src/types/view-common.ts +0 -157
  222. package/src/types/view-computed.ts +0 -118
  223. package/src/types/view-layouted.ts +0 -98
  224. package/src/types/view-parsed.deployment.ts +0 -39
  225. package/src/types/view-parsed.dynamic.ts +0 -89
  226. package/src/types/view-parsed.element.ts +0 -65
  227. package/src/types/view.ts +0 -113
  228. package/src/utils/common-head.ts +0 -22
  229. package/src/utils/compare-natural.ts +0 -60
  230. package/src/utils/const.ts +0 -1
  231. package/src/utils/fqn.ts +0 -302
  232. package/src/utils/getOrCreate.ts +0 -8
  233. package/src/utils/guards.ts +0 -9
  234. package/src/utils/index.ts +0 -68
  235. package/src/utils/invariant.ts +0 -29
  236. package/src/utils/iterable/_types.ts +0 -5
  237. package/src/utils/iterable/filter.ts +0 -55
  238. package/src/utils/iterable/find.ts +0 -38
  239. package/src/utils/iterable/first.ts +0 -48
  240. package/src/utils/iterable/flat.ts +0 -17
  241. package/src/utils/iterable/head.ts +0 -22
  242. package/src/utils/iterable/index.ts +0 -15
  243. package/src/utils/iterable/map.ts +0 -40
  244. package/src/utils/iterable/reduce.ts +0 -24
  245. package/src/utils/iterable/some.ts +0 -36
  246. package/src/utils/iterable/to.ts +0 -19
  247. package/src/utils/iterable/unique.ts +0 -23
  248. package/src/utils/markdown/index.ts +0 -2
  249. package/src/utils/markdown/to-html.ts +0 -32
  250. package/src/utils/markdown/to-text.ts +0 -14
  251. package/src/utils/memoize-prop.ts +0 -30
  252. package/src/utils/mnemonist.ts +0 -9
  253. package/src/utils/object-hash.ts +0 -14
  254. package/src/utils/promises.ts +0 -24
  255. package/src/utils/relations.ts +0 -36
  256. package/src/utils/set.ts +0 -83
  257. package/src/utils/string-hash.ts +0 -16
@@ -0,0 +1,450 @@
1
+ import { Tagged, NonEmptyTuple, PartialDeep, WritableDeep, Except } from 'type-fest';
2
+ import { s as BorderStyle, q as ShapeSize, r as SpacingSize, p as TextSize, Q as Color, u as ElementShape, v as RelationshipLineType, y as RelationshipArrowType, b as LikeC4Theme, L as LikeC4StyleDefaults } from './core.CQngdcuj.mjs';
3
+ import { I as Icon, M as MarkdownOrString, d as RelationId, P as ProjectId, N as NodeId, j as EdgeId, m as StepEdgeKind } from './core.DX-WYEPA.mjs';
4
+ import { A as Any, n as WithOptionalTags, o as WithOptionalLinks, h as StrictViewId, f as _stage, g as _type, F as Fqn, R as RelationKind, W as WithDescriptionAndTech, q as WithMetadata, r as WithNotation, j as ElementKind, x as WithTags, t as DeploymentKind, s as DeploymentFqn } from './core.Dgs6-nuz.mjs';
5
+ import { FqnRef } from '../types/fqnRef.mjs';
6
+ import { N as NonEmptyArray, E as ExclusiveUnion, a as NonEmptyReadonlyArray } from './core.D5fzJWbF.mjs';
7
+ import { ModelExpression, ModelFqnExpr } from '../types/expression-model.mjs';
8
+
9
+ type Point = readonly [x: number, y: number];
10
+ interface XYPoint {
11
+ x: number;
12
+ y: number;
13
+ }
14
+ interface BBox {
15
+ x: number;
16
+ y: number;
17
+ width: number;
18
+ height: number;
19
+ }
20
+ declare namespace BBox {
21
+ function center({ x, y, width, height }: BBox): XYPoint;
22
+ function fromPoints(points: Point[]): BBox;
23
+ function merge(...boxes: BBox[]): BBox;
24
+ function toRectBox(box: BBox): RectBox;
25
+ function expand(box: BBox, plus: number): BBox;
26
+ function shrink(box: BBox, minus: number): BBox;
27
+ }
28
+ interface RectBox {
29
+ x1: number;
30
+ y1: number;
31
+ x2: number;
32
+ y2: number;
33
+ }
34
+ declare namespace RectBox {
35
+ function center({ x1, y1, x2, y2 }: RectBox): XYPoint;
36
+ function fromPoints(points: Point[]): RectBox;
37
+ function merge(...boxes: RectBox[]): RectBox;
38
+ function toBBox(box: RectBox): BBox;
39
+ }
40
+
41
+ interface AnyIncludePredicate<Expr> {
42
+ include: Expr[];
43
+ exclude?: never;
44
+ }
45
+ interface AnyExcludePredicate<Expr> {
46
+ include?: never;
47
+ exclude: Expr[];
48
+ }
49
+ interface AnyViewRuleStyle<Expr> {
50
+ targets: Expr[];
51
+ notation?: string;
52
+ style: {
53
+ border?: BorderStyle;
54
+ opacity?: number;
55
+ multiple?: boolean;
56
+ size?: ShapeSize;
57
+ padding?: SpacingSize;
58
+ textSize?: TextSize;
59
+ color?: Color;
60
+ shape?: ElementShape;
61
+ icon?: Icon;
62
+ };
63
+ }
64
+ interface ViewRuleGlobalStyle {
65
+ styleId: GlobalStyleID;
66
+ }
67
+ declare function isViewRuleGlobalStyle(rule: object): rule is ViewRuleGlobalStyle;
68
+ interface ViewRuleGlobalPredicateRef {
69
+ predicateId: GlobalPredicateId;
70
+ }
71
+ declare function isViewRuleGlobalPredicateRef(rule: object): rule is ViewRuleGlobalPredicateRef;
72
+ type AutoLayoutDirection = 'TB' | 'BT' | 'LR' | 'RL';
73
+ declare function isAutoLayoutDirection(autoLayout: unknown): autoLayout is AutoLayoutDirection;
74
+ interface ViewRuleAutoLayout {
75
+ direction: AutoLayoutDirection;
76
+ nodeSep?: number;
77
+ rankSep?: number;
78
+ }
79
+ declare function isViewRuleAutoLayout(rule: object): rule is ViewRuleAutoLayout;
80
+ interface ViewAutoLayout {
81
+ direction: ViewRuleAutoLayout['direction'];
82
+ rankSep?: number;
83
+ nodeSep?: number;
84
+ }
85
+ type ViewManualLayout = {
86
+ readonly hash: string;
87
+ readonly x: number;
88
+ readonly y: number;
89
+ readonly width: number;
90
+ readonly height: number;
91
+ readonly autoLayout: ViewAutoLayout;
92
+ readonly nodes: Record<string, {
93
+ isCompound: boolean;
94
+ x: number;
95
+ y: number;
96
+ width: number;
97
+ height: number;
98
+ }>;
99
+ readonly edges: Record<string, {
100
+ dotpos?: string;
101
+ points: NonEmptyArray<Point>;
102
+ controlPoints?: NonEmptyArray<XYPoint>;
103
+ labelBBox?: BBox;
104
+ }>;
105
+ };
106
+ type ViewType = 'element' | 'dynamic' | 'deployment';
107
+ interface BaseViewProperties<A extends Any> extends WithOptionalTags<A>, WithOptionalLinks {
108
+ readonly id: StrictViewId<A>;
109
+ readonly title: string | null;
110
+ readonly description: MarkdownOrString | null;
111
+ /**
112
+ * Source file containing this view, relative to the project root.
113
+ * Undefined if the view is auto-generated.
114
+ */
115
+ readonly sourcePath?: string | undefined;
116
+ }
117
+ interface BaseParsedViewProperties<A extends Any> extends BaseViewProperties<A> {
118
+ /**
119
+ * Internal field to identify the stage of the view.
120
+ * This is used to create the correct type of the view.
121
+ */
122
+ readonly [_stage]: 'parsed';
123
+ /**
124
+ * URI to the source file of this view.
125
+ * Undefined if the view is auto-generated.
126
+ */
127
+ readonly docUri?: string | undefined;
128
+ /**
129
+ * If the view is changed manually this field contains the layout data.
130
+ */
131
+ readonly manualLayout?: ViewManualLayout | undefined;
132
+ }
133
+ type NodeNotation = {
134
+ kinds: string[];
135
+ shape: ElementShape;
136
+ color: Color;
137
+ title: string;
138
+ };
139
+ interface ViewWithNotation {
140
+ notation?: {
141
+ nodes: NodeNotation[];
142
+ };
143
+ }
144
+ interface ViewWithHash {
145
+ /**
146
+ * Hash of the view object.
147
+ * This is used to detect changes in layout
148
+ */
149
+ hash: string;
150
+ }
151
+
152
+ /**
153
+ * Predicates scoped to logical model
154
+ */
155
+ interface ElementViewIncludePredicate<A extends Any = Any> extends AnyIncludePredicate<ModelExpression<A>> {
156
+ }
157
+ interface ElementViewExcludePredicate<A extends Any = Any> extends AnyExcludePredicate<ModelExpression<A>> {
158
+ }
159
+ type ElementViewPredicate<A extends Any = Any> = ElementViewIncludePredicate<A> | ElementViewExcludePredicate<A>;
160
+ interface ElementViewRuleGroup<A extends Any = Any> {
161
+ groupRules: Array<ElementViewPredicate<A> | ElementViewRuleGroup<A>>;
162
+ title: string | null;
163
+ color?: Color;
164
+ border?: BorderStyle;
165
+ opacity?: number;
166
+ multiple?: boolean;
167
+ size?: ShapeSize;
168
+ padding?: SpacingSize;
169
+ textSize?: TextSize;
170
+ }
171
+ declare function isViewRuleGroup<A extends Any>(rule: ElementViewRule<A>): rule is ElementViewRuleGroup<A>;
172
+ interface ElementViewRuleStyle<A extends Any = Any> extends AnyViewRuleStyle<ModelFqnExpr<A>> {
173
+ }
174
+ type ElementViewRule<A extends Any = Any> = ExclusiveUnion<{
175
+ IncludePredicate: ElementViewIncludePredicate<A>;
176
+ ExcludePredicate: ElementViewExcludePredicate<A>;
177
+ Group: ElementViewRuleGroup<A>;
178
+ Style: ElementViewRuleStyle<A>;
179
+ GlobalStyle: ViewRuleGlobalStyle;
180
+ GlobalPredicateRef: ViewRuleGlobalPredicateRef;
181
+ AutoLayout: ViewRuleAutoLayout;
182
+ }>;
183
+ interface ParsedElementView<A extends Any = Any> extends BaseParsedViewProperties<A> {
184
+ [_type]: 'element';
185
+ readonly rules: ElementViewRule<A>[];
186
+ readonly viewOf?: Fqn<A>;
187
+ readonly extends?: StrictViewId<A>;
188
+ }
189
+
190
+ interface DynamicStep<A extends Any = Any> {
191
+ readonly source: Fqn<A>;
192
+ readonly target: Fqn<A>;
193
+ readonly title?: string | null;
194
+ readonly kind?: RelationKind<A>;
195
+ readonly description?: MarkdownOrString;
196
+ readonly technology?: string;
197
+ readonly notation?: string;
198
+ readonly notes?: MarkdownOrString;
199
+ readonly color?: Color;
200
+ readonly line?: RelationshipLineType;
201
+ readonly head?: RelationshipArrowType;
202
+ readonly tail?: RelationshipArrowType;
203
+ readonly isBackward?: boolean;
204
+ readonly navigateTo?: StrictViewId<A>;
205
+ /**
206
+ * Path to the AST node relative to the view body ast
207
+ * Used to locate the step in the source code
208
+ */
209
+ readonly astPath: string;
210
+ }
211
+ interface DynamicStepsSeries<A extends Any = Any> {
212
+ readonly seriesId: string;
213
+ readonly __series: NonEmptyReadonlyArray<DynamicStep<A>>;
214
+ }
215
+ interface DynamicStepsParallel<A extends Any = Any> {
216
+ readonly parallelId: string;
217
+ readonly __parallel: NonEmptyReadonlyArray<DynamicStep<A> | DynamicStepsSeries<A>>;
218
+ }
219
+ declare function getParallelStepsPrefix(id: string): string | null;
220
+ type DynamicViewStep<A extends Any = Any> = ExclusiveUnion<{
221
+ Step: DynamicStep<A>;
222
+ Series: DynamicStepsSeries<A>;
223
+ Parallel: DynamicStepsParallel<A>;
224
+ }>;
225
+ declare function isDynamicStep<A extends Any>(step: DynamicViewStep<A> | undefined): step is DynamicStep<A>;
226
+ declare function isDynamicStepsParallel<A extends Any>(step: DynamicViewStep<A> | undefined): step is DynamicStepsParallel<A>;
227
+ declare function isDynamicStepsSeries<A extends Any>(step: DynamicViewStep<A> | undefined): step is DynamicStepsSeries<A>;
228
+ interface DynamicViewIncludeRule<A extends Any = Any> {
229
+ include: ModelFqnExpr.Any<A>[];
230
+ }
231
+ type DynamicViewRule<A extends Any = Any> = ExclusiveUnion<{
232
+ Include: DynamicViewIncludeRule<A>;
233
+ GlobalPredicateRef: ViewRuleGlobalPredicateRef;
234
+ ElementViewRuleStyle: ElementViewRuleStyle<A>;
235
+ GlobalStyle: ViewRuleGlobalStyle;
236
+ AutoLayout: ViewRuleAutoLayout;
237
+ }>;
238
+ type DynamicViewDisplayVariant = 'diagram' | 'sequence';
239
+ interface ParsedDynamicView<A extends Any = Any> extends BaseParsedViewProperties<A> {
240
+ [_type]: 'dynamic';
241
+ /**
242
+ * How to display the dynamic view
243
+ * - `diagram`: display as a regular likec4 view
244
+ * - `sequence`: display as a sequence diagram
245
+ *
246
+ * @default 'diagram'
247
+ */
248
+ readonly variant?: DynamicViewDisplayVariant;
249
+ readonly steps: DynamicViewStep<A>[];
250
+ readonly rules: DynamicViewRule<A>[];
251
+ }
252
+
253
+ type GlobalPredicateId = Tagged<string, 'GlobalPredicateId'>;
254
+ type GlobalPredicates<A extends Any = Any> = NonEmptyArray<ElementViewPredicate<A>>;
255
+ type GlobalDynamicPredicates<A extends Any = Any> = NonEmptyArray<DynamicViewIncludeRule<A>>;
256
+ type GlobalStyleID = Tagged<string, 'GlobalStyleID'>;
257
+ type GlobalStyles<A extends Any = Any> = NonEmptyTuple<ElementViewRuleStyle<A>>;
258
+ interface ModelGlobals<A extends Any = Any> {
259
+ readonly predicates: Record<GlobalPredicateId, GlobalPredicates<A>>;
260
+ readonly dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates<A>>;
261
+ readonly styles: Record<GlobalStyleID, GlobalStyles<A>>;
262
+ }
263
+
264
+ interface ElementStyle {
265
+ readonly icon?: Icon;
266
+ readonly shape?: ElementShape;
267
+ readonly color?: Color;
268
+ readonly border?: BorderStyle;
269
+ /**
270
+ * In percentage 0-100, 0 is fully transparent
271
+ *
272
+ * @default 100
273
+ */
274
+ readonly opacity?: number;
275
+ /**
276
+ * If true, the element is rendered as multiple shapes
277
+ * @default false
278
+ */
279
+ readonly multiple?: boolean;
280
+ /**
281
+ * Shape size
282
+ *
283
+ * @default 'md'
284
+ */
285
+ readonly size?: ShapeSize;
286
+ readonly padding?: SpacingSize;
287
+ readonly textSize?: TextSize;
288
+ }
289
+ type WithSizes = Pick<ElementStyle, 'size' | 'padding' | 'textSize'>;
290
+ /**
291
+ * Ensures that the sizes are set to default values if they are not set
292
+ */
293
+ declare function ensureSizes<S extends WithSizes>({ size, padding, textSize, ...rest }: S, defaultSize?: "xs" | "sm" | "md" | "lg" | "xl"): Omit<S, 'size' | 'padding' | 'textSize'> & Required<WithSizes>;
294
+ interface Element<A extends Any = Any> extends WithDescriptionAndTech, WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A>, WithNotation {
295
+ readonly id: Fqn<A>;
296
+ readonly kind: ElementKind<A>;
297
+ readonly title: string;
298
+ readonly style: ElementStyle;
299
+ }
300
+ interface AbstractRelationship<A extends Any> extends WithDescriptionAndTech, WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
301
+ readonly id: RelationId;
302
+ readonly title?: string | null;
303
+ readonly kind?: RelationKind<A>;
304
+ readonly color?: Color;
305
+ readonly line?: RelationshipLineType;
306
+ readonly head?: RelationshipArrowType;
307
+ readonly tail?: RelationshipArrowType;
308
+ readonly navigateTo?: StrictViewId<A>;
309
+ }
310
+ /**
311
+ * Relationship between two model elements
312
+ */
313
+ interface Relationship<A extends Any = Any> extends AbstractRelationship<A> {
314
+ readonly source: FqnRef.ModelRef<A>;
315
+ readonly target: FqnRef.ModelRef<A>;
316
+ }
317
+ /**
318
+ * Backward compatibility alias
319
+ * @deprecated Use {@link Relationship} instead
320
+ */
321
+ type ModelRelation<A extends Any = Any> = Relationship<A>;
322
+
323
+ type LikeC4ProjectTheme = PartialDeep<WritableDeep<LikeC4Theme>, {
324
+ recurseIntoArrays: false;
325
+ allowUndefinedInNonTupleArrays: false;
326
+ }>;
327
+ type LikeC4ProjectStyleDefaults = PartialDeep<WritableDeep<LikeC4StyleDefaults>, {
328
+ recurseIntoArrays: false;
329
+ allowUndefinedInNonTupleArrays: false;
330
+ }>;
331
+ interface LikeC4ProjectStylesConfig {
332
+ theme?: LikeC4ProjectTheme;
333
+ defaults?: LikeC4ProjectStyleDefaults;
334
+ }
335
+ /**
336
+ * Configuration of the project, as read from the config file.
337
+ * LikeC4 projects encapsulate models, and can import from each other
338
+ */
339
+ interface LikeC4Project {
340
+ /**
341
+ * ID of the project, casted to {@link scalar.ProjectId}
342
+ */
343
+ readonly id: ProjectId;
344
+ title?: string;
345
+ /**
346
+ * Custom styles
347
+ */
348
+ styles?: LikeC4ProjectStylesConfig | undefined;
349
+ }
350
+
351
+ type ComputedNodeStyle = Except<ElementStyle, 'icon' | 'shape' | 'color', {
352
+ requireExactProps: true;
353
+ }>;
354
+ interface ComputedNode<A extends Any = Any> extends WithTags<A>, WithOptionalLinks {
355
+ id: NodeId;
356
+ kind: ElementKind<A> | DeploymentKind<A> | '@group';
357
+ parent: NodeId | null;
358
+ /**
359
+ * Reference to model element
360
+ */
361
+ modelRef?: Fqn<A>;
362
+ /**
363
+ * Reference to deployment element
364
+ */
365
+ deploymentRef?: DeploymentFqn<A>;
366
+ title: string;
367
+ /**
368
+ * Description of the node
369
+ * either summary or description
370
+ */
371
+ description?: MarkdownOrString | null;
372
+ technology?: string | null;
373
+ children: NodeId[];
374
+ inEdges: EdgeId[];
375
+ outEdges: EdgeId[];
376
+ shape: ElementShape;
377
+ color: Color;
378
+ icon?: Icon;
379
+ style: ComputedNodeStyle;
380
+ navigateTo?: StrictViewId<A> | null;
381
+ level: number;
382
+ depth?: number | null;
383
+ /**
384
+ * If this node was customized in the view
385
+ */
386
+ isCustomized?: boolean;
387
+ notation?: string | null;
388
+ }
389
+ interface ComputedEdge<A extends Any = Any> extends WithOptionalTags<A> {
390
+ id: EdgeId;
391
+ parent: NodeId | null;
392
+ source: NodeId;
393
+ target: NodeId;
394
+ label: string | null;
395
+ description?: MarkdownOrString | null;
396
+ technology?: string | null;
397
+ relations: RelationId[];
398
+ kind?: RelationKind<A> | typeof StepEdgeKind;
399
+ notation?: string;
400
+ notes?: MarkdownOrString;
401
+ color: Color;
402
+ line: RelationshipLineType;
403
+ head?: RelationshipArrowType;
404
+ tail?: RelationshipArrowType;
405
+ navigateTo?: StrictViewId<A> | null;
406
+ /**
407
+ * If this edge is derived from custom relationship predicate
408
+ */
409
+ isCustomized?: boolean;
410
+ /**
411
+ * Path to the AST node relative to the view body ast
412
+ * Available only in dynamic views
413
+ * @internal
414
+ */
415
+ astPath?: string;
416
+ /**
417
+ * For layouting purposes
418
+ * @default 'forward'
419
+ */
420
+ dir?: 'forward' | 'back' | 'both';
421
+ }
422
+ interface BaseComputedViewProperties<A extends Any> extends BaseViewProperties<A>, ViewWithHash, ViewWithNotation {
423
+ readonly [_stage]: 'computed';
424
+ readonly autoLayout: ViewAutoLayout;
425
+ readonly nodes: ComputedNode<A>[];
426
+ readonly edges: ComputedEdge<A>[];
427
+ /**
428
+ * If the view is changed manually this field contains the layout data.
429
+ */
430
+ readonly manualLayout?: ViewManualLayout | undefined;
431
+ }
432
+ interface ComputedElementView<A extends Any = Any> extends BaseComputedViewProperties<A> {
433
+ readonly [_type]: 'element';
434
+ readonly viewOf?: Fqn<A>;
435
+ readonly extends?: StrictViewId<A>;
436
+ }
437
+ interface ComputedDeploymentView<A extends Any = Any> extends BaseComputedViewProperties<A> {
438
+ readonly [_type]: 'deployment';
439
+ }
440
+ interface ComputedDynamicView<A extends Any = Any> extends BaseComputedViewProperties<A> {
441
+ readonly [_type]: 'dynamic';
442
+ /**
443
+ * How to display the dynamic view
444
+ * - `diagram`: display as a regular likec4 view
445
+ * - `sequence`: display as a sequence diagram
446
+ */
447
+ readonly variant: DynamicViewDisplayVariant;
448
+ }
449
+
450
+ export { type DynamicViewIncludeRule as $, type AbstractRelationship as A, BBox as B, type ViewWithNotation as C, type ViewWithHash as D, type ElementStyle as E, type ComputedNodeStyle as F, type GlobalPredicateId as G, type ComputedNode as H, type ComputedEdge as I, type ComputedElementView as J, type ComputedDeploymentView as K, type LikeC4ProjectTheme as L, type ModelGlobals as M, type NodeNotation as N, type ComputedDynamicView as O, type Point as P, type DynamicStep as Q, RectBox as R, type DynamicStepsSeries as S, type DynamicStepsParallel as T, getParallelStepsPrefix as U, type ViewRuleGlobalStyle as V, type DynamicViewStep as W, type XYPoint as X, isDynamicStep as Y, isDynamicStepsParallel as Z, isDynamicStepsSeries as _, type GlobalPredicates as a, type DynamicViewRule as a0, type DynamicViewDisplayVariant as a1, type ParsedDynamicView as a2, type ElementViewIncludePredicate as a3, type ElementViewExcludePredicate as a4, type ElementViewPredicate as a5, type ElementViewRuleGroup as a6, isViewRuleGroup as a7, type ElementViewRuleStyle as a8, type ElementViewRule as a9, type ParsedElementView as aa, type GlobalDynamicPredicates as b, type GlobalStyleID as c, type GlobalStyles as d, ensureSizes as e, type Element as f, type Relationship as g, type ModelRelation as h, type LikeC4ProjectStyleDefaults as i, type LikeC4ProjectStylesConfig as j, type LikeC4Project as k, type AnyIncludePredicate as l, type AnyExcludePredicate as m, type AnyViewRuleStyle as n, isViewRuleGlobalStyle as o, type ViewRuleGlobalPredicateRef as p, isViewRuleGlobalPredicateRef as q, type AutoLayoutDirection as r, isAutoLayoutDirection as s, type ViewRuleAutoLayout as t, isViewRuleAutoLayout as u, type ViewAutoLayout as v, type ViewManualLayout as w, type ViewType as x, type BaseViewProperties as y, type BaseParsedViewProperties as z };
@@ -1,9 +1,11 @@
1
- import { pipe, map, isNot } from 'remeda';
2
- import { c as customInspectSymbol } from './core.BVNaR17u.mjs';
3
- import { i as intersection, a as stringHash, u as union, d as difference, e as equals } from './core.4u1dVmfX.mjs';
4
- import { b as isDescendantOf, i as isAncestor, e as isString, s as sortNaturalByFqn, d as isSameHierarchy } from './core.DgttqsJc.mjs';
5
- import { i as isome } from './core.Be4Jy9Qx.mjs';
6
- import { i as ifilter } from './core.CCD1ID81.mjs';
1
+ import { c as customInspectSymbol } from './core.B7KhhkRY.mjs';
2
+ import { e } from './core.BoYfZOBm.mjs';
3
+ import { i as intersection, a as stringHash, u as union, d as difference, e as equals } from './core.C2TiyjI6.mjs';
4
+ import { t } from './core.OHD4KXm9.mjs';
5
+ import { t as t$1 } from './core.CbT8JVYL.mjs';
6
+ import { b as isDescendantOf, i as isAncestor, e as isString, s as sortNaturalByFqn, d as isSameHierarchy } from './core.DRhg-gVU.mjs';
7
+ import { i as isome } from './core.FZ305VYd.mjs';
8
+ import { i as ifilter } from './core.DRJma0Ol.mjs';
7
9
  import { i as invariant } from './core.D4npX2q8.mjs';
8
10
 
9
11
  function isNestedConnection(nested, parent) {
@@ -54,14 +56,14 @@ function sortConnectionsByBoundaryHierarchy(connections, sort) {
54
56
  return _sortByBoundary(connections, sort ?? "asc");
55
57
  }
56
58
  function _sortByBoundary(connections, order) {
57
- return pipe(
59
+ return t(
58
60
  connections,
59
- map((conn) => ({
61
+ t$1((conn) => ({
60
62
  id: boundaryHierarchy(conn),
61
63
  conn
62
64
  })),
63
65
  sortNaturalByFqn(order),
64
- map((p) => p.conn)
66
+ t$1((p) => p.conn)
65
67
  );
66
68
  }
67
69
  function findAscendingConnections(connections, connection) {
@@ -248,7 +250,7 @@ class ConnectionModel {
248
250
  * Returns true if includes relations between nested elements of the source and target elements.
249
251
  */
250
252
  get isImplicit() {
251
- return this.nonEmpty() && isome(this.relations, isNot(hasSameSourceTarget(this)));
253
+ return this.nonEmpty() && isome(this.relations, e(hasSameSourceTarget(this)));
252
254
  }
253
255
  get directRelations() {
254
256
  return new Set(ifilter(this.relations, hasSameSourceTarget(this)));
@@ -298,7 +300,7 @@ class ConnectionModel {
298
300
  relations
299
301
  );
300
302
  }
301
- [customInspectSymbol](depth, inspectOptions, inspect) {
303
+ [customInspectSymbol](_depth, _inspectOptions, _inspect) {
302
304
  const asString = this.toString();
303
305
  Object.defineProperty(asString, "constructor", {
304
306
  value: ConnectionModel,
@@ -326,4 +328,4 @@ class ConnectionModel {
326
328
  }
327
329
  }
328
330
 
329
- export { ConnectionModel as C, findConnectionsBetween as a, findConnectionsWithin as b, findAscendingConnections as c, differenceConnections as d, findDeepestNestedConnection as e, findConnection as f, findDescendantConnections as g, hasSameSource as h, hasSameSourceTarget as i, hasSameTarget as j, isAnyInOut as k, isIncoming as l, isNestedConnection as m, isOutgoing as n, mergeConnections as o, sortDeepestFirst as p, modelConnection as q, sortConnectionsByBoundaryHierarchy as s };
331
+ export { ConnectionModel as C, findDeepestNestedConnection as a, findDescendantConnections as b, hasSameSourceTarget as c, differenceConnections as d, hasSameTarget as e, findAscendingConnections as f, isIncoming as g, hasSameSource as h, isAnyInOut as i, isNestedConnection as j, isOutgoing as k, sortDeepestFirst as l, mergeConnections as m, modelConnection as n, findConnectionsBetween as o, findConnection as p, findConnectionsWithin as q, sortConnectionsByBoundaryHierarchy as s };
@@ -10,89 +10,6 @@ function requireSupport () {
10
10
  return support;
11
11
  }
12
12
 
13
- /**
14
- * Obliterator ForEach Function
15
- * =============================
16
- *
17
- * Helper function used to easily iterate over mixed values.
18
- */
19
-
20
- var foreach;
21
- var hasRequiredForeach;
22
-
23
- function requireForeach () {
24
- if (hasRequiredForeach) return foreach;
25
- hasRequiredForeach = 1;
26
- var support = requireSupport();
27
-
28
- var ARRAY_BUFFER_SUPPORT = support.ARRAY_BUFFER_SUPPORT;
29
- var SYMBOL_SUPPORT = support.SYMBOL_SUPPORT;
30
-
31
- /**
32
- * Function able to iterate over almost any iterable JS value.
33
- *
34
- * @param {any} iterable - Iterable value.
35
- * @param {function} callback - Callback function.
36
- */
37
- foreach = function forEach(iterable, callback) {
38
- var iterator, k, i, l, s;
39
-
40
- if (!iterable) throw new Error('obliterator/forEach: invalid iterable.');
41
-
42
- if (typeof callback !== 'function')
43
- throw new Error('obliterator/forEach: expecting a callback.');
44
-
45
- // The target is an array or a string or function arguments
46
- if (
47
- Array.isArray(iterable) ||
48
- (ARRAY_BUFFER_SUPPORT && ArrayBuffer.isView(iterable)) ||
49
- typeof iterable === 'string' ||
50
- iterable.toString() === '[object Arguments]'
51
- ) {
52
- for (i = 0, l = iterable.length; i < l; i++) callback(iterable[i], i);
53
- return;
54
- }
55
-
56
- // The target has a #.forEach method
57
- if (typeof iterable.forEach === 'function') {
58
- iterable.forEach(callback);
59
- return;
60
- }
61
-
62
- // The target is iterable
63
- if (
64
- SYMBOL_SUPPORT &&
65
- Symbol.iterator in iterable &&
66
- typeof iterable.next !== 'function'
67
- ) {
68
- iterable = iterable[Symbol.iterator]();
69
- }
70
-
71
- // The target is an iterator
72
- if (typeof iterable.next === 'function') {
73
- iterator = iterable;
74
- i = 0;
75
-
76
- while (((s = iterator.next()), s.done !== true)) {
77
- callback(s.value, i);
78
- i++;
79
- }
80
-
81
- return;
82
- }
83
-
84
- // The target is a plain object
85
- for (k in iterable) {
86
- if (iterable.hasOwnProperty(k)) {
87
- callback(iterable[k], k);
88
- }
89
- }
90
-
91
- return;
92
- };
93
- return foreach;
94
- }
95
-
96
13
  /**
97
14
  * Obliterator Iterator Class
98
15
  * ===========================
@@ -198,4 +115,4 @@ function requireIterator () {
198
115
  return iterator;
199
116
  }
200
117
 
201
- export { requireForeach as a, requireSupport as b, requireIterator as r };
118
+ export { requireIterator as a, requireSupport as r };
@@ -1,6 +1,6 @@
1
- import { C as Connection, c as customInspectSymbol } from './core.D704WZES.mjs';
2
- import { E as ElementModel, R as RelationshipModel } from './core.CySf-2gP.mjs';
3
- import { A as Any, U as Unknown, C as EdgeId } from './core.D_fI5Lf6.mjs';
1
+ import { C as Connection, c as customInspectSymbol } from './core.DIol3syK.mjs';
2
+ import { E as ElementModel, R as RelationshipModel } from './core.D0PjZzIS.mjs';
3
+ import { A as Any, U as Unknown, v as EdgeId } from './core.Dgs6-nuz.mjs';
4
4
 
5
5
  /**
6
6
  * Connection refers to any relationships between two elements,
@@ -46,7 +46,7 @@ declare class ConnectionModel<A extends Any = Unknown> implements Connection<Ele
46
46
  * @returns A new `ConnectionModel` instance with the updated relations.
47
47
  */
48
48
  update(relations: ReadonlySet<RelationshipModel<A>>): ConnectionModel<A>;
49
- [customInspectSymbol](depth: any, inspectOptions: any, inspect: any): string;
49
+ [customInspectSymbol](_depth: any, _inspectOptions: any, _inspect: any): string;
50
50
  toString(): string;
51
51
  /**
52
52
  * Creates a new connection with reversed direction (target becomes source and vice versa)