@likec4/core 1.19.1 → 1.20.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.
Files changed (91) hide show
  1. package/dist/builder/index.cjs +881 -0
  2. package/dist/builder/index.d.cts +503 -0
  3. package/dist/builder/index.d.mts +5 -4
  4. package/dist/builder/index.d.ts +5 -4
  5. package/dist/builder/{index.js → index.mjs} +14 -4
  6. package/dist/compute-view/index.cjs +86 -0
  7. package/dist/compute-view/index.d.cts +23 -0
  8. package/dist/compute-view/index.d.mts +3 -2
  9. package/dist/compute-view/index.d.ts +3 -2
  10. package/dist/compute-view/{index.js → index.mjs} +6 -5
  11. package/dist/index.cjs +4320 -0
  12. package/dist/index.d.cts +270 -0
  13. package/dist/index.d.mts +130 -4
  14. package/dist/index.d.ts +130 -4
  15. package/dist/{index.js → index.mjs} +512 -7
  16. package/dist/model/index.cjs +40 -0
  17. package/dist/model/index.d.cts +259 -0
  18. package/dist/model/index.d.mts +8 -3
  19. package/dist/model/index.d.ts +8 -3
  20. package/dist/model/index.mjs +1 -0
  21. package/dist/shared/core.B2QYWlYe.cjs +435 -0
  22. package/dist/shared/core.B72vUaNB.d.cts +850 -0
  23. package/dist/shared/core.BGus30EM.cjs +8027 -0
  24. package/dist/shared/core.BRuJ3Wzf.d.mts +12 -0
  25. package/dist/shared/{core.BZ9Msq7w.d.mts → core.BdbFkE_p.d.cts} +14 -4
  26. package/dist/shared/core.BvdNMbcA.d.cts +12 -0
  27. package/dist/shared/{object_hash.CE_oF3I3.js → core.BxvDITEI.mjs} +26 -389
  28. package/dist/shared/core.ByNgh-mC.d.cts +127 -0
  29. package/dist/shared/core.C9DCnJh8.cjs +908 -0
  30. package/dist/shared/{index.DafVOuVd.js → core.CqCTxzMY.mjs} +1111 -572
  31. package/dist/shared/core.D74xkKkG.d.cts +148 -0
  32. package/dist/shared/{core.C05RDLhi.d.ts → core.D_Gc58Gt.d.ts} +23 -5
  33. package/dist/shared/core.Damrzla-.d.ts +12 -0
  34. package/dist/shared/{core.CmYMqgha.d.mts → core.Dfzrh1VA.d.mts} +23 -5
  35. package/dist/shared/core.DsoCu540.cjs +26 -0
  36. package/dist/shared/{view.CyZrG8BJ.js → core.DunIMHRf.mjs} +27 -1
  37. package/dist/shared/{core.BIfgabEw.d.ts → core.ZWiGANIJ.d.ts} +14 -4
  38. package/dist/shared/core.gv1bMwCC.cjs +39 -0
  39. package/dist/shared/core.jy6z2iRn.d.mts +729 -0
  40. package/dist/shared/core.m3rCQAv6.mjs +37 -0
  41. package/dist/types/index.cjs +107 -0
  42. package/dist/types/index.d.cts +72 -0
  43. package/dist/types/index.d.mts +2 -2
  44. package/dist/types/index.d.ts +2 -2
  45. package/dist/types/{index.js → index.mjs} +1 -1
  46. package/dist/utils/index.cjs +95 -0
  47. package/dist/utils/index.d.cts +356 -0
  48. package/dist/utils/index.d.mts +1 -64
  49. package/dist/utils/index.d.ts +1 -64
  50. package/dist/utils/index.mjs +56 -0
  51. package/package.json +52 -26
  52. package/src/builder/Builder.view-common.ts +21 -1
  53. package/src/compute-view/deployment-view/__test__/fixture.ts +31 -3
  54. package/src/compute-view/deployment-view/_types.ts +2 -1
  55. package/src/compute-view/deployment-view/compute.ts +4 -36
  56. package/src/compute-view/deployment-view/predicates/index.ts +8 -0
  57. package/src/compute-view/deployment-view/predicates/relation-direct.ts +125 -99
  58. package/src/compute-view/deployment-view/predicates/relation-in-out.ts +16 -8
  59. package/src/compute-view/deployment-view/predicates/relation-incoming.ts +18 -12
  60. package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +16 -9
  61. package/src/compute-view/deployment-view/predicates/relation-where.ts +18 -0
  62. package/src/compute-view/deployment-view/predicates/utils.ts +214 -0
  63. package/src/compute-view/element-view/__test__/fixture.ts +17 -4
  64. package/src/compute-view/element-view/compute.ts +3 -2
  65. package/src/compute-view/element-view/predicates.ts +520 -0
  66. package/src/compute-view/element-view/utils.ts +11 -7
  67. package/src/compute-view/index.ts +1 -0
  68. package/src/compute-view/relationships-view/_types.ts +16 -0
  69. package/src/compute-view/relationships-view/compute.ts +74 -0
  70. package/src/compute-view/relationships-view/layout.ts +357 -0
  71. package/src/compute-view/relationships-view/utils.ts +40 -0
  72. package/src/compute-view/utils/relationExpressionToPredicates.ts +11 -4
  73. package/src/index.ts +16 -0
  74. package/src/model/DeploymentElementModel.ts +18 -1
  75. package/src/model/ElementModel.ts +13 -0
  76. package/src/model/LikeC4Model.ts +2 -2
  77. package/src/model/RelationModel.ts +9 -0
  78. package/src/model/connection/deployment/DeploymentConnectionModel.ts +11 -1
  79. package/src/model/guards.ts +17 -1
  80. package/src/model/view/LikeC4ViewModel.ts +7 -1
  81. package/src/model/view/NodeModel.ts +5 -0
  82. package/src/types/deployments.ts +1 -0
  83. package/src/types/expression-v2.ts +12 -0
  84. package/src/types/index.ts +1 -0
  85. package/src/types/operators.ts +46 -6
  86. package/src/types/view.ts +2 -2
  87. package/src/utils/index.ts +0 -5
  88. package/src/utils/iterable/unique.ts +1 -7
  89. package/dist/model/index.js +0 -1
  90. package/dist/utils/index.js +0 -347
  91. /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>;
39
- type Filterable<FTag extends string = string, FKind extends string = string> = {
44
+ type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | ParticipantOperator<Tag, Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
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<FTag, FKind>>;
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;
@@ -285,12 +293,20 @@ declare namespace RelationExpr {
285
293
  inout: FqnExpr<D, M>;
286
294
  };
287
295
  const isInOut: (expr: ExpressionV2) => expr is InOut;
296
+ type Where<D = Fqn, M = Fqn> = {
297
+ where: {
298
+ expr: ExpressionV2<D, M>;
299
+ condition: WhereOperator<string, string>;
300
+ };
301
+ };
302
+ const isWhere: (expr: ExpressionV2) => expr is Where;
288
303
  }
289
304
  type RelationExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
290
305
  Direct: RelationExpr.Direct<D, M>;
291
306
  Incoming: RelationExpr.Incoming<D, M>;
292
307
  Outgoing: RelationExpr.Outgoing<D, M>;
293
308
  InOut: RelationExpr.InOut<D, M>;
309
+ Where: RelationExpr.Where<D, M>;
294
310
  }>;
295
311
  /**
296
312
  * Represents a version 2 expression which can be one of several types.
@@ -306,6 +322,7 @@ type ExpressionV2<D = Fqn, M = Fqn> = ExclusiveUnion<{
306
322
  Incoming: RelationExpr.Incoming<D, M>;
307
323
  Outgoing: RelationExpr.Outgoing<D, M>;
308
324
  InOut: RelationExpr.InOut<D, M>;
325
+ RelationPredicateOrWhere: RelationExpr.Where<D, M>;
309
326
  }>;
310
327
  declare namespace ExpressionV2 {
311
328
  const isFqnExpr: (expr: ExpressionV2) => expr is FqnExpr;
@@ -517,7 +534,7 @@ interface ComputedNode {
517
534
  */
518
535
  icon?: IconUrl;
519
536
  style: ElementStyle;
520
- navigateTo?: ViewId;
537
+ navigateTo?: ViewId | null;
521
538
  level: number;
522
539
  depth?: number;
523
540
  /**
@@ -738,6 +755,7 @@ interface DeployedInstance {
738
755
  readonly title?: string;
739
756
  readonly description?: string | null;
740
757
  readonly technology?: string | null;
758
+ readonly kind?: string | null;
741
759
  readonly tags?: NonEmptyArray<Tag> | null;
742
760
  readonly links?: NonEmptyArray<Link> | null;
743
761
  readonly style?: DeploymentElementStyle;
@@ -829,4 +847,4 @@ interface LayoutedLikeC4Model<Fqns extends string = string, DeploymentFqns exten
829
847
  views: Record<Views, DiagramView<Views, Tags>>;
830
848
  }
831
849
 
832
- 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 DeploymentView 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, extractStep as aA, getBBoxCenter as aB, getParallelStepsPrefix as aC, isAutoLayoutDirection as aD, isDeploymentView as aE, isDynamicView as aF, isDynamicViewParallelSteps as aG, isElementView as aH, isExtendsElementView as aI, isScopedElementView as aJ, isStepEdgeId as aK, isViewRuleAutoLayout as aL, isViewRuleGlobalPredicateRef as aM, isViewRuleGlobalStyle as aN, isViewRuleGroup as aO, isViewRulePredicate as aP, isViewRuleStyle as aQ, stepEdgeId as aR, type AutoLayoutDirection as aS, type BasicElementView as aT, type BasicView as aU, type BBox as aV, type ComputedDeploymentView as aW, type ComputedDynamicView as aX, type ComputedEdge as aY, type ComputedElementView as aZ, type CustomColorDefinitions 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 OrOperator as al, type TagEqual as am, type WhereOperator as an, DefaultArrowType as ao, DefaultLineStyle as ap, DefaultRelationshipColor as aq, type AbstractRelation as ar, type ModelRelation as as, type RelationId as at, type RelationshipArrowType as au, type RelationshipKind as av, type RelationshipKindSpecification as aw, type RelationshipLineType as ax, ComputedNode as ay, DiagramNode as az, type DeployedInstance as b, type DeploymentViewRule as b0, type DeploymentViewRulePredicate as b1, type DeploymentViewRuleStyle as b2, type DiagramEdge as b3, type DiagramView as b4, type DynamicView as b5, type DynamicViewIncludeRule as b6, type DynamicViewParallelSteps as b7, type DynamicViewRule as b8, type DynamicViewStep as b9, type DynamicViewStepOrParallel as ba, type EdgeId as bb, type ElementView as bc, type ExtendsElementView as bd, type NodeId as be, type ScopedElementView as bf, type StepEdgeId as bg, type StepEdgeIdLiteral as bh, type ViewAutoLayout as bi, type ViewId as bj, type ViewManualLayout as bk, type ViewRule as bl, type ViewRuleAutoLayout as bm, type ViewRuleGlobalPredicateRef as bn, type ViewRuleGlobalStyle as bo, type ViewRuleGroup as bp, type ViewRulePredicate as bq, type ViewRuleStyle as br, type ViewRuleStyleOrGlobalRef as bs, type ViewWithHash as bt, type ViewWithNotation as bu, type ElementNotation as bv, 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>;
39
- type Filterable<FTag extends string = string, FKind extends string = string> = {
44
+ type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | ParticipantOperator<Tag, Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
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<FTag, FKind>>;
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;
@@ -285,12 +293,20 @@ declare namespace RelationExpr {
285
293
  inout: FqnExpr<D, M>;
286
294
  };
287
295
  const isInOut: (expr: ExpressionV2) => expr is InOut;
296
+ type Where<D = Fqn, M = Fqn> = {
297
+ where: {
298
+ expr: ExpressionV2<D, M>;
299
+ condition: WhereOperator<string, string>;
300
+ };
301
+ };
302
+ const isWhere: (expr: ExpressionV2) => expr is Where;
288
303
  }
289
304
  type RelationExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
290
305
  Direct: RelationExpr.Direct<D, M>;
291
306
  Incoming: RelationExpr.Incoming<D, M>;
292
307
  Outgoing: RelationExpr.Outgoing<D, M>;
293
308
  InOut: RelationExpr.InOut<D, M>;
309
+ Where: RelationExpr.Where<D, M>;
294
310
  }>;
295
311
  /**
296
312
  * Represents a version 2 expression which can be one of several types.
@@ -306,6 +322,7 @@ type ExpressionV2<D = Fqn, M = Fqn> = ExclusiveUnion<{
306
322
  Incoming: RelationExpr.Incoming<D, M>;
307
323
  Outgoing: RelationExpr.Outgoing<D, M>;
308
324
  InOut: RelationExpr.InOut<D, M>;
325
+ RelationPredicateOrWhere: RelationExpr.Where<D, M>;
309
326
  }>;
310
327
  declare namespace ExpressionV2 {
311
328
  const isFqnExpr: (expr: ExpressionV2) => expr is FqnExpr;
@@ -517,7 +534,7 @@ interface ComputedNode {
517
534
  */
518
535
  icon?: IconUrl;
519
536
  style: ElementStyle;
520
- navigateTo?: ViewId;
537
+ navigateTo?: ViewId | null;
521
538
  level: number;
522
539
  depth?: number;
523
540
  /**
@@ -738,6 +755,7 @@ interface DeployedInstance {
738
755
  readonly title?: string;
739
756
  readonly description?: string | null;
740
757
  readonly technology?: string | null;
758
+ readonly kind?: string | null;
741
759
  readonly tags?: NonEmptyArray<Tag> | null;
742
760
  readonly links?: NonEmptyArray<Link> | null;
743
761
  readonly style?: DeploymentElementStyle;
@@ -829,4 +847,4 @@ interface LayoutedLikeC4Model<Fqns extends string = string, DeploymentFqns exten
829
847
  views: Record<Views, DiagramView<Views, Tags>>;
830
848
  }
831
849
 
832
- 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 DeploymentView 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, extractStep as aA, getBBoxCenter as aB, getParallelStepsPrefix as aC, isAutoLayoutDirection as aD, isDeploymentView as aE, isDynamicView as aF, isDynamicViewParallelSteps as aG, isElementView as aH, isExtendsElementView as aI, isScopedElementView as aJ, isStepEdgeId as aK, isViewRuleAutoLayout as aL, isViewRuleGlobalPredicateRef as aM, isViewRuleGlobalStyle as aN, isViewRuleGroup as aO, isViewRulePredicate as aP, isViewRuleStyle as aQ, stepEdgeId as aR, type AutoLayoutDirection as aS, type BasicElementView as aT, type BasicView as aU, type BBox as aV, type ComputedDeploymentView as aW, type ComputedDynamicView as aX, type ComputedEdge as aY, type ComputedElementView as aZ, type CustomColorDefinitions 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 OrOperator as al, type TagEqual as am, type WhereOperator as an, DefaultArrowType as ao, DefaultLineStyle as ap, DefaultRelationshipColor as aq, type AbstractRelation as ar, type ModelRelation as as, type RelationId as at, type RelationshipArrowType as au, type RelationshipKind as av, type RelationshipKindSpecification as aw, type RelationshipLineType as ax, ComputedNode as ay, DiagramNode as az, type DeployedInstance as b, type DeploymentViewRule as b0, type DeploymentViewRulePredicate as b1, type DeploymentViewRuleStyle as b2, type DiagramEdge as b3, type DiagramView as b4, type DynamicView as b5, type DynamicViewIncludeRule as b6, type DynamicViewParallelSteps as b7, type DynamicViewRule as b8, type DynamicViewStep as b9, type DynamicViewStepOrParallel as ba, type EdgeId as bb, type ElementView as bc, type ExtendsElementView as bd, type NodeId as be, type ScopedElementView as bf, type StepEdgeId as bg, type StepEdgeIdLiteral as bh, type ViewAutoLayout as bi, type ViewId as bj, type ViewManualLayout as bk, type ViewRule as bl, type ViewRuleAutoLayout as bm, type ViewRuleGlobalPredicateRef as bn, type ViewRuleGlobalStyle as bo, type ViewRuleGroup as bp, type ViewRulePredicate as bq, type ViewRuleStyle as br, type ViewRuleStyleOrGlobalRef as bs, type ViewWithHash as bt, type ViewWithNotation as bu, type ElementNotation as bv, 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 './chunk-RAAYCPUM.M-JWF7SS.js';
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
 
@@ -163,6 +163,9 @@ var RelationExpr;
163
163
  RelationExpr2.isInOut = (expr) => {
164
164
  return "inout" in expr;
165
165
  };
166
+ RelationExpr2.isWhere = (expr) => {
167
+ return "where" in expr;
168
+ };
166
169
  })(RelationExpr || (RelationExpr = {}));
167
170
  var ExpressionV2;
168
171
  ((ExpressionV22) => {
@@ -180,6 +183,9 @@ const isTagEqual = (operator) => {
180
183
  const isKindEqual = (operator) => {
181
184
  return "kind" in operator;
182
185
  };
186
+ const isParticipantOperator = (operator) => {
187
+ return "participant" in operator;
188
+ };
183
189
  const isNotOperator = (operator) => {
184
190
  return "not" in operator;
185
191
  };
@@ -191,6 +197,11 @@ const isOrOperator = (operator) => {
191
197
  };
192
198
  function whereOperatorAsPredicate(operator) {
193
199
  switch (true) {
200
+ case isParticipantOperator(operator): {
201
+ const participant = operator.participant;
202
+ const participantPredicate = whereOperatorAsPredicate(operator.operator);
203
+ return participantIs(participant, participantPredicate);
204
+ }
194
205
  case isTagEqual(operator): {
195
206
  if ("eq" in operator.tag) {
196
207
  const tag2 = operator.tag.eq;
@@ -231,6 +242,21 @@ function whereOperatorAsPredicate(operator) {
231
242
  nonexhaustive(operator);
232
243
  }
233
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
+ }
234
260
 
235
261
  const DefaultLineStyle = "dashed";
236
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, bj as ViewId, at as RelationId, be as NodeId, bb as EdgeId, a6 as GenericLikeC4Model, a7 as LayoutedLikeC4Model, b4 as DiagramView, a8 as LikeC4ModelDump, f as DeploymentNodeKind, aX as ComputedDynamicView, bg as StepEdgeId, aZ as ComputedElementView, aW as ComputedDeploymentView, as as ModelRelation, a5 as AnyParsedLikeC4Model, a4 as ModelGlobals, h as DeploymentRef, d as DeploymentNode, b as DeployedInstance, c as DeploymentElementStyle, i as DeploymentRelation } from './core.C05RDLhi.js';
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.js';
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
  */
@@ -240,11 +242,13 @@ declare class RelationshipModel<M extends AnyAux = AnyAux> {
240
242
  get description(): string | null;
241
243
  get navigateTo(): LikeC4ViewModel<M> | null;
242
244
  get tags(): ReadonlyArray<Tag>;
245
+ get kind(): string | null;
243
246
  get links(): ReadonlyArray<Link>;
244
247
  /**
245
248
  * Iterate over all views that include this relationship.
246
249
  */
247
250
  views(): ViewsIterator<M>;
251
+ isDeploymentRelation(): this is DeploymentRelationModel<M>;
248
252
  }
249
253
 
250
254
  declare class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
@@ -325,7 +329,7 @@ declare class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
325
329
  * Returns a specific view by its ID.
326
330
  */
327
331
  view(viewId: M['View']): LikeC4ViewModel<M>;
328
- findView(viewId: M['View']): LikeC4ViewModel<M>;
332
+ findView(viewId: M['View']): LikeC4ViewModel<M> | null;
329
333
  /**
330
334
  * Returns the parent element of given element.
331
335
  * @see ancestors
@@ -474,6 +478,7 @@ declare abstract class AbstractDeploymentElementModel<M extends AnyAux = AnyAux>
474
478
  get shape(): ElementShape;
475
479
  get color(): ThemeColor;
476
480
  get tags(): ReadonlyArray<Tag>;
481
+ get kind(): DeploymentNodeKind | string | null;
477
482
  get description(): string | null;
478
483
  get technology(): string | null;
479
484
  get links(): ReadonlyArray<Link>;
@@ -574,6 +579,7 @@ declare class DeployedInstanceModel<M extends AnyAux = AnyAux> extends AbstractD
574
579
  get shape(): ElementShape;
575
580
  get color(): ThemeColor;
576
581
  get tags(): ReadonlyArray<Tag>;
582
+ get kind(): string | null;
577
583
  get description(): string | null;
578
584
  get technology(): string | null;
579
585
  get links(): ReadonlyArray<Link>;
@@ -614,9 +620,11 @@ declare class DeploymentRelationModel<M extends AnyAux = AnyAux> {
614
620
  get technology(): string | null;
615
621
  get description(): string | null;
616
622
  get tags(): ReadonlyArray<Tag>;
623
+ get kind(): RelationshipKind | null;
617
624
  get navigateTo(): LikeC4ViewModel<M> | null;
618
625
  get links(): ReadonlyArray<Link>;
619
626
  views(): IteratorLike<LikeC4ViewModel<M, ComputedDeploymentView>>;
627
+ isDeploymentRelation(): this is DeploymentRelationModel<M>;
620
628
  }
621
629
  declare class RelationshipsAccum<M extends AnyAux> {
622
630
  readonly model: ReadonlySet<RelationshipModel<M>>;
@@ -656,12 +664,14 @@ declare class ElementModel<M extends AnyAux = AnyAux> {
656
664
  get kind(): ElementKind;
657
665
  get shape(): ElementShape;
658
666
  get color(): ThemeColor;
667
+ get icon(): IconUrl | null;
659
668
  get tags(): ReadonlyArray<Tag>;
660
669
  get title(): string;
661
670
  get description(): string | null;
662
671
  get technology(): string | null;
663
672
  get links(): ReadonlyArray<Link>;
664
673
  get defaultView(): LikeC4ViewModel<M> | null;
674
+ get isRoot(): boolean;
665
675
  isAncestorOf(another: ElementModel<M>): boolean;
666
676
  isDescendantOf(another: ElementModel<M>): boolean;
667
677
  /**
@@ -716,4 +726,4 @@ declare class ElementModel<M extends AnyAux = AnyAux> {
716
726
  deployments(): DeployedInstancesIterator<M>;
717
727
  }
718
728
 
719
- export { type AnyAux as A, type ComputeViewResult as C, type DeploymentElementModel as D, ElementModel as E, LikeC4DeploymentModel as L, NodeModel as N, RelationshipsAccum as R, computeViews as a, Aux as b, computeView as c, LikeC4Model as d, LikeC4ViewModel as e, DeploymentNodeModel as f, DeployedInstanceModel as g, RelationshipModel as h, DeploymentRelationModel as i, EdgeModel as j, unsafeComputeView as u };
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;