@likec4/core 0.32.0 → 0.33.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/colors.d.ts +76 -9
- package/dist/colors.js +116 -93
- package/dist/colors.mjs +112 -0
- package/dist/compute-view/EdgeBuilder.d.ts +0 -1
- package/dist/compute-view/EdgeBuilder.js +37 -34
- package/dist/compute-view/EdgeBuilder.mjs +31 -0
- package/dist/compute-view/compute-ctx.d.ts +0 -1
- package/dist/compute-view/compute-ctx.js +33 -24
- package/dist/compute-view/compute-ctx.mjs +42 -0
- package/dist/compute-view/compute-element-view.d.ts +2 -3
- package/dist/compute-view/compute-element-view.js +137 -525
- package/dist/compute-view/compute-element-view.mjs +145 -0
- package/dist/compute-view/compute-predicates.d.ts +16 -0
- package/dist/compute-view/compute-predicates.js +358 -0
- package/dist/compute-view/compute-predicates.mjs +324 -0
- package/dist/compute-view/compute.d.ts +8 -9
- package/dist/compute-view/compute.js +49 -39
- package/dist/compute-view/compute.mjs +39 -0
- package/dist/compute-view/index.d.ts +1 -1
- package/dist/compute-view/index.js +24 -2
- package/dist/compute-view/index.mjs +1 -0
- package/dist/compute-view/utils/anyPossibleRelations.d.ts +0 -1
- package/dist/compute-view/utils/anyPossibleRelations.js +17 -12
- package/dist/compute-view/utils/anyPossibleRelations.mjs +12 -0
- package/dist/compute-view/utils/applyViewRuleStyles.d.ts +3 -0
- package/dist/compute-view/utils/applyViewRuleStyles.js +59 -0
- package/dist/compute-view/utils/applyViewRuleStyles.mjs +50 -0
- package/dist/compute-view/utils/sortNodes.d.ts +0 -1
- package/dist/compute-view/utils/sortNodes.js +47 -42
- package/dist/compute-view/utils/sortNodes.mjs +40 -0
- package/dist/errors/_base.d.ts +0 -1
- package/dist/errors/_base.js +14 -11
- package/dist/errors/_base.mjs +4 -0
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +60 -5
- package/dist/errors/index.mjs +5 -0
- package/dist/errors/invariant.d.ts +0 -2
- package/dist/errors/invariant.js +16 -21
- package/dist/errors/invariant.mjs +8 -0
- package/dist/errors/model-index.d.ts +0 -1
- package/dist/errors/model-index.js +16 -14
- package/dist/errors/model-index.mjs +8 -0
- package/dist/errors/non-nullable.d.ts +2 -0
- package/dist/errors/non-nullable.js +16 -0
- package/dist/errors/non-nullable.mjs +8 -0
- package/dist/errors/nonexhaustive.d.ts +0 -1
- package/dist/errors/nonexhaustive.js +13 -6
- package/dist/errors/nonexhaustive.mjs +5 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +71 -7
- package/dist/index.mjs +6 -0
- package/dist/model-index/ModelIndex.d.ts +0 -1
- package/dist/model-index/ModelIndex.js +125 -122
- package/dist/model-index/ModelIndex.mjs +128 -0
- package/dist/model-index/index.d.ts +0 -1
- package/dist/model-index/index.js +13 -2
- package/dist/model-index/index.mjs +1 -0
- package/dist/types/_common.d.ts +0 -1
- package/dist/types/_common.js +1 -2
- package/dist/types/_common.mjs +0 -0
- package/dist/types/computed-view.d.ts +7 -6
- package/dist/types/computed-view.js +1 -2
- package/dist/types/computed-view.mjs +0 -0
- package/dist/types/diagram.d.ts +5 -2
- package/dist/types/diagram.js +1 -2
- package/dist/types/diagram.mjs +0 -0
- package/dist/types/element.d.ts +3 -7
- package/dist/types/element.js +13 -5
- package/dist/types/element.mjs +5 -0
- package/dist/types/expression.d.ts +0 -1
- package/dist/types/expression.js +45 -31
- package/dist/types/expression.mjs +30 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +48 -4
- package/dist/types/index.mjs +3 -0
- package/dist/types/model.d.ts +0 -1
- package/dist/types/model.js +1 -2
- package/dist/types/model.mjs +0 -0
- package/dist/types/opaque.d.ts +0 -1
- package/dist/types/opaque.js +1 -2
- package/dist/types/opaque.mjs +0 -0
- package/dist/types/relation.d.ts +0 -1
- package/dist/types/relation.js +1 -2
- package/dist/types/relation.mjs +0 -0
- package/dist/types/theme.d.ts +22 -0
- package/dist/types/theme.js +1 -0
- package/dist/types/theme.mjs +0 -0
- package/dist/types/view.d.ts +2 -2
- package/dist/types/view.js +15 -8
- package/dist/types/view.mjs +9 -0
- package/dist/utils/compute-node-levels.d.ts +0 -1
- package/dist/utils/compute-node-levels.js +45 -29
- package/dist/utils/compute-node-levels.mjs +31 -0
- package/dist/utils/fqn.d.ts +0 -1
- package/dist/utils/fqn.js +71 -71
- package/dist/utils/fqn.mjs +66 -0
- package/dist/utils/guards.d.ts +0 -1
- package/dist/utils/guards.js +19 -12
- package/dist/utils/guards.mjs +13 -0
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +49 -5
- package/dist/utils/index.mjs +4 -0
- package/dist/utils/relations.d.ts +0 -1
- package/dist/utils/relations.js +56 -49
- package/dist/utils/relations.mjs +42 -0
- package/package.json +20 -55
package/dist/colors.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
type Color = `#${string}`;
|
|
2
|
-
export interface ElementColors {
|
|
3
|
-
fill: Color;
|
|
4
|
-
stroke: Color;
|
|
5
|
-
hiContrast: Color;
|
|
6
|
-
loContrast: Color;
|
|
7
|
-
}
|
|
8
1
|
export declare const RelationColors: {
|
|
9
2
|
readonly lineColor: "#a3a3a3";
|
|
10
3
|
readonly labelColor: "#d4d4d4";
|
|
@@ -77,5 +70,79 @@ export declare const Colors: {
|
|
|
77
70
|
readonly loContrast: "#c7d2fe";
|
|
78
71
|
};
|
|
79
72
|
};
|
|
80
|
-
export {
|
|
81
|
-
|
|
73
|
+
export declare const defaultTheme: {
|
|
74
|
+
readonly font: "Helvetica";
|
|
75
|
+
readonly shadow: "#0a0a0a";
|
|
76
|
+
readonly relation: {
|
|
77
|
+
readonly lineColor: "#a3a3a3";
|
|
78
|
+
readonly labelColor: "#d4d4d4";
|
|
79
|
+
};
|
|
80
|
+
readonly colors: {
|
|
81
|
+
readonly primary: {
|
|
82
|
+
fill: "#3b82f6";
|
|
83
|
+
stroke: "#2563eb";
|
|
84
|
+
hiContrast: "#eff6ff";
|
|
85
|
+
loContrast: "#dbeafe";
|
|
86
|
+
};
|
|
87
|
+
readonly blue: {
|
|
88
|
+
fill: "#3b82f6";
|
|
89
|
+
stroke: "#2563eb";
|
|
90
|
+
hiContrast: "#eff6ff";
|
|
91
|
+
loContrast: "#dbeafe";
|
|
92
|
+
};
|
|
93
|
+
readonly secondary: {
|
|
94
|
+
fill: "#0284c7";
|
|
95
|
+
stroke: "#0369a1";
|
|
96
|
+
hiContrast: "#f0f9ff";
|
|
97
|
+
loContrast: "#e0f2fe";
|
|
98
|
+
};
|
|
99
|
+
readonly sky: {
|
|
100
|
+
fill: "#0284c7";
|
|
101
|
+
stroke: "#0369a1";
|
|
102
|
+
hiContrast: "#f0f9ff";
|
|
103
|
+
loContrast: "#e0f2fe";
|
|
104
|
+
};
|
|
105
|
+
readonly muted: {
|
|
106
|
+
fill: "#64748b";
|
|
107
|
+
stroke: "#475569";
|
|
108
|
+
hiContrast: "#f8fafc";
|
|
109
|
+
loContrast: "#e2e8f0";
|
|
110
|
+
};
|
|
111
|
+
readonly slate: {
|
|
112
|
+
fill: "#64748b";
|
|
113
|
+
stroke: "#475569";
|
|
114
|
+
hiContrast: "#f8fafc";
|
|
115
|
+
loContrast: "#e2e8f0";
|
|
116
|
+
};
|
|
117
|
+
readonly gray: {
|
|
118
|
+
readonly fill: "#737373";
|
|
119
|
+
readonly stroke: "#525252";
|
|
120
|
+
readonly hiContrast: "#fafafa";
|
|
121
|
+
readonly loContrast: "#e5e5e5";
|
|
122
|
+
};
|
|
123
|
+
readonly red: {
|
|
124
|
+
readonly fill: "#ef4444";
|
|
125
|
+
readonly stroke: "#dc2626";
|
|
126
|
+
readonly hiContrast: "#111827";
|
|
127
|
+
readonly loContrast: "#1f2937";
|
|
128
|
+
};
|
|
129
|
+
readonly green: {
|
|
130
|
+
readonly fill: "#16a34a";
|
|
131
|
+
readonly stroke: "#15803d";
|
|
132
|
+
readonly hiContrast: "#111827";
|
|
133
|
+
readonly loContrast: "#1f2937";
|
|
134
|
+
};
|
|
135
|
+
readonly amber: {
|
|
136
|
+
readonly fill: "#d97706";
|
|
137
|
+
readonly stroke: "#b45309";
|
|
138
|
+
readonly hiContrast: "#111827";
|
|
139
|
+
readonly loContrast: "#1f2937";
|
|
140
|
+
};
|
|
141
|
+
readonly indigo: {
|
|
142
|
+
readonly fill: "#6366f1";
|
|
143
|
+
readonly stroke: "#4f46e5";
|
|
144
|
+
readonly hiContrast: "#eef2ff";
|
|
145
|
+
readonly loContrast: "#c7d2fe";
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
package/dist/colors.js
CHANGED
|
@@ -1,101 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultTheme = exports.RelationColors = exports.Colors = void 0;
|
|
1
7
|
const blue = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
// fill: colors.blue[500],
|
|
9
|
+
// stroke: colors.blue[600],
|
|
10
|
+
// hiContrast: colors.blue[50],
|
|
11
|
+
// loContrast: colors.blue[100],
|
|
12
|
+
fill: "#3b82f6",
|
|
13
|
+
stroke: "#2563eb",
|
|
14
|
+
hiContrast: "#eff6ff",
|
|
15
|
+
loContrast: "#dbeafe"
|
|
10
16
|
};
|
|
11
17
|
const sky = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
// fill: colors.sky[600],
|
|
19
|
+
// stroke: colors.sky[700],
|
|
20
|
+
// hiContrast: colors.sky[50],
|
|
21
|
+
// loContrast: colors.sky[100],
|
|
22
|
+
fill: "#0284c7",
|
|
23
|
+
stroke: "#0369a1",
|
|
24
|
+
hiContrast: "#f0f9ff",
|
|
25
|
+
loContrast: "#e0f2fe"
|
|
20
26
|
};
|
|
21
27
|
const slate = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// fill: colors.slate[500],
|
|
29
|
+
// stroke: colors.slate[600],
|
|
30
|
+
// hiContrast: colors.slate[50],
|
|
31
|
+
// loContrast: colors.slate[200],
|
|
32
|
+
fill: "#64748b",
|
|
33
|
+
stroke: "#475569",
|
|
34
|
+
hiContrast: "#f8fafc",
|
|
35
|
+
loContrast: "#e2e8f0"
|
|
30
36
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
const RelationColors = {
|
|
38
|
+
// lineColor: colors.neutral[400],
|
|
39
|
+
// labelColor: colors.neutral[300],
|
|
40
|
+
lineColor: "#a3a3a3",
|
|
41
|
+
labelColor: "#d4d4d4"
|
|
36
42
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
43
|
+
exports.RelationColors = RelationColors;
|
|
44
|
+
const Colors = {
|
|
45
|
+
primary: blue,
|
|
46
|
+
blue,
|
|
47
|
+
secondary: sky,
|
|
48
|
+
sky,
|
|
49
|
+
muted: slate,
|
|
50
|
+
slate,
|
|
51
|
+
gray: {
|
|
52
|
+
// fill: colors.neutral[500],
|
|
53
|
+
// stroke: colors.neutral[600],
|
|
54
|
+
// hiContrast: colors.neutral[50],
|
|
55
|
+
// loContrast: colors.neutral[200],
|
|
56
|
+
fill: "#737373",
|
|
57
|
+
stroke: "#525252",
|
|
58
|
+
hiContrast: "#fafafa",
|
|
59
|
+
loContrast: "#e5e5e5"
|
|
60
|
+
},
|
|
61
|
+
red: {
|
|
62
|
+
// fill: colors.red[500],
|
|
63
|
+
// stroke: colors.red[600],
|
|
64
|
+
// hiContrast: colors.red[50],
|
|
65
|
+
// loContrast: colors.red[200],
|
|
66
|
+
fill: "#ef4444",
|
|
67
|
+
stroke: "#dc2626",
|
|
68
|
+
// hiContrast: '#fef2f2',
|
|
69
|
+
// loContrast: '#fecaca',
|
|
70
|
+
hiContrast: "#111827",
|
|
71
|
+
// colors.gray[900],
|
|
72
|
+
loContrast: "#1f2937"
|
|
73
|
+
// colors.gray[800],
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
green: {
|
|
77
|
+
// fill: colors.green[600],
|
|
78
|
+
// stroke: colors.green[700],
|
|
79
|
+
// hiContrast: colors.green[50],
|
|
80
|
+
// loContrast: colors.green[200],
|
|
81
|
+
fill: "#16a34a",
|
|
82
|
+
stroke: "#15803d",
|
|
83
|
+
hiContrast: "#111827",
|
|
84
|
+
// colors.gray[900],
|
|
85
|
+
// hiContrast: '#f0fdf4',
|
|
86
|
+
loContrast: "#1f2937"
|
|
87
|
+
// colors.gray[800],
|
|
88
|
+
// loContrast: '#bbf7d0'
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
amber: {
|
|
92
|
+
// fill: colors.amber[600],
|
|
93
|
+
// stroke: colors.amber[700],
|
|
94
|
+
// hiContrast: colors.amber[50],
|
|
95
|
+
// loContrast: colors.amber[200],
|
|
96
|
+
fill: "#d97706",
|
|
97
|
+
stroke: "#b45309",
|
|
98
|
+
// hiContrast: '#fffbeb',
|
|
99
|
+
// loContrast: '#fde68a',
|
|
100
|
+
hiContrast: "#111827",
|
|
101
|
+
// colors.gray[900],
|
|
102
|
+
loContrast: "#1f2937"
|
|
103
|
+
// colors.gray[800],
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
indigo: {
|
|
107
|
+
// fill: colors.indigo[500],
|
|
108
|
+
// stroke: colors.indigo[600],
|
|
109
|
+
// hiContrast: colors.indigo[50],
|
|
110
|
+
// loContrast: colors.indigo[200],
|
|
111
|
+
fill: "#6366f1",
|
|
112
|
+
stroke: "#4f46e5",
|
|
113
|
+
hiContrast: "#eef2ff",
|
|
114
|
+
loContrast: "#c7d2fe"
|
|
115
|
+
}
|
|
100
116
|
};
|
|
101
|
-
|
|
117
|
+
exports.Colors = Colors;
|
|
118
|
+
const defaultTheme = {
|
|
119
|
+
font: "Helvetica",
|
|
120
|
+
shadow: "#0a0a0a",
|
|
121
|
+
relation: RelationColors,
|
|
122
|
+
colors: Colors
|
|
123
|
+
};
|
|
124
|
+
exports.defaultTheme = defaultTheme;
|
package/dist/colors.mjs
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const blue = {
|
|
2
|
+
// fill: colors.blue[500],
|
|
3
|
+
// stroke: colors.blue[600],
|
|
4
|
+
// hiContrast: colors.blue[50],
|
|
5
|
+
// loContrast: colors.blue[100],
|
|
6
|
+
fill: "#3b82f6",
|
|
7
|
+
stroke: "#2563eb",
|
|
8
|
+
hiContrast: "#eff6ff",
|
|
9
|
+
loContrast: "#dbeafe"
|
|
10
|
+
};
|
|
11
|
+
const sky = {
|
|
12
|
+
// fill: colors.sky[600],
|
|
13
|
+
// stroke: colors.sky[700],
|
|
14
|
+
// hiContrast: colors.sky[50],
|
|
15
|
+
// loContrast: colors.sky[100],
|
|
16
|
+
fill: "#0284c7",
|
|
17
|
+
stroke: "#0369a1",
|
|
18
|
+
hiContrast: "#f0f9ff",
|
|
19
|
+
loContrast: "#e0f2fe"
|
|
20
|
+
};
|
|
21
|
+
const slate = {
|
|
22
|
+
// fill: colors.slate[500],
|
|
23
|
+
// stroke: colors.slate[600],
|
|
24
|
+
// hiContrast: colors.slate[50],
|
|
25
|
+
// loContrast: colors.slate[200],
|
|
26
|
+
fill: "#64748b",
|
|
27
|
+
stroke: "#475569",
|
|
28
|
+
hiContrast: "#f8fafc",
|
|
29
|
+
loContrast: "#e2e8f0"
|
|
30
|
+
};
|
|
31
|
+
export const RelationColors = {
|
|
32
|
+
// lineColor: colors.neutral[400],
|
|
33
|
+
// labelColor: colors.neutral[300],
|
|
34
|
+
lineColor: "#a3a3a3",
|
|
35
|
+
labelColor: "#d4d4d4"
|
|
36
|
+
};
|
|
37
|
+
export const Colors = {
|
|
38
|
+
primary: blue,
|
|
39
|
+
blue,
|
|
40
|
+
secondary: sky,
|
|
41
|
+
sky,
|
|
42
|
+
muted: slate,
|
|
43
|
+
slate,
|
|
44
|
+
gray: {
|
|
45
|
+
// fill: colors.neutral[500],
|
|
46
|
+
// stroke: colors.neutral[600],
|
|
47
|
+
// hiContrast: colors.neutral[50],
|
|
48
|
+
// loContrast: colors.neutral[200],
|
|
49
|
+
fill: "#737373",
|
|
50
|
+
stroke: "#525252",
|
|
51
|
+
hiContrast: "#fafafa",
|
|
52
|
+
loContrast: "#e5e5e5"
|
|
53
|
+
},
|
|
54
|
+
red: {
|
|
55
|
+
// fill: colors.red[500],
|
|
56
|
+
// stroke: colors.red[600],
|
|
57
|
+
// hiContrast: colors.red[50],
|
|
58
|
+
// loContrast: colors.red[200],
|
|
59
|
+
fill: "#ef4444",
|
|
60
|
+
stroke: "#dc2626",
|
|
61
|
+
// hiContrast: '#fef2f2',
|
|
62
|
+
// loContrast: '#fecaca',
|
|
63
|
+
hiContrast: "#111827",
|
|
64
|
+
// colors.gray[900],
|
|
65
|
+
loContrast: "#1f2937"
|
|
66
|
+
// colors.gray[800],
|
|
67
|
+
},
|
|
68
|
+
green: {
|
|
69
|
+
// fill: colors.green[600],
|
|
70
|
+
// stroke: colors.green[700],
|
|
71
|
+
// hiContrast: colors.green[50],
|
|
72
|
+
// loContrast: colors.green[200],
|
|
73
|
+
fill: "#16a34a",
|
|
74
|
+
stroke: "#15803d",
|
|
75
|
+
hiContrast: "#111827",
|
|
76
|
+
// colors.gray[900],
|
|
77
|
+
// hiContrast: '#f0fdf4',
|
|
78
|
+
loContrast: "#1f2937"
|
|
79
|
+
// colors.gray[800],
|
|
80
|
+
// loContrast: '#bbf7d0'
|
|
81
|
+
},
|
|
82
|
+
amber: {
|
|
83
|
+
// fill: colors.amber[600],
|
|
84
|
+
// stroke: colors.amber[700],
|
|
85
|
+
// hiContrast: colors.amber[50],
|
|
86
|
+
// loContrast: colors.amber[200],
|
|
87
|
+
fill: "#d97706",
|
|
88
|
+
stroke: "#b45309",
|
|
89
|
+
// hiContrast: '#fffbeb',
|
|
90
|
+
// loContrast: '#fde68a',
|
|
91
|
+
hiContrast: "#111827",
|
|
92
|
+
// colors.gray[900],
|
|
93
|
+
loContrast: "#1f2937"
|
|
94
|
+
// colors.gray[800],
|
|
95
|
+
},
|
|
96
|
+
indigo: {
|
|
97
|
+
// fill: colors.indigo[500],
|
|
98
|
+
// stroke: colors.indigo[600],
|
|
99
|
+
// hiContrast: colors.indigo[50],
|
|
100
|
+
// loContrast: colors.indigo[200],
|
|
101
|
+
fill: "#6366f1",
|
|
102
|
+
stroke: "#4f46e5",
|
|
103
|
+
hiContrast: "#eef2ff",
|
|
104
|
+
loContrast: "#c7d2fe"
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
export const defaultTheme = {
|
|
108
|
+
font: "Helvetica",
|
|
109
|
+
shadow: "#0a0a0a",
|
|
110
|
+
relation: RelationColors,
|
|
111
|
+
colors: Colors
|
|
112
|
+
};
|
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EdgeBuilder = void 0;
|
|
7
|
+
var _rambdax = require("rambdax");
|
|
8
|
+
var _fqn = require("../utils/fqn");
|
|
9
|
+
var _relations = require("../utils/relations");
|
|
10
|
+
class EdgeBuilder {
|
|
11
|
+
_relationsObj = {};
|
|
12
|
+
add(source, target, relation) {
|
|
13
|
+
const bySource = this._relationsObj[source] ?? {};
|
|
14
|
+
const relations = bySource[target] ?? [];
|
|
15
|
+
relations.push(relation);
|
|
16
|
+
bySource[target] = relations;
|
|
17
|
+
this._relationsObj[source] = bySource;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
build() {
|
|
21
|
+
return (0, _rambdax.keys)(this._relationsObj).flatMap(source => {
|
|
22
|
+
const targets = this._relationsObj[source] ?? {};
|
|
23
|
+
return (0, _rambdax.keys)(targets).map(target => {
|
|
24
|
+
const relations = (targets[target] ?? []).sort(_relations.compareRelations);
|
|
25
|
+
const label = relations.find(r => r.title !== "")?.title ?? null;
|
|
26
|
+
return {
|
|
27
|
+
id: `${source}:${target}`,
|
|
28
|
+
parent: (0, _fqn.commonAncestor)(source, target),
|
|
29
|
+
source,
|
|
30
|
+
target,
|
|
31
|
+
label,
|
|
32
|
+
relations: (0, _rambdax.pluck)("id", relations)
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}).sort(_relations.compareRelations).reverse();
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
|
-
|
|
38
|
+
exports.EdgeBuilder = EdgeBuilder;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { keys, pluck } from "rambdax";
|
|
2
|
+
import { commonAncestor } from "../utils/fqn.mjs";
|
|
3
|
+
import { compareRelations } from "../utils/relations.mjs";
|
|
4
|
+
export class EdgeBuilder {
|
|
5
|
+
_relationsObj = {};
|
|
6
|
+
add(source, target, relation) {
|
|
7
|
+
const bySource = this._relationsObj[source] ?? {};
|
|
8
|
+
const relations = bySource[target] ?? [];
|
|
9
|
+
relations.push(relation);
|
|
10
|
+
bySource[target] = relations;
|
|
11
|
+
this._relationsObj[source] = bySource;
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
build() {
|
|
15
|
+
return keys(this._relationsObj).flatMap((source) => {
|
|
16
|
+
const targets = this._relationsObj[source] ?? {};
|
|
17
|
+
return keys(targets).map((target) => {
|
|
18
|
+
const relations = (targets[target] ?? []).sort(compareRelations);
|
|
19
|
+
const label = relations.find((r) => r.title !== "")?.title ?? null;
|
|
20
|
+
return {
|
|
21
|
+
id: `${source}:${target}`,
|
|
22
|
+
parent: commonAncestor(source, target),
|
|
23
|
+
source,
|
|
24
|
+
target,
|
|
25
|
+
label,
|
|
26
|
+
relations: pluck("id", relations)
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}).sort(compareRelations).reverse();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,26 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ComputeCtx = void 0;
|
|
7
|
+
var _rambdax = require("rambdax");
|
|
8
|
+
class ComputeCtx {
|
|
9
|
+
constructor(index, root, elements = /* @__PURE__ */new Set(), relations = /* @__PURE__ */new Set(), implicits = /* @__PURE__ */new Set()) {
|
|
10
|
+
this.index = index;
|
|
11
|
+
this.root = root;
|
|
12
|
+
this.elements = elements;
|
|
13
|
+
this.relations = relations;
|
|
14
|
+
this.implicits = implicits;
|
|
15
|
+
}
|
|
16
|
+
include({
|
|
17
|
+
elements,
|
|
18
|
+
relations,
|
|
19
|
+
implicits
|
|
20
|
+
}) {
|
|
21
|
+
return new ComputeCtx(this.index, this.root, elements ? /* @__PURE__ */new Set([...this.elements, ...elements]) : this.elements, relations ? /* @__PURE__ */new Set([...this.relations, ...relations]) : this.relations, implicits ? /* @__PURE__ */new Set([...this.implicits, ...implicits]) : this.implicits);
|
|
22
|
+
}
|
|
23
|
+
exclude({
|
|
24
|
+
elements,
|
|
25
|
+
relations,
|
|
26
|
+
implicits
|
|
27
|
+
}) {
|
|
28
|
+
let newImplicits = implicits ? new Set((0, _rambdax.difference)([...this.implicits], implicits)) : this.implicits;
|
|
29
|
+
if (elements) {
|
|
30
|
+
newImplicits = new Set((0, _rambdax.difference)([...newImplicits], elements));
|
|
24
31
|
}
|
|
32
|
+
return new ComputeCtx(this.index, this.root, elements ? new Set((0, _rambdax.difference)([...this.elements], elements)) : this.elements, relations ? new Set((0, _rambdax.difference)([...this.relations], relations)) : this.relations, newImplicits);
|
|
33
|
+
}
|
|
25
34
|
}
|
|
26
|
-
|
|
35
|
+
exports.ComputeCtx = ComputeCtx;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { difference } from "rambdax";
|
|
2
|
+
export class ComputeCtx {
|
|
3
|
+
constructor(index, root, elements = /* @__PURE__ */ new Set(), relations = /* @__PURE__ */ new Set(), implicits = /* @__PURE__ */ new Set()) {
|
|
4
|
+
this.index = index;
|
|
5
|
+
this.root = root;
|
|
6
|
+
this.elements = elements;
|
|
7
|
+
this.relations = relations;
|
|
8
|
+
this.implicits = implicits;
|
|
9
|
+
}
|
|
10
|
+
include({
|
|
11
|
+
elements,
|
|
12
|
+
relations,
|
|
13
|
+
implicits
|
|
14
|
+
}) {
|
|
15
|
+
return new ComputeCtx(
|
|
16
|
+
this.index,
|
|
17
|
+
this.root,
|
|
18
|
+
elements ? /* @__PURE__ */ new Set([...this.elements, ...elements]) : this.elements,
|
|
19
|
+
relations ? /* @__PURE__ */ new Set([...this.relations, ...relations]) : this.relations,
|
|
20
|
+
implicits ? /* @__PURE__ */ new Set([...this.implicits, ...implicits]) : this.implicits
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
exclude({
|
|
24
|
+
elements,
|
|
25
|
+
relations,
|
|
26
|
+
implicits
|
|
27
|
+
}) {
|
|
28
|
+
let newImplicits = implicits ? new Set(difference([...this.implicits], implicits)) : this.implicits;
|
|
29
|
+
if (elements) {
|
|
30
|
+
newImplicits = new Set(
|
|
31
|
+
difference([...newImplicits], elements)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return new ComputeCtx(
|
|
35
|
+
this.index,
|
|
36
|
+
this.root,
|
|
37
|
+
elements ? new Set(difference([...this.elements], elements)) : this.elements,
|
|
38
|
+
relations ? new Set(difference([...this.relations], relations)) : this.relations,
|
|
39
|
+
newImplicits
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { ModelIndex } from '../model-index';
|
|
2
|
-
import { type
|
|
3
|
-
export declare function computeElementView
|
|
4
|
-
//# sourceMappingURL=compute-element-view.d.ts.map
|
|
2
|
+
import { type ElementView, type ComputedView } from '../types';
|
|
3
|
+
export declare function computeElementView(view: ElementView, index: ModelIndex): ComputedView;
|