@likec4/core 0.37.1 → 0.41.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/README.md +2 -6
- package/dist/cjs/colors/element.d.ts +68 -0
- package/dist/{colors.js → cjs/colors/element.js} +24 -46
- package/dist/cjs/colors/index.d.ts +132 -0
- package/dist/cjs/colors/index.js +27 -0
- package/dist/cjs/colors/relationships.d.ts +57 -0
- package/dist/cjs/colors/relationships.js +76 -0
- package/dist/cjs/errors/index.d.ts +45 -0
- package/dist/cjs/errors/index.js +137 -0
- package/dist/{index.d.ts → cjs/index.d.ts} +3 -5
- package/dist/{index.cjs → cjs/index.js} +16 -38
- package/dist/{types → cjs/types}/computed-view.d.ts +11 -7
- package/dist/{types → cjs/types}/diagram.d.ts +15 -11
- package/dist/{types → cjs/types}/expression.d.ts +1 -1
- package/dist/{types/index.cjs → cjs/types/index.js} +10 -10
- package/dist/cjs/types/relation.d.ts +22 -0
- package/dist/cjs/types/relation.js +12 -0
- package/dist/{types → cjs/types}/theme.d.ts +10 -6
- package/dist/{types → cjs/types}/view.d.ts +22 -4
- package/dist/{types/view.cjs → cjs/types/view.js} +1 -1
- package/dist/{utils → cjs/utils}/fqn.d.ts +6 -1
- package/dist/{utils/fqn.cjs → cjs/utils/fqn.js} +18 -5
- package/dist/{utils → cjs/utils}/guards.d.ts +1 -2
- package/dist/cjs/utils/guards.js +20 -0
- package/dist/{utils → cjs/utils}/index.d.ts +0 -1
- package/dist/{utils/index.cjs → cjs/utils/index.js} +3 -14
- package/dist/{utils/relations.cjs → cjs/utils/relations.js} +1 -1
- package/dist/esm/colors/element.d.ts +68 -0
- package/dist/esm/colors/element.js +82 -0
- package/dist/esm/colors/index.d.ts +132 -0
- package/dist/esm/colors/index.js +9 -0
- package/dist/esm/colors/relationships.d.ts +57 -0
- package/dist/esm/colors/relationships.js +64 -0
- package/dist/esm/errors/index.d.ts +45 -0
- package/dist/esm/errors/index.js +97 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/types/_common.d.ts +3 -0
- package/dist/esm/types/computed-view.d.ts +44 -0
- package/dist/esm/types/diagram.d.ts +41 -0
- package/dist/esm/types/element.d.ts +29 -0
- package/dist/esm/types/expression.d.ts +56 -0
- package/dist/esm/types/index.d.ts +11 -0
- package/dist/esm/types/model.d.ts +14 -0
- package/dist/esm/types/opaque.d.ts +102 -0
- package/dist/esm/types/relation.d.ts +22 -0
- package/dist/esm/types/relation.js +3 -0
- package/dist/esm/types/theme.d.ts +26 -0
- package/dist/esm/types/view.d.ts +61 -0
- package/dist/{types → esm/types}/view.js +1 -1
- package/dist/esm/utils/fqn.d.ts +33 -0
- package/dist/{utils → esm/utils}/fqn.js +16 -4
- package/dist/esm/utils/guards.d.ts +4 -0
- package/dist/esm/utils/guards.js +7 -0
- package/dist/esm/utils/index.d.ts +3 -0
- package/dist/{utils → esm/utils}/index.js +0 -1
- package/dist/esm/utils/relations.d.ts +25 -0
- package/package.json +44 -61
- package/dist/colors.cjs +0 -124
- package/dist/colors.d.ts +0 -148
- package/dist/compute-view/EdgeBuilder.cjs +0 -37
- package/dist/compute-view/EdgeBuilder.d.ts +0 -6
- package/dist/compute-view/EdgeBuilder.js +0 -30
- package/dist/compute-view/compute-ctx.cjs +0 -89
- package/dist/compute-view/compute-ctx.d.ts +0 -19
- package/dist/compute-view/compute-ctx.js +0 -98
- package/dist/compute-view/compute-element-view.cjs +0 -91
- package/dist/compute-view/compute-element-view.d.ts +0 -3
- package/dist/compute-view/compute-element-view.js +0 -86
- package/dist/compute-view/compute-predicates.cjs +0 -363
- package/dist/compute-view/compute-predicates.d.ts +0 -16
- package/dist/compute-view/compute-predicates.js +0 -324
- package/dist/compute-view/compute.cjs +0 -46
- package/dist/compute-view/compute.d.ts +0 -14
- package/dist/compute-view/compute.js +0 -36
- package/dist/compute-view/index.cjs +0 -38
- package/dist/compute-view/index.d.ts +0 -3
- package/dist/compute-view/index.js +0 -3
- package/dist/compute-view/resolve-extended-views.cjs +0 -50
- package/dist/compute-view/resolve-extended-views.d.ts +0 -6
- package/dist/compute-view/resolve-extended-views.js +0 -38
- package/dist/compute-view/utils/anyPossibleRelations.cjs +0 -18
- package/dist/compute-view/utils/anyPossibleRelations.d.ts +0 -2
- package/dist/compute-view/utils/anyPossibleRelations.js +0 -12
- package/dist/compute-view/utils/applyViewRuleStyles.cjs +0 -57
- package/dist/compute-view/utils/applyViewRuleStyles.d.ts +0 -2
- package/dist/compute-view/utils/applyViewRuleStyles.js +0 -50
- package/dist/compute-view/utils/sortNodes.cjs +0 -50
- package/dist/compute-view/utils/sortNodes.d.ts +0 -2
- package/dist/compute-view/utils/sortNodes.js +0 -40
- package/dist/errors/_base.cjs +0 -62
- package/dist/errors/_base.d.ts +0 -26
- package/dist/errors/_base.js +0 -41
- package/dist/errors/index.cjs +0 -60
- package/dist/errors/index.d.ts +0 -5
- package/dist/errors/index.js +0 -5
- package/dist/errors/invariant.cjs +0 -23
- package/dist/errors/invariant.d.ts +0 -6
- package/dist/errors/invariant.js +0 -13
- package/dist/errors/model-index.cjs +0 -23
- package/dist/errors/model-index.d.ts +0 -6
- package/dist/errors/model-index.js +0 -13
- package/dist/errors/non-nullable.cjs +0 -23
- package/dist/errors/non-nullable.d.ts +0 -6
- package/dist/errors/non-nullable.js +0 -13
- package/dist/errors/nonexhaustive.cjs +0 -23
- package/dist/errors/nonexhaustive.d.ts +0 -6
- package/dist/errors/nonexhaustive.js +0 -12
- package/dist/index.js +0 -6
- package/dist/model-index/ModelIndex.cjs +0 -140
- package/dist/model-index/ModelIndex.d.ts +0 -27
- package/dist/model-index/ModelIndex.js +0 -128
- package/dist/model-index/index.cjs +0 -13
- package/dist/model-index/index.d.ts +0 -1
- package/dist/model-index/index.js +0 -1
- package/dist/types/relation.d.ts +0 -10
- package/dist/types/relation.js +0 -0
- package/dist/types/theme.cjs +0 -1
- package/dist/utils/compute-node-levels.cjs +0 -48
- package/dist/utils/compute-node-levels.d.ts +0 -7
- package/dist/utils/compute-node-levels.js +0 -31
- package/dist/utils/guards.cjs +0 -22
- package/dist/utils/guards.js +0 -13
- /package/dist/{types → cjs/types}/_common.d.ts +0 -0
- /package/dist/{types/_common.cjs → cjs/types/_common.js} +0 -0
- /package/dist/{types/computed-view.cjs → cjs/types/computed-view.js} +0 -0
- /package/dist/{types/diagram.cjs → cjs/types/diagram.js} +0 -0
- /package/dist/{types → cjs/types}/element.d.ts +0 -0
- /package/dist/{types/element.cjs → cjs/types/element.js} +0 -0
- /package/dist/{types/expression.cjs → cjs/types/expression.js} +0 -0
- /package/dist/{types → cjs/types}/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/model.d.ts +0 -0
- /package/dist/{types/model.cjs → cjs/types/model.js} +0 -0
- /package/dist/{types → cjs/types}/opaque.d.ts +0 -0
- /package/dist/{types/opaque.cjs → cjs/types/opaque.js} +0 -0
- /package/dist/{types/relation.cjs → cjs/types/theme.js} +0 -0
- /package/dist/{utils → cjs/utils}/relations.d.ts +0 -0
- /package/dist/{types → esm/types}/_common.js +0 -0
- /package/dist/{types → esm/types}/computed-view.js +0 -0
- /package/dist/{types → esm/types}/diagram.js +0 -0
- /package/dist/{types → esm/types}/element.js +0 -0
- /package/dist/{types → esm/types}/expression.js +0 -0
- /package/dist/{types → esm/types}/index.js +0 -0
- /package/dist/{types → esm/types}/model.js +0 -0
- /package/dist/{types → esm/types}/opaque.js +0 -0
- /package/dist/{types → esm/types}/theme.js +0 -0
- /package/dist/{utils → esm/utils}/relations.js +0 -0
|
@@ -3,69 +3,47 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var
|
|
7
|
-
Object.keys(
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _types[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _utils = require("./utils/index.cjs");
|
|
18
|
-
Object.keys(_utils).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _utils[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _utils[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _modelIndex = require("./model-index/index.cjs");
|
|
29
|
-
Object.keys(_modelIndex).forEach(function (key) {
|
|
6
|
+
var _colors = require("./colors");
|
|
7
|
+
Object.keys(_colors).forEach(function (key) {
|
|
30
8
|
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] ===
|
|
9
|
+
if (key in exports && exports[key] === _colors[key]) return;
|
|
32
10
|
Object.defineProperty(exports, key, {
|
|
33
11
|
enumerable: true,
|
|
34
12
|
get: function () {
|
|
35
|
-
return
|
|
13
|
+
return _colors[key];
|
|
36
14
|
}
|
|
37
15
|
});
|
|
38
16
|
});
|
|
39
|
-
var
|
|
40
|
-
Object.keys(
|
|
17
|
+
var _errors = require("./errors");
|
|
18
|
+
Object.keys(_errors).forEach(function (key) {
|
|
41
19
|
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] ===
|
|
20
|
+
if (key in exports && exports[key] === _errors[key]) return;
|
|
43
21
|
Object.defineProperty(exports, key, {
|
|
44
22
|
enumerable: true,
|
|
45
23
|
get: function () {
|
|
46
|
-
return
|
|
24
|
+
return _errors[key];
|
|
47
25
|
}
|
|
48
26
|
});
|
|
49
27
|
});
|
|
50
|
-
var
|
|
51
|
-
Object.keys(
|
|
28
|
+
var _types = require("./types");
|
|
29
|
+
Object.keys(_types).forEach(function (key) {
|
|
52
30
|
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] ===
|
|
31
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
54
32
|
Object.defineProperty(exports, key, {
|
|
55
33
|
enumerable: true,
|
|
56
34
|
get: function () {
|
|
57
|
-
return
|
|
35
|
+
return _types[key];
|
|
58
36
|
}
|
|
59
37
|
});
|
|
60
38
|
});
|
|
61
|
-
var
|
|
62
|
-
Object.keys(
|
|
39
|
+
var _utils = require("./utils");
|
|
40
|
+
Object.keys(_utils).forEach(function (key) {
|
|
63
41
|
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] ===
|
|
42
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
65
43
|
Object.defineProperty(exports, key, {
|
|
66
44
|
enumerable: true,
|
|
67
45
|
get: function () {
|
|
68
|
-
return
|
|
46
|
+
return _utils[key];
|
|
69
47
|
}
|
|
70
48
|
});
|
|
71
49
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Opaque } from './opaque';
|
|
2
2
|
import type { ElementKind, ElementShape, Fqn, Tag } from './element';
|
|
3
|
-
import type { RelationID } from './relation';
|
|
3
|
+
import type { RelationID, RelationshipArrowType, RelationshipLineType } from './relation';
|
|
4
4
|
import type { BasicElementView, ViewID, ViewRuleAutoLayout } from './view';
|
|
5
5
|
import type { IconUrl, NonEmptyArray } from './_common';
|
|
6
6
|
import type { ThemeColor } from './theme';
|
|
@@ -22,6 +22,7 @@ export interface ComputedNode {
|
|
|
22
22
|
color: ThemeColor;
|
|
23
23
|
icon?: IconUrl;
|
|
24
24
|
navigateTo?: ViewID;
|
|
25
|
+
level: number;
|
|
25
26
|
}
|
|
26
27
|
export interface ComputedEdge {
|
|
27
28
|
id: EdgeId;
|
|
@@ -30,11 +31,14 @@ export interface ComputedEdge {
|
|
|
30
31
|
target: NodeId;
|
|
31
32
|
label: string | null;
|
|
32
33
|
relations: RelationID[];
|
|
34
|
+
color?: ThemeColor;
|
|
35
|
+
line?: RelationshipLineType;
|
|
36
|
+
head?: RelationshipArrowType;
|
|
37
|
+
tail?: RelationshipArrowType;
|
|
33
38
|
}
|
|
34
|
-
export interface ComputedView extends BasicElementView {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
edges: ComputedEdge[];
|
|
39
|
+
export interface ComputedView extends Omit<BasicElementView, 'rules'> {
|
|
40
|
+
readonly extends?: ViewID;
|
|
41
|
+
readonly autoLayout: ViewRuleAutoLayout['autoLayout'];
|
|
42
|
+
readonly nodes: ComputedNode[];
|
|
43
|
+
readonly edges: ComputedEdge[];
|
|
40
44
|
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { ColorLiteral } from './theme';
|
|
2
2
|
import type { ComputedEdge, ComputedNode, ComputedView } from './computed-view';
|
|
3
|
+
import type { NonEmptyArray } from './_common';
|
|
3
4
|
export type Point = [x: number, y: number];
|
|
5
|
+
export type BBox = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
4
11
|
export interface DiagramLabel {
|
|
5
12
|
align: 'left' | 'right' | 'center';
|
|
6
13
|
fontStyle?: 'bold' | 'normal';
|
|
@@ -17,21 +24,18 @@ export interface DiagramNode extends ComputedNode {
|
|
|
17
24
|
};
|
|
18
25
|
labels: DiagramLabel[];
|
|
19
26
|
position: Point;
|
|
27
|
+
depth?: number;
|
|
20
28
|
}
|
|
21
29
|
export interface DiagramEdge extends ComputedEdge {
|
|
22
|
-
points: Point
|
|
23
|
-
headArrow?: Point
|
|
24
|
-
|
|
30
|
+
points: NonEmptyArray<Point>;
|
|
31
|
+
headArrow?: NonEmptyArray<Point>;
|
|
32
|
+
tailArrow?: NonEmptyArray<Point>;
|
|
33
|
+
labels?: NonEmptyArray<DiagramLabel>;
|
|
34
|
+
labelBBox?: BBox;
|
|
25
35
|
}
|
|
26
36
|
export interface DiagramView extends Omit<ComputedView, 'nodes' | 'edges'> {
|
|
27
37
|
readonly nodes: DiagramNode[];
|
|
28
38
|
readonly edges: DiagramEdge[];
|
|
29
|
-
width: number;
|
|
30
|
-
height: number;
|
|
31
|
-
boundingBox: {
|
|
32
|
-
x: number;
|
|
33
|
-
y: number;
|
|
34
|
-
width: number;
|
|
35
|
-
height: number;
|
|
36
|
-
};
|
|
39
|
+
readonly width: number;
|
|
40
|
+
readonly height: number;
|
|
37
41
|
}
|
|
@@ -14,7 +14,7 @@ interface BaseExpr {
|
|
|
14
14
|
}
|
|
15
15
|
export interface ElementRefExpr extends Omit<BaseExpr, 'element' | 'isDescedants'> {
|
|
16
16
|
element: Fqn;
|
|
17
|
-
isDescedants
|
|
17
|
+
isDescedants?: boolean;
|
|
18
18
|
}
|
|
19
19
|
export declare function isElementRef(expr: Expression): expr is ElementRefExpr;
|
|
20
20
|
export interface WildcardExpr extends Omit<BaseExpr, 'wildcard'> {
|
|
@@ -7,7 +7,7 @@ var _exportNames = {
|
|
|
7
7
|
Expr: true
|
|
8
8
|
};
|
|
9
9
|
exports.Expr = void 0;
|
|
10
|
-
var _opaque = require("./opaque
|
|
10
|
+
var _opaque = require("./opaque");
|
|
11
11
|
Object.keys(_opaque).forEach(function (key) {
|
|
12
12
|
if (key === "default" || key === "__esModule") return;
|
|
13
13
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -19,7 +19,7 @@ Object.keys(_opaque).forEach(function (key) {
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
-
var _common = require("./_common
|
|
22
|
+
var _common = require("./_common");
|
|
23
23
|
Object.keys(_common).forEach(function (key) {
|
|
24
24
|
if (key === "default" || key === "__esModule") return;
|
|
25
25
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -31,7 +31,7 @@ Object.keys(_common).forEach(function (key) {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
var _theme = require("./theme
|
|
34
|
+
var _theme = require("./theme");
|
|
35
35
|
Object.keys(_theme).forEach(function (key) {
|
|
36
36
|
if (key === "default" || key === "__esModule") return;
|
|
37
37
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -43,7 +43,7 @@ Object.keys(_theme).forEach(function (key) {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
-
var _element = require("./element
|
|
46
|
+
var _element = require("./element");
|
|
47
47
|
Object.keys(_element).forEach(function (key) {
|
|
48
48
|
if (key === "default" || key === "__esModule") return;
|
|
49
49
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -55,7 +55,7 @@ Object.keys(_element).forEach(function (key) {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
-
var _relation = require("./relation
|
|
58
|
+
var _relation = require("./relation");
|
|
59
59
|
Object.keys(_relation).forEach(function (key) {
|
|
60
60
|
if (key === "default" || key === "__esModule") return;
|
|
61
61
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -67,7 +67,7 @@ Object.keys(_relation).forEach(function (key) {
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
|
-
var _model = require("./model
|
|
70
|
+
var _model = require("./model");
|
|
71
71
|
Object.keys(_model).forEach(function (key) {
|
|
72
72
|
if (key === "default" || key === "__esModule") return;
|
|
73
73
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -79,7 +79,7 @@ Object.keys(_model).forEach(function (key) {
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
-
var _view = require("./view
|
|
82
|
+
var _view = require("./view");
|
|
83
83
|
Object.keys(_view).forEach(function (key) {
|
|
84
84
|
if (key === "default" || key === "__esModule") return;
|
|
85
85
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -91,7 +91,7 @@ Object.keys(_view).forEach(function (key) {
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
|
-
var _Expr = _interopRequireWildcard(require("./expression
|
|
94
|
+
var _Expr = _interopRequireWildcard(require("./expression"));
|
|
95
95
|
exports.Expr = _Expr;
|
|
96
96
|
Object.keys(_Expr).forEach(function (key) {
|
|
97
97
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -104,7 +104,7 @@ Object.keys(_Expr).forEach(function (key) {
|
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
|
-
var _computedView = require("./computed-view
|
|
107
|
+
var _computedView = require("./computed-view");
|
|
108
108
|
Object.keys(_computedView).forEach(function (key) {
|
|
109
109
|
if (key === "default" || key === "__esModule") return;
|
|
110
110
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -116,7 +116,7 @@ Object.keys(_computedView).forEach(function (key) {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
|
-
var _diagram = require("./diagram
|
|
119
|
+
var _diagram = require("./diagram");
|
|
120
120
|
Object.keys(_diagram).forEach(function (key) {
|
|
121
121
|
if (key === "default" || key === "__esModule") return;
|
|
122
122
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Opaque } from './opaque';
|
|
2
|
+
import type { Fqn, Tag } from './element';
|
|
3
|
+
import type { ThemeColor } from './theme';
|
|
4
|
+
export type RelationID = Opaque<string, 'RelationID'>;
|
|
5
|
+
export type RelationshipKind = Opaque<string, 'RelationshipKind'>;
|
|
6
|
+
export type RelationshipLineType = 'dashed' | 'solid' | 'dotted';
|
|
7
|
+
export type RelationshipArrowType = 'none' | 'normal' | 'onormal' | 'diamond' | 'odiamond' | 'crow' | 'open' | 'vee';
|
|
8
|
+
export declare const DefaultLineStyle = "dashed";
|
|
9
|
+
export declare const DefaultArrowType = "normal";
|
|
10
|
+
export declare const DefaultRelationshipColor = "gray";
|
|
11
|
+
export interface Relation {
|
|
12
|
+
readonly id: RelationID;
|
|
13
|
+
readonly source: Fqn;
|
|
14
|
+
readonly target: Fqn;
|
|
15
|
+
readonly title: string;
|
|
16
|
+
readonly tags?: Tag[];
|
|
17
|
+
readonly kind?: RelationshipKind;
|
|
18
|
+
readonly color?: ThemeColor;
|
|
19
|
+
readonly line?: RelationshipLineType;
|
|
20
|
+
readonly head?: RelationshipArrowType;
|
|
21
|
+
readonly tail?: RelationshipArrowType;
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DefaultRelationshipColor = exports.DefaultLineStyle = exports.DefaultArrowType = void 0;
|
|
7
|
+
const DefaultLineStyle = "dashed";
|
|
8
|
+
exports.DefaultLineStyle = DefaultLineStyle;
|
|
9
|
+
const DefaultArrowType = "normal";
|
|
10
|
+
exports.DefaultArrowType = DefaultArrowType;
|
|
11
|
+
const DefaultRelationshipColor = "gray";
|
|
12
|
+
exports.DefaultRelationshipColor = DefaultRelationshipColor;
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
export type ThemeColor = 'amber' | 'blue' | 'gray' | 'slate' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky';
|
|
2
2
|
export type HexColorLiteral = `#${string}`;
|
|
3
3
|
export type ColorLiteral = HexColorLiteral;
|
|
4
|
-
export interface
|
|
4
|
+
export interface ElementThemeColorValues {
|
|
5
5
|
fill: ColorLiteral;
|
|
6
6
|
stroke: ColorLiteral;
|
|
7
7
|
hiContrast: ColorLiteral;
|
|
8
8
|
loContrast: ColorLiteral;
|
|
9
9
|
}
|
|
10
|
-
export type
|
|
11
|
-
[key in ThemeColor]:
|
|
10
|
+
export type ElementThemeColors = {
|
|
11
|
+
[key in ThemeColor]: ElementThemeColorValues;
|
|
12
12
|
};
|
|
13
|
-
export interface
|
|
13
|
+
export interface RelationshipThemeColorValues {
|
|
14
14
|
lineColor: ColorLiteral;
|
|
15
|
+
labelBgColor: ColorLiteral;
|
|
15
16
|
labelColor: ColorLiteral;
|
|
16
17
|
}
|
|
18
|
+
export type RelationshipThemeColors = {
|
|
19
|
+
[key in ThemeColor]: RelationshipThemeColorValues;
|
|
20
|
+
};
|
|
17
21
|
export interface LikeC4Theme {
|
|
18
22
|
font: 'Helvetica';
|
|
19
23
|
shadow: ColorLiteral;
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
relationships: RelationshipThemeColors;
|
|
25
|
+
elements: ElementThemeColors;
|
|
22
26
|
}
|
|
@@ -4,10 +4,13 @@ import type { ElementExpression, Expression } from './expression';
|
|
|
4
4
|
import type { IconUrl, NonEmptyArray } from './_common';
|
|
5
5
|
import type { ThemeColor } from './theme';
|
|
6
6
|
export type ViewID = Opaque<string, 'ViewID'>;
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
export type ViewRuleExpression = {
|
|
8
|
+
include: Expression[];
|
|
9
|
+
exclude?: never;
|
|
10
|
+
} | {
|
|
11
|
+
include?: never;
|
|
12
|
+
exclude: Expression[];
|
|
13
|
+
};
|
|
11
14
|
export declare function isViewRuleExpression(rule: ViewRule): rule is ViewRuleExpression;
|
|
12
15
|
export interface ViewRuleStyle {
|
|
13
16
|
targets: ElementExpression[];
|
|
@@ -31,6 +34,21 @@ export interface BasicElementView {
|
|
|
31
34
|
readonly tags: NonEmptyArray<Tag> | null;
|
|
32
35
|
readonly links: NonEmptyArray<string> | null;
|
|
33
36
|
readonly rules: ViewRule[];
|
|
37
|
+
/**
|
|
38
|
+
* URI to the source file of this view.
|
|
39
|
+
* Undefined if the view is auto-generated.
|
|
40
|
+
*/
|
|
41
|
+
readonly docUri?: string;
|
|
42
|
+
/**
|
|
43
|
+
* For all views we find common ancestor path.
|
|
44
|
+
* This is used to generate relative paths, i.e.:
|
|
45
|
+
* - "" for views in the common ancestor directory (or root)
|
|
46
|
+
* - "subdir" for views in "<root>/subdir"
|
|
47
|
+
* - "subdir/subdir1" for views in "<root>/subdir/subdir1"
|
|
48
|
+
*
|
|
49
|
+
* Undefined if the view is auto-generated.
|
|
50
|
+
*/
|
|
51
|
+
readonly relativePath?: string;
|
|
34
52
|
}
|
|
35
53
|
export interface StrictElementView extends BasicElementView {
|
|
36
54
|
readonly viewOf: Fqn;
|
|
@@ -9,7 +9,7 @@ exports.isViewRuleAutoLayout = isViewRuleAutoLayout;
|
|
|
9
9
|
exports.isViewRuleExpression = isViewRuleExpression;
|
|
10
10
|
exports.isViewRuleStyle = isViewRuleStyle;
|
|
11
11
|
function isViewRuleExpression(rule) {
|
|
12
|
-
return "
|
|
12
|
+
return "include" in rule && Array.isArray(rule.include) || "exclude" in rule && Array.isArray(rule.exclude);
|
|
13
13
|
}
|
|
14
14
|
function isViewRuleStyle(rule) {
|
|
15
15
|
return "style" in rule && "targets" in rule;
|
|
@@ -5,13 +5,18 @@ export declare function isAncestor<E extends {
|
|
|
5
5
|
}>(...args: [ancestor: Fqn, another: Fqn] | [ancestor: E, another: E]): boolean;
|
|
6
6
|
export declare function isSameHierarchy<E extends {
|
|
7
7
|
id: Fqn;
|
|
8
|
-
}>(
|
|
8
|
+
}>(one: E | Fqn, another: E | Fqn): boolean;
|
|
9
9
|
export declare function isDescendantOf<E extends {
|
|
10
10
|
id: Fqn;
|
|
11
11
|
}>(ancestors: E[]): (e: E) => boolean;
|
|
12
12
|
export declare function notDescendantOf(ancestors: Element[]): (e: Element) => boolean;
|
|
13
13
|
export declare function commonAncestor(first: Fqn, second: Fqn): Fqn | null;
|
|
14
14
|
export declare function parentFqn(fqn: Fqn): Fqn | null;
|
|
15
|
+
/**
|
|
16
|
+
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
17
|
+
* (from closest to root)
|
|
18
|
+
*/
|
|
19
|
+
export declare function ancestorsFqn(fqn: Fqn): Fqn[];
|
|
15
20
|
/**
|
|
16
21
|
* Compares two fully qualified names (fqns) hierarchically based on their depth.
|
|
17
22
|
* From parent nodes to leaves
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.ancestorsFqn = ancestorsFqn;
|
|
6
7
|
exports.commonAncestor = commonAncestor;
|
|
7
8
|
exports.compareByFqnHierarchically = compareByFqnHierarchically;
|
|
8
9
|
exports.compareFqnHierarchically = compareFqnHierarchically;
|
|
@@ -13,7 +14,7 @@ exports.nameFromFqn = nameFromFqn;
|
|
|
13
14
|
exports.notDescendantOf = notDescendantOf;
|
|
14
15
|
exports.parentFqn = parentFqn;
|
|
15
16
|
var _remeda = require("remeda");
|
|
16
|
-
var _guards = require("./guards
|
|
17
|
+
var _guards = require("./guards");
|
|
17
18
|
function nameFromFqn(fqn) {
|
|
18
19
|
const lastDot = fqn.lastIndexOf(".");
|
|
19
20
|
if (lastDot > 0) {
|
|
@@ -27,10 +28,10 @@ function isAncestor(...args) {
|
|
|
27
28
|
const another = (0, _guards.isString)(args[1]) ? args[1] : args[1].id;
|
|
28
29
|
return another.startsWith(ancestor + ".");
|
|
29
30
|
}
|
|
30
|
-
function isSameHierarchy(
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
return
|
|
31
|
+
function isSameHierarchy(one, another) {
|
|
32
|
+
const first = (0, _guards.isString)(one) ? one : one.id;
|
|
33
|
+
const second = (0, _guards.isString)(another) ? another : another.id;
|
|
34
|
+
return first === second || second.startsWith(first + ".") || first.startsWith(second + ".");
|
|
34
35
|
}
|
|
35
36
|
function isDescendantOf(ancestors) {
|
|
36
37
|
const predicates = ancestors.flatMap(a => [e => e.id === a.id, e => isAncestor(a, e)]);
|
|
@@ -66,6 +67,18 @@ function parentFqn(fqn) {
|
|
|
66
67
|
}
|
|
67
68
|
return null;
|
|
68
69
|
}
|
|
70
|
+
function ancestorsFqn(fqn) {
|
|
71
|
+
const path = fqn.split(".");
|
|
72
|
+
path.pop();
|
|
73
|
+
if (path.length === 0) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
return path.reduce((acc, _, idx) => {
|
|
77
|
+
const ancestor = path.slice(0, idx + 1).join(".");
|
|
78
|
+
acc.unshift(ancestor);
|
|
79
|
+
return acc;
|
|
80
|
+
}, []);
|
|
81
|
+
}
|
|
69
82
|
function compareFqnHierarchically(a, b) {
|
|
70
83
|
const depthA = a.split(".").length;
|
|
71
84
|
const depthB = b.split(".").length;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { NonEmptyArray } from '../types';
|
|
2
|
+
export { hasAtLeast } from 'remeda';
|
|
2
3
|
export declare function isString(value: unknown): value is string;
|
|
3
|
-
export declare function failUnexpected(arg: never): never;
|
|
4
|
-
export declare function ignoreNeverInRuntime(arg: never): void;
|
|
5
4
|
export declare function isNonEmptyArray<A>(arr: ArrayLike<A>): arr is NonEmptyArray<A>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "hasAtLeast", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _remeda.hasAtLeast;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.isNonEmptyArray = isNonEmptyArray;
|
|
13
|
+
exports.isString = isString;
|
|
14
|
+
var _remeda = require("remeda");
|
|
15
|
+
function isString(value) {
|
|
16
|
+
return value != null && typeof value === "string";
|
|
17
|
+
}
|
|
18
|
+
function isNonEmptyArray(arr) {
|
|
19
|
+
return arr.length > 0;
|
|
20
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _fqn = require("./fqn
|
|
6
|
+
var _fqn = require("./fqn");
|
|
7
7
|
Object.keys(_fqn).forEach(function (key) {
|
|
8
8
|
if (key === "default" || key === "__esModule") return;
|
|
9
9
|
if (key in exports && exports[key] === _fqn[key]) return;
|
|
@@ -14,7 +14,7 @@ Object.keys(_fqn).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
-
var _guards = require("./guards
|
|
17
|
+
var _guards = require("./guards");
|
|
18
18
|
Object.keys(_guards).forEach(function (key) {
|
|
19
19
|
if (key === "default" || key === "__esModule") return;
|
|
20
20
|
if (key in exports && exports[key] === _guards[key]) return;
|
|
@@ -25,18 +25,7 @@ Object.keys(_guards).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
var
|
|
29
|
-
Object.keys(_computeNodeLevels).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _computeNodeLevels[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _computeNodeLevels[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _relations = require("./relations.cjs");
|
|
28
|
+
var _relations = require("./relations");
|
|
40
29
|
Object.keys(_relations).forEach(function (key) {
|
|
41
30
|
if (key === "default" || key === "__esModule") return;
|
|
42
31
|
if (key in exports && exports[key] === _relations[key]) return;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.compareRelations = exports.Relations = void 0;
|
|
7
|
-
var _fqn = require("./fqn
|
|
7
|
+
var _fqn = require("./fqn");
|
|
8
8
|
var _rambdax = require("rambdax");
|
|
9
9
|
const compareRelations = (a, b) => {
|
|
10
10
|
return (0, _fqn.compareFqnHierarchically)(a.source, b.source) || (0, _fqn.compareFqnHierarchically)(a.target, b.target);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export declare const ElementColors: {
|
|
2
|
+
readonly primary: {
|
|
3
|
+
fill: "#3b82f6";
|
|
4
|
+
stroke: "#2563eb";
|
|
5
|
+
hiContrast: "#eff6ff";
|
|
6
|
+
loContrast: "#bfdbfe";
|
|
7
|
+
};
|
|
8
|
+
readonly blue: {
|
|
9
|
+
fill: "#3b82f6";
|
|
10
|
+
stroke: "#2563eb";
|
|
11
|
+
hiContrast: "#eff6ff";
|
|
12
|
+
loContrast: "#bfdbfe";
|
|
13
|
+
};
|
|
14
|
+
readonly secondary: {
|
|
15
|
+
fill: "#0284c7";
|
|
16
|
+
stroke: "#0369a1";
|
|
17
|
+
hiContrast: "#f0f9ff";
|
|
18
|
+
loContrast: "#e0f2fe";
|
|
19
|
+
};
|
|
20
|
+
readonly sky: {
|
|
21
|
+
fill: "#0284c7";
|
|
22
|
+
stroke: "#0369a1";
|
|
23
|
+
hiContrast: "#f0f9ff";
|
|
24
|
+
loContrast: "#e0f2fe";
|
|
25
|
+
};
|
|
26
|
+
readonly muted: {
|
|
27
|
+
fill: "#64748b";
|
|
28
|
+
stroke: "#475569";
|
|
29
|
+
hiContrast: "#f8fafc";
|
|
30
|
+
loContrast: "#e2e8f0";
|
|
31
|
+
};
|
|
32
|
+
readonly slate: {
|
|
33
|
+
fill: "#64748b";
|
|
34
|
+
stroke: "#475569";
|
|
35
|
+
hiContrast: "#f8fafc";
|
|
36
|
+
loContrast: "#e2e8f0";
|
|
37
|
+
};
|
|
38
|
+
readonly gray: {
|
|
39
|
+
readonly fill: "#737373";
|
|
40
|
+
readonly stroke: "#525252";
|
|
41
|
+
readonly hiContrast: "#fafafa";
|
|
42
|
+
readonly loContrast: "#e5e5e5";
|
|
43
|
+
};
|
|
44
|
+
readonly red: {
|
|
45
|
+
readonly fill: "#b54548";
|
|
46
|
+
readonly stroke: "#8c333a";
|
|
47
|
+
readonly hiContrast: "#f8fafc";
|
|
48
|
+
readonly loContrast: "#F9C6C6";
|
|
49
|
+
};
|
|
50
|
+
readonly green: {
|
|
51
|
+
readonly fill: "#428a4f";
|
|
52
|
+
readonly stroke: "#2d5d39";
|
|
53
|
+
readonly hiContrast: "#f8fafc";
|
|
54
|
+
readonly loContrast: "#c2f0c2";
|
|
55
|
+
};
|
|
56
|
+
readonly amber: {
|
|
57
|
+
readonly fill: "#d97706";
|
|
58
|
+
readonly stroke: "#b45309";
|
|
59
|
+
readonly hiContrast: "#f8fafc";
|
|
60
|
+
readonly loContrast: "#ffe0c2";
|
|
61
|
+
};
|
|
62
|
+
readonly indigo: {
|
|
63
|
+
readonly fill: "#6366f1";
|
|
64
|
+
readonly stroke: "#4f46e5";
|
|
65
|
+
readonly hiContrast: "#eef2ff";
|
|
66
|
+
readonly loContrast: "#c7d2fe";
|
|
67
|
+
};
|
|
68
|
+
};
|