@likec4/core 0.37.0 → 0.40.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 → cjs/colors.d.ts} +28 -28
- package/dist/{colors.cjs → cjs/colors.js} +18 -28
- package/dist/{compute-view/EdgeBuilder.cjs → cjs/compute-view/EdgeBuilder.js} +1 -1
- package/dist/{compute-view → cjs/compute-view}/compute-ctx.d.ts +5 -4
- package/dist/{compute-view/compute-ctx.cjs → cjs/compute-view/compute-ctx.js} +5 -3
- package/dist/{compute-view/compute-element-view.cjs → cjs/compute-view/compute-element-view.js} +22 -13
- package/dist/{compute-view/compute-predicates.cjs → cjs/compute-view/compute-predicates.js} +3 -3
- package/dist/{compute-view/compute.cjs → cjs/compute-view/compute.js} +2 -2
- package/dist/{compute-view → cjs/compute-view}/index.d.ts +1 -0
- package/dist/{compute-view/index.cjs → cjs/compute-view/index.js} +14 -3
- package/dist/{compute-view → cjs/compute-view}/resolve-extended-views.d.ts +2 -2
- package/dist/{compute-view/resolve-extended-views.cjs → cjs/compute-view/resolve-extended-views.js} +16 -13
- package/dist/cjs/compute-view/resolve-relative-paths.d.ts +2 -0
- package/dist/cjs/compute-view/resolve-relative-paths.js +84 -0
- package/dist/{compute-view/utils/anyPossibleRelations.cjs → cjs/compute-view/utils/anyPossibleRelations.js} +1 -1
- package/dist/{compute-view/utils/applyViewRuleStyles.cjs → cjs/compute-view/utils/applyViewRuleStyles.js} +2 -2
- package/dist/cjs/compute-view/utils/sortNodes.d.ts +19 -0
- package/dist/cjs/compute-view/utils/sortNodes.js +47 -0
- package/dist/cjs/errors/index.d.ts +45 -0
- package/dist/cjs/errors/index.js +137 -0
- package/dist/{index.cjs → cjs/index.js} +24 -24
- package/dist/{model-index/ModelIndex.cjs → cjs/model-index/ModelIndex.js} +3 -4
- package/dist/{model-index/index.cjs → cjs/model-index/index.js} +1 -1
- package/dist/{types → cjs/types}/computed-view.d.ts +1 -0
- package/dist/{types → cjs/types}/diagram.d.ts +1 -6
- package/dist/{types/index.cjs → cjs/types/index.js} +10 -10
- package/dist/{types → cjs/types}/theme.d.ts +8 -2
- package/dist/{types → cjs/types}/view.d.ts +15 -0
- package/dist/{utils/compute-node-levels.cjs → cjs/utils/compute-node-levels.js} +1 -1
- package/dist/{utils/fqn.cjs → cjs/utils/fqn.js} +1 -1
- package/dist/{utils → cjs/utils}/guards.d.ts +0 -2
- package/dist/cjs/utils/guards.js +13 -0
- package/dist/{utils/index.cjs → cjs/utils/index.js} +4 -4
- package/dist/{utils/relations.cjs → cjs/utils/relations.js} +1 -1
- package/dist/esm/colors.d.ts +148 -0
- package/dist/{colors.js → esm/colors.js} +18 -26
- package/dist/esm/compute-view/EdgeBuilder.d.ts +6 -0
- package/dist/esm/compute-view/compute-ctx.d.ts +20 -0
- package/dist/{compute-view → esm/compute-view}/compute-ctx.js +2 -0
- package/dist/esm/compute-view/compute-element-view.d.ts +3 -0
- package/dist/{compute-view → esm/compute-view}/compute-element-view.js +18 -6
- package/dist/esm/compute-view/compute-predicates.d.ts +16 -0
- package/dist/{compute-view → esm/compute-view}/compute-predicates.js +1 -1
- package/dist/esm/compute-view/compute.d.ts +14 -0
- package/dist/esm/compute-view/index.d.ts +4 -0
- package/dist/{compute-view → esm/compute-view}/index.js +1 -0
- package/dist/esm/compute-view/resolve-extended-views.d.ts +6 -0
- package/dist/{compute-view → esm/compute-view}/resolve-extended-views.js +17 -14
- package/dist/esm/compute-view/resolve-relative-paths.d.ts +2 -0
- package/dist/esm/compute-view/resolve-relative-paths.js +76 -0
- package/dist/esm/compute-view/utils/anyPossibleRelations.d.ts +2 -0
- package/dist/esm/compute-view/utils/applyViewRuleStyles.d.ts +2 -0
- package/dist/esm/compute-view/utils/sortNodes.d.ts +19 -0
- package/dist/esm/compute-view/utils/sortNodes.js +37 -0
- package/dist/esm/errors/index.d.ts +45 -0
- package/dist/esm/errors/index.js +97 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/model-index/ModelIndex.d.ts +27 -0
- package/dist/{model-index → esm/model-index}/ModelIndex.js +3 -4
- package/dist/esm/model-index/index.d.ts +1 -0
- package/dist/esm/types/_common.d.ts +3 -0
- package/dist/esm/types/computed-view.d.ts +41 -0
- package/dist/esm/types/diagram.d.ts +32 -0
- package/dist/esm/types/element.d.ts +29 -0
- package/dist/esm/types/expression.d.ts +56 -0
- package/dist/esm/types/index.d.ts +11 -0
- package/dist/esm/types/model.d.ts +14 -0
- package/dist/esm/types/opaque.d.ts +102 -0
- package/dist/esm/types/relation.d.ts +10 -0
- package/dist/esm/types/theme.d.ts +28 -0
- package/dist/esm/types/view.d.ts +58 -0
- package/dist/esm/utils/compute-node-levels.d.ts +7 -0
- package/dist/esm/utils/fqn.d.ts +28 -0
- package/dist/esm/utils/guards.d.ts +3 -0
- package/dist/esm/utils/guards.js +6 -0
- package/dist/esm/utils/index.d.ts +4 -0
- package/dist/esm/utils/relations.d.ts +25 -0
- package/package.json +54 -68
- package/dist/compute-view/utils/sortNodes.cjs +0 -50
- package/dist/compute-view/utils/sortNodes.d.ts +0 -2
- package/dist/compute-view/utils/sortNodes.js +0 -40
- package/dist/errors/_base.cjs +0 -62
- package/dist/errors/_base.d.ts +0 -26
- package/dist/errors/_base.js +0 -41
- package/dist/errors/index.cjs +0 -60
- package/dist/errors/index.d.ts +0 -5
- package/dist/errors/index.js +0 -5
- package/dist/errors/invariant.cjs +0 -23
- package/dist/errors/invariant.d.ts +0 -6
- package/dist/errors/invariant.js +0 -13
- package/dist/errors/model-index.cjs +0 -23
- package/dist/errors/model-index.d.ts +0 -6
- package/dist/errors/model-index.js +0 -13
- package/dist/errors/non-nullable.cjs +0 -23
- package/dist/errors/non-nullable.d.ts +0 -6
- package/dist/errors/non-nullable.js +0 -13
- package/dist/errors/nonexhaustive.cjs +0 -23
- package/dist/errors/nonexhaustive.d.ts +0 -6
- package/dist/errors/nonexhaustive.js +0 -12
- package/dist/utils/guards.cjs +0 -22
- package/dist/utils/guards.js +0 -13
- package/dist/{compute-view → cjs/compute-view}/EdgeBuilder.d.ts +0 -0
- package/dist/{compute-view → cjs/compute-view}/compute-element-view.d.ts +0 -0
- package/dist/{compute-view → cjs/compute-view}/compute-predicates.d.ts +0 -0
- package/dist/{compute-view → cjs/compute-view}/compute.d.ts +0 -0
- package/dist/{compute-view → cjs/compute-view}/utils/anyPossibleRelations.d.ts +0 -0
- package/dist/{compute-view → cjs/compute-view}/utils/applyViewRuleStyles.d.ts +0 -0
- package/dist/{index.d.ts → cjs/index.d.ts} +5 -5
- package/dist/{model-index → cjs/model-index}/ModelIndex.d.ts +0 -0
- package/dist/{model-index → cjs/model-index}/index.d.ts +0 -0
- package/dist/{types → cjs/types}/_common.d.ts +0 -0
- package/dist/{types/_common.cjs → cjs/types/_common.js} +0 -0
- package/dist/{types/computed-view.cjs → cjs/types/computed-view.js} +0 -0
- package/dist/{types/diagram.cjs → cjs/types/diagram.js} +0 -0
- package/dist/{types → cjs/types}/element.d.ts +0 -0
- package/dist/{types/element.cjs → cjs/types/element.js} +0 -0
- package/dist/{types → cjs/types}/expression.d.ts +0 -0
- package/dist/{types/expression.cjs → cjs/types/expression.js} +0 -0
- package/dist/{types → cjs/types}/index.d.ts +0 -0
- package/dist/{types → cjs/types}/model.d.ts +0 -0
- package/dist/{types/model.cjs → cjs/types/model.js} +0 -0
- package/dist/{types → cjs/types}/opaque.d.ts +0 -0
- package/dist/{types/opaque.cjs → cjs/types/opaque.js} +0 -0
- package/dist/{types → cjs/types}/relation.d.ts +0 -0
- package/dist/{types/relation.cjs → cjs/types/relation.js} +0 -0
- package/dist/{types/theme.cjs → cjs/types/theme.js} +0 -0
- package/dist/{types/view.cjs → cjs/types/view.js} +0 -0
- package/dist/{utils → cjs/utils}/compute-node-levels.d.ts +0 -0
- package/dist/{utils → cjs/utils}/fqn.d.ts +0 -0
- package/dist/{utils → cjs/utils}/index.d.ts +0 -0
- package/dist/{utils → cjs/utils}/relations.d.ts +0 -0
- package/dist/{compute-view → esm/compute-view}/EdgeBuilder.js +0 -0
- package/dist/{compute-view → esm/compute-view}/compute.js +0 -0
- package/dist/{compute-view → esm/compute-view}/utils/anyPossibleRelations.js +0 -0
- package/dist/{compute-view → esm/compute-view}/utils/applyViewRuleStyles.js +0 -0
- package/dist/{index.js → esm/index.js} +4 -4
- /package/dist/{model-index → esm/model-index}/index.js +0 -0
- /package/dist/{types → esm/types}/_common.js +0 -0
- /package/dist/{types → esm/types}/computed-view.js +0 -0
- /package/dist/{types → esm/types}/diagram.js +0 -0
- /package/dist/{types → esm/types}/element.js +0 -0
- /package/dist/{types → esm/types}/expression.js +0 -0
- /package/dist/{types → esm/types}/index.js +0 -0
- /package/dist/{types → esm/types}/model.js +0 -0
- /package/dist/{types → esm/types}/opaque.js +0 -0
- /package/dist/{types → esm/types}/relation.js +0 -0
- /package/dist/{types → esm/types}/theme.js +0 -0
- /package/dist/{types → esm/types}/view.js +0 -0
- /package/dist/{utils → esm/utils}/compute-node-levels.js +0 -0
- /package/dist/{utils → esm/utils}/fqn.js +0 -0
- /package/dist/{utils → esm/utils}/index.js +0 -0
- /package/dist/{utils → esm/utils}/relations.js +0 -0
|
@@ -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
|
+
}
|
|
@@ -3,69 +3,69 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var
|
|
7
|
-
Object.keys(
|
|
6
|
+
var _colors = require("./colors");
|
|
7
|
+
Object.keys(_colors).forEach(function (key) {
|
|
8
8
|
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] ===
|
|
9
|
+
if (key in exports && exports[key] === _colors[key]) return;
|
|
10
10
|
Object.defineProperty(exports, key, {
|
|
11
11
|
enumerable: true,
|
|
12
12
|
get: function () {
|
|
13
|
-
return
|
|
13
|
+
return _colors[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
-
var
|
|
18
|
-
Object.keys(
|
|
17
|
+
var _computeView = require("./compute-view");
|
|
18
|
+
Object.keys(_computeView).forEach(function (key) {
|
|
19
19
|
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] ===
|
|
20
|
+
if (key in exports && exports[key] === _computeView[key]) return;
|
|
21
21
|
Object.defineProperty(exports, key, {
|
|
22
22
|
enumerable: true,
|
|
23
23
|
get: function () {
|
|
24
|
-
return
|
|
24
|
+
return _computeView[key];
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
var
|
|
29
|
-
Object.keys(
|
|
28
|
+
var _errors = require("./errors");
|
|
29
|
+
Object.keys(_errors).forEach(function (key) {
|
|
30
30
|
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] ===
|
|
31
|
+
if (key in exports && exports[key] === _errors[key]) return;
|
|
32
32
|
Object.defineProperty(exports, key, {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function () {
|
|
35
|
-
return
|
|
35
|
+
return _errors[key];
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
-
var
|
|
40
|
-
Object.keys(
|
|
39
|
+
var _modelIndex = require("./model-index");
|
|
40
|
+
Object.keys(_modelIndex).forEach(function (key) {
|
|
41
41
|
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] ===
|
|
42
|
+
if (key in exports && exports[key] === _modelIndex[key]) return;
|
|
43
43
|
Object.defineProperty(exports, key, {
|
|
44
44
|
enumerable: true,
|
|
45
45
|
get: function () {
|
|
46
|
-
return
|
|
46
|
+
return _modelIndex[key];
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
-
var
|
|
51
|
-
Object.keys(
|
|
50
|
+
var _types = require("./types");
|
|
51
|
+
Object.keys(_types).forEach(function (key) {
|
|
52
52
|
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] ===
|
|
53
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
54
54
|
Object.defineProperty(exports, key, {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function () {
|
|
57
|
-
return
|
|
57
|
+
return _types[key];
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
var
|
|
62
|
-
Object.keys(
|
|
61
|
+
var _utils = require("./utils");
|
|
62
|
+
Object.keys(_utils).forEach(function (key) {
|
|
63
63
|
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] ===
|
|
64
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
65
65
|
Object.defineProperty(exports, key, {
|
|
66
66
|
enumerable: true,
|
|
67
67
|
get: function () {
|
|
68
|
-
return
|
|
68
|
+
return _utils[key];
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
});
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
module.exports = void 0;
|
|
7
7
|
var _remeda = require("remeda");
|
|
8
|
-
var _errors = require("../errors
|
|
9
|
-
var _utils = require("../utils
|
|
8
|
+
var _errors = require("../errors");
|
|
9
|
+
var _utils = require("../utils");
|
|
10
10
|
function childrenOf(trie) {
|
|
11
11
|
const children = [];
|
|
12
12
|
for (const {
|
|
@@ -40,8 +40,7 @@ class ModelIndex {
|
|
|
40
40
|
relations
|
|
41
41
|
}) {
|
|
42
42
|
const index = new ModelIndex();
|
|
43
|
-
const
|
|
44
|
-
for (const el of sortedElements) {
|
|
43
|
+
for (const el of (0, _remeda.values)(elements)) {
|
|
45
44
|
index.addElement(el);
|
|
46
45
|
}
|
|
47
46
|
for (const rel of (0, _remeda.values)(relations)) {
|
|
@@ -9,5 +9,5 @@ Object.defineProperty(exports, "ModelIndex", {
|
|
|
9
9
|
return _ModelIndex.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var _ModelIndex = _interopRequireDefault(require("./ModelIndex
|
|
12
|
+
var _ModelIndex = _interopRequireDefault(require("./ModelIndex"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -17,6 +17,7 @@ export interface DiagramNode extends ComputedNode {
|
|
|
17
17
|
};
|
|
18
18
|
labels: DiagramLabel[];
|
|
19
19
|
position: Point;
|
|
20
|
+
depth?: number;
|
|
20
21
|
}
|
|
21
22
|
export interface DiagramEdge extends ComputedEdge {
|
|
22
23
|
points: Point[];
|
|
@@ -28,10 +29,4 @@ export interface DiagramView extends Omit<ComputedView, 'nodes' | 'edges'> {
|
|
|
28
29
|
readonly edges: DiagramEdge[];
|
|
29
30
|
width: number;
|
|
30
31
|
height: number;
|
|
31
|
-
boundingBox: {
|
|
32
|
-
x: number;
|
|
33
|
-
y: number;
|
|
34
|
-
width: number;
|
|
35
|
-
height: number;
|
|
36
|
-
};
|
|
37
32
|
}
|
|
@@ -7,7 +7,7 @@ var _exportNames = {
|
|
|
7
7
|
Expr: true
|
|
8
8
|
};
|
|
9
9
|
exports.Expr = void 0;
|
|
10
|
-
var _opaque = require("./opaque
|
|
10
|
+
var _opaque = require("./opaque");
|
|
11
11
|
Object.keys(_opaque).forEach(function (key) {
|
|
12
12
|
if (key === "default" || key === "__esModule") return;
|
|
13
13
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -19,7 +19,7 @@ Object.keys(_opaque).forEach(function (key) {
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
-
var _common = require("./_common
|
|
22
|
+
var _common = require("./_common");
|
|
23
23
|
Object.keys(_common).forEach(function (key) {
|
|
24
24
|
if (key === "default" || key === "__esModule") return;
|
|
25
25
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -31,7 +31,7 @@ Object.keys(_common).forEach(function (key) {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
var _theme = require("./theme
|
|
34
|
+
var _theme = require("./theme");
|
|
35
35
|
Object.keys(_theme).forEach(function (key) {
|
|
36
36
|
if (key === "default" || key === "__esModule") return;
|
|
37
37
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -43,7 +43,7 @@ Object.keys(_theme).forEach(function (key) {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
-
var _element = require("./element
|
|
46
|
+
var _element = require("./element");
|
|
47
47
|
Object.keys(_element).forEach(function (key) {
|
|
48
48
|
if (key === "default" || key === "__esModule") return;
|
|
49
49
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -55,7 +55,7 @@ Object.keys(_element).forEach(function (key) {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
-
var _relation = require("./relation
|
|
58
|
+
var _relation = require("./relation");
|
|
59
59
|
Object.keys(_relation).forEach(function (key) {
|
|
60
60
|
if (key === "default" || key === "__esModule") return;
|
|
61
61
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -67,7 +67,7 @@ Object.keys(_relation).forEach(function (key) {
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
|
-
var _model = require("./model
|
|
70
|
+
var _model = require("./model");
|
|
71
71
|
Object.keys(_model).forEach(function (key) {
|
|
72
72
|
if (key === "default" || key === "__esModule") return;
|
|
73
73
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -79,7 +79,7 @@ Object.keys(_model).forEach(function (key) {
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
-
var _view = require("./view
|
|
82
|
+
var _view = require("./view");
|
|
83
83
|
Object.keys(_view).forEach(function (key) {
|
|
84
84
|
if (key === "default" || key === "__esModule") return;
|
|
85
85
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -91,7 +91,7 @@ Object.keys(_view).forEach(function (key) {
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
|
-
var _Expr = _interopRequireWildcard(require("./expression
|
|
94
|
+
var _Expr = _interopRequireWildcard(require("./expression"));
|
|
95
95
|
exports.Expr = _Expr;
|
|
96
96
|
Object.keys(_Expr).forEach(function (key) {
|
|
97
97
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -104,7 +104,7 @@ Object.keys(_Expr).forEach(function (key) {
|
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
|
-
var _computedView = require("./computed-view
|
|
107
|
+
var _computedView = require("./computed-view");
|
|
108
108
|
Object.keys(_computedView).forEach(function (key) {
|
|
109
109
|
if (key === "default" || key === "__esModule") return;
|
|
110
110
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -116,7 +116,7 @@ Object.keys(_computedView).forEach(function (key) {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
|
-
var _diagram = require("./diagram
|
|
119
|
+
var _diagram = require("./diagram");
|
|
120
120
|
Object.keys(_diagram).forEach(function (key) {
|
|
121
121
|
if (key === "default" || key === "__esModule") return;
|
|
122
122
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export type ThemeColor = 'amber' | 'blue' | 'gray' | 'slate' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky';
|
|
2
2
|
export type HexColorLiteral = `#${string}`;
|
|
3
3
|
export type ColorLiteral = HexColorLiteral;
|
|
4
|
+
export type InteractiveColor = HexColorLiteral | [
|
|
5
|
+
HexColorLiteral,
|
|
6
|
+
{
|
|
7
|
+
onHover: HexColorLiteral;
|
|
8
|
+
}
|
|
9
|
+
];
|
|
4
10
|
export interface ThemeColorValues {
|
|
5
11
|
fill: ColorLiteral;
|
|
6
12
|
stroke: ColorLiteral;
|
|
@@ -11,8 +17,8 @@ export type ThemeColors = {
|
|
|
11
17
|
[key in ThemeColor]: ThemeColorValues;
|
|
12
18
|
};
|
|
13
19
|
export interface ThemeRelationColors {
|
|
14
|
-
lineColor:
|
|
15
|
-
labelColor:
|
|
20
|
+
lineColor: InteractiveColor;
|
|
21
|
+
labelColor: InteractiveColor;
|
|
16
22
|
}
|
|
17
23
|
export interface LikeC4Theme {
|
|
18
24
|
font: 'Helvetica';
|
|
@@ -31,6 +31,21 @@ export interface BasicElementView {
|
|
|
31
31
|
readonly tags: NonEmptyArray<Tag> | null;
|
|
32
32
|
readonly links: NonEmptyArray<string> | null;
|
|
33
33
|
readonly rules: ViewRule[];
|
|
34
|
+
/**
|
|
35
|
+
* URI to the source file of this view.
|
|
36
|
+
* Undefined if the view is auto-generated.
|
|
37
|
+
*/
|
|
38
|
+
readonly docUri?: string;
|
|
39
|
+
/**
|
|
40
|
+
* For all views we find common ancestor path.
|
|
41
|
+
* This is used to generate relative paths, i.e.:
|
|
42
|
+
* - "" for views in the common ancestor directory (or root)
|
|
43
|
+
* - "subdir" for views in "<root>/subdir"
|
|
44
|
+
* - "subdir/subdir1" for views in "<root>/subdir/subdir1"
|
|
45
|
+
*
|
|
46
|
+
* Undefined if the view is auto-generated.
|
|
47
|
+
*/
|
|
48
|
+
readonly relativePath?: string;
|
|
34
49
|
}
|
|
35
50
|
export interface StrictElementView extends BasicElementView {
|
|
36
51
|
readonly viewOf: Fqn;
|
|
@@ -13,7 +13,7 @@ exports.nameFromFqn = nameFromFqn;
|
|
|
13
13
|
exports.notDescendantOf = notDescendantOf;
|
|
14
14
|
exports.parentFqn = parentFqn;
|
|
15
15
|
var _remeda = require("remeda");
|
|
16
|
-
var _guards = require("./guards
|
|
16
|
+
var _guards = require("./guards");
|
|
17
17
|
function nameFromFqn(fqn) {
|
|
18
18
|
const lastDot = fqn.lastIndexOf(".");
|
|
19
19
|
if (lastDot > 0) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { NonEmptyArray } from '../types';
|
|
2
2
|
export declare function isString(value: unknown): value is string;
|
|
3
|
-
export declare function failUnexpected(arg: never): never;
|
|
4
|
-
export declare function ignoreNeverInRuntime(arg: never): void;
|
|
5
3
|
export declare function isNonEmptyArray<A>(arr: ArrayLike<A>): arr is NonEmptyArray<A>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isNonEmptyArray = isNonEmptyArray;
|
|
7
|
+
exports.isString = isString;
|
|
8
|
+
function isString(value) {
|
|
9
|
+
return value != null && typeof value === "string";
|
|
10
|
+
}
|
|
11
|
+
function isNonEmptyArray(arr) {
|
|
12
|
+
return arr.length > 0;
|
|
13
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _fqn = require("./fqn
|
|
6
|
+
var _fqn = require("./fqn");
|
|
7
7
|
Object.keys(_fqn).forEach(function (key) {
|
|
8
8
|
if (key === "default" || key === "__esModule") return;
|
|
9
9
|
if (key in exports && exports[key] === _fqn[key]) return;
|
|
@@ -14,7 +14,7 @@ Object.keys(_fqn).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
-
var _guards = require("./guards
|
|
17
|
+
var _guards = require("./guards");
|
|
18
18
|
Object.keys(_guards).forEach(function (key) {
|
|
19
19
|
if (key === "default" || key === "__esModule") return;
|
|
20
20
|
if (key in exports && exports[key] === _guards[key]) return;
|
|
@@ -25,7 +25,7 @@ Object.keys(_guards).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
var _computeNodeLevels = require("./compute-node-levels
|
|
28
|
+
var _computeNodeLevels = require("./compute-node-levels");
|
|
29
29
|
Object.keys(_computeNodeLevels).forEach(function (key) {
|
|
30
30
|
if (key === "default" || key === "__esModule") return;
|
|
31
31
|
if (key in exports && exports[key] === _computeNodeLevels[key]) return;
|
|
@@ -36,7 +36,7 @@ Object.keys(_computeNodeLevels).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
-
var _relations = require("./relations
|
|
39
|
+
var _relations = require("./relations");
|
|
40
40
|
Object.keys(_relations).forEach(function (key) {
|
|
41
41
|
if (key === "default" || key === "__esModule") return;
|
|
42
42
|
if (key in exports && exports[key] === _relations[key]) return;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.compareRelations = exports.Relations = void 0;
|
|
7
|
-
var _fqn = require("./fqn
|
|
7
|
+
var _fqn = require("./fqn");
|
|
8
8
|
var _rambdax = require("rambdax");
|
|
9
9
|
const compareRelations = (a, b) => {
|
|
10
10
|
return (0, _fqn.compareFqnHierarchically)(a.source, b.source) || (0, _fqn.compareFqnHierarchically)(a.target, b.target);
|