@likec4/core 1.0.0-next.2 → 1.0.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 (113) hide show
  1. package/dist/{cjs/errors → errors}/index.d.ts +1 -2
  2. package/dist/errors/index.js +0 -11
  3. package/dist/types/{types/expression.d.ts → expression.d.ts} +7 -2
  4. package/dist/types/expression.js +8 -1
  5. package/dist/types/index.d.ts +11 -7
  6. package/dist/{cjs/utils → utils}/index.d.ts +1 -0
  7. package/dist/utils/index.js +1 -0
  8. package/dist/utils/promises.d.ts +1 -0
  9. package/dist/utils/promises.js +8 -0
  10. package/package.json +24 -39
  11. package/dist/cjs/colors/element.js +0 -82
  12. package/dist/cjs/colors/index.js +0 -27
  13. package/dist/cjs/colors/relationships.js +0 -76
  14. package/dist/cjs/errors/index.js +0 -118
  15. package/dist/cjs/index.js +0 -49
  16. package/dist/cjs/log.d.ts +0 -3
  17. package/dist/cjs/log.js +0 -10
  18. package/dist/cjs/reset.d.ts +0 -2
  19. package/dist/cjs/types/_common.js +0 -1
  20. package/dist/cjs/types/computed-view.js +0 -1
  21. package/dist/cjs/types/diagram.js +0 -1
  22. package/dist/cjs/types/element.js +0 -16
  23. package/dist/cjs/types/expression.d.ts +0 -71
  24. package/dist/cjs/types/expression.js +0 -49
  25. package/dist/cjs/types/index.d.ts +0 -11
  26. package/dist/cjs/types/index.js +0 -132
  27. package/dist/cjs/types/model.js +0 -1
  28. package/dist/cjs/types/opaque.js +0 -1
  29. package/dist/cjs/types/relation.js +0 -12
  30. package/dist/cjs/types/theme.js +0 -1
  31. package/dist/cjs/types/view.js +0 -25
  32. package/dist/cjs/utils/fqn.js +0 -101
  33. package/dist/cjs/utils/guards.js +0 -20
  34. package/dist/cjs/utils/index.js +0 -38
  35. package/dist/cjs/utils/relations.js +0 -77
  36. package/dist/esm/colors/element.d.ts +0 -68
  37. package/dist/esm/colors/element.js +0 -75
  38. package/dist/esm/colors/index.d.ts +0 -132
  39. package/dist/esm/colors/index.js +0 -9
  40. package/dist/esm/colors/relationships.d.ts +0 -57
  41. package/dist/esm/colors/relationships.js +0 -64
  42. package/dist/esm/errors/index.d.ts +0 -39
  43. package/dist/esm/errors/index.js +0 -82
  44. package/dist/esm/index.d.ts +0 -6
  45. package/dist/esm/index.js +0 -4
  46. package/dist/esm/log.d.ts +0 -3
  47. package/dist/esm/log.js +0 -5
  48. package/dist/esm/reset.d.ts +0 -2
  49. package/dist/esm/types/_common.d.ts +0 -3
  50. package/dist/esm/types/_common.js +0 -0
  51. package/dist/esm/types/computed-view.d.ts +0 -45
  52. package/dist/esm/types/computed-view.js +0 -0
  53. package/dist/esm/types/diagram.d.ts +0 -40
  54. package/dist/esm/types/diagram.js +0 -0
  55. package/dist/esm/types/element.d.ts +0 -30
  56. package/dist/esm/types/element.js +0 -14
  57. package/dist/esm/types/expression.d.ts +0 -71
  58. package/dist/esm/types/expression.js +0 -33
  59. package/dist/esm/types/index.d.ts +0 -11
  60. package/dist/esm/types/index.js +0 -11
  61. package/dist/esm/types/model.d.ts +0 -14
  62. package/dist/esm/types/model.js +0 -0
  63. package/dist/esm/types/opaque.d.ts +0 -102
  64. package/dist/esm/types/opaque.js +0 -0
  65. package/dist/esm/types/relation.d.ts +0 -24
  66. package/dist/esm/types/relation.js +0 -3
  67. package/dist/esm/types/theme.d.ts +0 -26
  68. package/dist/esm/types/theme.js +0 -0
  69. package/dist/esm/types/view.d.ts +0 -62
  70. package/dist/esm/types/view.js +0 -15
  71. package/dist/esm/utils/fqn.d.ts +0 -33
  72. package/dist/esm/utils/fqn.js +0 -83
  73. package/dist/esm/utils/guards.d.ts +0 -4
  74. package/dist/esm/utils/guards.js +0 -7
  75. package/dist/esm/utils/index.d.ts +0 -3
  76. package/dist/esm/utils/index.js +0 -3
  77. package/dist/esm/utils/relations.d.ts +0 -29
  78. package/dist/esm/utils/relations.js +0 -69
  79. package/dist/types/colors/element.d.ts +0 -69
  80. package/dist/types/colors/index.d.ts +0 -133
  81. package/dist/types/colors/relationships.d.ts +0 -58
  82. package/dist/types/errors/index.d.ts +0 -40
  83. package/dist/types/log.d.ts +0 -4
  84. package/dist/types/types/_common.d.ts +0 -4
  85. package/dist/types/types/computed-view.d.ts +0 -46
  86. package/dist/types/types/diagram.d.ts +0 -41
  87. package/dist/types/types/element.d.ts +0 -31
  88. package/dist/types/types/index.d.ts +0 -12
  89. package/dist/types/types/model.d.ts +0 -15
  90. package/dist/types/types/opaque.d.ts +0 -103
  91. package/dist/types/types/relation.d.ts +0 -25
  92. package/dist/types/types/theme.d.ts +0 -27
  93. package/dist/types/types/view.d.ts +0 -63
  94. package/dist/types/utils/fqn.d.ts +0 -34
  95. package/dist/types/utils/guards.d.ts +0 -5
  96. package/dist/types/utils/index.d.ts +0 -4
  97. package/dist/types/utils/relations.d.ts +0 -30
  98. /package/dist/{cjs/colors → colors}/element.d.ts +0 -0
  99. /package/dist/{cjs/colors → colors}/index.d.ts +0 -0
  100. /package/dist/{cjs/colors → colors}/relationships.d.ts +0 -0
  101. /package/dist/{cjs/index.d.ts → index.d.ts} +0 -0
  102. /package/dist/{cjs/types → types}/_common.d.ts +0 -0
  103. /package/dist/{cjs/types → types}/computed-view.d.ts +0 -0
  104. /package/dist/{cjs/types → types}/diagram.d.ts +0 -0
  105. /package/dist/{cjs/types → types}/element.d.ts +0 -0
  106. /package/dist/{cjs/types → types}/model.d.ts +0 -0
  107. /package/dist/{cjs/types → types}/opaque.d.ts +0 -0
  108. /package/dist/{cjs/types → types}/relation.d.ts +0 -0
  109. /package/dist/{cjs/types → types}/theme.d.ts +0 -0
  110. /package/dist/{cjs/types → types}/view.d.ts +0 -0
  111. /package/dist/{cjs/utils → utils}/fqn.d.ts +0 -0
  112. /package/dist/{cjs/utils → utils}/guards.d.ts +0 -0
  113. /package/dist/{cjs/utils → utils}/relations.d.ts +0 -0
@@ -1,75 +0,0 @@
1
- const blue = {
2
- fill: "#3b82f6",
3
- stroke: "#2563eb",
4
- hiContrast: "#eff6ff",
5
- loContrast: "#bfdbfe"
6
- };
7
- const sky = {
8
- fill: "#0284c7",
9
- stroke: "#0369a1",
10
- hiContrast: "#f0f9ff",
11
- loContrast: "#B6ECF7"
12
- };
13
- const slate = {
14
- fill: "#64748b",
15
- stroke: "#475569",
16
- hiContrast: "#f8fafc",
17
- loContrast: "#cbd5e1"
18
- };
19
- export const ElementColors = {
20
- primary: blue,
21
- blue,
22
- secondary: sky,
23
- sky,
24
- muted: slate,
25
- slate,
26
- gray: {
27
- // fill: colors.neutral[500],
28
- // stroke: colors.neutral[600],
29
- // hiContrast: colors.neutral[50],
30
- // loContrast: colors.neutral[200],
31
- fill: "#737373",
32
- stroke: "#525252",
33
- hiContrast: "#fafafa",
34
- loContrast: "#d4d4d4"
35
- },
36
- red: {
37
- // fill: colors.red[500],
38
- // stroke: colors.red[600],
39
- // hiContrast: colors.red[50],
40
- // loContrast: colors.red[200],
41
- fill: "#AC4D39",
42
- // fill: '#b54548',
43
- stroke: "#853A2D",
44
- // hiContrast: '#fef2f2',
45
- // loContrast: '#fecaca',
46
- // hiContrast: '#191111', // colors.gray[900],
47
- // loContrast: '#3b1219' // colors.gray[800],
48
- hiContrast: "#FBD3CB",
49
- // hiContrast: '#f8fafc',
50
- // loContrast: '#fdd8d8' // radix black red 12
51
- loContrast: "#FF977D"
52
- },
53
- green: {
54
- fill: "#428a4f",
55
- stroke: "#2d5d39",
56
- hiContrast: "#f8fafc",
57
- loContrast: "#c2f0c2"
58
- },
59
- amber: {
60
- fill: "#A35829",
61
- stroke: "#7E451D",
62
- hiContrast: "#FFE0C2",
63
- loContrast: "#FFA057"
64
- },
65
- indigo: {
66
- // fill: colors.indigo[500],
67
- // stroke: colors.indigo[600],
68
- // hiContrast: colors.indigo[50],
69
- // loContrast: colors.indigo[200],
70
- fill: "#6366f1",
71
- stroke: "#4f46e5",
72
- hiContrast: "#eef2ff",
73
- loContrast: "#c7d2fe"
74
- }
75
- };
@@ -1,132 +0,0 @@
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 };
@@ -1,9 +0,0 @@
1
- import { ElementColors } from "./element.js";
2
- import { RelationshipColors } from "./relationships.js";
3
- export const defaultTheme = {
4
- elements: ElementColors,
5
- relationships: RelationshipColors,
6
- font: "Helvetica",
7
- shadow: "#0a0a0a"
8
- };
9
- export { ElementColors, RelationshipColors };
@@ -1,57 +0,0 @@
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
- };
@@ -1,64 +0,0 @@
1
- const gray = {
2
- lineColor: "#6E6E6E",
3
- labelBgColor: "#18191b",
4
- labelColor: "#C6C6C6"
5
- };
6
- const slate = {
7
- lineColor: "#64748b",
8
- // 500
9
- labelBgColor: "#0f172a",
10
- // 900
11
- labelColor: "#cbd5e1"
12
- // 300
13
- };
14
- const blue = {
15
- lineColor: "#3b82f6",
16
- // 500
17
- labelBgColor: "#172554",
18
- // 950
19
- labelColor: "#60a5fa"
20
- // 400
21
- };
22
- const sky = {
23
- lineColor: "#0ea5e9",
24
- // 500
25
- labelBgColor: "#082f49",
26
- // 950
27
- labelColor: "#38bdf8"
28
- // 400
29
- };
30
- export const RelationshipColors = {
31
- amber: {
32
- lineColor: "#b45309",
33
- labelBgColor: "#78350f",
34
- labelColor: "#FFE0C2"
35
- },
36
- blue,
37
- gray,
38
- green: {
39
- lineColor: "#15803d",
40
- // 700
41
- labelBgColor: "#052e16",
42
- // 950
43
- labelColor: "#22c55e"
44
- // 500
45
- },
46
- indigo: {
47
- lineColor: "#6366f1",
48
- // 500
49
- labelBgColor: "#1e1b4b",
50
- // 950
51
- labelColor: "#818cf8"
52
- // 400
53
- },
54
- muted: slate,
55
- primary: blue,
56
- red: {
57
- lineColor: "#AC4D39",
58
- labelBgColor: "#b91c1c",
59
- labelColor: "#FF977D"
60
- },
61
- secondary: sky,
62
- sky,
63
- slate
64
- };
@@ -1,39 +0,0 @@
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;
@@ -1,82 +0,0 @@
1
- import stringify from "safe-stable-stringify";
2
- import { CustomError } from "ts-custom-error";
3
- import { isString } from "../utils/guards.js";
4
- export class BaseError extends CustomError {
5
- constructor(message, options) {
6
- super(message, options);
7
- Object.defineProperty(this, "name", { value: "BaseError" });
8
- }
9
- }
10
- export class InvalidArgError extends BaseError {
11
- constructor(message, options) {
12
- super(message, options);
13
- Object.defineProperty(this, "name", { value: "InvalidArgError" });
14
- }
15
- }
16
- export class UnknownError extends BaseError {
17
- constructor(message, options) {
18
- super(message, options);
19
- Object.defineProperty(this, "name", { value: "UnknownError" });
20
- }
21
- }
22
- export class NullableError extends BaseError {
23
- constructor(message, options) {
24
- super(message, options);
25
- Object.defineProperty(this, "name", { value: "NullableError" });
26
- }
27
- }
28
- export class InvariantError extends BaseError {
29
- constructor(message, options) {
30
- super(message, options);
31
- Object.defineProperty(this, "name", { value: "InvariantError" });
32
- }
33
- }
34
- export function nonNullable(value, message) {
35
- if (typeof value === "undefined" || value == null) {
36
- throw new NullableError(message ?? `Expected defined value, but received ${value}`);
37
- }
38
- return value;
39
- }
40
- export class RelationRefError extends BaseError {
41
- constructor(message, options) {
42
- super(message, options);
43
- Object.defineProperty(this, "name", { value: "RelationRefError" });
44
- }
45
- }
46
- export function normalizeError(e) {
47
- if (e instanceof BaseError || e instanceof Error) {
48
- return e;
49
- }
50
- const message = isString(e) ? e : stringify(e);
51
- const error = new UnknownError(message);
52
- Error.captureStackTrace(error, normalizeError);
53
- return error;
54
- }
55
- export function invariant(condition, message) {
56
- if (condition) {
57
- return;
58
- }
59
- throw new InvariantError(message ?? "Invariant failed");
60
- }
61
- export class NonExhaustiveError extends BaseError {
62
- constructor(message, options) {
63
- super(message, options);
64
- Object.defineProperty(this, "name", { value: "NonExhaustiveError" });
65
- }
66
- }
67
- export function nonexhaustive(value) {
68
- const val = typeof value === "string" ? value : stringify(value);
69
- throw new NonExhaustiveError(`NonExhaustive value: ${val}`);
70
- }
71
- export class InvalidModelError extends BaseError {
72
- constructor(message, options) {
73
- super(message, options);
74
- Object.defineProperty(this, "name", { value: "InvalidModelError" });
75
- }
76
- }
77
- export function ensureModel(condition, message) {
78
- if (condition) {
79
- return;
80
- }
81
- throw new InvalidModelError(message ?? "ModelIndex Invariant failed");
82
- }
@@ -1,6 +0,0 @@
1
- export * from './colors';
2
- export * from './errors';
3
- export * from './types';
4
- export * from './utils';
5
- export type * as likec4 from './types';
6
- export type * as c4 from './types';
package/dist/esm/index.js DELETED
@@ -1,4 +0,0 @@
1
- export * from "./colors/index.js";
2
- export * from "./errors/index.js";
3
- export * from "./types/index.js";
4
- export * from "./utils/index.js";
package/dist/esm/log.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const likec4log: import("roarr").Logger<Error | import("roarr/dist/types").JsonObject | {
2
- error?: Error | undefined;
3
- }>;
package/dist/esm/log.js DELETED
@@ -1,5 +0,0 @@
1
- import {
2
- Roarr
3
- } from "roarr";
4
- export const likec4log = Roarr.child((msg) => msg);
5
- likec4log.error(new Error(), "This is an error message");
@@ -1,2 +0,0 @@
1
- // Do not add any other lines of code to this file!
2
- import '@total-typescript/ts-reset'
@@ -1,3 +0,0 @@
1
- import type { Opaque } from './opaque';
2
- export type NonEmptyArray<T> = [T, ...T[]] | [...T[], T];
3
- export type IconUrl = Opaque<string, 'IconUrl'>;
File without changes
@@ -1,45 +0,0 @@
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
- }
File without changes
@@ -1,40 +0,0 @@
1
- import type { NonEmptyArray } from './_common';
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
- export type BBox = {
6
- x: number;
7
- y: number;
8
- width: number;
9
- height: number;
10
- };
11
- export interface DiagramLabel {
12
- align: 'left' | 'right' | 'center';
13
- fontStyle?: 'bold' | 'normal';
14
- color?: ColorLiteral;
15
- fontSize: number;
16
- pt: Point;
17
- width: number;
18
- text: string;
19
- }
20
- export interface DiagramNode extends ComputedNode {
21
- width: number;
22
- height: number;
23
- position: Point;
24
- labels: DiagramLabel[];
25
- }
26
- export interface DiagramEdge extends ComputedEdge {
27
- points: NonEmptyArray<Point>;
28
- headArrow?: NonEmptyArray<Point>;
29
- headArrowPoint?: Point;
30
- tailArrow?: NonEmptyArray<Point>;
31
- tailArrowPoint?: Point;
32
- labels?: NonEmptyArray<DiagramLabel>;
33
- labelBBox?: BBox;
34
- }
35
- export interface DiagramView extends Omit<ComputedView, 'nodes' | 'edges'> {
36
- readonly nodes: DiagramNode[];
37
- readonly edges: DiagramEdge[];
38
- readonly width: number;
39
- readonly height: number;
40
- }
File without changes
@@ -1,30 +0,0 @@
1
- import type { IconUrl, NonEmptyArray } from './_common';
2
- import type { Opaque } from './opaque';
3
- import type { ThemeColor } from './theme';
4
- export type Fqn = Opaque<string, 'Fqn'>;
5
- export declare function AsFqn(name: string, parent?: Fqn | null): Fqn;
6
- export type ElementKind = Opaque<string, 'ElementKind'>;
7
- export declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue"];
8
- export type ElementShape = typeof ElementShapes[number];
9
- export declare const DefaultThemeColor = "primary";
10
- export declare const DefaultElementShape = "rectangle";
11
- export interface ElementStyle {
12
- shape?: ElementShape;
13
- }
14
- export type Tag = Opaque<string, 'Tag'>;
15
- export interface TagSpec {
16
- readonly id: Tag;
17
- readonly style: ElementStyle;
18
- }
19
- export interface Element {
20
- readonly id: Fqn;
21
- readonly kind: ElementKind;
22
- readonly title: string;
23
- readonly description: string | null;
24
- readonly technology: string | null;
25
- readonly tags: NonEmptyArray<Tag> | null;
26
- readonly links: NonEmptyArray<string> | null;
27
- readonly icon?: IconUrl;
28
- readonly shape?: ElementShape;
29
- readonly color?: ThemeColor;
30
- }
@@ -1,14 +0,0 @@
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";