@likec4/core 1.17.1 → 1.18.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/dist/compute-view/index.d.mts +91 -0
- package/dist/compute-view/index.d.ts +91 -0
- package/dist/compute-view/index.mjs +79 -0
- package/dist/index.d.mts +246 -434
- package/dist/index.d.ts +246 -434
- package/dist/index.mjs +418 -1322
- package/dist/model/index.d.mts +642 -0
- package/dist/model/index.d.ts +642 -0
- package/dist/model/index.mjs +2 -0
- package/dist/shared/core.BBgiAAv1.mjs +144 -0
- package/dist/shared/core.BPyJvuMU.mjs +2420 -0
- package/dist/shared/core.BQ4AbfvB.mjs +9228 -0
- package/dist/shared/{core.CoLQkcYL.d.mts → core.DMYY7C8s.d.mts} +398 -249
- package/dist/shared/{core.CoLQkcYL.d.ts → core.DMYY7C8s.d.ts} +398 -249
- package/dist/shared/core.k12s_keD.mjs +203 -0
- package/dist/types/index.d.mts +69 -1
- package/dist/types/index.d.ts +69 -1
- package/dist/types/index.mjs +21 -1
- package/package.json +38 -40
- package/src/builder/Builder.deployment.ts +219 -0
- package/src/builder/Builder.deploymentModel.ts +360 -0
- package/src/builder/Builder.element.ts +17 -19
- package/src/builder/Builder.model.ts +13 -2
- package/src/builder/Builder.test-d.ts +59 -4
- package/src/builder/Builder.ts +238 -53
- package/src/builder/Builder.view.ts +238 -53
- package/src/builder/_types.ts +87 -15
- package/src/compute-view/LikeC4ModelGraph.ts +330 -0
- package/src/compute-view/compute-view.ts +92 -0
- package/src/compute-view/deployment-view/Memory.ts +108 -0
- package/src/compute-view/deployment-view/Stage.ts +145 -0
- package/src/compute-view/deployment-view/__test__/fixture.ts +210 -0
- package/src/compute-view/deployment-view/_types.ts +29 -0
- package/src/compute-view/deployment-view/clean-connections.ts +229 -0
- package/src/compute-view/deployment-view/compute.ts +111 -0
- package/src/compute-view/deployment-view/predicates/deployment-ref.ts +146 -0
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +130 -0
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +43 -0
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +46 -0
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +49 -0
- package/src/compute-view/deployment-view/predicates/wildcard.ts +29 -0
- package/src/compute-view/deployment-view/utils.ts +212 -0
- package/src/compute-view/dynamic-view/__test__/fixture.ts +58 -0
- package/src/compute-view/dynamic-view/compute.ts +310 -0
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +456 -0
- package/src/compute-view/element-view/__test__/fixture.ts +645 -0
- package/src/compute-view/element-view/compute.ts +734 -0
- package/src/compute-view/element-view/predicates.ts +517 -0
- package/src/compute-view/index.ts +5 -0
- package/src/compute-view/utils/__snapshots__/sortNodes.spec.ts.snap +113 -0
- package/src/compute-view/utils/ancestorsOfNode.ts +19 -0
- package/src/compute-view/utils/applyCustomElementProperties.ts +66 -0
- package/src/compute-view/utils/applyCustomRelationProperties.ts +41 -0
- package/src/compute-view/utils/applyViewRuleStyles.ts +53 -0
- package/src/compute-view/utils/buildComputedNodes.ts +148 -0
- package/src/compute-view/utils/buildElementNotations.ts +63 -0
- package/src/compute-view/utils/derive-edge-props-from-relationships.ts +97 -0
- package/src/compute-view/utils/elementExpressionToPredicate.ts +52 -0
- package/src/compute-view/utils/link-nodes-with-edges.ts +58 -0
- package/src/compute-view/utils/relationExpressionToPredicates.ts +55 -0
- package/src/compute-view/utils/resolve-extended-views.ts +65 -0
- package/src/compute-view/utils/resolve-global-rules.ts +83 -0
- package/src/compute-view/utils/sortNodes.ts +101 -0
- package/src/compute-view/utils/topological-sort.ts +160 -0
- package/src/compute-view/utils/uniqueTags.test.ts +42 -0
- package/src/compute-view/utils/uniqueTags.ts +21 -0
- package/src/compute-view/utils/view-hash.ts +27 -0
- package/src/compute-view/utils/with-readable-edges.ts +31 -0
- package/src/index.ts +5 -1
- package/src/model/DeploymentElementModel.ts +534 -0
- package/src/model/DeploymentModel.ts +364 -0
- package/src/model/ElementModel.ts +195 -0
- package/src/model/LikeC4Model.test-d.ts +151 -0
- package/src/model/LikeC4Model.ts +280 -457
- package/src/model/RelationModel.ts +84 -0
- package/src/model/__test__/fixture.ts +153 -338
- package/src/model/connection/ConnectionModel.ts +94 -0
- package/src/model/connection/DeploymentConnectionModel.ts +99 -0
- package/src/model/connection/deployment.ts +124 -0
- package/src/model/connection/model.ts +123 -0
- package/src/model/index.ts +4 -2
- package/src/model/types.ts +95 -15
- package/src/model/view/EdgeModel.ts +103 -0
- package/src/model/view/LikeC4ViewModel.ts +220 -0
- package/src/model/view/NodeModel.ts +228 -0
- package/src/types/_common.ts +2 -0
- package/src/types/deployments.ts +237 -0
- package/src/types/element.ts +7 -3
- package/src/types/expression.ts +8 -6
- package/src/types/index.ts +1 -0
- package/src/types/model.ts +68 -9
- package/src/types/overview-graph.ts +2 -2
- package/src/types/relation.ts +4 -4
- package/src/types/view-notation.ts +2 -2
- package/src/types/view.ts +104 -30
- package/src/utils/{commonHead.ts → common-head.ts} +2 -0
- package/src/utils/fqn.ts +83 -27
- package/src/utils/getOrCreate.ts +42 -0
- package/src/utils/graphlib.ts +10 -0
- package/src/utils/index.ts +4 -1
- package/src/utils/object-hash.ts +3 -0
- package/src/utils/set.ts +76 -0
- package/src/utils/string-hash.ts +16 -0
- package/dist/index.cjs +0 -5452
- package/dist/index.d.cts +0 -1053
- package/dist/shared/core.BXTs-8n7.mjs +0 -293
- package/dist/shared/core.CoLQkcYL.d.cts +0 -734
- package/dist/shared/core.DIYZvpVg.cjs +0 -353
- package/dist/types/index.cjs +0 -70
- package/dist/types/index.d.cts +0 -2
- package/src/model/LikeC4DiagramModel.ts +0 -338
- package/src/model/LikeC4ViewModel.ts +0 -320
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
function u$1(t,n,a){let o=r=>t(r,...n);return a===void 0?o:Object.assign(o,{lazy:a,lazyArgs:n})}
|
|
2
|
+
|
|
3
|
+
function u(r,n,a){let o=r.length-n.length;if(o===0)return r(...n);if(o===1)return u$1(r,n,a);throw new Error("Wrong number of arguments")}
|
|
4
|
+
|
|
5
|
+
function n(e){return e==null}
|
|
6
|
+
|
|
7
|
+
function o(r){return Array.isArray(r)}
|
|
8
|
+
|
|
9
|
+
function nonNullable(value, message) {
|
|
10
|
+
if (typeof value === "undefined" || value == null) {
|
|
11
|
+
throw new Error(message ?? `Expected defined value, but received ${value}`);
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
function invariant(condition, message) {
|
|
16
|
+
if (condition) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
throw new Error(message ?? "Invariant failed");
|
|
20
|
+
}
|
|
21
|
+
function nonexhaustive(value) {
|
|
22
|
+
throw new Error(`NonExhaustive value: ${value}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var DeploymentElement;
|
|
26
|
+
((DeploymentElement2) => {
|
|
27
|
+
DeploymentElement2.isDeploymentNode = (el) => {
|
|
28
|
+
return "kind" in el && !("element" in el);
|
|
29
|
+
};
|
|
30
|
+
DeploymentElement2.isInstance = (el) => {
|
|
31
|
+
return "element" in el && !("kind" in el);
|
|
32
|
+
};
|
|
33
|
+
})(DeploymentElement || (DeploymentElement = {}));
|
|
34
|
+
var DeploymentRelationExpression;
|
|
35
|
+
((DeploymentRelationExpression2) => {
|
|
36
|
+
DeploymentRelationExpression2.isDirect = (expr) => {
|
|
37
|
+
return "source" in expr && "target" in expr;
|
|
38
|
+
};
|
|
39
|
+
DeploymentRelationExpression2.isIncoming = (expr) => {
|
|
40
|
+
return "incoming" in expr;
|
|
41
|
+
};
|
|
42
|
+
DeploymentRelationExpression2.isOutgoing = (expr) => {
|
|
43
|
+
return "outgoing" in expr;
|
|
44
|
+
};
|
|
45
|
+
DeploymentRelationExpression2.isInOut = (expr) => {
|
|
46
|
+
return "inout" in expr;
|
|
47
|
+
};
|
|
48
|
+
})(DeploymentRelationExpression || (DeploymentRelationExpression = {}));
|
|
49
|
+
var DeploymentElementExpression;
|
|
50
|
+
((DeploymentElementExpression2) => {
|
|
51
|
+
DeploymentElementExpression2.isRef = (expr) => {
|
|
52
|
+
return "ref" in expr;
|
|
53
|
+
};
|
|
54
|
+
DeploymentElementExpression2.isWildcard = (expr) => {
|
|
55
|
+
return "wildcard" in expr && expr.wildcard === true;
|
|
56
|
+
};
|
|
57
|
+
})(DeploymentElementExpression || (DeploymentElementExpression = {}));
|
|
58
|
+
var DeploymentExpression;
|
|
59
|
+
((DeploymentExpression2) => {
|
|
60
|
+
DeploymentExpression2.isElement = (expr) => {
|
|
61
|
+
return DeploymentElementExpression.isRef(expr) || DeploymentElementExpression.isWildcard(expr);
|
|
62
|
+
};
|
|
63
|
+
DeploymentExpression2.isRelation = (expr) => {
|
|
64
|
+
return !DeploymentExpression2.isElement(expr);
|
|
65
|
+
};
|
|
66
|
+
})(DeploymentExpression || (DeploymentExpression = {}));
|
|
67
|
+
|
|
68
|
+
function AsFqn(name, parent) {
|
|
69
|
+
return parent ? parent + "." + name : name;
|
|
70
|
+
}
|
|
71
|
+
const BorderStyles = ["solid", "dashed", "dotted", "none"];
|
|
72
|
+
var ElementKind;
|
|
73
|
+
((ElementKind2) => {
|
|
74
|
+
ElementKind2.Group = "@group";
|
|
75
|
+
})(ElementKind || (ElementKind = {}));
|
|
76
|
+
const ElementShapes = [
|
|
77
|
+
"rectangle",
|
|
78
|
+
"person",
|
|
79
|
+
"browser",
|
|
80
|
+
"mobile",
|
|
81
|
+
"cylinder",
|
|
82
|
+
"storage",
|
|
83
|
+
"queue"
|
|
84
|
+
];
|
|
85
|
+
const DefaultThemeColor = "primary";
|
|
86
|
+
const DefaultElementShape = "rectangle";
|
|
87
|
+
|
|
88
|
+
function isViewRulePredicate(rule) {
|
|
89
|
+
return "include" in rule && Array.isArray(rule.include) || "exclude" in rule && Array.isArray(rule.exclude);
|
|
90
|
+
}
|
|
91
|
+
function isViewRuleGlobalPredicateRef(rule) {
|
|
92
|
+
return "predicateId" in rule;
|
|
93
|
+
}
|
|
94
|
+
function isViewRuleStyle(rule) {
|
|
95
|
+
return "style" in rule && "targets" in rule && Array.isArray(rule.targets);
|
|
96
|
+
}
|
|
97
|
+
function isViewRuleGlobalStyle(rule) {
|
|
98
|
+
return "styleId" in rule;
|
|
99
|
+
}
|
|
100
|
+
function isAutoLayoutDirection(autoLayout) {
|
|
101
|
+
return autoLayout === "TB" || autoLayout === "BT" || autoLayout === "LR" || autoLayout === "RL";
|
|
102
|
+
}
|
|
103
|
+
function isViewRuleAutoLayout(rule) {
|
|
104
|
+
return "direction" in rule;
|
|
105
|
+
}
|
|
106
|
+
function isViewRuleGroup(rule) {
|
|
107
|
+
return "title" in rule && "groupRules" in rule && Array.isArray(rule.groupRules);
|
|
108
|
+
}
|
|
109
|
+
function isDynamicViewParallelSteps(step) {
|
|
110
|
+
return "__parallel" in step && o(step.__parallel);
|
|
111
|
+
}
|
|
112
|
+
function isDeploymentView(view) {
|
|
113
|
+
return view.__ === "deployment";
|
|
114
|
+
}
|
|
115
|
+
function isDynamicView(view) {
|
|
116
|
+
return view.__ === "dynamic";
|
|
117
|
+
}
|
|
118
|
+
function isElementView(view) {
|
|
119
|
+
return n(view.__) || view.__ === "element";
|
|
120
|
+
}
|
|
121
|
+
function isExtendsElementView(view) {
|
|
122
|
+
return isElementView(view) && "extends" in view;
|
|
123
|
+
}
|
|
124
|
+
function isScopedElementView(view) {
|
|
125
|
+
return isElementView(view) && "viewOf" in view;
|
|
126
|
+
}
|
|
127
|
+
function stepEdgeId(step, parallelStep) {
|
|
128
|
+
const id = `step-${String(step).padStart(2, "0")}`;
|
|
129
|
+
return parallelStep ? `${id}.${parallelStep}` : id;
|
|
130
|
+
}
|
|
131
|
+
function isStepEdgeId(id) {
|
|
132
|
+
return id.startsWith("step-");
|
|
133
|
+
}
|
|
134
|
+
function extractStep(id) {
|
|
135
|
+
if (!isStepEdgeId(id)) {
|
|
136
|
+
throw new Error(`Invalid step edge id: ${id}`);
|
|
137
|
+
}
|
|
138
|
+
return parseFloat(id.slice("step-".length));
|
|
139
|
+
}
|
|
140
|
+
function getParallelStepsPrefix(id) {
|
|
141
|
+
if (isStepEdgeId(id) && id.includes(".")) {
|
|
142
|
+
return id.slice(0, id.indexOf(".") + 1);
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
var ComputedNode;
|
|
147
|
+
((ComputedNode2) => {
|
|
148
|
+
function modelRef(node) {
|
|
149
|
+
return node.modelRef === 1 ? node.id : node.modelRef ?? null;
|
|
150
|
+
}
|
|
151
|
+
ComputedNode2.modelRef = modelRef;
|
|
152
|
+
function deploymentRef(node) {
|
|
153
|
+
return node.deploymentRef === 1 ? node.id : node.deploymentRef ?? null;
|
|
154
|
+
}
|
|
155
|
+
ComputedNode2.deploymentRef = deploymentRef;
|
|
156
|
+
function isNodesGroup(node) {
|
|
157
|
+
return node.kind === ElementKind.Group;
|
|
158
|
+
}
|
|
159
|
+
ComputedNode2.isNodesGroup = isNodesGroup;
|
|
160
|
+
})(ComputedNode || (ComputedNode = {}));
|
|
161
|
+
var ComputedView;
|
|
162
|
+
((ComputedView2) => {
|
|
163
|
+
function isDeployment(view) {
|
|
164
|
+
return view.__ === "deployment";
|
|
165
|
+
}
|
|
166
|
+
ComputedView2.isDeployment = isDeployment;
|
|
167
|
+
function isDynamic(view) {
|
|
168
|
+
return view.__ === "dynamic";
|
|
169
|
+
}
|
|
170
|
+
ComputedView2.isDynamic = isDynamic;
|
|
171
|
+
function isElement(view) {
|
|
172
|
+
return n(view.__) || view.__ === "element";
|
|
173
|
+
}
|
|
174
|
+
ComputedView2.isElement = isElement;
|
|
175
|
+
})(ComputedView || (ComputedView = {}));
|
|
176
|
+
function getBBoxCenter({
|
|
177
|
+
x,
|
|
178
|
+
y,
|
|
179
|
+
width,
|
|
180
|
+
height
|
|
181
|
+
}) {
|
|
182
|
+
return {
|
|
183
|
+
x: x + width / 2,
|
|
184
|
+
y: y + height / 2
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
var DiagramNode;
|
|
188
|
+
((DiagramNode2) => {
|
|
189
|
+
function modelRef(node) {
|
|
190
|
+
return node.modelRef === 1 ? node.id : node.modelRef ?? null;
|
|
191
|
+
}
|
|
192
|
+
DiagramNode2.modelRef = modelRef;
|
|
193
|
+
function deploymentRef(node) {
|
|
194
|
+
return node.deploymentRef === 1 ? node.id : node.deploymentRef ?? null;
|
|
195
|
+
}
|
|
196
|
+
DiagramNode2.deploymentRef = deploymentRef;
|
|
197
|
+
function isNodesGroup(node) {
|
|
198
|
+
return node.kind === ElementKind.Group;
|
|
199
|
+
}
|
|
200
|
+
DiagramNode2.isNodesGroup = isNodesGroup;
|
|
201
|
+
})(DiagramNode || (DiagramNode = {}));
|
|
202
|
+
|
|
203
|
+
export { AsFqn as A, BorderStyles as B, isStepEdgeId as C, DeploymentElement as D, ElementKind as E, extractStep as F, getParallelStepsPrefix as G, ComputedNode as H, ComputedView as I, getBBoxCenter as J, DiagramNode as K, n as a, invariant as b, isScopedElementView as c, DefaultThemeColor as d, DefaultElementShape as e, nonNullable as f, DeploymentRelationExpression as g, DeploymentElementExpression as h, isExtendsElementView as i, DeploymentExpression as j, ElementShapes as k, isViewRulePredicate as l, isViewRuleGlobalPredicateRef as m, nonexhaustive as n, o, isViewRuleStyle as p, isViewRuleGlobalStyle as q, isAutoLayoutDirection as r, isViewRuleAutoLayout as s, isViewRuleGroup as t, u, isDynamicViewParallelSteps as v, isDeploymentView as w, isDynamicView as x, isElementView as y, stepEdgeId as z };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,2 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
import { X as XYPoint, b3 as ViewId, N as NonEmptyArray, s as Point, bU as BBox, B as BorderStyle, f as ElementShape, aX as ThemeColor, F as Fqn, bZ as ViewManualLayout, A as AutoLayoutDirection } from '../shared/core.DMYY7C8s.mjs';
|
|
2
|
+
export { aM as AndOperator, aD as AnyLikeC4Model, G as AsFqn, bj as BasicElementView, bi as BasicView, J as BorderStyles, g as Color, aY as ColorLiteral, bT as ComputedDeploymentView, bS as ComputedDynamicView, bN as ComputedEdge, bR as ComputedElementView, c as ComputedLikeC4Model, C as ComputedLikeC4ModelFromParsed, bM as ComputedNode, a as ComputedView, r as CustomColor, bu as CustomColorDefinitions, m as CustomElementExpr, n as CustomRelationExpr, aV as DefaultArrowType, U as DefaultElementShape, aU as DefaultLineStyle, aW as DefaultRelationshipColor, S as DefaultThemeColor, w as DeployedInstance, j as DeploymentElement, z as DeploymentElementExpression, o as DeploymentExpression, v as DeploymentNode, t as DeploymentNodeKind, D as DeploymentNodeKindSpecification, x as DeploymentRef, k as DeploymentRelation, y as DeploymentRelationExpression, by as DeploymentView, bx as DeploymentViewRule, bv as DeploymentViewRulePredicate, bw as DeploymentViewRuleStyle, bX as DiagramEdge, bW as DiagramNode, bY as DiagramView, bs as DynamicView, bq as DynamicViewIncludeRule, bo as DynamicViewParallelSteps, br as DynamicViewRule, bn as DynamicViewStep, bp as DynamicViewStepOrParallel, bF as EdgeId, E as Element, ac as ElementExpression, O as ElementKind, a8 as ElementKindExpr, d as ElementKindSpecification, a0 as ElementKindSpecificationStyle, b_ as ElementNotation, ag as ElementPredicateExpression, a1 as ElementRefExpr, Q as ElementShapes, W as ElementStyle, aa as ElementTagExpr, a_ as ElementThemeColorValues, a$ as ElementThemeColors, bm as ElementView, ae as ElementWhereExpr, aF as EqualOperator, a3 as ExpandedElementExpr, l as Expression, bl as ExtendsElementView, aR as Filterable, az as GlobalDynamicPredicates, ax as GlobalPredicateId, ay as GlobalPredicates, aA as GlobalStyleID, aB as GlobalStyles, H as HexColorLiteral, I as IconUrl, ak as InOutExpr, am as IncomingExpr, K as KeysOf, aI as KindEqual, aE as LayoutedLikeC4Model, b2 as LikeC4Theme, L as LikeC4View, _ as Link, M as ModelGlobals, bE as NodeId, q as NonEmptyReadonlyArray, aK as NotOperator, aO as OrOperator, ao as OutgoingExpr, P as ParsedLikeC4Model, aC as ParsedLikeC4ModelDump, u as PhysicalElementStyle, R as Relation, ai as RelationExpr, aq as RelationExpression, b as RelationId, av as RelationPredicateExpression, as as RelationWhereExpr, h as RelationshipArrowType, aT as RelationshipKind, e as RelationshipKindSpecification, i as RelationshipLineType, b0 as RelationshipThemeColorValues, b1 as RelationshipThemeColors, bk as ScopedElementView, bH as StepEdgeId, bG as StepEdgeIdLiteral, Y as Tag, aG as TagEqual, Z as TagSpec, T as ThemeColorValues, $ as TypedElement, bQ as ViewAutoLayout, bh as ViewRule, bd as ViewRuleAutoLayout, b6 as ViewRuleGlobalPredicateRef, b9 as ViewRuleGlobalStyle, bf as ViewRuleGroup, b4 as ViewRulePredicate, V as ViewRuleStyle, bb as ViewRuleStyleOrGlobalRef, bO as ViewWithHash, bP as ViewWithNotation, aQ as WhereOperator, a6 as WildcardExpr, bK as extractStep, bV as getBBoxCenter, bL as getParallelStepsPrefix, aN as isAndOperator, bc as isAutoLayoutDirection, a5 as isCustomElement, au as isCustomRelationExpr, bz as isDeploymentView, bA as isDynamicView, bt as isDynamicViewParallelSteps, ad as isElement, a9 as isElementKindExpr, ah as isElementPredicateExpr, a2 as isElementRef, ab as isElementTagExpr, bB as isElementView, af as isElementWhere, a4 as isExpandedElementExpr, bC as isExtendsElementView, al as isInOut, an as isIncoming, aJ as isKindEqual, aL as isNotOperator, aP as isOrOperator, ap as isOutgoing, aj as isRelation, ar as isRelationExpression, aw as isRelationPredicateExpr, at as isRelationWhere, bD as isScopedElementView, bJ as isStepEdgeId, aH as isTagEqual, aZ as isThemeColor, be as isViewRuleAutoLayout, b7 as isViewRuleGlobalPredicateRef, ba as isViewRuleGlobalStyle, bg as isViewRuleGroup, b5 as isViewRulePredicate, b8 as isViewRuleStyle, a7 as isWildcard, bI as stepEdgeId, aS as whereOperatorAsPredicate } from '../shared/core.DMYY7C8s.mjs';
|
|
2
3
|
import 'type-fest';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* OverviewGraph is a graph representation of all views in a model
|
|
7
|
+
*/
|
|
8
|
+
declare namespace OverviewGraph {
|
|
9
|
+
type Node = {
|
|
10
|
+
id: string;
|
|
11
|
+
type: 'folder' | 'file';
|
|
12
|
+
path: string;
|
|
13
|
+
label: string;
|
|
14
|
+
parentId: string | null;
|
|
15
|
+
position: XYPoint;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
} | {
|
|
19
|
+
id: string;
|
|
20
|
+
type: 'view';
|
|
21
|
+
viewId: ViewId;
|
|
22
|
+
label: string;
|
|
23
|
+
parentId: string | null;
|
|
24
|
+
position: XYPoint;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Edge represents a navigational link from one view to another
|
|
30
|
+
*/
|
|
31
|
+
type Edge = {
|
|
32
|
+
id: string;
|
|
33
|
+
source: string;
|
|
34
|
+
target: string;
|
|
35
|
+
points: NonEmptyArray<Point>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface OverviewGraph {
|
|
39
|
+
nodes: OverviewGraph.Node[];
|
|
40
|
+
edges: OverviewGraph.Edge[];
|
|
41
|
+
bounds: BBox;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare namespace ViewChange {
|
|
45
|
+
interface ChangeElementStyle {
|
|
46
|
+
op: 'change-element-style';
|
|
47
|
+
style: {
|
|
48
|
+
border?: BorderStyle;
|
|
49
|
+
opacity?: number;
|
|
50
|
+
shape?: ElementShape;
|
|
51
|
+
color?: ThemeColor;
|
|
52
|
+
};
|
|
53
|
+
targets: NonEmptyArray<Fqn>;
|
|
54
|
+
}
|
|
55
|
+
interface SaveManualLayout {
|
|
56
|
+
op: 'save-manual-layout';
|
|
57
|
+
layout: ViewManualLayout;
|
|
58
|
+
}
|
|
59
|
+
interface ChangeAutoLayout {
|
|
60
|
+
op: 'change-autolayout';
|
|
61
|
+
layout: {
|
|
62
|
+
direction: AutoLayoutDirection;
|
|
63
|
+
nodeSep?: number | null;
|
|
64
|
+
rankSep?: number | null;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
|
|
69
|
+
|
|
70
|
+
export { AutoLayoutDirection, BBox, BorderStyle, ElementShape, Fqn, NonEmptyArray, OverviewGraph, Point, ThemeColor, ViewChange, ViewId, ViewManualLayout, XYPoint };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
import { X as XYPoint, b3 as ViewId, N as NonEmptyArray, s as Point, bU as BBox, B as BorderStyle, f as ElementShape, aX as ThemeColor, F as Fqn, bZ as ViewManualLayout, A as AutoLayoutDirection } from '../shared/core.DMYY7C8s.js';
|
|
2
|
+
export { aM as AndOperator, aD as AnyLikeC4Model, G as AsFqn, bj as BasicElementView, bi as BasicView, J as BorderStyles, g as Color, aY as ColorLiteral, bT as ComputedDeploymentView, bS as ComputedDynamicView, bN as ComputedEdge, bR as ComputedElementView, c as ComputedLikeC4Model, C as ComputedLikeC4ModelFromParsed, bM as ComputedNode, a as ComputedView, r as CustomColor, bu as CustomColorDefinitions, m as CustomElementExpr, n as CustomRelationExpr, aV as DefaultArrowType, U as DefaultElementShape, aU as DefaultLineStyle, aW as DefaultRelationshipColor, S as DefaultThemeColor, w as DeployedInstance, j as DeploymentElement, z as DeploymentElementExpression, o as DeploymentExpression, v as DeploymentNode, t as DeploymentNodeKind, D as DeploymentNodeKindSpecification, x as DeploymentRef, k as DeploymentRelation, y as DeploymentRelationExpression, by as DeploymentView, bx as DeploymentViewRule, bv as DeploymentViewRulePredicate, bw as DeploymentViewRuleStyle, bX as DiagramEdge, bW as DiagramNode, bY as DiagramView, bs as DynamicView, bq as DynamicViewIncludeRule, bo as DynamicViewParallelSteps, br as DynamicViewRule, bn as DynamicViewStep, bp as DynamicViewStepOrParallel, bF as EdgeId, E as Element, ac as ElementExpression, O as ElementKind, a8 as ElementKindExpr, d as ElementKindSpecification, a0 as ElementKindSpecificationStyle, b_ as ElementNotation, ag as ElementPredicateExpression, a1 as ElementRefExpr, Q as ElementShapes, W as ElementStyle, aa as ElementTagExpr, a_ as ElementThemeColorValues, a$ as ElementThemeColors, bm as ElementView, ae as ElementWhereExpr, aF as EqualOperator, a3 as ExpandedElementExpr, l as Expression, bl as ExtendsElementView, aR as Filterable, az as GlobalDynamicPredicates, ax as GlobalPredicateId, ay as GlobalPredicates, aA as GlobalStyleID, aB as GlobalStyles, H as HexColorLiteral, I as IconUrl, ak as InOutExpr, am as IncomingExpr, K as KeysOf, aI as KindEqual, aE as LayoutedLikeC4Model, b2 as LikeC4Theme, L as LikeC4View, _ as Link, M as ModelGlobals, bE as NodeId, q as NonEmptyReadonlyArray, aK as NotOperator, aO as OrOperator, ao as OutgoingExpr, P as ParsedLikeC4Model, aC as ParsedLikeC4ModelDump, u as PhysicalElementStyle, R as Relation, ai as RelationExpr, aq as RelationExpression, b as RelationId, av as RelationPredicateExpression, as as RelationWhereExpr, h as RelationshipArrowType, aT as RelationshipKind, e as RelationshipKindSpecification, i as RelationshipLineType, b0 as RelationshipThemeColorValues, b1 as RelationshipThemeColors, bk as ScopedElementView, bH as StepEdgeId, bG as StepEdgeIdLiteral, Y as Tag, aG as TagEqual, Z as TagSpec, T as ThemeColorValues, $ as TypedElement, bQ as ViewAutoLayout, bh as ViewRule, bd as ViewRuleAutoLayout, b6 as ViewRuleGlobalPredicateRef, b9 as ViewRuleGlobalStyle, bf as ViewRuleGroup, b4 as ViewRulePredicate, V as ViewRuleStyle, bb as ViewRuleStyleOrGlobalRef, bO as ViewWithHash, bP as ViewWithNotation, aQ as WhereOperator, a6 as WildcardExpr, bK as extractStep, bV as getBBoxCenter, bL as getParallelStepsPrefix, aN as isAndOperator, bc as isAutoLayoutDirection, a5 as isCustomElement, au as isCustomRelationExpr, bz as isDeploymentView, bA as isDynamicView, bt as isDynamicViewParallelSteps, ad as isElement, a9 as isElementKindExpr, ah as isElementPredicateExpr, a2 as isElementRef, ab as isElementTagExpr, bB as isElementView, af as isElementWhere, a4 as isExpandedElementExpr, bC as isExtendsElementView, al as isInOut, an as isIncoming, aJ as isKindEqual, aL as isNotOperator, aP as isOrOperator, ap as isOutgoing, aj as isRelation, ar as isRelationExpression, aw as isRelationPredicateExpr, at as isRelationWhere, bD as isScopedElementView, bJ as isStepEdgeId, aH as isTagEqual, aZ as isThemeColor, be as isViewRuleAutoLayout, b7 as isViewRuleGlobalPredicateRef, ba as isViewRuleGlobalStyle, bg as isViewRuleGroup, b5 as isViewRulePredicate, b8 as isViewRuleStyle, a7 as isWildcard, bI as stepEdgeId, aS as whereOperatorAsPredicate } from '../shared/core.DMYY7C8s.js';
|
|
2
3
|
import 'type-fest';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* OverviewGraph is a graph representation of all views in a model
|
|
7
|
+
*/
|
|
8
|
+
declare namespace OverviewGraph {
|
|
9
|
+
type Node = {
|
|
10
|
+
id: string;
|
|
11
|
+
type: 'folder' | 'file';
|
|
12
|
+
path: string;
|
|
13
|
+
label: string;
|
|
14
|
+
parentId: string | null;
|
|
15
|
+
position: XYPoint;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
} | {
|
|
19
|
+
id: string;
|
|
20
|
+
type: 'view';
|
|
21
|
+
viewId: ViewId;
|
|
22
|
+
label: string;
|
|
23
|
+
parentId: string | null;
|
|
24
|
+
position: XYPoint;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Edge represents a navigational link from one view to another
|
|
30
|
+
*/
|
|
31
|
+
type Edge = {
|
|
32
|
+
id: string;
|
|
33
|
+
source: string;
|
|
34
|
+
target: string;
|
|
35
|
+
points: NonEmptyArray<Point>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface OverviewGraph {
|
|
39
|
+
nodes: OverviewGraph.Node[];
|
|
40
|
+
edges: OverviewGraph.Edge[];
|
|
41
|
+
bounds: BBox;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare namespace ViewChange {
|
|
45
|
+
interface ChangeElementStyle {
|
|
46
|
+
op: 'change-element-style';
|
|
47
|
+
style: {
|
|
48
|
+
border?: BorderStyle;
|
|
49
|
+
opacity?: number;
|
|
50
|
+
shape?: ElementShape;
|
|
51
|
+
color?: ThemeColor;
|
|
52
|
+
};
|
|
53
|
+
targets: NonEmptyArray<Fqn>;
|
|
54
|
+
}
|
|
55
|
+
interface SaveManualLayout {
|
|
56
|
+
op: 'save-manual-layout';
|
|
57
|
+
layout: ViewManualLayout;
|
|
58
|
+
}
|
|
59
|
+
interface ChangeAutoLayout {
|
|
60
|
+
op: 'change-autolayout';
|
|
61
|
+
layout: {
|
|
62
|
+
direction: AutoLayoutDirection;
|
|
63
|
+
nodeSep?: number | null;
|
|
64
|
+
rankSep?: number | null;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
|
|
69
|
+
|
|
70
|
+
export { AutoLayoutDirection, BBox, BorderStyle, ElementShape, Fqn, NonEmptyArray, OverviewGraph, Point, ThemeColor, ViewChange, ViewId, ViewManualLayout, XYPoint };
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
export { A as AsFqn, B as BorderStyles,
|
|
1
|
+
export { A as AsFqn, B as BorderStyles, H as ComputedNode, I as ComputedView, e as DefaultElementShape, d as DefaultThemeColor, D as DeploymentElement, h as DeploymentElementExpression, j as DeploymentExpression, g as DeploymentRelationExpression, K as DiagramNode, E as ElementKind, k as ElementShapes, F as extractStep, J as getBBoxCenter, G as getParallelStepsPrefix, r as isAutoLayoutDirection, w as isDeploymentView, x as isDynamicView, v as isDynamicViewParallelSteps, y as isElementView, i as isExtendsElementView, c as isScopedElementView, C as isStepEdgeId, s as isViewRuleAutoLayout, m as isViewRuleGlobalPredicateRef, q as isViewRuleGlobalStyle, t as isViewRuleGroup, l as isViewRulePredicate, p as isViewRuleStyle, z as stepEdgeId } from '../shared/core.k12s_keD.mjs';
|
|
2
|
+
export { y as DefaultArrowType, D as DefaultLineStyle, z as DefaultRelationshipColor, v as isAndOperator, c as isCustomElement, q as isCustomRelationExpr, h as isElement, f as isElementKindExpr, i as isElementPredicateExpr, a as isElementRef, g as isElementTagExpr, j as isElementWhere, b as isExpandedElementExpr, l as isInOut, m as isIncoming, t as isKindEqual, u as isNotOperator, w as isOrOperator, n as isOutgoing, k as isRelation, o as isRelationExpression, r as isRelationPredicateExpr, p as isRelationWhere, s as isTagEqual, d as isWildcard, x as whereOperatorAsPredicate } from '../shared/core.BBgiAAv1.mjs';
|
|
3
|
+
|
|
4
|
+
const ThemeColors = [
|
|
5
|
+
"amber",
|
|
6
|
+
"blue",
|
|
7
|
+
"gray",
|
|
8
|
+
"slate",
|
|
9
|
+
"green",
|
|
10
|
+
"indigo",
|
|
11
|
+
"muted",
|
|
12
|
+
"primary",
|
|
13
|
+
"red",
|
|
14
|
+
"secondary",
|
|
15
|
+
"sky"
|
|
16
|
+
];
|
|
17
|
+
function isThemeColor(color) {
|
|
18
|
+
return color in ThemeColors;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { isThemeColor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://likec4.dev",
|
|
6
6
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -29,24 +29,20 @@
|
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
|
+
"default": "./dist/index.mjs"
|
|
34
|
+
},
|
|
35
|
+
"./compute-view": {
|
|
36
|
+
"types": "./dist/compute-view/index.d.mts",
|
|
37
|
+
"default": "./dist/compute-view/index.mjs"
|
|
38
|
+
},
|
|
39
|
+
"./model": {
|
|
40
|
+
"types": "./dist/model/index.d.mts",
|
|
41
|
+
"default": "./dist/model/index.mjs"
|
|
40
42
|
},
|
|
41
43
|
"./types": {
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"default": "./dist/types/index.mjs"
|
|
45
|
-
},
|
|
46
|
-
"require": {
|
|
47
|
-
"types": "./dist/types/index.d.cts",
|
|
48
|
-
"default": "./dist/types/index.cjs"
|
|
49
|
-
}
|
|
44
|
+
"types": "./dist/types/index.d.mts",
|
|
45
|
+
"default": "./dist/types/index.mjs"
|
|
50
46
|
}
|
|
51
47
|
},
|
|
52
48
|
"publishConfig": {
|
|
@@ -54,43 +50,45 @@
|
|
|
54
50
|
"access": "public",
|
|
55
51
|
"exports": {
|
|
56
52
|
".": {
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
"types": "./dist/index.d.mts",
|
|
54
|
+
"default": "./dist/index.mjs"
|
|
55
|
+
},
|
|
56
|
+
"./compute-view": {
|
|
57
|
+
"types": "./dist/compute-view/index.d.mts",
|
|
58
|
+
"default": "./dist/compute-view/index.mjs"
|
|
59
|
+
},
|
|
60
|
+
"./model": {
|
|
61
|
+
"types": "./dist/model/index.d.mts",
|
|
62
|
+
"default": "./dist/model/index.mjs"
|
|
65
63
|
},
|
|
66
64
|
"./types": {
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
"default": "./dist/types/index.mjs"
|
|
70
|
-
},
|
|
71
|
-
"require": {
|
|
72
|
-
"types": "./dist/types/index.d.cts",
|
|
73
|
-
"default": "./dist/types/index.cjs"
|
|
74
|
-
}
|
|
65
|
+
"types": "./dist/types/index.d.mts",
|
|
66
|
+
"default": "./dist/types/index.mjs"
|
|
75
67
|
}
|
|
76
68
|
}
|
|
77
69
|
},
|
|
78
70
|
"dependencies": {
|
|
79
71
|
"defu": "^6.1.4",
|
|
80
|
-
"type-fest": "4.
|
|
72
|
+
"type-fest": "4.28.1"
|
|
81
73
|
},
|
|
82
74
|
"devDependencies": {
|
|
83
|
-
"@
|
|
84
|
-
"@
|
|
75
|
+
"@dagrejs/dagre": "^1.1.4",
|
|
76
|
+
"@likec4/tsconfig": "1.18.0",
|
|
77
|
+
"@mantine/colors-generator": "7.15.1",
|
|
85
78
|
"@types/natural-compare-lite": "^1.4.2",
|
|
79
|
+
"@types/object-hash": "^3.0.6",
|
|
86
80
|
"chroma-js": "^3.1.2",
|
|
87
|
-
"
|
|
81
|
+
"graphology": "^0.25.4",
|
|
82
|
+
"graphology-dag": "^0.4.1",
|
|
83
|
+
"graphology-types": "^0.24.8",
|
|
84
|
+
"mnemonist": "^0.39.8",
|
|
88
85
|
"natural-compare-lite": "^1.4.0",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
86
|
+
"object-hash": "^3.0.0",
|
|
87
|
+
"remeda": "^2.17.4",
|
|
88
|
+
"turbo": "^2.3.3",
|
|
91
89
|
"typescript": "^5.7.2",
|
|
92
90
|
"unbuild": "^3.0.0-rc.11",
|
|
93
|
-
"vitest": "^2.1.
|
|
91
|
+
"vitest": "^2.1.8"
|
|
94
92
|
},
|
|
95
93
|
"packageManager": "yarn@4.5.3"
|
|
96
94
|
}
|