@likec4/core 1.40.0 → 1.42.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/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 +83 -20
- package/dist/builder/index.mjs +210 -126
- 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 +12 -12
- 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.DHQ32OHa.mjs → core.01VTr9qu.mjs} +10 -29
- 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.BIAlzwKc.mjs → core.BIqHjQiH.mjs} +85 -45
- package/dist/shared/core.BKlholso.mjs +3 -0
- package/dist/shared/core.BR4zXDH-.mjs +13 -0
- package/dist/shared/{core.yHe79zEl.mjs → core.BYNkXQ8A.mjs} +21 -12
- package/dist/shared/core.BazD6cot.mjs +14 -0
- 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.T-eLZTW_.mjs → core.BzTakU3I.mjs} +15 -7
- 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.FPITT8Vx.mjs → core.C8sl5Y8Z.mjs} +144 -61
- package/dist/shared/{core.DuR3R-xJ.mjs → core.CNgZvKb8.mjs} +3 -5176
- package/dist/shared/{core.BbThmf6M.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.CySf-2gP.d.mts → core.D0PjZzIS.d.mts} +52 -15
- package/dist/shared/{core.DrvfVXkh.d.mts → core.D5fzJWbF.d.mts} +11 -2
- package/dist/shared/{core.DrVOJuxX.d.mts → core.DACpKp35.d.mts} +5 -5
- package/dist/shared/core.DFi2dOTl.mjs +39548 -0
- package/dist/shared/{core.D704WZES.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.vWJTxpLV.d.mts → core.D_vkffV4.d.mts} +4 -2
- package/dist/shared/core.DdMJk7nx.d.mts +476 -0
- package/dist/shared/{core.D_fI5Lf6.d.mts → core.Dgs6-nuz.d.mts} +24 -4
- 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.kxeJe0OY.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/_aux.mjs +1 -5
- 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 +151 -6
- 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.Bpou6c2f.d.mts +0 -850
- package/dist/shared/core.CUw_2J9j.mjs +0 -47
- package/dist/shared/core.CzdwsPmY.d.mts +0 -69
- 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 -870
- 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 -320
- 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 -286
- 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 -357
- 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 -153
- package/src/compute-view/utils/buildElementNotations.ts +0 -63
- 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 -682
- package/src/model/DeploymentModel.ts +0 -393
- package/src/model/ElementModel.ts +0 -293
- 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 -120
- 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 -206
- package/src/types/_aux.ts +0 -291
- package/src/types/_common.ts +0 -80
- 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 -42
- package/src/types/model-data.ts +0 -77
- package/src/types/model-deployment.ts +0 -88
- package/src/types/model-dump.ts +0 -79
- package/src/types/model-logical.ts +0 -135
- package/src/types/model-spec.ts +0 -85
- 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 -118
- package/src/types/view-layouted.ts +0 -98
- 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,16 +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.BIAlzwKc.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
|
-
|
|
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)}
|
|
14
39
|
|
|
15
40
|
class ElementModel {
|
|
16
41
|
constructor($model, $element) {
|
|
@@ -44,13 +69,13 @@ class ElementModel {
|
|
|
44
69
|
return this.$element.kind;
|
|
45
70
|
}
|
|
46
71
|
get shape() {
|
|
47
|
-
return this
|
|
72
|
+
return this.style.shape;
|
|
48
73
|
}
|
|
49
74
|
get color() {
|
|
50
|
-
return this
|
|
75
|
+
return this.style.color;
|
|
51
76
|
}
|
|
52
77
|
get icon() {
|
|
53
|
-
return this
|
|
78
|
+
return this.style.icon ?? null;
|
|
54
79
|
}
|
|
55
80
|
/**
|
|
56
81
|
* Returns all tags of the element.
|
|
@@ -58,7 +83,7 @@ class ElementModel {
|
|
|
58
83
|
*/
|
|
59
84
|
get tags() {
|
|
60
85
|
return memoizeProp(this, Symbol.for("tags"), () => {
|
|
61
|
-
return
|
|
86
|
+
return n$4([
|
|
62
87
|
...this.$element.tags ?? [],
|
|
63
88
|
...this.$model.specification.elements[this.$element.kind]?.tags ?? []
|
|
64
89
|
]);
|
|
@@ -67,8 +92,26 @@ class ElementModel {
|
|
|
67
92
|
get title() {
|
|
68
93
|
return this.$element.title;
|
|
69
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Returns true if the element has a summary and a description
|
|
97
|
+
* (if one is missing - it falls back to another)
|
|
98
|
+
*/
|
|
99
|
+
get hasSummary() {
|
|
100
|
+
return !!this.$element.summary && !!this.$element.description && !t$5(this.$element.summary, this.$element.description);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Short description of the element.
|
|
104
|
+
* Falls back to description if summary is not provided.
|
|
105
|
+
*/
|
|
106
|
+
get summary() {
|
|
107
|
+
return RichText.memoize(this, "summary", preferSummary(this.$element));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Long description of the element.
|
|
111
|
+
* Falls back to summary if description is not provided.
|
|
112
|
+
*/
|
|
70
113
|
get description() {
|
|
71
|
-
return RichText.memoize(this, this.$element
|
|
114
|
+
return RichText.memoize(this, "description", preferDescription(this.$element));
|
|
72
115
|
}
|
|
73
116
|
get technology() {
|
|
74
117
|
return this.$element.technology ?? null;
|
|
@@ -83,10 +126,16 @@ class ElementModel {
|
|
|
83
126
|
return this.parent === null;
|
|
84
127
|
}
|
|
85
128
|
get style() {
|
|
86
|
-
return {
|
|
87
|
-
|
|
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,
|
|
88
137
|
...this.$element.style
|
|
89
|
-
};
|
|
138
|
+
}));
|
|
90
139
|
}
|
|
91
140
|
isAncestorOf(another) {
|
|
92
141
|
return isAncestor(this, another);
|
|
@@ -216,13 +265,13 @@ class ElementModel {
|
|
|
216
265
|
* @returns true if the element is deployed
|
|
217
266
|
*/
|
|
218
267
|
isDeployed() {
|
|
219
|
-
return
|
|
268
|
+
return e$3(ihead(this.deployments()));
|
|
220
269
|
}
|
|
221
270
|
deployments() {
|
|
222
271
|
return this.$model.deployment.instancesOf(this);
|
|
223
272
|
}
|
|
224
273
|
hasMetadata() {
|
|
225
|
-
return !!this.$element.metadata && !
|
|
274
|
+
return !!this.$element.metadata && !e$4(this.$element.metadata);
|
|
226
275
|
}
|
|
227
276
|
getMetadata(field) {
|
|
228
277
|
if (field) {
|
|
@@ -246,7 +295,7 @@ const splitViewTitle = (title) => {
|
|
|
246
295
|
invariant(!title.includes("\n"), "View title cannot contain newlines");
|
|
247
296
|
if (title.includes(VIEW_FOLDERS_SEPARATOR)) {
|
|
248
297
|
const segments = title.split(VIEW_FOLDERS_SEPARATOR).map((s) => s.trim()).filter((s) => s.length > 0);
|
|
249
|
-
if (
|
|
298
|
+
if (t$9(segments, 1)) {
|
|
250
299
|
return segments;
|
|
251
300
|
}
|
|
252
301
|
return [""];
|
|
@@ -258,7 +307,7 @@ const normalizeViewPath = (title) => {
|
|
|
258
307
|
};
|
|
259
308
|
const getViewFolderPath = (title) => {
|
|
260
309
|
const segments = splitViewTitle(title);
|
|
261
|
-
if (!
|
|
310
|
+
if (!t$9(segments, 2)) {
|
|
262
311
|
return null;
|
|
263
312
|
}
|
|
264
313
|
return segments.slice(0, -1).join(VIEW_FOLDERS_SEPARATOR);
|
|
@@ -274,7 +323,7 @@ class LikeC4DeploymentModel {
|
|
|
274
323
|
constructor($model) {
|
|
275
324
|
this.$model = $model;
|
|
276
325
|
const $deployments = this.$deployments = $model.$data.deployments;
|
|
277
|
-
const elements =
|
|
326
|
+
const elements = t($deployments.elements);
|
|
278
327
|
for (const element of sortParentsFirst(elements)) {
|
|
279
328
|
const el = this.addElement(element);
|
|
280
329
|
for (const tag of el.tags) {
|
|
@@ -284,7 +333,7 @@ class LikeC4DeploymentModel {
|
|
|
284
333
|
this.#instancesOf.get(el.element.id).add(el);
|
|
285
334
|
}
|
|
286
335
|
}
|
|
287
|
-
for (const relation of
|
|
336
|
+
for (const relation of t($deployments.relations)) {
|
|
288
337
|
const el = this.addRelation(relation);
|
|
289
338
|
for (const tag of el.tags) {
|
|
290
339
|
this.#allTags.get(tag).add(el);
|
|
@@ -312,6 +361,9 @@ class LikeC4DeploymentModel {
|
|
|
312
361
|
);
|
|
313
362
|
#nestedElementsOfDeployment = /* @__PURE__ */ new Map();
|
|
314
363
|
$deployments;
|
|
364
|
+
get $styles() {
|
|
365
|
+
return this.$model.$styles;
|
|
366
|
+
}
|
|
315
367
|
element(el) {
|
|
316
368
|
if (el instanceof DeploymentNodeModel || el instanceof DeployedInstanceModel) {
|
|
317
369
|
return el;
|
|
@@ -597,19 +649,19 @@ class RelationshipModel {
|
|
|
597
649
|
return `${this.source.id} -> ${this.target.id}`;
|
|
598
650
|
}
|
|
599
651
|
get title() {
|
|
600
|
-
if (!
|
|
652
|
+
if (!e$3(this.$relationship.title)) {
|
|
601
653
|
return null;
|
|
602
654
|
}
|
|
603
655
|
return this.$relationship.title;
|
|
604
656
|
}
|
|
605
657
|
get technology() {
|
|
606
|
-
if (!
|
|
658
|
+
if (!e$3(this.$relationship.technology)) {
|
|
607
659
|
return null;
|
|
608
660
|
}
|
|
609
661
|
return this.$relationship.technology;
|
|
610
662
|
}
|
|
611
663
|
get description() {
|
|
612
|
-
return RichText.memoize(this, this.$relationship.description);
|
|
664
|
+
return RichText.memoize(this, "description", this.$relationship.description);
|
|
613
665
|
}
|
|
614
666
|
get navigateTo() {
|
|
615
667
|
return this.$relationship.navigateTo ? this.model.view(this.$relationship.navigateTo) : null;
|
|
@@ -624,10 +676,16 @@ class RelationshipModel {
|
|
|
624
676
|
return this.$relationship.links ?? [];
|
|
625
677
|
}
|
|
626
678
|
get color() {
|
|
627
|
-
return this.$relationship.color ??
|
|
679
|
+
return this.$relationship.color ?? this.model.$styles.defaults.relationship.color;
|
|
628
680
|
}
|
|
629
681
|
get line() {
|
|
630
|
-
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;
|
|
631
689
|
}
|
|
632
690
|
/**
|
|
633
691
|
* Iterate over all views that include this relationship.
|
|
@@ -647,7 +705,7 @@ class RelationshipModel {
|
|
|
647
705
|
return true;
|
|
648
706
|
}
|
|
649
707
|
hasMetadata() {
|
|
650
|
-
return !!this.$relationship.metadata && !
|
|
708
|
+
return !!this.$relationship.metadata && !e$4(this.$relationship.metadata);
|
|
651
709
|
}
|
|
652
710
|
getMetadata(field) {
|
|
653
711
|
if (field) {
|
|
@@ -682,7 +740,7 @@ class EdgeModel {
|
|
|
682
740
|
return this.#edge.label ?? null;
|
|
683
741
|
}
|
|
684
742
|
get description() {
|
|
685
|
-
return RichText.memoize(this, this.#edge.description);
|
|
743
|
+
return RichText.memoize(this, "description", this.#edge.description);
|
|
686
744
|
}
|
|
687
745
|
get technology() {
|
|
688
746
|
return this.#edge.technology ?? null;
|
|
@@ -700,10 +758,16 @@ class EdgeModel {
|
|
|
700
758
|
return this.#edge.navigateTo ? this.view.$model.view(this.#edge.navigateTo) : null;
|
|
701
759
|
}
|
|
702
760
|
get color() {
|
|
703
|
-
return this.#edge.color
|
|
761
|
+
return this.#edge.color;
|
|
704
762
|
}
|
|
705
763
|
get line() {
|
|
706
|
-
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;
|
|
707
771
|
}
|
|
708
772
|
isStep() {
|
|
709
773
|
return isStepEdgeId(this.id);
|
|
@@ -747,7 +811,7 @@ class NodeModel {
|
|
|
747
811
|
return this.#node.kind;
|
|
748
812
|
}
|
|
749
813
|
get description() {
|
|
750
|
-
return RichText.memoize(this, this.#node.description);
|
|
814
|
+
return RichText.memoize(this, "description", this.#node.description);
|
|
751
815
|
}
|
|
752
816
|
get technology() {
|
|
753
817
|
return this.#node.technology ?? null;
|
|
@@ -869,13 +933,13 @@ class NodeModel {
|
|
|
869
933
|
* Check if this node references to logical model element.
|
|
870
934
|
*/
|
|
871
935
|
hasElement() {
|
|
872
|
-
return
|
|
936
|
+
return e$3(this.#node.modelRef);
|
|
873
937
|
}
|
|
874
938
|
/**
|
|
875
939
|
* Check if this node references to deployment element (Node or Instance).
|
|
876
940
|
*/
|
|
877
941
|
hasDeployment() {
|
|
878
|
-
return
|
|
942
|
+
return e$3(this.#node.deploymentRef);
|
|
879
943
|
}
|
|
880
944
|
/**
|
|
881
945
|
* Check if this node references to deployed instance
|
|
@@ -1000,7 +1064,7 @@ class LikeC4ViewModel {
|
|
|
1000
1064
|
});
|
|
1001
1065
|
}
|
|
1002
1066
|
get description() {
|
|
1003
|
-
return RichText.memoize(this, this.$view.description);
|
|
1067
|
+
return RichText.memoize(this, "description", this.$view.description);
|
|
1004
1068
|
}
|
|
1005
1069
|
get tags() {
|
|
1006
1070
|
return this.$view.tags ?? [];
|
|
@@ -1147,7 +1211,7 @@ class LikeC4ViewModel {
|
|
|
1147
1211
|
return this.$view[_type] === "element";
|
|
1148
1212
|
}
|
|
1149
1213
|
isScopedElementView() {
|
|
1150
|
-
return this.$view[_type] === "element" &&
|
|
1214
|
+
return this.$view[_type] === "element" && e$3(this.$view.viewOf);
|
|
1151
1215
|
}
|
|
1152
1216
|
isDeploymentView() {
|
|
1153
1217
|
return this.$view[_type] === "deployment";
|
|
@@ -1189,7 +1253,7 @@ class LikeC4ViewsFolder {
|
|
|
1189
1253
|
this.$model = $model;
|
|
1190
1254
|
this.path = path.join("/");
|
|
1191
1255
|
this.isRoot = this.path === "";
|
|
1192
|
-
this.title =
|
|
1256
|
+
this.title = t$4(path);
|
|
1193
1257
|
if (this.isRoot) {
|
|
1194
1258
|
this.parentPath = void 0;
|
|
1195
1259
|
} else {
|
|
@@ -1244,7 +1308,7 @@ class LikeC4ViewsFolder {
|
|
|
1244
1308
|
*/
|
|
1245
1309
|
get parent() {
|
|
1246
1310
|
invariant(!this.isRoot, "Root view folder has no parent");
|
|
1247
|
-
if (
|
|
1311
|
+
if (e$4(this.parentPath)) {
|
|
1248
1312
|
return null;
|
|
1249
1313
|
}
|
|
1250
1314
|
return this.$model.viewFolder(this.parentPath);
|
|
@@ -1365,13 +1429,13 @@ class LikeC4Model {
|
|
|
1365
1429
|
$data;
|
|
1366
1430
|
constructor($data) {
|
|
1367
1431
|
this.$data = $data;
|
|
1368
|
-
for (const [, element] of
|
|
1432
|
+
for (const [, element] of t$6($data.elements)) {
|
|
1369
1433
|
const el = this.addElement(element);
|
|
1370
1434
|
for (const tag of el.tags) {
|
|
1371
1435
|
this._allTags.get(tag).add(el);
|
|
1372
1436
|
}
|
|
1373
1437
|
}
|
|
1374
|
-
for (const [projectId, elements] of
|
|
1438
|
+
for (const [projectId, elements] of t$6($data.imports ?? {})) {
|
|
1375
1439
|
for (const element of sortParentsFirst(elements)) {
|
|
1376
1440
|
const el = this.addImportedElement(projectId, element);
|
|
1377
1441
|
for (const tag of el.tags) {
|
|
@@ -1379,7 +1443,7 @@ class LikeC4Model {
|
|
|
1379
1443
|
}
|
|
1380
1444
|
}
|
|
1381
1445
|
}
|
|
1382
|
-
for (const relation of
|
|
1446
|
+
for (const relation of t($data.relations)) {
|
|
1383
1447
|
const el = this.addRelation(relation);
|
|
1384
1448
|
for (const tag of el.tags) {
|
|
1385
1449
|
this._allTags.get(tag).add(el);
|
|
@@ -1388,21 +1452,21 @@ class LikeC4Model {
|
|
|
1388
1452
|
this.deployment = new LikeC4DeploymentModel(this);
|
|
1389
1453
|
if (isOnStage($data, "computed") || isOnStage($data, "layouted")) {
|
|
1390
1454
|
const compare = compareNaturalHierarchically(VIEW_FOLDERS_SEPARATOR);
|
|
1391
|
-
const views =
|
|
1392
|
-
|
|
1393
|
-
|
|
1455
|
+
const views = t$a(
|
|
1456
|
+
t($data.views),
|
|
1457
|
+
t$b((view) => ({
|
|
1394
1458
|
view,
|
|
1395
1459
|
path: normalizeViewPath(view.title ?? view.id),
|
|
1396
1460
|
folderPath: view.title && getViewFolderPath(view.title) || ""
|
|
1397
1461
|
})),
|
|
1398
1462
|
// Sort hierarchically by groups, but keep same order within groups
|
|
1399
|
-
|
|
1463
|
+
t$2((a, b) => compare(a.folderPath, b.folderPath))
|
|
1400
1464
|
);
|
|
1401
1465
|
const getOrCreateFolder = (path) => {
|
|
1402
1466
|
let folder = this._viewFolders.get(path);
|
|
1403
1467
|
if (!folder) {
|
|
1404
|
-
const segments =
|
|
1405
|
-
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`);
|
|
1406
1470
|
let defaultView;
|
|
1407
1471
|
if (path === "") {
|
|
1408
1472
|
defaultView = views.find((view) => view.view.id === "index");
|
|
@@ -1419,11 +1483,13 @@ class LikeC4Model {
|
|
|
1419
1483
|
if (this._viewFolders.has(folderPath)) {
|
|
1420
1484
|
continue;
|
|
1421
1485
|
}
|
|
1422
|
-
|
|
1423
|
-
const
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1426
|
-
|
|
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;
|
|
1427
1493
|
}, []);
|
|
1428
1494
|
}
|
|
1429
1495
|
for (const { view, folderPath } of views) {
|
|
@@ -1460,6 +1526,23 @@ class LikeC4Model {
|
|
|
1460
1526
|
get asLayouted() {
|
|
1461
1527
|
return this;
|
|
1462
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
|
+
}
|
|
1463
1546
|
/**
|
|
1464
1547
|
* Type guard the model to the parsed stage.
|
|
1465
1548
|
*/
|
|
@@ -1749,22 +1832,22 @@ class LikeC4Model {
|
|
|
1749
1832
|
* Use {@link specification.tags} to get all defined tags
|
|
1750
1833
|
*/
|
|
1751
1834
|
get tags() {
|
|
1752
|
-
return memoizeProp(this, "tags", () =>
|
|
1835
|
+
return memoizeProp(this, "tags", () => t$2([...this._allTags.keys()], compareNatural));
|
|
1753
1836
|
}
|
|
1754
1837
|
/**
|
|
1755
1838
|
* Returns all tags used in the model, sorted by usage count (descending).
|
|
1756
1839
|
*/
|
|
1757
1840
|
get tagsSortedByUsage() {
|
|
1758
|
-
return memoizeProp(this, "tagsSortedByUsage", () =>
|
|
1841
|
+
return memoizeProp(this, "tagsSortedByUsage", () => t$a(
|
|
1759
1842
|
[...this._allTags.entries()],
|
|
1760
|
-
|
|
1843
|
+
t$b(([tag, tagged]) => ({
|
|
1761
1844
|
tag,
|
|
1762
1845
|
count: tagged.size,
|
|
1763
1846
|
tagged
|
|
1764
1847
|
})),
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
[
|
|
1848
|
+
t$2((a, b) => compareNatural(a.tag, b.tag)),
|
|
1849
|
+
t$1(
|
|
1850
|
+
[e$1("count"), "desc"]
|
|
1768
1851
|
)
|
|
1769
1852
|
));
|
|
1770
1853
|
}
|
|
@@ -1980,4 +2063,4 @@ function isEdgeModel(edge) {
|
|
|
1980
2063
|
return edge instanceof EdgeModel;
|
|
1981
2064
|
}
|
|
1982
2065
|
|
|
1983
|
-
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 };
|