@likec4/core 1.32.2 → 1.34.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/builder/index.d.mts +6 -4
  2. package/dist/builder/index.mjs +45 -13
  3. package/dist/compute-view/index.d.mts +6 -4
  4. package/dist/compute-view/index.mjs +33 -10
  5. package/dist/compute-view/relationships-view/index.d.mts +6 -4
  6. package/dist/compute-view/relationships-view/index.mjs +6 -3
  7. package/dist/index.d.mts +9 -138
  8. package/dist/index.mjs +31 -3712
  9. package/dist/model/connection/deployment/index.d.mts +10 -0
  10. package/dist/model/connection/deployment/index.mjs +18 -0
  11. package/dist/model/connection/index.d.mts +70 -0
  12. package/dist/model/connection/index.mjs +23 -0
  13. package/dist/model/connection/model/index.d.mts +10 -0
  14. package/dist/model/connection/model/index.mjs +11 -0
  15. package/dist/model/index.d.mts +14 -256
  16. package/dist/model/index.mjs +27 -5
  17. package/dist/shared/{core.cbA9VZ02.mjs → core.4SpVCM9m.mjs} +31 -1073
  18. package/dist/shared/{core.BuO4ncfY.d.mts → core.668kXpZq.d.mts} +42 -52
  19. package/dist/shared/core.8KM0D6va.mjs +33 -0
  20. package/dist/shared/core.B0oEIXqd.mjs +47 -0
  21. package/dist/shared/core.BH9nN-_I.mjs +22 -0
  22. package/dist/shared/core.BMCb0wJI.mjs +177 -0
  23. package/dist/shared/core.BTnf14gD.mjs +331 -0
  24. package/dist/shared/core.BgvIuGGU.mjs +3 -0
  25. package/dist/shared/core.BoyJPEen.mjs +21 -0
  26. package/dist/shared/{core.CUYDgv2-.mjs → core.Br7Fab9l.mjs} +12 -15
  27. package/dist/shared/{core.BrCnZFTn.mjs → core.Btl47GOn.mjs} +3 -3
  28. package/dist/shared/core.ByrmCl9I.mjs +5 -0
  29. package/dist/shared/core.C80Z37Eu.mjs +29 -0
  30. package/dist/shared/{core.Pf5I9o0e.d.mts → core.CF82MWyh.d.mts} +1 -1
  31. package/dist/shared/core.CJSFKrYf.d.mts +83 -0
  32. package/dist/shared/{core.rmvsy0n3.mjs → core.C_C-3c1S.mjs} +5 -198
  33. package/dist/shared/{core.DoK86JEe.mjs → core.CpwrZi3D.mjs} +2 -73
  34. package/dist/shared/{core.CpXlRyE5.mjs → core.CtKXPqN_.mjs} +5 -36
  35. package/dist/shared/core.CxGKeL-L.mjs +144 -0
  36. package/dist/shared/core.CzdwsPmY.d.mts +69 -0
  37. package/dist/shared/core.D3xEWj5B.d.mts +41 -0
  38. package/dist/shared/{core.Cy9smucx.mjs → core.D4npX2q8.mjs} +1 -3
  39. package/dist/shared/core.D56nCp7e.mjs +168 -0
  40. package/dist/shared/core.D5qVzkws.mjs +724 -0
  41. package/dist/shared/{core.CBxTtXMi.d.mts → core.DAj3LuFH.d.mts} +58 -57
  42. package/dist/shared/{core.Bk7wEZFG.mjs → core.DXRAwwDB.mjs} +3 -2
  43. package/dist/shared/core.DcS-0zys.mjs +10 -0
  44. package/dist/shared/core.Di7__sMg.d.mts +87 -0
  45. package/dist/shared/{core.DaAyklhe.d.mts → core.DrS4Bf4y.d.mts} +31 -22
  46. package/dist/shared/core.DsMrjY2q.mjs +34 -0
  47. package/dist/shared/core.DuSLYTG6.d.mts +57 -0
  48. package/dist/shared/{core.Bdz6fBF1.d.mts → core.IWLie-Ma.d.mts} +92 -81
  49. package/dist/shared/{core.CBpKAlhj.mjs → core.PqNe5WxQ.mjs} +96 -56
  50. package/dist/shared/core.XptQjhMA.mjs +1295 -0
  51. package/dist/shared/core.zLlww-07.mjs +3 -0
  52. package/dist/theme/index.d.mts +134 -0
  53. package/dist/theme/index.mjs +3709 -0
  54. package/dist/types/_aux.d.mts +4 -0
  55. package/dist/types/index.d.mts +9 -5
  56. package/dist/types/index.mjs +17 -146
  57. package/dist/utils/index.d.mts +15 -100
  58. package/dist/utils/index.mjs +25 -1315
  59. package/dist/utils/iterable/index.d.mts +100 -0
  60. package/dist/utils/iterable/index.mjs +24 -0
  61. package/package.json +29 -13
  62. package/src/builder/Builder.ts +13 -4
  63. package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +0 -13
  64. package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +2 -6
  65. package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +0 -7
  66. package/src/compute-view/deployment-view/__test__/fixture.ts +15 -5
  67. package/src/compute-view/deployment-view/utils.ts +13 -13
  68. package/src/compute-view/dynamic-view/compute.ts +2 -1
  69. package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +2 -2
  70. package/src/compute-view/relationships-view/layout.ts +1 -1
  71. package/src/compute-view/utils/applyCustomElementProperties.ts +8 -0
  72. package/src/compute-view/utils/applyCustomRelationProperties.ts +2 -0
  73. package/src/compute-view/utils/buildComputedNodes.ts +4 -3
  74. package/src/compute-view/utils/merge-props-from-relationships.ts +6 -5
  75. package/src/compute-view/utils/view-hash.ts +24 -3
  76. package/src/model/DeploymentElementModel.ts +21 -17
  77. package/src/model/DeploymentModel.ts +1 -1
  78. package/src/model/ElementModel.ts +15 -5
  79. package/src/model/LikeC4Model.ts +1 -1
  80. package/src/model/RelationModel.ts +20 -17
  81. package/src/model/index.ts +2 -0
  82. package/src/model/types.ts +2 -1
  83. package/src/model/view/EdgeModel.ts +4 -3
  84. package/src/model/view/LikeC4ViewModel.ts +6 -1
  85. package/src/model/view/NodeModel.ts +5 -3
  86. package/src/theme/index.ts +12 -5
  87. package/src/types/RichText.ts +200 -0
  88. package/src/types/expression-model.ts +2 -2
  89. package/src/types/expression.ts +2 -2
  90. package/src/types/fqnRef.ts +2 -2
  91. package/src/types/global.ts +1 -1
  92. package/src/types/index.ts +4 -2
  93. package/src/types/model-data.ts +2 -2
  94. package/src/types/model-deployment.ts +6 -5
  95. package/src/types/model-dump.ts +1 -1
  96. package/src/types/model-logical.ts +5 -5
  97. package/src/types/model-spec.ts +2 -2
  98. package/src/types/operators.ts +2 -2
  99. package/src/types/scalar.ts +47 -2
  100. package/src/types/view-common.ts +3 -3
  101. package/src/types/view-computed.ts +4 -6
  102. package/src/types/view-layouted.ts +11 -2
  103. package/src/types/view-parsed.deployment.ts +1 -1
  104. package/src/types/view-parsed.dynamic.ts +2 -2
  105. package/src/types/view-parsed.element.ts +2 -2
  106. package/src/types/view.ts +2 -2
  107. package/src/utils/index.ts +4 -9
  108. package/src/utils/markdown/index.ts +2 -0
  109. package/src/utils/markdown/to-html.ts +32 -0
  110. package/src/utils/markdown/to-text.ts +14 -0
  111. package/dist/types/aux.d.mts +0 -3
  112. /package/dist/types/{aux.mjs → _aux.mjs} +0 -0
  113. /package/src/types/{aux.ts → _aux.ts} +0 -0
@@ -1,189 +1,13 @@
1
- import { t as t$1, i as invariant } from './core.Cy9smucx.mjs';
1
+ import { t } from './core.zLlww-07.mjs';
2
2
 
3
3
  var e={done:true,hasNext:false},s={done:false,hasNext:false},a=()=>e;
4
4
 
5
5
  function C(t,...o){let n=t,u=o.map(e=>"lazy"in e?y(e):void 0),p=0;for(;p<o.length;){if(u[p]===void 0||!B(n)){let i=o[p];n=i(n),p+=1;continue}let r=[];for(let i=p;i<o.length;i++){let l=u[i];if(l===void 0||(r.push(l),l.isSingle))break}let a=[];for(let i of n)if(f(i,a,r))break;let{isSingle:s}=r.at(-1);n=s?a[0]:a,p+=r.length;}return n}function f(t,o,n){if(n.length===0)return o.push(t),false;let u=t,p=s,e=false;for(let[r,a]of n.entries()){let{index:s,items:i}=a;if(i.push(u),p=a(u,s,i),a.index+=1,p.hasNext){if(p.hasMany??false){for(let l of p.next)if(f(l,o,n.slice(r+1)))return true;return e}u=p.next;}if(!p.hasNext)break;p.done&&(e=true);}return p.hasNext&&o.push(u),e}function y(t){let{lazy:o,lazyArgs:n}=t,u=o(...n);return Object.assign(u,{isSingle:o.single??false,index:0,items:[]})}function B(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}
6
6
 
7
- function t(n){return typeof n=="function"}
8
-
9
7
  function getDefaultExportFromCjs (x) {
10
8
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
11
9
  }
12
10
 
13
- /**
14
- * Mnemonist DefaultMap
15
- * =====================
16
- *
17
- * JavaScript implementation of a default map that will return a constructed
18
- * value any time one tries to access an inexisting key. It's quite similar
19
- * to python's defaultdict.
20
- */
21
-
22
- var defaultMap;
23
- var hasRequiredDefaultMap;
24
-
25
- function requireDefaultMap () {
26
- if (hasRequiredDefaultMap) return defaultMap;
27
- hasRequiredDefaultMap = 1;
28
- /**
29
- * DefaultMap.
30
- *
31
- * @constructor
32
- */
33
- function DefaultMap(factory) {
34
- if (typeof factory !== 'function')
35
- throw new Error('mnemonist/DefaultMap.constructor: expecting a function.');
36
-
37
- this.items = new Map();
38
- this.factory = factory;
39
- this.size = 0;
40
- }
41
-
42
- /**
43
- * Method used to clear the structure.
44
- *
45
- * @return {undefined}
46
- */
47
- DefaultMap.prototype.clear = function() {
48
-
49
- // Properties
50
- this.items.clear();
51
- this.size = 0;
52
- };
53
-
54
- /**
55
- * Method used to get the value set for given key. If the key does not exist,
56
- * the value will be created using the provided factory.
57
- *
58
- * @param {any} key - Target key.
59
- * @return {any}
60
- */
61
- DefaultMap.prototype.get = function(key) {
62
- var value = this.items.get(key);
63
-
64
- if (typeof value === 'undefined') {
65
- value = this.factory(key, this.size);
66
- this.items.set(key, value);
67
- this.size++;
68
- }
69
-
70
- return value;
71
- };
72
-
73
- /**
74
- * Method used to get the value set for given key. If the key does not exist,
75
- * a value won't be created.
76
- *
77
- * @param {any} key - Target key.
78
- * @return {any}
79
- */
80
- DefaultMap.prototype.peek = function(key) {
81
- return this.items.get(key);
82
- };
83
-
84
- /**
85
- * Method used to set a value for given key.
86
- *
87
- * @param {any} key - Target key.
88
- * @param {any} value - Value.
89
- * @return {DefaultMap}
90
- */
91
- DefaultMap.prototype.set = function(key, value) {
92
- this.items.set(key, value);
93
- this.size = this.items.size;
94
-
95
- return this;
96
- };
97
-
98
- /**
99
- * Method used to test the existence of a key in the map.
100
- *
101
- * @param {any} key - Target key.
102
- * @return {boolean}
103
- */
104
- DefaultMap.prototype.has = function(key) {
105
- return this.items.has(key);
106
- };
107
-
108
- /**
109
- * Method used to delete target key.
110
- *
111
- * @param {any} key - Target key.
112
- * @return {boolean}
113
- */
114
- DefaultMap.prototype.delete = function(key) {
115
- var deleted = this.items.delete(key);
116
-
117
- this.size = this.items.size;
118
-
119
- return deleted;
120
- };
121
-
122
- /**
123
- * Method used to iterate over each of the key/value pairs.
124
- *
125
- * @param {function} callback - Function to call for each item.
126
- * @param {object} scope - Optional scope.
127
- * @return {undefined}
128
- */
129
- DefaultMap.prototype.forEach = function(callback, scope) {
130
- scope = arguments.length > 1 ? scope : this;
131
-
132
- this.items.forEach(callback, scope);
133
- };
134
-
135
- /**
136
- * Iterators.
137
- */
138
- DefaultMap.prototype.entries = function() {
139
- return this.items.entries();
140
- };
141
-
142
- DefaultMap.prototype.keys = function() {
143
- return this.items.keys();
144
- };
145
-
146
- DefaultMap.prototype.values = function() {
147
- return this.items.values();
148
- };
149
-
150
- /**
151
- * Attaching the #.entries method to Symbol.iterator if possible.
152
- */
153
- if (typeof Symbol !== 'undefined')
154
- DefaultMap.prototype[Symbol.iterator] = DefaultMap.prototype.entries;
155
-
156
- /**
157
- * Convenience known methods.
158
- */
159
- DefaultMap.prototype.inspect = function() {
160
- return this.items;
161
- };
162
-
163
- if (typeof Symbol !== 'undefined')
164
- DefaultMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = DefaultMap.prototype.inspect;
165
-
166
- /**
167
- * Typical factories.
168
- */
169
- DefaultMap.autoIncrement = function() {
170
- var i = 0;
171
-
172
- return function() {
173
- return i++;
174
- };
175
- };
176
-
177
- /**
178
- * Exporting.
179
- */
180
- defaultMap = DefaultMap;
181
- return defaultMap;
182
- }
183
-
184
- var defaultMapExports = /*@__PURE__*/ requireDefaultMap();
185
- const DefaultMap = /*@__PURE__*/getDefaultExportFromCjs(defaultMapExports);
186
-
187
11
  var naturalCompareLite = {exports: {}};
188
12
 
189
13
  var hasRequiredNaturalCompareLite;
@@ -253,13 +77,13 @@ const compare = /*@__PURE__*/getDefaultExportFromCjs(naturalCompareLiteExports);
253
77
 
254
78
  function compareNatural(a, b) {
255
79
  if (a === b) return 0;
256
- if (t$1(a)) {
257
- if (t$1(b)) {
80
+ if (t(a)) {
81
+ if (t(b)) {
258
82
  return compare(a, b);
259
83
  }
260
84
  return 1;
261
85
  }
262
- return t$1(b) ? -1 : 0;
86
+ return t(b) ? -1 : 0;
263
87
  }
264
88
  function compareNaturalHierarchically(separator = ".") {
265
89
  return (a, b) => {
@@ -448,21 +272,4 @@ function sortNaturalByFqn(array, sort) {
448
272
  }).map(({ item }) => item);
449
273
  }
450
274
 
451
- function ifilter(arg1, arg2) {
452
- const pred = arg2 ?? arg1;
453
- invariant(t(pred));
454
- function* _filter(iter) {
455
- for (const value of iter) {
456
- if (pred(value)) {
457
- yield value;
458
- }
459
- }
460
- return;
461
- }
462
- if (!arg2) {
463
- return _filter;
464
- }
465
- return _filter(arg1);
466
- }
467
-
468
- export { C, DefaultMap as D, isAncestor as a, ifilter as b, isNonEmptyArray as c, isSameHierarchy as d, a as e, s as f, getDefaultExportFromCjs as g, compareByFqnHierarchically as h, isDescendantOf as i, sortByFqnHierarchically as j, commonAncestor as k, ancestorsFqn as l, compareNatural as m, nameFromFqn as n, compareNaturalHierarchically as o, parentFqn as p, compareFqnHierarchically as q, hierarchyDistance as r, sortParentsFirst as s, t, hierarchyLevel as u, sortNaturalByFqn as v, isString as w };
275
+ export { C, compareNaturalHierarchically as a, ancestorsFqn as b, compareNatural as c, commonAncestor as d, compareByFqnHierarchically as e, compareFqnHierarchically as f, hierarchyLevel as g, hierarchyDistance as h, isAncestor as i, isDescendantOf as j, isSameHierarchy as k, sortNaturalByFqn as l, sortParentsFirst as m, nameFromFqn as n, isNonEmptyArray as o, parentFqn as p, isString as q, getDefaultExportFromCjs as r, sortByFqnHierarchically as s, s as t, a as u };
@@ -1,11 +1,8 @@
1
1
  import { u } from './core.DbRvwARP.mjs';
2
- import { t } from './core.rmvsy0n3.mjs';
3
- import { i as invariant } from './core.Cy9smucx.mjs';
2
+ import { i as invariant } from './core.D4npX2q8.mjs';
4
3
 
5
4
  function i(...e){return u(n,e)}var n=(e,r)=>e.length>=r;
6
5
 
7
- function m(...a){return u(o,a,p)}var o=(a,e)=>a.map(e),p=a=>(e,t,r)=>({done:false,hasNext:true,next:a(e,t,r)});
8
-
9
6
  var set = {};
10
7
 
11
8
  /**
@@ -376,74 +373,6 @@ function requireSet () {
376
373
 
377
374
  var setExports = /*@__PURE__*/ requireSet();
378
375
 
379
- function getOrCreate(map, key, create) {
380
- let entry = map.get(key);
381
- if (!entry) {
382
- entry = create(key);
383
- map.set(key, entry);
384
- }
385
- return entry;
386
- }
387
-
388
- function ifind(arg1, arg2) {
389
- const pred = arg2 ?? arg1;
390
- invariant(t(pred));
391
- function _find(iter) {
392
- for (const value of iter) {
393
- if (pred(value)) {
394
- return value;
395
- }
396
- }
397
- return;
398
- }
399
- if (!arg2) {
400
- return _find;
401
- }
402
- return _find(arg1);
403
- }
404
-
405
- function ihead(iterable) {
406
- if (!iterable) {
407
- return _head;
408
- }
409
- return _head(iterable);
410
- }
411
- function _head(iter) {
412
- for (const value of iter) {
413
- return value;
414
- }
415
- return;
416
- }
417
-
418
- function isome(arg1, arg2) {
419
- const pred = arg2 ?? arg1;
420
- invariant(t(pred));
421
- function _some(iter) {
422
- for (const value of iter) {
423
- if (pred(value)) {
424
- return true;
425
- }
426
- }
427
- return false;
428
- }
429
- if (!arg2) {
430
- return _some;
431
- }
432
- return _some(arg1);
433
- }
434
-
435
- function memoizeProp(obj, tag, fn) {
436
- const tagSymbol = typeof tag === "symbol" ? tag : Symbol.for(tag);
437
- if (!obj.hasOwnProperty(tagSymbol)) {
438
- Object.defineProperty(obj, tagSymbol, {
439
- enumerable: false,
440
- writable: false,
441
- value: fn()
442
- });
443
- }
444
- return obj[tagSymbol];
445
- }
446
-
447
376
  function union(...sets) {
448
377
  let result = /* @__PURE__ */ new Set();
449
378
  for (const set of sets) {
@@ -515,4 +444,4 @@ function stringHash(str) {
515
444
  return (hash >>> 0).toString(36);
516
445
  }
517
446
 
518
- export { intersection as a, isome as b, ifind as c, difference as d, ihead as e, memoizeProp as f, getOrCreate as g, hasIntersection as h, i, equals as j, stringHash as k, m, symmetricDifference as s, union as u };
447
+ export { intersection as a, stringHash as b, difference as d, equals as e, hasIntersection as h, i, symmetricDifference as s, union as u };
@@ -1,16 +1,13 @@
1
- import { g as getDefaultExportFromCjs, C } from './core.rmvsy0n3.mjs';
1
+ import { r as getDefaultExportFromCjs, C } from './core.C_C-3c1S.mjs';
2
2
  import { u as u$1 } from './core.DbRvwARP.mjs';
3
- import { m } from './core.DoK86JEe.mjs';
4
- import { i as invariant } from './core.Cy9smucx.mjs';
3
+ import { m } from './core.ByrmCl9I.mjs';
4
+ import { l } from './core.8KM0D6va.mjs';
5
+ import { i as invariant } from './core.D4npX2q8.mjs';
5
6
 
6
7
  function d(...e){return u$1(i,e,o$1)}var i=(e,n)=>e.length<n.length?e.map((t,r)=>[t,n[r]]):n.map((t,r)=>[e[r],t]),o$1=e=>(n,t)=>({hasNext:true,next:[n,e[t]],done:t>=e.length-1});
7
8
 
8
9
  function u(...e){return u$1(o,e)}function o(e,a){let n=[];for(let[i,r]of e.entries()){if(!a(r,i,e))break;n.push(r);}return n}
9
10
 
10
- function n(e){return e!==void 0}
11
-
12
- function l(n){return n!=null}
13
-
14
11
  var support = {};
15
12
 
16
13
  var hasRequiredSupport;
@@ -446,34 +443,6 @@ function commonHead(sources, targets, equals) {
446
443
  );
447
444
  }
448
445
 
449
- function isIterable(something) {
450
- return l(something) && typeof something === "object" && Symbol.iterator in something;
451
- }
452
-
453
- function iflat(iterable) {
454
- return iterable ? _iflat(iterable) : _iflat;
455
- }
456
- function* _iflat(iterable) {
457
- for (const inner of iterable) {
458
- yield* inner;
459
- }
460
- return;
461
- }
462
-
463
- function iunique(iterable) {
464
- return iterable ? _iunique(iterable) : _iunique;
465
- }
466
- function* _iunique(iterable) {
467
- const seen = /* @__PURE__ */ new Set();
468
- for (const item of iterable) {
469
- if (!seen.has(item)) {
470
- seen.add(item);
471
- yield item;
472
- }
473
- }
474
- return;
475
- }
476
-
477
446
  function commonjsRequire(path) {
478
447
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
479
448
  }
@@ -505,4 +474,4 @@ function objectHash(value) {
505
474
  });
506
475
  }
507
476
 
508
- export { Stack as S, requireIterator as a, iunique as b, commonHead as c, d, iflat as e, isIterable as i, l, n, objectHash as o, requireForeach as r, u };
477
+ export { Stack as S, requireIterator as a, commonHead as c, d, objectHash as o, requireForeach as r, u };
@@ -0,0 +1,144 @@
1
+ import { i as invariant } from './core.D4npX2q8.mjs';
2
+
3
+ var BBox;
4
+ ((BBox2) => {
5
+ function center({ x, y, width, height }) {
6
+ return {
7
+ x: x + width / 2,
8
+ y: y + height / 2
9
+ };
10
+ }
11
+ BBox2.center = center;
12
+ function fromPoints(points) {
13
+ const { x1, y1, x2, y2 } = RectBox.fromPoints(points);
14
+ return {
15
+ x: x1,
16
+ y: y1,
17
+ width: x2 - x1,
18
+ height: y2 - y1
19
+ };
20
+ }
21
+ BBox2.fromPoints = fromPoints;
22
+ function merge(...boxes) {
23
+ invariant(boxes.length > 0, "No boxes provided");
24
+ let minX = Infinity;
25
+ let minY = Infinity;
26
+ let maxX = -Infinity;
27
+ let maxY = -Infinity;
28
+ for (const box of boxes) {
29
+ minX = Math.min(minX, box.x);
30
+ minY = Math.min(minY, box.y);
31
+ maxX = Math.max(maxX, box.x + box.width);
32
+ maxY = Math.max(maxY, box.y + box.height);
33
+ }
34
+ return {
35
+ x: minX,
36
+ y: minY,
37
+ width: maxX - minX,
38
+ height: maxY - minY
39
+ };
40
+ }
41
+ BBox2.merge = merge;
42
+ function toRectBox(box) {
43
+ return {
44
+ x1: box.x,
45
+ y1: box.y,
46
+ x2: box.x + box.width,
47
+ y2: box.y + box.height
48
+ };
49
+ }
50
+ BBox2.toRectBox = toRectBox;
51
+ })(BBox || (BBox = {}));
52
+ var RectBox;
53
+ ((RectBox2) => {
54
+ function center({ x1, y1, x2, y2 }) {
55
+ return {
56
+ x: (x1 + x2) / 2,
57
+ y: (y1 + y2) / 2
58
+ };
59
+ }
60
+ RectBox2.center = center;
61
+ function fromPoints(points) {
62
+ invariant(points.length > 0, "At least one point is required");
63
+ let minX = Infinity;
64
+ let minY = Infinity;
65
+ let maxX = -Infinity;
66
+ let maxY = -Infinity;
67
+ for (const [x, y] of points) {
68
+ minX = Math.min(minX, x);
69
+ minY = Math.min(minY, y);
70
+ maxX = Math.max(maxX, x);
71
+ maxY = Math.max(maxY, y);
72
+ }
73
+ return {
74
+ x1: minX,
75
+ y1: minY,
76
+ x2: maxX,
77
+ y2: maxY
78
+ };
79
+ }
80
+ RectBox2.fromPoints = fromPoints;
81
+ function merge(...boxes) {
82
+ invariant(boxes.length > 0, "No boxes provided");
83
+ let minX = Infinity;
84
+ let minY = Infinity;
85
+ let maxX = -Infinity;
86
+ let maxY = -Infinity;
87
+ for (const box of boxes) {
88
+ minX = Math.min(minX, box.x1);
89
+ minY = Math.min(minY, box.y1);
90
+ maxX = Math.max(maxX, box.x2);
91
+ maxY = Math.max(maxY, box.y2);
92
+ }
93
+ return {
94
+ x1: minX,
95
+ y1: minY,
96
+ x2: maxX,
97
+ y2: maxY
98
+ };
99
+ }
100
+ RectBox2.merge = merge;
101
+ function toBBox(box) {
102
+ return {
103
+ x: box.x1,
104
+ y: box.y1,
105
+ width: box.x2 - box.x1,
106
+ height: box.y2 - box.y1
107
+ };
108
+ }
109
+ RectBox2.toBBox = toBBox;
110
+ })(RectBox || (RectBox = {}));
111
+
112
+ function isTagColorSpecified(spec) {
113
+ const color = typeof spec === "string" ? spec : spec.color;
114
+ return color.startsWith("#") || color.startsWith("rgb");
115
+ }
116
+
117
+ const BorderStyles = ["solid", "dashed", "dotted", "none"];
118
+ const ElementShapes = [
119
+ "rectangle",
120
+ "person",
121
+ "browser",
122
+ "mobile",
123
+ "cylinder",
124
+ "storage",
125
+ "queue"
126
+ ];
127
+ const ThemeColors = [
128
+ "amber",
129
+ "blue",
130
+ "gray",
131
+ "slate",
132
+ "green",
133
+ "indigo",
134
+ "muted",
135
+ "primary",
136
+ "red",
137
+ "secondary",
138
+ "sky"
139
+ ];
140
+ function isThemeColor(color) {
141
+ return ThemeColors.includes(color);
142
+ }
143
+
144
+ export { BBox as B, ElementShapes as E, RectBox as R, ThemeColors as T, BorderStyles as a, isThemeColor as b, isTagColorSpecified as i };
@@ -0,0 +1,69 @@
1
+ import { TupleToUnion, Tagged } from 'type-fest';
2
+
3
+ /**
4
+ * For padding, margin, etc.
5
+ */
6
+ type SpacingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
7
+ type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
8
+ type ShapeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
+ declare const BorderStyles: readonly ["solid", "dashed", "dotted", "none"];
10
+ type BorderStyle = TupleToUnion<typeof BorderStyles>;
11
+ declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue"];
12
+ type ElementShape = TupleToUnion<typeof ElementShapes>;
13
+ type HexColor = `#${string}`;
14
+ type ColorLiteral = HexColor | `rgb(${number},${number},${number})` | `rgba(${number},${number},${number},${number})`;
15
+ type CustomColor<T = string> = Tagged<T, 'CustomColor'>;
16
+ type CustomColorDefinitions = {
17
+ [key: string]: ThemeColorValues;
18
+ };
19
+ type RelationshipLineType = 'dashed' | 'solid' | 'dotted';
20
+ type RelationshipArrowType = 'none' | 'normal' | 'onormal' | 'dot' | 'odot' | 'diamond' | 'odiamond' | 'crow' | 'open' | 'vee';
21
+ declare const ThemeColors: readonly ["amber", "blue", "gray", "slate", "green", "indigo", "muted", "primary", "red", "secondary", "sky"];
22
+ type ThemeColor = typeof ThemeColors[number];
23
+ /**
24
+ * Backward compatibility alias
25
+ * @deprecated Use {@link ThemeColor} instead
26
+ */
27
+ type Color = ThemeColor | ColorLiteral;
28
+ declare function isThemeColor(color: string): color is ThemeColor;
29
+ interface ElementThemeColorValues {
30
+ fill: ColorLiteral;
31
+ stroke: ColorLiteral;
32
+ hiContrast: ColorLiteral;
33
+ loContrast: ColorLiteral;
34
+ }
35
+ type ElementThemeColors = {
36
+ [key in ThemeColor]: ElementThemeColorValues;
37
+ };
38
+ interface RelationshipThemeColorValues {
39
+ lineColor: ColorLiteral;
40
+ labelBgColor: ColorLiteral;
41
+ labelColor: ColorLiteral;
42
+ }
43
+ interface ThemeColorValues {
44
+ elements: ElementThemeColorValues;
45
+ relationships: RelationshipThemeColorValues;
46
+ }
47
+ type RelationshipThemeColors = {
48
+ [key in ThemeColor]: RelationshipThemeColorValues;
49
+ };
50
+ interface LikeC4Theme {
51
+ font: 'Arial';
52
+ shadow: ColorLiteral;
53
+ relationships: RelationshipThemeColors;
54
+ elements: ElementThemeColors;
55
+ sizes: {
56
+ [key in ShapeSize]: {
57
+ width: number;
58
+ height: number;
59
+ };
60
+ };
61
+ spacing: {
62
+ [key in SpacingSize]: number;
63
+ };
64
+ textSizes: {
65
+ [key in TextSize]: number;
66
+ };
67
+ }
68
+
69
+ export { BorderStyles as B, type ColorLiteral as C, ElementShapes as E, type HexColor as H, type LikeC4Theme as L, type RelationshipLineType as R, type SpacingSize as S, type TextSize as T, type ShapeSize as a, type BorderStyle as b, type ElementShape as c, type CustomColor as d, type CustomColorDefinitions as e, type RelationshipArrowType as f, ThemeColors as g, type ThemeColor as h, type Color as i, isThemeColor as j, type ElementThemeColorValues as k, type ElementThemeColors as l, type RelationshipThemeColorValues as m, type ThemeColorValues as n, type RelationshipThemeColors as o };
@@ -0,0 +1,41 @@
1
+ import { E as ElementModel, e as DeploymentElementModel } from './core.DrS4Bf4y.mjs';
2
+ import { A as Any } from './core.DAj3LuFH.mjs';
3
+ import { F as Fqn } from './core.668kXpZq.mjs';
4
+
5
+ interface Connection<Elem = ElementModel<Any> | DeploymentElementModel<Any>, Id = string> {
6
+ readonly id: Id;
7
+ readonly source: Elem;
8
+ readonly target: Elem;
9
+ /**
10
+ * Common ancestor of the source and target elements.
11
+ * Represents the boundary of the connection.
12
+ */
13
+ readonly boundary: Elem | null;
14
+ /**
15
+ * Human readable expression of the connection
16
+ * Mostly used for testing and debugging
17
+ */
18
+ readonly expression: string;
19
+ mergeWith(this: Connection<Elem, Id>, other: typeof this): typeof this;
20
+ nonEmpty(): boolean;
21
+ difference(this: Connection<Elem, Id>, other: typeof this): typeof this;
22
+ intersect(this: Connection<Elem, Id>, other: typeof this): typeof this;
23
+ equals(other: Connection): boolean;
24
+ }
25
+ declare namespace Connection {
26
+ type ConnectionPredicate = <C extends Connection<{
27
+ id: string;
28
+ }, any>>(connection: C) => boolean;
29
+ type ElementId = Fqn | string;
30
+ export const isInside: (fqn: ElementId) => ConnectionPredicate;
31
+ export const isDirectedBetween: (source: ElementId, target: ElementId) => ConnectionPredicate;
32
+ export const isAnyBetween: (source: ElementId, target: ElementId) => ConnectionPredicate;
33
+ export const isIncoming: (target: ElementId) => ConnectionPredicate;
34
+ export const isOutgoing: (source: ElementId) => ConnectionPredicate;
35
+ export const isAnyInOut: (source: ElementId) => ConnectionPredicate;
36
+ export { };
37
+ }
38
+
39
+ declare const customInspectSymbol: unique symbol;
40
+
41
+ export { Connection as C, customInspectSymbol as c };
@@ -1,5 +1,3 @@
1
- function t(r){return typeof r=="string"}
2
-
3
1
  function nonNullable(value, message) {
4
2
  if (typeof value === "undefined" || value == null) {
5
3
  const msg = typeof message === "function" ? message() : message;
@@ -17,4 +15,4 @@ function nonexhaustive(value) {
17
15
  throw new Error(`NonExhaustive value: ${value}`);
18
16
  }
19
17
 
20
- export { nonexhaustive as a, invariant as i, nonNullable as n, t };
18
+ export { nonNullable as a, invariant as i, nonexhaustive as n };