@likec4/core 1.47.0 → 1.49.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 (152) hide show
  1. package/LICENSE +1 -1
  2. package/dist/THIRD-PARTY-LICENSES.md +1012 -0
  3. package/dist/_chunks/Builder.view-element.mjs +2 -0
  4. package/dist/_chunks/LikeC4Model.d.mts +1283 -0
  5. package/dist/_chunks/RichText.mjs +1 -0
  6. package/dist/_chunks/_types.d.mts +777 -0
  7. package/dist/_chunks/_types2.d.mts +36 -0
  8. package/dist/_chunks/assignTagColors.mjs +1 -0
  9. package/dist/_chunks/calcDriftsFromSnapshot.mjs +1 -0
  10. package/dist/_chunks/guards.d.mts +2026 -0
  11. package/dist/_chunks/guards.mjs +4 -0
  12. package/dist/_chunks/index.d.mts +288 -0
  13. package/dist/_chunks/libs/@mantine/colors-generator.mjs +15 -0
  14. package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
  15. package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -0
  16. package/dist/_chunks/libs/bail.mjs +1 -0
  17. package/dist/_chunks/libs/ccount.mjs +1 -0
  18. package/dist/_chunks/libs/character-entities-html4.mjs +1 -0
  19. package/dist/_chunks/libs/character-entities-legacy.mjs +1 -0
  20. package/dist/_chunks/libs/character-entities.mjs +2 -0
  21. package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -0
  22. package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -0
  23. package/dist/_chunks/libs/defu.mjs +1 -0
  24. package/dist/_chunks/libs/devlop.mjs +1 -0
  25. package/dist/_chunks/libs/escape-string-regexp.mjs +1 -0
  26. package/dist/_chunks/libs/extend.mjs +1 -0
  27. package/dist/_chunks/libs/graphology-dag.mjs +1 -0
  28. package/dist/_chunks/libs/graphology.mjs +1 -0
  29. package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -0
  30. package/dist/_chunks/libs/hast-util-to-html.mjs +9 -0
  31. package/dist/_chunks/libs/is-plain-obj.mjs +1 -0
  32. package/dist/_chunks/libs/longest-streak.mjs +1 -0
  33. package/dist/_chunks/libs/markdown-table.mjs +2 -0
  34. package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -0
  35. package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -0
  36. package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -0
  37. package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -0
  38. package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -0
  39. package/dist/_chunks/libs/mnemonist.d.mts +164 -0
  40. package/dist/_chunks/libs/mnemonist.mjs +1 -0
  41. package/dist/_chunks/libs/natural-compare-lite.mjs +9 -0
  42. package/dist/_chunks/libs/ohash.mjs +1 -0
  43. package/dist/_chunks/libs/rehype-sanitize.mjs +1 -0
  44. package/dist/_chunks/libs/rehype-stringify.mjs +1 -0
  45. package/dist/_chunks/libs/remark-gfm.mjs +1 -0
  46. package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -0
  47. package/dist/_chunks/libs/remark-parse.mjs +1 -0
  48. package/dist/_chunks/libs/remark-rehype.mjs +1 -0
  49. package/dist/_chunks/libs/remeda.mjs +1 -0
  50. package/dist/_chunks/libs/trough.mjs +1 -0
  51. package/dist/_chunks/libs/unified.mjs +1 -0
  52. package/dist/_chunks/rolldown-runtime.mjs +1 -0
  53. package/dist/_chunks/theme.d.mts +148 -0
  54. package/dist/_chunks/to-text.d.mts +404 -0
  55. package/dist/_chunks/to-text.mjs +1 -0
  56. package/dist/_chunks/vector.d.mts +198 -0
  57. package/dist/_chunks/vector.mjs +1 -0
  58. package/dist/builder/index.d.mts +5 -775
  59. package/dist/builder/index.mjs +1 -1053
  60. package/dist/compute-view/index.d.mts +156 -56
  61. package/dist/compute-view/index.mjs +2 -229
  62. package/dist/geometry/index.d.mts +2 -109
  63. package/dist/geometry/index.mjs +1 -328
  64. package/dist/index.d.mts +14 -20
  65. package/dist/index.mjs +1 -18
  66. package/dist/model/index.d.mts +5 -57
  67. package/dist/model/index.mjs +1 -4
  68. package/dist/styles/index.d.mts +3 -117
  69. package/dist/styles/index.mjs +1 -63
  70. package/dist/types/index.d.mts +3 -47
  71. package/dist/types/index.mjs +1 -17
  72. package/dist/utils/graphology/index.d.mts +2 -1864
  73. package/dist/utils/graphology/index.mjs +1 -1
  74. package/dist/utils/index.d.mts +4 -124
  75. package/dist/utils/index.mjs +1 -44
  76. package/package.json +20 -24
  77. package/compute-view/relationships/package.json +0 -4
  78. package/dist/compute-view/relationships-view/index.d.mts +0 -51
  79. package/dist/compute-view/relationships-view/index.mjs +0 -185
  80. package/dist/model/connection/deployment/index.d.mts +0 -15
  81. package/dist/model/connection/deployment/index.mjs +0 -2
  82. package/dist/model/connection/index.d.mts +0 -75
  83. package/dist/model/connection/index.mjs +0 -3
  84. package/dist/model/connection/model/index.d.mts +0 -15
  85. package/dist/model/connection/model/index.mjs +0 -2
  86. package/dist/shared/core.3ZhnKAlZ.mjs +0 -106
  87. package/dist/shared/core.78IWAHAE.mjs +0 -332
  88. package/dist/shared/core.B85MJLTf.mjs +0 -5
  89. package/dist/shared/core.BFd1lU9R.mjs +0 -29
  90. package/dist/shared/core.BKlholso.mjs +0 -3
  91. package/dist/shared/core.BNN-3vPH.mjs +0 -1255
  92. package/dist/shared/core.BPGOjone.d.mts +0 -46
  93. package/dist/shared/core.BP_QHEXs.mjs +0 -785
  94. package/dist/shared/core.BbE4y-yl.mjs +0 -177
  95. package/dist/shared/core.Bdy3hhTc.mjs +0 -28382
  96. package/dist/shared/core.BfCKSW-g.d.mts +0 -1266
  97. package/dist/shared/core.BhNcrwzK.mjs +0 -7
  98. package/dist/shared/core.BkVA6gjl.mjs +0 -5
  99. package/dist/shared/core.BoYfZOBm.mjs +0 -3
  100. package/dist/shared/core.BsSXS-_R.mjs +0 -7
  101. package/dist/shared/core.C3JowhaZ.mjs +0 -32
  102. package/dist/shared/core.C4x8aaWa.mjs +0 -27
  103. package/dist/shared/core.CAgYpDtM.d.mts +0 -98
  104. package/dist/shared/core.CHf8VEa3.mjs +0 -1206
  105. package/dist/shared/core.CLSZtnFh.mjs +0 -69
  106. package/dist/shared/core.C_3y3eqV.d.mts +0 -139
  107. package/dist/shared/core.CbT8JVYL.mjs +0 -5
  108. package/dist/shared/core.CdNCAwq7.mjs +0 -176
  109. package/dist/shared/core.CmGY9blO.mjs +0 -6717
  110. package/dist/shared/core.CmPXpJ8l.mjs +0 -21
  111. package/dist/shared/core.Coi_LOUZ.mjs +0 -7
  112. package/dist/shared/core.CqAJJpK_.mjs +0 -3
  113. package/dist/shared/core.CywrQs86.d.mts +0 -31
  114. package/dist/shared/core.D00YbOhQ.d.mts +0 -300
  115. package/dist/shared/core.D0WZutNd.mjs +0 -94
  116. package/dist/shared/core.D4npX2q8.mjs +0 -18
  117. package/dist/shared/core.DB0Ue5Wx.d.mts +0 -70
  118. package/dist/shared/core.DC5IAaDT.d.mts +0 -334
  119. package/dist/shared/core.DE9qzhn8.d.mts +0 -83
  120. package/dist/shared/core.DGcIbsj4.mjs +0 -3946
  121. package/dist/shared/core.DH7TXqXf.mjs +0 -136
  122. package/dist/shared/core.DKhRkHRN.d.mts +0 -41
  123. package/dist/shared/core.DRJma0Ol.mjs +0 -22
  124. package/dist/shared/core.DU5SRqNF.mjs +0 -2209
  125. package/dist/shared/core.DXhDWKFZ.d.mts +0 -3
  126. package/dist/shared/core.DbfO90vF.mjs +0 -434
  127. package/dist/shared/core.DcS-0zys.mjs +0 -10
  128. package/dist/shared/core.Dh119QSP.mjs +0 -4995
  129. package/dist/shared/core.DjcWextK.mjs +0 -1371
  130. package/dist/shared/core.Dojz4bvg.d.mts +0 -504
  131. package/dist/shared/core.FZ305VYd.mjs +0 -21
  132. package/dist/shared/core.OtRNdMxy.d.mts +0 -352
  133. package/dist/shared/core.RfnaEmgA.mjs +0 -7
  134. package/dist/shared/core.btEq3i3f.mjs +0 -300
  135. package/dist/shared/core.oSV6SRfk.mjs +0 -13
  136. package/dist/shared/core.om36dXXW.mjs +0 -41
  137. package/dist/shared/core.osFs8tU7.d.mts +0 -466
  138. package/dist/shared/core.q10OP9oJ.mjs +0 -5
  139. package/dist/shared/core.tpvDGvdC.d.mts +0 -87
  140. package/dist/shared/core.uFk_o9X6.mjs +0 -13
  141. package/dist/types/_aux.d.mts +0 -4
  142. package/dist/types/_aux.mjs +0 -8
  143. package/dist/types/expression-model.d.mts +0 -190
  144. package/dist/types/expression-model.mjs +0 -109
  145. package/dist/types/expression.d.mts +0 -6
  146. package/dist/types/expression.mjs +0 -113
  147. package/dist/types/fqnRef.d.mts +0 -60
  148. package/dist/types/fqnRef.mjs +0 -45
  149. package/dist/types/scalar.d.mts +0 -2
  150. package/dist/types/scalar.mjs +0 -4
  151. package/dist/utils/iterable/index.d.mts +0 -132
  152. package/dist/utils/iterable/index.mjs +0 -62
@@ -1 +1 @@
1
- export { G as Graph } from '../../shared/core.CmGY9blO.mjs';
1
+ import{t as Graph}from"../../_chunks/libs/graphology.mjs";export{Graph};
@@ -1,124 +1,4 @@
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, l as commonAncestor, o as compareByFqnHierarchically, q as compareFqnHierarchically, h as hasProp, r as hierarchyDistance, t as hierarchyLevel, i as invariant, b as isAncestor, v as isAnyOf, 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.OtRNdMxy.mjs';
3
- import { N as NonEmptyArray } from '../shared/core.DB0Ue5Wx.mjs';
4
- export { ifilter, ifind, ifirst, iflat, iflatMap, ihead, imap, ireduce, isome, iunique, toArray, toSet } from './iterable/index.mjs';
5
- export { i as isIterable } from '../shared/core.DXhDWKFZ.mjs';
6
- import '../shared/core.C_3y3eqV.mjs';
7
- import 'type-fest';
8
-
9
- /**
10
- * Mnemonist Stack Typings
11
- * ========================
12
- */
13
- declare class Stack<T> implements Iterable<T> {
14
-
15
- // Members
16
- size: number;
17
-
18
- // Constructor
19
- constructor();
20
-
21
- // Methods
22
- clear(): void;
23
- push(item: T): number;
24
- pop(): T | undefined;
25
- peek(): T | undefined;
26
- forEach(callback: (item: T, index: number, stack: this) => void, scope?: any): void;
27
- toArray(): Array<T>;
28
- values(): IterableIterator<T>;
29
- entries(): IterableIterator<[number, T]>;
30
- [Symbol.iterator](): IterableIterator<T>;
31
- toString(): string;
32
- toJSON(): Array<T>;
33
- inspect(): any;
34
-
35
- // Statics
36
- static from<I>(iterable: Iterable<I> | {[key: string]: I}): Stack<I>;
37
- static of<I>(...items: Array<I>): Stack<I>;
38
- }
39
-
40
- /**
41
- * Common head of two arrays
42
- *
43
- * @param equals - Equality function, defaults to `Object.is`
44
- */
45
- declare function commonHead<T>(sources: ReadonlyArray<T>, targets: ReadonlyArray<T>, equals?: (a: T, b: T) => boolean): T[];
46
-
47
- declare function compareNatural(a: string | undefined, b: string | undefined): -1 | 0 | 1;
48
- /**
49
- * Compares two strings lexicographically first, then hierarchically based on their depth.\
50
- * From parent nodes to leaves
51
- *
52
- * @example
53
- * const lines = [
54
- * 'b.c',
55
- * 'b',
56
- * 'a.b.c',
57
- * ]
58
- * lines.sort(compareNaturalHierarchically('.'))
59
- * // [
60
- * // 'a.b.c',
61
- * // 'b',
62
- * // 'b.c',
63
- * // ]
64
- */
65
- declare function compareNaturalHierarchically(separator?: string, deepestFirst?: boolean): (a: string | undefined, b: string | undefined) => number;
66
-
67
- declare function getOrCreate<K, V>(map: Map<K, V>, key: K, create: (key: K) => V): V;
68
- declare function getOrCreate<K extends WeakKey, V>(map: WeakMap<K, V>, key: K, create: (key: K) => V): V;
69
-
70
- declare function delay(): Promise<string>;
71
- declare function delay(ms: number): Promise<string>;
72
- declare function delay(randomFrom: number, randomTo: number): Promise<string>;
73
- declare function promiseNextTick(): Promise<void>;
74
- declare function onNextTick(fn: () => Promise<void> | void): void;
75
-
76
- type RelationshipLike = {
77
- source: {
78
- id: string;
79
- };
80
- target: {
81
- id: string;
82
- };
83
- };
84
- /**
85
- * Compares two relations hierarchically.
86
- * From the most general (implicit) to the most specific (deepest in the tree)
87
- */
88
- declare const compareRelations: <T extends RelationshipLike>(a: T, b: T) => number;
89
-
90
- /**
91
- * Returns new set as a union of given sets
92
- * Keeps order of elements
93
- */
94
- declare function union<T>(...sets: ReadonlySet<T>[]): Set<T>;
95
- /**
96
- * Returns new set as an intersection of all sets
97
- * Keeps order from the first set
98
- */
99
- declare function intersection<T>(first: ReadonlySet<T>, ...sets: NonEmptyArray<ReadonlySet<NoInfer<T>>>): Set<T>;
100
- /**
101
- * Returns new set as a difference of two sets (A-B)
102
- * Keeps order from the first set
103
- */
104
- declare function difference<T>(a: ReadonlySet<T>, b: ReadonlySet<NoInfer<T>>): Set<T>;
105
- declare function equals<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): boolean;
106
- declare function symmetricDifference<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): Set<T>;
107
-
108
- declare function objectHash(value: any): string;
109
-
110
- /**
111
- * @see https://gist.github.com/victor-homyakov/bcb7d7911e4a388b1c810f8c3ce17bcf
112
- */
113
- declare function stringHash(str: string): string;
114
-
115
- declare function markdownToHtml(markdown: string): string;
116
-
117
- /**
118
- * Converts markdown to plain text, removing any markdown formatting.
119
- * @param markdown - The markdown to convert.
120
- * @returns The plain text.
121
- */
122
- declare function markdownToText(markdown: string): string;
123
-
124
- export { Stack, commonHead, compareNatural, compareNaturalHierarchically, compareRelations, delay, difference, equals as equalsSet, getOrCreate, intersection, markdownToHtml, markdownToText, objectHash, onNextTick, promiseNextTick, stringHash, symmetricDifference, union };
1
+ import { a as isNonEmptyArray, o as isString } from "../_chunks/guards.mjs";
2
+ import { a as DefaultWeakMap, i as LinkedList, n as MultiMap, o as DefaultMap, r as Queue, t as Stack } from "../_chunks/libs/mnemonist.mjs";
3
+ import { A as commonAncestor, B as sortByFqnHierarchically, C as iflat, D as isIterable, E as ifilter, F as isAncestor, G as sortNatural, H as sortParentsFirst, I as isDescendantOf, J as nonNullable, K as commonHead, L as isSameHierarchy, M as compareFqnHierarchically, N as hierarchyDistance, O as getOrCreate, P as hierarchyLevel, R as nameFromFqn, S as iflatMap, T as ifind, U as compareNatural, V as sortNaturalByFqn, W as compareNaturalHierarchically, Y as nonexhaustive, _ as toSet, a as difference, b as imap, c as symmetricDifference, d as delay, f as onNextTick, g as toArray, h as iunique, i as objectHash, j as compareByFqnHierarchically, k as ancestorsFqn, l as union, m as memoizeProp, n as markdownToHtml, o as equals, p as promiseNextTick, q as invariant, r as stringHash, s as intersection, t as markdownToText, u as compareRelations, v as isome, w as ifirst, x as ihead, y as ireduce, z as parentFqn } from "../_chunks/to-text.mjs";
4
+ export { DefaultMap, DefaultWeakMap, LinkedList, MultiMap, Queue, Stack, ancestorsFqn, commonAncestor, commonHead, compareByFqnHierarchically, compareFqnHierarchically, compareNatural, compareNaturalHierarchically, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hierarchyDistance, hierarchyLevel, ifilter, ifind, ifirst, iflat, iflatMap, ihead, imap, intersection, invariant, ireduce, isAncestor, isDescendantOf, isIterable, isNonEmptyArray, isSameHierarchy, isString, isome, iunique, markdownToHtml, markdownToText, memoizeProp, nameFromFqn, nonNullable, nonexhaustive, objectHash, onNextTick, parentFqn, promiseNextTick, sortByFqnHierarchically, sortNatural, sortNaturalByFqn, sortParentsFirst, stringHash, symmetricDifference, toArray, toSet, union };
@@ -1,44 +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, a as compareRelations, o as objectHash } from '../shared/core.btEq3i3f.mjs';
3
- export { c as compareNatural, b as compareNaturalHierarchically } from '../shared/core.3ZhnKAlZ.mjs';
4
- export { a as ancestorsFqn, g as commonAncestor, j as compareByFqnHierarchically, k as compareFqnHierarchically, h as hasProp, l as hierarchyDistance, m as hierarchyLevel, i as isAncestor, q as isAnyOf, b as isDescendantOf, c as isNonEmptyArray, d as isSameHierarchy, e as isString, n as nameFromFqn, p as parentFqn, o as sortByFqnHierarchically, s as sortNaturalByFqn, f as sortParentsFirst } from '../shared/core.CdNCAwq7.mjs';
5
- export { g as getOrCreate } from '../shared/core.DcS-0zys.mjs';
6
- export { m as memoizeProp } from '../shared/core.CLSZtnFh.mjs';
7
- export { d as difference, e as equalsSet, i as intersection, s as symmetricDifference, u as union } from '../shared/core.DbfO90vF.mjs';
8
- export { s as stringHash } from '../shared/core.oSV6SRfk.mjs';
9
- export { b as BiMap, d as DefaultWeakMap, l as LinkedList, m as MultiMap, q as Queue } from '../shared/core.BNN-3vPH.mjs';
10
- export { D as DefaultMap } from '../shared/core.BbE4y-yl.mjs';
11
- export { i as ifilter } from '../shared/core.DRJma0Ol.mjs';
12
- export { i as ifind } from '../shared/core.CmPXpJ8l.mjs';
13
- export { ifirst, iflatMap, ireduce } from './iterable/index.mjs';
14
- export { i as iflat, a as iunique } from '../shared/core.C4x8aaWa.mjs';
15
- export { i as ihead } from '../shared/core.uFk_o9X6.mjs';
16
- export { i as imap, a as toArray, t as toSet } from '../shared/core.C3JowhaZ.mjs';
17
- export { i as isIterable } from '../shared/core.RfnaEmgA.mjs';
18
- export { i as isome } from '../shared/core.FZ305VYd.mjs';
19
- export { m as markdownToHtml, a as markdownToText } from '../shared/core.Bdy3hhTc.mjs';
20
-
21
- 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)}
22
-
23
- const DELAY = "LIKEC4_DELAY";
24
- function delay(...args) {
25
- let ms = 100;
26
- if (args.length === 2) {
27
- ms = e(args[0], args[1]);
28
- } else if (args.length === 1) {
29
- ms = args[0];
30
- }
31
- return new Promise((resolve) => {
32
- setTimeout(() => {
33
- resolve(DELAY);
34
- }, ms ?? 100);
35
- });
36
- }
37
- function promiseNextTick() {
38
- return Promise.resolve().then(() => void 0);
39
- }
40
- function onNextTick(fn) {
41
- void Promise.resolve().then(fn);
42
- }
43
-
44
- export { delay, onNextTick, promiseNextTick };
1
+ import"../_chunks/libs/defu.mjs";import{$ as nonNullable,A as ancestorsFqn,B as parentFqn,C as iflatMap,D as ifilter,E as ifind,F as hierarchyLevel,H as sortNaturalByFqn,I as isAncestor,J as compareNatural,K as isNonEmptyArray,L as isDescendantOf,M as compareByFqnHierarchically,N as compareFqnHierarchically,O as isIterable,P as hierarchyDistance,Q as invariant,R as isSameHierarchy,S as ihead,T as ifirst,U as sortParentsFirst,V as sortByFqnHierarchically,X as sortNatural,Y as compareNaturalHierarchically,Z as commonHead,_ as toArray,a as difference,b as ireduce,c as intersection,d as compareRelations,et as nonexhaustive,f as delay,g as iunique,h as memoizeProp,i as objectHash,j as commonAncestor,k as getOrCreate,l as symmetricDifference,m as promiseNextTick,n as markdownToHtml,o as equals,p as onNextTick,q as isString,r as stringHash,t as markdownToText,u as union,v as toSet,w as iflat,x as imap,y as isome,z as nameFromFqn}from"../_chunks/to-text.mjs";import"../_chunks/libs/graphology-dag.mjs";import{a as import_multi_map,c as import_stack,n as import_default_weak_map,o as import_queue,r as import_linked_list,t as import_default_map}from"../_chunks/libs/mnemonist.mjs";import"../_chunks/libs/natural-compare-lite.mjs";import"../_chunks/libs/extend.mjs";var DefaultMap=import_default_map.default,DefaultWeakMap=import_default_weak_map.default,LinkedList=import_linked_list.default,MultiMap=import_multi_map.default,Queue=import_queue.default,Stack=import_stack.default;export{DefaultMap,DefaultWeakMap,LinkedList,MultiMap,Queue,Stack,ancestorsFqn,commonAncestor,commonHead,compareByFqnHierarchically,compareFqnHierarchically,compareNatural,compareNaturalHierarchically,compareRelations,delay,difference,equals as equalsSet,getOrCreate,hierarchyDistance,hierarchyLevel,ifilter,ifind,ifirst,iflat,iflatMap,ihead,imap,intersection,invariant,ireduce,isAncestor,isDescendantOf,isIterable,isNonEmptyArray,isSameHierarchy,isString,isome,iunique,markdownToHtml,markdownToText,memoizeProp,nameFromFqn,nonNullable,nonexhaustive,objectHash,onNextTick,parentFqn,promiseNextTick,sortByFqnHierarchically,sortNatural,sortNaturalByFqn,sortParentsFirst,stringHash,symmetricDifference,toArray,toSet,union};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/core",
3
- "version": "1.47.0",
3
+ "version": "1.49.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://likec4.dev",
6
6
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -47,14 +47,6 @@
47
47
  "default": "./dist/geometry/index.mjs"
48
48
  }
49
49
  },
50
- "./compute-view/relationships": {
51
- "sources": "./src/compute-view/relationships-view/index.ts",
52
- "default": {
53
- "types": "./dist/compute-view/relationships-view/index.d.mts",
54
- "import": "./dist/compute-view/relationships-view/index.mjs",
55
- "default": "./dist/compute-view/relationships-view/index.mjs"
56
- }
57
- },
58
50
  "./compute-view": {
59
51
  "sources": "./src/compute-view/index.ts",
60
52
  "default": {
@@ -110,34 +102,37 @@
110
102
  "access": "public"
111
103
  },
112
104
  "dependencies": {
113
- "type-fest": "^4.41.0"
105
+ "immer": "^11.1.3",
106
+ "type-fest": "^4.41.0",
107
+ "zod": "^3.25.76"
114
108
  },
115
109
  "devDependencies": {
116
110
  "@dagrejs/dagre": "1.1.8",
117
- "@mantine/colors-generator": "8.3.10",
111
+ "@mantine/colors-generator": "8.3.14",
112
+ "@rolldown/plugin-node-polyfills": "^1.0.3",
118
113
  "@types/chroma-js": "^3.1.2",
119
114
  "@types/extend": "3.0.4",
120
115
  "@types/hast": "3.0.4",
121
116
  "@types/mdast": "4.0.4",
122
117
  "@types/natural-compare-lite": "^1.4.2",
123
- "@types/node": "~22.19.3",
124
- "@types/object-hash": "^3.0.6",
118
+ "@types/node": "~22.19.10",
125
119
  "@types/unist": "3.0.3",
120
+ "@typescript/native-preview": "7.0.0-dev.20260208.1",
126
121
  "chroma-js": "^3.2.0",
127
122
  "defu": "^6.1.4",
128
123
  "fdir": "6.4.0",
129
124
  "graphology": "^0.26.0",
130
125
  "graphology-dag": "^0.4.1",
131
126
  "graphology-types": "^0.24.8",
132
- "immer": "^11.1.0",
133
127
  "mdast-util-from-markdown": "^2.0.2",
134
- "mdast-util-to-string": "^4.0.0",
135
128
  "mdast-util-to-hast": "^13.2.1",
129
+ "mdast-util-to-string": "^4.0.0",
136
130
  "mnemonist": "0.40.3",
137
131
  "natural-compare-lite": "^1.4.0",
138
- "object-hash": "^3.0.0",
139
132
  "obliterator": "^2.0.5",
140
- "oxlint": "1.35.0",
133
+ "obuild": "^0.4.27",
134
+ "ohash": "^2.0.11",
135
+ "oxlint": "1.43.0",
141
136
  "rehype-format": "5.0.1",
142
137
  "rehype-sanitize": "^6.0.0",
143
138
  "rehype-stringify": "10.0.1",
@@ -145,19 +140,20 @@
145
140
  "remark-github-blockquote-alert": "^2.0.1",
146
141
  "remark-parse": "11.0.0",
147
142
  "remark-rehype": "11.1.2",
148
- "remeda": "^2.32.0",
149
- "turbo": "2.7.2",
143
+ "remeda": "^2.33.5",
144
+ "turbo": "2.8.3",
150
145
  "typescript": "5.9.3",
151
- "unbuild": "3.5.0",
152
146
  "unified": "11.0.5",
153
- "vitest": "4.0.16",
147
+ "vitest": "4.0.18",
148
+ "@likec4/styles": "1.49.0",
149
+ "@likec4/style-preset": "1.49.0",
154
150
  "@likec4/devops": "1.42.0",
155
- "@likec4/tsconfig": "1.46.1"
151
+ "@likec4/tsconfig": "1.49.0"
156
152
  },
157
153
  "scripts": {
158
154
  "typecheck": "tsc -b --verbose",
159
- "build": "unbuild",
160
- "lint": "run -T eslint src/ --fix",
155
+ "build": "obuild",
156
+ "lint": "oxlint --type-aware",
161
157
  "lint:package": "pnpx publint ./package.tgz",
162
158
  "test": "vitest run --no-isolate",
163
159
  "test:watch": "vitest",
@@ -1,4 +0,0 @@
1
- {
2
- "types": "../../dist/compute-view/relationships-view/index.d.mts",
3
- "module": "../../dist/compute-view/relationships-view/index.mjs"
4
- }
@@ -1,51 +0,0 @@
1
- import { A as Any, U as Unknown, a as ElementId, V as ViewId } from '../../shared/core.D00YbOhQ.mjs';
2
- import { E as ElementModel, R as RelationshipModel, f as LikeC4Model } from '../../shared/core.BfCKSW-g.mjs';
3
- import 'type-fest';
4
- import '../../shared/core.DB0Ue5Wx.mjs';
5
- import '../../shared/core.C_3y3eqV.mjs';
6
- import '../../shared/core.CAgYpDtM.mjs';
7
- import '../../shared/core.DC5IAaDT.mjs';
8
- import '../../types/fqnRef.mjs';
9
- import '../../shared/core.Dojz4bvg.mjs';
10
- import '../../types/expression-model.mjs';
11
- import '../../shared/core.BPGOjone.mjs';
12
- import '../../shared/core.CywrQs86.mjs';
13
- import '../../shared/core.osFs8tU7.mjs';
14
-
15
- type RelationshipsViewData<M extends Any = Unknown> = {
16
- incomers: ReadonlySet<ElementModel<M>>;
17
- incoming: ReadonlySet<RelationshipModel<M>>;
18
- subjects: ReadonlySet<ElementModel<M>>;
19
- outgoing: ReadonlySet<RelationshipModel<M>>;
20
- outgoers: ReadonlySet<ElementModel<M>>;
21
- };
22
-
23
- declare function computeRelationshipsView<M extends Any>(subjectId: ElementId<M>, likec4model: LikeC4Model<M>, scopeViewId: ViewId<M> | null, scope?: 'global' | 'view'): RelationshipsViewData<M>;
24
-
25
- declare function treeFromElements<M extends Any>(elements: Iterable<ElementModel<M>>): {
26
- sorted: readonly ElementModel<M>[];
27
- byId: (id: ElementId<M>) => ElementModel<M>;
28
- root: ReadonlySet<ElementModel<M>>;
29
- parent: (el: ElementModel<M>) => ElementModel<M> | null;
30
- children: (el: ElementModel<M>) => ReadonlyArray<ElementModel<M>>;
31
- /**
32
- * Flattens the tree structure by removing redundant hierarchy levels.
33
- * @example
34
- * A
35
- * └── B
36
- * ├── C
37
- * │ └── D
38
- * │ └── E
39
- * └── F
40
- * └── G
41
- * becomes
42
- * A
43
- * ├── C
44
- * │ └── E
45
- * └── F
46
- * └── G
47
- */
48
- flatten: () => Set<ElementModel<M>>;
49
- };
50
-
51
- export { type RelationshipsViewData, computeRelationshipsView, treeFromElements };
@@ -1,185 +0,0 @@
1
- import { t } from '../../shared/core.3ZhnKAlZ.mjs';
2
- import { f as sortParentsFirst, b as isDescendantOf, i as isAncestor } from '../../shared/core.CdNCAwq7.mjs';
3
- import { D as DefaultMap } from '../../shared/core.BbE4y-yl.mjs';
4
- import { a as nonNullable, i as invariant } from '../../shared/core.D4npX2q8.mjs';
5
- import { t as toSet, a as toArray, i as imap } from '../../shared/core.C3JowhaZ.mjs';
6
- import { i as ifilter } from '../../shared/core.DRJma0Ol.mjs';
7
-
8
- function treeFromElements(elements) {
9
- const sorted = sortParentsFirst([...elements]);
10
- const root = new Set(sorted);
11
- const map = new Map(sorted.map((e) => [e._literalId, e]));
12
- const parents = new DefaultMap(() => null);
13
- const children = sorted.reduce((acc, parent, index, all) => {
14
- acc.set(
15
- parent,
16
- all.slice(index + 1).filter(isDescendantOf(parent)).map((e) => {
17
- root.delete(e);
18
- return e;
19
- }).reduce((acc2, el) => {
20
- if (!acc2.some(isAncestor(el))) {
21
- acc2.push(el);
22
- parents.set(el, parent);
23
- }
24
- return acc2;
25
- }, [])
26
- );
27
- return acc;
28
- }, new DefaultMap(() => []));
29
- return {
30
- sorted,
31
- byId: (id) => nonNullable(map.get(id), `Element not found by id: ${id}`),
32
- root,
33
- parent: (el) => parents.get(el),
34
- children: (el) => children.get(el),
35
- /**
36
- * Flattens the tree structure by removing redundant hierarchy levels.
37
- * @example
38
- * A
39
- * └── B
40
- * ├── C
41
- * │ └── D
42
- * │ └── E
43
- * └── F
44
- * └── G
45
- * becomes
46
- * A
47
- * ├── C
48
- * │ └── E
49
- * └── F
50
- * └── G
51
- */
52
- flatten: () => {
53
- return /* @__PURE__ */ new Set([
54
- ...root,
55
- ...sorted.reduce((acc, el) => {
56
- const _children = children.get(el);
57
- if (_children.length === 0) {
58
- acc.push(el);
59
- return acc;
60
- }
61
- if (_children.length > 1) {
62
- acc.push(..._children);
63
- }
64
- return acc;
65
- }, [])
66
- ]);
67
- }
68
- };
69
- }
70
-
71
- const finalize = (elements, explicits) => {
72
- if (elements.size > 2 && explicits.size !== elements.size) {
73
- return new Set(sortParentsFirst([
74
- ...treeFromElements(elements).flatten(),
75
- ...explicits
76
- ]));
77
- }
78
- if (elements.size > 1) {
79
- return new Set(sortParentsFirst([...elements]));
80
- }
81
- return elements;
82
- };
83
- function computeRelationships(subject, others, relationships) {
84
- const isOther = (e) => others.has(e);
85
- let subjects = /* @__PURE__ */ new Set([subject]);
86
- const explicits = {
87
- incomers: /* @__PURE__ */ new Set(),
88
- subjects: /* @__PURE__ */ new Set([subject]),
89
- outgoers: /* @__PURE__ */ new Set()
90
- };
91
- let incomers = new Set(relationships.incoming.flatMap((r) => {
92
- explicits.subjects.add(r.target);
93
- explicits.incomers.add(r.source);
94
- subjects.add(r.target);
95
- if (r.target !== subject) {
96
- let target = r.target.parent;
97
- while (target && target !== subject) {
98
- subjects.add(target);
99
- target = target.parent;
100
- }
101
- }
102
- let source = r.source;
103
- const incomerBranch = [];
104
- while (true) {
105
- incomerBranch.push(source);
106
- if (isOther(source) || !source.parent) {
107
- break;
108
- }
109
- source = source.parent;
110
- }
111
- return incomerBranch;
112
- }));
113
- let outgoers = new Set(relationships.outgoing.flatMap((r) => {
114
- explicits.subjects.add(r.source);
115
- explicits.outgoers.add(r.target);
116
- subjects.add(r.source);
117
- if (r.source !== subject) {
118
- let source = r.source.parent;
119
- while (source && source !== subject) {
120
- subjects.add(source);
121
- source = source.parent;
122
- }
123
- }
124
- let target = r.target;
125
- const outgoerBranch = [];
126
- while (true) {
127
- outgoerBranch.push(target);
128
- if (isOther(target) || !target.parent) {
129
- break;
130
- }
131
- target = target.parent;
132
- }
133
- return outgoerBranch;
134
- }));
135
- return {
136
- incomers: finalize(incomers, explicits.incomers),
137
- incoming: new Set(relationships.incoming),
138
- subjects: finalize(subjects, explicits.subjects),
139
- outgoing: new Set(relationships.outgoing),
140
- outgoers: finalize(outgoers, explicits.outgoers)
141
- };
142
- }
143
- function computeRelationshipsView(subjectId, likec4model, scopeViewId, scope = "global") {
144
- const view = scopeViewId ? likec4model.findView(scopeViewId) : null;
145
- if (scope === "view") {
146
- invariant(
147
- view,
148
- 'Scope view id is required when scope is "view"'
149
- );
150
- return computeScopedRelationshipsView(subjectId, view, likec4model);
151
- }
152
- const subject = likec4model.element(subjectId);
153
- const subjectSiblings = toSet(subject.ascendingSiblings());
154
- return computeRelationships(
155
- subject,
156
- subjectSiblings,
157
- {
158
- incoming: [...subject.incoming()],
159
- outgoing: [...subject.outgoing()]
160
- }
161
- );
162
- }
163
- function computeScopedRelationshipsView(subjectId, view, likec4model) {
164
- const subject = likec4model.element(subjectId);
165
- let relationships = {
166
- incoming: toArray(ifilter(subject.incoming(), (r) => view.includesRelation(r.id))),
167
- outgoing: toArray(ifilter(subject.outgoing(), (r) => view.includesRelation(r.id)))
168
- };
169
- const isDescendant = isDescendantOf(subject);
170
- const others = /* @__PURE__ */ new Set([
171
- ...subject.ascendingSiblings(),
172
- ...t(
173
- view.elements(),
174
- imap((e) => e.element),
175
- ifilter((e) => e !== subject && isDescendant(e))
176
- )
177
- ]);
178
- return computeRelationships(
179
- subject,
180
- others,
181
- relationships
182
- );
183
- }
184
-
185
- export { computeRelationshipsView, treeFromElements };
@@ -1,15 +0,0 @@
1
- export { C as Connection } from '../../../shared/core.DKhRkHRN.mjs';
2
- export { D as DeploymentConnectionModel, a as findConnection, b as findConnectionsBetween, c as findConnectionsWithin } from '../../../shared/core.tpvDGvdC.mjs';
3
- import '../../../shared/core.BfCKSW-g.mjs';
4
- import 'type-fest';
5
- import '../../../shared/core.CAgYpDtM.mjs';
6
- import '../../../shared/core.DC5IAaDT.mjs';
7
- import '../../../shared/core.D00YbOhQ.mjs';
8
- import '../../../shared/core.DB0Ue5Wx.mjs';
9
- import '../../../shared/core.C_3y3eqV.mjs';
10
- import '../../../types/fqnRef.mjs';
11
- import '../../../shared/core.Dojz4bvg.mjs';
12
- import '../../../types/expression-model.mjs';
13
- import '../../../shared/core.BPGOjone.mjs';
14
- import '../../../shared/core.CywrQs86.mjs';
15
- import '../../../shared/core.osFs8tU7.mjs';
@@ -1,2 +0,0 @@
1
- export { C as Connection } from '../../../shared/core.BFd1lU9R.mjs';
2
- export { D as DeploymentConnectionModel, f as findConnection, g as findConnectionsBetween, h as findConnectionsWithin } from '../../../shared/core.BP_QHEXs.mjs';
@@ -1,75 +0,0 @@
1
- import { C as Connection } from '../../shared/core.DKhRkHRN.mjs';
2
- export { D as DeploymentConnectionModel, f as deployment } from '../../shared/core.tpvDGvdC.mjs';
3
- export { C as ConnectionModel, f as model } from '../../shared/core.DE9qzhn8.mjs';
4
- import { I as IterableContainer, R as ReorderedArray } from '../../shared/core.DB0Ue5Wx.mjs';
5
- import '../../shared/core.BfCKSW-g.mjs';
6
- import 'type-fest';
7
- import '../../shared/core.CAgYpDtM.mjs';
8
- import '../../shared/core.DC5IAaDT.mjs';
9
- import '../../shared/core.D00YbOhQ.mjs';
10
- import '../../shared/core.C_3y3eqV.mjs';
11
- import '../../types/fqnRef.mjs';
12
- import '../../shared/core.Dojz4bvg.mjs';
13
- import '../../types/expression-model.mjs';
14
- import '../../shared/core.BPGOjone.mjs';
15
- import '../../shared/core.CywrQs86.mjs';
16
- import '../../shared/core.osFs8tU7.mjs';
17
-
18
- /**
19
- * Check if connection is nested inside another connection
20
- * (i.e. between descendants)
21
- */
22
- declare function isNestedConnection<T extends {
23
- id: string;
24
- }>(parent: WithSourceTarget<NoInfer<T>>): (nested: WithSourceTarget<T>) => boolean;
25
- declare function isNestedConnection<T extends {
26
- id: string;
27
- }>(nested: WithSourceTarget<T>, parent: WithSourceTarget<T>): boolean;
28
- type ConnectionElemId = Connection<{
29
- readonly id: string;
30
- }, any>;
31
- declare function findDeepestNestedConnection<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): C | null;
32
- declare function sortDeepestFirst<C extends ConnectionElemId>(connections: ReadonlyArray<C>): C[];
33
- type WithBoundary = {
34
- id: string;
35
- boundary: null | {
36
- id: string;
37
- };
38
- };
39
- declare function sortConnectionsByBoundaryHierarchy(sort?: 'asc' | 'desc'): <T extends WithBoundary, A extends IterableContainer<T>>(array: A) => ReorderedArray<A>;
40
- declare function sortConnectionsByBoundaryHierarchy<T extends WithBoundary, A extends IterableContainer<T>>(array: A, sort?: 'asc' | 'desc'): ReorderedArray<A>;
41
- /**
42
- * Find connections that includes given connection (i.e between it's ancestors)
43
- */
44
- declare function findAscendingConnections<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): Array<C>;
45
- /**
46
- * Find connections that given connection includes (i.e between it's descendants)
47
- */
48
- declare function findDescendantConnections<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): Array<C>;
49
- declare function mergeConnections<C extends IterableContainer<Connection<any, any>>>(connections: C): Array<C[number]>;
50
- /**
51
- * Excludes the values existing in `other` array.
52
- * The output maintains the same order as the input.
53
- */
54
- declare function differenceConnections<C extends Connection<any, any>>(source: Iterable<C>, exclude: Iterable<C>): C[];
55
- type WithSourceTarget<T = unknown> = {
56
- source: T;
57
- target: T;
58
- };
59
- declare function hasSameSourceTarget<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
60
- declare function hasSameSourceTarget<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
61
- declare function hasSameSource<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
62
- declare function hasSameSource<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
63
- declare function hasSameTarget<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
64
- declare function hasSameTarget<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
65
- type WithId<T> = {
66
- id: T;
67
- };
68
- declare function isOutgoing<T extends string>(source: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
69
- declare function isOutgoing<T extends string>(a: WithSourceTarget<WithId<T>>, source: WithId<T>): boolean;
70
- declare function isIncoming<T extends string>(target: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
71
- declare function isIncoming<T extends string>(a: WithSourceTarget<WithId<T>>, target: WithId<T>): boolean;
72
- declare function isAnyInOut<T extends string>(source: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
73
- declare function isAnyInOut<T extends string>(a: WithSourceTarget<WithId<T>>, source: WithId<T>): boolean;
74
-
75
- export { Connection, differenceConnections, findAscendingConnections, findDeepestNestedConnection, findDescendantConnections, hasSameSource, hasSameSourceTarget, hasSameTarget, isAnyInOut, isIncoming, isNestedConnection, isOutgoing, mergeConnections, sortConnectionsByBoundaryHierarchy, sortDeepestFirst };
@@ -1,3 +0,0 @@
1
- export { C as Connection } from '../../shared/core.BFd1lU9R.mjs';
2
- export { D as DeploymentConnectionModel, d as deployment } from '../../shared/core.BP_QHEXs.mjs';
3
- export { C as ConnectionModel, d as differenceConnections, f as findAscendingConnections, a as findDeepestNestedConnection, b as findDescendantConnections, h as hasSameSource, c as hasSameSourceTarget, e as hasSameTarget, i as isAnyInOut, g as isIncoming, j as isNestedConnection, k as isOutgoing, m as mergeConnections, n as model, s as sortConnectionsByBoundaryHierarchy, l as sortDeepestFirst } from '../../shared/core.78IWAHAE.mjs';
@@ -1,15 +0,0 @@
1
- export { C as Connection } from '../../../shared/core.DKhRkHRN.mjs';
2
- export { C as ConnectionModel, a as findConnection, b as findConnectionsBetween, c as findConnectionsWithin } from '../../../shared/core.DE9qzhn8.mjs';
3
- import '../../../shared/core.BfCKSW-g.mjs';
4
- import 'type-fest';
5
- import '../../../shared/core.CAgYpDtM.mjs';
6
- import '../../../shared/core.DC5IAaDT.mjs';
7
- import '../../../shared/core.D00YbOhQ.mjs';
8
- import '../../../shared/core.DB0Ue5Wx.mjs';
9
- import '../../../shared/core.C_3y3eqV.mjs';
10
- import '../../../types/fqnRef.mjs';
11
- import '../../../shared/core.Dojz4bvg.mjs';
12
- import '../../../types/expression-model.mjs';
13
- import '../../../shared/core.BPGOjone.mjs';
14
- import '../../../shared/core.CywrQs86.mjs';
15
- import '../../../shared/core.osFs8tU7.mjs';
@@ -1,2 +0,0 @@
1
- export { C as Connection } from '../../../shared/core.BFd1lU9R.mjs';
2
- export { C as ConnectionModel, p as findConnection, o as findConnectionsBetween, q as findConnectionsWithin } from '../../../shared/core.78IWAHAE.mjs';