@likec4/core 1.41.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 +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,324 +0,0 @@
|
|
|
1
|
-
import { filter, findLast, forEach, map, pipe } from 'remeda'
|
|
2
|
-
import { ConnectionModel } from '../../model/connection/model/ConnectionModel'
|
|
3
|
-
import { LikeC4Model } from '../../model/LikeC4Model'
|
|
4
|
-
import type { RelationshipModel } from '../../model/RelationModel'
|
|
5
|
-
import {
|
|
6
|
-
type AnyAux,
|
|
7
|
-
type ComputedElementView,
|
|
8
|
-
type ElementViewRule,
|
|
9
|
-
type ModelGlobals,
|
|
10
|
-
type NodeId,
|
|
11
|
-
type ParsedElementView,
|
|
12
|
-
isViewRuleAutoLayout,
|
|
13
|
-
isViewRuleGroup,
|
|
14
|
-
isViewRulePredicate,
|
|
15
|
-
ModelExpression,
|
|
16
|
-
ModelFqnExpr,
|
|
17
|
-
ModelRelationExpr,
|
|
18
|
-
whereOperatorAsPredicate,
|
|
19
|
-
} from '../../types'
|
|
20
|
-
import { invariant, nonexhaustive, nonNullable, sortParentsFirst } from '../../utils'
|
|
21
|
-
import { DefaultMap } from '../../utils/mnemonist'
|
|
22
|
-
import { applyCustomElementProperties } from '../utils/applyCustomElementProperties'
|
|
23
|
-
import { applyCustomRelationProperties } from '../utils/applyCustomRelationProperties'
|
|
24
|
-
import { applyViewRuleStyles } from '../utils/applyViewRuleStyles'
|
|
25
|
-
import { buildElementNotations } from '../utils/buildElementNotations'
|
|
26
|
-
import { linkNodesWithEdges } from '../utils/link-nodes-with-edges'
|
|
27
|
-
import { resolveGlobalRulesInElementView } from '../utils/resolve-global-rules'
|
|
28
|
-
import { topologicalSort } from '../utils/topological-sort'
|
|
29
|
-
import { calcViewLayoutHash } from '../utils/view-hash'
|
|
30
|
-
import { type Connection, type Elem, type PredicateCtx } from './_types'
|
|
31
|
-
import { type NodesGroup, type Stage, Memory } from './memory'
|
|
32
|
-
import { ActiveGroupMemory } from './memory/memory'
|
|
33
|
-
import { StageFinal } from './memory/stage-final'
|
|
34
|
-
import { ExpandedElementPredicate } from './predicates/element-expand'
|
|
35
|
-
import { ElementKindOrTagPredicate } from './predicates/element-kind-tag'
|
|
36
|
-
import { ElementRefPredicate } from './predicates/element-ref'
|
|
37
|
-
import { DirectRelationExprPredicate } from './predicates/relation-direct'
|
|
38
|
-
import { IncomingExprPredicate } from './predicates/relation-in'
|
|
39
|
-
import { InOutRelationPredicate } from './predicates/relation-in-out'
|
|
40
|
-
import { OutgoingExprPredicate } from './predicates/relation-out'
|
|
41
|
-
import { WildcardPredicate } from './predicates/wildcard'
|
|
42
|
-
import { buildNodes, NoFilter, NoWhere, toComputedEdges } from './utils'
|
|
43
|
-
|
|
44
|
-
function processElementPredicate(
|
|
45
|
-
// ...args:
|
|
46
|
-
// | [expr: ModelAnyFqnExpr, op: 'include', IncludePredicateCtx<ModelAnyFqnExpr>]
|
|
47
|
-
// | [expr: ModelAnyFqnExpr, op: 'exclude', ExcludePredicateCtx<ModelAnyFqnExpr>]
|
|
48
|
-
expr: ModelFqnExpr.Any,
|
|
49
|
-
op: 'include' | 'exclude',
|
|
50
|
-
ctx: Omit<PredicateCtx<ModelFqnExpr.Any>, 'expr'>,
|
|
51
|
-
): Stage {
|
|
52
|
-
switch (true) {
|
|
53
|
-
case ModelFqnExpr.isCustom(expr): {
|
|
54
|
-
if (op === 'include') {
|
|
55
|
-
return processElementPredicate(expr.custom.expr, op, ctx)
|
|
56
|
-
}
|
|
57
|
-
return ctx.stage
|
|
58
|
-
}
|
|
59
|
-
case ModelFqnExpr.isWhere(expr): {
|
|
60
|
-
const where = whereOperatorAsPredicate(expr.where.condition)
|
|
61
|
-
const filterWhere = (elements: ReadonlyArray<Elem>) => {
|
|
62
|
-
return filter(elements, where)
|
|
63
|
-
}
|
|
64
|
-
return processElementPredicate(expr.where.expr, op, { ...ctx, where, filterWhere })
|
|
65
|
-
}
|
|
66
|
-
case ModelFqnExpr.isModelRef(expr) && expr.selector === 'expanded': {
|
|
67
|
-
return ExpandedElementPredicate[op]({ ...ctx, expr } as any) ?? ctx.stage
|
|
68
|
-
}
|
|
69
|
-
case ModelFqnExpr.isWildcard(expr): {
|
|
70
|
-
return WildcardPredicate[op]({ ...ctx, expr } as any) ?? ctx.stage
|
|
71
|
-
}
|
|
72
|
-
case ModelFqnExpr.isElementKindExpr(expr):
|
|
73
|
-
case ModelFqnExpr.isElementTagExpr(expr): {
|
|
74
|
-
return ElementKindOrTagPredicate[op]({ ...ctx, expr } as any) ?? ctx.stage
|
|
75
|
-
}
|
|
76
|
-
case ModelFqnExpr.isModelRef(expr): {
|
|
77
|
-
return ElementRefPredicate[op]({ ...ctx, expr } as any) ?? ctx.stage
|
|
78
|
-
}
|
|
79
|
-
default:
|
|
80
|
-
nonexhaustive(expr)
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function processRelationtPredicate(
|
|
84
|
-
expr: ModelRelationExpr.Any,
|
|
85
|
-
op: 'include' | 'exclude',
|
|
86
|
-
ctx: Omit<PredicateCtx<ModelRelationExpr.Any>, 'expr'>,
|
|
87
|
-
): Stage {
|
|
88
|
-
switch (true) {
|
|
89
|
-
case ModelRelationExpr.isCustom(expr): {
|
|
90
|
-
if (op === 'include') {
|
|
91
|
-
return processRelationtPredicate(expr.customRelation.expr, op, ctx)
|
|
92
|
-
}
|
|
93
|
-
return ctx.stage
|
|
94
|
-
}
|
|
95
|
-
case ModelRelationExpr.isWhere(expr): {
|
|
96
|
-
const where = whereOperatorAsPredicate(expr.where.condition)
|
|
97
|
-
const filterRelations = (relations: ReadonlySet<RelationshipModel>) => {
|
|
98
|
-
return new Set(filter([...relations], where))
|
|
99
|
-
}
|
|
100
|
-
const filterWhere = (connections: ReadonlyArray<Connection>) => {
|
|
101
|
-
return pipe(
|
|
102
|
-
connections,
|
|
103
|
-
map(c => new ConnectionModel(c.source, c.target, filterRelations(c.relations))),
|
|
104
|
-
filter(c => c.nonEmpty()),
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
return processRelationtPredicate(expr.where.expr, op, {
|
|
108
|
-
...ctx,
|
|
109
|
-
where,
|
|
110
|
-
filterWhere,
|
|
111
|
-
})
|
|
112
|
-
}
|
|
113
|
-
case ModelRelationExpr.isInOut(expr): {
|
|
114
|
-
return InOutRelationPredicate[op]({ ...ctx, expr } as any) ?? ctx.stage
|
|
115
|
-
}
|
|
116
|
-
case ModelRelationExpr.isDirect(expr): {
|
|
117
|
-
return DirectRelationExprPredicate[op]({ ...ctx, expr } as any) ?? ctx.stage
|
|
118
|
-
}
|
|
119
|
-
case ModelRelationExpr.isOutgoing(expr): {
|
|
120
|
-
return OutgoingExprPredicate[op]({ ...ctx, expr } as any) ?? ctx.stage
|
|
121
|
-
}
|
|
122
|
-
case ModelRelationExpr.isIncoming(expr): {
|
|
123
|
-
return IncomingExprPredicate[op]({ ...ctx, expr } as any) ?? ctx.stage
|
|
124
|
-
}
|
|
125
|
-
default:
|
|
126
|
-
nonexhaustive(expr)
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function processPredicates<A extends AnyAux>(
|
|
131
|
-
model: LikeC4Model<A>,
|
|
132
|
-
memory: Memory,
|
|
133
|
-
rules: ElementViewRule<A>[],
|
|
134
|
-
): Memory {
|
|
135
|
-
const ctx = {
|
|
136
|
-
model,
|
|
137
|
-
scope: memory.scope,
|
|
138
|
-
where: NoWhere,
|
|
139
|
-
filterWhere: NoFilter,
|
|
140
|
-
}
|
|
141
|
-
for (const rule of rules) {
|
|
142
|
-
if (isViewRuleGroup(rule)) {
|
|
143
|
-
const groupMemory = ActiveGroupMemory.enter(memory, rule)
|
|
144
|
-
memory = processPredicates(model, groupMemory, rule.groupRules)
|
|
145
|
-
invariant(memory instanceof ActiveGroupMemory, 'processPredicates must return ActiveGroupMemory')
|
|
146
|
-
memory = memory.leave()
|
|
147
|
-
continue
|
|
148
|
-
}
|
|
149
|
-
if (isViewRulePredicate(rule)) {
|
|
150
|
-
const op = 'include' in rule ? 'include' : 'exclude'
|
|
151
|
-
const exprs = rule.include ?? rule.exclude
|
|
152
|
-
for (const expr of exprs) {
|
|
153
|
-
let stage = op === 'include' ? memory.stageInclude(expr) : memory.stageExclude(expr)
|
|
154
|
-
switch (true) {
|
|
155
|
-
case ModelExpression.isFqnExpr(expr):
|
|
156
|
-
stage = processElementPredicate(expr, op, {
|
|
157
|
-
...ctx,
|
|
158
|
-
stage,
|
|
159
|
-
memory,
|
|
160
|
-
} as any) ?? stage
|
|
161
|
-
break
|
|
162
|
-
case ModelExpression.isRelationExpr(expr):
|
|
163
|
-
stage = processRelationtPredicate(expr, op, {
|
|
164
|
-
...ctx,
|
|
165
|
-
stage,
|
|
166
|
-
memory,
|
|
167
|
-
}) ?? stage
|
|
168
|
-
break
|
|
169
|
-
default:
|
|
170
|
-
nonexhaustive(expr)
|
|
171
|
-
}
|
|
172
|
-
memory = stage.commit()
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return StageFinal.for(memory).commit()
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export function computeElementView<A extends AnyAux>(
|
|
180
|
-
likec4model: LikeC4Model<any>,
|
|
181
|
-
{
|
|
182
|
-
docUri: _docUri, // exclude docUri
|
|
183
|
-
rules: _rules, // exclude rules
|
|
184
|
-
...view
|
|
185
|
-
}: ParsedElementView<A>,
|
|
186
|
-
): ComputedElementView<A> {
|
|
187
|
-
const rules = resolveGlobalRulesInElementView(
|
|
188
|
-
_rules,
|
|
189
|
-
likec4model.globals as unknown as ModelGlobals<A>,
|
|
190
|
-
)
|
|
191
|
-
const scope = view.viewOf ? likec4model.asComputed.element(view.viewOf) : null
|
|
192
|
-
let memory = processPredicates(
|
|
193
|
-
likec4model,
|
|
194
|
-
Memory.empty(scope),
|
|
195
|
-
rules,
|
|
196
|
-
)
|
|
197
|
-
if (memory.isEmpty() && scope) {
|
|
198
|
-
memory = memory.update({
|
|
199
|
-
final: new Set([scope]),
|
|
200
|
-
})
|
|
201
|
-
}
|
|
202
|
-
memory = assignElementsToGroups(memory)
|
|
203
|
-
|
|
204
|
-
const nodesMap = buildNodes<A>(memory)
|
|
205
|
-
|
|
206
|
-
const computedEdges = toComputedEdges(memory.connections as unknown as readonly ConnectionModel<A>[])
|
|
207
|
-
|
|
208
|
-
linkNodesWithEdges(nodesMap, computedEdges)
|
|
209
|
-
|
|
210
|
-
const sorted = topologicalSort({
|
|
211
|
-
nodes: nodesMap,
|
|
212
|
-
edges: computedEdges,
|
|
213
|
-
})
|
|
214
|
-
|
|
215
|
-
const nodes = applyCustomElementProperties(
|
|
216
|
-
rules,
|
|
217
|
-
applyViewRuleStyles(
|
|
218
|
-
rules,
|
|
219
|
-
sorted.nodes,
|
|
220
|
-
),
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
const autoLayoutRule = findLast(rules, isViewRuleAutoLayout)
|
|
224
|
-
|
|
225
|
-
const nodeNotations = buildElementNotations(nodes)
|
|
226
|
-
|
|
227
|
-
return calcViewLayoutHash({
|
|
228
|
-
...view,
|
|
229
|
-
_stage: 'computed',
|
|
230
|
-
autoLayout: {
|
|
231
|
-
direction: autoLayoutRule?.direction ?? 'TB',
|
|
232
|
-
...(autoLayoutRule?.nodeSep && { nodeSep: autoLayoutRule.nodeSep }),
|
|
233
|
-
...(autoLayoutRule?.rankSep && { rankSep: autoLayoutRule.rankSep }),
|
|
234
|
-
},
|
|
235
|
-
edges: applyCustomRelationProperties(rules, nodes, sorted.edges),
|
|
236
|
-
nodes: map(nodes, n => {
|
|
237
|
-
if (n.icon === 'none') {
|
|
238
|
-
delete n.icon
|
|
239
|
-
}
|
|
240
|
-
return n
|
|
241
|
-
}),
|
|
242
|
-
...(nodeNotations.length > 0 && {
|
|
243
|
-
notation: {
|
|
244
|
-
nodes: nodeNotations,
|
|
245
|
-
},
|
|
246
|
-
}),
|
|
247
|
-
})
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Clean up group.explicits and group.implicits
|
|
252
|
-
*/
|
|
253
|
-
function assignElementsToGroups(memory: Memory) {
|
|
254
|
-
if (memory.groups.length === 0) {
|
|
255
|
-
return memory
|
|
256
|
-
}
|
|
257
|
-
const groupAssignments = new DefaultMap<NodeId, Set<Elem>>(() => new Set())
|
|
258
|
-
|
|
259
|
-
const assignedTo = new Map<Elem, NodesGroup['id']>()
|
|
260
|
-
|
|
261
|
-
const isAncestorAssigned = (el: Elem) => {
|
|
262
|
-
for (const parent of el.ancestors()) {
|
|
263
|
-
const groupId = assignedTo.get(parent)
|
|
264
|
-
if (groupId) {
|
|
265
|
-
assignedTo.set(el, groupId)
|
|
266
|
-
groupAssignments.get(groupId).add(el)
|
|
267
|
-
return true
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return false
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const isDescendantAssigned = (el: Elem) => {
|
|
274
|
-
for (const descendant of el.descendants('asc')) {
|
|
275
|
-
const groupId = assignedTo.get(descendant)
|
|
276
|
-
if (groupId) {
|
|
277
|
-
assignedTo.set(el, groupId)
|
|
278
|
-
groupAssignments.get(groupId).add(el)
|
|
279
|
-
return true
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return false
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
pipe(
|
|
286
|
-
sortParentsFirst([...memory.explicitFirstSeenIn.keys()]),
|
|
287
|
-
forEach((el) => {
|
|
288
|
-
if (!isAncestorAssigned(el)) {
|
|
289
|
-
const groupId = nonNullable(memory.explicitFirstSeenIn.get(el))
|
|
290
|
-
assignedTo.set(el, groupId)
|
|
291
|
-
groupAssignments.get(groupId).add(el)
|
|
292
|
-
}
|
|
293
|
-
}),
|
|
294
|
-
)
|
|
295
|
-
|
|
296
|
-
pipe(
|
|
297
|
-
sortParentsFirst([...memory.lastSeenIn.keys()]),
|
|
298
|
-
filter(el => !assignedTo.has(el)),
|
|
299
|
-
forEach((el) => {
|
|
300
|
-
if (isAncestorAssigned(el)) {
|
|
301
|
-
return
|
|
302
|
-
}
|
|
303
|
-
if (isDescendantAssigned(el)) {
|
|
304
|
-
return
|
|
305
|
-
}
|
|
306
|
-
const groupId = nonNullable(memory.lastSeenIn.get(el))
|
|
307
|
-
assignedTo.set(el, groupId)
|
|
308
|
-
groupAssignments.get(groupId).add(el)
|
|
309
|
-
}),
|
|
310
|
-
)
|
|
311
|
-
|
|
312
|
-
if (groupAssignments.size === 0) {
|
|
313
|
-
return memory
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
let groups = memory.groups.map(group => {
|
|
317
|
-
const explicits = groupAssignments.get(group.id)
|
|
318
|
-
if (!explicits) {
|
|
319
|
-
return group
|
|
320
|
-
}
|
|
321
|
-
return group.update(explicits)
|
|
322
|
-
})
|
|
323
|
-
return memory.update({ groups })
|
|
324
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ElementModel } from '../../../model'
|
|
2
|
-
import { type AnyAux, type ElementViewRuleGroup, type NodeId, GroupElementKind } from '../../../types'
|
|
3
|
-
|
|
4
|
-
export class NodesGroup<A extends AnyAux = AnyAux> {
|
|
5
|
-
static readonly kind = GroupElementKind
|
|
6
|
-
|
|
7
|
-
constructor(
|
|
8
|
-
public readonly id: NodeId,
|
|
9
|
-
public readonly viewRule: ElementViewRuleGroup<A>,
|
|
10
|
-
public readonly parent: NodeId | null = null,
|
|
11
|
-
public readonly elements: ReadonlySet<ElementModel<A>> = new Set<ElementModel<A>>(),
|
|
12
|
-
) {
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
isEmpty() {
|
|
16
|
-
return this.elements.size === 0
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
update(elements: ReadonlySet<ElementModel<AnyAux>>): NodesGroup<A> {
|
|
20
|
-
return new NodesGroup(
|
|
21
|
-
this.id,
|
|
22
|
-
this.viewRule,
|
|
23
|
-
this.parent,
|
|
24
|
-
elements as unknown as ReadonlySet<ElementModel<A>>,
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
clone() {
|
|
29
|
-
return new NodesGroup(this.id, this.viewRule, this.parent, new Set(this.elements))
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { StageExclude } from './stage-exclude'
|
|
2
|
-
import type { StageInclude } from './stage-include'
|
|
3
|
-
|
|
4
|
-
export type { Ctx } from './memory'
|
|
5
|
-
export { Memory } from './memory'
|
|
6
|
-
export { NodesGroup } from './NodeGroup'
|
|
7
|
-
export { StageExclude } from './stage-exclude'
|
|
8
|
-
export { StageInclude } from './stage-include'
|
|
9
|
-
|
|
10
|
-
export type Stage = StageInclude | StageExclude
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import type { ConnectionModel, ElementModel } from '../../../model'
|
|
2
|
-
import type { aux, ElementViewRuleGroup as ViewRuleGroup, ModelExpression, NodeId, scalar } from '../../../types'
|
|
3
|
-
import { nonNullable } from '../../../utils'
|
|
4
|
-
import { Stack } from '../../../utils/mnemonist'
|
|
5
|
-
import { type ComputeCtx, type CtxElement, type MutableState, type StageExpression, AbstractMemory } from '../../memory'
|
|
6
|
-
import { NodesGroup } from './NodeGroup'
|
|
7
|
-
import { ActiveGroupStageExclude, StageExclude } from './stage-exclude'
|
|
8
|
-
import { ActiveGroupStageInclude, StageInclude } from './stage-include'
|
|
9
|
-
|
|
10
|
-
type A = aux.Any
|
|
11
|
-
|
|
12
|
-
export interface Ctx extends
|
|
13
|
-
ComputeCtx<
|
|
14
|
-
ElementModel<A>,
|
|
15
|
-
ConnectionModel<A>,
|
|
16
|
-
Memory<Ctx>,
|
|
17
|
-
StageInclude<Ctx>,
|
|
18
|
-
StageExclude,
|
|
19
|
-
ModelExpression<A>
|
|
20
|
-
>
|
|
21
|
-
{
|
|
22
|
-
MutableState: {
|
|
23
|
-
elements: Set<ElementModel<A>>
|
|
24
|
-
explicits: Set<ElementModel<A>>
|
|
25
|
-
final: Set<ElementModel<A>>
|
|
26
|
-
connections: ConnectionModel<A>[]
|
|
27
|
-
groups: NodesGroup<A>[]
|
|
28
|
-
/*
|
|
29
|
-
* The group where explict element was added first time
|
|
30
|
-
* May be a root group
|
|
31
|
-
*/
|
|
32
|
-
explicitFirstSeenIn: Map<ElementModel<A>, scalar.NodeId>
|
|
33
|
-
/**
|
|
34
|
-
* The group where element (implicit or explicit) was last seen (added or updated)
|
|
35
|
-
* Exclude root group
|
|
36
|
-
*/
|
|
37
|
-
lastSeenIn: Map<ElementModel<A>, scalar.NodeId>
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export class Memory<C extends Ctx = Ctx> extends AbstractMemory<C> {
|
|
42
|
-
static empty<EC extends Ctx>(scope: ElementModel<any> | null): Memory<EC> {
|
|
43
|
-
return new Memory({
|
|
44
|
-
elements: new Set(),
|
|
45
|
-
explicits: new Set(),
|
|
46
|
-
final: new Set(),
|
|
47
|
-
connections: [],
|
|
48
|
-
groups: [],
|
|
49
|
-
explicitFirstSeenIn: new Map(),
|
|
50
|
-
lastSeenIn: new Map(),
|
|
51
|
-
}, scope)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
protected constructor(
|
|
55
|
-
protected override state: MutableState<C>,
|
|
56
|
-
public readonly scope: CtxElement<C> | null,
|
|
57
|
-
) {
|
|
58
|
-
super(state)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public get groups(): ReadonlyArray<NodesGroup<A>> {
|
|
62
|
-
return this.state.groups
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public get explicitFirstSeenIn(): ReadonlyMap<ElementModel<A>, scalar.NodeId> {
|
|
66
|
-
return this.state.explicitFirstSeenIn
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public get lastSeenIn(): ReadonlyMap<ElementModel<A>, scalar.NodeId> {
|
|
70
|
-
return this.state.lastSeenIn
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
override stageInclude(expr: StageExpression<C>): StageInclude {
|
|
74
|
-
return new StageInclude(this, expr)
|
|
75
|
-
}
|
|
76
|
-
override stageExclude(expr: StageExpression<C>): StageExclude {
|
|
77
|
-
return new StageExclude(this, expr)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
override mutableState(): MutableState<C> {
|
|
81
|
-
return ({
|
|
82
|
-
elements: new Set(this.state.elements),
|
|
83
|
-
explicits: new Set(this.state.explicits),
|
|
84
|
-
final: new Set(this.state.final),
|
|
85
|
-
connections: [...this.state.connections],
|
|
86
|
-
groups: this.state.groups.map((g) => g.clone()),
|
|
87
|
-
explicitFirstSeenIn: new Map(this.state.explicitFirstSeenIn),
|
|
88
|
-
lastSeenIn: new Map(this.state.lastSeenIn),
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
override update(newstate: Partial<C['MutableState']>): Memory {
|
|
93
|
-
return new Memory({
|
|
94
|
-
...this.state,
|
|
95
|
-
...newstate,
|
|
96
|
-
}, this.scope)
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
type ActiveGroupState = Ctx['MutableState'] & {
|
|
101
|
-
// activeGroup: NodesGroup
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface ActiveGroupCtx extends Ctx {
|
|
105
|
-
MutableState: ActiveGroupState
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export class ActiveGroupMemory extends Memory<ActiveGroupCtx> {
|
|
109
|
-
static enter(
|
|
110
|
-
memory: Memory,
|
|
111
|
-
rule: ViewRuleGroup<any>,
|
|
112
|
-
): ActiveGroupMemory {
|
|
113
|
-
const groupId = `@gr${memory.groups.length + 1}` as NodeId
|
|
114
|
-
if (memory instanceof ActiveGroupMemory) {
|
|
115
|
-
const stack = Stack.from([...memory.stack].reverse())
|
|
116
|
-
const state = memory.mutableState()
|
|
117
|
-
state.groups.push(new NodesGroup(groupId, rule, memory.activeGroupId))
|
|
118
|
-
stack.push(groupId)
|
|
119
|
-
return new ActiveGroupMemory(state, memory.scope, stack)
|
|
120
|
-
}
|
|
121
|
-
const state = memory.mutableState() as ActiveGroupState
|
|
122
|
-
state.groups.push(new NodesGroup(groupId, rule, null))
|
|
123
|
-
const stack = Stack.of(groupId)
|
|
124
|
-
return new ActiveGroupMemory(state, memory.scope, stack)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
protected constructor(
|
|
128
|
-
protected override state: ActiveGroupState,
|
|
129
|
-
public override readonly scope: CtxElement<ActiveGroupCtx> | null,
|
|
130
|
-
// Stack of group ids
|
|
131
|
-
protected stack: Stack<NodeId>,
|
|
132
|
-
) {
|
|
133
|
-
super(state, scope)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
get activeGroupId(): NodeId {
|
|
137
|
-
return nonNullable(this.stack.peek(), 'Stack must not be empty')
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
override mutableState(): ActiveGroupState {
|
|
141
|
-
const state = super.mutableState()
|
|
142
|
-
return ({
|
|
143
|
-
...state,
|
|
144
|
-
// activeGroup: this.findActiveGroup(state.groups)
|
|
145
|
-
})
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// private findActiveGroup(groups: NodesGroup[]): NodesGroup {
|
|
149
|
-
// return nonNullable(groups.find(g => g.id === this.activeGroup.id), 'Active group not found in groups')
|
|
150
|
-
// }
|
|
151
|
-
|
|
152
|
-
override update(newstate: Partial<ActiveGroupState>): ActiveGroupMemory {
|
|
153
|
-
const nextstate = {
|
|
154
|
-
...this.state,
|
|
155
|
-
...newstate,
|
|
156
|
-
}
|
|
157
|
-
// const activeGroup = this.findActiveGroup(nextstate.groups)
|
|
158
|
-
// invariant(Object.is(activeGroup, nextstate.activeGroup), 'Active group must strictly equal to the group in groups')
|
|
159
|
-
return new ActiveGroupMemory(nextstate, this.scope, this.stack)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
override stageInclude(expr: StageExpression<Ctx>): ActiveGroupStageInclude {
|
|
163
|
-
return new ActiveGroupStageInclude(this, expr)
|
|
164
|
-
}
|
|
165
|
-
override stageExclude(expr: StageExpression<Ctx>): ActiveGroupStageExclude {
|
|
166
|
-
return new ActiveGroupStageExclude(this, expr)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
public leave(): Memory {
|
|
170
|
-
const state = this.mutableState()
|
|
171
|
-
this.stack.pop()
|
|
172
|
-
const prevgroup = this.stack.peek()
|
|
173
|
-
if (prevgroup) {
|
|
174
|
-
return new ActiveGroupMemory(state, this.scope, this.stack)
|
|
175
|
-
}
|
|
176
|
-
return new Memory(state, this.scope)
|
|
177
|
-
}
|
|
178
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { filter, forEach, pipe } from 'remeda'
|
|
2
|
-
import type { RelationshipModel } from '../../../model/RelationModel'
|
|
3
|
-
import { difference, hasIntersection, intersection } from '../../../utils/set'
|
|
4
|
-
import { AbstractStageExclude, type MutableState, type StageExpression } from '../../memory'
|
|
5
|
-
import { type ActiveGroupCtx, type ActiveGroupMemory, type Ctx } from './memory'
|
|
6
|
-
|
|
7
|
-
export class StageExclude<C extends Ctx = Ctx> extends AbstractStageExclude<C> {
|
|
8
|
-
public excludeRelations(excluded: ReadonlySet<RelationshipModel<any>>): this {
|
|
9
|
-
pipe(
|
|
10
|
-
this.memory.connections,
|
|
11
|
-
filter(c => hasIntersection(c.relations, excluded)),
|
|
12
|
-
forEach(c => {
|
|
13
|
-
this.excludeConnections(
|
|
14
|
-
c.update(intersection(c.relations, excluded)),
|
|
15
|
-
)
|
|
16
|
-
}),
|
|
17
|
-
)
|
|
18
|
-
return this
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Precommit hook
|
|
23
|
-
*/
|
|
24
|
-
protected override precommit(state: MutableState<C>): MutableState<C> {
|
|
25
|
-
if (this.excluded.elements.size > 0) {
|
|
26
|
-
const excludeRelationships = new Set(
|
|
27
|
-
[...this.excluded.elements].flatMap(el => [
|
|
28
|
-
...el.incoming('direct'),
|
|
29
|
-
...el.outgoing('direct'),
|
|
30
|
-
]),
|
|
31
|
-
)
|
|
32
|
-
this.excludeRelations(excludeRelationships)
|
|
33
|
-
}
|
|
34
|
-
return state
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
protected override postcommit(state: C['MutableState']) {
|
|
38
|
-
const leftExplicits = difference(this.memory.explicits, state.explicits)
|
|
39
|
-
for (const explicit of leftExplicits) {
|
|
40
|
-
state.explicitFirstSeenIn.delete(explicit)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Left elements
|
|
44
|
-
const left = difference(this.memory.elements, state.elements)
|
|
45
|
-
for (const el of left) {
|
|
46
|
-
state.lastSeenIn.delete(el)
|
|
47
|
-
}
|
|
48
|
-
return state
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export class ActiveGroupStageExclude extends StageExclude {
|
|
53
|
-
constructor(
|
|
54
|
-
public override readonly memory: ActiveGroupMemory,
|
|
55
|
-
public override readonly expression: StageExpression<ActiveGroupCtx>,
|
|
56
|
-
) {
|
|
57
|
-
super(memory, expression)
|
|
58
|
-
}
|
|
59
|
-
}
|