@likec4/core 1.38.0 → 1.39.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/builder/index.d.mts +6 -3
- package/dist/builder/index.mjs +55 -111
- package/dist/compute-view/index.d.mts +6 -3
- package/dist/compute-view/index.mjs +33 -34
- package/dist/compute-view/relationships-view/index.d.mts +6 -3
- package/dist/compute-view/relationships-view/index.mjs +6 -6
- package/dist/index.d.mts +8 -5
- package/dist/index.mjs +15 -24
- package/dist/model/connection/deployment/index.d.mts +8 -5
- package/dist/model/connection/deployment/index.mjs +7 -9
- package/dist/model/connection/index.d.mts +10 -7
- package/dist/model/connection/index.mjs +10 -14
- package/dist/model/connection/model/index.d.mts +8 -5
- package/dist/model/connection/model/index.mjs +7 -10
- package/dist/model/index.d.mts +13 -10
- package/dist/model/index.mjs +17 -20
- package/dist/shared/core.20m8Um0g.d.mts +253 -0
- package/dist/shared/{core.CpwrZi3D.mjs → core.4u1dVmfX.mjs} +3 -5
- package/dist/shared/{core.HUONfQfd.mjs → core.BB6zA-UU.mjs} +9 -214
- package/dist/shared/{core.C1GV0WWV.mjs → core.BVNaR17u.mjs} +1 -1
- package/dist/shared/{core.BL_xjl90.mjs → core.Be1n9a0i.mjs} +4 -5
- package/dist/shared/{core.BoyJPEen.mjs → core.Be4Jy9Qx.mjs} +2 -2
- package/dist/shared/{core.H8NbNp2X.mjs → core.BqVo8LrH.mjs} +1 -1
- package/dist/shared/{core.yaRvRnMW.mjs → core.BuoXfSMj.mjs} +1 -1
- package/dist/shared/{core.DhDo8LAz.d.mts → core.C7pZp1nR.d.mts} +3 -3
- package/dist/shared/{core.BH9nN-_I.mjs → core.CCD1ID81.mjs} +3 -4
- package/dist/shared/{core.8KM0D6va.mjs → core.CNGyqkJh.mjs} +1 -9
- package/dist/shared/{core.B0oEIXqd.mjs → core.CUw_2J9j.mjs} +1 -1
- package/dist/shared/{core.Y3j3s-oq.mjs → core.CWv15GLo.mjs} +11 -15
- package/dist/shared/{core.Bf5zKDK1.d.mts → core.CXCmvCws.d.mts} +2 -2
- package/dist/shared/core.CaT0SUUK.mjs +201 -0
- package/dist/shared/{core.Dtw1SBlz.d.mts → core.ClpXZ4Ib.d.mts} +3 -3
- package/dist/shared/{core.DyzAZvbX.mjs → core.CsbOakly.mjs} +13 -22
- package/dist/shared/{core.Btl47GOn.mjs → core.DLpidoWc.mjs} +2 -2
- package/dist/shared/{core.wwaSalox.d.mts → core.DM3vdkO_.d.mts} +1 -1
- package/dist/shared/core.DXhDWKFZ.d.mts +3 -0
- package/dist/shared/{core.O6FG0HF9.d.mts → core.DdzRtJ9d.d.mts} +1 -1
- package/dist/shared/{core.DQj9iv_y.mjs → core.DgttqsJc.mjs} +8 -11
- package/dist/shared/{core.b2BzqGz0.mjs → core.DlG1xWt2.mjs} +3 -43
- package/dist/shared/core.DnRszv-l.mjs +11982 -0
- package/dist/shared/core.DoM6aM9N.mjs +7 -0
- package/dist/shared/{core.DsznOb9G.mjs → core.DozSPE83.mjs} +43 -60
- package/dist/shared/{core.DsMrjY2q.mjs → core.GTgsmXS_.mjs} +2 -2
- package/dist/shared/core.ILwny7BV.mjs +38 -0
- package/dist/shared/core.PHwHXzkG.d.mts +213 -0
- package/dist/shared/core.T-eLZTW_.mjs +59 -0
- package/dist/shared/{core.CE_hG7EJ.d.mts → core.aWJgARyY.d.mts} +10 -486
- package/dist/shared/{core.BvlHvikl.d.mts → core.v1iEaXaR.d.mts} +5 -3
- package/dist/shared/core.yHe79zEl.mjs +98 -0
- package/dist/theme/index.d.mts +3 -126
- package/dist/theme/index.mjs +2 -3
- package/dist/types/_aux.d.mts +1 -1
- package/dist/types/expression-model.d.mts +191 -0
- package/dist/types/expression-model.mjs +112 -0
- package/dist/types/expression.d.mts +7 -0
- package/dist/types/expression.mjs +116 -0
- package/dist/types/fqnRef.d.mts +61 -0
- package/dist/types/fqnRef.mjs +46 -0
- package/dist/types/index.d.mts +6 -3
- package/dist/types/index.mjs +9 -9
- package/dist/types/scalar.mjs +2 -3
- package/dist/utils/index.d.mts +7 -429
- package/dist/utils/index.mjs +56 -15
- package/dist/utils/iterable/index.d.mts +2 -3
- package/dist/utils/iterable/index.mjs +9 -44
- package/package.json +9 -8
- package/src/index.ts +24 -1
- package/src/model/RelationModel.ts +1 -1
- package/src/model/index.ts +1 -1
- package/src/theme/element.ts +2 -2
- package/src/theme/relationships.ts +2 -2
- package/src/types/RichText.ts +1 -1
- package/src/types/expression-model.ts +3 -1
- package/src/types/expression.ts +3 -1
- package/src/types/fqnRef.ts +4 -1
- package/src/utils/compare-natural.ts +4 -2
- package/src/utils/guards.ts +0 -1
- package/src/utils/index.ts +0 -1
- package/dist/shared/core.BW8K1y6R.mjs +0 -278
- package/dist/shared/core.BgvIuGGU.mjs +0 -3
- package/dist/shared/core.BpJu1RrF.mjs +0 -5
- package/dist/shared/core.ByrmCl9I.mjs +0 -5
- package/dist/shared/core.CnIyafWn.mjs +0 -3
- package/dist/shared/core.DK6I-Nr7.mjs +0 -149
- package/dist/shared/core.DbRvwARP.mjs +0 -5
- package/dist/shared/core.YyjkRVss.mjs +0 -5236
- package/dist/shared/core.zLlww-07.mjs +0 -3
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +0 -425
- package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +0 -318
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +0 -221
- package/src/compute-view/deployment-view/__test__/TestHelper.ts +0 -249
- package/src/compute-view/deployment-view/__test__/fixture.ts +0 -238
- package/src/compute-view/dynamic-view/__test__/fixture.ts +0 -67
- package/src/compute-view/element-view/__test__/TestHelper.ts +0 -282
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +0 -458
- package/src/compute-view/element-view/__test__/fixture.ts +0 -749
- package/src/compute-view/utils/__snapshots__/sortNodes.spec.ts.snap +0 -113
- package/src/model/__test__/fixture.ts +0 -168
- package/src/theme/__test__/theme-index.ts +0 -29
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { p } from './core.
|
|
3
|
-
import { m as m$2 } from './core.ByrmCl9I.mjs';
|
|
4
|
-
import { i as i$2 } from './core.CpwrZi3D.mjs';
|
|
5
|
-
import { g as hierarchyLevel, n as nameFromFqn, i as isAncestor, d as commonAncestor, l as sortNaturalByFqn, m as sortParentsFirst, p as parentFqn, b as ancestorsFqn, C, a as compareNaturalHierarchically, c as compareNatural } from './core.DQj9iv_y.mjs';
|
|
1
|
+
import { unique, isTruthy, isEmpty, hasAtLeast, values, last, entries, pipe, map, sort, split, sortBy, prop } from 'remeda';
|
|
2
|
+
import { o as hierarchyLevel, n as nameFromFqn, i as isAncestor, g as commonAncestor, s as sortNaturalByFqn, f as sortParentsFirst, p as parentFqn, a as ancestorsFqn, k as compareNaturalHierarchically, j as compareNatural } from './core.DgttqsJc.mjs';
|
|
6
3
|
import { g as getOrCreate } from './core.DcS-0zys.mjs';
|
|
7
|
-
import {
|
|
8
|
-
import { D as DefaultMap } from './core.
|
|
4
|
+
import { e as DeploymentNodeModel, c as DeployedInstanceModel, g as DeploymentRelationModel, N as NestedElementOfDeployedInstanceModel } from './core.CsbOakly.mjs';
|
|
5
|
+
import { D as DefaultMap } from './core.BuoXfSMj.mjs';
|
|
9
6
|
import { i as invariant, a as nonNullable } from './core.D4npX2q8.mjs';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { a as DefaultElementShape, D as DefaultThemeColor, R as RichText, b as DefaultShapeSize, g as DefaultRelationshipColor, e as DefaultLineStyle } from './core.
|
|
16
|
-
import { a as ihead, i as ifind } from './core.
|
|
17
|
-
|
|
18
|
-
function r(...t){return u$1(Object.values,t)}
|
|
19
|
-
|
|
20
|
-
var T={asc:(r,n)=>r>n,desc:(r,n)=>r<n};function s(r,n){let[e,...o]=n;if(!m$1(e)){let t=u(...o);return r(e,t)}let a=u(e,...o);return t=>r(t,a)}function u(r,n,...e){let o=typeof r=="function"?r:r[0],a=typeof r=="function"?"asc":r[1],{[a]:t}=T,i=n===void 0?void 0:u(n,...e);return (y,c)=>{let p=o(y),l=o(c);return t(p,l)?1:t(l,p)?-1:i?.(y,c)??0}}function m$1(r){if(d(r))return true;if(typeof r!="object"||!Array.isArray(r))return false;let[n,e,...o]=r;return d(n)&&typeof e=="string"&&e in T&&o.length===0}var d=r=>typeof r=="function"&&r.length===1;
|
|
21
|
-
|
|
22
|
-
function i(t,e,n){return typeof e=="number"||e===void 0?r=>r.split(t,e):t.split(e,n)}
|
|
23
|
-
|
|
24
|
-
function m(...r){return u$1(o,r)}function o(r,t){let e=[...r];return e.sort(t),e}
|
|
25
|
-
|
|
26
|
-
function a$1(...r){return s(n$1,r)}var n$1=(r,t)=>[...r].sort(t);
|
|
27
|
-
|
|
28
|
-
function a(...e){return u$1(n,e)}var n=e=>e.at(-1);
|
|
29
|
-
|
|
30
|
-
function t(...r){return u$1(Object.entries,r)}
|
|
7
|
+
import { FqnRef } from '../types/fqnRef.mjs';
|
|
8
|
+
import { b as isDeploymentNode, a as _type, _ as _stage, i as isOnStage, w as whereOperatorAsPredicate } from './core.yHe79zEl.mjs';
|
|
9
|
+
import { m as memoizeProp } from './core.CUw_2J9j.mjs';
|
|
10
|
+
import { i as ifilter } from './core.CCD1ID81.mjs';
|
|
11
|
+
import { c as splitGlobalFqn, g as extractStep, e as isStepEdgeId, i as isGroupElementKind, b as isGlobalFqn, a as GlobalFqn } from './core.Be1n9a0i.mjs';
|
|
12
|
+
import { a as DefaultElementShape, D as DefaultThemeColor, R as RichText, b as DefaultShapeSize, g as DefaultRelationshipColor, e as DefaultLineStyle } from './core.BqVo8LrH.mjs';
|
|
13
|
+
import { a as ihead, i as ifind } from './core.GTgsmXS_.mjs';
|
|
31
14
|
|
|
32
15
|
class ElementModel {
|
|
33
16
|
constructor($model, $element) {
|
|
@@ -75,7 +58,7 @@ class ElementModel {
|
|
|
75
58
|
*/
|
|
76
59
|
get tags() {
|
|
77
60
|
return memoizeProp(this, Symbol.for("tags"), () => {
|
|
78
|
-
return
|
|
61
|
+
return unique([
|
|
79
62
|
...this.$element.tags ?? [],
|
|
80
63
|
...this.$model.specification.elements[this.$element.kind]?.tags ?? []
|
|
81
64
|
]);
|
|
@@ -233,13 +216,13 @@ class ElementModel {
|
|
|
233
216
|
* @returns true if the element is deployed
|
|
234
217
|
*/
|
|
235
218
|
isDeployed() {
|
|
236
|
-
return
|
|
219
|
+
return isTruthy(ihead(this.deployments()));
|
|
237
220
|
}
|
|
238
221
|
deployments() {
|
|
239
222
|
return this.$model.deployment.instancesOf(this);
|
|
240
223
|
}
|
|
241
224
|
hasMetadata() {
|
|
242
|
-
return !!this.$element.metadata && !
|
|
225
|
+
return !!this.$element.metadata && !isEmpty(this.$element.metadata);
|
|
243
226
|
}
|
|
244
227
|
getMetadata(field) {
|
|
245
228
|
if (field) {
|
|
@@ -263,7 +246,7 @@ const splitViewTitle = (title) => {
|
|
|
263
246
|
invariant(!title.includes("\n"), "View title cannot contain newlines");
|
|
264
247
|
if (title.includes(VIEW_FOLDERS_SEPARATOR)) {
|
|
265
248
|
const segments = title.split(VIEW_FOLDERS_SEPARATOR).map((s) => s.trim()).filter((s) => s.length > 0);
|
|
266
|
-
if (
|
|
249
|
+
if (hasAtLeast(segments, 1)) {
|
|
267
250
|
return segments;
|
|
268
251
|
}
|
|
269
252
|
return [""];
|
|
@@ -275,7 +258,7 @@ const normalizeViewPath = (title) => {
|
|
|
275
258
|
};
|
|
276
259
|
const getViewFolderPath = (title) => {
|
|
277
260
|
const segments = splitViewTitle(title);
|
|
278
|
-
if (!
|
|
261
|
+
if (!hasAtLeast(segments, 2)) {
|
|
279
262
|
return null;
|
|
280
263
|
}
|
|
281
264
|
return segments.slice(0, -1).join(VIEW_FOLDERS_SEPARATOR);
|
|
@@ -291,7 +274,7 @@ class LikeC4DeploymentModel {
|
|
|
291
274
|
constructor($model) {
|
|
292
275
|
this.$model = $model;
|
|
293
276
|
const $deployments = this.$deployments = $model.$data.deployments;
|
|
294
|
-
const elements =
|
|
277
|
+
const elements = values($deployments.elements);
|
|
295
278
|
for (const element of sortParentsFirst(elements)) {
|
|
296
279
|
const el = this.addElement(element);
|
|
297
280
|
for (const tag of el.tags) {
|
|
@@ -301,7 +284,7 @@ class LikeC4DeploymentModel {
|
|
|
301
284
|
this.#instancesOf.get(el.element.id).add(el);
|
|
302
285
|
}
|
|
303
286
|
}
|
|
304
|
-
for (const relation of
|
|
287
|
+
for (const relation of values($deployments.relations)) {
|
|
305
288
|
const el = this.addRelation(relation);
|
|
306
289
|
for (const tag of el.tags) {
|
|
307
290
|
this.#allTags.get(tag).add(el);
|
|
@@ -614,13 +597,13 @@ class RelationshipModel {
|
|
|
614
597
|
return `${this.source.id} -> ${this.target.id}`;
|
|
615
598
|
}
|
|
616
599
|
get title() {
|
|
617
|
-
if (!
|
|
600
|
+
if (!isTruthy(this.$relationship.title)) {
|
|
618
601
|
return null;
|
|
619
602
|
}
|
|
620
603
|
return this.$relationship.title;
|
|
621
604
|
}
|
|
622
605
|
get technology() {
|
|
623
|
-
if (!
|
|
606
|
+
if (!isTruthy(this.$relationship.technology)) {
|
|
624
607
|
return null;
|
|
625
608
|
}
|
|
626
609
|
return this.$relationship.technology;
|
|
@@ -664,7 +647,7 @@ class RelationshipModel {
|
|
|
664
647
|
return true;
|
|
665
648
|
}
|
|
666
649
|
hasMetadata() {
|
|
667
|
-
return !!this.$relationship.metadata && !
|
|
650
|
+
return !!this.$relationship.metadata && !isEmpty(this.$relationship.metadata);
|
|
668
651
|
}
|
|
669
652
|
getMetadata(field) {
|
|
670
653
|
if (field) {
|
|
@@ -886,13 +869,13 @@ class NodeModel {
|
|
|
886
869
|
* Check if this node references to logical model element.
|
|
887
870
|
*/
|
|
888
871
|
hasElement() {
|
|
889
|
-
return
|
|
872
|
+
return isTruthy(this.#node.modelRef);
|
|
890
873
|
}
|
|
891
874
|
/**
|
|
892
875
|
* Check if this node references to deployment element (Node or Instance).
|
|
893
876
|
*/
|
|
894
877
|
hasDeployment() {
|
|
895
|
-
return
|
|
878
|
+
return isTruthy(this.#node.deploymentRef);
|
|
896
879
|
}
|
|
897
880
|
/**
|
|
898
881
|
* Check if this node references to deployed instance
|
|
@@ -1147,7 +1130,7 @@ class LikeC4ViewModel {
|
|
|
1147
1130
|
return this.$view[_type] === "element";
|
|
1148
1131
|
}
|
|
1149
1132
|
isScopedElementView() {
|
|
1150
|
-
return this.$view[_type] === "element" &&
|
|
1133
|
+
return this.$view[_type] === "element" && isTruthy(this.$view.viewOf);
|
|
1151
1134
|
}
|
|
1152
1135
|
isDeploymentView() {
|
|
1153
1136
|
return this.$view[_type] === "deployment";
|
|
@@ -1189,7 +1172,7 @@ class LikeC4ViewsFolder {
|
|
|
1189
1172
|
this.$model = $model;
|
|
1190
1173
|
this.path = path.join("/");
|
|
1191
1174
|
this.isRoot = this.path === "";
|
|
1192
|
-
this.title =
|
|
1175
|
+
this.title = last(path);
|
|
1193
1176
|
if (this.isRoot) {
|
|
1194
1177
|
this.parentPath = void 0;
|
|
1195
1178
|
} else {
|
|
@@ -1244,7 +1227,7 @@ class LikeC4ViewsFolder {
|
|
|
1244
1227
|
*/
|
|
1245
1228
|
get parent() {
|
|
1246
1229
|
invariant(!this.isRoot, "Root view folder has no parent");
|
|
1247
|
-
if (
|
|
1230
|
+
if (isEmpty(this.parentPath)) {
|
|
1248
1231
|
return null;
|
|
1249
1232
|
}
|
|
1250
1233
|
return this.$model.viewFolder(this.parentPath);
|
|
@@ -1365,13 +1348,13 @@ class LikeC4Model {
|
|
|
1365
1348
|
$data;
|
|
1366
1349
|
constructor($data) {
|
|
1367
1350
|
this.$data = $data;
|
|
1368
|
-
for (const [, element] of
|
|
1351
|
+
for (const [, element] of entries($data.elements)) {
|
|
1369
1352
|
const el = this.addElement(element);
|
|
1370
1353
|
for (const tag of el.tags) {
|
|
1371
1354
|
this._allTags.get(tag).add(el);
|
|
1372
1355
|
}
|
|
1373
1356
|
}
|
|
1374
|
-
for (const [projectId, elements] of
|
|
1357
|
+
for (const [projectId, elements] of entries($data.imports ?? {})) {
|
|
1375
1358
|
for (const element of sortParentsFirst(elements)) {
|
|
1376
1359
|
const el = this.addImportedElement(projectId, element);
|
|
1377
1360
|
for (const tag of el.tags) {
|
|
@@ -1379,7 +1362,7 @@ class LikeC4Model {
|
|
|
1379
1362
|
}
|
|
1380
1363
|
}
|
|
1381
1364
|
}
|
|
1382
|
-
for (const relation of
|
|
1365
|
+
for (const relation of values($data.relations)) {
|
|
1383
1366
|
const el = this.addRelation(relation);
|
|
1384
1367
|
for (const tag of el.tags) {
|
|
1385
1368
|
this._allTags.get(tag).add(el);
|
|
@@ -1388,21 +1371,21 @@ class LikeC4Model {
|
|
|
1388
1371
|
this.deployment = new LikeC4DeploymentModel(this);
|
|
1389
1372
|
if (isOnStage($data, "computed") || isOnStage($data, "layouted")) {
|
|
1390
1373
|
const compare = compareNaturalHierarchically(VIEW_FOLDERS_SEPARATOR);
|
|
1391
|
-
const views =
|
|
1392
|
-
|
|
1393
|
-
|
|
1374
|
+
const views = pipe(
|
|
1375
|
+
values($data.views),
|
|
1376
|
+
map((view) => ({
|
|
1394
1377
|
view,
|
|
1395
1378
|
path: normalizeViewPath(view.title ?? view.id),
|
|
1396
1379
|
folderPath: view.title && getViewFolderPath(view.title) || ""
|
|
1397
1380
|
})),
|
|
1398
1381
|
// Sort hierarchically by groups, but keep same order within groups
|
|
1399
|
-
|
|
1382
|
+
sort((a, b) => compare(a.folderPath, b.folderPath))
|
|
1400
1383
|
);
|
|
1401
1384
|
const getOrCreateFolder = (path) => {
|
|
1402
1385
|
let folder = this._viewFolders.get(path);
|
|
1403
1386
|
if (!folder) {
|
|
1404
|
-
const segments =
|
|
1405
|
-
invariant(
|
|
1387
|
+
const segments = split(path, VIEW_FOLDERS_SEPARATOR);
|
|
1388
|
+
invariant(hasAtLeast(segments, 1), `View group path "${path}" must have at least one element`);
|
|
1406
1389
|
let defaultView;
|
|
1407
1390
|
if (path === "") {
|
|
1408
1391
|
defaultView = views.find((view) => view.view.id === "index");
|
|
@@ -1419,7 +1402,7 @@ class LikeC4Model {
|
|
|
1419
1402
|
if (this._viewFolders.has(folderPath)) {
|
|
1420
1403
|
continue;
|
|
1421
1404
|
}
|
|
1422
|
-
|
|
1405
|
+
split(folderPath, VIEW_FOLDERS_SEPARATOR).reduce((parent, segment) => {
|
|
1423
1406
|
const path = [...parent, segment];
|
|
1424
1407
|
const folder = getOrCreateFolder(path.join(VIEW_FOLDERS_SEPARATOR));
|
|
1425
1408
|
this._viewFolderItems.get(parent.join(VIEW_FOLDERS_SEPARATOR)).add(folder);
|
|
@@ -1749,22 +1732,22 @@ class LikeC4Model {
|
|
|
1749
1732
|
* Use {@link specification.tags} to get all defined tags
|
|
1750
1733
|
*/
|
|
1751
1734
|
get tags() {
|
|
1752
|
-
return memoizeProp(this, "tags", () =>
|
|
1735
|
+
return memoizeProp(this, "tags", () => sort([...this._allTags.keys()], compareNatural));
|
|
1753
1736
|
}
|
|
1754
1737
|
/**
|
|
1755
1738
|
* Returns all tags used in the model, sorted by usage count (descending).
|
|
1756
1739
|
*/
|
|
1757
1740
|
get tagsSortedByUsage() {
|
|
1758
|
-
return memoizeProp(this, "tagsSortedByUsage", () =>
|
|
1741
|
+
return memoizeProp(this, "tagsSortedByUsage", () => pipe(
|
|
1759
1742
|
[...this._allTags.entries()],
|
|
1760
|
-
|
|
1743
|
+
map(([tag, tagged]) => ({
|
|
1761
1744
|
tag,
|
|
1762
1745
|
count: tagged.size,
|
|
1763
1746
|
tagged
|
|
1764
1747
|
})),
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
[
|
|
1748
|
+
sort((a, b) => compareNatural(a.tag, b.tag)),
|
|
1749
|
+
sortBy(
|
|
1750
|
+
[prop("count"), "desc"]
|
|
1768
1751
|
)
|
|
1769
1752
|
));
|
|
1770
1753
|
}
|
|
@@ -1980,4 +1963,4 @@ function isEdgeModel(edge) {
|
|
|
1980
1963
|
return edge instanceof EdgeModel;
|
|
1981
1964
|
}
|
|
1982
1965
|
|
|
1983
|
-
export { ElementModel as E, LikeC4Model as L, NodeModel as N, RelationshipModel as R, VIEW_FOLDERS_SEPARATOR as V, LikeC4DeploymentModel as a, EdgeModel as b, LikeC4ViewModel as c, LikeC4ViewsFolder as d, extractViewTitleFromPath as e, isDeployedInstanceModel as f, getViewFolderPath as g, isDeploymentElementModel as h, isDeploymentNodeModel as i, isNestedElementOfDeployedInstanceModel as j, isDeploymentRelationModel as k, isRelationModel as l, isElementModel as m, normalizeViewPath as n, isLikeC4ViewModel as o, isNodeModel as p, isEdgeModel as q
|
|
1966
|
+
export { ElementModel as E, LikeC4Model as L, NodeModel as N, RelationshipModel as R, VIEW_FOLDERS_SEPARATOR as V, LikeC4DeploymentModel as a, EdgeModel as b, LikeC4ViewModel as c, LikeC4ViewsFolder as d, extractViewTitleFromPath as e, isDeployedInstanceModel as f, getViewFolderPath as g, isDeploymentElementModel as h, isDeploymentNodeModel as i, isNestedElementOfDeployedInstanceModel as j, isDeploymentRelationModel as k, isRelationModel as l, isElementModel as m, normalizeViewPath as n, isLikeC4ViewModel as o, isNodeModel as p, isEdgeModel as q };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isFunction } from 'remeda';
|
|
2
2
|
import { i as invariant } from './core.D4npX2q8.mjs';
|
|
3
3
|
|
|
4
4
|
function ifind(arg1, arg2) {
|
|
5
5
|
const pred = arg2 ?? arg1;
|
|
6
|
-
invariant(
|
|
6
|
+
invariant(isFunction(pred));
|
|
7
7
|
function _find(iter) {
|
|
8
8
|
for (const value of iter) {
|
|
9
9
|
if (pred(value)) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { i as invariant } from './core.D4npX2q8.mjs';
|
|
2
|
+
import { isDefined, isFunction } from 'remeda';
|
|
3
|
+
|
|
4
|
+
function ifirst(arg1, arg2) {
|
|
5
|
+
const count = arg2 ?? arg1;
|
|
6
|
+
invariant(typeof count === "number" && count >= 0, "Count must be a non-negative number");
|
|
7
|
+
function* _first(iter) {
|
|
8
|
+
let taken = 0;
|
|
9
|
+
for (const value of iter) {
|
|
10
|
+
if (taken >= count) {
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
yield value;
|
|
14
|
+
taken++;
|
|
15
|
+
}
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (arg2 === void 0) {
|
|
19
|
+
return (iterable) => _first(iterable);
|
|
20
|
+
}
|
|
21
|
+
return _first(arg1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function ireduce(arg1, arg2, arg3) {
|
|
25
|
+
const reducer = isDefined(arg3) ? arg2 : arg1;
|
|
26
|
+
const initialValue = arg3 ?? arg2;
|
|
27
|
+
invariant(isFunction(reducer));
|
|
28
|
+
function _reduce(iter) {
|
|
29
|
+
let acc = initialValue;
|
|
30
|
+
for (const value of iter) {
|
|
31
|
+
acc = reducer(acc, value);
|
|
32
|
+
}
|
|
33
|
+
return acc;
|
|
34
|
+
}
|
|
35
|
+
return isDefined(arg3) ? _reduce(arg1) : _reduce;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { ireduce as a, ifirst as i };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { N as NonEmptyArray } from './core.DuSLYTG6.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mnemonist DefaultWeakMap Typings
|
|
5
|
+
* ================================
|
|
6
|
+
*/
|
|
7
|
+
declare class DefaultWeakMap<K extends object, V> {
|
|
8
|
+
|
|
9
|
+
// Constructor
|
|
10
|
+
constructor(factory: (key: K) => V);
|
|
11
|
+
|
|
12
|
+
// Methods
|
|
13
|
+
clear(): void;
|
|
14
|
+
set(key: K, value: V): this;
|
|
15
|
+
delete(key: K): boolean;
|
|
16
|
+
has(key: K): boolean;
|
|
17
|
+
get(key: K): V;
|
|
18
|
+
peek(key: K): V | undefined;
|
|
19
|
+
inspect(): any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Mnemonist LinkedList Typings
|
|
24
|
+
* =============================
|
|
25
|
+
*/
|
|
26
|
+
declare class LinkedList<T> implements Iterable<T> {
|
|
27
|
+
|
|
28
|
+
// Members
|
|
29
|
+
size: number;
|
|
30
|
+
|
|
31
|
+
// Constructor
|
|
32
|
+
constructor();
|
|
33
|
+
|
|
34
|
+
// Methods
|
|
35
|
+
clear(): void;
|
|
36
|
+
first(): T | undefined;
|
|
37
|
+
last(): T | undefined;
|
|
38
|
+
peek(): T | undefined;
|
|
39
|
+
push(value: T): number;
|
|
40
|
+
shift(): T | undefined;
|
|
41
|
+
unshift(value: T): number;
|
|
42
|
+
forEach(callback: (value: T, index: number, list: this) => void, scope?: any): void;
|
|
43
|
+
toArray(): Array<T>;
|
|
44
|
+
values(): IterableIterator<T>;
|
|
45
|
+
entries(): IterableIterator<[number, T]>;
|
|
46
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
47
|
+
toString(): string;
|
|
48
|
+
toJSON(): Array<T>;
|
|
49
|
+
inspect(): any;
|
|
50
|
+
|
|
51
|
+
// Statics
|
|
52
|
+
static from<I>(iterable: Iterable<I> | {[key: string]: I}): LinkedList<I>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Mnemonist Queue Typings
|
|
57
|
+
* ========================
|
|
58
|
+
*/
|
|
59
|
+
declare class Queue<T> implements Iterable<T> {
|
|
60
|
+
|
|
61
|
+
// Members
|
|
62
|
+
size: number;
|
|
63
|
+
|
|
64
|
+
// Constructor
|
|
65
|
+
constructor();
|
|
66
|
+
|
|
67
|
+
// Methods
|
|
68
|
+
clear(): void;
|
|
69
|
+
enqueue(item: T): number;
|
|
70
|
+
dequeue(): T | undefined;
|
|
71
|
+
peek(): T | undefined;
|
|
72
|
+
forEach(callback: (item: T, index: number, queue: this) => void, scope?: any): void;
|
|
73
|
+
toArray(): Array<T>;
|
|
74
|
+
values(): IterableIterator<T>;
|
|
75
|
+
entries(): IterableIterator<[number, T]>;
|
|
76
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
77
|
+
toString(): string;
|
|
78
|
+
toJSON(): Array<T>;
|
|
79
|
+
inspect(): any;
|
|
80
|
+
|
|
81
|
+
// Statics
|
|
82
|
+
static from<I>(iterable: Iterable<I> | {[key: string]: I}): Queue<I>;
|
|
83
|
+
static of<I>(...items: Array<I>): Queue<I>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface MultiMapConstructor {
|
|
87
|
+
new <K, V>(container: SetConstructor): MultiMap<K, V, Set<V>>;
|
|
88
|
+
new <K, V>(container?: ArrayConstructor): MultiMap<K, V, V[]>;
|
|
89
|
+
|
|
90
|
+
from<K, V>(
|
|
91
|
+
iterable: Iterable<[K, V]> | {[key: string]: V},
|
|
92
|
+
Container: SetConstructor
|
|
93
|
+
): MultiMap<K, V, Set<V>>;
|
|
94
|
+
from<K, V>(
|
|
95
|
+
iterable: Iterable<[K, V]> | {[key: string]: V},
|
|
96
|
+
Container?: ArrayConstructor
|
|
97
|
+
): MultiMap<K, V, V[]>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Mnemonist MultiMap Typings
|
|
101
|
+
* ===========================
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
interface MultiMap<K, V, C extends V[] | Set<V> = V[]> extends Iterable<[K, V]> {
|
|
105
|
+
|
|
106
|
+
// Members
|
|
107
|
+
dimension: number;
|
|
108
|
+
size: number;
|
|
109
|
+
|
|
110
|
+
// Methods
|
|
111
|
+
clear(): void;
|
|
112
|
+
set(key: K, value: V): this;
|
|
113
|
+
delete(key: K): boolean;
|
|
114
|
+
remove(key: K, value: V): boolean;
|
|
115
|
+
has(key: K): boolean;
|
|
116
|
+
get(key: K): C | undefined;
|
|
117
|
+
multiplicity(key: K): number;
|
|
118
|
+
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
119
|
+
forEachAssociation(callback: (value: C, key: K, map: this) => void, scope?: any): void;
|
|
120
|
+
keys(): IterableIterator<K>;
|
|
121
|
+
values(): IterableIterator<V>;
|
|
122
|
+
entries(): IterableIterator<[K, V]>;
|
|
123
|
+
containers(): IterableIterator<C>;
|
|
124
|
+
associations(): IterableIterator<[K, C]>;
|
|
125
|
+
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
126
|
+
inspect(): any;
|
|
127
|
+
toJSON(): any;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare const MultiMap: MultiMapConstructor;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Mnemonist BiMap Typings
|
|
134
|
+
* ========================
|
|
135
|
+
*/
|
|
136
|
+
declare class InverseMap<K, V> implements Iterable<[K, V]> {
|
|
137
|
+
|
|
138
|
+
// Members
|
|
139
|
+
size: number;
|
|
140
|
+
inverse: BiMap<V, K>;
|
|
141
|
+
|
|
142
|
+
// Constructor
|
|
143
|
+
constructor(original: BiMap<K, V>);
|
|
144
|
+
|
|
145
|
+
// Methods
|
|
146
|
+
clear(): void;
|
|
147
|
+
set(key: K, value: V): this;
|
|
148
|
+
delete(key: K): boolean;
|
|
149
|
+
has(key: K): boolean;
|
|
150
|
+
get(key: K): V | undefined;
|
|
151
|
+
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
152
|
+
keys(): IterableIterator<K>;
|
|
153
|
+
values(): IterableIterator<V>;
|
|
154
|
+
entries(): IterableIterator<[K, V]>;
|
|
155
|
+
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
156
|
+
inspect(): any;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
declare class BiMap<K, V> implements Iterable<[K, V]> {
|
|
160
|
+
|
|
161
|
+
// Members
|
|
162
|
+
size: number;
|
|
163
|
+
inverse: InverseMap<V, K>;
|
|
164
|
+
|
|
165
|
+
// Constructor
|
|
166
|
+
constructor();
|
|
167
|
+
|
|
168
|
+
// Methods
|
|
169
|
+
clear(): void;
|
|
170
|
+
set(key: K, value: V): this;
|
|
171
|
+
delete(key: K): boolean;
|
|
172
|
+
has(key: K): boolean;
|
|
173
|
+
get(key: K): V | undefined;
|
|
174
|
+
forEach(callback: (value: V, key: K, map: this) => void, scope?: any): void;
|
|
175
|
+
keys(): IterableIterator<K>;
|
|
176
|
+
values(): IterableIterator<V>;
|
|
177
|
+
entries(): IterableIterator<[K, V]>;
|
|
178
|
+
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
179
|
+
inspect(): any;
|
|
180
|
+
|
|
181
|
+
// Statics
|
|
182
|
+
static from<I, J>(iterable: Iterable<[I, J]> | {[key: string]: J}): BiMap<I, J>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
declare function nonNullable<T>(value: T, message?: string | (() => string)): NonNullable<T>;
|
|
186
|
+
declare function invariant(condition: any, message?: string): asserts condition;
|
|
187
|
+
declare function nonexhaustive(value: never): never;
|
|
188
|
+
|
|
189
|
+
declare function isString(value: unknown): value is string;
|
|
190
|
+
declare function isNonEmptyArray<A>(arr: ArrayLike<A> | undefined): arr is NonEmptyArray<A>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Saves the value returned by fn() in a hidden property tag of obj object, so next time memoizeProp() is called,
|
|
194
|
+
* that value will be returned, and fn won't be called.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```ts
|
|
198
|
+
* class Model {
|
|
199
|
+
* // using same Symbol
|
|
200
|
+
* get computed1() {
|
|
201
|
+
* return memoizeProp(this, Symbol.for('computed1'), () => doOnce())
|
|
202
|
+
* }
|
|
203
|
+
* // using string
|
|
204
|
+
* get computed2() {
|
|
205
|
+
* return memoizeProp(this, 'computed2', () => doOnce())
|
|
206
|
+
* }
|
|
207
|
+
*
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
declare function memoizeProp<Tag extends symbol | string, Res>(obj: object, tag: Tag, fn: () => Res): Res;
|
|
212
|
+
|
|
213
|
+
export { BiMap as B, DefaultWeakMap as D, LinkedList as L, MultiMap as M, Queue as Q, isNonEmptyArray as a, isString as b, nonNullable as c, invariant as i, memoizeProp as m, nonexhaustive as n };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isTruthy, isArray } from 'remeda';
|
|
2
|
+
import { e as isStepEdgeId } from './core.Be1n9a0i.mjs';
|
|
3
|
+
|
|
4
|
+
function isViewRulePredicate(rule) {
|
|
5
|
+
return "include" in rule || "exclude" in rule;
|
|
6
|
+
}
|
|
7
|
+
function isViewRuleStyle(rule) {
|
|
8
|
+
return "targets" in rule && "style" in rule;
|
|
9
|
+
}
|
|
10
|
+
function isComputedView(view) {
|
|
11
|
+
return view._stage === "computed";
|
|
12
|
+
}
|
|
13
|
+
function isDiagramView(view) {
|
|
14
|
+
return view._stage === "layouted";
|
|
15
|
+
}
|
|
16
|
+
function isElementView(view) {
|
|
17
|
+
return view._type === "element";
|
|
18
|
+
}
|
|
19
|
+
function isScopedElementView(view) {
|
|
20
|
+
return isElementView(view) && isTruthy(view.viewOf);
|
|
21
|
+
}
|
|
22
|
+
function isExtendsElementView(view) {
|
|
23
|
+
return isElementView(view) && isTruthy(view.extends);
|
|
24
|
+
}
|
|
25
|
+
function isDeploymentView(view) {
|
|
26
|
+
return view._type === "deployment";
|
|
27
|
+
}
|
|
28
|
+
function isDynamicView(view) {
|
|
29
|
+
return view._type === "dynamic";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function isViewRuleGlobalStyle(rule) {
|
|
33
|
+
return "styleId" in rule;
|
|
34
|
+
}
|
|
35
|
+
function isViewRuleGlobalPredicateRef(rule) {
|
|
36
|
+
return "predicateId" in rule;
|
|
37
|
+
}
|
|
38
|
+
function isAutoLayoutDirection(autoLayout) {
|
|
39
|
+
return autoLayout === "TB" || autoLayout === "BT" || autoLayout === "LR" || autoLayout === "RL";
|
|
40
|
+
}
|
|
41
|
+
function isViewRuleAutoLayout(rule) {
|
|
42
|
+
return "direction" in rule;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getParallelStepsPrefix(id) {
|
|
46
|
+
if (isStepEdgeId(id) && id.includes(".")) {
|
|
47
|
+
return id.slice(0, id.indexOf(".") + 1);
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function isDynamicViewParallelSteps(step) {
|
|
52
|
+
return "__parallel" in step && isArray(step.__parallel);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isViewRuleGroup(rule) {
|
|
56
|
+
return "title" in rule && "groupRules" in rule && Array.isArray(rule.groupRules);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { isViewRuleStyle as a, isComputedView as b, isDiagramView as c, isElementView as d, isScopedElementView as e, isExtendsElementView as f, isDeploymentView as g, isDynamicView as h, isViewRulePredicate as i, isViewRuleGlobalStyle as j, isViewRuleGlobalPredicateRef as k, isAutoLayoutDirection as l, isViewRuleAutoLayout as m, getParallelStepsPrefix as n, isDynamicViewParallelSteps as o, isViewRuleGroup as p };
|