@likec4/core 1.23.1 → 1.24.1
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/dist/builder/index.d.mts +3 -3
- package/dist/builder/index.d.ts +3 -3
- package/dist/builder/index.mjs +2 -2
- package/dist/compute-view/index.d.mts +4 -4
- package/dist/compute-view/index.d.ts +4 -4
- package/dist/compute-view/index.mjs +4 -4
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.mjs +4 -4
- package/dist/model/index.d.mts +5 -5
- package/dist/model/index.d.ts +5 -5
- package/dist/model/index.mjs +1 -1
- package/dist/shared/{core.3xeQpJ_K.d.cts → core.3L0y_SNW.d.mts} +2 -2
- package/dist/shared/{core.QP35c488.d.cts → core.Bhx0OGK8.d.mts} +1 -1
- package/dist/shared/{core.QP35c488.d.mts → core.Bhx0OGK8.d.ts} +1 -1
- package/dist/shared/{core.DsDq-blc.d.ts → core.BreLKHbT.d.mts} +1 -2
- package/dist/shared/{core.DQCc-Jxk.d.ts → core.BsAIrb_r.d.ts} +1 -1
- package/dist/shared/{core.CJaCUZQ9.d.mts → core.C9UbC1nX.d.ts} +1 -2
- package/dist/shared/core.CHsHWcLq.mjs +2499 -0
- package/dist/shared/{core.s6UB2oA0.d.ts → core.DBToPQ3n.d.ts} +2 -2
- package/dist/shared/{core.GIZxdz4M.mjs → core.DT2JT2Cd.mjs} +1 -1
- package/dist/shared/{core.1pNr6Ryk.d.ts → core.DbfQeUKm.d.mts} +5 -4
- package/dist/shared/{core.uGbvOLGK.mjs → core.Mz23ea8u.mjs} +29 -10
- package/dist/shared/{core.BYs5deiY.d.cts → core.RiWsY3jz.d.mts} +1 -1
- package/dist/shared/{core.DKJ2y3NP.d.mts → core.k4jahJ8j.d.ts} +5 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.mjs +1 -1
- package/dist/utils/index.d.mts +92 -4
- package/dist/utils/index.d.ts +92 -4
- package/dist/utils/index.mjs +2 -2
- package/package.json +5 -29
- package/src/compute-view/deployment-view/clean-connections.ts +1 -1
- package/src/compute-view/deployment-view/stages/stage-final.ts +1 -1
- package/src/compute-view/element-view/compute.ts +1 -1
- package/src/compute-view/element-view/memory/memory.ts +1 -1
- package/src/compute-view/memory/ops.ts +1 -1
- package/src/compute-view/relationships-view/layout.ts +1 -1
- package/src/compute-view/relationships-view/utils.ts +1 -1
- package/src/model/DeploymentElementModel.ts +4 -6
- package/src/model/DeploymentModel.ts +1 -1
- package/src/model/LikeC4Model.ts +23 -2
- package/src/model/view/LikeC4ViewModel.ts +5 -6
- package/src/types/deployments.ts +0 -1
- package/src/types/index.ts +1 -1
- package/src/types/theme.ts +1 -1
- package/src/utils/index.ts +8 -1
- package/src/utils/mnemonist.ts +8 -0
- package/src/utils/set.ts +5 -3
- package/dist/builder/index.cjs +0 -887
- package/dist/builder/index.d.cts +0 -509
- package/dist/compute-view/index.cjs +0 -86
- package/dist/compute-view/index.d.cts +0 -23
- package/dist/index.cjs +0 -3857
- package/dist/index.d.cts +0 -146
- package/dist/model/index.cjs +0 -40
- package/dist/model/index.d.cts +0 -259
- package/dist/shared/core.BHQYwEvc.d.mts +0 -12
- package/dist/shared/core.BS_nXBsP.d.cts +0 -858
- package/dist/shared/core.BYiA0A6H.cjs +0 -39
- package/dist/shared/core.CEJQrbXY.cjs +0 -441
- package/dist/shared/core.D0KD4FiT.d.mts +0 -127
- package/dist/shared/core.DEzbhxsA.cjs +0 -14874
- package/dist/shared/core.DUbKSpjd.cjs +0 -26
- package/dist/shared/core.DqmAHWZs.cjs +0 -7501
- package/dist/shared/core.OjOfEBRQ.d.cts +0 -731
- package/dist/shared/core.QP35c488.d.ts +0 -185
- package/dist/shared/core.f1tiPwpd.mjs +0 -14819
- package/dist/types/index.cjs +0 -110
- package/dist/types/index.d.cts +0 -72
- package/dist/utils/index.cjs +0 -99
- package/dist/utils/index.d.cts +0 -340
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const object_hash = require('./core.DEzbhxsA.cjs');
|
|
4
|
-
|
|
5
|
-
function computeRelationshipsView(subjectId, likec4model) {
|
|
6
|
-
const subject = likec4model.element(subjectId);
|
|
7
|
-
let relationships = {
|
|
8
|
-
incoming: [...subject.incoming()],
|
|
9
|
-
outgoing: [...subject.outgoing()]
|
|
10
|
-
};
|
|
11
|
-
const subjectSiblings = object_hash.toSet(subject.ascendingSiblings());
|
|
12
|
-
const isSubjectSibling = (e) => subjectSiblings.has(e);
|
|
13
|
-
const subjects = /* @__PURE__ */ new Set([subject]);
|
|
14
|
-
const incomers = new Set(relationships.incoming.flatMap((r) => {
|
|
15
|
-
subjects.add(r.target);
|
|
16
|
-
if (subjectSiblings.has(r.source)) {
|
|
17
|
-
return [r.source];
|
|
18
|
-
}
|
|
19
|
-
const parent = object_hash.ifind(r.source.ancestors(), isSubjectSibling);
|
|
20
|
-
return parent ? [r.source, parent] : [r.source];
|
|
21
|
-
}));
|
|
22
|
-
const outgoers = new Set(relationships.outgoing.flatMap((r) => {
|
|
23
|
-
subjects.add(r.source);
|
|
24
|
-
if (subjectSiblings.has(r.target)) {
|
|
25
|
-
return [r.target];
|
|
26
|
-
}
|
|
27
|
-
const parent = object_hash.ifind(r.target.ancestors(), isSubjectSibling);
|
|
28
|
-
return parent ? [r.target, parent] : [r.target];
|
|
29
|
-
}));
|
|
30
|
-
return {
|
|
31
|
-
incomers,
|
|
32
|
-
incoming: new Set(relationships.incoming),
|
|
33
|
-
subjects,
|
|
34
|
-
outgoing: new Set(relationships.outgoing),
|
|
35
|
-
outgoers
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
exports.computeRelationshipsView = computeRelationshipsView;
|
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const chunkWIMGWYZL = require('./core.DUbKSpjd.cjs');
|
|
4
|
-
|
|
5
|
-
function o$1(a){return t=>!a(t)}
|
|
6
|
-
|
|
7
|
-
function n(e){return e==null}
|
|
8
|
-
|
|
9
|
-
function o(r){return Array.isArray(r)}
|
|
10
|
-
|
|
11
|
-
function t(...a){return chunkWIMGWYZL.u(e,a)}var e=(a,o)=>o.every(l=>l(a));
|
|
12
|
-
|
|
13
|
-
function y(...a){return chunkWIMGWYZL.u(r,a)}var r=(a,o)=>o.some(e=>e(a));
|
|
14
|
-
|
|
15
|
-
exports.DeploymentElement = void 0;
|
|
16
|
-
((DeploymentElement2) => {
|
|
17
|
-
DeploymentElement2.isDeploymentNode = (el) => {
|
|
18
|
-
return "kind" in el && !("element" in el);
|
|
19
|
-
};
|
|
20
|
-
DeploymentElement2.isInstance = (el) => {
|
|
21
|
-
return "element" in el && !("kind" in el);
|
|
22
|
-
};
|
|
23
|
-
})(exports.DeploymentElement || (exports.DeploymentElement = {}));
|
|
24
|
-
|
|
25
|
-
function AsFqn(name, parent) {
|
|
26
|
-
return parent ? parent + "." + name : name;
|
|
27
|
-
}
|
|
28
|
-
const BorderStyles = ["solid", "dashed", "dotted", "none"];
|
|
29
|
-
exports.ElementKind = void 0;
|
|
30
|
-
((ElementKind2) => {
|
|
31
|
-
ElementKind2.Group = "@group";
|
|
32
|
-
})(exports.ElementKind || (exports.ElementKind = {}));
|
|
33
|
-
const ElementShapes = [
|
|
34
|
-
"rectangle",
|
|
35
|
-
"person",
|
|
36
|
-
"browser",
|
|
37
|
-
"mobile",
|
|
38
|
-
"cylinder",
|
|
39
|
-
"storage",
|
|
40
|
-
"queue"
|
|
41
|
-
];
|
|
42
|
-
const DefaultThemeColor = "primary";
|
|
43
|
-
const DefaultElementShape = "rectangle";
|
|
44
|
-
const DefaultShapeSize = "md";
|
|
45
|
-
const DefaultPaddingSize = "md";
|
|
46
|
-
const DefaultTextSize = "md";
|
|
47
|
-
|
|
48
|
-
function isElementRef(expr) {
|
|
49
|
-
return "element" in expr;
|
|
50
|
-
}
|
|
51
|
-
function isExpandedElementExpr(expr) {
|
|
52
|
-
return "expanded" in expr;
|
|
53
|
-
}
|
|
54
|
-
function isCustomElement(expr) {
|
|
55
|
-
return "custom" in expr && (isElement(expr.custom.expr) || isElementWhere(expr.custom.expr));
|
|
56
|
-
}
|
|
57
|
-
function isWildcard(expr) {
|
|
58
|
-
return "wildcard" in expr;
|
|
59
|
-
}
|
|
60
|
-
function isElementKindExpr(expr) {
|
|
61
|
-
return "elementKind" in expr && "isEqual" in expr;
|
|
62
|
-
}
|
|
63
|
-
function isElementTagExpr(expr) {
|
|
64
|
-
return "elementTag" in expr && "isEqual" in expr;
|
|
65
|
-
}
|
|
66
|
-
function isElement(expr) {
|
|
67
|
-
return isElementRef(expr) || isWildcard(expr) || isElementKindExpr(expr) || isElementTagExpr(expr) || isExpandedElementExpr(expr);
|
|
68
|
-
}
|
|
69
|
-
function isElementWhere(expr) {
|
|
70
|
-
return "where" in expr && isElement(expr.where.expr);
|
|
71
|
-
}
|
|
72
|
-
function isElementPredicateExpr(expr) {
|
|
73
|
-
return isElement(expr) || isElementWhere(expr) || isCustomElement(expr);
|
|
74
|
-
}
|
|
75
|
-
function isRelation(expr) {
|
|
76
|
-
return "source" in expr && "target" in expr;
|
|
77
|
-
}
|
|
78
|
-
function isInOut(expr) {
|
|
79
|
-
return "inout" in expr;
|
|
80
|
-
}
|
|
81
|
-
function isIncoming(expr) {
|
|
82
|
-
return "incoming" in expr;
|
|
83
|
-
}
|
|
84
|
-
function isOutgoing(expr) {
|
|
85
|
-
return "outgoing" in expr;
|
|
86
|
-
}
|
|
87
|
-
function isRelationExpression(expr) {
|
|
88
|
-
return isRelation(expr) || isInOut(expr) || isIncoming(expr) || isOutgoing(expr);
|
|
89
|
-
}
|
|
90
|
-
function isRelationWhere(expr) {
|
|
91
|
-
return "where" in expr && isRelationExpression(expr.where.expr);
|
|
92
|
-
}
|
|
93
|
-
function isCustomRelationExpr(expr) {
|
|
94
|
-
return "customRelation" in expr;
|
|
95
|
-
}
|
|
96
|
-
function isRelationPredicateExpr(expr) {
|
|
97
|
-
return isRelationExpression(expr) || isRelationWhere(expr) || isCustomRelationExpr(expr);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const expression = {
|
|
101
|
-
__proto__: null,
|
|
102
|
-
isCustomElement: isCustomElement,
|
|
103
|
-
isCustomRelationExpr: isCustomRelationExpr,
|
|
104
|
-
isElement: isElement,
|
|
105
|
-
isElementKindExpr: isElementKindExpr,
|
|
106
|
-
isElementPredicateExpr: isElementPredicateExpr,
|
|
107
|
-
isElementRef: isElementRef,
|
|
108
|
-
isElementTagExpr: isElementTagExpr,
|
|
109
|
-
isElementWhere: isElementWhere,
|
|
110
|
-
isExpandedElementExpr: isExpandedElementExpr,
|
|
111
|
-
isInOut: isInOut,
|
|
112
|
-
isIncoming: isIncoming,
|
|
113
|
-
isOutgoing: isOutgoing,
|
|
114
|
-
isRelation: isRelation,
|
|
115
|
-
isRelationExpression: isRelationExpression,
|
|
116
|
-
isRelationPredicateExpr: isRelationPredicateExpr,
|
|
117
|
-
isRelationWhere: isRelationWhere,
|
|
118
|
-
isWildcard: isWildcard
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
exports.FqnRef = void 0;
|
|
122
|
-
((FqnRef2) => {
|
|
123
|
-
FqnRef2.isInsideInstanceRef = (ref) => {
|
|
124
|
-
return "deployment" in ref && "element" in ref;
|
|
125
|
-
};
|
|
126
|
-
FqnRef2.isDeploymentElementRef = (ref) => {
|
|
127
|
-
return "deployment" in ref && !("element" in ref);
|
|
128
|
-
};
|
|
129
|
-
FqnRef2.isDeploymentRef = (ref) => {
|
|
130
|
-
return !(0, FqnRef2.isModelRef)(ref);
|
|
131
|
-
};
|
|
132
|
-
FqnRef2.isModelRef = (ref) => {
|
|
133
|
-
return "model" in ref;
|
|
134
|
-
};
|
|
135
|
-
FqnRef2.toDeploymentRef = (ref) => {
|
|
136
|
-
chunkWIMGWYZL.invariant((0, FqnRef2.isDeploymentRef)(ref), "Expected DeploymentRef");
|
|
137
|
-
return (0, FqnRef2.isInsideInstanceRef)(ref) ? {
|
|
138
|
-
id: ref.deployment,
|
|
139
|
-
element: ref.element
|
|
140
|
-
} : {
|
|
141
|
-
id: ref.deployment
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
})(exports.FqnRef || (exports.FqnRef = {}));
|
|
145
|
-
exports.FqnExpr = void 0;
|
|
146
|
-
((FqnExpr2) => {
|
|
147
|
-
FqnExpr2.isWildcard = (expr) => {
|
|
148
|
-
return "wildcard" in expr && expr.wildcard === true;
|
|
149
|
-
};
|
|
150
|
-
FqnExpr2.isModelRef = (ref) => {
|
|
151
|
-
return "ref" in ref && exports.FqnRef.isModelRef(ref.ref);
|
|
152
|
-
};
|
|
153
|
-
FqnExpr2.isDeploymentRef = (ref) => {
|
|
154
|
-
return "ref" in ref && exports.FqnRef.isDeploymentRef(ref.ref);
|
|
155
|
-
};
|
|
156
|
-
})(exports.FqnExpr || (exports.FqnExpr = {}));
|
|
157
|
-
exports.RelationExpr = void 0;
|
|
158
|
-
((RelationExpr2) => {
|
|
159
|
-
RelationExpr2.isDirect = (expr) => {
|
|
160
|
-
return "source" in expr && "target" in expr;
|
|
161
|
-
};
|
|
162
|
-
RelationExpr2.isIncoming = (expr) => {
|
|
163
|
-
return "incoming" in expr;
|
|
164
|
-
};
|
|
165
|
-
RelationExpr2.isOutgoing = (expr) => {
|
|
166
|
-
return "outgoing" in expr;
|
|
167
|
-
};
|
|
168
|
-
RelationExpr2.isInOut = (expr) => {
|
|
169
|
-
return "inout" in expr;
|
|
170
|
-
};
|
|
171
|
-
RelationExpr2.isWhere = (expr) => {
|
|
172
|
-
return "where" in expr;
|
|
173
|
-
};
|
|
174
|
-
})(exports.RelationExpr || (exports.RelationExpr = {}));
|
|
175
|
-
exports.ExpressionV2 = void 0;
|
|
176
|
-
((ExpressionV22) => {
|
|
177
|
-
ExpressionV22.isFqnExpr = (expr) => {
|
|
178
|
-
return exports.FqnExpr.isWildcard(expr) || exports.FqnExpr.isModelRef(expr) || exports.FqnExpr.isDeploymentRef(expr);
|
|
179
|
-
};
|
|
180
|
-
ExpressionV22.isRelation = (expr) => {
|
|
181
|
-
return exports.RelationExpr.isDirect(expr) || exports.RelationExpr.isIncoming(expr) || exports.RelationExpr.isOutgoing(expr) || exports.RelationExpr.isInOut(expr);
|
|
182
|
-
};
|
|
183
|
-
})(exports.ExpressionV2 || (exports.ExpressionV2 = {}));
|
|
184
|
-
|
|
185
|
-
const isTagEqual = (operator) => {
|
|
186
|
-
return "tag" in operator;
|
|
187
|
-
};
|
|
188
|
-
const isKindEqual = (operator) => {
|
|
189
|
-
return "kind" in operator;
|
|
190
|
-
};
|
|
191
|
-
const isParticipantOperator = (operator) => {
|
|
192
|
-
return "participant" in operator;
|
|
193
|
-
};
|
|
194
|
-
const isNotOperator = (operator) => {
|
|
195
|
-
return "not" in operator;
|
|
196
|
-
};
|
|
197
|
-
const isAndOperator = (operator) => {
|
|
198
|
-
return "and" in operator;
|
|
199
|
-
};
|
|
200
|
-
const isOrOperator = (operator) => {
|
|
201
|
-
return "or" in operator;
|
|
202
|
-
};
|
|
203
|
-
function whereOperatorAsPredicate(operator) {
|
|
204
|
-
switch (true) {
|
|
205
|
-
case isParticipantOperator(operator): {
|
|
206
|
-
const participant = operator.participant;
|
|
207
|
-
const participantPredicate = whereOperatorAsPredicate(operator.operator);
|
|
208
|
-
return participantIs(participant, participantPredicate);
|
|
209
|
-
}
|
|
210
|
-
case isTagEqual(operator): {
|
|
211
|
-
if ("eq" in operator.tag) {
|
|
212
|
-
const tag2 = operator.tag.eq;
|
|
213
|
-
return (value) => {
|
|
214
|
-
return Array.isArray(value.tags) && value.tags.includes(tag2);
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
const tag = operator.tag.neq;
|
|
218
|
-
return (value) => {
|
|
219
|
-
return !Array.isArray(value.tags) || !value.tags.includes(tag);
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
case isKindEqual(operator): {
|
|
223
|
-
if ("eq" in operator.kind) {
|
|
224
|
-
const kind2 = operator.kind.eq;
|
|
225
|
-
return (value) => {
|
|
226
|
-
return value.kind === kind2;
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
const kind = operator.kind.neq;
|
|
230
|
-
return (value) => {
|
|
231
|
-
return n(value.kind) || value.kind !== kind;
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
case isNotOperator(operator): {
|
|
235
|
-
const predicate = whereOperatorAsPredicate(operator.not);
|
|
236
|
-
return o$1(predicate);
|
|
237
|
-
}
|
|
238
|
-
case isAndOperator(operator): {
|
|
239
|
-
const predicates = operator.and.map(whereOperatorAsPredicate);
|
|
240
|
-
return t(predicates);
|
|
241
|
-
}
|
|
242
|
-
case isOrOperator(operator): {
|
|
243
|
-
const predicates = operator.or.map(whereOperatorAsPredicate);
|
|
244
|
-
return y(predicates);
|
|
245
|
-
}
|
|
246
|
-
default:
|
|
247
|
-
chunkWIMGWYZL.nonexhaustive(operator);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function participantIs(participant, predicate) {
|
|
251
|
-
return (value) => {
|
|
252
|
-
if (!value.source || !value.target) {
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
switch (participant) {
|
|
256
|
-
case "source": {
|
|
257
|
-
return predicate(value.source);
|
|
258
|
-
}
|
|
259
|
-
case "target": {
|
|
260
|
-
return predicate(value.target);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const DefaultLineStyle = "dashed";
|
|
267
|
-
const DefaultArrowType = "normal";
|
|
268
|
-
const DefaultRelationshipColor = "gray";
|
|
269
|
-
|
|
270
|
-
function isViewRulePredicate(rule) {
|
|
271
|
-
return "include" in rule && Array.isArray(rule.include) || "exclude" in rule && Array.isArray(rule.exclude);
|
|
272
|
-
}
|
|
273
|
-
function isViewRuleGlobalPredicateRef(rule) {
|
|
274
|
-
return "predicateId" in rule;
|
|
275
|
-
}
|
|
276
|
-
function isViewRuleStyle(rule) {
|
|
277
|
-
return "style" in rule && "targets" in rule && Array.isArray(rule.targets);
|
|
278
|
-
}
|
|
279
|
-
function isViewRuleGlobalStyle(rule) {
|
|
280
|
-
return "styleId" in rule;
|
|
281
|
-
}
|
|
282
|
-
function isAutoLayoutDirection(autoLayout) {
|
|
283
|
-
return autoLayout === "TB" || autoLayout === "BT" || autoLayout === "LR" || autoLayout === "RL";
|
|
284
|
-
}
|
|
285
|
-
function isViewRuleAutoLayout(rule) {
|
|
286
|
-
return "direction" in rule;
|
|
287
|
-
}
|
|
288
|
-
function isViewRuleGroup(rule) {
|
|
289
|
-
return "title" in rule && "groupRules" in rule && Array.isArray(rule.groupRules);
|
|
290
|
-
}
|
|
291
|
-
function isDynamicViewParallelSteps(step) {
|
|
292
|
-
return "__parallel" in step && o(step.__parallel);
|
|
293
|
-
}
|
|
294
|
-
function isDeploymentView(view) {
|
|
295
|
-
return view.__ === "deployment";
|
|
296
|
-
}
|
|
297
|
-
function isDynamicView(view) {
|
|
298
|
-
return view.__ === "dynamic";
|
|
299
|
-
}
|
|
300
|
-
function isElementView(view) {
|
|
301
|
-
return n(view.__) || view.__ === "element";
|
|
302
|
-
}
|
|
303
|
-
function isExtendsElementView(view) {
|
|
304
|
-
return isElementView(view) && "extends" in view;
|
|
305
|
-
}
|
|
306
|
-
function isScopedElementView(view) {
|
|
307
|
-
return isElementView(view) && "viewOf" in view;
|
|
308
|
-
}
|
|
309
|
-
function stepEdgeId(step, parallelStep) {
|
|
310
|
-
const id = `step-${String(step).padStart(2, "0")}`;
|
|
311
|
-
return parallelStep ? `${id}.${parallelStep}` : id;
|
|
312
|
-
}
|
|
313
|
-
function isStepEdgeId(id) {
|
|
314
|
-
return id.startsWith("step-");
|
|
315
|
-
}
|
|
316
|
-
function extractStep(id) {
|
|
317
|
-
if (!isStepEdgeId(id)) {
|
|
318
|
-
throw new Error(`Invalid step edge id: ${id}`);
|
|
319
|
-
}
|
|
320
|
-
return parseFloat(id.slice("step-".length));
|
|
321
|
-
}
|
|
322
|
-
function getParallelStepsPrefix(id) {
|
|
323
|
-
if (isStepEdgeId(id) && id.includes(".")) {
|
|
324
|
-
return id.slice(0, id.indexOf(".") + 1);
|
|
325
|
-
}
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
328
|
-
exports.ComputedNode = void 0;
|
|
329
|
-
((ComputedNode2) => {
|
|
330
|
-
function modelRef(node) {
|
|
331
|
-
return node.modelRef === 1 ? node.id : node.modelRef ?? null;
|
|
332
|
-
}
|
|
333
|
-
ComputedNode2.modelRef = modelRef;
|
|
334
|
-
function deploymentRef(node) {
|
|
335
|
-
return node.deploymentRef === 1 ? node.id : node.deploymentRef ?? null;
|
|
336
|
-
}
|
|
337
|
-
ComputedNode2.deploymentRef = deploymentRef;
|
|
338
|
-
function isNodesGroup(node) {
|
|
339
|
-
return node.kind === exports.ElementKind.Group;
|
|
340
|
-
}
|
|
341
|
-
ComputedNode2.isNodesGroup = isNodesGroup;
|
|
342
|
-
})(exports.ComputedNode || (exports.ComputedNode = {}));
|
|
343
|
-
exports.ComputedView = void 0;
|
|
344
|
-
((ComputedView2) => {
|
|
345
|
-
function isDeployment(view) {
|
|
346
|
-
return view.__ === "deployment";
|
|
347
|
-
}
|
|
348
|
-
ComputedView2.isDeployment = isDeployment;
|
|
349
|
-
function isDynamic(view) {
|
|
350
|
-
return view.__ === "dynamic";
|
|
351
|
-
}
|
|
352
|
-
ComputedView2.isDynamic = isDynamic;
|
|
353
|
-
function isElement(view) {
|
|
354
|
-
return n(view.__) || view.__ === "element";
|
|
355
|
-
}
|
|
356
|
-
ComputedView2.isElement = isElement;
|
|
357
|
-
})(exports.ComputedView || (exports.ComputedView = {}));
|
|
358
|
-
function getBBoxCenter({
|
|
359
|
-
x,
|
|
360
|
-
y,
|
|
361
|
-
width,
|
|
362
|
-
height
|
|
363
|
-
}) {
|
|
364
|
-
return {
|
|
365
|
-
x: x + width / 2,
|
|
366
|
-
y: y + height / 2
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
exports.DiagramNode = void 0;
|
|
370
|
-
((DiagramNode2) => {
|
|
371
|
-
function modelRef(node) {
|
|
372
|
-
return node.modelRef === 1 ? node.id : node.modelRef ?? null;
|
|
373
|
-
}
|
|
374
|
-
DiagramNode2.modelRef = modelRef;
|
|
375
|
-
function deploymentRef(node) {
|
|
376
|
-
return node.deploymentRef === 1 ? node.id : node.deploymentRef ?? null;
|
|
377
|
-
}
|
|
378
|
-
DiagramNode2.deploymentRef = deploymentRef;
|
|
379
|
-
function isNodesGroup(node) {
|
|
380
|
-
return node.kind === exports.ElementKind.Group;
|
|
381
|
-
}
|
|
382
|
-
DiagramNode2.isNodesGroup = isNodesGroup;
|
|
383
|
-
})(exports.DiagramNode || (exports.DiagramNode = {}));
|
|
384
|
-
|
|
385
|
-
exports.AsFqn = AsFqn;
|
|
386
|
-
exports.BorderStyles = BorderStyles;
|
|
387
|
-
exports.DefaultArrowType = DefaultArrowType;
|
|
388
|
-
exports.DefaultElementShape = DefaultElementShape;
|
|
389
|
-
exports.DefaultLineStyle = DefaultLineStyle;
|
|
390
|
-
exports.DefaultPaddingSize = DefaultPaddingSize;
|
|
391
|
-
exports.DefaultRelationshipColor = DefaultRelationshipColor;
|
|
392
|
-
exports.DefaultShapeSize = DefaultShapeSize;
|
|
393
|
-
exports.DefaultTextSize = DefaultTextSize;
|
|
394
|
-
exports.DefaultThemeColor = DefaultThemeColor;
|
|
395
|
-
exports.ElementShapes = ElementShapes;
|
|
396
|
-
exports.expression = expression;
|
|
397
|
-
exports.extractStep = extractStep;
|
|
398
|
-
exports.getBBoxCenter = getBBoxCenter;
|
|
399
|
-
exports.getParallelStepsPrefix = getParallelStepsPrefix;
|
|
400
|
-
exports.isAndOperator = isAndOperator;
|
|
401
|
-
exports.isAutoLayoutDirection = isAutoLayoutDirection;
|
|
402
|
-
exports.isCustomElement = isCustomElement;
|
|
403
|
-
exports.isCustomRelationExpr = isCustomRelationExpr;
|
|
404
|
-
exports.isDeploymentView = isDeploymentView;
|
|
405
|
-
exports.isDynamicView = isDynamicView;
|
|
406
|
-
exports.isDynamicViewParallelSteps = isDynamicViewParallelSteps;
|
|
407
|
-
exports.isElement = isElement;
|
|
408
|
-
exports.isElementKindExpr = isElementKindExpr;
|
|
409
|
-
exports.isElementPredicateExpr = isElementPredicateExpr;
|
|
410
|
-
exports.isElementRef = isElementRef;
|
|
411
|
-
exports.isElementTagExpr = isElementTagExpr;
|
|
412
|
-
exports.isElementView = isElementView;
|
|
413
|
-
exports.isElementWhere = isElementWhere;
|
|
414
|
-
exports.isExpandedElementExpr = isExpandedElementExpr;
|
|
415
|
-
exports.isExtendsElementView = isExtendsElementView;
|
|
416
|
-
exports.isInOut = isInOut;
|
|
417
|
-
exports.isIncoming = isIncoming;
|
|
418
|
-
exports.isKindEqual = isKindEqual;
|
|
419
|
-
exports.isNotOperator = isNotOperator;
|
|
420
|
-
exports.isOrOperator = isOrOperator;
|
|
421
|
-
exports.isOutgoing = isOutgoing;
|
|
422
|
-
exports.isRelation = isRelation;
|
|
423
|
-
exports.isRelationExpression = isRelationExpression;
|
|
424
|
-
exports.isRelationPredicateExpr = isRelationPredicateExpr;
|
|
425
|
-
exports.isRelationWhere = isRelationWhere;
|
|
426
|
-
exports.isScopedElementView = isScopedElementView;
|
|
427
|
-
exports.isStepEdgeId = isStepEdgeId;
|
|
428
|
-
exports.isTagEqual = isTagEqual;
|
|
429
|
-
exports.isViewRuleAutoLayout = isViewRuleAutoLayout;
|
|
430
|
-
exports.isViewRuleGlobalPredicateRef = isViewRuleGlobalPredicateRef;
|
|
431
|
-
exports.isViewRuleGlobalStyle = isViewRuleGlobalStyle;
|
|
432
|
-
exports.isViewRuleGroup = isViewRuleGroup;
|
|
433
|
-
exports.isViewRulePredicate = isViewRulePredicate;
|
|
434
|
-
exports.isViewRuleStyle = isViewRuleStyle;
|
|
435
|
-
exports.isWildcard = isWildcard;
|
|
436
|
-
exports.n = n;
|
|
437
|
-
exports.o = o;
|
|
438
|
-
exports.o$1 = o$1;
|
|
439
|
-
exports.stepEdgeId = stepEdgeId;
|
|
440
|
-
exports.whereOperatorAsPredicate = whereOperatorAsPredicate;
|
|
441
|
-
exports.y = y;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { F as Fqn } from './core.QP35c488.mjs';
|
|
2
|
-
|
|
3
|
-
declare function parentFqn<E extends string>(fqn: E): E | null;
|
|
4
|
-
declare function nameFromFqn<E extends string>(fqn: E): string;
|
|
5
|
-
/**
|
|
6
|
-
* Check if one element is an ancestor of another
|
|
7
|
-
* Composable version
|
|
8
|
-
* @signature
|
|
9
|
-
* isAncestor(another)(ancestor)
|
|
10
|
-
*/
|
|
11
|
-
declare function isAncestor<A extends string | {
|
|
12
|
-
id: string;
|
|
13
|
-
}>(another: NoInfer<A>): (ancestor: A) => boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Check if one element is an ancestor of another
|
|
16
|
-
* @signature
|
|
17
|
-
* isAncestor(ancestor, another)
|
|
18
|
-
*/
|
|
19
|
-
declare function isAncestor<A extends string | {
|
|
20
|
-
id: string;
|
|
21
|
-
}>(ancestor: A, another: A): boolean;
|
|
22
|
-
declare function isSameHierarchy<T extends string>(one: NoInfer<T> | WithId<NoInfer<T>>): (another: T | WithId<T>) => boolean;
|
|
23
|
-
declare function isSameHierarchy<T extends string>(one: T | WithId<T>, another: T | WithId<T>): boolean;
|
|
24
|
-
type WithId<T> = {
|
|
25
|
-
id: T;
|
|
26
|
-
};
|
|
27
|
-
declare function isDescendantOf<T extends string>(ancestor: WithId<T>): (descedant: WithId<T>) => boolean;
|
|
28
|
-
declare function isDescendantOf<T extends string>(descedant: WithId<T>, ancestor: WithId<T>): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* How deep in the hierarchy the element is.
|
|
31
|
-
* Root element has depth 1
|
|
32
|
-
*/
|
|
33
|
-
declare function hierarchyLevel<E extends string | {
|
|
34
|
-
id: Fqn;
|
|
35
|
-
}>(elementOfFqn: E): number;
|
|
36
|
-
/**
|
|
37
|
-
* Calculate the distance as number of steps from one element to another, i.e.
|
|
38
|
-
* going up to the common ancestor, then going down to the other element.
|
|
39
|
-
* Sibling distance is always 1
|
|
40
|
-
*
|
|
41
|
-
* Can be used for hierarchical clustering
|
|
42
|
-
*/
|
|
43
|
-
declare function hierarchyDistance<E extends string | {
|
|
44
|
-
id: Fqn;
|
|
45
|
-
}>(one: E, another: E): number;
|
|
46
|
-
declare function commonAncestor<E extends string>(first: E, second: E): E | null;
|
|
47
|
-
/**
|
|
48
|
-
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
49
|
-
* going up from parent to the root
|
|
50
|
-
*/
|
|
51
|
-
declare function ancestorsFqn<Id extends string>(fqn: Id): Id[];
|
|
52
|
-
/**
|
|
53
|
-
* Compares two fully qualified names (fqns) hierarchically based on their depth.
|
|
54
|
-
* From parent nodes to leaves
|
|
55
|
-
*
|
|
56
|
-
* @param {string} a - The first fqn to compare.
|
|
57
|
-
* @param {string} b - The second fqn to compare.
|
|
58
|
-
* @returns {number} - 0 if the fqns have the same depth.
|
|
59
|
-
* - Positive number if a is deeper than b.
|
|
60
|
-
* - Negative number if b is deeper than a.
|
|
61
|
-
*/
|
|
62
|
-
declare function compareFqnHierarchically<T extends string = string>(a: T, b: T): -1 | 0 | 1;
|
|
63
|
-
declare function compareByFqnHierarchically<T extends {
|
|
64
|
-
id: string;
|
|
65
|
-
}>(a: T, b: T): -1 | 0 | 1;
|
|
66
|
-
type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
|
|
67
|
-
type ReorderedArray<T extends IterableContainer> = {
|
|
68
|
-
-readonly [P in keyof T]: T[number];
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Sorts an array of objects hierarchically based on their fully qualified names (FQN).
|
|
72
|
-
* Objects are sorted by the number of segments in their FQN (defined by dot-separated ID).
|
|
73
|
-
*
|
|
74
|
-
* @typeParam T - Object type that contains an 'id' string property
|
|
75
|
-
* @typeParam A - Type extending IterableContainer of T
|
|
76
|
-
*
|
|
77
|
-
* @param array - Array of objects to be sorted
|
|
78
|
-
* @returns A new array with items sorted by their FQN hierarchy depth (number of segments)
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```ts
|
|
82
|
-
* const items = [
|
|
83
|
-
* { id: "a.b.c" },
|
|
84
|
-
* { id: "a" },
|
|
85
|
-
* { id: "a.b" }
|
|
86
|
-
* ];
|
|
87
|
-
* sortByFqnHierarchically(items);
|
|
88
|
-
* // Result: [
|
|
89
|
-
* // { id: "a" },
|
|
90
|
-
* // { id: "a.b" },
|
|
91
|
-
* // { id: "a.b.c" }
|
|
92
|
-
* // ]
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
declare function sortByFqnHierarchically<T extends {
|
|
96
|
-
id: string;
|
|
97
|
-
}, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
|
|
98
|
-
/**
|
|
99
|
-
* Keeps initial order of the elements, but ensures that parents are before children
|
|
100
|
-
*/
|
|
101
|
-
declare function sortParentsFirst<T extends {
|
|
102
|
-
id: string;
|
|
103
|
-
}, A extends IterableContainer<T>>(array: A): ReorderedArray<A>;
|
|
104
|
-
/**
|
|
105
|
-
* Sorts an array of objects naturally by their fully qualified name (FQN) identifier.
|
|
106
|
-
*
|
|
107
|
-
* @template T - Type of objects containing an 'id' string property
|
|
108
|
-
* @template A - Type extending IterableContainer of T
|
|
109
|
-
*
|
|
110
|
-
* @param first - Optional. Either the array to sort or the sort direction ('asc'|'desc')
|
|
111
|
-
* @param sort - Optional. The sort direction ('asc'|'desc'). Defaults to 'asc' if not specified
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* // As a function that returns a sorting function
|
|
115
|
-
* const sorted = sortNaturalByFqn('desc')(myArray);
|
|
116
|
-
*
|
|
117
|
-
* // Direct array sorting
|
|
118
|
-
* const sorted = sortNaturalByFqn(myArray, 'desc');
|
|
119
|
-
*/
|
|
120
|
-
declare function sortNaturalByFqn(sort?: 'asc' | 'desc'): <T extends {
|
|
121
|
-
id: string;
|
|
122
|
-
}, A extends IterableContainer<T>>(array: A) => ReorderedArray<A>;
|
|
123
|
-
declare function sortNaturalByFqn<T extends {
|
|
124
|
-
id: string;
|
|
125
|
-
}, A extends IterableContainer<T>>(array: A, sort?: 'asc' | 'desc'): ReorderedArray<A>;
|
|
126
|
-
|
|
127
|
-
export { type IterableContainer as I, type ReorderedArray as R, ancestorsFqn as a, compareByFqnHierarchically as b, commonAncestor as c, compareFqnHierarchically as d, hierarchyLevel as e, isDescendantOf as f, isSameHierarchy as g, hierarchyDistance as h, isAncestor as i, sortNaturalByFqn as j, sortParentsFirst as k, nameFromFqn as n, parentFqn as p, sortByFqnHierarchically as s };
|