@likec4/core 1.48.0 → 1.50.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/dist/THIRD-PARTY-LICENSES.md +1034 -0
- package/dist/_chunks/Builder.view-element.mjs +2 -3284
- package/dist/_chunks/LikeC4Model.d.mts +21 -25
- package/dist/_chunks/_types.d.mts +1 -5
- package/dist/_chunks/_types2.d.mts +2 -4
- package/dist/_chunks/assignTagColors.mjs +1 -24
- package/dist/_chunks/geometry.mjs +1 -335
- package/dist/_chunks/index.d.mts +1995 -131
- package/dist/_chunks/index2.d.mts +153 -892
- package/dist/_chunks/index3.d.mts +15 -13
- package/dist/_chunks/index4.d.mts +229 -3
- package/dist/_chunks/index5.d.mts +392 -30
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
- package/dist/_chunks/libs/bail.mjs +1 -14
- package/dist/_chunks/libs/ccount.mjs +1 -25
- package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
- package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
- package/dist/_chunks/libs/character-entities.mjs +2 -2136
- package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
- package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/devlop.mjs +1 -5
- package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
- package/dist/_chunks/libs/extend.mjs +1 -77
- package/dist/_chunks/libs/graphology-dag.mjs +1 -703
- package/dist/_chunks/libs/graphology.mjs +1 -4565
- package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
- package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/longest-streak.mjs +1 -30
- package/dist/_chunks/libs/markdown-table.mjs +2 -290
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
- package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
- package/dist/_chunks/libs/mnemonist.d.mts +1 -91
- package/dist/_chunks/libs/mnemonist.mjs +1 -1978
- package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
- package/dist/_chunks/libs/ohash.mjs +1 -0
- package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
- package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
- package/dist/_chunks/libs/remark-gfm.mjs +1 -36
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
- package/dist/_chunks/libs/remark-parse.mjs +1 -39
- package/dist/_chunks/libs/remark-rehype.mjs +1 -171
- package/dist/_chunks/libs/remeda.mjs +2 -702
- package/dist/_chunks/libs/trough.mjs +1 -158
- package/dist/_chunks/libs/unified.mjs +1 -2212
- package/dist/_chunks/manual-layout.mjs +1 -0
- package/dist/_chunks/model.mjs +4 -1898
- package/dist/_chunks/rolldown-runtime.mjs +1 -42
- package/dist/_chunks/types.mjs +1 -0
- package/dist/_chunks/utils.mjs +1 -483
- package/dist/builder/index.d.mts +3 -6
- package/dist/builder/index.mjs +1 -662
- package/dist/compute-view/index.d.mts +85 -13
- package/dist/compute-view/index.mjs +2 -262
- package/dist/geometry/index.d.mts +2 -2
- package/dist/geometry/index.mjs +1 -3
- package/dist/index.d.mts +7 -13
- package/dist/index.mjs +1 -27
- package/dist/model/index.d.mts +4 -11
- package/dist/model/index.mjs +1 -11
- package/dist/styles/index.d.mts +2 -7
- package/dist/styles/index.mjs +1 -30
- package/dist/types/index.d.mts +3 -9
- package/dist/types/index.mjs +1 -15
- package/dist/utils/graphology/index.d.mts +1 -1
- package/dist/utils/graphology/index.mjs +1 -3
- package/dist/utils/index.d.mts +5 -10
- package/dist/utils/index.mjs +1 -17
- package/package.json +14 -13
- package/dist/_chunks/LikeC4Styles.mjs +0 -691
- package/dist/_chunks/RichText.d.mts +0 -84
- package/dist/_chunks/RichText.mjs +0 -148
- package/dist/_chunks/_aux.d.mts +0 -289
- package/dist/_chunks/_aux.mjs +0 -18
- package/dist/_chunks/calcDriftsFromSnapshot.mjs +0 -379
- package/dist/_chunks/connection.mjs +0 -0
- package/dist/_chunks/const.d.mts +0 -43
- package/dist/_chunks/const.mjs +0 -33
- package/dist/_chunks/expression-model.d.mts +0 -192
- package/dist/_chunks/expression-model.mjs +0 -103
- package/dist/_chunks/expression.d.mts +0 -347
- package/dist/_chunks/expression.mjs +0 -107
- package/dist/_chunks/find.d.mts +0 -82
- package/dist/_chunks/find.mjs +0 -646
- package/dist/_chunks/find2.d.mts +0 -78
- package/dist/_chunks/find2.mjs +0 -287
- package/dist/_chunks/fqnRef.d.mts +0 -58
- package/dist/_chunks/fqnRef.mjs +0 -41
- package/dist/_chunks/index6.d.mts +0 -43
- package/dist/_chunks/index7.d.mts +0 -268
- package/dist/_chunks/index8.d.mts +0 -144
- package/dist/_chunks/invariant.mjs +0 -18
- package/dist/_chunks/iterable.mjs +0 -146
- package/dist/_chunks/libs/graphology-types.d.mts +0 -601
- package/dist/_chunks/libs/graphology.d.mts +0 -6
- package/dist/_chunks/mnemonist.mjs +0 -0
- package/dist/_chunks/model2.mjs +0 -0
- package/dist/_chunks/relationships-view.mjs +0 -132
- package/dist/_chunks/scalar.d.mts +0 -109
- package/dist/_chunks/scalar.mjs +0 -84
- package/dist/compute-view/relationships-view/index.d.mts +0 -16
- package/dist/compute-view/relationships-view/index.mjs +0 -7
- package/dist/model/connection/deployment/index.d.mts +0 -12
- package/dist/model/connection/deployment/index.mjs +0 -9
- package/dist/model/connection/index.d.mts +0 -14
- package/dist/model/connection/index.mjs +0 -10
- package/dist/model/connection/model/index.d.mts +0 -12
- package/dist/model/connection/model/index.mjs +0 -8
- package/dist/types/RichText.d.mts +0 -3
- package/dist/types/RichText.mjs +0 -7
- package/dist/types/_aux.d.mts +0 -3
- package/dist/types/_aux.mjs +0 -3
- package/dist/types/expression-model.d.mts +0 -6
- package/dist/types/expression-model.mjs +0 -7
- package/dist/types/expression.d.mts +0 -5
- package/dist/types/expression.mjs +0 -7
- package/dist/types/fqnRef.d.mts +0 -4
- package/dist/types/fqnRef.mjs +0 -7
- package/dist/types/scalar.d.mts +0 -2
- package/dist/types/scalar.mjs +0 -7
- package/dist/utils/iterable/index.d.mts +0 -9
- package/dist/utils/iterable/index.mjs +0 -3
- package/dist/utils/mnemonist.d.mts +0 -2
- package/dist/utils/mnemonist.mjs +0 -12
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { i as
|
|
4
|
-
import {
|
|
5
|
-
import { t as FqnRef } from "./fqnRef.mjs";
|
|
6
|
-
import { $ as LikeC4Project, G as ViewManualLayoutSnapshot, Nt as DynamicViewDisplayVariant, St as Relationship, Z as ComputedNodeStyle, b as ViewWithType, bt as ElementStyle, c as ComputedLikeC4ModelData, d as ParsedLikeC4ModelData, dt as DeploymentElement, ht as DeploymentRelationship, kt as ModelGlobals, l as LayoutedLikeC4ModelData, m as LayoutedView, n as AuxFromDump, p as ComputedView, pt as DeploymentNode, r as LikeC4ModelDump, st as Specification, ut as DeployedInstance, yt as Element } from "./index2.mjs";
|
|
7
|
-
import { i as RichTextOrEmpty } from "./RichText.mjs";
|
|
8
|
-
import { a as LikeC4Styles } from "./index3.mjs";
|
|
9
|
-
import { c as DefaultMap } from "./libs/mnemonist.mjs";
|
|
1
|
+
import { $n as FqnRef, Br as ElementId, C as LayoutedView, Ei as NodeId, Fr as Aux, Gn as WhereOperator, Hr as Fqn, Ht as DynamicViewDisplayVariant, Ii as ViewId$1, Ir as DeploymentFqn, Ji as _stage, Jr as Metadata, Kr as LooseTag, Lr as DeploymentId, Mi as StepEdgeId, Mr as AnyComputed, Nr as AnyLayouted, Oi as ProjectId, Ot as Element, Pr as AnyParsed, Qr as RelationKind, Rr as DeploymentKind, Rt as ModelGlobals, S as ComputedView, Si as GroupElementKind, St as DeploymentNode, Ur as LooseDeploymentId, Vr as ElementKind, Wr as LooseElementId, Xr as ProjectId$1, Yi as _type, Yr as MetadataKey, Zr as RelationId$1, _ as ComputedLikeC4ModelData, ai as UnknownComputed, b as ParsedLikeC4ModelData, bt as DeploymentElement, ci as ViewId, ct as LikeC4Project, d as AuxFromDump, ea as IteratorLike, ei as Stage, et as ViewManualLayoutSnapshot, f as LikeC4ModelDump, gr as RelationshipLineType, gt as Specification, ia as NonEmptyArray, ii as Unknown, jr as Any, jt as Relationship, k as ViewWithType, ki as RelationId, kt as ElementStyle, l as RichTextOrEmpty, na as Link, ni as Tag, oi as UnknownLayouted, or as ElementShape, ot as ComputedNodeStyle, pi as toComputed, pr as RelationshipArrowType, qr as LooseViewId, ri as Tags, si as UnknownParsed, ti as StrictViewId, tr as Color, v as LayoutedLikeC4ModelData, vi as EdgeId, wi as IconUrl, wt as DeploymentRelationship, yt as DeployedInstance } from "./index.mjs";
|
|
2
|
+
import { i as BBox } from "./index2.mjs";
|
|
3
|
+
import { i as LikeC4Styles } from "./index3.mjs";
|
|
4
|
+
import { o as DefaultMap } from "./libs/mnemonist.mjs";
|
|
10
5
|
import { IsAny, SetRequired, Tagged } from "type-fest";
|
|
11
6
|
|
|
12
7
|
//#region src/model/RelationModel.d.ts
|
|
@@ -16,7 +11,7 @@ type RelationshipsIterator<A extends Any> = IteratorLike<RelationshipModel<A>>;
|
|
|
16
11
|
* use {@link isDeploymentRelationModel} guard to check if the relationship is a deployment relationship
|
|
17
12
|
*/
|
|
18
13
|
interface AnyRelationshipModel<A extends Any = Any> extends WithTags<A>, WithMetadata<A> {
|
|
19
|
-
readonly id: RelationId
|
|
14
|
+
readonly id: RelationId;
|
|
20
15
|
readonly expression: string;
|
|
21
16
|
readonly title: string | null;
|
|
22
17
|
readonly technology: string | null;
|
|
@@ -45,7 +40,7 @@ declare class RelationshipModel<A extends Any = Any> implements AnyRelationshipM
|
|
|
45
40
|
*/
|
|
46
41
|
readonly boundary: ElementModel<A> | null;
|
|
47
42
|
constructor(model: LikeC4Model<A>, $relationship: Relationship<A>);
|
|
48
|
-
get id(): RelationId
|
|
43
|
+
get id(): RelationId;
|
|
49
44
|
get expression(): string;
|
|
50
45
|
get title(): string | null;
|
|
51
46
|
get technology(): string | null;
|
|
@@ -100,7 +95,7 @@ declare class ElementModel<A extends Any = Any> implements WithTags<A>, WithMeta
|
|
|
100
95
|
readonly _literalId: ElementId<A>;
|
|
101
96
|
readonly hierarchyLevel: number;
|
|
102
97
|
readonly imported: null | {
|
|
103
|
-
readonly from: ProjectId
|
|
98
|
+
readonly from: ProjectId;
|
|
104
99
|
readonly fqn: Fqn<Any>;
|
|
105
100
|
};
|
|
106
101
|
constructor($model: LikeC4Model<A>, $element: Element<A>);
|
|
@@ -136,7 +131,7 @@ declare class ElementModel<A extends Any = Any> implements WithTags<A>, WithMeta
|
|
|
136
131
|
get defaultView(): LikeC4ViewModel.ScopedElementView<A> | null;
|
|
137
132
|
get isRoot(): boolean;
|
|
138
133
|
get style(): SetRequired<ElementStyle, 'shape' | 'color' | 'size'>;
|
|
139
|
-
get projectId(): ProjectId<A>;
|
|
134
|
+
get projectId(): ProjectId$1<A>;
|
|
140
135
|
isAncestorOf(another: ElementModel<A>): boolean;
|
|
141
136
|
isDescendantOf(another: ElementModel<A>): boolean;
|
|
142
137
|
/**
|
|
@@ -209,6 +204,7 @@ declare class NodeModel<A extends Any = Any, V extends $View<A> = $View<A>> impl
|
|
|
209
204
|
get kind(): ElementKind<A> | DeploymentKind<A> | typeof GroupElementKind | 'instance';
|
|
210
205
|
get description(): RichTextOrEmpty;
|
|
211
206
|
get technology(): string | null;
|
|
207
|
+
get notes(): RichTextOrEmpty;
|
|
212
208
|
get parent(): NodeModel<A, V> | null;
|
|
213
209
|
get element(): ElementModel<A> | null;
|
|
214
210
|
get deployment(): DeploymentElementModel<A> | null;
|
|
@@ -313,8 +309,8 @@ declare class EdgeModel<A extends Any = Any, V extends $View<A> = $View<A>> impl
|
|
|
313
309
|
relationships(type: 'model'): IteratorLike<RelationshipModel<A>>;
|
|
314
310
|
relationships(type: 'deployment'): IteratorLike<DeploymentRelationModel<A>>;
|
|
315
311
|
relationships(type?: 'model' | 'deployment'): IteratorLike<RelationshipModel<A> | DeploymentRelationModel<A>>;
|
|
316
|
-
includesRelation(rel: RelationId | {
|
|
317
|
-
id: RelationId;
|
|
312
|
+
includesRelation(rel: RelationId$1 | {
|
|
313
|
+
id: RelationId$1;
|
|
318
314
|
}): boolean;
|
|
319
315
|
isTagged(tag: LooseTag<A>): boolean;
|
|
320
316
|
}
|
|
@@ -492,7 +488,7 @@ declare class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>
|
|
|
492
488
|
* If view has manual layout, returns it with manual layout applied
|
|
493
489
|
*/
|
|
494
490
|
get $manual(): V | null;
|
|
495
|
-
get projectId(): ProjectId<A>;
|
|
491
|
+
get projectId(): ProjectId$1<A>;
|
|
496
492
|
roots(): NodesIterator<A, V>;
|
|
497
493
|
/**
|
|
498
494
|
* Iterate over all nodes that have children.
|
|
@@ -535,7 +531,7 @@ declare class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>
|
|
|
535
531
|
/**
|
|
536
532
|
* Iterate over all edges.
|
|
537
533
|
*/
|
|
538
|
-
edgesWithRelation(relation: RelationId): EdgesIterator<A, V>;
|
|
534
|
+
edgesWithRelation(relation: RelationId$1): EdgesIterator<A, V>;
|
|
539
535
|
/**
|
|
540
536
|
* Nodes that have references to elements from logical model.
|
|
541
537
|
*/
|
|
@@ -550,8 +546,8 @@ declare class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>
|
|
|
550
546
|
includesDeployment(deployment: LooseDeploymentId<A> | {
|
|
551
547
|
id: DeploymentFqn<A>;
|
|
552
548
|
}): boolean;
|
|
553
|
-
includesRelation(relation: RelationId
|
|
554
|
-
id: RelationId
|
|
549
|
+
includesRelation(relation: RelationId | {
|
|
550
|
+
id: RelationId;
|
|
555
551
|
}): boolean;
|
|
556
552
|
/**
|
|
557
553
|
* Below are type guards.
|
|
@@ -604,7 +600,7 @@ type EdgeOrId = string | {
|
|
|
604
600
|
id: EdgeId;
|
|
605
601
|
};
|
|
606
602
|
type RelationOrId = string | {
|
|
607
|
-
id: RelationId
|
|
603
|
+
id: RelationId;
|
|
608
604
|
};
|
|
609
605
|
type $View<A extends Any> = {
|
|
610
606
|
parsed: never;
|
|
@@ -645,7 +641,7 @@ declare class LikeC4DeploymentModel<A extends Any = Any> {
|
|
|
645
641
|
* Returns the Project ID associated with the model.
|
|
646
642
|
* If the project ID is not defined in the model, it returns "default".
|
|
647
643
|
*/
|
|
648
|
-
get projectId(): ProjectId<A>;
|
|
644
|
+
get projectId(): ProjectId$1<A>;
|
|
649
645
|
/**
|
|
650
646
|
* Returns the project associated with the model.
|
|
651
647
|
* If the project is not defined in the model, it returns a default project with the ID "default".
|
|
@@ -903,7 +899,7 @@ declare class DeploymentRelationModel<A extends Any = Any> implements AnyRelatio
|
|
|
903
899
|
source: DeploymentRelationEndpoint<A>;
|
|
904
900
|
target: DeploymentRelationEndpoint<A>;
|
|
905
901
|
constructor($model: LikeC4DeploymentModel<A>, $relationship: DeploymentRelationship<A>);
|
|
906
|
-
get id(): RelationId
|
|
902
|
+
get id(): RelationId;
|
|
907
903
|
get expression(): string;
|
|
908
904
|
get title(): string | null;
|
|
909
905
|
get technology(): string | null;
|
|
@@ -978,7 +974,7 @@ declare class LikeC4Model<A extends Any = Any> {
|
|
|
978
974
|
protected readonly _parents: Map<Fqn<A>, ElementModel<A>>;
|
|
979
975
|
protected readonly _children: DefaultMap<Fqn<A>, Set<ElementModel<A>>>;
|
|
980
976
|
protected readonly _rootElements: Set<ElementModel<A>>;
|
|
981
|
-
protected readonly _relations: Map<RelationId
|
|
977
|
+
protected readonly _relations: Map<RelationId<string>, RelationshipModel<A>>;
|
|
982
978
|
protected readonly _incoming: DefaultMap<Fqn<A>, Set<RelationshipModel<A>>>;
|
|
983
979
|
protected readonly _outgoing: DefaultMap<Fqn<A>, Set<RelationshipModel<A>>>;
|
|
984
980
|
protected readonly _internal: DefaultMap<Fqn<A>, Set<RelationshipModel<A>>>;
|
|
@@ -1054,7 +1050,7 @@ declare class LikeC4Model<A extends Any = Any> {
|
|
|
1054
1050
|
* Returns the Project ID associated with the model.
|
|
1055
1051
|
* If the project ID is not defined in the model, it returns "default".
|
|
1056
1052
|
*/
|
|
1057
|
-
get projectId(): ProjectId<A>;
|
|
1053
|
+
get projectId(): ProjectId$1<A>;
|
|
1058
1054
|
/**
|
|
1059
1055
|
* Returns the project associated with the model.
|
|
1060
1056
|
* If the project is not defined in the model, it returns a default project with the ID "default".
|
|
@@ -1108,7 +1104,7 @@ declare class LikeC4Model<A extends Any = Any> {
|
|
|
1108
1104
|
*/
|
|
1109
1105
|
relationship(rel: RelationOrId, type: 'model'): RelationshipModel<A>;
|
|
1110
1106
|
relationship(rel: RelationOrId, type: 'deployment'): DeploymentRelationModel<A>;
|
|
1111
|
-
relationship(rel: RelationId
|
|
1107
|
+
relationship(rel: RelationId, type?: 'model' | 'deployment'): RelationshipModel<A> | DeploymentRelationModel<A>;
|
|
1112
1108
|
findRelationship(id: string, type: 'model'): RelationshipModel<A> | null;
|
|
1113
1109
|
findRelationship(id: string, type: 'deployment'): DeploymentRelationModel<A> | null;
|
|
1114
1110
|
findRelationship(id: string, type?: 'model' | 'deployment'): RelationshipModel<A> | DeploymentRelationModel<A> | null;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as MarkdownOrString, r as DeploymentFqn, s as Fqn } from "./scalar.mjs";
|
|
3
|
-
import { B as ShapeSize, C as BorderStyle, H as SpacingSize, I as RelationshipArrowType, U as TextSize, W as ThemeColor, f as Participant, j as IconPosition, k as ElementShape, t as Expression, z as RelationshipLineType } from "./expression.mjs";
|
|
4
|
-
import { n as ModelFqnExpr, r as ModelRelationExpr } from "./expression-model.mjs";
|
|
5
|
-
import { F as ParsedDeploymentView, Yt as ParsedElementView, at as ElementSpecification$1, ct as TagSpecification, d as ParsedLikeC4ModelData, dt as DeploymentElement, en as AnyViewRuleStyle, h as ParsedView, ht as DeploymentRelationship, nt as LikeC4ProjectStylesConfig, ot as RelationshipSpecification, tn as AutoLayoutDirection, xt as ModelRelation, yt as Element } from "./index2.mjs";
|
|
1
|
+
import { $r as SpecAux, An as ModelRelationExpr, At as ModelRelation, Fr as Aux, Hn as Participant, Ot as Element, Ti as MarkdownOrString, W as ParsedDeploymentView, _r as ShapeSize, _t as TagSpecification, b as ParsedLikeC4ModelData, bi as Fqn, br as TextSize, bt as DeploymentElement, cr as IconPosition, dt as LikeC4ProjectStylesConfig, er as BorderStyle, fi as setProject, gi as DeploymentFqn, gr as RelationshipLineType, ht as RelationshipSpecification, ia as NonEmptyArray, in as ParsedElementView, jn as Expression, jr as Any, kn as ModelFqnExpr, ln as AnyViewRuleStyle, mt as ElementSpecification$1, or as ElementShape, pr as RelationshipArrowType, ta as KeysOf, un as AutoLayoutDirection, w as ParsedView, wt as DeploymentRelationship, xr as ThemeColor, yr as SpacingSize } from "./index.mjs";
|
|
6
2
|
import { n as LikeC4Model } from "./LikeC4Model.mjs";
|
|
7
3
|
import { IfNever, IsLiteral, IsNever, LastArrayElement, PartialDeep, Simplify, Split, Tagged, TupleToUnion, Writable } from "type-fest";
|
|
8
4
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { i as BBox } from "./index.mjs";
|
|
4
|
-
import { I as DiagramEdge, J as ComputedEdge, L as DiagramNode, X as ComputedNode, on as ViewAutoLayout, rn as BaseViewProperties } from "./index2.mjs";
|
|
1
|
+
import { G as DiagramEdge, Ji as _stage, K as DiagramNode, Oi as ProjectId, Yi as _type, at as ComputedNode, fn as BaseViewProperties, hn as ViewAutoLayout, rt as ComputedEdge } from "./index.mjs";
|
|
2
|
+
import { i as BBox } from "./index2.mjs";
|
|
5
3
|
|
|
6
4
|
//#region src/compute-view/projects-view/_types.d.ts
|
|
7
5
|
interface ComputedProjectNode extends ComputedNode {
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { V as DefaultTagColors } from "./LikeC4Styles.mjs";
|
|
3
|
-
import { I as compareNatural } from "./utils.mjs";
|
|
4
|
-
import { n as nonNullable } from "./invariant.mjs";
|
|
5
|
-
|
|
6
|
-
//#region src/styles/assignTagColors.ts
|
|
7
|
-
function assignTagColors(tags) {
|
|
8
|
-
const tagsWithColors = [];
|
|
9
|
-
const tagsWithoutColors = [];
|
|
10
|
-
for (const [tag, spec] of t(tags)) if (e(spec.color)) tagsWithColors.push({
|
|
11
|
-
tag,
|
|
12
|
-
spec: { color: spec.color }
|
|
13
|
-
});
|
|
14
|
-
else tagsWithoutColors.push(tag);
|
|
15
|
-
return t$1(tagsWithoutColors, t$2(compareNatural), t$3((tag, idx) => {
|
|
16
|
-
return {
|
|
17
|
-
tag,
|
|
18
|
-
spec: { color: nonNullable(DefaultTagColors[idx % DefaultTagColors.length]) }
|
|
19
|
-
};
|
|
20
|
-
}), t$4(tagsWithColors), t$2((a, b) => compareNatural(a.tag, b.tag)), t$5(e$1("tag"), e$1("spec")));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { assignTagColors as t };
|
|
1
|
+
import{O as e,T as t,X as n,et as r,l as i,m as a,nt as o,p as s}from"./libs/remeda.mjs";import{F as c}from"./types.mjs";import{$ as l,J as u}from"./utils.mjs";function d(d){let f=[],p=[];for(let[t,r]of n(d))e(r.color)?f.push({tag:t,spec:{color:r.color}}):p.push(t);return r(p,i(u),t((e,t)=>({tag:e,spec:{color:l(c[t%c.length])}})),o(f),i((e,t)=>u(e.tag,t.tag)),s(a(`tag`),a(`spec`)))}export{d as t};
|
|
@@ -1,335 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { t as invariant } from "./invariant.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/geometry/bbox.ts
|
|
5
|
-
let BBox;
|
|
6
|
-
(function(_BBox) {
|
|
7
|
-
function center({ x, y, width, height }) {
|
|
8
|
-
return {
|
|
9
|
-
x: x + width / 2,
|
|
10
|
-
y: y + height / 2
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
_BBox.center = center;
|
|
14
|
-
function toPoints({ x, y, width, height }) {
|
|
15
|
-
return [
|
|
16
|
-
{
|
|
17
|
-
x,
|
|
18
|
-
y
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
x: x + width,
|
|
22
|
-
y
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
x: x + width,
|
|
26
|
-
y: y + height
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
x,
|
|
30
|
-
y: y + height
|
|
31
|
-
}
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
_BBox.toPoints = toPoints;
|
|
35
|
-
function fromPoints(points) {
|
|
36
|
-
const { x1, y1, x2, y2 } = RectBox.fromPoints(points);
|
|
37
|
-
return {
|
|
38
|
-
x: x1,
|
|
39
|
-
y: y1,
|
|
40
|
-
width: x2 - x1,
|
|
41
|
-
height: y2 - y1
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
_BBox.fromPoints = fromPoints;
|
|
45
|
-
function merge(...boxes) {
|
|
46
|
-
invariant(t(boxes, 1), "No boxes provided");
|
|
47
|
-
if (boxes.length === 1) return boxes[0];
|
|
48
|
-
let minX = boxes[0].x;
|
|
49
|
-
let minY = boxes[0].y;
|
|
50
|
-
let maxX = boxes[0].x + boxes[0].width;
|
|
51
|
-
let maxY = boxes[0].y + boxes[0].height;
|
|
52
|
-
for (let i = 1; i < boxes.length; i++) {
|
|
53
|
-
const box = boxes[i];
|
|
54
|
-
minX = Math.min(minX, box.x);
|
|
55
|
-
minY = Math.min(minY, box.y);
|
|
56
|
-
maxX = Math.max(maxX, box.x + box.width);
|
|
57
|
-
maxY = Math.max(maxY, box.y + box.height);
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
x: Math.floor(minX),
|
|
61
|
-
y: Math.floor(minY),
|
|
62
|
-
width: Math.round(maxX - minX),
|
|
63
|
-
height: Math.round(maxY - minY)
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
_BBox.merge = merge;
|
|
67
|
-
function fromRectBox(rect) {
|
|
68
|
-
return {
|
|
69
|
-
x: Math.min(rect.x1, rect.x2),
|
|
70
|
-
y: Math.min(rect.y1, rect.y2),
|
|
71
|
-
width: Math.abs(rect.x2 - rect.x1),
|
|
72
|
-
height: Math.abs(rect.y2 - rect.y1)
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
_BBox.fromRectBox = fromRectBox;
|
|
76
|
-
function toRectBox(box) {
|
|
77
|
-
return {
|
|
78
|
-
x1: box.x,
|
|
79
|
-
y1: box.y,
|
|
80
|
-
x2: box.x + box.width,
|
|
81
|
-
y2: box.y + box.height
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
_BBox.toRectBox = toRectBox;
|
|
85
|
-
function expand(box, plus) {
|
|
86
|
-
if (plus === 0) return box;
|
|
87
|
-
return {
|
|
88
|
-
x: box.x - plus,
|
|
89
|
-
y: box.y - plus,
|
|
90
|
-
width: box.width + plus * 2,
|
|
91
|
-
height: box.height + plus * 2
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
_BBox.expand = expand;
|
|
95
|
-
function shrink(box, minus) {
|
|
96
|
-
if (minus === 0) return box;
|
|
97
|
-
return {
|
|
98
|
-
x: box.x + minus,
|
|
99
|
-
y: box.y + minus,
|
|
100
|
-
width: box.width - minus * 2,
|
|
101
|
-
height: box.height - minus * 2
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
_BBox.shrink = shrink;
|
|
105
|
-
function includes(a, b) {
|
|
106
|
-
if (a === b) return true;
|
|
107
|
-
return a.x <= b.x && a.y <= b.y && a.x + a.width >= b.x + b.width && a.y + a.height >= b.y + b.height;
|
|
108
|
-
}
|
|
109
|
-
_BBox.includes = includes;
|
|
110
|
-
})(BBox || (BBox = {}));
|
|
111
|
-
let RectBox;
|
|
112
|
-
(function(_RectBox) {
|
|
113
|
-
function center({ x1, y1, x2, y2 }) {
|
|
114
|
-
return {
|
|
115
|
-
x: (x1 + x2) / 2,
|
|
116
|
-
y: (y1 + y2) / 2
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
_RectBox.center = center;
|
|
120
|
-
function fromPoints(points) {
|
|
121
|
-
invariant(points.length > 0, "At least one point is required");
|
|
122
|
-
let minX = Infinity;
|
|
123
|
-
let minY = Infinity;
|
|
124
|
-
let maxX = -Infinity;
|
|
125
|
-
let maxY = -Infinity;
|
|
126
|
-
for (const [x, y] of points) {
|
|
127
|
-
minX = Math.min(minX, x);
|
|
128
|
-
minY = Math.min(minY, y);
|
|
129
|
-
maxX = Math.max(maxX, x);
|
|
130
|
-
maxY = Math.max(maxY, y);
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
x1: minX,
|
|
134
|
-
y1: minY,
|
|
135
|
-
x2: maxX,
|
|
136
|
-
y2: maxY
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
_RectBox.fromPoints = fromPoints;
|
|
140
|
-
function merge(...boxes) {
|
|
141
|
-
invariant(boxes.length > 0, "No boxes provided");
|
|
142
|
-
let minX = Infinity;
|
|
143
|
-
let minY = Infinity;
|
|
144
|
-
let maxX = -Infinity;
|
|
145
|
-
let maxY = -Infinity;
|
|
146
|
-
for (const box of boxes) {
|
|
147
|
-
minX = Math.min(minX, box.x1);
|
|
148
|
-
minY = Math.min(minY, box.y1);
|
|
149
|
-
maxX = Math.max(maxX, box.x2);
|
|
150
|
-
maxY = Math.max(maxY, box.y2);
|
|
151
|
-
}
|
|
152
|
-
return {
|
|
153
|
-
x1: minX,
|
|
154
|
-
y1: minY,
|
|
155
|
-
x2: maxX,
|
|
156
|
-
y2: maxY
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
_RectBox.merge = merge;
|
|
160
|
-
function toBBox(box) {
|
|
161
|
-
return {
|
|
162
|
-
x: box.x1,
|
|
163
|
-
y: box.y1,
|
|
164
|
-
width: box.x2 - box.x1,
|
|
165
|
-
height: box.y2 - box.y1
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
_RectBox.toBBox = toBBox;
|
|
169
|
-
function includes(a, b) {
|
|
170
|
-
if (a === b) return true;
|
|
171
|
-
return a.x1 <= b.x1 && a.y1 <= b.y1 && a.x2 >= b.x2 && a.y2 >= b.y2;
|
|
172
|
-
}
|
|
173
|
-
_RectBox.includes = includes;
|
|
174
|
-
})(RectBox || (RectBox = {}));
|
|
175
|
-
|
|
176
|
-
//#endregion
|
|
177
|
-
//#region src/geometry/vector.ts
|
|
178
|
-
var Vector = class Vector {
|
|
179
|
-
constructor(x, y) {
|
|
180
|
-
this.x = x;
|
|
181
|
-
this.y = y;
|
|
182
|
-
}
|
|
183
|
-
static create(...args) {
|
|
184
|
-
if (args.length === 2) return new Vector(args[0], args[1]);
|
|
185
|
-
return new Vector(args[0].x, args[0].y);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Adds two vectors.
|
|
189
|
-
* @param a The first vector.
|
|
190
|
-
* @param b The second vector.
|
|
191
|
-
* @returns The sum of the two vectors.
|
|
192
|
-
*/
|
|
193
|
-
static add(a, b) {
|
|
194
|
-
return {
|
|
195
|
-
x: a.x + b.x,
|
|
196
|
-
y: a.y + b.y
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Subtracts two vectors.
|
|
201
|
-
* @param a The first vector.
|
|
202
|
-
* @param b The second vector.
|
|
203
|
-
* @returns The difference of the two vectors.
|
|
204
|
-
*/
|
|
205
|
-
static subtract(a, b) {
|
|
206
|
-
return {
|
|
207
|
-
x: a.x - b.x,
|
|
208
|
-
y: a.y - b.y
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Multiplies a vector by a scalar.
|
|
213
|
-
* @param a The vector.
|
|
214
|
-
* @param b The scalar.
|
|
215
|
-
* @returns The scaled vector.
|
|
216
|
-
*/
|
|
217
|
-
static multiply(a, b) {
|
|
218
|
-
return {
|
|
219
|
-
x: a.x * b,
|
|
220
|
-
y: a.y * b
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Divides a vector by a scalar.
|
|
225
|
-
* @param a The vector.
|
|
226
|
-
* @param b The scalar.
|
|
227
|
-
* @returns The scaled vector.
|
|
228
|
-
*/
|
|
229
|
-
static divide(a, b) {
|
|
230
|
-
return {
|
|
231
|
-
x: a.x / b,
|
|
232
|
-
y: a.y / b
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Calculates the dot product of the vectors.
|
|
237
|
-
* @param a The first vector.
|
|
238
|
-
* @param b The second vector.
|
|
239
|
-
* @returns The dot product.
|
|
240
|
-
*/
|
|
241
|
-
static dot(a, b) {
|
|
242
|
-
return a.x * b.x + a.y * b.y;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Adds the given vector to this vector.
|
|
246
|
-
* @param b The vector to add.
|
|
247
|
-
* @returns A new vector that is the sum of this vector and the given vector.
|
|
248
|
-
*/
|
|
249
|
-
add(b) {
|
|
250
|
-
return new Vector(this.x + b.x, this.y + b.y);
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Subtracts the given vector from this vector.
|
|
254
|
-
* @param b The vector to subtract.
|
|
255
|
-
* @returns A new vector that is the difference of this vector and the given vector.
|
|
256
|
-
*/
|
|
257
|
-
subtract(b) {
|
|
258
|
-
return new Vector(this.x - b.x, this.y - b.y);
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Multiplies this vector by a scalar.
|
|
262
|
-
* @param b The scalar to multiply by.
|
|
263
|
-
* @returns A new vector that is the product of this vector and the given scalar.
|
|
264
|
-
*/
|
|
265
|
-
multiply(b) {
|
|
266
|
-
return new Vector(this.x * b, this.y * b);
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Divides this vector by a scalar.
|
|
270
|
-
* @param b The scalar to divide by.
|
|
271
|
-
* @returns A new vector that is the quotient of this vector and the given scalar.
|
|
272
|
-
*/
|
|
273
|
-
divide(b) {
|
|
274
|
-
return new Vector(this.x / b, this.y / b);
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Calculates the dot product of this vector and another vector.
|
|
278
|
-
* @param b The other vector.
|
|
279
|
-
* @returns The dot product.
|
|
280
|
-
*/
|
|
281
|
-
dot(b) {
|
|
282
|
-
return this.x * b.x + this.y * b.y;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Calculates the cross product of this vector and another vector.
|
|
286
|
-
* The cross product of two 2D vectors is a scalar value: a.x * b.y - a.y * b.x
|
|
287
|
-
* @param b The other vector.
|
|
288
|
-
* @returns The cross product as a scalar.
|
|
289
|
-
*/
|
|
290
|
-
cross(b) {
|
|
291
|
-
return this.x * b.y - this.y * b.x;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Calculates the length (magnitude) of this vector.
|
|
295
|
-
* @returns The length of the vector.
|
|
296
|
-
*/
|
|
297
|
-
length() {
|
|
298
|
-
if (this.x === 0 && this.y === 0) return 0;
|
|
299
|
-
return Math.sqrt(this.x ** 2 + this.y ** 2);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Normalizes the vector (makes it unit length, i.e., has a length of 1).
|
|
303
|
-
* @returns A new vector that is the normalized version of this vector.
|
|
304
|
-
*/
|
|
305
|
-
normalize() {
|
|
306
|
-
const len = this.length();
|
|
307
|
-
if (len === 0) return new Vector(0, 0);
|
|
308
|
-
return new Vector(this.x / len, this.y / len);
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Rounds the components of the vector to the nearest integers.
|
|
312
|
-
* @returns A new vector with rounded components.
|
|
313
|
-
*/
|
|
314
|
-
round() {
|
|
315
|
-
return new Vector(Math.round(this.x), Math.round(this.y));
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Converts the vector to a plain object.
|
|
319
|
-
* @returns An object with x and y properties.
|
|
320
|
-
*/
|
|
321
|
-
toObject() {
|
|
322
|
-
return {
|
|
323
|
-
x: this.x,
|
|
324
|
-
y: this.y
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
function vector(...args) {
|
|
329
|
-
if (args.length === 1 && args[0] instanceof Vector) return args[0];
|
|
330
|
-
if (args.length === 2) return new Vector(args[0], args[1]);
|
|
331
|
-
return new Vector(args[0].x, args[0].y);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
//#endregion
|
|
335
|
-
export { RectBox as i, vector as n, BBox as r, Vector as t };
|
|
1
|
+
import{Q as e}from"./libs/remeda.mjs";import{Q as t}from"./utils.mjs";function n(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function r(e){return n(e)?{x:e[0],y:e[1]}:[e.x,e.y]}const i={center({x:e,y:t,width:n,height:r}){return{x:e+n/2,y:t+r/2}},toPoints({x:e,y:t,width:n,height:r}){return[{x:e,y:t},{x:e+n,y:t},{x:e+n,y:t+r},{x:e,y:t+r}]},fromPoints(e){let{x1:t,y1:n,x2:r,y2:i}=a.fromPoints(e);return{x:t,y:n,width:r-t,height:i-n}},merge(...n){if(t(e(n,1),`No boxes provided`),n.length===1)return n[0];let r=n[0].x,i=n[0].y,a=n[0].x+n[0].width,o=n[0].y+n[0].height;for(let e=1;e<n.length;e++){let t=n[e];r=Math.min(r,t.x),i=Math.min(i,t.y),a=Math.max(a,t.x+t.width),o=Math.max(o,t.y+t.height)}return{x:Math.floor(r),y:Math.floor(i),width:Math.round(a-r),height:Math.round(o-i)}},fromRectBox(e){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),width:Math.abs(e.x2-e.x1),height:Math.abs(e.y2-e.y1)}},toRectBox(e){return{x1:e.x,y1:e.y,x2:e.x+e.width,y2:e.y+e.height}},expand(e,t){return t===0?e:{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}},shrink(e,t){return t===0?e:{x:e.x+t,y:e.y+t,width:e.width-t*2,height:e.height-t*2}},includes(e,t){return e===t?!0:e.x<=t.x&&e.y<=t.y&&e.x+e.width>=t.x+t.width&&e.y+e.height>=t.y+t.height}},a={center({x1:e,y1:t,x2:n,y2:r}){return{x:(e+n)/2,y:(t+r)/2}},fromPoints(e){t(e.length>0,`At least one point is required`);let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let[t,o]of e)n=Math.min(n,t),r=Math.min(r,o),i=Math.max(i,t),a=Math.max(a,o);return{x1:n,y1:r,x2:i,y2:a}},merge(...e){t(e.length>0,`No boxes provided`);let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let t of e)n=Math.min(n,t.x1),r=Math.min(r,t.y1),i=Math.max(i,t.x2),a=Math.max(a,t.y2);return{x1:n,y1:r,x2:i,y2:a}},toBBox(e){return{x:e.x1,y:e.y1,width:e.x2-e.x1,height:e.y2-e.y1}},includes(e,t){return e===t?!0:e.x1<=t.x1&&e.y1<=t.y1&&e.x2>=t.x2&&e.y2>=t.y2}};var o=class e{constructor(e,n){this.x=e,this.y=n,t(typeof e==`number`&&!isNaN(e)&&isFinite(e)&&typeof n==`number`&&!isNaN(n)&&isFinite(n),`Invalid arguments for Vector: (${e}, ${n})`)}static create(...t){return t.length===2?new e(t[0],t[1]):new e(t[0].x,t[0].y)}static add(e,t){return{x:e.x+t.x,y:e.y+t.y}}static subtract(e,t){return{x:e.x-t.x,y:e.y-t.y}}static multiply(e,t){return{x:e.x*t,y:e.y*t}}static divide(e,t){return{x:e.x/t,y:e.y/t}}static dot(e,t){return e.x*t.x+e.y*t.y}add(t){return new e(this.x+t.x,this.y+t.y)}subtract(t){return new e(this.x-t.x,this.y-t.y)}multiply(t){return new e(this.x*t,this.y*t)}divide(t){return new e(this.x/t,this.y/t)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}length(){return this.x===0&&this.y===0?0:Math.sqrt(this.x**2+this.y**2)}normalize(){let t=this.length();return t===0?new e(0,0):new e(this.x/t,this.y/t)}round(){return new e(Math.round(this.x),Math.round(this.y))}trunc(){return new e(Math.trunc(this.x),Math.trunc(this.y))}toObject(){return{x:this.x,y:this.y}}};function s(...e){return e.length===1&&e[0]instanceof o?e[0]:e.length===2?new o(e[0],e[1]):new o(e[0].x,e[0].y)}export{r as a,a as i,s as n,n as o,i as r,o as t};
|