@likec4/core 1.41.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 (255) 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 +13 -11
  5. package/dist/builder/index.mjs +111 -91
  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 +11 -11
  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.Ae86Y3tB.mjs → core.01VTr9qu.mjs} +8 -26
  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.DA5vzwZ9.mjs → core.BIqHjQiH.mjs} +56 -42
  25. package/dist/shared/core.BKlholso.mjs +3 -0
  26. package/dist/shared/core.BR4zXDH-.mjs +13 -0
  27. package/dist/shared/{core.CXy1NLUG.mjs → core.BYNkXQ8A.mjs} +21 -12
  28. package/dist/shared/{core.BuoXfSMj.mjs → core.BbE4y-yl.mjs} +1 -1
  29. package/dist/shared/core.BoYfZOBm.mjs +3 -0
  30. package/dist/shared/core.BsSXS-_R.mjs +7 -0
  31. package/dist/shared/{core.DJp8fgok.mjs → core.BzTakU3I.mjs} +14 -10
  32. package/dist/shared/{core.4u1dVmfX.mjs → core.C2TiyjI6.mjs} +2 -2
  33. package/dist/shared/{core.DLpidoWc.mjs → core.C3JowhaZ.mjs} +3 -3
  34. package/dist/shared/{core.CNGyqkJh.mjs → core.C4x8aaWa.mjs} +3 -1
  35. package/dist/shared/{core.BB6zA-UU.mjs → core.C8YY6Uub.mjs} +38 -9
  36. package/dist/shared/{core.Asc11Mjy.mjs → core.C8sl5Y8Z.mjs} +122 -58
  37. package/dist/shared/{core.BvMRMo7Z.mjs → core.CNgZvKb8.mjs} +3 -5198
  38. package/dist/shared/{core.CUG6vpyL.d.mts → core.CQngdcuj.d.mts} +85 -4
  39. package/dist/shared/{core.Be1n9a0i.mjs → core.C_Ni6yHl.mjs} +5 -4
  40. package/dist/shared/core.CbT8JVYL.mjs +5 -0
  41. package/dist/shared/core.CqAJJpK_.mjs +3 -0
  42. package/dist/shared/{core.BXsxn-hf.d.mts → core.D0PjZzIS.d.mts} +27 -15
  43. package/dist/shared/{core.DgesAwC8.d.mts → core.D5fzJWbF.d.mts} +2 -2
  44. package/dist/shared/{core.hfOE3RfK.d.mts → core.DACpKp35.d.mts} +5 -5
  45. package/dist/shared/core.DFi2dOTl.mjs +39548 -0
  46. package/dist/shared/{core.xSQO0XYD.d.mts → core.DIol3syK.d.mts} +2 -2
  47. package/dist/shared/{core.DlG1xWt2.mjs → core.DMMOWQqc.mjs} +3 -2
  48. package/dist/shared/core.DNbUPnve.mjs +3990 -0
  49. package/dist/shared/{core.CCD1ID81.mjs → core.DRJma0Ol.mjs} +4 -3
  50. package/dist/shared/{core.DgttqsJc.mjs → core.DRhg-gVU.mjs} +9 -9
  51. package/dist/shared/core.DSO_rTC2.mjs +5322 -0
  52. package/dist/shared/{core.FUPplpae.d.mts → core.D_vkffV4.d.mts} +4 -2
  53. package/dist/shared/core.DdMJk7nx.d.mts +476 -0
  54. package/dist/shared/{core.BhpgpOep.d.mts → core.Dgs6-nuz.d.mts} +2 -2
  55. package/dist/shared/{core.Be4Jy9Qx.mjs → core.FZ305VYd.mjs} +2 -2
  56. package/dist/shared/core.OHD4KXm9.mjs +5 -0
  57. package/dist/shared/{core.GTgsmXS_.mjs → core.QJD_fcrc.mjs} +2 -2
  58. package/dist/shared/core.RfnaEmgA.mjs +7 -0
  59. package/dist/shared/core.fHR_8Tnq.d.mts +450 -0
  60. package/dist/shared/{core.D0EgVMQK.mjs → core.lRvxPoao.mjs} +14 -12
  61. package/dist/shared/{core.CaT0SUUK.mjs → core.rCeaAqgW.mjs} +1 -84
  62. package/dist/shared/{core.zxTBF_PD.d.mts → core.s9uwOt60.d.mts} +4 -4
  63. package/dist/shared/core.yna0OdV5.d.mts +98 -0
  64. package/dist/styles/index.d.mts +106 -0
  65. package/dist/styles/index.mjs +1 -0
  66. package/dist/types/_aux.d.mts +2 -2
  67. package/dist/types/expression-model.d.mts +3 -4
  68. package/dist/types/expression.d.mts +3 -4
  69. package/dist/types/fqnRef.d.mts +2 -2
  70. package/dist/types/fqnRef.mjs +3 -3
  71. package/dist/types/index.d.mts +8 -8
  72. package/dist/types/index.mjs +150 -5
  73. package/dist/types/scalar.mjs +3 -2
  74. package/dist/utils/graphology/index.d.mts +1864 -0
  75. package/dist/utils/graphology/index.mjs +1 -0
  76. package/dist/utils/index.d.mts +11 -6
  77. package/dist/utils/index.mjs +21 -37
  78. package/dist/utils/iterable/index.d.mts +1 -1
  79. package/dist/utils/iterable/index.mjs +45 -7
  80. package/model/package.json +4 -0
  81. package/package.json +42 -24
  82. package/styles/package.json +4 -0
  83. package/types/package.json +4 -0
  84. package/utils/graphology/package.json +4 -0
  85. package/utils/package.json +4 -0
  86. package/dist/shared/core.6_Vp2iiN.mjs +0 -172
  87. package/dist/shared/core.CUw_2J9j.mjs +0 -47
  88. package/dist/shared/core.CzdwsPmY.d.mts +0 -69
  89. package/dist/shared/core.D-ZGWDDt.d.mts +0 -831
  90. package/dist/shared/core.DoM6aM9N.mjs +0 -7
  91. package/dist/shared/core.ILwny7BV.mjs +0 -38
  92. package/dist/theme/index.d.mts +0 -11
  93. package/dist/theme/index.mjs +0 -232
  94. package/src/builder/Builder.deployment.ts +0 -224
  95. package/src/builder/Builder.deploymentModel.ts +0 -449
  96. package/src/builder/Builder.element.ts +0 -241
  97. package/src/builder/Builder.model.ts +0 -494
  98. package/src/builder/Builder.ts +0 -946
  99. package/src/builder/Builder.view-common.ts +0 -273
  100. package/src/builder/Builder.view-deployment.ts +0 -135
  101. package/src/builder/Builder.view-element.ts +0 -202
  102. package/src/builder/Builder.views.ts +0 -399
  103. package/src/builder/Builder.with.ts +0 -156
  104. package/src/builder/_types.ts +0 -324
  105. package/src/builder/index.ts +0 -11
  106. package/src/compute-view/compute-view.ts +0 -80
  107. package/src/compute-view/deployment-view/_types.ts +0 -38
  108. package/src/compute-view/deployment-view/clean-connections.ts +0 -236
  109. package/src/compute-view/deployment-view/compute.ts +0 -94
  110. package/src/compute-view/deployment-view/memory/index.ts +0 -9
  111. package/src/compute-view/deployment-view/memory/memory.ts +0 -96
  112. package/src/compute-view/deployment-view/predicates/deploymentRefs-where.ts +0 -18
  113. package/src/compute-view/deployment-view/predicates/deploymentRefs.ts +0 -154
  114. package/src/compute-view/deployment-view/predicates/index.ts +0 -8
  115. package/src/compute-view/deployment-view/predicates/relation-direct.ts +0 -243
  116. package/src/compute-view/deployment-view/predicates/relation-in-out.ts +0 -70
  117. package/src/compute-view/deployment-view/predicates/relation-incoming.ts +0 -101
  118. package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +0 -95
  119. package/src/compute-view/deployment-view/predicates/relation-where.ts +0 -18
  120. package/src/compute-view/deployment-view/predicates/utils.ts +0 -282
  121. package/src/compute-view/deployment-view/predicates/wildcard.ts +0 -41
  122. package/src/compute-view/deployment-view/stages/stage-exclude.ts +0 -5
  123. package/src/compute-view/deployment-view/stages/stage-final.ts +0 -245
  124. package/src/compute-view/deployment-view/stages/stage-include.ts +0 -95
  125. package/src/compute-view/deployment-view/utils.ts +0 -297
  126. package/src/compute-view/dynamic-view/compute.ts +0 -312
  127. package/src/compute-view/element-view/_types.ts +0 -47
  128. package/src/compute-view/element-view/clean-connections.ts +0 -117
  129. package/src/compute-view/element-view/compute.ts +0 -324
  130. package/src/compute-view/element-view/memory/NodeGroup.ts +0 -31
  131. package/src/compute-view/element-view/memory/index.ts +0 -10
  132. package/src/compute-view/element-view/memory/memory.ts +0 -178
  133. package/src/compute-view/element-view/memory/stage-exclude.ts +0 -59
  134. package/src/compute-view/element-view/memory/stage-final.ts +0 -129
  135. package/src/compute-view/element-view/memory/stage-include.ts +0 -130
  136. package/src/compute-view/element-view/predicates/_utils.ts +0 -91
  137. package/src/compute-view/element-view/predicates/element-expand.ts +0 -29
  138. package/src/compute-view/element-view/predicates/element-kind-tag.ts +0 -27
  139. package/src/compute-view/element-view/predicates/element-ref.ts +0 -24
  140. package/src/compute-view/element-view/predicates/relation-direct.ts +0 -321
  141. package/src/compute-view/element-view/predicates/relation-in-out.ts +0 -64
  142. package/src/compute-view/element-view/predicates/relation-in.ts +0 -115
  143. package/src/compute-view/element-view/predicates/relation-out.ts +0 -119
  144. package/src/compute-view/element-view/predicates/wildcard.ts +0 -88
  145. package/src/compute-view/element-view/utils.ts +0 -65
  146. package/src/compute-view/index.ts +0 -4
  147. package/src/compute-view/memory/AbstractMemory.ts +0 -45
  148. package/src/compute-view/memory/AbstractStageExclude.ts +0 -215
  149. package/src/compute-view/memory/AbstractStageInclude.ts +0 -200
  150. package/src/compute-view/memory/_types.ts +0 -148
  151. package/src/compute-view/memory/index.ts +0 -5
  152. package/src/compute-view/memory/ops.ts +0 -43
  153. package/src/compute-view/relationships-view/_types.ts +0 -16
  154. package/src/compute-view/relationships-view/compute.ts +0 -159
  155. package/src/compute-view/relationships-view/index.ts +0 -3
  156. package/src/compute-view/relationships-view/layout.ts +0 -358
  157. package/src/compute-view/relationships-view/utils.ts +0 -73
  158. package/src/compute-view/utils/ancestorsOfNode.ts +0 -19
  159. package/src/compute-view/utils/applyCustomElementProperties.ts +0 -107
  160. package/src/compute-view/utils/applyCustomRelationProperties.ts +0 -58
  161. package/src/compute-view/utils/applyViewRuleStyles.ts +0 -73
  162. package/src/compute-view/utils/buildComputedNodes.ts +0 -166
  163. package/src/compute-view/utils/buildElementNotations.ts +0 -64
  164. package/src/compute-view/utils/elementExpressionToPredicate.ts +0 -50
  165. package/src/compute-view/utils/link-nodes-with-edges.ts +0 -56
  166. package/src/compute-view/utils/merge-props-from-relationships.ts +0 -161
  167. package/src/compute-view/utils/relationExpressionToPredicates.ts +0 -55
  168. package/src/compute-view/utils/resolve-extended-views.ts +0 -85
  169. package/src/compute-view/utils/resolve-global-rules.ts +0 -88
  170. package/src/compute-view/utils/topological-sort.ts +0 -256
  171. package/src/compute-view/utils/view-hash.ts +0 -45
  172. package/src/compute-view/utils/with-readable-edges.ts +0 -40
  173. package/src/index.ts +0 -32
  174. package/src/model/DeploymentElementModel.ts +0 -712
  175. package/src/model/DeploymentModel.ts +0 -393
  176. package/src/model/ElementModel.ts +0 -316
  177. package/src/model/LikeC4Model.ts +0 -882
  178. package/src/model/RelationModel.ts +0 -152
  179. package/src/model/connection/Connection.ts +0 -72
  180. package/src/model/connection/deployment/DeploymentConnectionModel.ts +0 -185
  181. package/src/model/connection/deployment/find.ts +0 -120
  182. package/src/model/connection/deployment/index.ts +0 -8
  183. package/src/model/connection/index.ts +0 -22
  184. package/src/model/connection/model/ConnectionModel.ts +0 -158
  185. package/src/model/connection/model/find.ts +0 -117
  186. package/src/model/connection/model/index.ts +0 -8
  187. package/src/model/connection/ops.ts +0 -276
  188. package/src/model/guards.ts +0 -77
  189. package/src/model/index.ts +0 -72
  190. package/src/model/types.ts +0 -67
  191. package/src/model/utils.ts +0 -66
  192. package/src/model/view/EdgeModel.ts +0 -121
  193. package/src/model/view/LikeC4ViewModel.ts +0 -361
  194. package/src/model/view/LikeC4ViewsFolder.ts +0 -151
  195. package/src/model/view/NodeModel.ts +0 -247
  196. package/src/theme/element.ts +0 -61
  197. package/src/theme/index.ts +0 -127
  198. package/src/theme/relationships.ts +0 -54
  199. package/src/types/RichText.ts +0 -205
  200. package/src/types/_aux.ts +0 -317
  201. package/src/types/_common.ts +0 -102
  202. package/src/types/const.ts +0 -34
  203. package/src/types/expression-model.ts +0 -294
  204. package/src/types/expression.ts +0 -313
  205. package/src/types/fqnRef.ts +0 -91
  206. package/src/types/geometry.ts +0 -159
  207. package/src/types/global.ts +0 -21
  208. package/src/types/index.ts +0 -44
  209. package/src/types/model-data.ts +0 -77
  210. package/src/types/model-deployment.ts +0 -78
  211. package/src/types/model-dump.ts +0 -79
  212. package/src/types/model-logical.ts +0 -126
  213. package/src/types/model-spec.ts +0 -88
  214. package/src/types/operators.ts +0 -156
  215. package/src/types/project.ts +0 -14
  216. package/src/types/scalar.ts +0 -162
  217. package/src/types/styles.ts +0 -122
  218. package/src/types/view-changes.ts +0 -32
  219. package/src/types/view-common.ts +0 -157
  220. package/src/types/view-computed.ts +0 -126
  221. package/src/types/view-layouted.ts +0 -94
  222. package/src/types/view-parsed.deployment.ts +0 -39
  223. package/src/types/view-parsed.dynamic.ts +0 -89
  224. package/src/types/view-parsed.element.ts +0 -65
  225. package/src/types/view.ts +0 -113
  226. package/src/utils/common-head.ts +0 -22
  227. package/src/utils/compare-natural.ts +0 -60
  228. package/src/utils/const.ts +0 -1
  229. package/src/utils/fqn.ts +0 -302
  230. package/src/utils/getOrCreate.ts +0 -8
  231. package/src/utils/guards.ts +0 -9
  232. package/src/utils/index.ts +0 -68
  233. package/src/utils/invariant.ts +0 -29
  234. package/src/utils/iterable/_types.ts +0 -5
  235. package/src/utils/iterable/filter.ts +0 -55
  236. package/src/utils/iterable/find.ts +0 -38
  237. package/src/utils/iterable/first.ts +0 -48
  238. package/src/utils/iterable/flat.ts +0 -17
  239. package/src/utils/iterable/head.ts +0 -22
  240. package/src/utils/iterable/index.ts +0 -15
  241. package/src/utils/iterable/map.ts +0 -40
  242. package/src/utils/iterable/reduce.ts +0 -24
  243. package/src/utils/iterable/some.ts +0 -36
  244. package/src/utils/iterable/to.ts +0 -19
  245. package/src/utils/iterable/unique.ts +0 -23
  246. package/src/utils/markdown/index.ts +0 -2
  247. package/src/utils/markdown/to-html.ts +0 -32
  248. package/src/utils/markdown/to-text.ts +0 -14
  249. package/src/utils/memoize-prop.ts +0 -30
  250. package/src/utils/mnemonist.ts +0 -9
  251. package/src/utils/object-hash.ts +0 -14
  252. package/src/utils/promises.ts +0 -24
  253. package/src/utils/relations.ts +0 -36
  254. package/src/utils/set.ts +0 -83
  255. package/src/utils/string-hash.ts +0 -16
@@ -0,0 +1 @@
1
+ export { G as Graph } from '../../shared/core.CNgZvKb8.mjs';
@@ -1,6 +1,6 @@
1
1
  export { D as DefaultMap } from '../shared/core.CywrQs86.mjs';
2
- export { B as BiMap, D as DefaultWeakMap, L as LinkedList, M as MultiMap, Q as Queue, a as ancestorsFqn, k as commonAncestor, l as compareByFqnHierarchically, o as compareFqnHierarchically, q as hierarchyDistance, r as hierarchyLevel, i as invariant, b as isAncestor, c as isDescendantOf, d as isNonEmptyArray, e as isSameHierarchy, f as isString, m as memoizeProp, n as nameFromFqn, h as nonNullable, g as nonexhaustive, p as parentFqn, t as sortByFqnHierarchically, s as sortNaturalByFqn, j as sortParentsFirst } from '../shared/core.FUPplpae.mjs';
3
- import { N as NonEmptyArray } from '../shared/core.DgesAwC8.mjs';
2
+ export { B as BiMap, D as DefaultWeakMap, L as LinkedList, M as MultiMap, Q as Queue, a as ancestorsFqn, l as commonAncestor, o as compareByFqnHierarchically, q as compareFqnHierarchically, h as hasProp, r as hierarchyDistance, t as hierarchyLevel, i as invariant, b as isAncestor, c as isDescendantOf, d as isNonEmptyArray, e as isSameHierarchy, f as isString, m as memoizeProp, n as nameFromFqn, j as nonNullable, g as nonexhaustive, p as parentFqn, u as sortByFqnHierarchically, s as sortNaturalByFqn, k as sortParentsFirst } from '../shared/core.D_vkffV4.mjs';
3
+ import { N as NonEmptyArray } from '../shared/core.D5fzJWbF.mjs';
4
4
  export { ifilter, ifind, ifirst, iflat, ihead, imap, ireduce, isome, iunique, toArray, toSet } from './iterable/index.mjs';
5
5
  export { i as isIterable } from '../shared/core.DXhDWKFZ.mjs';
6
6
  import '../shared/core.DX-WYEPA.mjs';
@@ -70,18 +70,19 @@ declare function delay(): Promise<string>;
70
70
  declare function delay(ms: number): Promise<string>;
71
71
  declare function delay(randomFrom: number, randomTo: number): Promise<string>;
72
72
  declare function promiseNextTick(): Promise<void>;
73
+ declare function onNextTick(fn: () => Promise<void> | void): void;
73
74
 
74
75
  type RelationshipLike = {
75
76
  source: {
76
- model: string;
77
+ id: string;
77
78
  };
78
79
  target: {
79
- model: string;
80
+ id: string;
80
81
  };
81
82
  };
82
83
  /**
83
84
  * Compares two relations hierarchically.
84
- * From the most general (implicit) to the most specific.
85
+ * From the most general (implicit) to the most specific (deepest in the tree)
85
86
  */
86
87
  declare const compareRelations: <T extends RelationshipLike>(a: T, b: T) => number;
87
88
 
@@ -95,6 +96,10 @@ declare function union<T>(...sets: ReadonlySet<T>[]): Set<T>;
95
96
  * Keeps order from the first set
96
97
  */
97
98
  declare function intersection<T>(first: ReadonlySet<T>, ...sets: NonEmptyArray<ReadonlySet<NoInfer<T>>>): Set<T>;
99
+ /**
100
+ * Returns new set as a difference of two sets (A-B)
101
+ * Keeps order from the first set
102
+ */
98
103
  declare function difference<T>(a: ReadonlySet<T>, b: ReadonlySet<NoInfer<T>>): Set<T>;
99
104
  declare function equals<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): boolean;
100
105
  declare function symmetricDifference<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): Set<T>;
@@ -115,4 +120,4 @@ declare function markdownToHtml(markdown: string): string;
115
120
  */
116
121
  declare function markdownToText(markdown: string): string;
117
122
 
118
- export { Stack, commonHead, compareNatural, compareNaturalHierarchically, compareRelations, delay, difference, equals as equalsSet, getOrCreate, intersection, markdownToHtml, markdownToText, objectHash, promiseNextTick, stringHash, symmetricDifference, union };
123
+ export { Stack, commonHead, compareNatural, compareNaturalHierarchically, compareRelations, delay, difference, equals as equalsSet, getOrCreate, intersection, markdownToHtml, markdownToText, objectHash, onNextTick, promiseNextTick, stringHash, symmetricDifference, union };
@@ -1,26 +1,27 @@
1
1
  export { i as invariant, a as nonNullable, n as nonexhaustive } from '../shared/core.D4npX2q8.mjs';
2
- export { S as Stack, c as commonHead, o as objectHash } from '../shared/core.BB6zA-UU.mjs';
3
- import { g as commonAncestor, h as compareFqnHierarchically } from '../shared/core.DgttqsJc.mjs';
4
- export { a as ancestorsFqn, l as compareByFqnHierarchically, j as compareNatural, k as compareNaturalHierarchically, m as hierarchyDistance, o as hierarchyLevel, i as isAncestor, b as isDescendantOf, c as isNonEmptyArray, d as isSameHierarchy, e as isString, n as nameFromFqn, p as parentFqn, q as sortByFqnHierarchically, s as sortNaturalByFqn, f as sortParentsFirst } from '../shared/core.DgttqsJc.mjs';
2
+ export { S as Stack, c as commonHead, a as compareRelations, o as objectHash } from '../shared/core.C8YY6Uub.mjs';
3
+ export { a as ancestorsFqn, k as commonAncestor, l as compareByFqnHierarchically, m as compareFqnHierarchically, g as compareNatural, j as compareNaturalHierarchically, h as hasProp, o as hierarchyDistance, q as hierarchyLevel, i as isAncestor, b as isDescendantOf, c as isNonEmptyArray, d as isSameHierarchy, e as isString, n as nameFromFqn, p as parentFqn, r as sortByFqnHierarchically, s as sortNaturalByFqn, f as sortParentsFirst } from '../shared/core.DRhg-gVU.mjs';
5
4
  export { g as getOrCreate } from '../shared/core.DcS-0zys.mjs';
6
- export { b as markdownToHtml, a as markdownToText, m as memoizeProp } from '../shared/core.CUw_2J9j.mjs';
7
- import { randomInteger } from 'remeda';
8
- export { d as difference, e as equalsSet, i as intersection, a as stringHash, s as symmetricDifference, u as union } from '../shared/core.4u1dVmfX.mjs';
9
- export { b as BiMap, d as DefaultWeakMap, l as LinkedList, m as MultiMap, q as Queue } from '../shared/core.DlG1xWt2.mjs';
10
- export { D as DefaultMap } from '../shared/core.BuoXfSMj.mjs';
11
- export { i as ifilter } from '../shared/core.CCD1ID81.mjs';
12
- export { i as ifind, a as ihead } from '../shared/core.GTgsmXS_.mjs';
13
- export { i as ifirst, a as ireduce } from '../shared/core.ILwny7BV.mjs';
14
- export { i as iflat, a as iunique } from '../shared/core.CNGyqkJh.mjs';
15
- export { i as imap, t as toArray, a as toSet } from '../shared/core.DLpidoWc.mjs';
16
- export { i as isIterable } from '../shared/core.DoM6aM9N.mjs';
17
- export { i as isome } from '../shared/core.Be4Jy9Qx.mjs';
5
+ export { m as memoizeProp } from '../shared/core.BR4zXDH-.mjs';
6
+ export { d as difference, e as equalsSet, i as intersection, a as stringHash, s as symmetricDifference, u as union } from '../shared/core.C2TiyjI6.mjs';
7
+ export { b as BiMap, d as DefaultWeakMap, l as LinkedList, m as MultiMap, q as Queue } from '../shared/core.DMMOWQqc.mjs';
8
+ export { D as DefaultMap } from '../shared/core.BbE4y-yl.mjs';
9
+ export { i as ifilter } from '../shared/core.DRJma0Ol.mjs';
10
+ export { i as ifind, a as ihead } from '../shared/core.QJD_fcrc.mjs';
11
+ export { ifirst, ireduce } from './iterable/index.mjs';
12
+ export { i as iflat, a as iunique } from '../shared/core.C4x8aaWa.mjs';
13
+ export { i as imap, a as toArray, t as toSet } from '../shared/core.C3JowhaZ.mjs';
14
+ export { i as isIterable } from '../shared/core.RfnaEmgA.mjs';
15
+ export { i as isome } from '../shared/core.FZ305VYd.mjs';
16
+ export { m as markdownToHtml, a as markdownToText } from '../shared/core.DFi2dOTl.mjs';
17
+
18
+ function e(e,t){let n=Math.ceil(e),r=Math.floor(t);if(r<n)throw RangeError(`randomInteger: The range [${e.toString()},${t.toString()}] contains no integer`);return Math.floor(Math.random()*(r-n+1)+n)}
18
19
 
19
20
  const DELAY = "LIKEC4_DELAY";
20
21
  function delay(...args) {
21
22
  let ms = 100;
22
23
  if (args.length === 2) {
23
- ms = randomInteger(args[0], args[1]);
24
+ ms = e(args[0], args[1]);
24
25
  } else if (args.length === 1) {
25
26
  ms = args[0];
26
27
  }
@@ -33,25 +34,8 @@ function delay(...args) {
33
34
  function promiseNextTick() {
34
35
  return Promise.resolve().then(() => void 0);
35
36
  }
37
+ function onNextTick(fn) {
38
+ void Promise.resolve().then(fn);
39
+ }
36
40
 
37
- const compareRelations = (a, b) => {
38
- const parentA = commonAncestor(a.source.model, a.target.model);
39
- const parentB = commonAncestor(b.source.model, b.target.model);
40
- if (parentA && !parentB) {
41
- return 1;
42
- }
43
- if (!parentA && parentB) {
44
- return -1;
45
- }
46
- const compareParents = parentA && parentB ? compareFqnHierarchically(parentA, parentB) : 0;
47
- if (compareParents !== 0) {
48
- return compareParents;
49
- }
50
- const compareSource = compareFqnHierarchically(a.source.model, b.source.model);
51
- if (compareSource !== 0) {
52
- return compareSource;
53
- }
54
- return compareFqnHierarchically(a.target.model, b.target.model);
55
- };
56
-
57
- export { commonAncestor, compareFqnHierarchically, compareRelations, delay, promiseNextTick };
41
+ export { delay, onNextTick, promiseNextTick };
@@ -1,5 +1,5 @@
1
1
  export { i as isIterable } from '../../shared/core.DXhDWKFZ.mjs';
2
- import { c as IteratorLike } from '../../shared/core.DgesAwC8.mjs';
2
+ import { c as IteratorLike } from '../../shared/core.D5fzJWbF.mjs';
3
3
  import 'type-fest';
4
4
 
5
5
  /**
@@ -1,7 +1,45 @@
1
- export { i as isIterable } from '../../shared/core.DoM6aM9N.mjs';
2
- export { i as ifilter } from '../../shared/core.CCD1ID81.mjs';
3
- export { i as ifind, a as ihead } from '../../shared/core.GTgsmXS_.mjs';
4
- export { i as ifirst, a as ireduce } from '../../shared/core.ILwny7BV.mjs';
5
- export { i as iflat, a as iunique } from '../../shared/core.CNGyqkJh.mjs';
6
- export { i as imap, t as toArray, a as toSet } from '../../shared/core.DLpidoWc.mjs';
7
- export { i as isome } from '../../shared/core.Be4Jy9Qx.mjs';
1
+ export { i as isIterable } from '../../shared/core.RfnaEmgA.mjs';
2
+ import { e } from '../../shared/core.DRJma0Ol.mjs';
3
+ export { i as ifilter } from '../../shared/core.DRJma0Ol.mjs';
4
+ export { i as ifind, a as ihead } from '../../shared/core.QJD_fcrc.mjs';
5
+ import { i as invariant } from '../../shared/core.D4npX2q8.mjs';
6
+ import { e as e$1 } from '../../shared/core.C4x8aaWa.mjs';
7
+ export { i as iflat, a as iunique } from '../../shared/core.C4x8aaWa.mjs';
8
+ export { i as imap, a as toArray, t as toSet } from '../../shared/core.C3JowhaZ.mjs';
9
+ export { i as isome } from '../../shared/core.FZ305VYd.mjs';
10
+
11
+ function ifirst(arg1, arg2) {
12
+ const count = arg2 ?? arg1;
13
+ invariant(typeof count === "number" && count >= 0, "Count must be a non-negative number");
14
+ function* _first(iter) {
15
+ let taken = 0;
16
+ for (const value of iter) {
17
+ if (taken >= count) {
18
+ break;
19
+ }
20
+ yield value;
21
+ taken++;
22
+ }
23
+ return;
24
+ }
25
+ if (arg2 === void 0) {
26
+ return (iterable) => _first(iterable);
27
+ }
28
+ return _first(arg1);
29
+ }
30
+
31
+ function ireduce(arg1, arg2, arg3) {
32
+ const reducer = e$1(arg3) ? arg2 : arg1;
33
+ const initialValue = arg3 ?? arg2;
34
+ invariant(e(reducer));
35
+ function _reduce(iter) {
36
+ let acc = initialValue;
37
+ for (const value of iter) {
38
+ acc = reducer(acc, value);
39
+ }
40
+ return acc;
41
+ }
42
+ return e$1(arg3) ? _reduce(arg1) : _reduce;
43
+ }
44
+
45
+ export { ifirst, ireduce };
@@ -0,0 +1,4 @@
1
+ {
2
+ "types": "../dist/model/index.d.mts",
3
+ "module": "../dist/model/index.mjs"
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/core",
3
- "version": "1.41.0",
3
+ "version": "1.42.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://likec4.dev",
6
6
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -13,7 +13,7 @@
13
13
  "bugs": "https://github.com/likec4/likec4/issues",
14
14
  "files": [
15
15
  "dist",
16
- "src",
16
+ "**/package.json",
17
17
  "!**/*.spec.ts",
18
18
  "!**/*.test-d.ts",
19
19
  "!**/__test__/*",
@@ -63,12 +63,12 @@
63
63
  "default": "./dist/model/index.mjs"
64
64
  }
65
65
  },
66
- "./utils": {
67
- "sources": "./src/utils/index.ts",
66
+ "./styles": {
67
+ "sources": "./src/styles/index.ts",
68
68
  "default": {
69
- "types": "./dist/utils/index.d.mts",
70
- "import": "./dist/utils/index.mjs",
71
- "default": "./dist/utils/index.mjs"
69
+ "types": "./dist/styles/index.d.mts",
70
+ "import": "./dist/styles/index.mjs",
71
+ "default": "./dist/styles/index.mjs"
72
72
  }
73
73
  },
74
74
  "./types": {
@@ -79,8 +79,22 @@
79
79
  "default": "./dist/types/index.mjs"
80
80
  }
81
81
  },
82
- "./src": "./src/index.ts",
83
- "./src/*": "./src/*",
82
+ "./utils/graphology": {
83
+ "sources": "./src/utils/graphology/index.ts",
84
+ "default": {
85
+ "types": "./dist/utils/graphology/index.d.mts",
86
+ "import": "./dist/utils/graphology/index.mjs",
87
+ "default": "./dist/utils/graphology/index.mjs"
88
+ }
89
+ },
90
+ "./utils": {
91
+ "sources": "./src/utils/index.ts",
92
+ "default": {
93
+ "types": "./dist/utils/index.d.mts",
94
+ "import": "./dist/utils/index.mjs",
95
+ "default": "./dist/utils/index.mjs"
96
+ }
97
+ },
84
98
  "./package.json": "./package.json"
85
99
  },
86
100
  "publishConfig": {
@@ -88,6 +102,10 @@
88
102
  "access": "public"
89
103
  },
90
104
  "dependencies": {
105
+ "type-fest": "^4.41.0"
106
+ },
107
+ "devDependencies": {
108
+ "unified": "11.0.5",
91
109
  "mdast-util-from-markdown": "^2.0.2",
92
110
  "mdast-util-to-string": "^4.0.0",
93
111
  "rehype-format": "5.0.1",
@@ -97,23 +115,19 @@
97
115
  "remark-gfm": "4.0.1",
98
116
  "remark-parse": "11.0.0",
99
117
  "remark-rehype": "11.1.2",
100
- "type-fest": "^4.41.0",
101
- "unified": "11.0.5",
102
- "chroma-js": "^3.1.2",
103
- "remeda": "^2.30.0",
104
- "defu": "^6.1.4",
105
- "@mantine/colors-generator": "8.2.8"
106
- },
107
- "devDependencies": {
108
- "@types/chroma-js": "^3.1.1",
109
118
  "@dagrejs/dagre": "1.1.5",
119
+ "@mantine/colors-generator": "8.3.1",
120
+ "@types/chroma-js": "^3.1.1",
110
121
  "@types/extend": "3.0.4",
111
122
  "@types/hast": "3.0.4",
112
123
  "@types/mdast": "4.0.4",
113
124
  "@types/natural-compare-lite": "^1.4.2",
125
+ "@types/node": "~20.19.11",
114
126
  "@types/object-hash": "^3.0.6",
115
127
  "@types/unist": "3.0.3",
116
- "@types/node": "~20.19.11",
128
+ "chroma-js": "^3.1.2",
129
+ "defu": "^6.1.4",
130
+ "fdir": "6.4.0",
117
131
  "graphology": "^0.25.4",
118
132
  "graphology-dag": "^0.4.1",
119
133
  "graphology-types": "^0.24.8",
@@ -121,12 +135,14 @@
121
135
  "natural-compare-lite": "^1.4.0",
122
136
  "object-hash": "^3.0.0",
123
137
  "obliterator": "^2.0.5",
124
- "fdir": "6.4.0",
125
- "turbo": "2.5.6",
138
+ "oxlint": "1.18.0",
139
+ "remeda": "^2.31.1",
140
+ "turbo": "2.5.8",
126
141
  "typescript": "5.9.2",
127
142
  "unbuild": "3.5.0",
128
143
  "vitest": "3.2.4",
129
- "@likec4/tsconfig": "1.41.0"
144
+ "@likec4/devops": "1.41.0",
145
+ "@likec4/tsconfig": "1.42.0"
130
146
  },
131
147
  "scripts": {
132
148
  "typecheck": "tsc -b --verbose",
@@ -135,7 +151,9 @@
135
151
  "lint:package": "pnpx publint ./package.tgz",
136
152
  "test": "vitest run --no-isolate",
137
153
  "test:watch": "vitest",
138
- "clean": "pnpm rimraf dist lib",
154
+ "clean": "likec4ops clean",
139
155
  "pack": "pnpm pack"
140
- }
156
+ },
157
+ "types": "dist/index.d.mts",
158
+ "module": "dist/index.mjs"
141
159
  }
@@ -0,0 +1,4 @@
1
+ {
2
+ "types": "../dist/styles/index.d.mts",
3
+ "module": "../dist/styles/index.mjs"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "types": "../dist/types/index.d.mts",
3
+ "module": "../dist/types/index.mjs"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "types": "../../dist/utils/graphology/index.d.mts",
3
+ "module": "../../dist/utils/graphology/index.mjs"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "types": "../dist/utils/index.d.mts",
3
+ "module": "../dist/utils/index.mjs"
4
+ }
@@ -1,172 +0,0 @@
1
- import { hasAtLeast } from 'remeda';
2
- import { i as invariant } from './core.D4npX2q8.mjs';
3
-
4
- var BBox;
5
- ((BBox2) => {
6
- function center({ x, y, width, height }) {
7
- return {
8
- x: x + width / 2,
9
- y: y + height / 2
10
- };
11
- }
12
- BBox2.center = center;
13
- function fromPoints(points) {
14
- const { x1, y1, x2, y2 } = RectBox.fromPoints(points);
15
- return {
16
- x: x1,
17
- y: y1,
18
- width: x2 - x1,
19
- height: y2 - y1
20
- };
21
- }
22
- BBox2.fromPoints = fromPoints;
23
- function merge(...boxes) {
24
- invariant(hasAtLeast(boxes, 1), "No boxes provided");
25
- if (boxes.length === 1) {
26
- return boxes[0];
27
- }
28
- let minX = Infinity;
29
- let minY = Infinity;
30
- let maxX = -Infinity;
31
- let maxY = -Infinity;
32
- for (const box of boxes) {
33
- minX = Math.min(minX, box.x);
34
- minY = Math.min(minY, box.y);
35
- maxX = Math.max(maxX, box.x + box.width);
36
- maxY = Math.max(maxY, box.y + box.height);
37
- }
38
- return {
39
- x: minX,
40
- y: minY,
41
- width: maxX - minX,
42
- height: maxY - minY
43
- };
44
- }
45
- BBox2.merge = merge;
46
- function toRectBox(box) {
47
- return {
48
- x1: box.x,
49
- y1: box.y,
50
- x2: box.x + box.width,
51
- y2: box.y + box.height
52
- };
53
- }
54
- BBox2.toRectBox = toRectBox;
55
- function expand(box, plus) {
56
- if (plus === 0) {
57
- return box;
58
- }
59
- return {
60
- x: box.x - plus,
61
- y: box.y - plus,
62
- width: box.width + plus * 2,
63
- height: box.height + plus * 2
64
- };
65
- }
66
- BBox2.expand = expand;
67
- function shrink(box, minus) {
68
- if (minus === 0) {
69
- return box;
70
- }
71
- return {
72
- x: box.x + minus,
73
- y: box.y + minus,
74
- width: box.width - minus * 2,
75
- height: box.height - minus * 2
76
- };
77
- }
78
- BBox2.shrink = shrink;
79
- })(BBox || (BBox = {}));
80
- var RectBox;
81
- ((RectBox2) => {
82
- function center({ x1, y1, x2, y2 }) {
83
- return {
84
- x: (x1 + x2) / 2,
85
- y: (y1 + y2) / 2
86
- };
87
- }
88
- RectBox2.center = center;
89
- function fromPoints(points) {
90
- invariant(points.length > 0, "At least one point is required");
91
- let minX = Infinity;
92
- let minY = Infinity;
93
- let maxX = -Infinity;
94
- let maxY = -Infinity;
95
- for (const [x, y] of points) {
96
- minX = Math.min(minX, x);
97
- minY = Math.min(minY, y);
98
- maxX = Math.max(maxX, x);
99
- maxY = Math.max(maxY, y);
100
- }
101
- return {
102
- x1: minX,
103
- y1: minY,
104
- x2: maxX,
105
- y2: maxY
106
- };
107
- }
108
- RectBox2.fromPoints = fromPoints;
109
- function merge(...boxes) {
110
- invariant(boxes.length > 0, "No boxes provided");
111
- let minX = Infinity;
112
- let minY = Infinity;
113
- let maxX = -Infinity;
114
- let maxY = -Infinity;
115
- for (const box of boxes) {
116
- minX = Math.min(minX, box.x1);
117
- minY = Math.min(minY, box.y1);
118
- maxX = Math.max(maxX, box.x2);
119
- maxY = Math.max(maxY, box.y2);
120
- }
121
- return {
122
- x1: minX,
123
- y1: minY,
124
- x2: maxX,
125
- y2: maxY
126
- };
127
- }
128
- RectBox2.merge = merge;
129
- function toBBox(box) {
130
- return {
131
- x: box.x1,
132
- y: box.y1,
133
- width: box.x2 - box.x1,
134
- height: box.y2 - box.y1
135
- };
136
- }
137
- RectBox2.toBBox = toBBox;
138
- })(RectBox || (RectBox = {}));
139
-
140
- function isTagColorSpecified(spec) {
141
- const color = typeof spec === "string" ? spec : spec.color;
142
- return color.startsWith("#") || color.startsWith("rgb");
143
- }
144
-
145
- const BorderStyles = ["solid", "dashed", "dotted", "none"];
146
- const ElementShapes = [
147
- "rectangle",
148
- "person",
149
- "browser",
150
- "mobile",
151
- "cylinder",
152
- "storage",
153
- "queue"
154
- ];
155
- const ThemeColors = [
156
- "amber",
157
- "blue",
158
- "gray",
159
- "slate",
160
- "green",
161
- "indigo",
162
- "muted",
163
- "primary",
164
- "red",
165
- "secondary",
166
- "sky"
167
- ];
168
- function isThemeColor(color) {
169
- return ThemeColors.includes(color);
170
- }
171
-
172
- export { BBox as B, ElementShapes as E, RectBox as R, ThemeColors as T, BorderStyles as a, isThemeColor as b, isTagColorSpecified as i };
@@ -1,47 +0,0 @@
1
- import rehypeRaw from 'rehype-raw';
2
- import rehypeSanitize from 'rehype-sanitize';
3
- import rehypeStringify from 'rehype-stringify';
4
- import remarkGfm from 'remark-gfm';
5
- import remarkParse from 'remark-parse';
6
- import remarkRehype from 'remark-rehype';
7
- import { unified } from 'unified';
8
- import { fromMarkdown } from 'mdast-util-from-markdown';
9
- import { toString } from 'mdast-util-to-string';
10
-
11
- function memoizeProp(obj, tag, fn) {
12
- const tagSymbol = typeof tag === "symbol" ? tag : Symbol.for(tag);
13
- if (!obj.hasOwnProperty(tagSymbol)) {
14
- Object.defineProperty(obj, tagSymbol, {
15
- enumerable: false,
16
- writable: false,
17
- value: fn()
18
- });
19
- }
20
- return obj[tagSymbol];
21
- }
22
-
23
- function remark() {
24
- return unified().use(remarkParse).use(remarkGfm).use(remarkRehype, {
25
- // Tight paragraphs prevent extra newlines
26
- allowDangerousHtml: true,
27
- clobberPrefix: "",
28
- tableCellPadding: false,
29
- tight: true
30
- }).use(rehypeRaw).use(rehypeSanitize).use(rehypeStringify, {
31
- // Prevent extra closing newlines
32
- closeSelfClosing: true,
33
- tightSelfClosing: true
34
- });
35
- }
36
- function markdownToHtml(markdown) {
37
- return String(remark().processSync(markdown.trim())).trim();
38
- }
39
-
40
- function markdownToText(markdown) {
41
- return toString(fromMarkdown(markdown), {
42
- includeHtml: false,
43
- includeImageAlt: false
44
- });
45
- }
46
-
47
- export { markdownToText as a, markdownToHtml as b, memoizeProp as m };
@@ -1,69 +0,0 @@
1
- import { TupleToUnion, Tagged } from 'type-fest';
2
-
3
- /**
4
- * For padding, margin, etc.
5
- */
6
- type SpacingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
7
- type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
8
- type ShapeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
- declare const BorderStyles: readonly ["solid", "dashed", "dotted", "none"];
10
- type BorderStyle = TupleToUnion<typeof BorderStyles>;
11
- declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue"];
12
- type ElementShape = TupleToUnion<typeof ElementShapes>;
13
- type HexColor = `#${string}`;
14
- type ColorLiteral = HexColor | `rgb(${number},${number},${number})` | `rgba(${number},${number},${number},${number})`;
15
- type CustomColor<T = string> = Tagged<T, 'CustomColor'>;
16
- type CustomColorDefinitions = {
17
- [key: string]: ThemeColorValues;
18
- };
19
- type RelationshipLineType = 'dashed' | 'solid' | 'dotted';
20
- type RelationshipArrowType = 'none' | 'normal' | 'onormal' | 'dot' | 'odot' | 'diamond' | 'odiamond' | 'crow' | 'open' | 'vee';
21
- declare const ThemeColors: readonly ["amber", "blue", "gray", "slate", "green", "indigo", "muted", "primary", "red", "secondary", "sky"];
22
- type ThemeColor = typeof ThemeColors[number];
23
- /**
24
- * Backward compatibility alias
25
- * @deprecated Use {@link ThemeColor} instead
26
- */
27
- type Color = ThemeColor | ColorLiteral;
28
- declare function isThemeColor(color: string): color is ThemeColor;
29
- interface ElementThemeColorValues {
30
- fill: ColorLiteral;
31
- stroke: ColorLiteral;
32
- hiContrast: ColorLiteral;
33
- loContrast: ColorLiteral;
34
- }
35
- type ElementThemeColors = {
36
- [key in ThemeColor]: ElementThemeColorValues;
37
- };
38
- interface RelationshipThemeColorValues {
39
- lineColor: ColorLiteral;
40
- labelBgColor: ColorLiteral;
41
- labelColor: ColorLiteral;
42
- }
43
- interface ThemeColorValues {
44
- elements: ElementThemeColorValues;
45
- relationships: RelationshipThemeColorValues;
46
- }
47
- type RelationshipThemeColors = {
48
- [key in ThemeColor]: RelationshipThemeColorValues;
49
- };
50
- interface LikeC4Theme {
51
- font: 'Arial';
52
- shadow: ColorLiteral;
53
- relationships: RelationshipThemeColors;
54
- elements: ElementThemeColors;
55
- sizes: {
56
- [key in ShapeSize]: {
57
- width: number;
58
- height: number;
59
- };
60
- };
61
- spacing: {
62
- [key in SpacingSize]: number;
63
- };
64
- textSizes: {
65
- [key in TextSize]: number;
66
- };
67
- }
68
-
69
- export { BorderStyles as B, type ColorLiteral as C, ElementShapes as E, type HexColor as H, type LikeC4Theme as L, type RelationshipLineType as R, type SpacingSize as S, type TextSize as T, type ShapeSize as a, type BorderStyle as b, type ElementShape as c, type CustomColor as d, type CustomColorDefinitions as e, type RelationshipArrowType as f, ThemeColors as g, type ThemeColor as h, type Color as i, isThemeColor as j, type ElementThemeColorValues as k, type ElementThemeColors as l, type RelationshipThemeColorValues as m, type ThemeColorValues as n, type RelationshipThemeColors as o };