@likec4/core 1.32.2 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/builder/index.d.mts +6 -4
  2. package/dist/builder/index.mjs +45 -13
  3. package/dist/compute-view/index.d.mts +6 -4
  4. package/dist/compute-view/index.mjs +33 -10
  5. package/dist/compute-view/relationships-view/index.d.mts +6 -4
  6. package/dist/compute-view/relationships-view/index.mjs +6 -3
  7. package/dist/index.d.mts +9 -138
  8. package/dist/index.mjs +31 -3712
  9. package/dist/model/connection/deployment/index.d.mts +10 -0
  10. package/dist/model/connection/deployment/index.mjs +18 -0
  11. package/dist/model/connection/index.d.mts +70 -0
  12. package/dist/model/connection/index.mjs +23 -0
  13. package/dist/model/connection/model/index.d.mts +10 -0
  14. package/dist/model/connection/model/index.mjs +11 -0
  15. package/dist/model/index.d.mts +14 -256
  16. package/dist/model/index.mjs +27 -5
  17. package/dist/shared/{core.Bdz6fBF1.d.mts → core.1pNeDdRk.d.mts} +92 -81
  18. package/dist/shared/{core.BuO4ncfY.d.mts → core.668kXpZq.d.mts} +42 -52
  19. package/dist/shared/core.8KM0D6va.mjs +33 -0
  20. package/dist/shared/core.B0oEIXqd.mjs +47 -0
  21. package/dist/shared/core.BH9nN-_I.mjs +22 -0
  22. package/dist/shared/core.BMCb0wJI.mjs +177 -0
  23. package/dist/shared/core.BTnf14gD.mjs +331 -0
  24. package/dist/shared/core.BgvIuGGU.mjs +3 -0
  25. package/dist/shared/core.BoyJPEen.mjs +21 -0
  26. package/dist/shared/{core.CUYDgv2-.mjs → core.Br7Fab9l.mjs} +12 -15
  27. package/dist/shared/{core.BrCnZFTn.mjs → core.Btl47GOn.mjs} +3 -3
  28. package/dist/shared/core.ByrmCl9I.mjs +5 -0
  29. package/dist/shared/core.C80Z37Eu.mjs +29 -0
  30. package/dist/shared/{core.Pf5I9o0e.d.mts → core.CF82MWyh.d.mts} +1 -1
  31. package/dist/shared/{core.rmvsy0n3.mjs → core.C_C-3c1S.mjs} +5 -198
  32. package/dist/shared/core.CeQbbp7K.d.mts +41 -0
  33. package/dist/shared/{core.DoK86JEe.mjs → core.CpwrZi3D.mjs} +2 -73
  34. package/dist/shared/{core.CpXlRyE5.mjs → core.CtKXPqN_.mjs} +5 -36
  35. package/dist/shared/core.CxGKeL-L.mjs +144 -0
  36. package/dist/shared/core.CzdwsPmY.d.mts +69 -0
  37. package/dist/shared/{core.Cy9smucx.mjs → core.D4npX2q8.mjs} +1 -3
  38. package/dist/shared/core.D56nCp7e.mjs +168 -0
  39. package/dist/shared/core.D5qVzkws.mjs +724 -0
  40. package/dist/shared/core.DDAPzd3T.d.mts +87 -0
  41. package/dist/shared/{core.CBpKAlhj.mjs → core.DDynPqbh.mjs} +96 -56
  42. package/dist/shared/{core.Bk7wEZFG.mjs → core.DXRAwwDB.mjs} +3 -2
  43. package/dist/shared/core.DcS-0zys.mjs +10 -0
  44. package/dist/shared/{core.CBxTtXMi.d.mts → core.De___iBS.d.mts} +3 -2
  45. package/dist/shared/core.DsMrjY2q.mjs +34 -0
  46. package/dist/shared/core.DuSLYTG6.d.mts +57 -0
  47. package/dist/shared/core.Dy-F3xRP.d.mts +83 -0
  48. package/dist/shared/{core.DaAyklhe.d.mts → core.OLInHaJx.d.mts} +30 -22
  49. package/dist/shared/core.XptQjhMA.mjs +1295 -0
  50. package/dist/shared/{core.cbA9VZ02.mjs → core.hoq9W4rW.mjs} +28 -1073
  51. package/dist/shared/core.zLlww-07.mjs +3 -0
  52. package/dist/theme/index.d.mts +134 -0
  53. package/dist/theme/index.mjs +3709 -0
  54. package/dist/types/aux.d.mts +3 -2
  55. package/dist/types/index.d.mts +9 -5
  56. package/dist/types/index.mjs +17 -146
  57. package/dist/utils/index.d.mts +15 -100
  58. package/dist/utils/index.mjs +25 -1315
  59. package/dist/utils/iterable/index.d.mts +100 -0
  60. package/dist/utils/iterable/index.mjs +24 -0
  61. package/package.json +23 -7
  62. package/src/builder/Builder.ts +13 -4
  63. package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +0 -13
  64. package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +2 -6
  65. package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +0 -7
  66. package/src/compute-view/deployment-view/__test__/fixture.ts +15 -5
  67. package/src/compute-view/deployment-view/utils.ts +13 -13
  68. package/src/compute-view/dynamic-view/compute.ts +2 -1
  69. package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +2 -2
  70. package/src/compute-view/relationships-view/layout.ts +1 -1
  71. package/src/compute-view/utils/applyCustomElementProperties.ts +8 -0
  72. package/src/compute-view/utils/applyCustomRelationProperties.ts +2 -0
  73. package/src/compute-view/utils/buildComputedNodes.ts +4 -3
  74. package/src/compute-view/utils/merge-props-from-relationships.ts +6 -5
  75. package/src/compute-view/utils/view-hash.ts +24 -3
  76. package/src/model/DeploymentElementModel.ts +20 -16
  77. package/src/model/ElementModel.ts +9 -3
  78. package/src/model/RelationModel.ts +19 -16
  79. package/src/model/index.ts +2 -0
  80. package/src/model/types.ts +1 -0
  81. package/src/model/view/EdgeModel.ts +4 -3
  82. package/src/model/view/LikeC4ViewModel.ts +5 -0
  83. package/src/model/view/NodeModel.ts +4 -2
  84. package/src/theme/index.ts +12 -5
  85. package/src/types/RichText.ts +200 -0
  86. package/src/types/index.ts +2 -0
  87. package/src/types/model-deployment.ts +4 -3
  88. package/src/types/model-logical.ts +3 -3
  89. package/src/types/scalar.ts +47 -2
  90. package/src/types/view-common.ts +1 -1
  91. package/src/types/view-computed.ts +2 -4
  92. package/src/types/view-layouted.ts +9 -0
  93. package/src/utils/index.ts +4 -9
  94. package/src/utils/markdown/index.ts +2 -0
  95. package/src/utils/markdown/to-html.ts +32 -0
  96. package/src/utils/markdown/to-text.ts +14 -0
@@ -0,0 +1,331 @@
1
+ import { c as customInspectSymbol } from './core.C80Z37Eu.mjs';
2
+ import { o } from './core.BgvIuGGU.mjs';
3
+ import { a as intersection, b as stringHash, u as union, d as difference, e as equals } from './core.CpwrZi3D.mjs';
4
+ import { u } from './core.DbRvwARP.mjs';
5
+ import { m } from './core.ByrmCl9I.mjs';
6
+ import { j as isDescendantOf, i as isAncestor, q as isString, C, l as sortNaturalByFqn, k as isSameHierarchy } from './core.C_C-3c1S.mjs';
7
+ import { i as isome } from './core.BoyJPEen.mjs';
8
+ import { i as ifilter } from './core.BH9nN-_I.mjs';
9
+ import { i as invariant } from './core.D4npX2q8.mjs';
10
+
11
+ function p(...e){return u(t,e)}var t=(e,o)=>e[o];
12
+
13
+ function isNestedConnection(nested, parent) {
14
+ if (!parent) {
15
+ const p = nested;
16
+ return (n) => isNestedConnection(n, p);
17
+ }
18
+ const isSameSource = nested.source === parent.source;
19
+ const isSameTarget = nested.target === parent.target;
20
+ if (isSameSource && isSameTarget) {
21
+ return false;
22
+ }
23
+ const isSourceNested = isAncestor(parent.source.id, nested.source.id);
24
+ const isTargetNested = isAncestor(parent.target.id, nested.target.id);
25
+ return isSourceNested && isTargetNested || isSameSource && isTargetNested || isSameTarget && isSourceNested;
26
+ }
27
+ function findDeepestNestedConnection(connections, connection) {
28
+ let deepest = connection;
29
+ for (const c of connections) {
30
+ if (isNestedConnection(c, deepest)) {
31
+ deepest = c;
32
+ }
33
+ }
34
+ return deepest !== connection ? deepest : null;
35
+ }
36
+ function sortDeepestFirst(connections) {
37
+ const sorted = [];
38
+ const unsorted = connections.slice();
39
+ let next;
40
+ while (next = unsorted.shift()) {
41
+ let deepest;
42
+ while (deepest = findDeepestNestedConnection(unsorted, next)) {
43
+ const index = unsorted.indexOf(deepest);
44
+ sorted.push(unsorted.splice(index, 1)[0]);
45
+ }
46
+ sorted.push(next);
47
+ }
48
+ return sorted;
49
+ }
50
+ const boundaryHierarchy = (conn) => conn.boundary?.id ? `.${conn.boundary.id}` : "";
51
+ function sortConnectionsByBoundaryHierarchy(connections, sort) {
52
+ if (!connections || isString(connections)) {
53
+ const dir = connections ?? "asc";
54
+ return (arr) => _sortByBoundary(arr, dir);
55
+ }
56
+ return _sortByBoundary(connections, sort ?? "asc");
57
+ }
58
+ function _sortByBoundary(connections, order) {
59
+ return C(
60
+ connections,
61
+ m((conn) => ({
62
+ id: boundaryHierarchy(conn),
63
+ conn
64
+ })),
65
+ sortNaturalByFqn(order),
66
+ m(p("conn"))
67
+ );
68
+ }
69
+ function findAscendingConnections(connections, connection) {
70
+ return connections.filter((c) => isNestedConnection(connection, c));
71
+ }
72
+ function findDescendantConnections(connections, connection) {
73
+ return connections.filter(isNestedConnection(connection));
74
+ }
75
+ function mergeConnections(connections) {
76
+ const map2 = /* @__PURE__ */ new Map();
77
+ for (const conn of connections) {
78
+ const existing = map2.get(conn.id);
79
+ if (existing) {
80
+ map2.set(conn.id, conn.mergeWith(existing));
81
+ } else {
82
+ map2.set(conn.id, conn);
83
+ }
84
+ }
85
+ return [...map2.values()];
86
+ }
87
+ function differenceConnections(source, exclude) {
88
+ const minus = new Map([...exclude].map((c) => [c.id, c]));
89
+ return [...source].reduce((acc, c) => {
90
+ const other = minus.get(c.id);
91
+ if (!other) {
92
+ acc.push(c);
93
+ return acc;
94
+ }
95
+ const updated = c.difference(other);
96
+ if (updated.nonEmpty()) {
97
+ acc.push(updated);
98
+ }
99
+ return acc;
100
+ }, []);
101
+ }
102
+ function hasSameSourceTarget(a, b) {
103
+ if (b) {
104
+ return a.source === b.source && a.target === b.target;
105
+ }
106
+ return (b2) => a.source === b2.source && a.target === b2.target;
107
+ }
108
+ function hasSameSource(a, b) {
109
+ if (b) {
110
+ return a.source === b.source;
111
+ }
112
+ return (b2) => a.source === b2.source;
113
+ }
114
+ function hasSameTarget(a, b) {
115
+ if (b) {
116
+ return a.target === b.target;
117
+ }
118
+ return (b2) => a.target === b2.target;
119
+ }
120
+ function isOutgoing(a, source) {
121
+ if (!source) {
122
+ const _source = a;
123
+ return (b) => isOutgoing(b, _source);
124
+ }
125
+ const at = a;
126
+ return isDescendantOf(at.source, source) && !isDescendantOf(at.target, source);
127
+ }
128
+ function isIncoming(a, target) {
129
+ if (!target) {
130
+ const _target = a;
131
+ return (b) => isIncoming(b, _target);
132
+ }
133
+ const at = a;
134
+ return isDescendantOf(at.target, target) && !isDescendantOf(at.source, target);
135
+ }
136
+ function isAnyInOut(a, source) {
137
+ if (!source) {
138
+ const _source = a;
139
+ return (b) => isAnyInOut(b, _source);
140
+ }
141
+ const at = a;
142
+ return isDescendantOf(at.source, source) !== isDescendantOf(at.target, source);
143
+ }
144
+
145
+ function findConnection(source, target, direction = "directed") {
146
+ if (source === target) {
147
+ return [];
148
+ }
149
+ if (isSameHierarchy(source, target)) {
150
+ return [];
151
+ }
152
+ const directedIntersection = intersection(source.allOutgoing, target.allIncoming);
153
+ const directed = directedIntersection.size > 0 ? new ConnectionModel(
154
+ source,
155
+ target,
156
+ directedIntersection
157
+ ) : null;
158
+ if (direction === "directed") {
159
+ return directed ? [directed] : [];
160
+ }
161
+ const reverseIntersection = intersection(source.allIncoming, target.allOutgoing);
162
+ const reverse = reverseIntersection.size > 0 ? new ConnectionModel(
163
+ target,
164
+ source,
165
+ reverseIntersection
166
+ ) : null;
167
+ if (directed && reverse) {
168
+ return [directed, reverse];
169
+ }
170
+ if (directed) {
171
+ return [directed];
172
+ }
173
+ if (reverse) {
174
+ return [reverse];
175
+ }
176
+ return [];
177
+ }
178
+ function findConnectionsBetween(element, others, direction = "both") {
179
+ if (element.allIncoming.size === 0 && element.allOutgoing.size === 0) {
180
+ return [];
181
+ }
182
+ const outgoing = [];
183
+ const incoming = [];
184
+ for (const _other of others) {
185
+ if (element === _other) {
186
+ continue;
187
+ }
188
+ for (const found of findConnection(element, _other, direction)) {
189
+ if (found.source === element) {
190
+ outgoing.push(found);
191
+ } else {
192
+ incoming.push(found);
193
+ }
194
+ }
195
+ }
196
+ return [
197
+ ...outgoing,
198
+ ...incoming
199
+ ];
200
+ }
201
+ function findConnectionsWithin(elements) {
202
+ return [...elements].reduce((acc, el, index, array) => {
203
+ if (index === array.length - 1) {
204
+ return acc;
205
+ }
206
+ acc.push(
207
+ ...findConnectionsBetween(el, array.slice(index + 1), "both")
208
+ );
209
+ return acc;
210
+ }, []);
211
+ }
212
+
213
+ const modelConnection = {
214
+ __proto__: null,
215
+ findConnection: findConnection,
216
+ findConnectionsBetween: findConnectionsBetween,
217
+ findConnectionsWithin: findConnectionsWithin
218
+ };
219
+
220
+ class ConnectionModel {
221
+ constructor(source, target, relations = /* @__PURE__ */ new Set()) {
222
+ this.source = source;
223
+ this.target = target;
224
+ this.relations = relations;
225
+ this.id = stringHash(`model:${source.id}:${target.id}`);
226
+ }
227
+ id;
228
+ _boundary;
229
+ /**
230
+ * Common ancestor of the source and target elements.
231
+ * Represents the boundary of the connection.
232
+ */
233
+ get boundary() {
234
+ return this._boundary ??= this.source.commonAncestor(this.target);
235
+ }
236
+ /**
237
+ * Human readable expression of the connection
238
+ * Mostly used for testing and debugging
239
+ */
240
+ get expression() {
241
+ return `${this.source.id} -> ${this.target.id}`;
242
+ }
243
+ /**
244
+ * Returns true if only includes relations between the source and target elements.
245
+ */
246
+ get isDirect() {
247
+ return this.nonEmpty() && !this.isImplicit;
248
+ }
249
+ /**
250
+ * Returns true if includes relations between nested elements of the source and target elements.
251
+ */
252
+ get isImplicit() {
253
+ return this.nonEmpty() && isome(this.relations, o(hasSameSourceTarget(this)));
254
+ }
255
+ get directRelations() {
256
+ return new Set(ifilter(this.relations, hasSameSourceTarget(this)));
257
+ }
258
+ nonEmpty() {
259
+ return this.relations.size > 0;
260
+ }
261
+ mergeWith(other) {
262
+ invariant(this.source.id === other.source.id, "Cannot merge connections with different sources");
263
+ invariant(this.target.id === other.target.id, "Cannot merge connections with different targets");
264
+ return new ConnectionModel(
265
+ this.source,
266
+ this.target,
267
+ union(this.relations, other.relations)
268
+ );
269
+ }
270
+ difference(other) {
271
+ return new ConnectionModel(
272
+ this.source,
273
+ this.target,
274
+ difference(this.relations, other.relations)
275
+ );
276
+ }
277
+ intersect(other) {
278
+ invariant(other instanceof ConnectionModel, "Cannot intersect connection with different type");
279
+ return new ConnectionModel(
280
+ this.source,
281
+ this.target,
282
+ intersection(this.relations, other.relations)
283
+ );
284
+ }
285
+ equals(other) {
286
+ invariant(other instanceof ConnectionModel, "Cannot merge connection with different type");
287
+ const _other = other;
288
+ return this.id === _other.id && this.source.id === _other.source.id && this.target.id === _other.target.id && equals(this.relations, _other.relations);
289
+ }
290
+ /**
291
+ * Returns a new instance with the updated relations.
292
+ *
293
+ * @param relations - A readonly set of `RelationshipModel` instances representing the new relations.
294
+ * @returns A new `ConnectionModel` instance with the updated relations.
295
+ */
296
+ update(relations) {
297
+ return new ConnectionModel(
298
+ this.source,
299
+ this.target,
300
+ relations
301
+ );
302
+ }
303
+ [customInspectSymbol](depth, inspectOptions, inspect) {
304
+ const asString = this.toString();
305
+ Object.defineProperty(asString, "constructor", {
306
+ value: ConnectionModel,
307
+ enumerable: false
308
+ });
309
+ return asString;
310
+ }
311
+ toString() {
312
+ return [
313
+ this.expression,
314
+ this.relations.size ? " relations:" : " relations: [ ]",
315
+ ...[...this.relations].map((c) => " " + c.expression)
316
+ ].join("\n");
317
+ }
318
+ /**
319
+ * Creates a new connection with reversed direction (target becomes source and vice versa)
320
+ * @param search - When true, attempts to find an existing connection between the reversed nodes
321
+ */
322
+ reversed(search = false) {
323
+ if (!search) {
324
+ return new ConnectionModel(this.target, this.source);
325
+ }
326
+ const [found] = findConnection(this.target, this.source, "directed");
327
+ return found ?? new ConnectionModel(this.target, this.source, /* @__PURE__ */ new Set());
328
+ }
329
+ }
330
+
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, p, findConnection as q, findConnectionsWithin as r, sortConnectionsByBoundaryHierarchy as s };
@@ -0,0 +1,3 @@
1
+ function o(a){return t=>!a(t)}
2
+
3
+ export { o };
@@ -0,0 +1,21 @@
1
+ import { t } from './core.BH9nN-_I.mjs';
2
+ import { i as invariant } from './core.D4npX2q8.mjs';
3
+
4
+ function isome(arg1, arg2) {
5
+ const pred = arg2 ?? arg1;
6
+ invariant(t(pred));
7
+ function _some(iter) {
8
+ for (const value of iter) {
9
+ if (pred(value)) {
10
+ return true;
11
+ }
12
+ }
13
+ return false;
14
+ }
15
+ if (!arg2) {
16
+ return _some;
17
+ }
18
+ return _some(arg1);
19
+ }
20
+
21
+ export { isome as i };
@@ -1,4 +1,7 @@
1
- import { i as invariant, t as t$1, a as nonexhaustive } from './core.Cy9smucx.mjs';
1
+ import { t as t$1 } from './core.zLlww-07.mjs';
2
+ import { n as n$1 } from './core.D56nCp7e.mjs';
3
+ import { i as invariant, n as nonexhaustive } from './core.D4npX2q8.mjs';
4
+ import { o } from './core.BgvIuGGU.mjs';
2
5
  import { u } from './core.DbRvwARP.mjs';
3
6
 
4
7
  function isOnStage(value, stage) {
@@ -7,16 +10,19 @@ function isOnStage(value, stage) {
7
10
  const _stage = "_stage";
8
11
  const _type = "_type";
9
12
 
10
- function n$1(e){return !!e}
11
-
12
13
  function n(e){return e==null}
13
14
 
14
- function o(a){return t=>!a(t)}
15
-
16
15
  function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
17
16
 
18
17
  function y(...a){return u(r,a)}var r=(a,o)=>o.some(e=>e(a));
19
18
 
19
+ function flattenMarkdownOrString(value) {
20
+ if (value === null || value === void 0) {
21
+ return null;
22
+ }
23
+ const content = t$1(value) ? value : value.txt ?? value.md;
24
+ return n$1(content?.trim()) ? content : null;
25
+ }
20
26
  function Fqn(name, parent) {
21
27
  return parent ? parent + "." + name : name;
22
28
  }
@@ -121,15 +127,6 @@ function isDeployedInstance(el) {
121
127
  return "element" in el && n$1(el.element);
122
128
  }
123
129
 
124
- const DefaultThemeColor = "primary";
125
- const DefaultElementShape = "rectangle";
126
- const DefaultShapeSize = "md";
127
- const DefaultPaddingSize = "md";
128
- const DefaultTextSize = "md";
129
- const DefaultLineStyle = "dashed";
130
- const DefaultArrowType = "normal";
131
- const DefaultRelationshipColor = "gray";
132
-
133
130
  function isTagEqual(operator) {
134
131
  return "tag" in operator;
135
132
  }
@@ -211,4 +208,4 @@ function participantIs(participant, predicate) {
211
208
  };
212
209
  }
213
210
 
214
- export { DeploymentFqn as A, GlobalFqn as B, isGlobalFqn as C, DefaultElementShape as D, splitGlobalFqn as E, FqnRef as F, GroupElementKind as G, EdgeId as H, extractStep as I, NodeId as N, RelationId as R, StepEdgeKind as S, ViewId as V, _type as _, DefaultThemeColor as a, _stage as b, n$1 as c, isStepEdgeId as d, isGroupElementKind as e, DefaultArrowType as f, DefaultLineStyle as g, DefaultRelationshipColor as h, isDeployedInstance as i, isOnStage as j, isDeploymentNode as k, DefaultShapeSize as l, DefaultPaddingSize as m, n, o, DefaultTextSize as p, isTagEqual as q, isKindEqual as r, stepEdgeId as s, isParticipantOperator as t, isNotOperator as u, isAndOperator as v, whereOperatorAsPredicate as w, isOrOperator as x, y, Fqn as z };
211
+ export { DeploymentFqn as D, EdgeId as E, FqnRef as F, GroupElementKind as G, NodeId as N, RelationId as R, StepEdgeKind as S, ViewId as V, _stage as _, _type as a, isDeploymentNode as b, isDeployedInstance as c, isTagEqual as d, isKindEqual as e, isParticipantOperator as f, isNotOperator as g, isAndOperator as h, isOnStage as i, isOrOperator as j, flattenMarkdownOrString as k, Fqn as l, isGroupElementKind as m, GlobalFqn as n, isGlobalFqn as o, stepEdgeId as p, isStepEdgeId as q, extractStep as r, splitGlobalFqn as s, n as t, whereOperatorAsPredicate as w, y };
@@ -1,5 +1,5 @@
1
- import { t } from './core.rmvsy0n3.mjs';
2
- import { i as invariant } from './core.Cy9smucx.mjs';
1
+ import { t } from './core.BH9nN-_I.mjs';
2
+ import { i as invariant } from './core.D4npX2q8.mjs';
3
3
 
4
4
  function imap(arg1, arg2) {
5
5
  const mapper = arg2 ?? arg1;
@@ -29,4 +29,4 @@ function toSet(iterable) {
29
29
  return (it) => new Set(it);
30
30
  }
31
31
 
32
- export { toArray as a, imap as i, toSet as t };
32
+ export { toSet as a, imap as i, toArray as t };
@@ -0,0 +1,5 @@
1
+ import { u } from './core.DbRvwARP.mjs';
2
+
3
+ function m(...a){return u(o,a,p)}var o=(a,e)=>a.map(e),p=a=>(e,t,r)=>({done:false,hasNext:true,next:a(e,t,r)});
4
+
5
+ export { m };
@@ -0,0 +1,29 @@
1
+ import { i as isAncestor } from './core.C_C-3c1S.mjs';
2
+
3
+ var Connection;
4
+ ((Connection2) => {
5
+ Connection2.isInside = (fqn) => {
6
+ return (connection) => isAncestor(fqn, connection.source.id) && isAncestor(fqn, connection.target.id);
7
+ };
8
+ Connection2.isDirectedBetween = (source, target) => {
9
+ return (connection) => (connection.source.id === source || isAncestor(source, connection.source.id)) && (connection.target.id === target || isAncestor(target, connection.target.id));
10
+ };
11
+ Connection2.isAnyBetween = (source, target) => {
12
+ const forward = (0, Connection2.isDirectedBetween)(source, target), backward = (0, Connection2.isDirectedBetween)(target, source);
13
+ return (connection) => forward(connection) || backward(connection);
14
+ };
15
+ Connection2.isIncoming = (target) => {
16
+ return (connection) => (connection.target.id === target || isAncestor(target, connection.target.id)) && !isAncestor(target, connection.source.id);
17
+ };
18
+ Connection2.isOutgoing = (source) => {
19
+ return (connection) => (connection.source.id === source || isAncestor(source, connection.source.id)) && !isAncestor(source, connection.target.id);
20
+ };
21
+ Connection2.isAnyInOut = (source) => {
22
+ const isIn = (0, Connection2.isIncoming)(source), isOut = (0, Connection2.isOutgoing)(source);
23
+ return (connection) => isIn(connection) || isOut(connection);
24
+ };
25
+ })(Connection || (Connection = {}));
26
+
27
+ const customInspectSymbol = Symbol.for("nodejs.util.inspect.custom");
28
+
29
+ export { Connection as C, customInspectSymbol as c };
@@ -1,4 +1,4 @@
1
- import { F as Fqn } from './core.BuO4ncfY.mjs';
1
+ import { F as Fqn } from './core.668kXpZq.mjs';
2
2
 
3
3
  declare function parentFqn<E extends string>(fqn: E): E | null;
4
4
  declare function nameFromFqn<E extends string>(fqn: E): string;
@@ -1,189 +1,13 @@
1
- import { t as t$1, i as invariant } from './core.Cy9smucx.mjs';
1
+ import { t } from './core.zLlww-07.mjs';
2
2
 
3
3
  var e={done:true,hasNext:false},s={done:false,hasNext:false},a=()=>e;
4
4
 
5
5
  function C(t,...o){let n=t,u=o.map(e=>"lazy"in e?y(e):void 0),p=0;for(;p<o.length;){if(u[p]===void 0||!B(n)){let i=o[p];n=i(n),p+=1;continue}let r=[];for(let i=p;i<o.length;i++){let l=u[i];if(l===void 0||(r.push(l),l.isSingle))break}let a=[];for(let i of n)if(f(i,a,r))break;let{isSingle:s}=r.at(-1);n=s?a[0]:a,p+=r.length;}return n}function f(t,o,n){if(n.length===0)return o.push(t),false;let u=t,p=s,e=false;for(let[r,a]of n.entries()){let{index:s,items:i}=a;if(i.push(u),p=a(u,s,i),a.index+=1,p.hasNext){if(p.hasMany??false){for(let l of p.next)if(f(l,o,n.slice(r+1)))return true;return e}u=p.next;}if(!p.hasNext)break;p.done&&(e=true);}return p.hasNext&&o.push(u),e}function y(t){let{lazy:o,lazyArgs:n}=t,u=o(...n);return Object.assign(u,{isSingle:o.single??false,index:0,items:[]})}function B(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}
6
6
 
7
- function t(n){return typeof n=="function"}
8
-
9
7
  function getDefaultExportFromCjs (x) {
10
8
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
11
9
  }
12
10
 
13
- /**
14
- * Mnemonist DefaultMap
15
- * =====================
16
- *
17
- * JavaScript implementation of a default map that will return a constructed
18
- * value any time one tries to access an inexisting key. It's quite similar
19
- * to python's defaultdict.
20
- */
21
-
22
- var defaultMap;
23
- var hasRequiredDefaultMap;
24
-
25
- function requireDefaultMap () {
26
- if (hasRequiredDefaultMap) return defaultMap;
27
- hasRequiredDefaultMap = 1;
28
- /**
29
- * DefaultMap.
30
- *
31
- * @constructor
32
- */
33
- function DefaultMap(factory) {
34
- if (typeof factory !== 'function')
35
- throw new Error('mnemonist/DefaultMap.constructor: expecting a function.');
36
-
37
- this.items = new Map();
38
- this.factory = factory;
39
- this.size = 0;
40
- }
41
-
42
- /**
43
- * Method used to clear the structure.
44
- *
45
- * @return {undefined}
46
- */
47
- DefaultMap.prototype.clear = function() {
48
-
49
- // Properties
50
- this.items.clear();
51
- this.size = 0;
52
- };
53
-
54
- /**
55
- * Method used to get the value set for given key. If the key does not exist,
56
- * the value will be created using the provided factory.
57
- *
58
- * @param {any} key - Target key.
59
- * @return {any}
60
- */
61
- DefaultMap.prototype.get = function(key) {
62
- var value = this.items.get(key);
63
-
64
- if (typeof value === 'undefined') {
65
- value = this.factory(key, this.size);
66
- this.items.set(key, value);
67
- this.size++;
68
- }
69
-
70
- return value;
71
- };
72
-
73
- /**
74
- * Method used to get the value set for given key. If the key does not exist,
75
- * a value won't be created.
76
- *
77
- * @param {any} key - Target key.
78
- * @return {any}
79
- */
80
- DefaultMap.prototype.peek = function(key) {
81
- return this.items.get(key);
82
- };
83
-
84
- /**
85
- * Method used to set a value for given key.
86
- *
87
- * @param {any} key - Target key.
88
- * @param {any} value - Value.
89
- * @return {DefaultMap}
90
- */
91
- DefaultMap.prototype.set = function(key, value) {
92
- this.items.set(key, value);
93
- this.size = this.items.size;
94
-
95
- return this;
96
- };
97
-
98
- /**
99
- * Method used to test the existence of a key in the map.
100
- *
101
- * @param {any} key - Target key.
102
- * @return {boolean}
103
- */
104
- DefaultMap.prototype.has = function(key) {
105
- return this.items.has(key);
106
- };
107
-
108
- /**
109
- * Method used to delete target key.
110
- *
111
- * @param {any} key - Target key.
112
- * @return {boolean}
113
- */
114
- DefaultMap.prototype.delete = function(key) {
115
- var deleted = this.items.delete(key);
116
-
117
- this.size = this.items.size;
118
-
119
- return deleted;
120
- };
121
-
122
- /**
123
- * Method used to iterate over each of the key/value pairs.
124
- *
125
- * @param {function} callback - Function to call for each item.
126
- * @param {object} scope - Optional scope.
127
- * @return {undefined}
128
- */
129
- DefaultMap.prototype.forEach = function(callback, scope) {
130
- scope = arguments.length > 1 ? scope : this;
131
-
132
- this.items.forEach(callback, scope);
133
- };
134
-
135
- /**
136
- * Iterators.
137
- */
138
- DefaultMap.prototype.entries = function() {
139
- return this.items.entries();
140
- };
141
-
142
- DefaultMap.prototype.keys = function() {
143
- return this.items.keys();
144
- };
145
-
146
- DefaultMap.prototype.values = function() {
147
- return this.items.values();
148
- };
149
-
150
- /**
151
- * Attaching the #.entries method to Symbol.iterator if possible.
152
- */
153
- if (typeof Symbol !== 'undefined')
154
- DefaultMap.prototype[Symbol.iterator] = DefaultMap.prototype.entries;
155
-
156
- /**
157
- * Convenience known methods.
158
- */
159
- DefaultMap.prototype.inspect = function() {
160
- return this.items;
161
- };
162
-
163
- if (typeof Symbol !== 'undefined')
164
- DefaultMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = DefaultMap.prototype.inspect;
165
-
166
- /**
167
- * Typical factories.
168
- */
169
- DefaultMap.autoIncrement = function() {
170
- var i = 0;
171
-
172
- return function() {
173
- return i++;
174
- };
175
- };
176
-
177
- /**
178
- * Exporting.
179
- */
180
- defaultMap = DefaultMap;
181
- return defaultMap;
182
- }
183
-
184
- var defaultMapExports = /*@__PURE__*/ requireDefaultMap();
185
- const DefaultMap = /*@__PURE__*/getDefaultExportFromCjs(defaultMapExports);
186
-
187
11
  var naturalCompareLite = {exports: {}};
188
12
 
189
13
  var hasRequiredNaturalCompareLite;
@@ -253,13 +77,13 @@ const compare = /*@__PURE__*/getDefaultExportFromCjs(naturalCompareLiteExports);
253
77
 
254
78
  function compareNatural(a, b) {
255
79
  if (a === b) return 0;
256
- if (t$1(a)) {
257
- if (t$1(b)) {
80
+ if (t(a)) {
81
+ if (t(b)) {
258
82
  return compare(a, b);
259
83
  }
260
84
  return 1;
261
85
  }
262
- return t$1(b) ? -1 : 0;
86
+ return t(b) ? -1 : 0;
263
87
  }
264
88
  function compareNaturalHierarchically(separator = ".") {
265
89
  return (a, b) => {
@@ -448,21 +272,4 @@ function sortNaturalByFqn(array, sort) {
448
272
  }).map(({ item }) => item);
449
273
  }
450
274
 
451
- function ifilter(arg1, arg2) {
452
- const pred = arg2 ?? arg1;
453
- invariant(t(pred));
454
- function* _filter(iter) {
455
- for (const value of iter) {
456
- if (pred(value)) {
457
- yield value;
458
- }
459
- }
460
- return;
461
- }
462
- if (!arg2) {
463
- return _filter;
464
- }
465
- return _filter(arg1);
466
- }
467
-
468
- export { C, DefaultMap as D, isAncestor as a, ifilter as b, isNonEmptyArray as c, isSameHierarchy as d, a as e, s as f, getDefaultExportFromCjs as g, compareByFqnHierarchically as h, isDescendantOf as i, sortByFqnHierarchically as j, commonAncestor as k, ancestorsFqn as l, compareNatural as m, nameFromFqn as n, compareNaturalHierarchically as o, parentFqn as p, compareFqnHierarchically as q, hierarchyDistance as r, sortParentsFirst as s, t, hierarchyLevel as u, sortNaturalByFqn as v, isString as w };
275
+ export { C, compareNaturalHierarchically as a, ancestorsFqn as b, compareNatural as c, commonAncestor as d, compareByFqnHierarchically as e, compareFqnHierarchically as f, hierarchyLevel as g, hierarchyDistance as h, isAncestor as i, isDescendantOf as j, isSameHierarchy as k, sortNaturalByFqn as l, sortParentsFirst as m, nameFromFqn as n, isNonEmptyArray as o, parentFqn as p, isString as q, getDefaultExportFromCjs as r, sortByFqnHierarchically as s, s as t, a as u };