@likec4/core 0.60.2 → 1.0.0-next.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/cjs/colors/relationships.js +1 -1
- package/dist/cjs/log.d.ts +3 -0
- package/dist/cjs/log.js +10 -0
- package/dist/cjs/reset.d.ts +2 -0
- package/dist/cjs/types/computed-view.d.ts +3 -3
- package/dist/cjs/types/diagram.d.ts +6 -8
- package/dist/cjs/types/element.d.ts +2 -1
- package/dist/cjs/types/element.js +3 -1
- package/dist/cjs/types/index.d.ts +6 -6
- package/dist/cjs/types/index.js +33 -33
- package/dist/cjs/types/model.d.ts +2 -2
- package/dist/cjs/types/view.d.ts +4 -3
- package/dist/cjs/utils/fqn.d.ts +2 -2
- package/dist/cjs/utils/fqn.js +1 -2
- package/dist/cjs/utils/relations.js +6 -3
- package/dist/colors/element.js +75 -0
- package/dist/colors/index.js +9 -0
- package/dist/colors/relationships.js +49 -0
- package/dist/errors/index.js +111 -0
- package/dist/esm/colors/relationships.js +1 -1
- package/dist/esm/log.d.ts +3 -0
- package/dist/esm/log.js +5 -0
- package/dist/esm/reset.d.ts +2 -0
- package/dist/esm/types/computed-view.d.ts +3 -3
- package/dist/esm/types/diagram.d.ts +6 -8
- package/dist/esm/types/element.d.ts +2 -1
- package/dist/esm/types/element.js +9 -0
- package/dist/esm/types/index.d.ts +6 -6
- package/dist/esm/types/index.js +6 -6
- package/dist/esm/types/model.d.ts +2 -2
- package/dist/esm/types/view.d.ts +4 -3
- package/dist/esm/utils/fqn.d.ts +2 -2
- package/dist/esm/utils/fqn.js +1 -2
- package/dist/esm/utils/relations.js +6 -3
- package/dist/index.js +4 -0
- package/dist/types/_common.js +1 -0
- package/dist/types/colors/element.d.ts +69 -0
- package/dist/types/colors/index.d.ts +133 -0
- package/dist/types/colors/relationships.d.ts +58 -0
- package/dist/types/computed-view.js +1 -0
- package/dist/types/diagram.js +1 -0
- package/dist/types/element.js +14 -0
- package/dist/types/errors/index.d.ts +40 -0
- package/dist/types/expression.js +45 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.js +11 -0
- package/dist/types/log.d.ts +4 -0
- package/dist/types/model.js +1 -0
- package/dist/types/opaque.js +1 -0
- package/dist/types/relation.js +3 -0
- package/dist/types/theme.js +1 -0
- package/dist/types/types/_common.d.ts +4 -0
- package/dist/types/types/computed-view.d.ts +46 -0
- package/dist/types/types/diagram.d.ts +41 -0
- package/dist/types/types/element.d.ts +31 -0
- package/dist/types/types/expression.d.ts +72 -0
- package/dist/types/types/index.d.ts +12 -0
- package/dist/types/types/model.d.ts +15 -0
- package/dist/types/types/opaque.d.ts +103 -0
- package/dist/types/types/relation.d.ts +25 -0
- package/dist/types/types/theme.d.ts +27 -0
- package/dist/types/types/view.d.ts +63 -0
- package/dist/types/utils/fqn.d.ts +34 -0
- package/dist/types/utils/guards.d.ts +5 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/relations.d.ts +30 -0
- package/dist/types/view.js +16 -0
- package/dist/utils/fqn.js +98 -0
- package/dist/utils/guards.js +7 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/relations.js +79 -0
- package/package.json +4 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ColorLiteral } from './theme';
|
|
2
|
-
import type { ComputedEdge, ComputedNode, ComputedView } from './computed-view';
|
|
3
1
|
import type { NonEmptyArray } from './_common';
|
|
4
|
-
|
|
2
|
+
import type { ComputedEdge, ComputedNode, ComputedView } from './computed-view';
|
|
3
|
+
import type { ColorLiteral } from './theme';
|
|
4
|
+
export type Point = readonly [x: number, y: number];
|
|
5
5
|
export type BBox = {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
@@ -18,12 +18,10 @@ export interface DiagramLabel {
|
|
|
18
18
|
text: string;
|
|
19
19
|
}
|
|
20
20
|
export interface DiagramNode extends ComputedNode {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
height: number;
|
|
24
|
-
};
|
|
25
|
-
labels: DiagramLabel[];
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
26
23
|
position: Point;
|
|
24
|
+
labels: DiagramLabel[];
|
|
27
25
|
}
|
|
28
26
|
export interface DiagramEdge extends ComputedEdge {
|
|
29
27
|
points: NonEmptyArray<Point>;
|
|
@@ -4,7 +4,8 @@ import type { ThemeColor } from './theme';
|
|
|
4
4
|
export type Fqn = Opaque<string, 'Fqn'>;
|
|
5
5
|
export declare function AsFqn(name: string, parent?: Fqn | null): Fqn;
|
|
6
6
|
export type ElementKind = Opaque<string, 'ElementKind'>;
|
|
7
|
-
export
|
|
7
|
+
export declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue"];
|
|
8
|
+
export type ElementShape = typeof ElementShapes[number];
|
|
8
9
|
export declare const DefaultThemeColor = "primary";
|
|
9
10
|
export declare const DefaultElementShape = "rectangle";
|
|
10
11
|
export interface ElementStyle {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export function AsFqn(name, parent) {
|
|
2
2
|
return parent ? parent + "." + name : name;
|
|
3
3
|
}
|
|
4
|
+
export const ElementShapes = [
|
|
5
|
+
"rectangle",
|
|
6
|
+
"person",
|
|
7
|
+
"browser",
|
|
8
|
+
"mobile",
|
|
9
|
+
"cylinder",
|
|
10
|
+
"storage",
|
|
11
|
+
"queue"
|
|
12
|
+
];
|
|
4
13
|
export const DefaultThemeColor = "primary";
|
|
5
14
|
export const DefaultElementShape = "rectangle";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './opaque';
|
|
2
1
|
export * from './_common';
|
|
3
|
-
export * from './
|
|
2
|
+
export * from './computed-view';
|
|
3
|
+
export * from './diagram';
|
|
4
4
|
export * from './element';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './expression';
|
|
6
6
|
export * from './model';
|
|
7
|
+
export * from './opaque';
|
|
8
|
+
export * from './relation';
|
|
9
|
+
export * from './theme';
|
|
7
10
|
export * from './view';
|
|
8
|
-
export * from './expression';
|
|
9
|
-
export * from './computed-view';
|
|
10
|
-
export * from './diagram';
|
|
11
11
|
export * as Expr from './expression';
|
package/dist/esm/types/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from "./opaque.js";
|
|
2
1
|
export * from "./_common.js";
|
|
3
|
-
export * from "./
|
|
2
|
+
export * from "./computed-view.js";
|
|
3
|
+
export * from "./diagram.js";
|
|
4
4
|
export * from "./element.js";
|
|
5
|
-
export * from "./
|
|
5
|
+
export * from "./expression.js";
|
|
6
6
|
export * from "./model.js";
|
|
7
|
+
export * from "./opaque.js";
|
|
8
|
+
export * from "./relation.js";
|
|
9
|
+
export * from "./theme.js";
|
|
7
10
|
export * from "./view.js";
|
|
8
|
-
export * from "./expression.js";
|
|
9
|
-
export * from "./computed-view.js";
|
|
10
|
-
export * from "./diagram.js";
|
|
11
11
|
export * as Expr from "./expression.js";
|
|
@@ -2,12 +2,12 @@ import type { ComputedView } from './computed-view';
|
|
|
2
2
|
import type { Element, Fqn } from './element';
|
|
3
3
|
import type { Relation, RelationID } from './relation';
|
|
4
4
|
import type { ElementView, ViewID } from './view';
|
|
5
|
-
export interface
|
|
5
|
+
export interface LikeC4Model {
|
|
6
6
|
elements: Record<Fqn, Element>;
|
|
7
7
|
relations: Record<RelationID, Relation>;
|
|
8
8
|
views: Record<ViewID, ElementView>;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface LikeC4ComputedModel {
|
|
11
11
|
elements: Record<Fqn, Element>;
|
|
12
12
|
relations: Record<RelationID, Relation>;
|
|
13
13
|
views: Record<ViewID, ComputedView>;
|
package/dist/esm/types/view.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IconUrl, NonEmptyArray } from './_common';
|
|
2
2
|
import type { ElementShape, Fqn, Tag } from './element';
|
|
3
3
|
import type { ElementExpression, Expression } from './expression';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Opaque } from './opaque';
|
|
5
5
|
import type { ThemeColor } from './theme';
|
|
6
6
|
export type ViewID = Opaque<string, 'ViewID'>;
|
|
7
7
|
export type ViewRuleExpression = {
|
|
@@ -21,8 +21,9 @@ export interface ViewRuleStyle {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export declare function isViewRuleStyle(rule: ViewRule): rule is ViewRuleStyle;
|
|
24
|
+
export type AutoLayoutDirection = 'TB' | 'BT' | 'LR' | 'RL';
|
|
24
25
|
export interface ViewRuleAutoLayout {
|
|
25
|
-
autoLayout:
|
|
26
|
+
autoLayout: AutoLayoutDirection;
|
|
26
27
|
}
|
|
27
28
|
export declare function isViewRuleAutoLayout(rule: ViewRule): rule is ViewRuleAutoLayout;
|
|
28
29
|
export type ViewRule = ViewRuleExpression | ViewRuleStyle | ViewRuleAutoLayout;
|
package/dist/esm/utils/fqn.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Element, Fqn } from '../types';
|
|
|
2
2
|
export declare function nameFromFqn(fqn: Fqn): string;
|
|
3
3
|
export declare function isAncestor<E extends {
|
|
4
4
|
id: Fqn;
|
|
5
|
-
}>(...args: [ancestor:
|
|
5
|
+
}>(...args: [ancestor: string, another: string] | [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;
|
|
@@ -29,5 +29,5 @@ export declare function ancestorsFqn(fqn: Fqn): Fqn[];
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function compareFqnHierarchically<T extends string = string>(a: T, b: T): number;
|
|
31
31
|
export declare function compareByFqnHierarchically<T extends {
|
|
32
|
-
id:
|
|
32
|
+
id: string;
|
|
33
33
|
}>(a: T, b: T): number;
|
package/dist/esm/utils/fqn.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { anyPass } from "remeda";
|
|
2
1
|
import { isString } from "./guards.js";
|
|
3
2
|
export function nameFromFqn(fqn) {
|
|
4
3
|
const lastDot = fqn.lastIndexOf(".");
|
|
@@ -20,7 +19,7 @@ export function isSameHierarchy(one, another) {
|
|
|
20
19
|
}
|
|
21
20
|
export function isDescendantOf(ancestors) {
|
|
22
21
|
const predicates = ancestors.flatMap((a) => [(e) => e.id === a.id, (e) => isAncestor(a, e)]);
|
|
23
|
-
return
|
|
22
|
+
return (e) => predicates.some((p) => p(e));
|
|
24
23
|
}
|
|
25
24
|
export function notDescendantOf(ancestors) {
|
|
26
25
|
const isDescendant = isDescendantOf(ancestors);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { commonAncestor, compareFqnHierarchically, isAncestor } from "./fqn.js";
|
|
2
|
-
import { either } from "rambdax";
|
|
3
2
|
export const compareRelations = (a, b) => {
|
|
4
3
|
const parentA = commonAncestor(a.source, a.target);
|
|
5
4
|
const parentB = commonAncestor(b.source, b.target);
|
|
@@ -33,7 +32,8 @@ const isBetween = (source, target) => {
|
|
|
33
32
|
};
|
|
34
33
|
};
|
|
35
34
|
const isAnyBetween = (source, target) => {
|
|
36
|
-
|
|
35
|
+
const predicates = [isBetween(source, target), isBetween(target, source)];
|
|
36
|
+
return (rel) => predicates.some((p) => p(rel));
|
|
37
37
|
};
|
|
38
38
|
const isIncoming = (target) => {
|
|
39
39
|
const targetPrefix = target + ".";
|
|
@@ -48,7 +48,10 @@ const isOutgoing = (source) => {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
const isAnyInOut = (source) => {
|
|
51
|
-
|
|
51
|
+
const predicates = [isIncoming(source), isOutgoing(source)];
|
|
52
|
+
return (rel) => {
|
|
53
|
+
return predicates.some((p) => p(rel));
|
|
54
|
+
};
|
|
52
55
|
};
|
|
53
56
|
const hasRelation = (rel) => {
|
|
54
57
|
return (element) => {
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
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: "#B6ECF7";
|
|
19
|
+
};
|
|
20
|
+
readonly sky: {
|
|
21
|
+
fill: "#0284c7";
|
|
22
|
+
stroke: "#0369a1";
|
|
23
|
+
hiContrast: "#f0f9ff";
|
|
24
|
+
loContrast: "#B6ECF7";
|
|
25
|
+
};
|
|
26
|
+
readonly muted: {
|
|
27
|
+
fill: "#64748b";
|
|
28
|
+
stroke: "#475569";
|
|
29
|
+
hiContrast: "#f8fafc";
|
|
30
|
+
loContrast: "#cbd5e1";
|
|
31
|
+
};
|
|
32
|
+
readonly slate: {
|
|
33
|
+
fill: "#64748b";
|
|
34
|
+
stroke: "#475569";
|
|
35
|
+
hiContrast: "#f8fafc";
|
|
36
|
+
loContrast: "#cbd5e1";
|
|
37
|
+
};
|
|
38
|
+
readonly gray: {
|
|
39
|
+
readonly fill: "#737373";
|
|
40
|
+
readonly stroke: "#525252";
|
|
41
|
+
readonly hiContrast: "#fafafa";
|
|
42
|
+
readonly loContrast: "#d4d4d4";
|
|
43
|
+
};
|
|
44
|
+
readonly red: {
|
|
45
|
+
readonly fill: "#AC4D39";
|
|
46
|
+
readonly stroke: "#853A2D";
|
|
47
|
+
readonly hiContrast: "#FBD3CB";
|
|
48
|
+
readonly loContrast: "#FF977D";
|
|
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: "#A35829";
|
|
58
|
+
readonly stroke: "#7E451D";
|
|
59
|
+
readonly hiContrast: "#FFE0C2";
|
|
60
|
+
readonly loContrast: "#FFA057";
|
|
61
|
+
};
|
|
62
|
+
readonly indigo: {
|
|
63
|
+
readonly fill: "#6366f1";
|
|
64
|
+
readonly stroke: "#4f46e5";
|
|
65
|
+
readonly hiContrast: "#eef2ff";
|
|
66
|
+
readonly loContrast: "#c7d2fe";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ElementColors } from './element';
|
|
2
|
+
import { RelationshipColors } from './relationships';
|
|
3
|
+
export declare const defaultTheme: {
|
|
4
|
+
elements: {
|
|
5
|
+
readonly primary: {
|
|
6
|
+
fill: "#3b82f6";
|
|
7
|
+
stroke: "#2563eb";
|
|
8
|
+
hiContrast: "#eff6ff";
|
|
9
|
+
loContrast: "#bfdbfe";
|
|
10
|
+
};
|
|
11
|
+
readonly blue: {
|
|
12
|
+
fill: "#3b82f6";
|
|
13
|
+
stroke: "#2563eb";
|
|
14
|
+
hiContrast: "#eff6ff";
|
|
15
|
+
loContrast: "#bfdbfe";
|
|
16
|
+
};
|
|
17
|
+
readonly secondary: {
|
|
18
|
+
fill: "#0284c7";
|
|
19
|
+
stroke: "#0369a1";
|
|
20
|
+
hiContrast: "#f0f9ff";
|
|
21
|
+
loContrast: "#B6ECF7";
|
|
22
|
+
};
|
|
23
|
+
readonly sky: {
|
|
24
|
+
fill: "#0284c7";
|
|
25
|
+
stroke: "#0369a1";
|
|
26
|
+
hiContrast: "#f0f9ff";
|
|
27
|
+
loContrast: "#B6ECF7";
|
|
28
|
+
};
|
|
29
|
+
readonly muted: {
|
|
30
|
+
fill: "#64748b";
|
|
31
|
+
stroke: "#475569";
|
|
32
|
+
hiContrast: "#f8fafc";
|
|
33
|
+
loContrast: "#cbd5e1";
|
|
34
|
+
};
|
|
35
|
+
readonly slate: {
|
|
36
|
+
fill: "#64748b";
|
|
37
|
+
stroke: "#475569";
|
|
38
|
+
hiContrast: "#f8fafc";
|
|
39
|
+
loContrast: "#cbd5e1";
|
|
40
|
+
};
|
|
41
|
+
readonly gray: {
|
|
42
|
+
readonly fill: "#737373";
|
|
43
|
+
readonly stroke: "#525252";
|
|
44
|
+
readonly hiContrast: "#fafafa";
|
|
45
|
+
readonly loContrast: "#d4d4d4";
|
|
46
|
+
};
|
|
47
|
+
readonly red: {
|
|
48
|
+
readonly fill: "#AC4D39";
|
|
49
|
+
readonly stroke: "#853A2D";
|
|
50
|
+
readonly hiContrast: "#FBD3CB";
|
|
51
|
+
readonly loContrast: "#FF977D";
|
|
52
|
+
};
|
|
53
|
+
readonly green: {
|
|
54
|
+
readonly fill: "#428a4f";
|
|
55
|
+
readonly stroke: "#2d5d39";
|
|
56
|
+
readonly hiContrast: "#f8fafc";
|
|
57
|
+
readonly loContrast: "#c2f0c2";
|
|
58
|
+
};
|
|
59
|
+
readonly amber: {
|
|
60
|
+
readonly fill: "#A35829";
|
|
61
|
+
readonly stroke: "#7E451D";
|
|
62
|
+
readonly hiContrast: "#FFE0C2";
|
|
63
|
+
readonly loContrast: "#FFA057";
|
|
64
|
+
};
|
|
65
|
+
readonly indigo: {
|
|
66
|
+
readonly fill: "#6366f1";
|
|
67
|
+
readonly stroke: "#4f46e5";
|
|
68
|
+
readonly hiContrast: "#eef2ff";
|
|
69
|
+
readonly loContrast: "#c7d2fe";
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
relationships: {
|
|
73
|
+
amber: {
|
|
74
|
+
lineColor: "#b45309";
|
|
75
|
+
labelBgColor: "#78350f";
|
|
76
|
+
labelColor: "#FFE0C2";
|
|
77
|
+
};
|
|
78
|
+
blue: {
|
|
79
|
+
lineColor: "#3b82f6";
|
|
80
|
+
labelBgColor: "#172554";
|
|
81
|
+
labelColor: "#60a5fa";
|
|
82
|
+
};
|
|
83
|
+
gray: {
|
|
84
|
+
lineColor: "#6E6E6E";
|
|
85
|
+
labelBgColor: "#18191b";
|
|
86
|
+
labelColor: "#C6C6C6";
|
|
87
|
+
};
|
|
88
|
+
green: {
|
|
89
|
+
lineColor: "#15803d";
|
|
90
|
+
labelBgColor: "#052e16";
|
|
91
|
+
labelColor: "#22c55e";
|
|
92
|
+
};
|
|
93
|
+
indigo: {
|
|
94
|
+
lineColor: "#6366f1";
|
|
95
|
+
labelBgColor: "#1e1b4b";
|
|
96
|
+
labelColor: "#818cf8";
|
|
97
|
+
};
|
|
98
|
+
muted: {
|
|
99
|
+
lineColor: "#64748b";
|
|
100
|
+
labelBgColor: "#0f172a";
|
|
101
|
+
labelColor: "#cbd5e1";
|
|
102
|
+
};
|
|
103
|
+
primary: {
|
|
104
|
+
lineColor: "#3b82f6";
|
|
105
|
+
labelBgColor: "#172554";
|
|
106
|
+
labelColor: "#60a5fa";
|
|
107
|
+
};
|
|
108
|
+
red: {
|
|
109
|
+
lineColor: "#AC4D39";
|
|
110
|
+
labelBgColor: "#b91c1c";
|
|
111
|
+
labelColor: "#FF977D";
|
|
112
|
+
};
|
|
113
|
+
secondary: {
|
|
114
|
+
lineColor: "#0ea5e9";
|
|
115
|
+
labelBgColor: "#082f49";
|
|
116
|
+
labelColor: "#38bdf8";
|
|
117
|
+
};
|
|
118
|
+
sky: {
|
|
119
|
+
lineColor: "#0ea5e9";
|
|
120
|
+
labelBgColor: "#082f49";
|
|
121
|
+
labelColor: "#38bdf8";
|
|
122
|
+
};
|
|
123
|
+
slate: {
|
|
124
|
+
lineColor: "#64748b";
|
|
125
|
+
labelBgColor: "#0f172a";
|
|
126
|
+
labelColor: "#cbd5e1";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
font: "Helvetica";
|
|
130
|
+
shadow: "#0a0a0a";
|
|
131
|
+
};
|
|
132
|
+
export { ElementColors, RelationshipColors };
|
|
133
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare const RelationshipColors: {
|
|
2
|
+
amber: {
|
|
3
|
+
lineColor: "#b45309";
|
|
4
|
+
labelBgColor: "#78350f";
|
|
5
|
+
labelColor: "#FFE0C2";
|
|
6
|
+
};
|
|
7
|
+
blue: {
|
|
8
|
+
lineColor: "#3b82f6";
|
|
9
|
+
labelBgColor: "#172554";
|
|
10
|
+
labelColor: "#60a5fa";
|
|
11
|
+
};
|
|
12
|
+
gray: {
|
|
13
|
+
lineColor: "#6E6E6E";
|
|
14
|
+
labelBgColor: "#18191b";
|
|
15
|
+
labelColor: "#C6C6C6";
|
|
16
|
+
};
|
|
17
|
+
green: {
|
|
18
|
+
lineColor: "#15803d";
|
|
19
|
+
labelBgColor: "#052e16";
|
|
20
|
+
labelColor: "#22c55e";
|
|
21
|
+
};
|
|
22
|
+
indigo: {
|
|
23
|
+
lineColor: "#6366f1";
|
|
24
|
+
labelBgColor: "#1e1b4b";
|
|
25
|
+
labelColor: "#818cf8";
|
|
26
|
+
};
|
|
27
|
+
muted: {
|
|
28
|
+
lineColor: "#64748b";
|
|
29
|
+
labelBgColor: "#0f172a";
|
|
30
|
+
labelColor: "#cbd5e1";
|
|
31
|
+
};
|
|
32
|
+
primary: {
|
|
33
|
+
lineColor: "#3b82f6";
|
|
34
|
+
labelBgColor: "#172554";
|
|
35
|
+
labelColor: "#60a5fa";
|
|
36
|
+
};
|
|
37
|
+
red: {
|
|
38
|
+
lineColor: "#AC4D39";
|
|
39
|
+
labelBgColor: "#b91c1c";
|
|
40
|
+
labelColor: "#FF977D";
|
|
41
|
+
};
|
|
42
|
+
secondary: {
|
|
43
|
+
lineColor: "#0ea5e9";
|
|
44
|
+
labelBgColor: "#082f49";
|
|
45
|
+
labelColor: "#38bdf8";
|
|
46
|
+
};
|
|
47
|
+
sky: {
|
|
48
|
+
lineColor: "#0ea5e9";
|
|
49
|
+
labelBgColor: "#082f49";
|
|
50
|
+
labelColor: "#38bdf8";
|
|
51
|
+
};
|
|
52
|
+
slate: {
|
|
53
|
+
lineColor: "#64748b";
|
|
54
|
+
labelBgColor: "#0f172a";
|
|
55
|
+
labelColor: "#cbd5e1";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=relationships.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function AsFqn(name, parent) {
|
|
2
|
+
return (parent ? parent + '.' + name : name);
|
|
3
|
+
}
|
|
4
|
+
export const ElementShapes = [
|
|
5
|
+
'rectangle',
|
|
6
|
+
'person',
|
|
7
|
+
'browser',
|
|
8
|
+
'mobile',
|
|
9
|
+
'cylinder',
|
|
10
|
+
'storage',
|
|
11
|
+
'queue'
|
|
12
|
+
];
|
|
13
|
+
export const DefaultThemeColor = 'primary';
|
|
14
|
+
export const DefaultElementShape = 'rectangle';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CustomError } from 'ts-custom-error';
|
|
2
|
+
export interface BaseErrorOptions {
|
|
3
|
+
cause?: unknown;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Base class for all errors in the LikeC4 library.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BaseError extends CustomError {
|
|
9
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
10
|
+
}
|
|
11
|
+
export declare class InvalidArgError extends BaseError {
|
|
12
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Unknown error, mosly probably a bug, unhandled case or coming from a third-party library.
|
|
16
|
+
*/
|
|
17
|
+
export declare class UnknownError extends BaseError {
|
|
18
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
19
|
+
}
|
|
20
|
+
export declare class NullableError extends BaseError {
|
|
21
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
22
|
+
}
|
|
23
|
+
export declare class InvariantError extends BaseError {
|
|
24
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
25
|
+
}
|
|
26
|
+
export declare function nonNullable<T>(value: T, message?: string): T & {};
|
|
27
|
+
export declare class RelationRefError extends BaseError {
|
|
28
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
29
|
+
}
|
|
30
|
+
export declare function normalizeError(e: unknown): Error;
|
|
31
|
+
export declare function invariant(condition: any, message?: string): asserts condition;
|
|
32
|
+
export declare class NonExhaustiveError extends BaseError {
|
|
33
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
34
|
+
}
|
|
35
|
+
export declare function nonexhaustive(value: never): never;
|
|
36
|
+
export declare class InvalidModelError extends BaseError {
|
|
37
|
+
constructor(message: string, options?: BaseErrorOptions);
|
|
38
|
+
}
|
|
39
|
+
export declare function ensureModel(condition: any, message?: string): asserts condition;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function isElementRef(expr) {
|
|
2
|
+
return 'element' in expr;
|
|
3
|
+
}
|
|
4
|
+
export function isCustomElement(expr) {
|
|
5
|
+
return 'custom' in expr;
|
|
6
|
+
}
|
|
7
|
+
export function isWildcard(expr) {
|
|
8
|
+
return 'wildcard' in expr;
|
|
9
|
+
}
|
|
10
|
+
export function isElementKindExpr(expr) {
|
|
11
|
+
return 'elementKind' in expr && 'isEqual' in expr;
|
|
12
|
+
}
|
|
13
|
+
export function isElementTagExpr(expr) {
|
|
14
|
+
return 'elementTag' in expr && 'isEqual' in expr;
|
|
15
|
+
}
|
|
16
|
+
export function isElement(expr) {
|
|
17
|
+
return isElementRef(expr) || isWildcard(expr) || isElementKindExpr(expr) || isElementTagExpr(expr);
|
|
18
|
+
}
|
|
19
|
+
export function isRelation(expr) {
|
|
20
|
+
return 'source' in expr && 'target' in expr;
|
|
21
|
+
}
|
|
22
|
+
export function isInOut(expr) {
|
|
23
|
+
return 'inout' in expr;
|
|
24
|
+
}
|
|
25
|
+
export function isIncoming(expr) {
|
|
26
|
+
return 'incoming' in expr;
|
|
27
|
+
}
|
|
28
|
+
export function isOutgoing(expr) {
|
|
29
|
+
return 'outgoing' in expr;
|
|
30
|
+
}
|
|
31
|
+
export function isAnyRelation(expr) {
|
|
32
|
+
return isRelation(expr) || isInOut(expr) || isIncoming(expr) || isOutgoing(expr);
|
|
33
|
+
}
|
|
34
|
+
// export const Expr = {
|
|
35
|
+
// isElementRef,
|
|
36
|
+
// isWildcard,
|
|
37
|
+
// isElementKindExpr,
|
|
38
|
+
// isElementTagExpr,
|
|
39
|
+
// isElement,
|
|
40
|
+
// isRelation,
|
|
41
|
+
// isInOut,
|
|
42
|
+
// isIncoming,
|
|
43
|
+
// isOutgoing,
|
|
44
|
+
// isAnyRelation,
|
|
45
|
+
// }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './_common';
|
|
2
|
+
export * from './computed-view';
|
|
3
|
+
export * from './diagram';
|
|
4
|
+
export * from './element';
|
|
5
|
+
export * from './expression';
|
|
6
|
+
export * from './model';
|
|
7
|
+
export * from './opaque';
|
|
8
|
+
export * from './relation';
|
|
9
|
+
export * from './theme';
|
|
10
|
+
export * from './view';
|
|
11
|
+
export * as Expr from './expression';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IconUrl, NonEmptyArray } from './_common';
|
|
2
|
+
import type { ElementKind, ElementShape, Fqn, Tag } from './element';
|
|
3
|
+
import type { Opaque } from './opaque';
|
|
4
|
+
import type { RelationID, RelationshipArrowType, RelationshipLineType } from './relation';
|
|
5
|
+
import type { ThemeColor } from './theme';
|
|
6
|
+
import type { BasicElementView, ViewID, ViewRuleAutoLayout } from './view';
|
|
7
|
+
export type NodeId = Fqn;
|
|
8
|
+
export type EdgeId = Opaque<string, 'EdgeId'>;
|
|
9
|
+
export interface ComputedNode {
|
|
10
|
+
id: NodeId;
|
|
11
|
+
kind: ElementKind;
|
|
12
|
+
parent: NodeId | null;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string | null;
|
|
15
|
+
technology: string | null;
|
|
16
|
+
tags: NonEmptyArray<Tag> | null;
|
|
17
|
+
links: NonEmptyArray<string> | null;
|
|
18
|
+
children: NodeId[];
|
|
19
|
+
inEdges: EdgeId[];
|
|
20
|
+
outEdges: EdgeId[];
|
|
21
|
+
shape: ElementShape;
|
|
22
|
+
color: ThemeColor;
|
|
23
|
+
icon?: IconUrl;
|
|
24
|
+
navigateTo?: ViewID;
|
|
25
|
+
level: number;
|
|
26
|
+
depth?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface ComputedEdge {
|
|
29
|
+
id: EdgeId;
|
|
30
|
+
parent: NodeId | null;
|
|
31
|
+
source: NodeId;
|
|
32
|
+
target: NodeId;
|
|
33
|
+
label: string | null;
|
|
34
|
+
relations: RelationID[];
|
|
35
|
+
color?: ThemeColor;
|
|
36
|
+
line?: RelationshipLineType;
|
|
37
|
+
head?: RelationshipArrowType;
|
|
38
|
+
tail?: RelationshipArrowType;
|
|
39
|
+
}
|
|
40
|
+
export interface ComputedView extends Omit<BasicElementView, 'rules'> {
|
|
41
|
+
readonly extends?: ViewID;
|
|
42
|
+
readonly autoLayout: ViewRuleAutoLayout['autoLayout'];
|
|
43
|
+
readonly nodes: ComputedNode[];
|
|
44
|
+
readonly edges: ComputedEdge[];
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=computed-view.d.ts.map
|