@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.
Files changed (147) hide show
  1. package/README.md +2 -6
  2. package/dist/cjs/colors/element.d.ts +68 -0
  3. package/dist/{colors.js → cjs/colors/element.js} +24 -46
  4. package/dist/cjs/colors/index.d.ts +132 -0
  5. package/dist/cjs/colors/index.js +27 -0
  6. package/dist/cjs/colors/relationships.d.ts +57 -0
  7. package/dist/cjs/colors/relationships.js +76 -0
  8. package/dist/cjs/errors/index.d.ts +45 -0
  9. package/dist/cjs/errors/index.js +137 -0
  10. package/dist/{index.d.ts → cjs/index.d.ts} +3 -5
  11. package/dist/{index.cjs → cjs/index.js} +16 -38
  12. package/dist/{types → cjs/types}/computed-view.d.ts +11 -7
  13. package/dist/{types → cjs/types}/diagram.d.ts +15 -11
  14. package/dist/{types → cjs/types}/expression.d.ts +1 -1
  15. package/dist/{types/index.cjs → cjs/types/index.js} +10 -10
  16. package/dist/cjs/types/relation.d.ts +22 -0
  17. package/dist/cjs/types/relation.js +12 -0
  18. package/dist/{types → cjs/types}/theme.d.ts +10 -6
  19. package/dist/{types → cjs/types}/view.d.ts +22 -4
  20. package/dist/{types/view.cjs → cjs/types/view.js} +1 -1
  21. package/dist/{utils → cjs/utils}/fqn.d.ts +6 -1
  22. package/dist/{utils/fqn.cjs → cjs/utils/fqn.js} +18 -5
  23. package/dist/{utils → cjs/utils}/guards.d.ts +1 -2
  24. package/dist/cjs/utils/guards.js +20 -0
  25. package/dist/{utils → cjs/utils}/index.d.ts +0 -1
  26. package/dist/{utils/index.cjs → cjs/utils/index.js} +3 -14
  27. package/dist/{utils/relations.cjs → cjs/utils/relations.js} +1 -1
  28. package/dist/esm/colors/element.d.ts +68 -0
  29. package/dist/esm/colors/element.js +82 -0
  30. package/dist/esm/colors/index.d.ts +132 -0
  31. package/dist/esm/colors/index.js +9 -0
  32. package/dist/esm/colors/relationships.d.ts +57 -0
  33. package/dist/esm/colors/relationships.js +64 -0
  34. package/dist/esm/errors/index.d.ts +45 -0
  35. package/dist/esm/errors/index.js +97 -0
  36. package/dist/esm/index.d.ts +6 -0
  37. package/dist/esm/index.js +4 -0
  38. package/dist/esm/types/_common.d.ts +3 -0
  39. package/dist/esm/types/computed-view.d.ts +44 -0
  40. package/dist/esm/types/diagram.d.ts +41 -0
  41. package/dist/esm/types/element.d.ts +29 -0
  42. package/dist/esm/types/expression.d.ts +56 -0
  43. package/dist/esm/types/index.d.ts +11 -0
  44. package/dist/esm/types/model.d.ts +14 -0
  45. package/dist/esm/types/opaque.d.ts +102 -0
  46. package/dist/esm/types/relation.d.ts +22 -0
  47. package/dist/esm/types/relation.js +3 -0
  48. package/dist/esm/types/theme.d.ts +26 -0
  49. package/dist/esm/types/view.d.ts +61 -0
  50. package/dist/{types → esm/types}/view.js +1 -1
  51. package/dist/esm/utils/fqn.d.ts +33 -0
  52. package/dist/{utils → esm/utils}/fqn.js +16 -4
  53. package/dist/esm/utils/guards.d.ts +4 -0
  54. package/dist/esm/utils/guards.js +7 -0
  55. package/dist/esm/utils/index.d.ts +3 -0
  56. package/dist/{utils → esm/utils}/index.js +0 -1
  57. package/dist/esm/utils/relations.d.ts +25 -0
  58. package/package.json +44 -61
  59. package/dist/colors.cjs +0 -124
  60. package/dist/colors.d.ts +0 -148
  61. package/dist/compute-view/EdgeBuilder.cjs +0 -37
  62. package/dist/compute-view/EdgeBuilder.d.ts +0 -6
  63. package/dist/compute-view/EdgeBuilder.js +0 -30
  64. package/dist/compute-view/compute-ctx.cjs +0 -89
  65. package/dist/compute-view/compute-ctx.d.ts +0 -19
  66. package/dist/compute-view/compute-ctx.js +0 -98
  67. package/dist/compute-view/compute-element-view.cjs +0 -91
  68. package/dist/compute-view/compute-element-view.d.ts +0 -3
  69. package/dist/compute-view/compute-element-view.js +0 -86
  70. package/dist/compute-view/compute-predicates.cjs +0 -363
  71. package/dist/compute-view/compute-predicates.d.ts +0 -16
  72. package/dist/compute-view/compute-predicates.js +0 -324
  73. package/dist/compute-view/compute.cjs +0 -46
  74. package/dist/compute-view/compute.d.ts +0 -14
  75. package/dist/compute-view/compute.js +0 -36
  76. package/dist/compute-view/index.cjs +0 -38
  77. package/dist/compute-view/index.d.ts +0 -3
  78. package/dist/compute-view/index.js +0 -3
  79. package/dist/compute-view/resolve-extended-views.cjs +0 -50
  80. package/dist/compute-view/resolve-extended-views.d.ts +0 -6
  81. package/dist/compute-view/resolve-extended-views.js +0 -38
  82. package/dist/compute-view/utils/anyPossibleRelations.cjs +0 -18
  83. package/dist/compute-view/utils/anyPossibleRelations.d.ts +0 -2
  84. package/dist/compute-view/utils/anyPossibleRelations.js +0 -12
  85. package/dist/compute-view/utils/applyViewRuleStyles.cjs +0 -57
  86. package/dist/compute-view/utils/applyViewRuleStyles.d.ts +0 -2
  87. package/dist/compute-view/utils/applyViewRuleStyles.js +0 -50
  88. package/dist/compute-view/utils/sortNodes.cjs +0 -50
  89. package/dist/compute-view/utils/sortNodes.d.ts +0 -2
  90. package/dist/compute-view/utils/sortNodes.js +0 -40
  91. package/dist/errors/_base.cjs +0 -62
  92. package/dist/errors/_base.d.ts +0 -26
  93. package/dist/errors/_base.js +0 -41
  94. package/dist/errors/index.cjs +0 -60
  95. package/dist/errors/index.d.ts +0 -5
  96. package/dist/errors/index.js +0 -5
  97. package/dist/errors/invariant.cjs +0 -23
  98. package/dist/errors/invariant.d.ts +0 -6
  99. package/dist/errors/invariant.js +0 -13
  100. package/dist/errors/model-index.cjs +0 -23
  101. package/dist/errors/model-index.d.ts +0 -6
  102. package/dist/errors/model-index.js +0 -13
  103. package/dist/errors/non-nullable.cjs +0 -23
  104. package/dist/errors/non-nullable.d.ts +0 -6
  105. package/dist/errors/non-nullable.js +0 -13
  106. package/dist/errors/nonexhaustive.cjs +0 -23
  107. package/dist/errors/nonexhaustive.d.ts +0 -6
  108. package/dist/errors/nonexhaustive.js +0 -12
  109. package/dist/index.js +0 -6
  110. package/dist/model-index/ModelIndex.cjs +0 -140
  111. package/dist/model-index/ModelIndex.d.ts +0 -27
  112. package/dist/model-index/ModelIndex.js +0 -128
  113. package/dist/model-index/index.cjs +0 -13
  114. package/dist/model-index/index.d.ts +0 -1
  115. package/dist/model-index/index.js +0 -1
  116. package/dist/types/relation.d.ts +0 -10
  117. package/dist/types/relation.js +0 -0
  118. package/dist/types/theme.cjs +0 -1
  119. package/dist/utils/compute-node-levels.cjs +0 -48
  120. package/dist/utils/compute-node-levels.d.ts +0 -7
  121. package/dist/utils/compute-node-levels.js +0 -31
  122. package/dist/utils/guards.cjs +0 -22
  123. package/dist/utils/guards.js +0 -13
  124. /package/dist/{types → cjs/types}/_common.d.ts +0 -0
  125. /package/dist/{types/_common.cjs → cjs/types/_common.js} +0 -0
  126. /package/dist/{types/computed-view.cjs → cjs/types/computed-view.js} +0 -0
  127. /package/dist/{types/diagram.cjs → cjs/types/diagram.js} +0 -0
  128. /package/dist/{types → cjs/types}/element.d.ts +0 -0
  129. /package/dist/{types/element.cjs → cjs/types/element.js} +0 -0
  130. /package/dist/{types/expression.cjs → cjs/types/expression.js} +0 -0
  131. /package/dist/{types → cjs/types}/index.d.ts +0 -0
  132. /package/dist/{types → cjs/types}/model.d.ts +0 -0
  133. /package/dist/{types/model.cjs → cjs/types/model.js} +0 -0
  134. /package/dist/{types → cjs/types}/opaque.d.ts +0 -0
  135. /package/dist/{types/opaque.cjs → cjs/types/opaque.js} +0 -0
  136. /package/dist/{types/relation.cjs → cjs/types/theme.js} +0 -0
  137. /package/dist/{utils → cjs/utils}/relations.d.ts +0 -0
  138. /package/dist/{types → esm/types}/_common.js +0 -0
  139. /package/dist/{types → esm/types}/computed-view.js +0 -0
  140. /package/dist/{types → esm/types}/diagram.js +0 -0
  141. /package/dist/{types → esm/types}/element.js +0 -0
  142. /package/dist/{types → esm/types}/expression.js +0 -0
  143. /package/dist/{types → esm/types}/index.js +0 -0
  144. /package/dist/{types → esm/types}/model.js +0 -0
  145. /package/dist/{types → esm/types}/opaque.js +0 -0
  146. /package/dist/{types → esm/types}/theme.js +0 -0
  147. /package/dist/{utils → esm/utils}/relations.js +0 -0
package/README.md CHANGED
@@ -1,10 +1,6 @@
1
- # LikeC4 Core
1
+ # `@likec4/core`
2
2
 
3
- [docs](https://likec4.dev/docs/) | [example](https://likec4.dev/examples/bigbank/likec4/)
4
-
5
- ```bash
6
- npm install @likec4/core
7
- ```
3
+ [docs](https://likec4.dev/docs/)
8
4
 
9
5
  Package contains:
10
6
 
@@ -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
+ };
@@ -1,40 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ElementColors = void 0;
1
7
  const blue = {
2
- // fill: colors.blue[500],
3
- // stroke: colors.blue[600],
4
- // hiContrast: colors.blue[50],
5
- // loContrast: colors.blue[100],
6
8
  fill: "#3b82f6",
7
9
  stroke: "#2563eb",
8
10
  hiContrast: "#eff6ff",
9
- loContrast: "#dbeafe"
11
+ loContrast: "#bfdbfe"
10
12
  };
11
13
  const sky = {
12
- // fill: colors.sky[600],
13
- // stroke: colors.sky[700],
14
- // hiContrast: colors.sky[50],
15
- // loContrast: colors.sky[100],
16
14
  fill: "#0284c7",
17
15
  stroke: "#0369a1",
18
16
  hiContrast: "#f0f9ff",
19
17
  loContrast: "#e0f2fe"
20
18
  };
21
19
  const slate = {
22
- // fill: colors.slate[500],
23
- // stroke: colors.slate[600],
24
- // hiContrast: colors.slate[50],
25
- // loContrast: colors.slate[200],
26
20
  fill: "#64748b",
27
21
  stroke: "#475569",
28
22
  hiContrast: "#f8fafc",
29
23
  loContrast: "#e2e8f0"
30
24
  };
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 = {
25
+ const ElementColors = {
38
26
  primary: blue,
39
27
  blue,
40
28
  secondary: sky,
@@ -56,28 +44,22 @@ export const Colors = {
56
44
  // stroke: colors.red[600],
57
45
  // hiContrast: colors.red[50],
58
46
  // loContrast: colors.red[200],
59
- fill: "#ef4444",
60
- stroke: "#dc2626",
47
+ fill: "#b54548",
48
+ stroke: "#8c333a",
61
49
  // hiContrast: '#fef2f2',
62
50
  // loContrast: '#fecaca',
63
- hiContrast: "#111827",
64
- // colors.gray[900],
65
- loContrast: "#1f2937"
66
- // colors.gray[800],
51
+ // hiContrast: '#191111', // colors.gray[900],
52
+ // loContrast: '#3b1219' // colors.gray[800],
53
+ hiContrast: "#f8fafc",
54
+ // hiContrast: '#f8fafc',
55
+ // loContrast: '#fdd8d8' // radix black red 12
56
+ loContrast: "#F9C6C6"
67
57
  },
68
58
  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'
59
+ fill: "#428a4f",
60
+ stroke: "#2d5d39",
61
+ hiContrast: "#f8fafc",
62
+ loContrast: "#c2f0c2"
81
63
  },
82
64
  amber: {
83
65
  // fill: colors.amber[600],
@@ -88,11 +70,12 @@ export const Colors = {
88
70
  stroke: "#b45309",
89
71
  // hiContrast: '#fffbeb',
90
72
  // loContrast: '#fde68a',
91
- hiContrast: "#111827",
73
+ hiContrast: "#f8fafc",
92
74
  // colors.gray[900],
93
- loContrast: "#1f2937"
75
+ loContrast: "#ffe0c2"
94
76
  // colors.gray[800],
95
77
  },
78
+
96
79
  indigo: {
97
80
  // fill: colors.indigo[500],
98
81
  // stroke: colors.indigo[600],
@@ -104,9 +87,4 @@ export const Colors = {
104
87
  loContrast: "#c7d2fe"
105
88
  }
106
89
  };
107
- export const defaultTheme = {
108
- font: "Helvetica",
109
- shadow: "#0a0a0a",
110
- relation: RelationColors,
111
- colors: Colors
112
- };
90
+ exports.ElementColors = ElementColors;
@@ -0,0 +1,132 @@
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: "#e0f2fe";
22
+ };
23
+ readonly sky: {
24
+ fill: "#0284c7";
25
+ stroke: "#0369a1";
26
+ hiContrast: "#f0f9ff";
27
+ loContrast: "#e0f2fe";
28
+ };
29
+ readonly muted: {
30
+ fill: "#64748b";
31
+ stroke: "#475569";
32
+ hiContrast: "#f8fafc";
33
+ loContrast: "#e2e8f0";
34
+ };
35
+ readonly slate: {
36
+ fill: "#64748b";
37
+ stroke: "#475569";
38
+ hiContrast: "#f8fafc";
39
+ loContrast: "#e2e8f0";
40
+ };
41
+ readonly gray: {
42
+ readonly fill: "#737373";
43
+ readonly stroke: "#525252";
44
+ readonly hiContrast: "#fafafa";
45
+ readonly loContrast: "#e5e5e5";
46
+ };
47
+ readonly red: {
48
+ readonly fill: "#b54548";
49
+ readonly stroke: "#8c333a";
50
+ readonly hiContrast: "#f8fafc";
51
+ readonly loContrast: "#F9C6C6";
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: "#d97706";
61
+ readonly stroke: "#b45309";
62
+ readonly hiContrast: "#f8fafc";
63
+ readonly loContrast: "#ffe0c2";
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: "#f59e0b";
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: "#b91c1c";
110
+ labelBgColor: "#b91c1c";
111
+ labelColor: "#dc2626";
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 };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ElementColors", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _element.ElementColors;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "RelationshipColors", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _relationships.RelationshipColors;
16
+ }
17
+ });
18
+ exports.defaultTheme = void 0;
19
+ var _element = require("./element");
20
+ var _relationships = require("./relationships");
21
+ const defaultTheme = {
22
+ elements: _element.ElementColors,
23
+ relationships: _relationships.RelationshipColors,
24
+ font: "Helvetica",
25
+ shadow: "#0a0a0a"
26
+ };
27
+ exports.defaultTheme = defaultTheme;
@@ -0,0 +1,57 @@
1
+ export declare const RelationshipColors: {
2
+ amber: {
3
+ lineColor: "#b45309";
4
+ labelBgColor: "#78350f";
5
+ labelColor: "#f59e0b";
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: "#b91c1c";
39
+ labelBgColor: "#b91c1c";
40
+ labelColor: "#dc2626";
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
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RelationshipColors = void 0;
7
+ const gray = {
8
+ lineColor: "#6E6E6E",
9
+ labelBgColor: "#18191b",
10
+ labelColor: "#C6C6C6"
11
+ };
12
+ const slate = {
13
+ lineColor: "#64748b",
14
+ // 500
15
+ labelBgColor: "#0f172a",
16
+ // 900
17
+ labelColor: "#cbd5e1"
18
+ // 300
19
+ };
20
+
21
+ const blue = {
22
+ lineColor: "#3b82f6",
23
+ // 500
24
+ labelBgColor: "#172554",
25
+ // 950
26
+ labelColor: "#60a5fa"
27
+ // 400
28
+ };
29
+
30
+ const sky = {
31
+ lineColor: "#0ea5e9",
32
+ // 500
33
+ labelBgColor: "#082f49",
34
+ // 950
35
+ labelColor: "#38bdf8"
36
+ // 400
37
+ };
38
+
39
+ const RelationshipColors = {
40
+ amber: {
41
+ lineColor: "#b45309",
42
+ labelBgColor: "#78350f",
43
+ labelColor: "#f59e0b"
44
+ },
45
+ blue,
46
+ gray,
47
+ green: {
48
+ lineColor: "#15803d",
49
+ // 700
50
+ labelBgColor: "#052e16",
51
+ //950
52
+ labelColor: "#22c55e"
53
+ // 500
54
+ },
55
+
56
+ indigo: {
57
+ lineColor: "#6366f1",
58
+ // 500
59
+ labelBgColor: "#1e1b4b",
60
+ // 950
61
+ labelColor: "#818cf8"
62
+ // 400
63
+ },
64
+
65
+ muted: slate,
66
+ primary: blue,
67
+ red: {
68
+ lineColor: "#b91c1c",
69
+ labelBgColor: "#b91c1c",
70
+ labelColor: "#dc2626"
71
+ },
72
+ secondary: sky,
73
+ sky,
74
+ slate
75
+ };
76
+ exports.RelationshipColors = RelationshipColors;
@@ -0,0 +1,45 @@
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): BaseError;
31
+ export declare function serializeError(e: unknown): {
32
+ name: string;
33
+ message: string;
34
+ error: BaseError;
35
+ };
36
+ export declare function throwNormalizedError(e: unknown): never;
37
+ export declare function invariant(condition: any, message?: string): asserts condition;
38
+ export declare class NonExhaustiveError extends BaseError {
39
+ constructor(message: string, options?: BaseErrorOptions);
40
+ }
41
+ export declare function nonexhaustive(value: never): never;
42
+ export declare class InvalidModelError extends BaseError {
43
+ constructor(message: string, options?: BaseErrorOptions);
44
+ }
45
+ export declare function ensureModel(condition: any, message?: string): asserts condition;
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UnknownError = exports.RelationRefError = exports.NullableError = exports.NonExhaustiveError = exports.InvariantError = exports.InvalidModelError = exports.InvalidArgError = exports.BaseError = void 0;
7
+ exports.ensureModel = ensureModel;
8
+ exports.invariant = invariant;
9
+ exports.nonNullable = nonNullable;
10
+ exports.nonexhaustive = nonexhaustive;
11
+ exports.normalizeError = normalizeError;
12
+ exports.serializeError = serializeError;
13
+ exports.throwNormalizedError = throwNormalizedError;
14
+ var _safeStableStringify = _interopRequireDefault(require("safe-stable-stringify"));
15
+ var _tsCustomError = require("ts-custom-error");
16
+ var _guards = require("../utils/guards");
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ class BaseError extends _tsCustomError.CustomError {
19
+ constructor(message, options) {
20
+ super(message, options);
21
+ Object.defineProperty(this, "name", {
22
+ value: "BaseError"
23
+ });
24
+ }
25
+ }
26
+ exports.BaseError = BaseError;
27
+ class InvalidArgError extends BaseError {
28
+ constructor(message, options) {
29
+ super(message, options);
30
+ Object.defineProperty(this, "name", {
31
+ value: "InvalidArgError"
32
+ });
33
+ }
34
+ }
35
+ exports.InvalidArgError = InvalidArgError;
36
+ class UnknownError extends BaseError {
37
+ constructor(message, options) {
38
+ super(message, options);
39
+ Object.defineProperty(this, "name", {
40
+ value: "UnknownError"
41
+ });
42
+ }
43
+ }
44
+ exports.UnknownError = UnknownError;
45
+ class NullableError extends BaseError {
46
+ constructor(message, options) {
47
+ super(message, options);
48
+ Object.defineProperty(this, "name", {
49
+ value: "NullableError"
50
+ });
51
+ }
52
+ }
53
+ exports.NullableError = NullableError;
54
+ class InvariantError extends BaseError {
55
+ constructor(message, options) {
56
+ super(message, options);
57
+ Object.defineProperty(this, "name", {
58
+ value: "InvariantError"
59
+ });
60
+ }
61
+ }
62
+ exports.InvariantError = InvariantError;
63
+ function nonNullable(value, message) {
64
+ if (typeof value === "undefined" || value == null) {
65
+ throw new NullableError(message ?? `Expected defined value, but received ${value}`);
66
+ }
67
+ return value;
68
+ }
69
+ class RelationRefError extends BaseError {
70
+ constructor(message, options) {
71
+ super(message, options);
72
+ Object.defineProperty(this, "name", {
73
+ value: "RelationRefError"
74
+ });
75
+ }
76
+ }
77
+ exports.RelationRefError = RelationRefError;
78
+ function normalizeError(e) {
79
+ if (e instanceof BaseError) {
80
+ return e;
81
+ }
82
+ if (e instanceof Error) {
83
+ return new UnknownError(e.message, {
84
+ cause: e
85
+ });
86
+ }
87
+ if (e === null || e === void 0) {
88
+ return new UnknownError("Undefined error");
89
+ }
90
+ const message = (0, _guards.isString)(e) ? e : (0, _safeStableStringify.default)(e);
91
+ return new UnknownError(message);
92
+ }
93
+ function serializeError(e) {
94
+ const error = normalizeError(e);
95
+ return {
96
+ name: error.name,
97
+ message: error.stack ? error.stack : `${error.name}: ${error.message}`,
98
+ error
99
+ };
100
+ }
101
+ function throwNormalizedError(e) {
102
+ throw normalizeError(e);
103
+ }
104
+ function invariant(condition, message) {
105
+ if (condition) {
106
+ return;
107
+ }
108
+ throw new InvariantError(message ?? "Invariant failed");
109
+ }
110
+ class NonExhaustiveError extends BaseError {
111
+ constructor(message, options) {
112
+ super(message, options);
113
+ Object.defineProperty(this, "name", {
114
+ value: "NonExhaustiveError"
115
+ });
116
+ }
117
+ }
118
+ exports.NonExhaustiveError = NonExhaustiveError;
119
+ function nonexhaustive(value) {
120
+ const val = typeof value === "string" ? value : (0, _safeStableStringify.default)(value);
121
+ throw new NonExhaustiveError(`NonExhaustive value: ${val}`);
122
+ }
123
+ class InvalidModelError extends BaseError {
124
+ constructor(message, options) {
125
+ super(message, options);
126
+ Object.defineProperty(this, "name", {
127
+ value: "InvalidModelError"
128
+ });
129
+ }
130
+ }
131
+ exports.InvalidModelError = InvalidModelError;
132
+ function ensureModel(condition, message) {
133
+ if (condition) {
134
+ return;
135
+ }
136
+ throw new InvalidModelError(message ?? "ModelIndex Invariant failed");
137
+ }
@@ -1,8 +1,6 @@
1
- export * from './types';
2
- export * from './utils';
3
- export * from './model-index';
4
- export * from './compute-view';
5
1
  export * from './colors';
6
2
  export * from './errors';
7
- export type * as c4 from './types';
3
+ export * from './types';
4
+ export * from './utils';
8
5
  export type * as likec4 from './types';
6
+ export type * as c4 from './types';