@likec4/core 1.19.2 → 1.20.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/dist/builder/index.cjs +881 -0
- package/dist/builder/index.d.cts +503 -0
- package/dist/builder/index.d.mts +4 -3
- package/dist/builder/index.d.ts +4 -3
- package/dist/builder/{index.js → index.mjs} +14 -4
- package/dist/compute-view/index.cjs +86 -0
- package/dist/compute-view/index.d.cts +23 -0
- package/dist/compute-view/index.d.mts +3 -2
- package/dist/compute-view/index.d.ts +3 -2
- package/dist/compute-view/{index.js → index.mjs} +6 -5
- package/dist/index.cjs +4320 -0
- package/dist/index.d.cts +270 -0
- package/dist/index.d.mts +130 -4
- package/dist/index.d.ts +130 -4
- package/dist/{index.js → index.mjs} +512 -7
- package/dist/model/index.cjs +40 -0
- package/dist/model/index.d.cts +259 -0
- package/dist/model/index.d.mts +3 -3
- package/dist/model/index.d.ts +3 -3
- package/dist/model/index.mjs +1 -0
- package/dist/shared/core.B2QYWlYe.cjs +435 -0
- package/dist/shared/core.B72vUaNB.d.cts +850 -0
- package/dist/shared/core.BGus30EM.cjs +8027 -0
- package/dist/shared/core.BRuJ3Wzf.d.mts +12 -0
- package/dist/shared/{core.CqXs9Frh.d.ts → core.BdbFkE_p.d.cts} +10 -4
- package/dist/shared/core.BvdNMbcA.d.cts +12 -0
- package/dist/shared/{object_hash.CE_oF3I3.js → core.BxvDITEI.mjs} +26 -389
- package/dist/shared/core.ByNgh-mC.d.cts +127 -0
- package/dist/shared/core.C9DCnJh8.cjs +908 -0
- package/dist/shared/{index.KOeaSlL8.js → core.CqCTxzMY.mjs} +787 -372
- package/dist/shared/core.D74xkKkG.d.cts +148 -0
- package/dist/shared/{core.DyJ41fBO.d.ts → core.D_Gc58Gt.d.ts} +12 -4
- package/dist/shared/core.Damrzla-.d.ts +12 -0
- package/dist/shared/{core.BL1oTk7-.d.mts → core.Dfzrh1VA.d.mts} +12 -4
- package/dist/shared/core.DsoCu540.cjs +26 -0
- package/dist/shared/{view.DrmaOfjr.js → core.DunIMHRf.mjs} +24 -1
- package/dist/shared/{core.2I-l5UtM.d.mts → core.ZWiGANIJ.d.ts} +10 -4
- package/dist/shared/core.gv1bMwCC.cjs +39 -0
- package/dist/shared/core.jy6z2iRn.d.mts +729 -0
- package/dist/shared/core.m3rCQAv6.mjs +37 -0
- package/dist/types/index.cjs +107 -0
- package/dist/types/index.d.cts +72 -0
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/{index.js → index.mjs} +1 -1
- package/dist/utils/index.cjs +95 -0
- package/dist/utils/index.d.cts +356 -0
- package/dist/utils/index.d.mts +1 -64
- package/dist/utils/index.d.ts +1 -64
- package/dist/utils/index.mjs +56 -0
- package/package.json +51 -25
- package/src/builder/Builder.view-common.ts +20 -1
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +26 -29
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +1 -1
- package/src/compute-view/deployment-view/predicates/utils.ts +47 -16
- package/src/compute-view/element-view/__test__/fixture.ts +17 -4
- package/src/compute-view/element-view/compute.ts +3 -2
- package/src/compute-view/element-view/predicates.ts +520 -0
- package/src/compute-view/element-view/utils.ts +11 -7
- package/src/compute-view/index.ts +1 -0
- package/src/compute-view/relationships-view/_types.ts +16 -0
- package/src/compute-view/relationships-view/compute.ts +74 -0
- package/src/compute-view/relationships-view/layout.ts +357 -0
- package/src/compute-view/relationships-view/utils.ts +40 -0
- package/src/compute-view/utils/relationExpressionToPredicates.ts +11 -4
- package/src/index.ts +16 -0
- package/src/model/DeploymentElementModel.ts +4 -0
- package/src/model/ElementModel.ts +13 -0
- package/src/model/LikeC4Model.ts +2 -2
- package/src/model/RelationModel.ts +5 -0
- package/src/model/guards.ts +17 -1
- package/src/model/view/LikeC4ViewModel.ts +7 -1
- package/src/model/view/NodeModel.ts +5 -0
- package/src/types/operators.ts +42 -2
- package/src/types/view.ts +2 -2
- package/src/utils/index.ts +0 -5
- package/src/utils/iterable/unique.ts +1 -7
- package/dist/model/index.js +0 -1
- package/dist/utils/index.js +0 -347
- /package/dist/shared/{chunk-RAAYCPUM.M-JWF7SS.js → core.M-JWF7SS.mjs} +0 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { LiteralUnion, Tagged, Simplify, UnionToIntersection, TupleToUnion } from 'type-fest';
|
|
2
|
+
|
|
3
|
+
declare const ThemeColors: readonly ["amber", "blue", "gray", "slate", "green", "indigo", "muted", "primary", "red", "secondary", "sky"];
|
|
4
|
+
type ThemeColor = typeof ThemeColors[number];
|
|
5
|
+
type HexColorLiteral = `#${string}`;
|
|
6
|
+
type ColorLiteral = HexColorLiteral;
|
|
7
|
+
type Color = LiteralUnion<ThemeColor, string>;
|
|
8
|
+
declare function isThemeColor(color: Color): color is ThemeColor;
|
|
9
|
+
interface ElementThemeColorValues {
|
|
10
|
+
fill: ColorLiteral;
|
|
11
|
+
stroke: ColorLiteral;
|
|
12
|
+
hiContrast: ColorLiteral;
|
|
13
|
+
loContrast: ColorLiteral;
|
|
14
|
+
}
|
|
15
|
+
type ElementThemeColors = {
|
|
16
|
+
[key in ThemeColor]: ElementThemeColorValues;
|
|
17
|
+
};
|
|
18
|
+
interface RelationshipThemeColorValues {
|
|
19
|
+
lineColor: ColorLiteral;
|
|
20
|
+
labelBgColor: ColorLiteral;
|
|
21
|
+
labelColor: ColorLiteral;
|
|
22
|
+
}
|
|
23
|
+
interface ThemeColorValues {
|
|
24
|
+
elements: ElementThemeColorValues;
|
|
25
|
+
relationships: RelationshipThemeColorValues;
|
|
26
|
+
}
|
|
27
|
+
type RelationshipThemeColors = {
|
|
28
|
+
[key in ThemeColor]: RelationshipThemeColorValues;
|
|
29
|
+
};
|
|
30
|
+
interface LikeC4Theme {
|
|
31
|
+
font: 'Arial';
|
|
32
|
+
shadow: ColorLiteral;
|
|
33
|
+
relationships: RelationshipThemeColors;
|
|
34
|
+
elements: ElementThemeColors;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
38
|
+
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
39
|
+
type IconUrl = Tagged<string, 'IconUrl'> | 'none';
|
|
40
|
+
type CustomColor = string;
|
|
41
|
+
type Point = readonly [x: number, y: number];
|
|
42
|
+
interface XYPoint {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
}
|
|
46
|
+
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
47
|
+
type AllNever<Expressions> = UnionToIntersection<{
|
|
48
|
+
[Name in keyof Expressions]: {
|
|
49
|
+
-readonly [Key in keyof Expressions[Name]]?: never;
|
|
50
|
+
};
|
|
51
|
+
}[keyof Expressions]>;
|
|
52
|
+
/**
|
|
53
|
+
* @example
|
|
54
|
+
* type Variant1 = {
|
|
55
|
+
* a: string
|
|
56
|
+
* }
|
|
57
|
+
* type Variant2 = {
|
|
58
|
+
* b: number
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* type Variants = ExclusiveUnion<{
|
|
62
|
+
* Variant1: Variant1,
|
|
63
|
+
* Variant2: Variant2
|
|
64
|
+
* }>
|
|
65
|
+
*
|
|
66
|
+
* Fail here
|
|
67
|
+
* const variant1: Variants = {
|
|
68
|
+
* a: 'one',
|
|
69
|
+
* b: 1
|
|
70
|
+
* }
|
|
71
|
+
*/
|
|
72
|
+
type ExclusiveUnion<Expressions> = Expressions extends object ? {
|
|
73
|
+
[Name in keyof Expressions]: Simplify<Omit<AllNever<Expressions>, keyof Expressions[Name]> & Expressions[Name]>;
|
|
74
|
+
}[keyof Expressions] : Expressions;
|
|
75
|
+
/**
|
|
76
|
+
* Copy from https://github.com/remeda/remeda/blob/main/src/internal/types/NTuple.ts
|
|
77
|
+
* An array with *exactly* N elements in it.
|
|
78
|
+
*
|
|
79
|
+
* Only literal N values are supported. For very large N the type might result
|
|
80
|
+
* in a recurse depth error. For negative N the type would result in an infinite
|
|
81
|
+
* recursion. None of these have protections because this is an internal type!
|
|
82
|
+
*/
|
|
83
|
+
type NTuple<T, N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : NTuple<T, N, [...Result, T]>;
|
|
84
|
+
type IteratorLike<T> = IteratorObject<T, BuiltinIteratorReturn>;
|
|
85
|
+
type Predicate<T> = (x: T) => boolean;
|
|
86
|
+
|
|
87
|
+
type Fqn<Id extends string = string> = Tagged<Id, 'Fqn'>;
|
|
88
|
+
declare function AsFqn(name: string, parent?: Fqn | null): Fqn;
|
|
89
|
+
declare const BorderStyles: readonly ["solid", "dashed", "dotted", "none"];
|
|
90
|
+
type BorderStyle = TupleToUnion<typeof BorderStyles>;
|
|
91
|
+
type ElementKind<Kinds extends string = string> = Tagged<Kinds, 'ElementKind'>;
|
|
92
|
+
declare namespace ElementKind {
|
|
93
|
+
const Group: ElementKind;
|
|
94
|
+
}
|
|
95
|
+
declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue"];
|
|
96
|
+
type ElementShape = TupleToUnion<typeof ElementShapes>;
|
|
97
|
+
declare const DefaultThemeColor: ThemeColor;
|
|
98
|
+
declare const DefaultElementShape: ElementShape;
|
|
99
|
+
interface ElementStyle {
|
|
100
|
+
readonly border?: BorderStyle;
|
|
101
|
+
/**
|
|
102
|
+
* In percentage 0-100, 0 is fully transparent
|
|
103
|
+
*
|
|
104
|
+
* @default 100
|
|
105
|
+
*/
|
|
106
|
+
readonly opacity?: number;
|
|
107
|
+
}
|
|
108
|
+
type Tag<Tags extends string = string> = Tagged<Tags, 'Tag'>;
|
|
109
|
+
interface TagSpec {
|
|
110
|
+
readonly id: Tag;
|
|
111
|
+
readonly style: ElementStyle;
|
|
112
|
+
}
|
|
113
|
+
interface Link {
|
|
114
|
+
readonly title?: string;
|
|
115
|
+
readonly url: string;
|
|
116
|
+
readonly relative?: string;
|
|
117
|
+
}
|
|
118
|
+
interface TypedElement<Ids extends string, Kinds extends string, Tags extends string, MetadataKeys extends string = never> {
|
|
119
|
+
readonly id: Fqn<Ids>;
|
|
120
|
+
readonly kind: ElementKind<Kinds>;
|
|
121
|
+
readonly title: string;
|
|
122
|
+
readonly description: string | null;
|
|
123
|
+
readonly technology: string | null;
|
|
124
|
+
readonly tags: NonEmptyArray<Tag<Tags>> | null;
|
|
125
|
+
readonly links: NonEmptyArray<Link> | null;
|
|
126
|
+
readonly icon?: IconUrl;
|
|
127
|
+
readonly shape?: ElementShape;
|
|
128
|
+
readonly color?: Color;
|
|
129
|
+
readonly style?: ElementStyle;
|
|
130
|
+
readonly notation?: string;
|
|
131
|
+
readonly metadata?: Record<MetadataKeys, string>;
|
|
132
|
+
}
|
|
133
|
+
interface Element extends TypedElement<string, string, string, string> {
|
|
134
|
+
}
|
|
135
|
+
interface ElementKindSpecificationStyle {
|
|
136
|
+
shape?: ElementShape;
|
|
137
|
+
icon?: IconUrl;
|
|
138
|
+
color?: Color;
|
|
139
|
+
border?: BorderStyle;
|
|
140
|
+
opacity?: number;
|
|
141
|
+
}
|
|
142
|
+
interface ElementKindSpecification {
|
|
143
|
+
readonly technology?: string;
|
|
144
|
+
readonly notation?: string;
|
|
145
|
+
readonly style: ElementKindSpecificationStyle;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { AsFqn as A, BorderStyles as B, type CustomColor as C, DefaultElementShape as D, type ExclusiveUnion as E, type Fqn as F, type HexColorLiteral as H, type IconUrl as I, type KeysOf as K, type LikeC4Theme as L, type NonEmptyArray as N, type Point as P, type RelationshipThemeColors as R, type ThemeColorValues as T, type XYPoint as X, type IteratorLike as a, type NonEmptyReadonlyArray as b, type NTuple as c, type Predicate as d, DefaultThemeColor as e, ElementKind as f, ElementShapes as g, type BorderStyle as h, type Element as i, type ElementKindSpecification as j, type ElementKindSpecificationStyle as k, type ElementShape as l, type ElementStyle as m, type Link as n, type Tag as o, type TagSpec as p, type TypedElement as q, isThemeColor as r, type Color as s, type ColorLiteral as t, type ElementThemeColors as u, type ElementThemeColorValues as v, type RelationshipThemeColorValues as w, type ThemeColor as x };
|
|
@@ -14,6 +14,7 @@ type AllNever = {
|
|
|
14
14
|
or?: never;
|
|
15
15
|
tag?: never;
|
|
16
16
|
kind?: never;
|
|
17
|
+
participant?: never;
|
|
17
18
|
};
|
|
18
19
|
type TagEqual<Tag> = Omit<AllNever, 'tag'> & {
|
|
19
20
|
tag: EqualOperator<Tag>;
|
|
@@ -23,6 +24,11 @@ type KindEqual<Kind> = Omit<AllNever, 'kind'> & {
|
|
|
23
24
|
kind: EqualOperator<Kind>;
|
|
24
25
|
};
|
|
25
26
|
declare const isKindEqual: <Kind>(operator: WhereOperator<any, Kind>) => operator is KindEqual<Kind>;
|
|
27
|
+
type Participant = 'source' | 'target';
|
|
28
|
+
type ParticipantOperator<Tag, Kind> = Omit<AllNever, 'participant'> & {
|
|
29
|
+
participant: Participant;
|
|
30
|
+
operator: KindEqual<Kind> | TagEqual<Tag>;
|
|
31
|
+
};
|
|
26
32
|
type NotOperator<Tag, Kind> = Omit<AllNever, 'not'> & {
|
|
27
33
|
not: WhereOperator<Tag, Kind>;
|
|
28
34
|
};
|
|
@@ -35,13 +41,15 @@ type OrOperator<Tag, Kind> = Omit<AllNever, 'or'> & {
|
|
|
35
41
|
or: NonEmptyArray<WhereOperator<Tag, Kind>>;
|
|
36
42
|
};
|
|
37
43
|
declare const isOrOperator: <Tag, Kind>(operator: WhereOperator<Tag, Kind>) => operator is OrOperator<Tag, Kind>;
|
|
38
|
-
type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
|
|
44
|
+
type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | ParticipantOperator<Tag, Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
|
|
39
45
|
type Filterable<FTag extends string | null = string | null, FKind extends string | null = string | null> = {
|
|
40
46
|
tags?: readonly FTag[] | null;
|
|
41
47
|
kind?: FKind;
|
|
48
|
+
source?: Filterable<FTag, FKind>;
|
|
49
|
+
target?: Filterable<FTag, FKind>;
|
|
42
50
|
};
|
|
43
51
|
type OperatorPredicate<V extends Filterable> = (value: V) => boolean;
|
|
44
|
-
declare function whereOperatorAsPredicate<FTag extends string = string, FKind extends string = string>(operator: WhereOperator<FTag, FKind>): OperatorPredicate<Filterable>;
|
|
52
|
+
declare function whereOperatorAsPredicate<FTag extends string | null = string | null, FKind extends string | null = string | null>(operator: WhereOperator<FTag, FKind>): OperatorPredicate<Filterable>;
|
|
45
53
|
|
|
46
54
|
interface BaseExpr {
|
|
47
55
|
where?: never;
|
|
@@ -526,7 +534,7 @@ interface ComputedNode {
|
|
|
526
534
|
*/
|
|
527
535
|
icon?: IconUrl;
|
|
528
536
|
style: ElementStyle;
|
|
529
|
-
navigateTo?: ViewId;
|
|
537
|
+
navigateTo?: ViewId | null;
|
|
530
538
|
level: number;
|
|
531
539
|
depth?: number;
|
|
532
540
|
/**
|
|
@@ -839,4 +847,4 @@ interface LayoutedLikeC4Model<Fqns extends string = string, DeploymentFqns exten
|
|
|
839
847
|
views: Record<Views, DiagramView<Views, Tags>>;
|
|
840
848
|
}
|
|
841
849
|
|
|
842
|
-
export { type GlobalDynamicPredicates as $, type CustomElementExpr as A, type CustomRelationExpr as B, ComputedView as C, DeploymentElement as D, type DirectRelationExpr as E, type ElementExpression as F, type ElementKindExpr as G, type ElementPredicateExpression as H, type ElementRefExpr as I, type ElementTagExpr as J, type ElementWhereExpr as K, type LikeC4View as L, type ExpandedElementExpr as M, type Expression as N, type IncomingExpr as O, type PredicateSelector as P, type InOutExpr as Q, type NonWilcard as R, type OutgoingExpr as S, type RelationExpression as T, type RelationPredicateExpression as U, type RelationWhereExpr as V, type WildcardExpr as W, ExpressionV2 as X, FqnExpr as Y, FqnRef as Z, RelationExpr as _, type ComputedLikeC4Model as a, type CustomColorDefinitions as a$, type GlobalPredicateId as a0, type GlobalPredicates as a1, type GlobalStyleID as a2, type GlobalStyles as a3, type ModelGlobals as a4, type AnyParsedLikeC4Model as a5, type GenericLikeC4Model as a6, type LayoutedLikeC4Model as a7, type LikeC4ModelDump as a8, type ParsedLikeC4Model as a9, DiagramNode as aA, extractStep as aB, getBBoxCenter as aC, getParallelStepsPrefix as aD, isAutoLayoutDirection as aE, isDeploymentView as aF, isDynamicView as aG, isDynamicViewParallelSteps as aH, isElementView as aI, isExtendsElementView as aJ, isScopedElementView as aK, isStepEdgeId as aL, isViewRuleAutoLayout as aM, isViewRuleGlobalPredicateRef as aN, isViewRuleGlobalStyle as aO, isViewRuleGroup as aP, isViewRulePredicate as aQ, isViewRuleStyle as aR, stepEdgeId as aS, type AutoLayoutDirection as aT, type BasicElementView as aU, type BasicView as aV, type BBox as aW, type ComputedDeploymentView as aX, type ComputedDynamicView as aY, type ComputedEdge as aZ, type ComputedElementView as a_, isAndOperator as aa, isKindEqual as ab, isNotOperator as ac, isOrOperator as ad, isTagEqual as ae, whereOperatorAsPredicate as af, type AndOperator as ag, type EqualOperator as ah, type Filterable as ai, type KindEqual as aj, type NotOperator as ak, type OperatorPredicate as al, type OrOperator as am, type TagEqual as an, type WhereOperator as ao, DefaultArrowType as ap, DefaultLineStyle as aq, DefaultRelationshipColor as ar, type AbstractRelation as as, type ModelRelation as at, type RelationId as au, type RelationshipArrowType as av, type RelationshipKind as aw, type RelationshipKindSpecification as ax, type RelationshipLineType as ay, ComputedNode as az, type DeployedInstance as b, type DeploymentView as b0, type DeploymentViewRule as b1, type DeploymentViewRulePredicate as b2, type DeploymentViewRuleStyle as b3, type DiagramEdge as b4, type DiagramView as b5, type DynamicView as b6, type DynamicViewIncludeRule as b7, type DynamicViewParallelSteps as b8, type DynamicViewRule as b9, type DynamicViewStep as ba, type DynamicViewStepOrParallel as bb, type EdgeId as bc, type ElementView as bd, type ExtendsElementView as be, type NodeId as bf, type ScopedElementView as bg, type StepEdgeId as bh, type StepEdgeIdLiteral as bi, type ViewAutoLayout as bj, type ViewId as bk, type ViewManualLayout as bl, type ViewRule as bm, type ViewRuleAutoLayout as bn, type ViewRuleGlobalPredicateRef as bo, type ViewRuleGlobalStyle as bp, type ViewRuleGroup as bq, type ViewRulePredicate as br, type ViewRuleStyle as bs, type ViewRuleStyleOrGlobalRef as bt, type ViewWithHash as bu, type ViewWithNotation as bv, type ElementNotation as bw, type DeploymentElementStyle as c, type DeploymentNode as d, expression as e, type DeploymentNodeKind as f, type DeploymentNodeKindSpecification as g, type DeploymentRef as h, type DeploymentRelation as i, isCustomElement as j, isCustomRelationExpr as k, isElement as l, isElementKindExpr as m, isElementPredicateExpr as n, isElementRef as o, isElementTagExpr as p, isElementWhere as q, isExpandedElementExpr as r, isIncoming as s, isInOut as t, isOutgoing as u, isRelation as v, isRelationExpression as w, isRelationPredicateExpr as x, isRelationWhere as y, isWildcard as z };
|
|
850
|
+
export { type GlobalDynamicPredicates as $, type CustomElementExpr as A, type CustomRelationExpr as B, ComputedView as C, DeploymentElement as D, type DirectRelationExpr as E, type ElementExpression as F, type ElementKindExpr as G, type ElementPredicateExpression as H, type ElementRefExpr as I, type ElementTagExpr as J, type ElementWhereExpr as K, type LikeC4View as L, type ExpandedElementExpr as M, type Expression as N, type IncomingExpr as O, type PredicateSelector as P, type InOutExpr as Q, type NonWilcard as R, type OutgoingExpr as S, type RelationExpression as T, type RelationPredicateExpression as U, type RelationWhereExpr as V, type WildcardExpr as W, ExpressionV2 as X, FqnExpr as Y, FqnRef as Z, RelationExpr as _, type ComputedLikeC4Model as a, type CustomColorDefinitions as a$, type GlobalPredicateId as a0, type GlobalPredicates as a1, type GlobalStyleID as a2, type GlobalStyles as a3, type ModelGlobals as a4, type AnyParsedLikeC4Model as a5, type GenericLikeC4Model as a6, type LayoutedLikeC4Model as a7, type LikeC4ModelDump as a8, type ParsedLikeC4Model as a9, DiagramNode as aA, extractStep as aB, getBBoxCenter as aC, getParallelStepsPrefix as aD, isAutoLayoutDirection as aE, isDeploymentView as aF, isDynamicView as aG, isDynamicViewParallelSteps as aH, isElementView as aI, isExtendsElementView as aJ, isScopedElementView as aK, isStepEdgeId as aL, isViewRuleAutoLayout as aM, isViewRuleGlobalPredicateRef as aN, isViewRuleGlobalStyle as aO, isViewRuleGroup as aP, isViewRulePredicate as aQ, isViewRuleStyle as aR, stepEdgeId as aS, type AutoLayoutDirection as aT, type BasicElementView as aU, type BasicView as aV, type BBox as aW, type ComputedDeploymentView as aX, type ComputedDynamicView as aY, type ComputedEdge as aZ, type ComputedElementView as a_, isAndOperator as aa, isKindEqual as ab, isNotOperator as ac, isOrOperator as ad, isTagEqual as ae, whereOperatorAsPredicate as af, type AndOperator as ag, type EqualOperator as ah, type Filterable as ai, type KindEqual as aj, type NotOperator as ak, type OperatorPredicate as al, type OrOperator as am, type TagEqual as an, type WhereOperator as ao, DefaultArrowType as ap, DefaultLineStyle as aq, DefaultRelationshipColor as ar, type AbstractRelation as as, type ModelRelation as at, type RelationId as au, type RelationshipArrowType as av, type RelationshipKind as aw, type RelationshipKindSpecification as ax, type RelationshipLineType as ay, ComputedNode as az, type DeployedInstance as b, type DeploymentView as b0, type DeploymentViewRule as b1, type DeploymentViewRulePredicate as b2, type DeploymentViewRuleStyle as b3, type DiagramEdge as b4, type DiagramView as b5, type DynamicView as b6, type DynamicViewIncludeRule as b7, type DynamicViewParallelSteps as b8, type DynamicViewRule as b9, type DynamicViewStep as ba, type DynamicViewStepOrParallel as bb, type EdgeId as bc, type ElementView as bd, type ExtendsElementView as be, type NodeId as bf, type ScopedElementView as bg, type StepEdgeId as bh, type StepEdgeIdLiteral as bi, type ViewAutoLayout as bj, type ViewId as bk, type ViewManualLayout as bl, type ViewRule as bm, type ViewRuleAutoLayout as bn, type ViewRuleGlobalPredicateRef as bo, type ViewRuleGlobalStyle as bp, type ViewRuleGroup as bq, type ViewRulePredicate as br, type ViewRuleStyle as bs, type ViewRuleStyleOrGlobalRef as bt, type ViewWithHash as bu, type ViewWithNotation as bv, type ElementNotation as bw, type Participant as bx, type DeploymentElementStyle as c, type DeploymentNode as d, expression as e, type DeploymentNodeKind as f, type DeploymentNodeKindSpecification as g, type DeploymentRef as h, type DeploymentRelation as i, isCustomElement as j, isCustomRelationExpr as k, isElement as l, isElementKindExpr as m, isElementPredicateExpr as n, isElementRef as o, isElementTagExpr as p, isElementWhere as q, isExpandedElementExpr as r, isIncoming as s, isInOut as t, isOutgoing as u, isRelation as v, isRelationExpression as w, isRelationPredicateExpr as x, isRelationWhere as y, isWildcard as z };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { L as LikeC4Model, E as ElementModel, R as RelationshipModel } from './core.ZWiGANIJ.js';
|
|
2
|
+
import { F as Fqn } from './core.D74xkKkG.js';
|
|
3
|
+
|
|
4
|
+
declare function computeRelationshipsView(subjectId: Fqn, likec4model: LikeC4Model): {
|
|
5
|
+
incomers: Set<ElementModel<LikeC4Model.Any>>;
|
|
6
|
+
incoming: Set<RelationshipModel<LikeC4Model.Any>>;
|
|
7
|
+
subjects: Set<ElementModel<LikeC4Model.Any>>;
|
|
8
|
+
outgoing: Set<RelationshipModel<LikeC4Model.Any>>;
|
|
9
|
+
outgoers: Set<ElementModel<LikeC4Model.Any>>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { computeRelationshipsView as c };
|
|
@@ -14,6 +14,7 @@ type AllNever = {
|
|
|
14
14
|
or?: never;
|
|
15
15
|
tag?: never;
|
|
16
16
|
kind?: never;
|
|
17
|
+
participant?: never;
|
|
17
18
|
};
|
|
18
19
|
type TagEqual<Tag> = Omit<AllNever, 'tag'> & {
|
|
19
20
|
tag: EqualOperator<Tag>;
|
|
@@ -23,6 +24,11 @@ type KindEqual<Kind> = Omit<AllNever, 'kind'> & {
|
|
|
23
24
|
kind: EqualOperator<Kind>;
|
|
24
25
|
};
|
|
25
26
|
declare const isKindEqual: <Kind>(operator: WhereOperator<any, Kind>) => operator is KindEqual<Kind>;
|
|
27
|
+
type Participant = 'source' | 'target';
|
|
28
|
+
type ParticipantOperator<Tag, Kind> = Omit<AllNever, 'participant'> & {
|
|
29
|
+
participant: Participant;
|
|
30
|
+
operator: KindEqual<Kind> | TagEqual<Tag>;
|
|
31
|
+
};
|
|
26
32
|
type NotOperator<Tag, Kind> = Omit<AllNever, 'not'> & {
|
|
27
33
|
not: WhereOperator<Tag, Kind>;
|
|
28
34
|
};
|
|
@@ -35,13 +41,15 @@ type OrOperator<Tag, Kind> = Omit<AllNever, 'or'> & {
|
|
|
35
41
|
or: NonEmptyArray<WhereOperator<Tag, Kind>>;
|
|
36
42
|
};
|
|
37
43
|
declare const isOrOperator: <Tag, Kind>(operator: WhereOperator<Tag, Kind>) => operator is OrOperator<Tag, Kind>;
|
|
38
|
-
type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
|
|
44
|
+
type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | ParticipantOperator<Tag, Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
|
|
39
45
|
type Filterable<FTag extends string | null = string | null, FKind extends string | null = string | null> = {
|
|
40
46
|
tags?: readonly FTag[] | null;
|
|
41
47
|
kind?: FKind;
|
|
48
|
+
source?: Filterable<FTag, FKind>;
|
|
49
|
+
target?: Filterable<FTag, FKind>;
|
|
42
50
|
};
|
|
43
51
|
type OperatorPredicate<V extends Filterable> = (value: V) => boolean;
|
|
44
|
-
declare function whereOperatorAsPredicate<FTag extends string = string, FKind extends string = string>(operator: WhereOperator<FTag, FKind>): OperatorPredicate<Filterable>;
|
|
52
|
+
declare function whereOperatorAsPredicate<FTag extends string | null = string | null, FKind extends string | null = string | null>(operator: WhereOperator<FTag, FKind>): OperatorPredicate<Filterable>;
|
|
45
53
|
|
|
46
54
|
interface BaseExpr {
|
|
47
55
|
where?: never;
|
|
@@ -526,7 +534,7 @@ interface ComputedNode {
|
|
|
526
534
|
*/
|
|
527
535
|
icon?: IconUrl;
|
|
528
536
|
style: ElementStyle;
|
|
529
|
-
navigateTo?: ViewId;
|
|
537
|
+
navigateTo?: ViewId | null;
|
|
530
538
|
level: number;
|
|
531
539
|
depth?: number;
|
|
532
540
|
/**
|
|
@@ -839,4 +847,4 @@ interface LayoutedLikeC4Model<Fqns extends string = string, DeploymentFqns exten
|
|
|
839
847
|
views: Record<Views, DiagramView<Views, Tags>>;
|
|
840
848
|
}
|
|
841
849
|
|
|
842
|
-
export { type GlobalDynamicPredicates as $, type CustomElementExpr as A, type CustomRelationExpr as B, ComputedView as C, DeploymentElement as D, type DirectRelationExpr as E, type ElementExpression as F, type ElementKindExpr as G, type ElementPredicateExpression as H, type ElementRefExpr as I, type ElementTagExpr as J, type ElementWhereExpr as K, type LikeC4View as L, type ExpandedElementExpr as M, type Expression as N, type IncomingExpr as O, type PredicateSelector as P, type InOutExpr as Q, type NonWilcard as R, type OutgoingExpr as S, type RelationExpression as T, type RelationPredicateExpression as U, type RelationWhereExpr as V, type WildcardExpr as W, ExpressionV2 as X, FqnExpr as Y, FqnRef as Z, RelationExpr as _, type ComputedLikeC4Model as a, type CustomColorDefinitions as a$, type GlobalPredicateId as a0, type GlobalPredicates as a1, type GlobalStyleID as a2, type GlobalStyles as a3, type ModelGlobals as a4, type AnyParsedLikeC4Model as a5, type GenericLikeC4Model as a6, type LayoutedLikeC4Model as a7, type LikeC4ModelDump as a8, type ParsedLikeC4Model as a9, DiagramNode as aA, extractStep as aB, getBBoxCenter as aC, getParallelStepsPrefix as aD, isAutoLayoutDirection as aE, isDeploymentView as aF, isDynamicView as aG, isDynamicViewParallelSteps as aH, isElementView as aI, isExtendsElementView as aJ, isScopedElementView as aK, isStepEdgeId as aL, isViewRuleAutoLayout as aM, isViewRuleGlobalPredicateRef as aN, isViewRuleGlobalStyle as aO, isViewRuleGroup as aP, isViewRulePredicate as aQ, isViewRuleStyle as aR, stepEdgeId as aS, type AutoLayoutDirection as aT, type BasicElementView as aU, type BasicView as aV, type BBox as aW, type ComputedDeploymentView as aX, type ComputedDynamicView as aY, type ComputedEdge as aZ, type ComputedElementView as a_, isAndOperator as aa, isKindEqual as ab, isNotOperator as ac, isOrOperator as ad, isTagEqual as ae, whereOperatorAsPredicate as af, type AndOperator as ag, type EqualOperator as ah, type Filterable as ai, type KindEqual as aj, type NotOperator as ak, type OperatorPredicate as al, type OrOperator as am, type TagEqual as an, type WhereOperator as ao, DefaultArrowType as ap, DefaultLineStyle as aq, DefaultRelationshipColor as ar, type AbstractRelation as as, type ModelRelation as at, type RelationId as au, type RelationshipArrowType as av, type RelationshipKind as aw, type RelationshipKindSpecification as ax, type RelationshipLineType as ay, ComputedNode as az, type DeployedInstance as b, type DeploymentView as b0, type DeploymentViewRule as b1, type DeploymentViewRulePredicate as b2, type DeploymentViewRuleStyle as b3, type DiagramEdge as b4, type DiagramView as b5, type DynamicView as b6, type DynamicViewIncludeRule as b7, type DynamicViewParallelSteps as b8, type DynamicViewRule as b9, type DynamicViewStep as ba, type DynamicViewStepOrParallel as bb, type EdgeId as bc, type ElementView as bd, type ExtendsElementView as be, type NodeId as bf, type ScopedElementView as bg, type StepEdgeId as bh, type StepEdgeIdLiteral as bi, type ViewAutoLayout as bj, type ViewId as bk, type ViewManualLayout as bl, type ViewRule as bm, type ViewRuleAutoLayout as bn, type ViewRuleGlobalPredicateRef as bo, type ViewRuleGlobalStyle as bp, type ViewRuleGroup as bq, type ViewRulePredicate as br, type ViewRuleStyle as bs, type ViewRuleStyleOrGlobalRef as bt, type ViewWithHash as bu, type ViewWithNotation as bv, type ElementNotation as bw, type DeploymentElementStyle as c, type DeploymentNode as d, expression as e, type DeploymentNodeKind as f, type DeploymentNodeKindSpecification as g, type DeploymentRef as h, type DeploymentRelation as i, isCustomElement as j, isCustomRelationExpr as k, isElement as l, isElementKindExpr as m, isElementPredicateExpr as n, isElementRef as o, isElementTagExpr as p, isElementWhere as q, isExpandedElementExpr as r, isIncoming as s, isInOut as t, isOutgoing as u, isRelation as v, isRelationExpression as w, isRelationPredicateExpr as x, isRelationWhere as y, isWildcard as z };
|
|
850
|
+
export { type GlobalDynamicPredicates as $, type CustomElementExpr as A, type CustomRelationExpr as B, ComputedView as C, DeploymentElement as D, type DirectRelationExpr as E, type ElementExpression as F, type ElementKindExpr as G, type ElementPredicateExpression as H, type ElementRefExpr as I, type ElementTagExpr as J, type ElementWhereExpr as K, type LikeC4View as L, type ExpandedElementExpr as M, type Expression as N, type IncomingExpr as O, type PredicateSelector as P, type InOutExpr as Q, type NonWilcard as R, type OutgoingExpr as S, type RelationExpression as T, type RelationPredicateExpression as U, type RelationWhereExpr as V, type WildcardExpr as W, ExpressionV2 as X, FqnExpr as Y, FqnRef as Z, RelationExpr as _, type ComputedLikeC4Model as a, type CustomColorDefinitions as a$, type GlobalPredicateId as a0, type GlobalPredicates as a1, type GlobalStyleID as a2, type GlobalStyles as a3, type ModelGlobals as a4, type AnyParsedLikeC4Model as a5, type GenericLikeC4Model as a6, type LayoutedLikeC4Model as a7, type LikeC4ModelDump as a8, type ParsedLikeC4Model as a9, DiagramNode as aA, extractStep as aB, getBBoxCenter as aC, getParallelStepsPrefix as aD, isAutoLayoutDirection as aE, isDeploymentView as aF, isDynamicView as aG, isDynamicViewParallelSteps as aH, isElementView as aI, isExtendsElementView as aJ, isScopedElementView as aK, isStepEdgeId as aL, isViewRuleAutoLayout as aM, isViewRuleGlobalPredicateRef as aN, isViewRuleGlobalStyle as aO, isViewRuleGroup as aP, isViewRulePredicate as aQ, isViewRuleStyle as aR, stepEdgeId as aS, type AutoLayoutDirection as aT, type BasicElementView as aU, type BasicView as aV, type BBox as aW, type ComputedDeploymentView as aX, type ComputedDynamicView as aY, type ComputedEdge as aZ, type ComputedElementView as a_, isAndOperator as aa, isKindEqual as ab, isNotOperator as ac, isOrOperator as ad, isTagEqual as ae, whereOperatorAsPredicate as af, type AndOperator as ag, type EqualOperator as ah, type Filterable as ai, type KindEqual as aj, type NotOperator as ak, type OperatorPredicate as al, type OrOperator as am, type TagEqual as an, type WhereOperator as ao, DefaultArrowType as ap, DefaultLineStyle as aq, DefaultRelationshipColor as ar, type AbstractRelation as as, type ModelRelation as at, type RelationId as au, type RelationshipArrowType as av, type RelationshipKind as aw, type RelationshipKindSpecification as ax, type RelationshipLineType as ay, ComputedNode as az, type DeployedInstance as b, type DeploymentView as b0, type DeploymentViewRule as b1, type DeploymentViewRulePredicate as b2, type DeploymentViewRuleStyle as b3, type DiagramEdge as b4, type DiagramView as b5, type DynamicView as b6, type DynamicViewIncludeRule as b7, type DynamicViewParallelSteps as b8, type DynamicViewRule as b9, type DynamicViewStep as ba, type DynamicViewStepOrParallel as bb, type EdgeId as bc, type ElementView as bd, type ExtendsElementView as be, type NodeId as bf, type ScopedElementView as bg, type StepEdgeId as bh, type StepEdgeIdLiteral as bi, type ViewAutoLayout as bj, type ViewId as bk, type ViewManualLayout as bl, type ViewRule as bm, type ViewRuleAutoLayout as bn, type ViewRuleGlobalPredicateRef as bo, type ViewRuleGlobalStyle as bp, type ViewRuleGroup as bq, type ViewRulePredicate as br, type ViewRuleStyle as bs, type ViewRuleStyleOrGlobalRef as bt, type ViewWithHash as bu, type ViewWithNotation as bv, type ElementNotation as bw, type Participant as bx, type DeploymentElementStyle as c, type DeploymentNode as d, expression as e, type DeploymentNodeKind as f, type DeploymentNodeKindSpecification as g, type DeploymentRef as h, type DeploymentRelation as i, isCustomElement as j, isCustomRelationExpr as k, isElement as l, isElementKindExpr as m, isElementPredicateExpr as n, isElementRef as o, isElementTagExpr as p, isElementWhere as q, isExpandedElementExpr as r, isIncoming as s, isInOut as t, isOutgoing as u, isRelation as v, isRelationExpression as w, isRelationPredicateExpr as x, isRelationWhere as y, isWildcard as z };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function nonNullable(value, message) {
|
|
4
|
+
if (typeof value === "undefined" || value == null) {
|
|
5
|
+
throw new Error(message ?? `Expected defined value, but received ${value}`);
|
|
6
|
+
}
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
function invariant(condition, message) {
|
|
10
|
+
if (condition) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
throw new Error(message ?? "Invariant failed");
|
|
14
|
+
}
|
|
15
|
+
function nonexhaustive(value) {
|
|
16
|
+
throw new Error(`NonExhaustive value: ${value}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function u$1(t,n,a){let o=r=>t(r,...n);return a===void 0?o:Object.assign(o,{lazy:a,lazyArgs:n})}
|
|
20
|
+
|
|
21
|
+
function u(r,n,a){let o=r.length-n.length;if(o===0)return r(...n);if(o===1)return u$1(r,n,a);throw new Error("Wrong number of arguments")}
|
|
22
|
+
|
|
23
|
+
exports.invariant = invariant;
|
|
24
|
+
exports.nonNullable = nonNullable;
|
|
25
|
+
exports.nonexhaustive = nonexhaustive;
|
|
26
|
+
exports.u = u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u, i as invariant, n as nonexhaustive } from './
|
|
1
|
+
import { u, i as invariant, n as nonexhaustive } from './core.M-JWF7SS.mjs';
|
|
2
2
|
|
|
3
3
|
function o$1(a){return t=>!a(t)}
|
|
4
4
|
|
|
@@ -183,6 +183,9 @@ const isTagEqual = (operator) => {
|
|
|
183
183
|
const isKindEqual = (operator) => {
|
|
184
184
|
return "kind" in operator;
|
|
185
185
|
};
|
|
186
|
+
const isParticipantOperator = (operator) => {
|
|
187
|
+
return "participant" in operator;
|
|
188
|
+
};
|
|
186
189
|
const isNotOperator = (operator) => {
|
|
187
190
|
return "not" in operator;
|
|
188
191
|
};
|
|
@@ -194,6 +197,11 @@ const isOrOperator = (operator) => {
|
|
|
194
197
|
};
|
|
195
198
|
function whereOperatorAsPredicate(operator) {
|
|
196
199
|
switch (true) {
|
|
200
|
+
case isParticipantOperator(operator): {
|
|
201
|
+
const participant = operator.participant;
|
|
202
|
+
const participantPredicate = whereOperatorAsPredicate(operator.operator);
|
|
203
|
+
return participantIs(participant, participantPredicate);
|
|
204
|
+
}
|
|
197
205
|
case isTagEqual(operator): {
|
|
198
206
|
if ("eq" in operator.tag) {
|
|
199
207
|
const tag2 = operator.tag.eq;
|
|
@@ -234,6 +242,21 @@ function whereOperatorAsPredicate(operator) {
|
|
|
234
242
|
nonexhaustive(operator);
|
|
235
243
|
}
|
|
236
244
|
}
|
|
245
|
+
function participantIs(participant, predicate) {
|
|
246
|
+
return (value) => {
|
|
247
|
+
if (!value.source || !value.target) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
switch (participant) {
|
|
251
|
+
case "source": {
|
|
252
|
+
return predicate(value.source);
|
|
253
|
+
}
|
|
254
|
+
case "target": {
|
|
255
|
+
return predicate(value.target);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
237
260
|
|
|
238
261
|
const DefaultLineStyle = "dashed";
|
|
239
262
|
const DefaultArrowType = "normal";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IsStringLiteral, LiteralUnion, Simplify, SetRequired } from 'type-fest';
|
|
2
|
-
import { C as ComputedView, L as LikeC4View, a9 as ParsedLikeC4Model, a as ComputedLikeC4Model, bk as ViewId, au as RelationId, bf as NodeId, bc as EdgeId, a6 as GenericLikeC4Model, a7 as LayoutedLikeC4Model, b5 as DiagramView, a8 as LikeC4ModelDump, f as DeploymentNodeKind, aY as ComputedDynamicView, bh as StepEdgeId, a_ as ComputedElementView, aX as ComputedDeploymentView, at as ModelRelation, a5 as AnyParsedLikeC4Model, a4 as ModelGlobals, h as DeploymentRef, d as DeploymentNode, b as DeployedInstance, c as DeploymentElementStyle, i as DeploymentRelation, aw as RelationshipKind } from './core.
|
|
3
|
-
import { F as Fqn, K as KeysOf, f as ElementKind, l as ElementShape, s as Color, o as Tag, n as Link, a as IteratorLike, x as ThemeColor, i as Element } from './core.D74xkKkG.
|
|
2
|
+
import { C as ComputedView, L as LikeC4View, a9 as ParsedLikeC4Model, a as ComputedLikeC4Model, bk as ViewId, au as RelationId, bf as NodeId, bc as EdgeId, a6 as GenericLikeC4Model, a7 as LayoutedLikeC4Model, b5 as DiagramView, a8 as LikeC4ModelDump, f as DeploymentNodeKind, aY as ComputedDynamicView, bh as StepEdgeId, a_ as ComputedElementView, aX as ComputedDeploymentView, at as ModelRelation, a5 as AnyParsedLikeC4Model, a4 as ModelGlobals, h as DeploymentRef, d as DeploymentNode, b as DeployedInstance, c as DeploymentElementStyle, i as DeploymentRelation, aw as RelationshipKind } from './core.D_Gc58Gt.js';
|
|
3
|
+
import { F as Fqn, K as KeysOf, f as ElementKind, l as ElementShape, s as Color, I as IconUrl, o as Tag, n as Link, a as IteratorLike, x as ThemeColor, i as Element } from './core.D74xkKkG.js';
|
|
4
4
|
|
|
5
5
|
type ComputeViewResult<V extends ComputedView = ComputedView> = {
|
|
6
6
|
isSuccess: true;
|
|
@@ -90,6 +90,7 @@ declare class NodeModel<M extends AnyAux, V extends ComputedView | DiagramView =
|
|
|
90
90
|
get deployment(): DeploymentElementModel<M> | null;
|
|
91
91
|
get shape(): ElementShape;
|
|
92
92
|
get color(): Color;
|
|
93
|
+
get icon(): IconUrl | null;
|
|
93
94
|
get tags(): ReadonlyArray<Tag>;
|
|
94
95
|
get links(): ReadonlyArray<Link>;
|
|
95
96
|
get navigateTo(): LikeC4ViewModel<M> | null;
|
|
@@ -185,6 +186,7 @@ declare class LikeC4ViewModel<M extends AnyAux, V extends ComputedView | Diagram
|
|
|
185
186
|
* Find node by id.
|
|
186
187
|
*/
|
|
187
188
|
findNode(node: M['NodeOrId']): NodeModel<M, V> | null;
|
|
189
|
+
findNodeWithElement(fqn: M['Element']): NodeModel.WithElement<M, V> | null;
|
|
188
190
|
/**
|
|
189
191
|
* Iterate over all nodes.
|
|
190
192
|
*/
|
|
@@ -246,6 +248,7 @@ declare class RelationshipModel<M extends AnyAux = AnyAux> {
|
|
|
246
248
|
* Iterate over all views that include this relationship.
|
|
247
249
|
*/
|
|
248
250
|
views(): ViewsIterator<M>;
|
|
251
|
+
isDeploymentRelation(): this is DeploymentRelationModel<M>;
|
|
249
252
|
}
|
|
250
253
|
|
|
251
254
|
declare class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
|
|
@@ -326,7 +329,7 @@ declare class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
|
|
|
326
329
|
* Returns a specific view by its ID.
|
|
327
330
|
*/
|
|
328
331
|
view(viewId: M['View']): LikeC4ViewModel<M>;
|
|
329
|
-
findView(viewId: M['View']): LikeC4ViewModel<M
|
|
332
|
+
findView(viewId: M['View']): LikeC4ViewModel<M> | null;
|
|
330
333
|
/**
|
|
331
334
|
* Returns the parent element of given element.
|
|
332
335
|
* @see ancestors
|
|
@@ -621,6 +624,7 @@ declare class DeploymentRelationModel<M extends AnyAux = AnyAux> {
|
|
|
621
624
|
get navigateTo(): LikeC4ViewModel<M> | null;
|
|
622
625
|
get links(): ReadonlyArray<Link>;
|
|
623
626
|
views(): IteratorLike<LikeC4ViewModel<M, ComputedDeploymentView>>;
|
|
627
|
+
isDeploymentRelation(): this is DeploymentRelationModel<M>;
|
|
624
628
|
}
|
|
625
629
|
declare class RelationshipsAccum<M extends AnyAux> {
|
|
626
630
|
readonly model: ReadonlySet<RelationshipModel<M>>;
|
|
@@ -660,12 +664,14 @@ declare class ElementModel<M extends AnyAux = AnyAux> {
|
|
|
660
664
|
get kind(): ElementKind;
|
|
661
665
|
get shape(): ElementShape;
|
|
662
666
|
get color(): ThemeColor;
|
|
667
|
+
get icon(): IconUrl | null;
|
|
663
668
|
get tags(): ReadonlyArray<Tag>;
|
|
664
669
|
get title(): string;
|
|
665
670
|
get description(): string | null;
|
|
666
671
|
get technology(): string | null;
|
|
667
672
|
get links(): ReadonlyArray<Link>;
|
|
668
673
|
get defaultView(): LikeC4ViewModel<M> | null;
|
|
674
|
+
get isRoot(): boolean;
|
|
669
675
|
isAncestorOf(another: ElementModel<M>): boolean;
|
|
670
676
|
isDescendantOf(another: ElementModel<M>): boolean;
|
|
671
677
|
/**
|
|
@@ -720,4 +726,4 @@ declare class ElementModel<M extends AnyAux = AnyAux> {
|
|
|
720
726
|
deployments(): DeployedInstancesIterator<M>;
|
|
721
727
|
}
|
|
722
728
|
|
|
723
|
-
export { type AnyAux as A, type ComputeViewResult as C, type DeploymentElementModel as D, ElementModel as E,
|
|
729
|
+
export { type AnyAux as A, type ComputeViewResult as C, type DeploymentElementModel as D, ElementModel as E, LikeC4Model as L, NodeModel as N, RelationshipModel as R, computeViews as a, Aux as b, computeView as c, LikeC4DeploymentModel as d, LikeC4ViewModel as e, DeploymentNodeModel as f, DeployedInstanceModel as g, RelationshipsAccum as h, DeploymentRelationModel as i, EdgeModel as j, unsafeComputeView as u };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const object_hash = require('./core.C9DCnJh8.cjs');
|
|
4
|
+
|
|
5
|
+
function computeRelationshipsView(subjectId, likec4model) {
|
|
6
|
+
const subject = likec4model.element(subjectId);
|
|
7
|
+
let relationships = {
|
|
8
|
+
incoming: [...subject.incoming()],
|
|
9
|
+
outgoing: [...subject.outgoing()]
|
|
10
|
+
};
|
|
11
|
+
const subjectSiblings = object_hash.toSet(subject.ascendingSiblings());
|
|
12
|
+
const isSubjectSibling = (e) => subjectSiblings.has(e);
|
|
13
|
+
const subjects = /* @__PURE__ */ new Set([subject]);
|
|
14
|
+
const incomers = new Set(relationships.incoming.flatMap((r) => {
|
|
15
|
+
subjects.add(r.target);
|
|
16
|
+
if (subjectSiblings.has(r.source)) {
|
|
17
|
+
return [r.source];
|
|
18
|
+
}
|
|
19
|
+
const parent = object_hash.ifind(r.source.ancestors(), isSubjectSibling);
|
|
20
|
+
return parent ? [r.source, parent] : [r.source];
|
|
21
|
+
}));
|
|
22
|
+
const outgoers = new Set(relationships.outgoing.flatMap((r) => {
|
|
23
|
+
subjects.add(r.source);
|
|
24
|
+
if (subjectSiblings.has(r.target)) {
|
|
25
|
+
return [r.target];
|
|
26
|
+
}
|
|
27
|
+
const parent = object_hash.ifind(r.target.ancestors(), isSubjectSibling);
|
|
28
|
+
return parent ? [r.target, parent] : [r.target];
|
|
29
|
+
}));
|
|
30
|
+
return {
|
|
31
|
+
incomers,
|
|
32
|
+
incoming: new Set(relationships.incoming),
|
|
33
|
+
subjects,
|
|
34
|
+
outgoing: new Set(relationships.outgoing),
|
|
35
|
+
outgoers
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.computeRelationshipsView = computeRelationshipsView;
|