@likec4/core 1.41.0 → 1.42.1
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/builder/package.json +4 -0
- package/compute-view/package.json +4 -0
- package/compute-view/relationships/package.json +4 -0
- package/dist/builder/index.d.mts +13 -11
- package/dist/builder/index.mjs +111 -91
- package/dist/compute-view/index.d.mts +8 -7
- package/dist/compute-view/index.mjs +14 -11
- package/dist/compute-view/relationships-view/index.d.mts +9 -8
- package/dist/compute-view/relationships-view/index.mjs +6 -6
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +11 -11
- package/dist/model/connection/deployment/index.d.mts +11 -10
- package/dist/model/connection/deployment/index.mjs +2 -2
- package/dist/model/connection/index.d.mts +12 -11
- package/dist/model/connection/index.mjs +3 -3
- package/dist/model/connection/model/index.d.mts +11 -10
- package/dist/model/connection/model/index.mjs +2 -2
- package/dist/model/index.d.mts +14 -14
- package/dist/model/index.mjs +4 -5
- package/dist/shared/{core.Ae86Y3tB.mjs → core.01VTr9qu.mjs} +8 -26
- package/dist/shared/core.1vX5a9AY.mjs +86 -0
- package/dist/shared/{core.BVNaR17u.mjs → core.B7KhhkRY.mjs} +1 -1
- package/dist/shared/core.B85MJLTf.mjs +5 -0
- package/dist/shared/{core.DA5vzwZ9.mjs → core.BIqHjQiH.mjs} +56 -42
- package/dist/shared/core.BKlholso.mjs +3 -0
- package/dist/shared/core.BR4zXDH-.mjs +13 -0
- package/dist/shared/{core.CXy1NLUG.mjs → core.BYNkXQ8A.mjs} +21 -12
- package/dist/shared/{core.BuoXfSMj.mjs → core.BbE4y-yl.mjs} +1 -1
- package/dist/shared/core.BoYfZOBm.mjs +3 -0
- package/dist/shared/core.BsSXS-_R.mjs +7 -0
- package/dist/shared/{core.DJp8fgok.mjs → core.BzTakU3I.mjs} +14 -10
- package/dist/shared/{core.4u1dVmfX.mjs → core.C2TiyjI6.mjs} +2 -2
- package/dist/shared/{core.DLpidoWc.mjs → core.C3JowhaZ.mjs} +3 -3
- package/dist/shared/{core.CNGyqkJh.mjs → core.C4x8aaWa.mjs} +3 -1
- package/dist/shared/{core.BB6zA-UU.mjs → core.C8YY6Uub.mjs} +38 -9
- package/dist/shared/{core.Asc11Mjy.mjs → core.C8sl5Y8Z.mjs} +122 -58
- package/dist/shared/{core.BvMRMo7Z.mjs → core.CNgZvKb8.mjs} +3 -5198
- package/dist/shared/{core.CUG6vpyL.d.mts → core.CQngdcuj.d.mts} +85 -4
- package/dist/shared/{core.Be1n9a0i.mjs → core.C_Ni6yHl.mjs} +5 -4
- package/dist/shared/core.CbT8JVYL.mjs +5 -0
- package/dist/shared/core.CqAJJpK_.mjs +3 -0
- package/dist/shared/{core.BXsxn-hf.d.mts → core.D0PjZzIS.d.mts} +27 -15
- package/dist/shared/{core.DgesAwC8.d.mts → core.D5fzJWbF.d.mts} +2 -2
- package/dist/shared/{core.hfOE3RfK.d.mts → core.DACpKp35.d.mts} +5 -5
- package/dist/shared/core.DFi2dOTl.mjs +39548 -0
- package/dist/shared/{core.xSQO0XYD.d.mts → core.DIol3syK.d.mts} +2 -2
- package/dist/shared/{core.DlG1xWt2.mjs → core.DMMOWQqc.mjs} +3 -2
- package/dist/shared/core.DNbUPnve.mjs +3990 -0
- package/dist/shared/{core.CCD1ID81.mjs → core.DRJma0Ol.mjs} +4 -3
- package/dist/shared/{core.DgttqsJc.mjs → core.DRhg-gVU.mjs} +9 -9
- package/dist/shared/core.DSO_rTC2.mjs +5322 -0
- package/dist/shared/{core.FUPplpae.d.mts → core.D_vkffV4.d.mts} +4 -2
- package/dist/shared/core.DdMJk7nx.d.mts +476 -0
- package/dist/shared/{core.BhpgpOep.d.mts → core.Dgs6-nuz.d.mts} +2 -2
- package/dist/shared/{core.Be4Jy9Qx.mjs → core.FZ305VYd.mjs} +2 -2
- package/dist/shared/core.OHD4KXm9.mjs +5 -0
- package/dist/shared/{core.GTgsmXS_.mjs → core.QJD_fcrc.mjs} +2 -2
- package/dist/shared/core.RfnaEmgA.mjs +7 -0
- package/dist/shared/core.fHR_8Tnq.d.mts +450 -0
- package/dist/shared/{core.D0EgVMQK.mjs → core.lRvxPoao.mjs} +14 -12
- package/dist/shared/{core.CaT0SUUK.mjs → core.rCeaAqgW.mjs} +1 -84
- package/dist/shared/{core.zxTBF_PD.d.mts → core.s9uwOt60.d.mts} +4 -4
- package/dist/shared/core.yna0OdV5.d.mts +98 -0
- package/dist/styles/index.d.mts +106 -0
- package/dist/styles/index.mjs +1 -0
- package/dist/types/_aux.d.mts +2 -2
- package/dist/types/expression-model.d.mts +3 -4
- package/dist/types/expression.d.mts +3 -4
- package/dist/types/fqnRef.d.mts +2 -2
- package/dist/types/fqnRef.mjs +3 -3
- package/dist/types/index.d.mts +8 -8
- package/dist/types/index.mjs +150 -5
- package/dist/types/scalar.mjs +3 -2
- package/dist/utils/graphology/index.d.mts +1864 -0
- package/dist/utils/graphology/index.mjs +1 -0
- package/dist/utils/index.d.mts +11 -6
- package/dist/utils/index.mjs +21 -37
- package/dist/utils/iterable/index.d.mts +1 -1
- package/dist/utils/iterable/index.mjs +45 -7
- package/model/package.json +4 -0
- package/package.json +42 -24
- package/styles/package.json +4 -0
- package/types/package.json +4 -0
- package/utils/graphology/package.json +4 -0
- package/utils/package.json +4 -0
- package/dist/shared/core.6_Vp2iiN.mjs +0 -172
- package/dist/shared/core.CUw_2J9j.mjs +0 -47
- package/dist/shared/core.CzdwsPmY.d.mts +0 -69
- package/dist/shared/core.D-ZGWDDt.d.mts +0 -831
- package/dist/shared/core.DoM6aM9N.mjs +0 -7
- package/dist/shared/core.ILwny7BV.mjs +0 -38
- package/dist/theme/index.d.mts +0 -11
- package/dist/theme/index.mjs +0 -232
- package/src/builder/Builder.deployment.ts +0 -224
- package/src/builder/Builder.deploymentModel.ts +0 -449
- package/src/builder/Builder.element.ts +0 -241
- package/src/builder/Builder.model.ts +0 -494
- package/src/builder/Builder.ts +0 -946
- package/src/builder/Builder.view-common.ts +0 -273
- package/src/builder/Builder.view-deployment.ts +0 -135
- package/src/builder/Builder.view-element.ts +0 -202
- package/src/builder/Builder.views.ts +0 -399
- package/src/builder/Builder.with.ts +0 -156
- package/src/builder/_types.ts +0 -324
- package/src/builder/index.ts +0 -11
- package/src/compute-view/compute-view.ts +0 -80
- package/src/compute-view/deployment-view/_types.ts +0 -38
- package/src/compute-view/deployment-view/clean-connections.ts +0 -236
- package/src/compute-view/deployment-view/compute.ts +0 -94
- package/src/compute-view/deployment-view/memory/index.ts +0 -9
- package/src/compute-view/deployment-view/memory/memory.ts +0 -96
- package/src/compute-view/deployment-view/predicates/deploymentRefs-where.ts +0 -18
- package/src/compute-view/deployment-view/predicates/deploymentRefs.ts +0 -154
- package/src/compute-view/deployment-view/predicates/index.ts +0 -8
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +0 -243
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +0 -70
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +0 -101
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +0 -95
- package/src/compute-view/deployment-view/predicates/relation-where.ts +0 -18
- package/src/compute-view/deployment-view/predicates/utils.ts +0 -282
- package/src/compute-view/deployment-view/predicates/wildcard.ts +0 -41
- package/src/compute-view/deployment-view/stages/stage-exclude.ts +0 -5
- package/src/compute-view/deployment-view/stages/stage-final.ts +0 -245
- package/src/compute-view/deployment-view/stages/stage-include.ts +0 -95
- package/src/compute-view/deployment-view/utils.ts +0 -297
- package/src/compute-view/dynamic-view/compute.ts +0 -312
- package/src/compute-view/element-view/_types.ts +0 -47
- package/src/compute-view/element-view/clean-connections.ts +0 -117
- package/src/compute-view/element-view/compute.ts +0 -324
- package/src/compute-view/element-view/memory/NodeGroup.ts +0 -31
- package/src/compute-view/element-view/memory/index.ts +0 -10
- package/src/compute-view/element-view/memory/memory.ts +0 -178
- package/src/compute-view/element-view/memory/stage-exclude.ts +0 -59
- package/src/compute-view/element-view/memory/stage-final.ts +0 -129
- package/src/compute-view/element-view/memory/stage-include.ts +0 -130
- package/src/compute-view/element-view/predicates/_utils.ts +0 -91
- package/src/compute-view/element-view/predicates/element-expand.ts +0 -29
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +0 -27
- package/src/compute-view/element-view/predicates/element-ref.ts +0 -24
- package/src/compute-view/element-view/predicates/relation-direct.ts +0 -321
- package/src/compute-view/element-view/predicates/relation-in-out.ts +0 -64
- package/src/compute-view/element-view/predicates/relation-in.ts +0 -115
- package/src/compute-view/element-view/predicates/relation-out.ts +0 -119
- package/src/compute-view/element-view/predicates/wildcard.ts +0 -88
- package/src/compute-view/element-view/utils.ts +0 -65
- package/src/compute-view/index.ts +0 -4
- package/src/compute-view/memory/AbstractMemory.ts +0 -45
- package/src/compute-view/memory/AbstractStageExclude.ts +0 -215
- package/src/compute-view/memory/AbstractStageInclude.ts +0 -200
- package/src/compute-view/memory/_types.ts +0 -148
- package/src/compute-view/memory/index.ts +0 -5
- package/src/compute-view/memory/ops.ts +0 -43
- package/src/compute-view/relationships-view/_types.ts +0 -16
- package/src/compute-view/relationships-view/compute.ts +0 -159
- package/src/compute-view/relationships-view/index.ts +0 -3
- package/src/compute-view/relationships-view/layout.ts +0 -358
- package/src/compute-view/relationships-view/utils.ts +0 -73
- package/src/compute-view/utils/ancestorsOfNode.ts +0 -19
- package/src/compute-view/utils/applyCustomElementProperties.ts +0 -107
- package/src/compute-view/utils/applyCustomRelationProperties.ts +0 -58
- package/src/compute-view/utils/applyViewRuleStyles.ts +0 -73
- package/src/compute-view/utils/buildComputedNodes.ts +0 -166
- package/src/compute-view/utils/buildElementNotations.ts +0 -64
- package/src/compute-view/utils/elementExpressionToPredicate.ts +0 -50
- package/src/compute-view/utils/link-nodes-with-edges.ts +0 -56
- package/src/compute-view/utils/merge-props-from-relationships.ts +0 -161
- package/src/compute-view/utils/relationExpressionToPredicates.ts +0 -55
- package/src/compute-view/utils/resolve-extended-views.ts +0 -85
- package/src/compute-view/utils/resolve-global-rules.ts +0 -88
- package/src/compute-view/utils/topological-sort.ts +0 -256
- package/src/compute-view/utils/view-hash.ts +0 -45
- package/src/compute-view/utils/with-readable-edges.ts +0 -40
- package/src/index.ts +0 -32
- package/src/model/DeploymentElementModel.ts +0 -712
- package/src/model/DeploymentModel.ts +0 -393
- package/src/model/ElementModel.ts +0 -316
- package/src/model/LikeC4Model.ts +0 -882
- package/src/model/RelationModel.ts +0 -152
- package/src/model/connection/Connection.ts +0 -72
- package/src/model/connection/deployment/DeploymentConnectionModel.ts +0 -185
- package/src/model/connection/deployment/find.ts +0 -120
- package/src/model/connection/deployment/index.ts +0 -8
- package/src/model/connection/index.ts +0 -22
- package/src/model/connection/model/ConnectionModel.ts +0 -158
- package/src/model/connection/model/find.ts +0 -117
- package/src/model/connection/model/index.ts +0 -8
- package/src/model/connection/ops.ts +0 -276
- package/src/model/guards.ts +0 -77
- package/src/model/index.ts +0 -72
- package/src/model/types.ts +0 -67
- package/src/model/utils.ts +0 -66
- package/src/model/view/EdgeModel.ts +0 -121
- package/src/model/view/LikeC4ViewModel.ts +0 -361
- package/src/model/view/LikeC4ViewsFolder.ts +0 -151
- package/src/model/view/NodeModel.ts +0 -247
- package/src/theme/element.ts +0 -61
- package/src/theme/index.ts +0 -127
- package/src/theme/relationships.ts +0 -54
- package/src/types/RichText.ts +0 -205
- package/src/types/_aux.ts +0 -317
- package/src/types/_common.ts +0 -102
- package/src/types/const.ts +0 -34
- package/src/types/expression-model.ts +0 -294
- package/src/types/expression.ts +0 -313
- package/src/types/fqnRef.ts +0 -91
- package/src/types/geometry.ts +0 -159
- package/src/types/global.ts +0 -21
- package/src/types/index.ts +0 -44
- package/src/types/model-data.ts +0 -77
- package/src/types/model-deployment.ts +0 -78
- package/src/types/model-dump.ts +0 -79
- package/src/types/model-logical.ts +0 -126
- package/src/types/model-spec.ts +0 -88
- package/src/types/operators.ts +0 -156
- package/src/types/project.ts +0 -14
- package/src/types/scalar.ts +0 -162
- package/src/types/styles.ts +0 -122
- package/src/types/view-changes.ts +0 -32
- package/src/types/view-common.ts +0 -157
- package/src/types/view-computed.ts +0 -126
- package/src/types/view-layouted.ts +0 -94
- package/src/types/view-parsed.deployment.ts +0 -39
- package/src/types/view-parsed.dynamic.ts +0 -89
- package/src/types/view-parsed.element.ts +0 -65
- package/src/types/view.ts +0 -113
- package/src/utils/common-head.ts +0 -22
- package/src/utils/compare-natural.ts +0 -60
- package/src/utils/const.ts +0 -1
- package/src/utils/fqn.ts +0 -302
- package/src/utils/getOrCreate.ts +0 -8
- package/src/utils/guards.ts +0 -9
- package/src/utils/index.ts +0 -68
- package/src/utils/invariant.ts +0 -29
- package/src/utils/iterable/_types.ts +0 -5
- package/src/utils/iterable/filter.ts +0 -55
- package/src/utils/iterable/find.ts +0 -38
- package/src/utils/iterable/first.ts +0 -48
- package/src/utils/iterable/flat.ts +0 -17
- package/src/utils/iterable/head.ts +0 -22
- package/src/utils/iterable/index.ts +0 -15
- package/src/utils/iterable/map.ts +0 -40
- package/src/utils/iterable/reduce.ts +0 -24
- package/src/utils/iterable/some.ts +0 -36
- package/src/utils/iterable/to.ts +0 -19
- package/src/utils/iterable/unique.ts +0 -23
- package/src/utils/markdown/index.ts +0 -2
- package/src/utils/markdown/to-html.ts +0 -32
- package/src/utils/markdown/to-text.ts +0 -14
- package/src/utils/memoize-prop.ts +0 -30
- package/src/utils/mnemonist.ts +0 -9
- package/src/utils/object-hash.ts +0 -14
- package/src/utils/promises.ts +0 -24
- package/src/utils/relations.ts +0 -36
- package/src/utils/set.ts +0 -83
- package/src/utils/string-hash.ts +0 -16
|
@@ -1,17 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as n$4, e as e$4, a as DeploymentNodeModel, b as DeployedInstanceModel, c as DeploymentRelationModel, N as NestedElementOfDeployedInstanceModel } from './core.BIqHjQiH.mjs';
|
|
2
|
+
import { t as t$8, a as t$9 } from './core.BsSXS-_R.mjs';
|
|
3
|
+
import { e as e$3 } from './core.BKlholso.mjs';
|
|
4
|
+
import { c as splitGlobalFqn, g as extractStep, e as isStepEdgeId, i as isGroupElementKind, b as isGlobalFqn, a as GlobalFqn } from './core.C_Ni6yHl.mjs';
|
|
5
|
+
import { q as hierarchyLevel, n as nameFromFqn, i as isAncestor, k as commonAncestor, s as sortNaturalByFqn, f as sortParentsFirst, p as parentFqn, a as ancestorsFqn, j as compareNaturalHierarchically, g as compareNatural } from './core.DRhg-gVU.mjs';
|
|
6
|
+
import { m as memoizeProp } from './core.BR4zXDH-.mjs';
|
|
7
|
+
import { R as RichText, e as exact } from './core.01VTr9qu.mjs';
|
|
8
|
+
import { a as preferSummary, p as preferDescription } from './core.BazD6cot.mjs';
|
|
9
|
+
import { a as ihead, i as ifind } from './core.QJD_fcrc.mjs';
|
|
10
|
+
import { t as t$a } from './core.OHD4KXm9.mjs';
|
|
11
|
+
import { t as t$b } from './core.CbT8JVYL.mjs';
|
|
12
|
+
import { L as LikeC4Styles } from './core.DNbUPnve.mjs';
|
|
3
13
|
import { g as getOrCreate } from './core.DcS-0zys.mjs';
|
|
4
|
-
import { e as DeploymentNodeModel, c as DeployedInstanceModel, g as DeploymentRelationModel, N as NestedElementOfDeployedInstanceModel } from './core.DA5vzwZ9.mjs';
|
|
5
|
-
import { D as DefaultMap } from './core.BuoXfSMj.mjs';
|
|
6
14
|
import { i as invariant, a as nonNullable } from './core.D4npX2q8.mjs';
|
|
15
|
+
import { D as DefaultMap } from './core.BbE4y-yl.mjs';
|
|
7
16
|
import { FqnRef } from '../types/fqnRef.mjs';
|
|
8
|
-
import { b as isDeploymentNode, a as _type, _ as _stage, i as isOnStage, w as whereOperatorAsPredicate } from './core.
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
import { b as isDeploymentNode, a as _type, _ as _stage, i as isOnStage, w as whereOperatorAsPredicate } from './core.BYNkXQ8A.mjs';
|
|
18
|
+
import { i as ifilter } from './core.DRJma0Ol.mjs';
|
|
19
|
+
import './core.B7KhhkRY.mjs';
|
|
20
|
+
import './core.lRvxPoao.mjs';
|
|
21
|
+
|
|
22
|
+
const e$2={asc:(e,t)=>e>t,desc:(e,t)=>e<t};function t$7(e,t){let[n,...a]=t;if(!i$1(n)){let t=r$1(...a);return e(n,t)}let o=r$1(n,...a);return t=>e(t,o)}function r$1(t,n,...i){let a=typeof t==`function`?t:t[0],o=typeof t==`function`?`asc`:t[1],{[o]:s}=e$2,c=n===void 0?void 0:r$1(n,...i);return (e,t)=>{let n=a(e),r=a(t);return s(n,r)?1:s(r,n)?-1:c?.(e,t)??0}}function i$1(t){if(a(t))return true;if(typeof t!=`object`||!Array.isArray(t))return false;let[n,r,...i]=t;return a(n)&&typeof r==`string`&&r in e$2&&i.length===0}const a=e=>typeof e==`function`&&e.length===1;
|
|
23
|
+
|
|
24
|
+
function t$6(...t){return t$8(Object.entries,t)}
|
|
25
|
+
|
|
26
|
+
function t$5(...t){return t$8(n$3,t)}function n$3(e,t){if(e===t||Object.is(e,t))return true;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return false;if(e instanceof Map&&t instanceof Map)return r(e,t);if(e instanceof Set&&t instanceof Set)return i(e,t);let n=Object.keys(e);if(n.length!==Object.keys(t).length)return false;for(let r of n){if(!Object.hasOwn(t,r))return false;let{[r]:n}=e,{[r]:i}=t;if(n!==i||!Object.is(n,i))return false}return true}function r(e,t){if(e.size!==t.size)return false;for(let[n,r]of e){let e=t.get(n);if(r!==e||!Object.is(r,e))return false}return true}function i(e,t){if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}
|
|
27
|
+
|
|
28
|
+
function t$4(...t){return t$8(n$2,t)}const n$2=e=>e.at(-1);
|
|
29
|
+
|
|
30
|
+
function e$1(e,...n){return typeof e==`string`||typeof e==`number`||typeof e==`symbol`?r=>t$3(r,e,...n):t$3(e,...n)}function t$3(e,...t){let n=e;for(let e of t){if(n==null)return;n=n[e];}return n}
|
|
31
|
+
|
|
32
|
+
function t$2(...t){return t$8(n$1,t)}function n$1(e,t){let n=[...e];return n.sort(t),n}
|
|
33
|
+
|
|
34
|
+
function t$1(...t){return t$7(n,t)}const n=(e,t)=>[...e].sort(t);
|
|
35
|
+
|
|
36
|
+
function e(e,t,n){return typeof t==`number`||t===void 0?n=>n.split(e,t):e.split(t,n)}
|
|
37
|
+
|
|
38
|
+
function t(...t){return t$8(Object.values,t)}
|
|
15
39
|
|
|
16
40
|
class ElementModel {
|
|
17
41
|
constructor($model, $element) {
|
|
@@ -45,13 +69,13 @@ class ElementModel {
|
|
|
45
69
|
return this.$element.kind;
|
|
46
70
|
}
|
|
47
71
|
get shape() {
|
|
48
|
-
return this
|
|
72
|
+
return this.style.shape;
|
|
49
73
|
}
|
|
50
74
|
get color() {
|
|
51
|
-
return this
|
|
75
|
+
return this.style.color;
|
|
52
76
|
}
|
|
53
77
|
get icon() {
|
|
54
|
-
return this
|
|
78
|
+
return this.style.icon ?? null;
|
|
55
79
|
}
|
|
56
80
|
/**
|
|
57
81
|
* Returns all tags of the element.
|
|
@@ -59,7 +83,7 @@ class ElementModel {
|
|
|
59
83
|
*/
|
|
60
84
|
get tags() {
|
|
61
85
|
return memoizeProp(this, Symbol.for("tags"), () => {
|
|
62
|
-
return
|
|
86
|
+
return n$4([
|
|
63
87
|
...this.$element.tags ?? [],
|
|
64
88
|
...this.$model.specification.elements[this.$element.kind]?.tags ?? []
|
|
65
89
|
]);
|
|
@@ -73,7 +97,7 @@ class ElementModel {
|
|
|
73
97
|
* (if one is missing - it falls back to another)
|
|
74
98
|
*/
|
|
75
99
|
get hasSummary() {
|
|
76
|
-
return !!this.$element.summary && !!this.$element.description && !
|
|
100
|
+
return !!this.$element.summary && !!this.$element.description && !t$5(this.$element.summary, this.$element.description);
|
|
77
101
|
}
|
|
78
102
|
/**
|
|
79
103
|
* Short description of the element.
|
|
@@ -102,10 +126,16 @@ class ElementModel {
|
|
|
102
126
|
return this.parent === null;
|
|
103
127
|
}
|
|
104
128
|
get style() {
|
|
105
|
-
return {
|
|
106
|
-
|
|
129
|
+
return memoizeProp(this, "style", () => exact({
|
|
130
|
+
shape: this.$model.$styles.defaults.shape,
|
|
131
|
+
color: this.$model.$styles.defaults.color,
|
|
132
|
+
border: this.$model.$styles.defaults.border,
|
|
133
|
+
opacity: this.$model.$styles.defaults.opacity,
|
|
134
|
+
size: this.$model.$styles.defaults.size,
|
|
135
|
+
padding: this.$model.$styles.defaults.padding,
|
|
136
|
+
textSize: this.$model.$styles.defaults.text,
|
|
107
137
|
...this.$element.style
|
|
108
|
-
};
|
|
138
|
+
}));
|
|
109
139
|
}
|
|
110
140
|
isAncestorOf(another) {
|
|
111
141
|
return isAncestor(this, another);
|
|
@@ -235,13 +265,13 @@ class ElementModel {
|
|
|
235
265
|
* @returns true if the element is deployed
|
|
236
266
|
*/
|
|
237
267
|
isDeployed() {
|
|
238
|
-
return
|
|
268
|
+
return e$3(ihead(this.deployments()));
|
|
239
269
|
}
|
|
240
270
|
deployments() {
|
|
241
271
|
return this.$model.deployment.instancesOf(this);
|
|
242
272
|
}
|
|
243
273
|
hasMetadata() {
|
|
244
|
-
return !!this.$element.metadata && !
|
|
274
|
+
return !!this.$element.metadata && !e$4(this.$element.metadata);
|
|
245
275
|
}
|
|
246
276
|
getMetadata(field) {
|
|
247
277
|
if (field) {
|
|
@@ -265,7 +295,7 @@ const splitViewTitle = (title) => {
|
|
|
265
295
|
invariant(!title.includes("\n"), "View title cannot contain newlines");
|
|
266
296
|
if (title.includes(VIEW_FOLDERS_SEPARATOR)) {
|
|
267
297
|
const segments = title.split(VIEW_FOLDERS_SEPARATOR).map((s) => s.trim()).filter((s) => s.length > 0);
|
|
268
|
-
if (
|
|
298
|
+
if (t$9(segments, 1)) {
|
|
269
299
|
return segments;
|
|
270
300
|
}
|
|
271
301
|
return [""];
|
|
@@ -277,7 +307,7 @@ const normalizeViewPath = (title) => {
|
|
|
277
307
|
};
|
|
278
308
|
const getViewFolderPath = (title) => {
|
|
279
309
|
const segments = splitViewTitle(title);
|
|
280
|
-
if (!
|
|
310
|
+
if (!t$9(segments, 2)) {
|
|
281
311
|
return null;
|
|
282
312
|
}
|
|
283
313
|
return segments.slice(0, -1).join(VIEW_FOLDERS_SEPARATOR);
|
|
@@ -293,7 +323,7 @@ class LikeC4DeploymentModel {
|
|
|
293
323
|
constructor($model) {
|
|
294
324
|
this.$model = $model;
|
|
295
325
|
const $deployments = this.$deployments = $model.$data.deployments;
|
|
296
|
-
const elements =
|
|
326
|
+
const elements = t($deployments.elements);
|
|
297
327
|
for (const element of sortParentsFirst(elements)) {
|
|
298
328
|
const el = this.addElement(element);
|
|
299
329
|
for (const tag of el.tags) {
|
|
@@ -303,7 +333,7 @@ class LikeC4DeploymentModel {
|
|
|
303
333
|
this.#instancesOf.get(el.element.id).add(el);
|
|
304
334
|
}
|
|
305
335
|
}
|
|
306
|
-
for (const relation of
|
|
336
|
+
for (const relation of t($deployments.relations)) {
|
|
307
337
|
const el = this.addRelation(relation);
|
|
308
338
|
for (const tag of el.tags) {
|
|
309
339
|
this.#allTags.get(tag).add(el);
|
|
@@ -331,6 +361,9 @@ class LikeC4DeploymentModel {
|
|
|
331
361
|
);
|
|
332
362
|
#nestedElementsOfDeployment = /* @__PURE__ */ new Map();
|
|
333
363
|
$deployments;
|
|
364
|
+
get $styles() {
|
|
365
|
+
return this.$model.$styles;
|
|
366
|
+
}
|
|
334
367
|
element(el) {
|
|
335
368
|
if (el instanceof DeploymentNodeModel || el instanceof DeployedInstanceModel) {
|
|
336
369
|
return el;
|
|
@@ -616,13 +649,13 @@ class RelationshipModel {
|
|
|
616
649
|
return `${this.source.id} -> ${this.target.id}`;
|
|
617
650
|
}
|
|
618
651
|
get title() {
|
|
619
|
-
if (!
|
|
652
|
+
if (!e$3(this.$relationship.title)) {
|
|
620
653
|
return null;
|
|
621
654
|
}
|
|
622
655
|
return this.$relationship.title;
|
|
623
656
|
}
|
|
624
657
|
get technology() {
|
|
625
|
-
if (!
|
|
658
|
+
if (!e$3(this.$relationship.technology)) {
|
|
626
659
|
return null;
|
|
627
660
|
}
|
|
628
661
|
return this.$relationship.technology;
|
|
@@ -643,10 +676,16 @@ class RelationshipModel {
|
|
|
643
676
|
return this.$relationship.links ?? [];
|
|
644
677
|
}
|
|
645
678
|
get color() {
|
|
646
|
-
return this.$relationship.color ??
|
|
679
|
+
return this.$relationship.color ?? this.model.$styles.defaults.relationship.color;
|
|
647
680
|
}
|
|
648
681
|
get line() {
|
|
649
|
-
return this.$relationship.line ??
|
|
682
|
+
return this.$relationship.line ?? this.model.$styles.defaults.relationship.line;
|
|
683
|
+
}
|
|
684
|
+
get head() {
|
|
685
|
+
return this.$relationship.head ?? this.model.$styles.defaults.relationship.arrow;
|
|
686
|
+
}
|
|
687
|
+
get tail() {
|
|
688
|
+
return this.$relationship.tail;
|
|
650
689
|
}
|
|
651
690
|
/**
|
|
652
691
|
* Iterate over all views that include this relationship.
|
|
@@ -666,7 +705,7 @@ class RelationshipModel {
|
|
|
666
705
|
return true;
|
|
667
706
|
}
|
|
668
707
|
hasMetadata() {
|
|
669
|
-
return !!this.$relationship.metadata && !
|
|
708
|
+
return !!this.$relationship.metadata && !e$4(this.$relationship.metadata);
|
|
670
709
|
}
|
|
671
710
|
getMetadata(field) {
|
|
672
711
|
if (field) {
|
|
@@ -719,10 +758,16 @@ class EdgeModel {
|
|
|
719
758
|
return this.#edge.navigateTo ? this.view.$model.view(this.#edge.navigateTo) : null;
|
|
720
759
|
}
|
|
721
760
|
get color() {
|
|
722
|
-
return this.#edge.color
|
|
761
|
+
return this.#edge.color;
|
|
723
762
|
}
|
|
724
763
|
get line() {
|
|
725
|
-
return this.#edge.line ??
|
|
764
|
+
return this.#edge.line ?? this.view.$model.$styles.defaults.relationship.line;
|
|
765
|
+
}
|
|
766
|
+
get head() {
|
|
767
|
+
return this.#edge.head ?? this.view.$model.$styles.defaults.relationship.arrow;
|
|
768
|
+
}
|
|
769
|
+
get tail() {
|
|
770
|
+
return this.#edge.tail;
|
|
726
771
|
}
|
|
727
772
|
isStep() {
|
|
728
773
|
return isStepEdgeId(this.id);
|
|
@@ -888,13 +933,13 @@ class NodeModel {
|
|
|
888
933
|
* Check if this node references to logical model element.
|
|
889
934
|
*/
|
|
890
935
|
hasElement() {
|
|
891
|
-
return
|
|
936
|
+
return e$3(this.#node.modelRef);
|
|
892
937
|
}
|
|
893
938
|
/**
|
|
894
939
|
* Check if this node references to deployment element (Node or Instance).
|
|
895
940
|
*/
|
|
896
941
|
hasDeployment() {
|
|
897
|
-
return
|
|
942
|
+
return e$3(this.#node.deploymentRef);
|
|
898
943
|
}
|
|
899
944
|
/**
|
|
900
945
|
* Check if this node references to deployed instance
|
|
@@ -1166,7 +1211,7 @@ class LikeC4ViewModel {
|
|
|
1166
1211
|
return this.$view[_type] === "element";
|
|
1167
1212
|
}
|
|
1168
1213
|
isScopedElementView() {
|
|
1169
|
-
return this.$view[_type] === "element" &&
|
|
1214
|
+
return this.$view[_type] === "element" && e$3(this.$view.viewOf);
|
|
1170
1215
|
}
|
|
1171
1216
|
isDeploymentView() {
|
|
1172
1217
|
return this.$view[_type] === "deployment";
|
|
@@ -1208,7 +1253,7 @@ class LikeC4ViewsFolder {
|
|
|
1208
1253
|
this.$model = $model;
|
|
1209
1254
|
this.path = path.join("/");
|
|
1210
1255
|
this.isRoot = this.path === "";
|
|
1211
|
-
this.title =
|
|
1256
|
+
this.title = t$4(path);
|
|
1212
1257
|
if (this.isRoot) {
|
|
1213
1258
|
this.parentPath = void 0;
|
|
1214
1259
|
} else {
|
|
@@ -1263,7 +1308,7 @@ class LikeC4ViewsFolder {
|
|
|
1263
1308
|
*/
|
|
1264
1309
|
get parent() {
|
|
1265
1310
|
invariant(!this.isRoot, "Root view folder has no parent");
|
|
1266
|
-
if (
|
|
1311
|
+
if (e$4(this.parentPath)) {
|
|
1267
1312
|
return null;
|
|
1268
1313
|
}
|
|
1269
1314
|
return this.$model.viewFolder(this.parentPath);
|
|
@@ -1384,13 +1429,13 @@ class LikeC4Model {
|
|
|
1384
1429
|
$data;
|
|
1385
1430
|
constructor($data) {
|
|
1386
1431
|
this.$data = $data;
|
|
1387
|
-
for (const [, element] of
|
|
1432
|
+
for (const [, element] of t$6($data.elements)) {
|
|
1388
1433
|
const el = this.addElement(element);
|
|
1389
1434
|
for (const tag of el.tags) {
|
|
1390
1435
|
this._allTags.get(tag).add(el);
|
|
1391
1436
|
}
|
|
1392
1437
|
}
|
|
1393
|
-
for (const [projectId, elements] of
|
|
1438
|
+
for (const [projectId, elements] of t$6($data.imports ?? {})) {
|
|
1394
1439
|
for (const element of sortParentsFirst(elements)) {
|
|
1395
1440
|
const el = this.addImportedElement(projectId, element);
|
|
1396
1441
|
for (const tag of el.tags) {
|
|
@@ -1398,7 +1443,7 @@ class LikeC4Model {
|
|
|
1398
1443
|
}
|
|
1399
1444
|
}
|
|
1400
1445
|
}
|
|
1401
|
-
for (const relation of
|
|
1446
|
+
for (const relation of t($data.relations)) {
|
|
1402
1447
|
const el = this.addRelation(relation);
|
|
1403
1448
|
for (const tag of el.tags) {
|
|
1404
1449
|
this._allTags.get(tag).add(el);
|
|
@@ -1407,21 +1452,21 @@ class LikeC4Model {
|
|
|
1407
1452
|
this.deployment = new LikeC4DeploymentModel(this);
|
|
1408
1453
|
if (isOnStage($data, "computed") || isOnStage($data, "layouted")) {
|
|
1409
1454
|
const compare = compareNaturalHierarchically(VIEW_FOLDERS_SEPARATOR);
|
|
1410
|
-
const views =
|
|
1411
|
-
|
|
1412
|
-
|
|
1455
|
+
const views = t$a(
|
|
1456
|
+
t($data.views),
|
|
1457
|
+
t$b((view) => ({
|
|
1413
1458
|
view,
|
|
1414
1459
|
path: normalizeViewPath(view.title ?? view.id),
|
|
1415
1460
|
folderPath: view.title && getViewFolderPath(view.title) || ""
|
|
1416
1461
|
})),
|
|
1417
1462
|
// Sort hierarchically by groups, but keep same order within groups
|
|
1418
|
-
|
|
1463
|
+
t$2((a, b) => compare(a.folderPath, b.folderPath))
|
|
1419
1464
|
);
|
|
1420
1465
|
const getOrCreateFolder = (path) => {
|
|
1421
1466
|
let folder = this._viewFolders.get(path);
|
|
1422
1467
|
if (!folder) {
|
|
1423
|
-
const segments =
|
|
1424
|
-
invariant(
|
|
1468
|
+
const segments = e(path, VIEW_FOLDERS_SEPARATOR);
|
|
1469
|
+
invariant(t$9(segments, 1), `View group path "${path}" must have at least one element`);
|
|
1425
1470
|
let defaultView;
|
|
1426
1471
|
if (path === "") {
|
|
1427
1472
|
defaultView = views.find((view) => view.view.id === "index");
|
|
@@ -1438,11 +1483,13 @@ class LikeC4Model {
|
|
|
1438
1483
|
if (this._viewFolders.has(folderPath)) {
|
|
1439
1484
|
continue;
|
|
1440
1485
|
}
|
|
1441
|
-
|
|
1442
|
-
const
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
|
|
1486
|
+
e(folderPath, VIEW_FOLDERS_SEPARATOR).reduce((segments, segment) => {
|
|
1487
|
+
const parent = segments.join(VIEW_FOLDERS_SEPARATOR);
|
|
1488
|
+
const path = e$4(parent) ? segment : parent + VIEW_FOLDERS_SEPARATOR + segment;
|
|
1489
|
+
const folder = getOrCreateFolder(path);
|
|
1490
|
+
this._viewFolderItems.get(parent).add(folder);
|
|
1491
|
+
segments.push(segment);
|
|
1492
|
+
return segments;
|
|
1446
1493
|
}, []);
|
|
1447
1494
|
}
|
|
1448
1495
|
for (const { view, folderPath } of views) {
|
|
@@ -1479,6 +1526,23 @@ class LikeC4Model {
|
|
|
1479
1526
|
get asLayouted() {
|
|
1480
1527
|
return this;
|
|
1481
1528
|
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Returns the styles configuration for the project.
|
|
1531
|
+
*/
|
|
1532
|
+
get $styles() {
|
|
1533
|
+
return memoizeProp(
|
|
1534
|
+
this,
|
|
1535
|
+
"styles",
|
|
1536
|
+
() => LikeC4Styles.from(
|
|
1537
|
+
this.$data.project.styles,
|
|
1538
|
+
this.$data.specification.customColors ? {
|
|
1539
|
+
theme: {
|
|
1540
|
+
colors: this.$data.specification.customColors
|
|
1541
|
+
}
|
|
1542
|
+
} : void 0
|
|
1543
|
+
)
|
|
1544
|
+
);
|
|
1545
|
+
}
|
|
1482
1546
|
/**
|
|
1483
1547
|
* Type guard the model to the parsed stage.
|
|
1484
1548
|
*/
|
|
@@ -1768,22 +1832,22 @@ class LikeC4Model {
|
|
|
1768
1832
|
* Use {@link specification.tags} to get all defined tags
|
|
1769
1833
|
*/
|
|
1770
1834
|
get tags() {
|
|
1771
|
-
return memoizeProp(this, "tags", () =>
|
|
1835
|
+
return memoizeProp(this, "tags", () => t$2([...this._allTags.keys()], compareNatural));
|
|
1772
1836
|
}
|
|
1773
1837
|
/**
|
|
1774
1838
|
* Returns all tags used in the model, sorted by usage count (descending).
|
|
1775
1839
|
*/
|
|
1776
1840
|
get tagsSortedByUsage() {
|
|
1777
|
-
return memoizeProp(this, "tagsSortedByUsage", () =>
|
|
1841
|
+
return memoizeProp(this, "tagsSortedByUsage", () => t$a(
|
|
1778
1842
|
[...this._allTags.entries()],
|
|
1779
|
-
|
|
1843
|
+
t$b(([tag, tagged]) => ({
|
|
1780
1844
|
tag,
|
|
1781
1845
|
count: tagged.size,
|
|
1782
1846
|
tagged
|
|
1783
1847
|
})),
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
[
|
|
1848
|
+
t$2((a, b) => compareNatural(a.tag, b.tag)),
|
|
1849
|
+
t$1(
|
|
1850
|
+
[e$1("count"), "desc"]
|
|
1787
1851
|
)
|
|
1788
1852
|
));
|
|
1789
1853
|
}
|
|
@@ -1999,4 +2063,4 @@ function isEdgeModel(edge) {
|
|
|
1999
2063
|
return edge instanceof EdgeModel;
|
|
2000
2064
|
}
|
|
2001
2065
|
|
|
2002
|
-
export { ElementModel as E, LikeC4Model as L, NodeModel as N, RelationshipModel as R, VIEW_FOLDERS_SEPARATOR as V,
|
|
2066
|
+
export { ElementModel as E, LikeC4Model as L, NodeModel as N, RelationshipModel as R, VIEW_FOLDERS_SEPARATOR as V, t$6 as a, t$1 as b, t$4 as c, isNestedElementOfDeployedInstanceModel as d, e$1 as e, isDeployedInstanceModel as f, isDeploymentNodeModel as g, isDeploymentElementModel as h, isElementModel as i, LikeC4DeploymentModel as j, EdgeModel as k, LikeC4ViewModel as l, LikeC4ViewsFolder as m, extractViewTitleFromPath as n, getViewFolderPath as o, normalizeViewPath as p, isDeploymentRelationModel as q, isRelationModel as r, isLikeC4ViewModel as s, t, isNodeModel as u, isEdgeModel as v };
|