@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.
Files changed (106) hide show
  1. package/dist/colors.d.ts +76 -9
  2. package/dist/colors.js +116 -93
  3. package/dist/colors.mjs +112 -0
  4. package/dist/compute-view/EdgeBuilder.d.ts +0 -1
  5. package/dist/compute-view/EdgeBuilder.js +37 -34
  6. package/dist/compute-view/EdgeBuilder.mjs +31 -0
  7. package/dist/compute-view/compute-ctx.d.ts +0 -1
  8. package/dist/compute-view/compute-ctx.js +33 -24
  9. package/dist/compute-view/compute-ctx.mjs +42 -0
  10. package/dist/compute-view/compute-element-view.d.ts +2 -3
  11. package/dist/compute-view/compute-element-view.js +137 -525
  12. package/dist/compute-view/compute-element-view.mjs +145 -0
  13. package/dist/compute-view/compute-predicates.d.ts +16 -0
  14. package/dist/compute-view/compute-predicates.js +358 -0
  15. package/dist/compute-view/compute-predicates.mjs +324 -0
  16. package/dist/compute-view/compute.d.ts +8 -9
  17. package/dist/compute-view/compute.js +49 -39
  18. package/dist/compute-view/compute.mjs +39 -0
  19. package/dist/compute-view/index.d.ts +1 -1
  20. package/dist/compute-view/index.js +24 -2
  21. package/dist/compute-view/index.mjs +1 -0
  22. package/dist/compute-view/utils/anyPossibleRelations.d.ts +0 -1
  23. package/dist/compute-view/utils/anyPossibleRelations.js +17 -12
  24. package/dist/compute-view/utils/anyPossibleRelations.mjs +12 -0
  25. package/dist/compute-view/utils/applyViewRuleStyles.d.ts +3 -0
  26. package/dist/compute-view/utils/applyViewRuleStyles.js +59 -0
  27. package/dist/compute-view/utils/applyViewRuleStyles.mjs +50 -0
  28. package/dist/compute-view/utils/sortNodes.d.ts +0 -1
  29. package/dist/compute-view/utils/sortNodes.js +47 -42
  30. package/dist/compute-view/utils/sortNodes.mjs +40 -0
  31. package/dist/errors/_base.d.ts +0 -1
  32. package/dist/errors/_base.js +14 -11
  33. package/dist/errors/_base.mjs +4 -0
  34. package/dist/errors/index.d.ts +1 -1
  35. package/dist/errors/index.js +60 -5
  36. package/dist/errors/index.mjs +5 -0
  37. package/dist/errors/invariant.d.ts +0 -2
  38. package/dist/errors/invariant.js +16 -21
  39. package/dist/errors/invariant.mjs +8 -0
  40. package/dist/errors/model-index.d.ts +0 -1
  41. package/dist/errors/model-index.js +16 -14
  42. package/dist/errors/model-index.mjs +8 -0
  43. package/dist/errors/non-nullable.d.ts +2 -0
  44. package/dist/errors/non-nullable.js +16 -0
  45. package/dist/errors/non-nullable.mjs +8 -0
  46. package/dist/errors/nonexhaustive.d.ts +0 -1
  47. package/dist/errors/nonexhaustive.js +13 -6
  48. package/dist/errors/nonexhaustive.mjs +5 -0
  49. package/dist/index.d.ts +6 -3
  50. package/dist/index.js +71 -7
  51. package/dist/index.mjs +6 -0
  52. package/dist/model-index/ModelIndex.d.ts +0 -1
  53. package/dist/model-index/ModelIndex.js +125 -122
  54. package/dist/model-index/ModelIndex.mjs +128 -0
  55. package/dist/model-index/index.d.ts +0 -1
  56. package/dist/model-index/index.js +13 -2
  57. package/dist/model-index/index.mjs +1 -0
  58. package/dist/types/_common.d.ts +0 -1
  59. package/dist/types/_common.js +1 -2
  60. package/dist/types/_common.mjs +0 -0
  61. package/dist/types/computed-view.d.ts +7 -6
  62. package/dist/types/computed-view.js +1 -2
  63. package/dist/types/computed-view.mjs +0 -0
  64. package/dist/types/diagram.d.ts +5 -2
  65. package/dist/types/diagram.js +1 -2
  66. package/dist/types/diagram.mjs +0 -0
  67. package/dist/types/element.d.ts +3 -7
  68. package/dist/types/element.js +13 -5
  69. package/dist/types/element.mjs +5 -0
  70. package/dist/types/expression.d.ts +0 -1
  71. package/dist/types/expression.js +45 -31
  72. package/dist/types/expression.mjs +30 -0
  73. package/dist/types/index.d.ts +1 -1
  74. package/dist/types/index.js +48 -4
  75. package/dist/types/index.mjs +3 -0
  76. package/dist/types/model.d.ts +0 -1
  77. package/dist/types/model.js +1 -2
  78. package/dist/types/model.mjs +0 -0
  79. package/dist/types/opaque.d.ts +0 -1
  80. package/dist/types/opaque.js +1 -2
  81. package/dist/types/opaque.mjs +0 -0
  82. package/dist/types/relation.d.ts +0 -1
  83. package/dist/types/relation.js +1 -2
  84. package/dist/types/relation.mjs +0 -0
  85. package/dist/types/theme.d.ts +22 -0
  86. package/dist/types/theme.js +1 -0
  87. package/dist/types/theme.mjs +0 -0
  88. package/dist/types/view.d.ts +2 -2
  89. package/dist/types/view.js +15 -8
  90. package/dist/types/view.mjs +9 -0
  91. package/dist/utils/compute-node-levels.d.ts +0 -1
  92. package/dist/utils/compute-node-levels.js +45 -29
  93. package/dist/utils/compute-node-levels.mjs +31 -0
  94. package/dist/utils/fqn.d.ts +0 -1
  95. package/dist/utils/fqn.js +71 -71
  96. package/dist/utils/fqn.mjs +66 -0
  97. package/dist/utils/guards.d.ts +0 -1
  98. package/dist/utils/guards.js +19 -12
  99. package/dist/utils/guards.mjs +13 -0
  100. package/dist/utils/index.d.ts +0 -1
  101. package/dist/utils/index.js +49 -5
  102. package/dist/utils/index.mjs +4 -0
  103. package/dist/utils/relations.d.ts +0 -1
  104. package/dist/utils/relations.js +56 -49
  105. package/dist/utils/relations.mjs +42 -0
  106. package/package.json +20 -55
@@ -1,137 +1,140 @@
1
- import { pipe, sort, values } from 'remeda';
2
- import { InvalidModelError, ensureModel } from '../errors';
3
- import { compareByFqnHierarchically, parentFqn } from '../utils/fqn';
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = void 0;
7
+ var _remeda = require("remeda");
8
+ var _errors = require("../errors");
9
+ var _fqn = require("../utils/fqn");
4
10
  function childrenOf(trie) {
5
- const children = [];
6
- for (const { el } of values(trie.children)) {
7
- if (el) {
8
- children.push(el);
9
- }
11
+ const children = [];
12
+ for (const {
13
+ el
14
+ } of (0, _remeda.values)(trie.children)) {
15
+ if (el) {
16
+ children.push(el);
10
17
  }
11
- return children;
18
+ }
19
+ return children;
12
20
  }
13
21
  function asPath(id) {
14
- return id.split('.');
22
+ return id.split(".");
15
23
  }
16
- export default class ModelIndex {
17
- root = {
18
- children: {}
19
- };
20
- _elements = new Map();
21
- _relations = new Map();
22
- // private _taggedElements = new Map<Tag, Set<Element>>()
23
- // private _taggedRelations = new Map<Tag, Set<Relation>>()
24
- get relations() {
25
- return Array.from(this._relations.values());
24
+ class ModelIndex {
25
+ root = {
26
+ children: {}
27
+ };
28
+ _elements = /* @__PURE__ */new Map();
29
+ _relations = /* @__PURE__ */new Map();
30
+ // private _taggedElements = new Map<Tag, Set<Element>>()
31
+ // private _taggedRelations = new Map<Tag, Set<Relation>>()
32
+ get relations() {
33
+ return Array.from(this._relations.values());
34
+ }
35
+ filterRelations(predicate) {
36
+ return this.relations.filter(predicate);
37
+ }
38
+ static from({
39
+ elements,
40
+ relations
41
+ }) {
42
+ const index = new ModelIndex();
43
+ const sortedElements = (0, _remeda.pipe)((0, _remeda.values)(elements), (0, _remeda.sort)(_fqn.compareByFqnHierarchically));
44
+ for (const el of sortedElements) {
45
+ index.addElement(el);
26
46
  }
27
- filterRelations(predicate) {
28
- return this.relations.filter(predicate);
47
+ for (const rel of (0, _remeda.values)(relations)) {
48
+ index.addRelation(rel);
29
49
  }
30
- static from({ elements, relations }) {
31
- const index = new ModelIndex();
32
- const sortedElements = pipe(values(elements), sort(compareByFqnHierarchically));
33
- for (const el of sortedElements) {
34
- index.addElement(el);
35
- }
36
- for (const rel of values(relations)) {
37
- index.addRelation(rel);
38
- }
39
- return index;
50
+ return index;
51
+ }
52
+ addElement(el) {
53
+ if (this.hasElement(el.id)) {
54
+ throw new _errors.InvalidModelError(`Element already exists with id ${el.id}`);
40
55
  }
41
- addElement(el) {
42
- if (this.hasElement(el.id)) {
43
- throw new InvalidModelError(`Element already exists with id ${el.id}`);
44
- }
45
- const path = asPath(el.id);
46
- let scope = this.root;
47
- for (const name of path) {
48
- const next = scope.children[name] ?? {
49
- children: {}
50
- };
51
- scope.children[name] = next;
52
- scope = next;
53
- }
54
- scope.el = el;
55
- this._elements.set(el.id, el);
56
+ const path = asPath(el.id);
57
+ let scope = this.root;
58
+ for (const name of path) {
59
+ const next = scope.children[name] ?? {
60
+ children: {}
61
+ };
62
+ scope.children[name] = next;
63
+ scope = next;
56
64
  }
57
- locateTrie = (id) => {
58
- let scope = this.root;
59
- for (const name of asPath(id)) {
60
- const next = scope.children[name];
61
- ensureModel(next, `Invalid index, Element not found at path ${name} of ${id}`);
62
- scope = next;
63
- }
64
- return scope;
65
- };
66
- find = (id) => {
67
- const el = this._elements.get(id);
68
- ensureModel(el, `Element not found with id ${id}`);
69
- return el;
70
- };
71
- children = (id) => {
72
- return childrenOf(this.locateTrie(id));
73
- };
74
- siblings = (id) => {
75
- const parent = parentFqn(id);
76
- const trie = parent ? this.locateTrie(parent) : this.root;
77
- return childrenOf(trie).filter(e => e.id !== id);
78
- };
79
- /**
80
- * Ancestors from closest parent to root
81
- */
82
- ancestors(id) {
83
- const path = asPath(id);
84
- const ancestors = [];
85
- // The root
86
- if (path.length === 1) {
87
- return ancestors;
88
- }
89
- // Remove the element itself
90
- path.pop();
91
- let name = path.shift();
92
- let trie = this.root;
93
- while (name) {
94
- const next = trie.children[name];
95
- ensureModel(next, `Invalid index, Element not found at path ${name} of ${id}`);
96
- trie = next;
97
- ensureModel(trie.el, `invalid index, no element ${name} found in ${id}`);
98
- ancestors.unshift(trie.el);
99
- name = path.shift();
100
- }
101
- return ancestors;
65
+ scope.el = el;
66
+ this._elements.set(el.id, el);
67
+ }
68
+ locateTrie = id => {
69
+ let scope = this.root;
70
+ for (const name of asPath(id)) {
71
+ const next = scope.children[name];
72
+ (0, _errors.ensureModel)(next, `Invalid index, Element not found at path ${name} of ${id}`);
73
+ scope = next;
102
74
  }
103
- // tagged = (tag?: Tag): TaggedResult => {
104
- // return tag ? {
105
- // elements: [...this._taggedElements.get(tag)?.values() ?? []],
106
- // relations: [...this._taggedRelations.get(tag)?.values() ?? []],
107
- // } : {
108
- // elements: uniq([...this._taggedElements.values()].flatMap(s => [...s.values()])),
109
- // relations: uniq([...this._taggedRelations.values()].flatMap(s => [...s.values()]))
110
- // }
111
- // }
112
- rootElements() {
113
- return childrenOf(this.root);
75
+ return scope;
76
+ };
77
+ find = id => {
78
+ const el = this._elements.get(id);
79
+ (0, _errors.ensureModel)(el, `Element not found with id ${id}`);
80
+ return el;
81
+ };
82
+ children = id => {
83
+ return childrenOf(this.locateTrie(id));
84
+ };
85
+ siblings = id => {
86
+ const parent = (0, _fqn.parentFqn)(id);
87
+ const trie = parent ? this.locateTrie(parent) : this.root;
88
+ return childrenOf(trie).filter(e => e.id !== id);
89
+ };
90
+ /**
91
+ * Ancestors from closest parent to root
92
+ */
93
+ ancestors(id) {
94
+ const path = asPath(id);
95
+ const ancestors = [];
96
+ if (path.length === 1) {
97
+ return ancestors;
114
98
  }
115
- get elements() {
116
- return Array.from(this._elements.values());
99
+ path.pop();
100
+ let name = path.shift();
101
+ let trie = this.root;
102
+ while (name) {
103
+ const next = trie.children[name];
104
+ (0, _errors.ensureModel)(next, `Invalid index, Element not found at path ${name} of ${id}`);
105
+ trie = next;
106
+ (0, _errors.ensureModel)(trie.el, `invalid index, no element ${name} found in ${id}`);
107
+ ancestors.unshift(trie.el);
108
+ name = path.shift();
117
109
  }
118
- hasElement(fqn) {
119
- return this._elements.has(fqn);
110
+ return ancestors;
111
+ }
112
+ // tagged = (tag?: Tag): TaggedResult => {
113
+ // return tag ? {
114
+ // elements: [...this._taggedElements.get(tag)?.values() ?? []],
115
+ // relations: [...this._taggedRelations.get(tag)?.values() ?? []],
116
+ // } : {
117
+ // elements: uniq([...this._taggedElements.values()].flatMap(s => [...s.values()])),
118
+ // relations: uniq([...this._taggedRelations.values()].flatMap(s => [...s.values()]))
119
+ // }
120
+ // }
121
+ rootElements() {
122
+ return childrenOf(this.root);
123
+ }
124
+ get elements() {
125
+ return Array.from(this._elements.values());
126
+ }
127
+ hasElement(fqn) {
128
+ return this._elements.has(fqn);
129
+ }
130
+ addRelation(rel) {
131
+ if (!this.hasElement(rel.source)) {
132
+ throw new _errors.InvalidModelError(`Source of relation not found ${rel.source}`);
120
133
  }
121
- addRelation(rel) {
122
- // Validate source and target
123
- if (!this.hasElement(rel.source)) {
124
- throw new InvalidModelError(`Source of relation not found ${rel.source}`);
125
- }
126
- if (!this.hasElement(rel.target)) {
127
- throw new InvalidModelError(`Target of relation not found ${rel.target}`);
128
- }
129
- this._relations.set(rel.id, rel);
130
- // for (const tag of rel.tags) {
131
- // const tagged = this._taggedRelations.get(tag) ?? new Set()
132
- // tagged.add(rel)
133
- // this._taggedRelations.set(tag, tagged)
134
- // }
134
+ if (!this.hasElement(rel.target)) {
135
+ throw new _errors.InvalidModelError(`Target of relation not found ${rel.target}`);
135
136
  }
137
+ this._relations.set(rel.id, rel);
138
+ }
136
139
  }
137
- //# sourceMappingURL=ModelIndex.js.map
140
+ module.exports = ModelIndex;
@@ -0,0 +1,128 @@
1
+ import { pipe, sort, values } from "remeda";
2
+ import { InvalidModelError, ensureModel } from "../errors/index.mjs";
3
+ import { compareByFqnHierarchically, parentFqn } from "../utils/fqn.mjs";
4
+ function childrenOf(trie) {
5
+ const children = [];
6
+ for (const { el } of values(trie.children)) {
7
+ if (el) {
8
+ children.push(el);
9
+ }
10
+ }
11
+ return children;
12
+ }
13
+ function asPath(id) {
14
+ return id.split(".");
15
+ }
16
+ export default class ModelIndex {
17
+ root = {
18
+ children: {}
19
+ };
20
+ _elements = /* @__PURE__ */ new Map();
21
+ _relations = /* @__PURE__ */ new Map();
22
+ // private _taggedElements = new Map<Tag, Set<Element>>()
23
+ // private _taggedRelations = new Map<Tag, Set<Relation>>()
24
+ get relations() {
25
+ return Array.from(this._relations.values());
26
+ }
27
+ filterRelations(predicate) {
28
+ return this.relations.filter(predicate);
29
+ }
30
+ static from({ elements, relations }) {
31
+ const index = new ModelIndex();
32
+ const sortedElements = pipe(values(elements), sort(compareByFqnHierarchically));
33
+ for (const el of sortedElements) {
34
+ index.addElement(el);
35
+ }
36
+ for (const rel of values(relations)) {
37
+ index.addRelation(rel);
38
+ }
39
+ return index;
40
+ }
41
+ addElement(el) {
42
+ if (this.hasElement(el.id)) {
43
+ throw new InvalidModelError(`Element already exists with id ${el.id}`);
44
+ }
45
+ const path = asPath(el.id);
46
+ let scope = this.root;
47
+ for (const name of path) {
48
+ const next = scope.children[name] ?? {
49
+ children: {}
50
+ };
51
+ scope.children[name] = next;
52
+ scope = next;
53
+ }
54
+ scope.el = el;
55
+ this._elements.set(el.id, el);
56
+ }
57
+ locateTrie = (id) => {
58
+ let scope = this.root;
59
+ for (const name of asPath(id)) {
60
+ const next = scope.children[name];
61
+ ensureModel(next, `Invalid index, Element not found at path ${name} of ${id}`);
62
+ scope = next;
63
+ }
64
+ return scope;
65
+ };
66
+ find = (id) => {
67
+ const el = this._elements.get(id);
68
+ ensureModel(el, `Element not found with id ${id}`);
69
+ return el;
70
+ };
71
+ children = (id) => {
72
+ return childrenOf(this.locateTrie(id));
73
+ };
74
+ siblings = (id) => {
75
+ const parent = parentFqn(id);
76
+ const trie = parent ? this.locateTrie(parent) : this.root;
77
+ return childrenOf(trie).filter((e) => e.id !== id);
78
+ };
79
+ /**
80
+ * Ancestors from closest parent to root
81
+ */
82
+ ancestors(id) {
83
+ const path = asPath(id);
84
+ const ancestors = [];
85
+ if (path.length === 1) {
86
+ return ancestors;
87
+ }
88
+ path.pop();
89
+ let name = path.shift();
90
+ let trie = this.root;
91
+ while (name) {
92
+ const next = trie.children[name];
93
+ ensureModel(next, `Invalid index, Element not found at path ${name} of ${id}`);
94
+ trie = next;
95
+ ensureModel(trie.el, `invalid index, no element ${name} found in ${id}`);
96
+ ancestors.unshift(trie.el);
97
+ name = path.shift();
98
+ }
99
+ return ancestors;
100
+ }
101
+ // tagged = (tag?: Tag): TaggedResult => {
102
+ // return tag ? {
103
+ // elements: [...this._taggedElements.get(tag)?.values() ?? []],
104
+ // relations: [...this._taggedRelations.get(tag)?.values() ?? []],
105
+ // } : {
106
+ // elements: uniq([...this._taggedElements.values()].flatMap(s => [...s.values()])),
107
+ // relations: uniq([...this._taggedRelations.values()].flatMap(s => [...s.values()]))
108
+ // }
109
+ // }
110
+ rootElements() {
111
+ return childrenOf(this.root);
112
+ }
113
+ get elements() {
114
+ return Array.from(this._elements.values());
115
+ }
116
+ hasElement(fqn) {
117
+ return this._elements.has(fqn);
118
+ }
119
+ addRelation(rel) {
120
+ if (!this.hasElement(rel.source)) {
121
+ throw new InvalidModelError(`Source of relation not found ${rel.source}`);
122
+ }
123
+ if (!this.hasElement(rel.target)) {
124
+ throw new InvalidModelError(`Target of relation not found ${rel.target}`);
125
+ }
126
+ this._relations.set(rel.id, rel);
127
+ }
128
+ }
@@ -1,2 +1 @@
1
1
  export { default as ModelIndex } from './ModelIndex';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,13 @@
1
- export { default as ModelIndex } from './ModelIndex';
2
- //# sourceMappingURL=index.js.map
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ModelIndex", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ModelIndex.default;
10
+ }
11
+ });
12
+ var _ModelIndex = _interopRequireDefault(require("./ModelIndex"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1 @@
1
+ export { default as ModelIndex } from "./ModelIndex.mjs";
@@ -1,4 +1,3 @@
1
1
  import type { Opaque } from './opaque';
2
2
  export type NonEmptyArray<T> = [T, ...T[]];
3
3
  export type IconUrl = Opaque<string, 'IconUrl'>;
4
- //# sourceMappingURL=_common.d.ts.map
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=_common.js.map
1
+ "use strict";
File without changes
@@ -1,8 +1,9 @@
1
1
  import type { Opaque } from './opaque';
2
- import type { ElementKind, ElementShape, Fqn, Tag, ThemeColor } from './element';
2
+ import type { ElementKind, ElementShape, Fqn, Tag } from './element';
3
3
  import type { RelationID } from './relation';
4
4
  import type { ElementView, ViewID, ViewRuleAutoLayout } from './view';
5
5
  import type { IconUrl, NonEmptyArray } from './_common';
6
+ import type { ThemeColor } from './theme';
6
7
  export type NodeId = Fqn;
7
8
  export type EdgeId = Opaque<string, 'EdgeId'>;
8
9
  export interface ComputedNode {
@@ -15,6 +16,8 @@ export interface ComputedNode {
15
16
  tags: NonEmptyArray<Tag> | null;
16
17
  links: NonEmptyArray<string> | null;
17
18
  children: NodeId[];
19
+ inEdges: EdgeId[];
20
+ outEdges: EdgeId[];
18
21
  shape: ElementShape;
19
22
  color: ThemeColor;
20
23
  icon?: IconUrl;
@@ -28,10 +31,8 @@ export interface ComputedEdge {
28
31
  label: string | null;
29
32
  relations: RelationID[];
30
33
  }
31
- export interface ComputedView<Node extends ComputedNode = ComputedNode, Edge extends ComputedEdge = ComputedEdge> extends ElementView {
34
+ export interface ComputedView extends ElementView {
32
35
  autoLayout: ViewRuleAutoLayout['autoLayout'];
33
- nodes: Node[];
34
- edges: Edge[];
36
+ nodes: ComputedNode[];
37
+ edges: ComputedEdge[];
35
38
  }
36
- export type ComputeResult<V extends ElementView> = V & Pick<ComputedView, 'autoLayout' | 'nodes' | 'edges'>;
37
- //# sourceMappingURL=computed-view.d.ts.map
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=computed-view.js.map
1
+ "use strict";
File without changes
@@ -1,8 +1,10 @@
1
+ import type { ColorLiteral } from './theme';
1
2
  import type { ComputedEdge, ComputedNode, ComputedView } from './computed-view';
2
3
  export type Point = [x: number, y: number];
3
4
  export interface DiagramLabel {
4
5
  align: 'left' | 'right' | 'center';
5
6
  fontStyle?: 'bold' | 'normal';
7
+ color?: ColorLiteral;
6
8
  fontSize: number;
7
9
  pt: Point;
8
10
  width: number;
@@ -21,7 +23,9 @@ export interface DiagramEdge extends ComputedEdge {
21
23
  headArrow?: Point[];
22
24
  labels: DiagramLabel[];
23
25
  }
24
- export interface DiagramView extends ComputedView<DiagramNode, DiagramEdge> {
26
+ export interface DiagramView extends Omit<ComputedView, 'nodes' | 'edges'> {
27
+ readonly nodes: DiagramNode[];
28
+ readonly edges: DiagramEdge[];
25
29
  width: number;
26
30
  height: number;
27
31
  boundingBox: {
@@ -31,4 +35,3 @@ export interface DiagramView extends ComputedView<DiagramNode, DiagramEdge> {
31
35
  height: number;
32
36
  };
33
37
  }
34
- //# sourceMappingURL=diagram.d.ts.map
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=diagram.js.map
1
+ "use strict";
File without changes
@@ -1,15 +1,12 @@
1
1
  import type { IconUrl, NonEmptyArray } from './_common';
2
2
  import type { Opaque } from './opaque';
3
+ import type { ThemeColor } from './theme';
3
4
  export type Fqn = Opaque<string, 'Fqn'>;
4
5
  export declare function AsFqn(name: string, parent?: Fqn | null): Fqn;
5
6
  export type ElementKind = Opaque<string, 'ElementKind'>;
6
- /**
7
- * TailwindCSS based color palette
8
- */
9
- export type ThemeColor = 'amber' | 'blue' | 'gray' | 'slate' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky';
10
7
  export type ElementShape = 'rectangle' | 'person' | 'browser' | 'mobile' | 'cylinder' | 'storage' | 'queue';
11
- export declare const DefaultThemeColor: ThemeColor;
12
- export declare const DefaultElementShape: ElementShape;
8
+ export declare const DefaultThemeColor = "primary";
9
+ export declare const DefaultElementShape = "rectangle";
13
10
  export interface ElementStyle {
14
11
  shape?: ElementShape;
15
12
  }
@@ -30,4 +27,3 @@ export interface Element {
30
27
  readonly shape?: ElementShape;
31
28
  readonly color?: ThemeColor;
32
29
  }
33
- //# sourceMappingURL=element.d.ts.map
@@ -1,6 +1,14 @@
1
- export function AsFqn(name, parent) {
2
- return (parent ? parent + '.' + name : name);
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AsFqn = AsFqn;
7
+ exports.DefaultThemeColor = exports.DefaultElementShape = void 0;
8
+ function AsFqn(name, parent) {
9
+ return parent ? parent + "." + name : name;
3
10
  }
4
- export const DefaultThemeColor = 'primary';
5
- export const DefaultElementShape = 'rectangle';
6
- //# sourceMappingURL=element.js.map
11
+ const DefaultThemeColor = "primary";
12
+ exports.DefaultThemeColor = DefaultThemeColor;
13
+ const DefaultElementShape = "rectangle";
14
+ exports.DefaultElementShape = DefaultElementShape;
@@ -0,0 +1,5 @@
1
+ export function AsFqn(name, parent) {
2
+ return parent ? parent + "." + name : name;
3
+ }
4
+ export const DefaultThemeColor = "primary";
5
+ export const DefaultElementShape = "rectangle";
@@ -54,4 +54,3 @@ export type AnyRelationExpression = RelationExpr | InOutExpr | IncomingExpr | Ou
54
54
  export declare function isAnyRelation(expr: Expression): expr is AnyRelationExpression;
55
55
  export type Expression = ElementExpression | AnyRelationExpression;
56
56
  export {};
57
- //# sourceMappingURL=expression.d.ts.map
@@ -1,31 +1,45 @@
1
- export function isElementRef(expr) {
2
- return 'element' in expr && 'isDescedants' in expr;
3
- }
4
- export function isWildcard(expr) {
5
- return 'wildcard' in expr;
6
- }
7
- export function isElementKindExpr(expr) {
8
- return 'elementKind' in expr && 'isEqual' in expr;
9
- }
10
- export function isElementTagExpr(expr) {
11
- return 'elementTag' in expr && 'isEqual' in expr;
12
- }
13
- export function isElement(expr) {
14
- return isElementRef(expr) || isWildcard(expr) || isElementKindExpr(expr) || isElementTagExpr(expr);
15
- }
16
- export function isRelation(expr) {
17
- return 'source' in expr && 'target' in expr;
18
- }
19
- export function isInOut(expr) {
20
- return 'inout' in expr;
21
- }
22
- export function isIncoming(expr) {
23
- return 'incoming' in expr;
24
- }
25
- export function isOutgoing(expr) {
26
- return 'outgoing' in expr;
27
- }
28
- export function isAnyRelation(expr) {
29
- return isRelation(expr) || isInOut(expr) || isIncoming(expr) || isOutgoing(expr);
30
- }
31
- //# sourceMappingURL=expression.js.map
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isAnyRelation = isAnyRelation;
7
+ exports.isElement = isElement;
8
+ exports.isElementKindExpr = isElementKindExpr;
9
+ exports.isElementRef = isElementRef;
10
+ exports.isElementTagExpr = isElementTagExpr;
11
+ exports.isInOut = isInOut;
12
+ exports.isIncoming = isIncoming;
13
+ exports.isOutgoing = isOutgoing;
14
+ exports.isRelation = isRelation;
15
+ exports.isWildcard = isWildcard;
16
+ function isElementRef(expr) {
17
+ return "element" in expr && "isDescedants" in expr;
18
+ }
19
+ function isWildcard(expr) {
20
+ return "wildcard" in expr;
21
+ }
22
+ function isElementKindExpr(expr) {
23
+ return "elementKind" in expr && "isEqual" in expr;
24
+ }
25
+ function isElementTagExpr(expr) {
26
+ return "elementTag" in expr && "isEqual" in expr;
27
+ }
28
+ function isElement(expr) {
29
+ return isElementRef(expr) || isWildcard(expr) || isElementKindExpr(expr) || isElementTagExpr(expr);
30
+ }
31
+ function isRelation(expr) {
32
+ return "source" in expr && "target" in expr;
33
+ }
34
+ function isInOut(expr) {
35
+ return "inout" in expr;
36
+ }
37
+ function isIncoming(expr) {
38
+ return "incoming" in expr;
39
+ }
40
+ function isOutgoing(expr) {
41
+ return "outgoing" in expr;
42
+ }
43
+ function isAnyRelation(expr) {
44
+ return isRelation(expr) || isInOut(expr) || isIncoming(expr) || isOutgoing(expr);
45
+ }