@likec4/core 1.18.0 → 1.19.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/builder/index.d.mts +502 -0
- package/dist/builder/index.d.ts +502 -0
- package/dist/builder/index.js +871 -0
- package/dist/compute-view/index.d.mts +9 -78
- package/dist/compute-view/index.d.ts +9 -78
- package/dist/compute-view/index.js +78 -0
- package/dist/index.d.mts +9 -730
- package/dist/index.d.ts +9 -730
- package/dist/{index.mjs → index.js} +7 -784
- package/dist/model/index.d.mts +218 -606
- package/dist/model/index.d.ts +218 -606
- package/dist/model/index.js +1 -0
- package/dist/shared/chunk-RAAYCPUM.M-JWF7SS.js +21 -0
- package/dist/shared/core.BIfgabEw.d.ts +719 -0
- package/dist/shared/core.BZ9Msq7w.d.mts +719 -0
- package/dist/shared/{core.DMYY7C8s.d.mts → core.C05RDLhi.d.ts} +179 -230
- package/dist/shared/{core.DMYY7C8s.d.ts → core.CmYMqgha.d.mts} +179 -230
- package/dist/shared/core.D6-fWbM3.d.ts +127 -0
- package/dist/shared/core.D74xkKkG.d.mts +148 -0
- package/dist/shared/core.D74xkKkG.d.ts +148 -0
- package/dist/shared/core.sLaWHBjR.d.mts +127 -0
- package/dist/shared/index.-BdzdI2C.js +7443 -0
- package/dist/shared/object_hash.CE_oF3I3.js +1222 -0
- package/dist/shared/view.CyZrG8BJ.js +354 -0
- package/dist/types/index.d.mts +4 -2
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.js +20 -0
- package/dist/utils/index.d.mts +404 -0
- package/dist/utils/index.d.ts +404 -0
- package/dist/utils/index.js +330 -0
- package/package.json +47 -33
- package/src/builder/Builder-style1.test-d.ts +190 -0
- package/src/builder/Builder-style2.test-d.ts +175 -0
- package/src/builder/Builder.deployment.ts +25 -20
- package/src/builder/Builder.deploymentModel.ts +80 -55
- package/src/builder/Builder.element.ts +2 -0
- package/src/builder/Builder.model.ts +57 -43
- package/src/builder/Builder.ts +412 -431
- package/src/builder/Builder.view-common.ts +234 -0
- package/src/builder/Builder.view-deployment.ts +135 -0
- package/src/builder/Builder.view-element.ts +189 -0
- package/src/builder/Builder.views.ts +109 -33
- package/src/builder/Builder.with.ts +475 -0
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +374 -0
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +183 -0
- package/src/builder/__snapshots__/Builder.spec.ts.snap +374 -0
- package/src/builder/_types.ts +28 -5
- package/src/builder/index.ts +10 -4
- package/src/colors/index.ts +2 -2
- package/src/compute-view/compute-view.ts +45 -54
- package/src/compute-view/deployment-view/__test__/TestHelper.ts +236 -0
- package/src/compute-view/deployment-view/__test__/fixture.ts +50 -62
- package/src/compute-view/deployment-view/_types.ts +26 -18
- package/src/compute-view/deployment-view/clean-connections.ts +173 -164
- package/src/compute-view/deployment-view/compute.ts +51 -37
- package/src/compute-view/deployment-view/memory/index.ts +9 -0
- package/src/compute-view/deployment-view/memory/memory.ts +97 -0
- package/src/compute-view/deployment-view/predicates/elements.ts +144 -0
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +183 -76
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +38 -20
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +72 -23
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +61 -22
- package/src/compute-view/deployment-view/predicates/wildcard.ts +15 -15
- package/src/compute-view/deployment-view/stages/stage-exclude.ts +5 -0
- package/src/compute-view/deployment-view/stages/stage-final.ts +245 -0
- package/src/compute-view/deployment-view/stages/stage-include.ts +95 -0
- package/src/compute-view/deployment-view/utils.ts +95 -31
- package/src/compute-view/dynamic-view/__test__/fixture.ts +4 -4
- package/src/compute-view/dynamic-view/compute.ts +59 -45
- package/src/compute-view/element-view/__test__/TestHelper.ts +258 -0
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +64 -62
- package/src/compute-view/element-view/__test__/fixture.ts +147 -117
- package/src/compute-view/element-view/_types.ts +48 -0
- package/src/compute-view/element-view/clean-connections.ts +113 -0
- package/src/compute-view/element-view/compute.ts +264 -683
- package/src/compute-view/element-view/memory/NodeGroup.ts +31 -0
- package/src/compute-view/element-view/memory/index.ts +10 -0
- package/src/compute-view/element-view/memory/memory.ts +177 -0
- package/src/compute-view/element-view/memory/stage-exclude.ts +59 -0
- package/src/compute-view/element-view/memory/stage-final.ts +129 -0
- package/src/compute-view/element-view/memory/stage-include.ts +128 -0
- package/src/compute-view/element-view/predicates/_utils.ts +86 -0
- package/src/compute-view/element-view/predicates/element-expand.ts +33 -0
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +26 -0
- package/src/compute-view/element-view/predicates/element-ref.ts +37 -0
- package/src/compute-view/element-view/predicates/relation-direct.ts +309 -0
- package/src/compute-view/element-view/predicates/relation-in-out.ts +66 -0
- package/src/compute-view/element-view/predicates/relation-in.ts +118 -0
- package/src/compute-view/element-view/predicates/relation-out.ts +116 -0
- package/src/compute-view/element-view/predicates/wildcard.ts +88 -0
- package/src/compute-view/element-view/utils.ts +59 -0
- package/src/compute-view/index.ts +3 -4
- package/src/compute-view/memory/AbstractMemory.ts +45 -0
- package/src/compute-view/memory/AbstractStageExclude.ts +216 -0
- package/src/compute-view/memory/AbstractStageInclude.ts +200 -0
- package/src/compute-view/memory/_types.ts +147 -0
- package/src/compute-view/memory/index.ts +5 -0
- package/src/compute-view/memory/ops.ts +43 -0
- package/src/compute-view/utils/buildComputedNodes.ts +4 -4
- package/src/compute-view/utils/elementExpressionToPredicate.ts +1 -3
- package/src/compute-view/utils/link-nodes-with-edges.ts +3 -7
- package/src/compute-view/utils/{derive-edge-props-from-relationships.ts → merge-props-from-relationships.ts} +54 -23
- package/src/compute-view/utils/relationExpressionToPredicates.ts +2 -2
- package/src/compute-view/utils/resolve-extended-views.ts +44 -40
- package/src/compute-view/utils/resolve-global-rules.ts +6 -6
- package/src/compute-view/utils/topological-sort.ts +167 -71
- package/src/compute-view/utils/with-readable-edges.ts +14 -9
- package/src/index.ts +22 -16
- package/src/model/DeploymentElementModel.ts +150 -85
- package/src/model/DeploymentModel.ts +27 -21
- package/src/model/ElementModel.ts +51 -25
- package/src/model/LikeC4Model.test-d.ts +4 -3
- package/src/model/LikeC4Model.ts +98 -42
- package/src/model/RelationModel.ts +5 -4
- package/src/model/__test__/fixture.ts +5 -9
- package/src/model/connection/Connection.ts +72 -0
- package/src/model/connection/deployment/DeploymentConnectionModel.ts +178 -0
- package/src/model/connection/{deployment.ts → deployment/find.ts} +14 -18
- package/src/model/connection/deployment/index.ts +8 -0
- package/src/model/connection/index.ts +22 -0
- package/src/model/connection/model/ConnectionModel.ts +157 -0
- package/src/model/connection/{model.ts → model/find.ts} +43 -49
- package/src/model/connection/model/index.ts +8 -0
- package/src/model/connection/ops.ts +274 -0
- package/src/model/guards.ts +9 -0
- package/src/model/index.ts +45 -3
- package/src/model/types.ts +35 -18
- package/src/model/view/EdgeModel.ts +6 -6
- package/src/model/view/LikeC4ViewModel.ts +14 -8
- package/src/model/view/NodeModel.ts +6 -5
- package/src/types/_common.ts +53 -1
- package/src/types/deployments.ts +88 -156
- package/src/types/element.ts +2 -2
- package/src/types/expression-v2.ts +172 -0
- package/src/types/expression.ts +9 -5
- package/src/types/global.ts +3 -3
- package/src/types/index.ts +220 -13
- package/src/types/model.ts +28 -24
- package/src/types/operators.ts +1 -1
- package/src/types/relation.ts +14 -10
- package/src/types/theme.ts +0 -1
- package/src/types/view.ts +20 -18
- package/src/utils/const.ts +1 -0
- package/src/utils/fqn.ts +140 -49
- package/src/utils/getOrCreate.ts +1 -1
- package/src/utils/index.ts +74 -9
- package/src/utils/iterable/_types.ts +5 -0
- package/src/utils/iterable/filter.ts +55 -0
- package/src/utils/iterable/flat.ts +17 -0
- package/src/utils/iterable/index.ts +12 -0
- package/src/utils/iterable/map.ts +40 -0
- package/src/utils/iterable/reduce.ts +24 -0
- package/src/utils/iterable/some.ts +36 -0
- package/src/utils/iterable/to.ts +19 -0
- package/src/utils/iterable/unique.ts +29 -0
- package/src/utils/relations.ts +3 -64
- package/src/utils/set.ts +11 -9
- package/src/utils/string-hash.ts +1 -1
- package/dist/compute-view/index.mjs +0 -79
- package/dist/model/index.mjs +0 -2
- package/dist/shared/core.BBgiAAv1.mjs +0 -144
- package/dist/shared/core.BPyJvuMU.mjs +0 -2420
- package/dist/shared/core.BQ4AbfvB.mjs +0 -9228
- package/dist/shared/core.k12s_keD.mjs +0 -203
- package/dist/types/index.mjs +0 -21
- package/src/builder/Builder.test-d.ts +0 -124
- package/src/builder/Builder.view.ts +0 -543
- package/src/compute-view/LikeC4ModelGraph.ts +0 -330
- package/src/compute-view/deployment-view/Memory.ts +0 -108
- package/src/compute-view/deployment-view/Stage.ts +0 -145
- package/src/compute-view/deployment-view/predicates/deployment-ref.ts +0 -146
- package/src/compute-view/element-view/predicates.ts +0 -517
- package/src/compute-view/utils/sortNodes.ts +0 -101
- package/src/model/connection/ConnectionModel.ts +0 -94
- package/src/model/connection/DeploymentConnectionModel.ts +0 -99
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { u, i as invariant, n as nonexhaustive } from './chunk-RAAYCPUM.M-JWF7SS.js';
|
|
2
|
+
|
|
3
|
+
function o$1(a){return t=>!a(t)}
|
|
4
|
+
|
|
5
|
+
function n(e){return e==null}
|
|
6
|
+
|
|
7
|
+
function o(r){return Array.isArray(r)}
|
|
8
|
+
|
|
9
|
+
function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
|
|
10
|
+
|
|
11
|
+
function y(...a){return u(r,a)}var r=(a,o)=>o.some(e=>e(a));
|
|
12
|
+
|
|
13
|
+
var DeploymentElement;
|
|
14
|
+
((DeploymentElement2) => {
|
|
15
|
+
DeploymentElement2.isDeploymentNode = (el) => {
|
|
16
|
+
return "kind" in el && !("element" in el);
|
|
17
|
+
};
|
|
18
|
+
DeploymentElement2.isInstance = (el) => {
|
|
19
|
+
return "element" in el && !("kind" in el);
|
|
20
|
+
};
|
|
21
|
+
})(DeploymentElement || (DeploymentElement = {}));
|
|
22
|
+
|
|
23
|
+
function AsFqn(name, parent) {
|
|
24
|
+
return parent ? parent + "." + name : name;
|
|
25
|
+
}
|
|
26
|
+
const BorderStyles = ["solid", "dashed", "dotted", "none"];
|
|
27
|
+
var ElementKind;
|
|
28
|
+
((ElementKind2) => {
|
|
29
|
+
ElementKind2.Group = "@group";
|
|
30
|
+
})(ElementKind || (ElementKind = {}));
|
|
31
|
+
const ElementShapes = [
|
|
32
|
+
"rectangle",
|
|
33
|
+
"person",
|
|
34
|
+
"browser",
|
|
35
|
+
"mobile",
|
|
36
|
+
"cylinder",
|
|
37
|
+
"storage",
|
|
38
|
+
"queue"
|
|
39
|
+
];
|
|
40
|
+
const DefaultThemeColor = "primary";
|
|
41
|
+
const DefaultElementShape = "rectangle";
|
|
42
|
+
|
|
43
|
+
function isElementRef(expr) {
|
|
44
|
+
return "element" in expr;
|
|
45
|
+
}
|
|
46
|
+
function isExpandedElementExpr(expr) {
|
|
47
|
+
return "expanded" in expr;
|
|
48
|
+
}
|
|
49
|
+
function isCustomElement(expr) {
|
|
50
|
+
return "custom" in expr && (isElement(expr.custom.expr) || isElementWhere(expr.custom.expr));
|
|
51
|
+
}
|
|
52
|
+
function isWildcard(expr) {
|
|
53
|
+
return "wildcard" in expr;
|
|
54
|
+
}
|
|
55
|
+
function isElementKindExpr(expr) {
|
|
56
|
+
return "elementKind" in expr && "isEqual" in expr;
|
|
57
|
+
}
|
|
58
|
+
function isElementTagExpr(expr) {
|
|
59
|
+
return "elementTag" in expr && "isEqual" in expr;
|
|
60
|
+
}
|
|
61
|
+
function isElement(expr) {
|
|
62
|
+
return isElementRef(expr) || isWildcard(expr) || isElementKindExpr(expr) || isElementTagExpr(expr) || isExpandedElementExpr(expr);
|
|
63
|
+
}
|
|
64
|
+
function isElementWhere(expr) {
|
|
65
|
+
return "where" in expr && isElement(expr.where.expr);
|
|
66
|
+
}
|
|
67
|
+
function isElementPredicateExpr(expr) {
|
|
68
|
+
return isElement(expr) || isElementWhere(expr) || isCustomElement(expr);
|
|
69
|
+
}
|
|
70
|
+
function isRelation(expr) {
|
|
71
|
+
return "source" in expr && "target" in expr;
|
|
72
|
+
}
|
|
73
|
+
function isInOut(expr) {
|
|
74
|
+
return "inout" in expr;
|
|
75
|
+
}
|
|
76
|
+
function isIncoming(expr) {
|
|
77
|
+
return "incoming" in expr;
|
|
78
|
+
}
|
|
79
|
+
function isOutgoing(expr) {
|
|
80
|
+
return "outgoing" in expr;
|
|
81
|
+
}
|
|
82
|
+
function isRelationExpression(expr) {
|
|
83
|
+
return isRelation(expr) || isInOut(expr) || isIncoming(expr) || isOutgoing(expr);
|
|
84
|
+
}
|
|
85
|
+
function isRelationWhere(expr) {
|
|
86
|
+
return "where" in expr && isRelationExpression(expr.where.expr);
|
|
87
|
+
}
|
|
88
|
+
function isCustomRelationExpr(expr) {
|
|
89
|
+
return "customRelation" in expr;
|
|
90
|
+
}
|
|
91
|
+
function isRelationPredicateExpr(expr) {
|
|
92
|
+
return isRelationExpression(expr) || isRelationWhere(expr) || isCustomRelationExpr(expr);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const expression = {
|
|
96
|
+
__proto__: null,
|
|
97
|
+
isCustomElement: isCustomElement,
|
|
98
|
+
isCustomRelationExpr: isCustomRelationExpr,
|
|
99
|
+
isElement: isElement,
|
|
100
|
+
isElementKindExpr: isElementKindExpr,
|
|
101
|
+
isElementPredicateExpr: isElementPredicateExpr,
|
|
102
|
+
isElementRef: isElementRef,
|
|
103
|
+
isElementTagExpr: isElementTagExpr,
|
|
104
|
+
isElementWhere: isElementWhere,
|
|
105
|
+
isExpandedElementExpr: isExpandedElementExpr,
|
|
106
|
+
isInOut: isInOut,
|
|
107
|
+
isIncoming: isIncoming,
|
|
108
|
+
isOutgoing: isOutgoing,
|
|
109
|
+
isRelation: isRelation,
|
|
110
|
+
isRelationExpression: isRelationExpression,
|
|
111
|
+
isRelationPredicateExpr: isRelationPredicateExpr,
|
|
112
|
+
isRelationWhere: isRelationWhere,
|
|
113
|
+
isWildcard: isWildcard
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var FqnRef;
|
|
117
|
+
((FqnRef2) => {
|
|
118
|
+
FqnRef2.isInsideInstanceRef = (ref) => {
|
|
119
|
+
return "deployment" in ref && "element" in ref;
|
|
120
|
+
};
|
|
121
|
+
FqnRef2.isDeploymentElementRef = (ref) => {
|
|
122
|
+
return "deployment" in ref && !("element" in ref);
|
|
123
|
+
};
|
|
124
|
+
FqnRef2.isDeploymentRef = (ref) => {
|
|
125
|
+
return !(0, FqnRef2.isModelRef)(ref);
|
|
126
|
+
};
|
|
127
|
+
FqnRef2.isModelRef = (ref) => {
|
|
128
|
+
return "model" in ref;
|
|
129
|
+
};
|
|
130
|
+
FqnRef2.toDeploymentRef = (ref) => {
|
|
131
|
+
invariant((0, FqnRef2.isDeploymentRef)(ref), "Expected DeploymentRef");
|
|
132
|
+
return (0, FqnRef2.isInsideInstanceRef)(ref) ? {
|
|
133
|
+
id: ref.deployment,
|
|
134
|
+
element: ref.element
|
|
135
|
+
} : {
|
|
136
|
+
id: ref.deployment
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
})(FqnRef || (FqnRef = {}));
|
|
140
|
+
var FqnExpr;
|
|
141
|
+
((FqnExpr2) => {
|
|
142
|
+
FqnExpr2.isWildcard = (expr) => {
|
|
143
|
+
return "wildcard" in expr && expr.wildcard === true;
|
|
144
|
+
};
|
|
145
|
+
FqnExpr2.isModelRef = (ref) => {
|
|
146
|
+
return "ref" in ref && FqnRef.isModelRef(ref.ref);
|
|
147
|
+
};
|
|
148
|
+
FqnExpr2.isDeploymentRef = (ref) => {
|
|
149
|
+
return "ref" in ref && FqnRef.isDeploymentRef(ref.ref);
|
|
150
|
+
};
|
|
151
|
+
})(FqnExpr || (FqnExpr = {}));
|
|
152
|
+
var RelationExpr;
|
|
153
|
+
((RelationExpr2) => {
|
|
154
|
+
RelationExpr2.isDirect = (expr) => {
|
|
155
|
+
return "source" in expr && "target" in expr;
|
|
156
|
+
};
|
|
157
|
+
RelationExpr2.isIncoming = (expr) => {
|
|
158
|
+
return "incoming" in expr;
|
|
159
|
+
};
|
|
160
|
+
RelationExpr2.isOutgoing = (expr) => {
|
|
161
|
+
return "outgoing" in expr;
|
|
162
|
+
};
|
|
163
|
+
RelationExpr2.isInOut = (expr) => {
|
|
164
|
+
return "inout" in expr;
|
|
165
|
+
};
|
|
166
|
+
})(RelationExpr || (RelationExpr = {}));
|
|
167
|
+
var ExpressionV2;
|
|
168
|
+
((ExpressionV22) => {
|
|
169
|
+
ExpressionV22.isFqnExpr = (expr) => {
|
|
170
|
+
return FqnExpr.isWildcard(expr) || FqnExpr.isModelRef(expr) || FqnExpr.isDeploymentRef(expr);
|
|
171
|
+
};
|
|
172
|
+
ExpressionV22.isRelation = (expr) => {
|
|
173
|
+
return RelationExpr.isDirect(expr) || RelationExpr.isIncoming(expr) || RelationExpr.isOutgoing(expr) || RelationExpr.isInOut(expr);
|
|
174
|
+
};
|
|
175
|
+
})(ExpressionV2 || (ExpressionV2 = {}));
|
|
176
|
+
|
|
177
|
+
const isTagEqual = (operator) => {
|
|
178
|
+
return "tag" in operator;
|
|
179
|
+
};
|
|
180
|
+
const isKindEqual = (operator) => {
|
|
181
|
+
return "kind" in operator;
|
|
182
|
+
};
|
|
183
|
+
const isNotOperator = (operator) => {
|
|
184
|
+
return "not" in operator;
|
|
185
|
+
};
|
|
186
|
+
const isAndOperator = (operator) => {
|
|
187
|
+
return "and" in operator;
|
|
188
|
+
};
|
|
189
|
+
const isOrOperator = (operator) => {
|
|
190
|
+
return "or" in operator;
|
|
191
|
+
};
|
|
192
|
+
function whereOperatorAsPredicate(operator) {
|
|
193
|
+
switch (true) {
|
|
194
|
+
case isTagEqual(operator): {
|
|
195
|
+
if ("eq" in operator.tag) {
|
|
196
|
+
const tag2 = operator.tag.eq;
|
|
197
|
+
return (value) => {
|
|
198
|
+
return Array.isArray(value.tags) && value.tags.includes(tag2);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const tag = operator.tag.neq;
|
|
202
|
+
return (value) => {
|
|
203
|
+
return !Array.isArray(value.tags) || !value.tags.includes(tag);
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
case isKindEqual(operator): {
|
|
207
|
+
if ("eq" in operator.kind) {
|
|
208
|
+
const kind2 = operator.kind.eq;
|
|
209
|
+
return (value) => {
|
|
210
|
+
return value.kind === kind2;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const kind = operator.kind.neq;
|
|
214
|
+
return (value) => {
|
|
215
|
+
return n(value.kind) || value.kind !== kind;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
case isNotOperator(operator): {
|
|
219
|
+
const predicate = whereOperatorAsPredicate(operator.not);
|
|
220
|
+
return o$1(predicate);
|
|
221
|
+
}
|
|
222
|
+
case isAndOperator(operator): {
|
|
223
|
+
const predicates = operator.and.map(whereOperatorAsPredicate);
|
|
224
|
+
return t(predicates);
|
|
225
|
+
}
|
|
226
|
+
case isOrOperator(operator): {
|
|
227
|
+
const predicates = operator.or.map(whereOperatorAsPredicate);
|
|
228
|
+
return y(predicates);
|
|
229
|
+
}
|
|
230
|
+
default:
|
|
231
|
+
nonexhaustive(operator);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const DefaultLineStyle = "dashed";
|
|
236
|
+
const DefaultArrowType = "normal";
|
|
237
|
+
const DefaultRelationshipColor = "gray";
|
|
238
|
+
|
|
239
|
+
function isViewRulePredicate(rule) {
|
|
240
|
+
return "include" in rule && Array.isArray(rule.include) || "exclude" in rule && Array.isArray(rule.exclude);
|
|
241
|
+
}
|
|
242
|
+
function isViewRuleGlobalPredicateRef(rule) {
|
|
243
|
+
return "predicateId" in rule;
|
|
244
|
+
}
|
|
245
|
+
function isViewRuleStyle(rule) {
|
|
246
|
+
return "style" in rule && "targets" in rule && Array.isArray(rule.targets);
|
|
247
|
+
}
|
|
248
|
+
function isViewRuleGlobalStyle(rule) {
|
|
249
|
+
return "styleId" in rule;
|
|
250
|
+
}
|
|
251
|
+
function isAutoLayoutDirection(autoLayout) {
|
|
252
|
+
return autoLayout === "TB" || autoLayout === "BT" || autoLayout === "LR" || autoLayout === "RL";
|
|
253
|
+
}
|
|
254
|
+
function isViewRuleAutoLayout(rule) {
|
|
255
|
+
return "direction" in rule;
|
|
256
|
+
}
|
|
257
|
+
function isViewRuleGroup(rule) {
|
|
258
|
+
return "title" in rule && "groupRules" in rule && Array.isArray(rule.groupRules);
|
|
259
|
+
}
|
|
260
|
+
function isDynamicViewParallelSteps(step) {
|
|
261
|
+
return "__parallel" in step && o(step.__parallel);
|
|
262
|
+
}
|
|
263
|
+
function isDeploymentView(view) {
|
|
264
|
+
return view.__ === "deployment";
|
|
265
|
+
}
|
|
266
|
+
function isDynamicView(view) {
|
|
267
|
+
return view.__ === "dynamic";
|
|
268
|
+
}
|
|
269
|
+
function isElementView(view) {
|
|
270
|
+
return n(view.__) || view.__ === "element";
|
|
271
|
+
}
|
|
272
|
+
function isExtendsElementView(view) {
|
|
273
|
+
return isElementView(view) && "extends" in view;
|
|
274
|
+
}
|
|
275
|
+
function isScopedElementView(view) {
|
|
276
|
+
return isElementView(view) && "viewOf" in view;
|
|
277
|
+
}
|
|
278
|
+
function stepEdgeId(step, parallelStep) {
|
|
279
|
+
const id = `step-${String(step).padStart(2, "0")}`;
|
|
280
|
+
return parallelStep ? `${id}.${parallelStep}` : id;
|
|
281
|
+
}
|
|
282
|
+
function isStepEdgeId(id) {
|
|
283
|
+
return id.startsWith("step-");
|
|
284
|
+
}
|
|
285
|
+
function extractStep(id) {
|
|
286
|
+
if (!isStepEdgeId(id)) {
|
|
287
|
+
throw new Error(`Invalid step edge id: ${id}`);
|
|
288
|
+
}
|
|
289
|
+
return parseFloat(id.slice("step-".length));
|
|
290
|
+
}
|
|
291
|
+
function getParallelStepsPrefix(id) {
|
|
292
|
+
if (isStepEdgeId(id) && id.includes(".")) {
|
|
293
|
+
return id.slice(0, id.indexOf(".") + 1);
|
|
294
|
+
}
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
var ComputedNode;
|
|
298
|
+
((ComputedNode2) => {
|
|
299
|
+
function modelRef(node) {
|
|
300
|
+
return node.modelRef === 1 ? node.id : node.modelRef ?? null;
|
|
301
|
+
}
|
|
302
|
+
ComputedNode2.modelRef = modelRef;
|
|
303
|
+
function deploymentRef(node) {
|
|
304
|
+
return node.deploymentRef === 1 ? node.id : node.deploymentRef ?? null;
|
|
305
|
+
}
|
|
306
|
+
ComputedNode2.deploymentRef = deploymentRef;
|
|
307
|
+
function isNodesGroup(node) {
|
|
308
|
+
return node.kind === ElementKind.Group;
|
|
309
|
+
}
|
|
310
|
+
ComputedNode2.isNodesGroup = isNodesGroup;
|
|
311
|
+
})(ComputedNode || (ComputedNode = {}));
|
|
312
|
+
var ComputedView;
|
|
313
|
+
((ComputedView2) => {
|
|
314
|
+
function isDeployment(view) {
|
|
315
|
+
return view.__ === "deployment";
|
|
316
|
+
}
|
|
317
|
+
ComputedView2.isDeployment = isDeployment;
|
|
318
|
+
function isDynamic(view) {
|
|
319
|
+
return view.__ === "dynamic";
|
|
320
|
+
}
|
|
321
|
+
ComputedView2.isDynamic = isDynamic;
|
|
322
|
+
function isElement(view) {
|
|
323
|
+
return n(view.__) || view.__ === "element";
|
|
324
|
+
}
|
|
325
|
+
ComputedView2.isElement = isElement;
|
|
326
|
+
})(ComputedView || (ComputedView = {}));
|
|
327
|
+
function getBBoxCenter({
|
|
328
|
+
x,
|
|
329
|
+
y,
|
|
330
|
+
width,
|
|
331
|
+
height
|
|
332
|
+
}) {
|
|
333
|
+
return {
|
|
334
|
+
x: x + width / 2,
|
|
335
|
+
y: y + height / 2
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
var DiagramNode;
|
|
339
|
+
((DiagramNode2) => {
|
|
340
|
+
function modelRef(node) {
|
|
341
|
+
return node.modelRef === 1 ? node.id : node.modelRef ?? null;
|
|
342
|
+
}
|
|
343
|
+
DiagramNode2.modelRef = modelRef;
|
|
344
|
+
function deploymentRef(node) {
|
|
345
|
+
return node.deploymentRef === 1 ? node.id : node.deploymentRef ?? null;
|
|
346
|
+
}
|
|
347
|
+
DiagramNode2.deploymentRef = deploymentRef;
|
|
348
|
+
function isNodesGroup(node) {
|
|
349
|
+
return node.kind === ElementKind.Group;
|
|
350
|
+
}
|
|
351
|
+
DiagramNode2.isNodesGroup = isNodesGroup;
|
|
352
|
+
})(DiagramNode || (DiagramNode = {}));
|
|
353
|
+
|
|
354
|
+
export { isStepEdgeId as $, AsFqn as A, BorderStyles as B, ExpressionV2 as C, DeploymentElement as D, ElementKind as E, FqnExpr as F, FqnRef as G, isAndOperator as H, isKindEqual as I, isNotOperator as J, isOrOperator as K, isTagEqual as L, whereOperatorAsPredicate as M, DefaultArrowType as N, DefaultLineStyle as O, DefaultRelationshipColor as P, ComputedNode as Q, RelationExpr as R, ComputedView as S, DiagramNode as T, extractStep as U, getBBoxCenter as V, getParallelStepsPrefix as W, isAutoLayoutDirection as X, isDeploymentView as Y, isDynamicView as Z, isDynamicViewParallelSteps as _, isElementView as a, isViewRuleAutoLayout as a0, isViewRuleGlobalPredicateRef as a1, isViewRuleGlobalStyle as a2, isViewRuleGroup as a3, isViewRulePredicate as a4, isViewRuleStyle as a5, stepEdgeId as a6, o$1 as a7, y as a8, isElementPredicateExpr as b, isScopedElementView as c, DefaultThemeColor as d, DefaultElementShape as e, expression as f, ElementShapes as g, isCustomElement as h, isExtendsElementView as i, isCustomRelationExpr as j, isElement as k, isElementKindExpr as l, isElementRef as m, n, o, isElementTagExpr as p, isElementWhere as q, isExpandedElementExpr as r, isIncoming as s, isInOut as t, isOutgoing as u, isRelation as v, isRelationExpression as w, isRelationPredicateExpr as x, isRelationWhere as y, isWildcard as z };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { X as XYPoint,
|
|
2
|
-
export {
|
|
1
|
+
import { X as XYPoint, N as NonEmptyArray, P as Point, h as BorderStyle, l as ElementShape, x as ThemeColor, F as Fqn } from '../shared/core.D74xkKkG.mjs';
|
|
2
|
+
export { A as AsFqn, B as BorderStyles, s as Color, t as ColorLiteral, C as CustomColor, D as DefaultElementShape, e as DefaultThemeColor, i as Element, f as ElementKind, j as ElementKindSpecification, k as ElementKindSpecificationStyle, g as ElementShapes, m as ElementStyle, v as ElementThemeColorValues, u as ElementThemeColors, E as ExclusiveUnion, H as HexColorLiteral, I as IconUrl, a as IteratorLike, K as KeysOf, L as LikeC4Theme, n as Link, c as NTuple, b as NonEmptyReadonlyArray, d as Predicate, w as RelationshipThemeColorValues, R as RelationshipThemeColors, o as Tag, p as TagSpec, T as ThemeColorValues, q as TypedElement, r as isThemeColor } from '../shared/core.D74xkKkG.mjs';
|
|
3
|
+
import { bj as ViewId, aV as BBox, bk as ViewManualLayout, aS as AutoLayoutDirection } from '../shared/core.CmYMqgha.mjs';
|
|
4
|
+
export { ar as AbstractRelation, ag as AndOperator, a5 as AnyParsedLikeC4Model, aT as BasicElementView, aU as BasicView, aW as ComputedDeploymentView, aX as ComputedDynamicView, aY as ComputedEdge, aZ as ComputedElementView, a as ComputedLikeC4Model, ay as ComputedNode, C as ComputedView, a_ as CustomColorDefinitions, A as CustomElementExpr, B as CustomRelationExpr, ao as DefaultArrowType, ap as DefaultLineStyle, aq as DefaultRelationshipColor, b as DeployedInstance, D as DeploymentElement, c as DeploymentElementStyle, d as DeploymentNode, f as DeploymentNodeKind, g as DeploymentNodeKindSpecification, h as DeploymentRef, i as DeploymentRelation, a$ as DeploymentView, b0 as DeploymentViewRule, b1 as DeploymentViewRulePredicate, b2 as DeploymentViewRuleStyle, b3 as DiagramEdge, az as DiagramNode, b4 as DiagramView, E as DirectRelationExpr, b5 as DynamicView, b6 as DynamicViewIncludeRule, b7 as DynamicViewParallelSteps, b8 as DynamicViewRule, b9 as DynamicViewStep, ba as DynamicViewStepOrParallel, bb as EdgeId, F as ElementExpression, G as ElementKindExpr, bv as ElementNotation, H as ElementPredicateExpression, I as ElementRefExpr, J as ElementTagExpr, bc as ElementView, K as ElementWhereExpr, ah as EqualOperator, M as ExpandedElementExpr, N as Expression, X as ExpressionV2, bd as ExtendsElementView, ai as Filterable, Y as FqnExpr, Z as FqnRef, a6 as GenericLikeC4Model, $ as GlobalDynamicPredicates, a0 as GlobalPredicateId, a1 as GlobalPredicates, a2 as GlobalStyleID, a3 as GlobalStyles, Q as InOutExpr, O as IncomingExpr, aj as KindEqual, a7 as LayoutedLikeC4Model, a8 as LikeC4ModelDump, L as LikeC4View, a4 as ModelGlobals, as as ModelRelation, be as NodeId, R as NonWilcard, ak as NotOperator, al as OrOperator, S as OutgoingExpr, a9 as ParsedLikeC4Model, P as PredicateSelector, _ as RelationExpr, T as RelationExpression, at as RelationId, U as RelationPredicateExpression, V as RelationWhereExpr, au as RelationshipArrowType, av as RelationshipKind, aw as RelationshipKindSpecification, ax as RelationshipLineType, bf as ScopedElementView, bg as StepEdgeId, bh as StepEdgeIdLiteral, am as TagEqual, bi as ViewAutoLayout, bl as ViewRule, bm as ViewRuleAutoLayout, bn as ViewRuleGlobalPredicateRef, bo as ViewRuleGlobalStyle, bp as ViewRuleGroup, bq as ViewRulePredicate, br as ViewRuleStyle, bs as ViewRuleStyleOrGlobalRef, bt as ViewWithHash, bu as ViewWithNotation, an as WhereOperator, W as WildcardExpr, aA as extractStep, aB as getBBoxCenter, aC as getParallelStepsPrefix, aa as isAndOperator, aD as isAutoLayoutDirection, j as isCustomElement, k as isCustomRelationExpr, aE as isDeploymentView, aF as isDynamicView, aG as isDynamicViewParallelSteps, l as isElement, m as isElementKindExpr, n as isElementPredicateExpr, o as isElementRef, p as isElementTagExpr, aH as isElementView, q as isElementWhere, r as isExpandedElementExpr, aI as isExtendsElementView, t as isInOut, s as isIncoming, ab as isKindEqual, ac as isNotOperator, ad as isOrOperator, u as isOutgoing, v as isRelation, w as isRelationExpression, x as isRelationPredicateExpr, y as isRelationWhere, aJ as isScopedElementView, aK as isStepEdgeId, ae as isTagEqual, aL as isViewRuleAutoLayout, aM as isViewRuleGlobalPredicateRef, aN as isViewRuleGlobalStyle, aO as isViewRuleGroup, aP as isViewRulePredicate, aQ as isViewRuleStyle, z as isWildcard, aR as stepEdgeId, af as whereOperatorAsPredicate } from '../shared/core.CmYMqgha.mjs';
|
|
3
5
|
import 'type-fest';
|
|
4
6
|
|
|
5
7
|
/**
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { X as XYPoint,
|
|
2
|
-
export {
|
|
1
|
+
import { X as XYPoint, N as NonEmptyArray, P as Point, h as BorderStyle, l as ElementShape, x as ThemeColor, F as Fqn } from '../shared/core.D74xkKkG.js';
|
|
2
|
+
export { A as AsFqn, B as BorderStyles, s as Color, t as ColorLiteral, C as CustomColor, D as DefaultElementShape, e as DefaultThemeColor, i as Element, f as ElementKind, j as ElementKindSpecification, k as ElementKindSpecificationStyle, g as ElementShapes, m as ElementStyle, v as ElementThemeColorValues, u as ElementThemeColors, E as ExclusiveUnion, H as HexColorLiteral, I as IconUrl, a as IteratorLike, K as KeysOf, L as LikeC4Theme, n as Link, c as NTuple, b as NonEmptyReadonlyArray, d as Predicate, w as RelationshipThemeColorValues, R as RelationshipThemeColors, o as Tag, p as TagSpec, T as ThemeColorValues, q as TypedElement, r as isThemeColor } from '../shared/core.D74xkKkG.js';
|
|
3
|
+
import { bj as ViewId, aV as BBox, bk as ViewManualLayout, aS as AutoLayoutDirection } from '../shared/core.C05RDLhi.js';
|
|
4
|
+
export { ar as AbstractRelation, ag as AndOperator, a5 as AnyParsedLikeC4Model, aT as BasicElementView, aU as BasicView, aW as ComputedDeploymentView, aX as ComputedDynamicView, aY as ComputedEdge, aZ as ComputedElementView, a as ComputedLikeC4Model, ay as ComputedNode, C as ComputedView, a_ as CustomColorDefinitions, A as CustomElementExpr, B as CustomRelationExpr, ao as DefaultArrowType, ap as DefaultLineStyle, aq as DefaultRelationshipColor, b as DeployedInstance, D as DeploymentElement, c as DeploymentElementStyle, d as DeploymentNode, f as DeploymentNodeKind, g as DeploymentNodeKindSpecification, h as DeploymentRef, i as DeploymentRelation, a$ as DeploymentView, b0 as DeploymentViewRule, b1 as DeploymentViewRulePredicate, b2 as DeploymentViewRuleStyle, b3 as DiagramEdge, az as DiagramNode, b4 as DiagramView, E as DirectRelationExpr, b5 as DynamicView, b6 as DynamicViewIncludeRule, b7 as DynamicViewParallelSteps, b8 as DynamicViewRule, b9 as DynamicViewStep, ba as DynamicViewStepOrParallel, bb as EdgeId, F as ElementExpression, G as ElementKindExpr, bv as ElementNotation, H as ElementPredicateExpression, I as ElementRefExpr, J as ElementTagExpr, bc as ElementView, K as ElementWhereExpr, ah as EqualOperator, M as ExpandedElementExpr, N as Expression, X as ExpressionV2, bd as ExtendsElementView, ai as Filterable, Y as FqnExpr, Z as FqnRef, a6 as GenericLikeC4Model, $ as GlobalDynamicPredicates, a0 as GlobalPredicateId, a1 as GlobalPredicates, a2 as GlobalStyleID, a3 as GlobalStyles, Q as InOutExpr, O as IncomingExpr, aj as KindEqual, a7 as LayoutedLikeC4Model, a8 as LikeC4ModelDump, L as LikeC4View, a4 as ModelGlobals, as as ModelRelation, be as NodeId, R as NonWilcard, ak as NotOperator, al as OrOperator, S as OutgoingExpr, a9 as ParsedLikeC4Model, P as PredicateSelector, _ as RelationExpr, T as RelationExpression, at as RelationId, U as RelationPredicateExpression, V as RelationWhereExpr, au as RelationshipArrowType, av as RelationshipKind, aw as RelationshipKindSpecification, ax as RelationshipLineType, bf as ScopedElementView, bg as StepEdgeId, bh as StepEdgeIdLiteral, am as TagEqual, bi as ViewAutoLayout, bl as ViewRule, bm as ViewRuleAutoLayout, bn as ViewRuleGlobalPredicateRef, bo as ViewRuleGlobalStyle, bp as ViewRuleGroup, bq as ViewRulePredicate, br as ViewRuleStyle, bs as ViewRuleStyleOrGlobalRef, bt as ViewWithHash, bu as ViewWithNotation, an as WhereOperator, W as WildcardExpr, aA as extractStep, aB as getBBoxCenter, aC as getParallelStepsPrefix, aa as isAndOperator, aD as isAutoLayoutDirection, j as isCustomElement, k as isCustomRelationExpr, aE as isDeploymentView, aF as isDynamicView, aG as isDynamicViewParallelSteps, l as isElement, m as isElementKindExpr, n as isElementPredicateExpr, o as isElementRef, p as isElementTagExpr, aH as isElementView, q as isElementWhere, r as isExpandedElementExpr, aI as isExtendsElementView, t as isInOut, s as isIncoming, ab as isKindEqual, ac as isNotOperator, ad as isOrOperator, u as isOutgoing, v as isRelation, w as isRelationExpression, x as isRelationPredicateExpr, y as isRelationWhere, aJ as isScopedElementView, aK as isStepEdgeId, ae as isTagEqual, aL as isViewRuleAutoLayout, aM as isViewRuleGlobalPredicateRef, aN as isViewRuleGlobalStyle, aO as isViewRuleGroup, aP as isViewRulePredicate, aQ as isViewRuleStyle, z as isWildcard, aR as stepEdgeId, af as whereOperatorAsPredicate } from '../shared/core.C05RDLhi.js';
|
|
3
5
|
import 'type-fest';
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { A as AsFqn, B as BorderStyles, Q as ComputedNode, S as ComputedView, N as DefaultArrowType, e as DefaultElementShape, O as DefaultLineStyle, P as DefaultRelationshipColor, d as DefaultThemeColor, D as DeploymentElement, T as DiagramNode, E as ElementKind, g as ElementShapes, C as ExpressionV2, F as FqnExpr, G as FqnRef, R as RelationExpr, U as extractStep, V as getBBoxCenter, W as getParallelStepsPrefix, H as isAndOperator, X as isAutoLayoutDirection, h as isCustomElement, j as isCustomRelationExpr, Y as isDeploymentView, Z as isDynamicView, _ as isDynamicViewParallelSteps, k as isElement, l as isElementKindExpr, b as isElementPredicateExpr, m as isElementRef, p as isElementTagExpr, a as isElementView, q as isElementWhere, r as isExpandedElementExpr, i as isExtendsElementView, t as isInOut, s as isIncoming, I as isKindEqual, J as isNotOperator, K as isOrOperator, u as isOutgoing, v as isRelation, w as isRelationExpression, x as isRelationPredicateExpr, y as isRelationWhere, c as isScopedElementView, $ as isStepEdgeId, L as isTagEqual, a0 as isViewRuleAutoLayout, a1 as isViewRuleGlobalPredicateRef, a2 as isViewRuleGlobalStyle, a3 as isViewRuleGroup, a4 as isViewRulePredicate, a5 as isViewRuleStyle, z as isWildcard, a6 as stepEdgeId, M as whereOperatorAsPredicate } from '../shared/view.CyZrG8BJ.js';
|
|
2
|
+
|
|
3
|
+
const ThemeColors = [
|
|
4
|
+
"amber",
|
|
5
|
+
"blue",
|
|
6
|
+
"gray",
|
|
7
|
+
"slate",
|
|
8
|
+
"green",
|
|
9
|
+
"indigo",
|
|
10
|
+
"muted",
|
|
11
|
+
"primary",
|
|
12
|
+
"red",
|
|
13
|
+
"secondary",
|
|
14
|
+
"sky"
|
|
15
|
+
];
|
|
16
|
+
function isThemeColor(color) {
|
|
17
|
+
return color in ThemeColors;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { isThemeColor };
|