@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.
- package/LICENSE +1 -1
- package/dist/THIRD-PARTY-LICENSES.md +1012 -0
- package/dist/_chunks/Builder.view-element.mjs +2 -0
- package/dist/_chunks/LikeC4Model.d.mts +1283 -0
- package/dist/_chunks/RichText.mjs +1 -0
- package/dist/_chunks/_types.d.mts +777 -0
- package/dist/_chunks/_types2.d.mts +36 -0
- package/dist/_chunks/assignTagColors.mjs +1 -0
- package/dist/_chunks/calcDriftsFromSnapshot.mjs +1 -0
- package/dist/_chunks/guards.d.mts +2026 -0
- package/dist/_chunks/guards.mjs +4 -0
- package/dist/_chunks/index.d.mts +288 -0
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +15 -0
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -0
- package/dist/_chunks/libs/bail.mjs +1 -0
- package/dist/_chunks/libs/ccount.mjs +1 -0
- package/dist/_chunks/libs/character-entities-html4.mjs +1 -0
- package/dist/_chunks/libs/character-entities-legacy.mjs +1 -0
- package/dist/_chunks/libs/character-entities.mjs +2 -0
- package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -0
- package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -0
- package/dist/_chunks/libs/defu.mjs +1 -0
- package/dist/_chunks/libs/devlop.mjs +1 -0
- package/dist/_chunks/libs/escape-string-regexp.mjs +1 -0
- package/dist/_chunks/libs/extend.mjs +1 -0
- package/dist/_chunks/libs/graphology-dag.mjs +1 -0
- package/dist/_chunks/libs/graphology.mjs +1 -0
- package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -0
- package/dist/_chunks/libs/hast-util-to-html.mjs +9 -0
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -0
- package/dist/_chunks/libs/longest-streak.mjs +1 -0
- package/dist/_chunks/libs/markdown-table.mjs +2 -0
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -0
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -0
- package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -0
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -0
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -0
- package/dist/_chunks/libs/mnemonist.d.mts +164 -0
- package/dist/_chunks/libs/mnemonist.mjs +1 -0
- package/dist/_chunks/libs/natural-compare-lite.mjs +9 -0
- package/dist/_chunks/libs/ohash.mjs +1 -0
- package/dist/_chunks/libs/rehype-sanitize.mjs +1 -0
- package/dist/_chunks/libs/rehype-stringify.mjs +1 -0
- package/dist/_chunks/libs/remark-gfm.mjs +1 -0
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -0
- package/dist/_chunks/libs/remark-parse.mjs +1 -0
- package/dist/_chunks/libs/remark-rehype.mjs +1 -0
- package/dist/_chunks/libs/remeda.mjs +1 -0
- package/dist/_chunks/libs/trough.mjs +1 -0
- package/dist/_chunks/libs/unified.mjs +1 -0
- package/dist/_chunks/rolldown-runtime.mjs +1 -0
- package/dist/_chunks/theme.d.mts +148 -0
- package/dist/_chunks/to-text.d.mts +404 -0
- package/dist/_chunks/to-text.mjs +1 -0
- package/dist/_chunks/vector.d.mts +198 -0
- package/dist/_chunks/vector.mjs +1 -0
- package/dist/builder/index.d.mts +5 -775
- package/dist/builder/index.mjs +1 -1053
- package/dist/compute-view/index.d.mts +156 -56
- package/dist/compute-view/index.mjs +2 -229
- package/dist/geometry/index.d.mts +2 -109
- package/dist/geometry/index.mjs +1 -328
- package/dist/index.d.mts +14 -20
- package/dist/index.mjs +1 -18
- package/dist/model/index.d.mts +5 -57
- package/dist/model/index.mjs +1 -4
- package/dist/styles/index.d.mts +3 -117
- package/dist/styles/index.mjs +1 -63
- package/dist/types/index.d.mts +3 -47
- package/dist/types/index.mjs +1 -17
- package/dist/utils/graphology/index.d.mts +2 -1864
- package/dist/utils/graphology/index.mjs +1 -1
- package/dist/utils/index.d.mts +4 -124
- package/dist/utils/index.mjs +1 -44
- package/package.json +20 -24
- package/compute-view/relationships/package.json +0 -4
- package/dist/compute-view/relationships-view/index.d.mts +0 -51
- package/dist/compute-view/relationships-view/index.mjs +0 -185
- package/dist/model/connection/deployment/index.d.mts +0 -15
- package/dist/model/connection/deployment/index.mjs +0 -2
- package/dist/model/connection/index.d.mts +0 -75
- package/dist/model/connection/index.mjs +0 -3
- package/dist/model/connection/model/index.d.mts +0 -15
- package/dist/model/connection/model/index.mjs +0 -2
- package/dist/shared/core.3ZhnKAlZ.mjs +0 -106
- package/dist/shared/core.78IWAHAE.mjs +0 -332
- package/dist/shared/core.B85MJLTf.mjs +0 -5
- package/dist/shared/core.BFd1lU9R.mjs +0 -29
- package/dist/shared/core.BKlholso.mjs +0 -3
- package/dist/shared/core.BNN-3vPH.mjs +0 -1255
- package/dist/shared/core.BPGOjone.d.mts +0 -46
- package/dist/shared/core.BP_QHEXs.mjs +0 -785
- package/dist/shared/core.BbE4y-yl.mjs +0 -177
- package/dist/shared/core.Bdy3hhTc.mjs +0 -28382
- package/dist/shared/core.BfCKSW-g.d.mts +0 -1266
- package/dist/shared/core.BhNcrwzK.mjs +0 -7
- package/dist/shared/core.BkVA6gjl.mjs +0 -5
- package/dist/shared/core.BoYfZOBm.mjs +0 -3
- package/dist/shared/core.BsSXS-_R.mjs +0 -7
- package/dist/shared/core.C3JowhaZ.mjs +0 -32
- package/dist/shared/core.C4x8aaWa.mjs +0 -27
- package/dist/shared/core.CAgYpDtM.d.mts +0 -98
- package/dist/shared/core.CHf8VEa3.mjs +0 -1206
- package/dist/shared/core.CLSZtnFh.mjs +0 -69
- package/dist/shared/core.C_3y3eqV.d.mts +0 -139
- package/dist/shared/core.CbT8JVYL.mjs +0 -5
- package/dist/shared/core.CdNCAwq7.mjs +0 -176
- package/dist/shared/core.CmGY9blO.mjs +0 -6717
- package/dist/shared/core.CmPXpJ8l.mjs +0 -21
- package/dist/shared/core.Coi_LOUZ.mjs +0 -7
- package/dist/shared/core.CqAJJpK_.mjs +0 -3
- package/dist/shared/core.CywrQs86.d.mts +0 -31
- package/dist/shared/core.D00YbOhQ.d.mts +0 -300
- package/dist/shared/core.D0WZutNd.mjs +0 -94
- package/dist/shared/core.D4npX2q8.mjs +0 -18
- package/dist/shared/core.DB0Ue5Wx.d.mts +0 -70
- package/dist/shared/core.DC5IAaDT.d.mts +0 -334
- package/dist/shared/core.DE9qzhn8.d.mts +0 -83
- package/dist/shared/core.DGcIbsj4.mjs +0 -3946
- package/dist/shared/core.DH7TXqXf.mjs +0 -136
- package/dist/shared/core.DKhRkHRN.d.mts +0 -41
- package/dist/shared/core.DRJma0Ol.mjs +0 -22
- package/dist/shared/core.DU5SRqNF.mjs +0 -2209
- package/dist/shared/core.DXhDWKFZ.d.mts +0 -3
- package/dist/shared/core.DbfO90vF.mjs +0 -434
- package/dist/shared/core.DcS-0zys.mjs +0 -10
- package/dist/shared/core.Dh119QSP.mjs +0 -4995
- package/dist/shared/core.DjcWextK.mjs +0 -1371
- package/dist/shared/core.Dojz4bvg.d.mts +0 -504
- package/dist/shared/core.FZ305VYd.mjs +0 -21
- package/dist/shared/core.OtRNdMxy.d.mts +0 -352
- package/dist/shared/core.RfnaEmgA.mjs +0 -7
- package/dist/shared/core.btEq3i3f.mjs +0 -300
- package/dist/shared/core.oSV6SRfk.mjs +0 -13
- package/dist/shared/core.om36dXXW.mjs +0 -41
- package/dist/shared/core.osFs8tU7.d.mts +0 -466
- package/dist/shared/core.q10OP9oJ.mjs +0 -5
- package/dist/shared/core.tpvDGvdC.d.mts +0 -87
- package/dist/shared/core.uFk_o9X6.mjs +0 -13
- package/dist/types/_aux.d.mts +0 -4
- package/dist/types/_aux.mjs +0 -8
- package/dist/types/expression-model.d.mts +0 -190
- package/dist/types/expression-model.mjs +0 -109
- package/dist/types/expression.d.mts +0 -6
- package/dist/types/expression.mjs +0 -113
- package/dist/types/fqnRef.d.mts +0 -60
- package/dist/types/fqnRef.mjs +0 -45
- package/dist/types/scalar.d.mts +0 -2
- package/dist/types/scalar.mjs +0 -4
- package/dist/utils/iterable/index.d.mts +0 -132
- package/dist/utils/iterable/index.mjs +0 -62
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs } from './core.B85MJLTf.mjs';
|
|
2
|
-
import { e as e$1 } from './core.CqAJJpK_.mjs';
|
|
3
|
-
|
|
4
|
-
const e={done:true,hasNext:false},t$1={done:false,hasNext:false},n$1=()=>e;
|
|
5
|
-
|
|
6
|
-
function t(e,...t){let a=e,o=t.map(e=>`lazy`in e?r(e):void 0),s=0;for(;s<t.length;){if(o[s]===void 0||!i(a)){let e=t[s];a=e(a),s+=1;continue}let e=[];for(let n=s;n<t.length;n++){let t=o[n];if(t===void 0||(e.push(t),t.isSingle))break}let r=[];for(let t of a)if(n(t,r,e))break;let{isSingle:c}=e.at(-1);a=c?r[0]:r,s+=e.length;}return a}function n(t,r,i){if(i.length===0)return r.push(t),false;let a=t,o=t$1,s=false;for(let[e,t]of i.entries()){let{index:c,items:l}=t;if(l.push(a),o=t(a,c,l),t.index+=1,o.hasNext){if(o.hasMany??false){for(let t of o.next)if(n(t,r,i.slice(e+1)))return true;return s}a=o.next;}if(!o.hasNext)break;o.done&&(s=true);}return o.hasNext&&r.push(a),s}function r(e){let{lazy:t,lazyArgs:n}=e,r=t(...n);return Object.assign(r,{isSingle:t.single??false,index:0,items:[]})}function i(e){return typeof e==`string`||typeof e==`object`&&!!e&&Symbol.iterator in e}
|
|
7
|
-
|
|
8
|
-
var naturalCompareLite = {exports: {}};
|
|
9
|
-
|
|
10
|
-
var hasRequiredNaturalCompareLite;
|
|
11
|
-
|
|
12
|
-
function requireNaturalCompareLite () {
|
|
13
|
-
if (hasRequiredNaturalCompareLite) return naturalCompareLite.exports;
|
|
14
|
-
hasRequiredNaturalCompareLite = 1;
|
|
15
|
-
/*
|
|
16
|
-
* @version 1.4.0
|
|
17
|
-
* @date 2015-10-26
|
|
18
|
-
* @stability 3 - Stable
|
|
19
|
-
* @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
|
|
20
|
-
* @license MIT License
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var naturalCompare = function(a, b) {
|
|
25
|
-
var i, codeA
|
|
26
|
-
, codeB = 1
|
|
27
|
-
, posA = 0
|
|
28
|
-
, posB = 0
|
|
29
|
-
, alphabet = String.alphabet;
|
|
30
|
-
|
|
31
|
-
function getCode(str, pos, code) {
|
|
32
|
-
if (code) {
|
|
33
|
-
for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i;
|
|
34
|
-
return +str.slice(pos - 1, i)
|
|
35
|
-
}
|
|
36
|
-
code = alphabet && alphabet.indexOf(str.charAt(pos));
|
|
37
|
-
return code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code
|
|
38
|
-
: code < 46 ? 65 // -
|
|
39
|
-
: code < 48 ? code - 1
|
|
40
|
-
: code < 58 ? code + 18 // 0-9
|
|
41
|
-
: code < 65 ? code - 11
|
|
42
|
-
: code < 91 ? code + 11 // A-Z
|
|
43
|
-
: code < 97 ? code - 37
|
|
44
|
-
: code < 123 ? code + 5 // a-z
|
|
45
|
-
: code - 63
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if ((a+="") != (b+="")) for (;codeB;) {
|
|
50
|
-
codeA = getCode(a, posA++);
|
|
51
|
-
codeB = getCode(b, posB++);
|
|
52
|
-
|
|
53
|
-
if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
|
|
54
|
-
codeA = getCode(a, posA, posA);
|
|
55
|
-
codeB = getCode(b, posB, posA = i);
|
|
56
|
-
posB = i;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (codeA != codeB) return (codeA < codeB) ? -1 : 1
|
|
60
|
-
}
|
|
61
|
-
return 0
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
naturalCompareLite.exports = naturalCompare;
|
|
66
|
-
} catch (e) {
|
|
67
|
-
String.naturalCompare = naturalCompare;
|
|
68
|
-
}
|
|
69
|
-
return naturalCompareLite.exports;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var naturalCompareLiteExports = requireNaturalCompareLite();
|
|
73
|
-
const compare = /*@__PURE__*/getDefaultExportFromCjs(naturalCompareLiteExports);
|
|
74
|
-
|
|
75
|
-
function compareNatural(a, b) {
|
|
76
|
-
if (a === b) return 0;
|
|
77
|
-
if (e$1(a)) {
|
|
78
|
-
if (e$1(b)) {
|
|
79
|
-
return compare(a, b);
|
|
80
|
-
}
|
|
81
|
-
return 1;
|
|
82
|
-
}
|
|
83
|
-
return e$1(b) ? -1 : 0;
|
|
84
|
-
}
|
|
85
|
-
function compareNaturalHierarchically(separator = ".", deepestFirst = false) {
|
|
86
|
-
return (a, b) => {
|
|
87
|
-
if (a === b) return 0;
|
|
88
|
-
if (!a) return -1;
|
|
89
|
-
if (!b) return 1;
|
|
90
|
-
const aParts = a.split(separator);
|
|
91
|
-
const bParts = b.split(separator);
|
|
92
|
-
const minLength = Math.min(aParts.length, bParts.length);
|
|
93
|
-
for (let i = 0; i < minLength; i++) {
|
|
94
|
-
const aPart = aParts[i];
|
|
95
|
-
const bPart = bParts[i];
|
|
96
|
-
const comparison = compare(aPart, bPart);
|
|
97
|
-
if (comparison !== 0) {
|
|
98
|
-
return comparison;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const diff = aParts.length - bParts.length;
|
|
102
|
-
return deepestFirst ? -1 * diff : diff;
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export { t$1 as a, compareNaturalHierarchically as b, compareNatural as c, n$1 as n, t };
|
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
import { c as customInspectSymbol } from './core.BFd1lU9R.mjs';
|
|
2
|
-
import { e } from './core.BoYfZOBm.mjs';
|
|
3
|
-
import { i as intersection, u as union, d as difference, e as equals } from './core.DbfO90vF.mjs';
|
|
4
|
-
import { s as stringHash } from './core.oSV6SRfk.mjs';
|
|
5
|
-
import { t } from './core.3ZhnKAlZ.mjs';
|
|
6
|
-
import { t as t$1 } from './core.CbT8JVYL.mjs';
|
|
7
|
-
import { b as isDescendantOf, i as isAncestor, e as isString, s as sortNaturalByFqn, d as isSameHierarchy } from './core.CdNCAwq7.mjs';
|
|
8
|
-
import { i as isome } from './core.FZ305VYd.mjs';
|
|
9
|
-
import { i as ifilter } from './core.DRJma0Ol.mjs';
|
|
10
|
-
import { i as invariant } from './core.D4npX2q8.mjs';
|
|
11
|
-
|
|
12
|
-
function isNestedConnection(nested, parent) {
|
|
13
|
-
if (!parent) {
|
|
14
|
-
const p = nested;
|
|
15
|
-
return (n) => isNestedConnection(n, p);
|
|
16
|
-
}
|
|
17
|
-
const isSameSource = nested.source === parent.source;
|
|
18
|
-
const isSameTarget = nested.target === parent.target;
|
|
19
|
-
if (isSameSource && isSameTarget) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
const isSourceNested = isAncestor(parent.source.id, nested.source.id);
|
|
23
|
-
const isTargetNested = isAncestor(parent.target.id, nested.target.id);
|
|
24
|
-
return isSourceNested && isTargetNested || isSameSource && isTargetNested || isSameTarget && isSourceNested;
|
|
25
|
-
}
|
|
26
|
-
function findDeepestNestedConnection(connections, connection) {
|
|
27
|
-
let deepest = connection;
|
|
28
|
-
for (const c of connections) {
|
|
29
|
-
if (isNestedConnection(c, deepest)) {
|
|
30
|
-
deepest = c;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return deepest !== connection ? deepest : null;
|
|
34
|
-
}
|
|
35
|
-
function sortDeepestFirst(connections) {
|
|
36
|
-
const sorted = [];
|
|
37
|
-
const unsorted = connections.slice();
|
|
38
|
-
let next;
|
|
39
|
-
while (next = unsorted.shift()) {
|
|
40
|
-
let deepest;
|
|
41
|
-
while (deepest = findDeepestNestedConnection(unsorted, next)) {
|
|
42
|
-
const index = unsorted.indexOf(deepest);
|
|
43
|
-
sorted.push(unsorted.splice(index, 1)[0]);
|
|
44
|
-
}
|
|
45
|
-
sorted.push(next);
|
|
46
|
-
}
|
|
47
|
-
return sorted;
|
|
48
|
-
}
|
|
49
|
-
function boundaryHierarchy(conn) {
|
|
50
|
-
return conn.boundary?.id ? `.${conn.boundary.id}` : "";
|
|
51
|
-
}
|
|
52
|
-
function sortConnectionsByBoundaryHierarchy(connections, sort) {
|
|
53
|
-
if (!connections || isString(connections)) {
|
|
54
|
-
const dir = connections ?? "asc";
|
|
55
|
-
return (arr) => _sortByBoundary(arr, dir);
|
|
56
|
-
}
|
|
57
|
-
return _sortByBoundary(connections, sort ?? "asc");
|
|
58
|
-
}
|
|
59
|
-
function _sortByBoundary(connections, order) {
|
|
60
|
-
return t(
|
|
61
|
-
connections,
|
|
62
|
-
t$1((conn) => ({
|
|
63
|
-
id: boundaryHierarchy(conn),
|
|
64
|
-
conn
|
|
65
|
-
})),
|
|
66
|
-
sortNaturalByFqn(order),
|
|
67
|
-
t$1((p) => p.conn)
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
function findAscendingConnections(connections, connection) {
|
|
71
|
-
return connections.filter((c) => isNestedConnection(connection, c));
|
|
72
|
-
}
|
|
73
|
-
function findDescendantConnections(connections, connection) {
|
|
74
|
-
return connections.filter(isNestedConnection(connection));
|
|
75
|
-
}
|
|
76
|
-
function mergeConnections(connections) {
|
|
77
|
-
const map2 = /* @__PURE__ */ new Map();
|
|
78
|
-
for (const conn of connections) {
|
|
79
|
-
const existing = map2.get(conn.id);
|
|
80
|
-
if (existing) {
|
|
81
|
-
map2.set(conn.id, conn.mergeWith(existing));
|
|
82
|
-
} else {
|
|
83
|
-
map2.set(conn.id, conn);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return [...map2.values()];
|
|
87
|
-
}
|
|
88
|
-
function differenceConnections(source, exclude) {
|
|
89
|
-
const minus = new Map([...exclude].map((c) => [c.id, c]));
|
|
90
|
-
return [...source].reduce((acc, c) => {
|
|
91
|
-
const other = minus.get(c.id);
|
|
92
|
-
if (!other) {
|
|
93
|
-
acc.push(c);
|
|
94
|
-
return acc;
|
|
95
|
-
}
|
|
96
|
-
const updated = c.difference(other);
|
|
97
|
-
if (updated.nonEmpty()) {
|
|
98
|
-
acc.push(updated);
|
|
99
|
-
}
|
|
100
|
-
return acc;
|
|
101
|
-
}, []);
|
|
102
|
-
}
|
|
103
|
-
function hasSameSourceTarget(a, b) {
|
|
104
|
-
if (b) {
|
|
105
|
-
return a.source === b.source && a.target === b.target;
|
|
106
|
-
}
|
|
107
|
-
return (b2) => a.source === b2.source && a.target === b2.target;
|
|
108
|
-
}
|
|
109
|
-
function hasSameSource(a, b) {
|
|
110
|
-
if (b) {
|
|
111
|
-
return a.source === b.source;
|
|
112
|
-
}
|
|
113
|
-
return (b2) => a.source === b2.source;
|
|
114
|
-
}
|
|
115
|
-
function hasSameTarget(a, b) {
|
|
116
|
-
if (b) {
|
|
117
|
-
return a.target === b.target;
|
|
118
|
-
}
|
|
119
|
-
return (b2) => a.target === b2.target;
|
|
120
|
-
}
|
|
121
|
-
function isOutgoing(a, source) {
|
|
122
|
-
if (!source) {
|
|
123
|
-
const _source = a;
|
|
124
|
-
return (b) => isOutgoing(b, _source);
|
|
125
|
-
}
|
|
126
|
-
const at = a;
|
|
127
|
-
return isDescendantOf(at.source, source) && !isDescendantOf(at.target, source);
|
|
128
|
-
}
|
|
129
|
-
function isIncoming(a, target) {
|
|
130
|
-
if (!target) {
|
|
131
|
-
const _target = a;
|
|
132
|
-
return (b) => isIncoming(b, _target);
|
|
133
|
-
}
|
|
134
|
-
const at = a;
|
|
135
|
-
return isDescendantOf(at.target, target) && !isDescendantOf(at.source, target);
|
|
136
|
-
}
|
|
137
|
-
function isAnyInOut(a, source) {
|
|
138
|
-
if (!source) {
|
|
139
|
-
const _source = a;
|
|
140
|
-
return (b) => isAnyInOut(b, _source);
|
|
141
|
-
}
|
|
142
|
-
const at = a;
|
|
143
|
-
return isDescendantOf(at.source, source) !== isDescendantOf(at.target, source);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function findConnection(source, target, direction = "directed") {
|
|
147
|
-
if (source === target) {
|
|
148
|
-
return [];
|
|
149
|
-
}
|
|
150
|
-
if (isSameHierarchy(source, target)) {
|
|
151
|
-
return [];
|
|
152
|
-
}
|
|
153
|
-
const directedIntersection = intersection(source.allOutgoing, target.allIncoming);
|
|
154
|
-
const directed = directedIntersection.size > 0 ? new ConnectionModel(
|
|
155
|
-
source,
|
|
156
|
-
target,
|
|
157
|
-
directedIntersection
|
|
158
|
-
) : null;
|
|
159
|
-
if (direction === "directed") {
|
|
160
|
-
return directed ? [directed] : [];
|
|
161
|
-
}
|
|
162
|
-
const reverseIntersection = intersection(source.allIncoming, target.allOutgoing);
|
|
163
|
-
const reverse = reverseIntersection.size > 0 ? new ConnectionModel(
|
|
164
|
-
target,
|
|
165
|
-
source,
|
|
166
|
-
reverseIntersection
|
|
167
|
-
) : null;
|
|
168
|
-
if (directed && reverse) {
|
|
169
|
-
return [directed, reverse];
|
|
170
|
-
}
|
|
171
|
-
if (directed) {
|
|
172
|
-
return [directed];
|
|
173
|
-
}
|
|
174
|
-
if (reverse) {
|
|
175
|
-
return [reverse];
|
|
176
|
-
}
|
|
177
|
-
return [];
|
|
178
|
-
}
|
|
179
|
-
function findConnectionsBetween(element, others, direction = "both") {
|
|
180
|
-
if (element.allIncoming.size === 0 && element.allOutgoing.size === 0) {
|
|
181
|
-
return [];
|
|
182
|
-
}
|
|
183
|
-
const outgoing = [];
|
|
184
|
-
const incoming = [];
|
|
185
|
-
for (const _other of others) {
|
|
186
|
-
if (element === _other) {
|
|
187
|
-
continue;
|
|
188
|
-
}
|
|
189
|
-
for (const found of findConnection(element, _other, direction)) {
|
|
190
|
-
if (found.source === element) {
|
|
191
|
-
outgoing.push(found);
|
|
192
|
-
} else {
|
|
193
|
-
incoming.push(found);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return [
|
|
198
|
-
...outgoing,
|
|
199
|
-
...incoming
|
|
200
|
-
];
|
|
201
|
-
}
|
|
202
|
-
function findConnectionsWithin(elements) {
|
|
203
|
-
return [...elements].reduce((acc, el, index, array) => {
|
|
204
|
-
if (index === array.length - 1) {
|
|
205
|
-
return acc;
|
|
206
|
-
}
|
|
207
|
-
acc.push(
|
|
208
|
-
...findConnectionsBetween(el, array.slice(index + 1), "both")
|
|
209
|
-
);
|
|
210
|
-
return acc;
|
|
211
|
-
}, []);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const modelConnection = {
|
|
215
|
-
__proto__: null,
|
|
216
|
-
findConnection: findConnection,
|
|
217
|
-
findConnectionsBetween: findConnectionsBetween,
|
|
218
|
-
findConnectionsWithin: findConnectionsWithin
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
class ConnectionModel {
|
|
222
|
-
constructor(source, target, relations = /* @__PURE__ */ new Set()) {
|
|
223
|
-
this.source = source;
|
|
224
|
-
this.target = target;
|
|
225
|
-
this.relations = relations;
|
|
226
|
-
this.id = stringHash(`model:${source.id}:${target.id}`);
|
|
227
|
-
}
|
|
228
|
-
id;
|
|
229
|
-
_boundary;
|
|
230
|
-
/**
|
|
231
|
-
* Common ancestor of the source and target elements.
|
|
232
|
-
* Represents the boundary of the connection.
|
|
233
|
-
*/
|
|
234
|
-
get boundary() {
|
|
235
|
-
return this._boundary ??= this.source.commonAncestor(this.target);
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Human readable expression of the connection
|
|
239
|
-
* Mostly used for testing and debugging
|
|
240
|
-
*/
|
|
241
|
-
get expression() {
|
|
242
|
-
return `${this.source.id} -> ${this.target.id}`;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Returns true if only includes relations between the source and target elements.
|
|
246
|
-
*/
|
|
247
|
-
get isDirect() {
|
|
248
|
-
return this.nonEmpty() && !this.isImplicit;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Returns true if includes relations between nested elements of the source and target elements.
|
|
252
|
-
*/
|
|
253
|
-
get isImplicit() {
|
|
254
|
-
return this.nonEmpty() && isome(this.relations, e(hasSameSourceTarget(this)));
|
|
255
|
-
}
|
|
256
|
-
get directRelations() {
|
|
257
|
-
return new Set(ifilter(this.relations, hasSameSourceTarget(this)));
|
|
258
|
-
}
|
|
259
|
-
nonEmpty() {
|
|
260
|
-
return this.relations.size > 0;
|
|
261
|
-
}
|
|
262
|
-
mergeWith(other) {
|
|
263
|
-
invariant(this.source.id === other.source.id, "Cannot merge connections with different sources");
|
|
264
|
-
invariant(this.target.id === other.target.id, "Cannot merge connections with different targets");
|
|
265
|
-
return new ConnectionModel(
|
|
266
|
-
this.source,
|
|
267
|
-
this.target,
|
|
268
|
-
union(this.relations, other.relations)
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
difference(other) {
|
|
272
|
-
return new ConnectionModel(
|
|
273
|
-
this.source,
|
|
274
|
-
this.target,
|
|
275
|
-
difference(this.relations, other.relations)
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
intersect(other) {
|
|
279
|
-
invariant(other instanceof ConnectionModel, "Cannot intersect connection with different type");
|
|
280
|
-
return new ConnectionModel(
|
|
281
|
-
this.source,
|
|
282
|
-
this.target,
|
|
283
|
-
intersection(this.relations, other.relations)
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
equals(other) {
|
|
287
|
-
invariant(other instanceof ConnectionModel, "Cannot merge connection with different type");
|
|
288
|
-
const _other = other;
|
|
289
|
-
return this.id === _other.id && this.source.id === _other.source.id && this.target.id === _other.target.id && equals(this.relations, _other.relations);
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Returns a new instance with the updated relations.
|
|
293
|
-
*
|
|
294
|
-
* @param relations - A readonly set of `RelationshipModel` instances representing the new relations.
|
|
295
|
-
* @returns A new `ConnectionModel` instance with the updated relations.
|
|
296
|
-
*/
|
|
297
|
-
update(relations) {
|
|
298
|
-
return new ConnectionModel(
|
|
299
|
-
this.source,
|
|
300
|
-
this.target,
|
|
301
|
-
relations
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
[customInspectSymbol](_depth, _inspectOptions, _inspect) {
|
|
305
|
-
const asString = this.toString();
|
|
306
|
-
Object.defineProperty(asString, "constructor", {
|
|
307
|
-
value: ConnectionModel,
|
|
308
|
-
enumerable: false
|
|
309
|
-
});
|
|
310
|
-
return asString;
|
|
311
|
-
}
|
|
312
|
-
toString() {
|
|
313
|
-
return [
|
|
314
|
-
this.expression,
|
|
315
|
-
this.relations.size ? " relations:" : " relations: [ ]",
|
|
316
|
-
...[...this.relations].map((c) => " " + c.expression)
|
|
317
|
-
].join("\n");
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Creates a new connection with reversed direction (target becomes source and vice versa)
|
|
321
|
-
* @param search - When true, attempts to find an existing connection between the reversed nodes
|
|
322
|
-
*/
|
|
323
|
-
reversed(search = false) {
|
|
324
|
-
if (!search) {
|
|
325
|
-
return new ConnectionModel(this.target, this.source);
|
|
326
|
-
}
|
|
327
|
-
const [found] = findConnection(this.target, this.source, "directed");
|
|
328
|
-
return found ?? new ConnectionModel(this.target, this.source, /* @__PURE__ */ new Set());
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
export { ConnectionModel as C, findDeepestNestedConnection as a, findDescendantConnections as b, hasSameSourceTarget as c, differenceConnections as d, hasSameTarget as e, findAscendingConnections as f, isIncoming as g, hasSameSource as h, isAnyInOut as i, isNestedConnection as j, isOutgoing as k, sortDeepestFirst as l, mergeConnections as m, modelConnection as n, findConnectionsBetween as o, findConnection as p, findConnectionsWithin as q, sortConnectionsByBoundaryHierarchy as s };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { i as isAncestor } from './core.CdNCAwq7.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 = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
28
|
-
|
|
29
|
-
export { Connection as C, customInspectSymbol as c };
|