@likec4/core 1.48.0 → 1.49.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 +1012 -0
- package/dist/_chunks/Builder.view-element.mjs +2 -3284
- package/dist/_chunks/LikeC4Model.d.mts +21 -25
- package/dist/_chunks/RichText.mjs +1 -148
- 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/calcDriftsFromSnapshot.mjs +1 -379
- package/dist/_chunks/guards.d.mts +2026 -0
- package/dist/_chunks/guards.mjs +4 -0
- package/dist/_chunks/index.d.mts +255 -136
- 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 +1 -702
- package/dist/_chunks/libs/trough.mjs +1 -158
- package/dist/_chunks/libs/unified.mjs +1 -2212
- package/dist/_chunks/rolldown-runtime.mjs +1 -42
- package/dist/_chunks/{index3.d.mts → theme.d.mts} +15 -13
- package/dist/_chunks/{index7.d.mts → to-text.d.mts} +165 -29
- package/dist/_chunks/to-text.mjs +1 -0
- package/dist/_chunks/vector.d.mts +198 -0
- package/dist/_chunks/vector.mjs +1 -0
- package/dist/builder/index.d.mts +2 -8
- package/dist/builder/index.mjs +1 -662
- package/dist/compute-view/index.d.mts +86 -15
- 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 +9 -13
- package/dist/index.mjs +1 -27
- package/dist/model/index.d.mts +4 -14
- package/dist/model/index.mjs +1 -11
- package/dist/styles/index.d.mts +2 -8
- 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 +4 -11
- package/dist/utils/index.mjs +1 -17
- package/package.json +13 -12
- package/dist/_chunks/LikeC4Styles.mjs +0 -691
- package/dist/_chunks/RichText.d.mts +0 -84
- package/dist/_chunks/_aux.d.mts +0 -289
- package/dist/_chunks/_aux.mjs +0 -18
- 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/geometry.mjs +0 -335
- package/dist/_chunks/index2.d.mts +0 -937
- package/dist/_chunks/index4.d.mts +0 -62
- package/dist/_chunks/index5.d.mts +0 -42
- package/dist/_chunks/index6.d.mts +0 -43
- 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.d.mts +0 -1
- package/dist/_chunks/mnemonist.mjs +0 -0
- package/dist/_chunks/model.mjs +0 -1898
- 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/_chunks/utils.mjs +0 -483
- 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 "./guards.mjs";
|
|
2
|
+
import { i as BBox } from "./vector.mjs";
|
|
3
|
+
import { i as LikeC4Styles } from "./theme.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,148 +1 @@
|
|
|
1
|
-
import { h as memoizeProp, n as markdownToHtml, t as markdownToText } from "./utils.mjs";
|
|
2
|
-
import { r as nonexhaustive } from "./invariant.mjs";
|
|
3
|
-
import { a as import_lru_map } from "./libs/mnemonist.mjs";
|
|
4
|
-
|
|
5
|
-
//#region src/types/RichText.ts
|
|
6
|
-
const symb_text = Symbol.for("text");
|
|
7
|
-
const symb_html = Symbol.for("html");
|
|
8
|
-
const emptyTxt = "";
|
|
9
|
-
/**
|
|
10
|
-
* RichText is a class that represents a potentially markdown string.
|
|
11
|
-
* It can be either a plain text or a markdown.
|
|
12
|
-
* It is used to represent the content of a node or a link.
|
|
13
|
-
*/
|
|
14
|
-
var RichText = class RichText {
|
|
15
|
-
static mdcache = new import_lru_map.default(500);
|
|
16
|
-
static txtcache = new import_lru_map.default(500);
|
|
17
|
-
static getOrCreateFromText(txt) {
|
|
18
|
-
txt = txt.trimEnd();
|
|
19
|
-
if (txt === emptyTxt) return RichText.EMPTY;
|
|
20
|
-
let cached = RichText.txtcache.get(txt);
|
|
21
|
-
if (cached) return cached;
|
|
22
|
-
cached = new RichText({ txt });
|
|
23
|
-
RichText.txtcache.set(txt, cached);
|
|
24
|
-
return cached;
|
|
25
|
-
}
|
|
26
|
-
static getOrCreateFromMarkdown(md) {
|
|
27
|
-
md = md.trimEnd();
|
|
28
|
-
if (md === emptyTxt) return RichText.EMPTY;
|
|
29
|
-
let cached = RichText.mdcache.get(md);
|
|
30
|
-
if (cached) return cached;
|
|
31
|
-
cached = new RichText({ md });
|
|
32
|
-
RichText.mdcache.set(md, cached);
|
|
33
|
-
return cached;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Creates and memoizes a RichText instance.
|
|
37
|
-
* @see ElementModel.description
|
|
38
|
-
* @example
|
|
39
|
-
*
|
|
40
|
-
* get description(): RichTextOrEmpty {
|
|
41
|
-
* return RichText.memoize(this, 'description', this.$element.description)
|
|
42
|
-
* }
|
|
43
|
-
*/
|
|
44
|
-
static memoize(obj, tag, source) {
|
|
45
|
-
return memoizeProp(obj, tag, () => RichText.from(source));
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Creates a RichText instance from a source.
|
|
49
|
-
*/
|
|
50
|
-
static from(source) {
|
|
51
|
-
if (source === null || source === void 0 || source === RichText.EMPTY) return RichText.EMPTY;
|
|
52
|
-
if (source instanceof RichText) return source;
|
|
53
|
-
if (typeof source === "string") return this.getOrCreateFromText(source);
|
|
54
|
-
if ("isEmpty" in source && source.isEmpty) return RichText.EMPTY;
|
|
55
|
-
if ("md" in source) return this.getOrCreateFromMarkdown(source.md);
|
|
56
|
-
return this.getOrCreateFromText(source.txt);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* This is a workaround for the fact that we need instance of RichText for `instanceof` checks
|
|
60
|
-
* It is invalid inheritance (returning `null` from getters), and we cast to @see RichTextEmpty
|
|
61
|
-
*/
|
|
62
|
-
static EMPTY = new class extends RichText {
|
|
63
|
-
isEmpty = true;
|
|
64
|
-
nonEmpty = false;
|
|
65
|
-
isMarkdown = false;
|
|
66
|
-
$source = null;
|
|
67
|
-
constructor() {
|
|
68
|
-
super({ txt: emptyTxt });
|
|
69
|
-
}
|
|
70
|
-
get text() {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
get md() {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
get html() {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
}();
|
|
80
|
-
$source;
|
|
81
|
-
isEmpty;
|
|
82
|
-
nonEmpty;
|
|
83
|
-
isMarkdown;
|
|
84
|
-
/**
|
|
85
|
-
* Private constructor to prevent direct instantiation.
|
|
86
|
-
* Use {@link RichText.from} or {@link RichText.memoize} instead.
|
|
87
|
-
*/
|
|
88
|
-
constructor(source) {
|
|
89
|
-
this.isMarkdown = false;
|
|
90
|
-
if (typeof source === "string") {
|
|
91
|
-
this.$source = { txt: source };
|
|
92
|
-
this.isEmpty = source.trim() === emptyTxt;
|
|
93
|
-
} else {
|
|
94
|
-
this.$source = source;
|
|
95
|
-
this.isEmpty = true;
|
|
96
|
-
if ("md" in source) {
|
|
97
|
-
this.isEmpty = source.md === emptyTxt;
|
|
98
|
-
this.isMarkdown = true;
|
|
99
|
-
} else this.isEmpty = source.txt === emptyTxt;
|
|
100
|
-
}
|
|
101
|
-
this.nonEmpty = !this.isEmpty;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Returns the text content of the rich text.
|
|
105
|
-
* If the source is a string, it returns the string.
|
|
106
|
-
* If the source is a markdown, it returns the markdown.
|
|
107
|
-
*/
|
|
108
|
-
get text() {
|
|
109
|
-
if (this.isEmpty || this.$source === null) return emptyTxt;
|
|
110
|
-
const source = this.$source;
|
|
111
|
-
if ("txt" in source) return source.txt;
|
|
112
|
-
return memoizeProp(this, symb_text, () => markdownToText(source.md));
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Returns the markdown content of the rich text.
|
|
116
|
-
* If the source is a string, it returns the string.
|
|
117
|
-
* If the source is a markdown, it returns the markdown.
|
|
118
|
-
*/
|
|
119
|
-
get md() {
|
|
120
|
-
if (this.isEmpty || this.$source === null) return emptyTxt;
|
|
121
|
-
const source = this.$source;
|
|
122
|
-
if ("md" in source) return source.md;
|
|
123
|
-
if ("txt" in source) return source.txt;
|
|
124
|
-
nonexhaustive(source);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Returns the html content of the rich text.
|
|
128
|
-
* If the source is a string, it returns the string.
|
|
129
|
-
* If the source is a markdown, it returns the HTML.
|
|
130
|
-
*/
|
|
131
|
-
get html() {
|
|
132
|
-
if (this.isEmpty || this.$source === null) return emptyTxt;
|
|
133
|
-
const source = this.$source;
|
|
134
|
-
if ("txt" in source) return source.txt;
|
|
135
|
-
return memoizeProp(this, symb_html, () => markdownToHtml(source.md));
|
|
136
|
-
}
|
|
137
|
-
equals(other) {
|
|
138
|
-
if (this === other) return true;
|
|
139
|
-
if (!(other instanceof RichText)) return false;
|
|
140
|
-
if (this.isEmpty && other.isEmpty) return true;
|
|
141
|
-
if (this.isEmpty !== other.isEmpty || this.isMarkdown !== other.isMarkdown) return false;
|
|
142
|
-
if (this.isMarkdown) return this.$source?.md === other.$source?.md;
|
|
143
|
-
return this.$source?.txt === other.$source?.txt;
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
//#endregion
|
|
148
|
-
export { RichText as t };
|
|
1
|
+
import{n as __exportAll}from"./rolldown-runtime.mjs";import{t as defu}from"./libs/defu.mjs";import{B as e$5,I as e,M as e$3,N as e$4,O as e$2,T as t$4,V as t$1,et as t$2,it as t$5,k as e$1,rt as t$6,t as t$3,x as t}from"./libs/remeda.mjs";import{Q as invariant,et as nonexhaustive,h as memoizeProp,n as markdownToHtml,t as markdownToText}from"./to-text.mjs";import{i as import_lru_map,n as import_default_weak_map,t as import_default_map}from"./libs/mnemonist.mjs";import{a as indigo,c as pink,d as ruby,f as teal,h as yellow,i as grass,l as purple,m as violet,n as blue$2,o as lime,p as tomato,r as crimson,s as orange,t as amber,u as red}from"./libs/@radix-ui/colors.mjs";import{n as chroma_js_default,t as generateColors}from"./libs/@mantine/colors-generator.mjs";function exact(n){return t(n,n=>n===void 0)}function preferSummary(n){return n.summary??n.description}function preferDescription(n){return n.description??n.summary}function isOnStage(n,r){return n[_stage]===r}const _stage=`_stage`,_type=`_type`,_layout=`_layout`;var scalar_exports=__exportAll({DeploymentFqn:()=>DeploymentFqn,EdgeId:()=>EdgeId,Fqn:()=>Fqn,GlobalFqn:()=>GlobalFqn,GroupElementKind:()=>GroupElementKind,MarkdownOrString:()=>MarkdownOrString,NodeId:()=>NodeId,NoneIcon:()=>NoneIcon,ProjectId:()=>ProjectId,RelationId:()=>RelationId,StepEdgeKind:()=>StepEdgeKind,ViewId:()=>ViewId,extractStep:()=>extractStep,flattenMarkdownOrString:()=>flattenMarkdownOrString,isGlobalFqn:()=>isGlobalFqn,isGroupElementKind:()=>isGroupElementKind,isStepEdgeId:()=>isStepEdgeId,splitGlobalFqn:()=>splitGlobalFqn,stepEdgeId:()=>stepEdgeId});function ProjectId(n){return n}function MarkdownOrString(n){return typeof n==`string`?{txt:n}:n}function flattenMarkdownOrString(n){if(e(n))return null;let r=e$1(n)?n:n.txt??n.md;return e$2(r?.trim())?r:null}const NoneIcon=`none`;function Fqn(n,r){return r?r+`.`+n:n}const GroupElementKind=`@group`;function isGroupElementKind(n){return n.kind===GroupElementKind}function DeploymentFqn(n,r){return r?r+`.`+n:n}function ViewId(n){return n}function RelationId(n){return n}function GlobalFqn(n,r){return invariant(typeof n==`string`&&n!=``),`@`+n+`.`+r}function isGlobalFqn(n){return n.startsWith(`@`)}function splitGlobalFqn(n){if(!n.startsWith(`@`))return[null,n];let r=n.indexOf(`.`);if(r<2)throw Error(`Invalid global FQN`);return[n.slice(1,r),n.slice(r+1)]}function NodeId(n){return n}function EdgeId(n){return n}function stepEdgeId(n,r){let i=`step-${String(n).padStart(2,`0`)}`;return r?`${i}.${r}`:i}const StepEdgeKind=`@step`;function isStepEdgeId(n){return n.startsWith(`step-`)}function extractStep(n){if(!isStepEdgeId(n))throw Error(`Invalid step edge id: ${n}`);return parseFloat(n.slice(5))}let FqnRef;(function(n){function r(n){return`model`in n&&!(`project`in n)}n.isElementRef=r;function i(n){return`project`in n&&`model`in n}n.isImportRef=i;function a(n){if(e$1(n))throw Error(`Expected FqnRef, got: "${n}"`);if(i(n))return GlobalFqn(n.project,n.model);if(r(n))return n.model;throw Error(`Expected FqnRef.ModelRef or FqnRef.ImportRef`)}n.flatten=a;function o(n){return r(n)||i(n)}n.isModelRef=o;function s(n){return`deployment`in n&&`element`in n}n.isInsideInstanceRef=s;function c(n){return`deployment`in n&&!(`element`in n)}n.isDeploymentElementRef=c;function l(n){return c(n)||s(n)}n.isDeploymentRef=l})(FqnRef||={});let FqnExpr;(function(n){function r(n){return`wildcard`in n&&n.wildcard===!0}n.isWildcard=r;function i(n){return`ref`in n&&FqnRef.isModelRef(n.ref)}n.isModelRef=i;function a(n){return`ref`in n&&FqnRef.isDeploymentRef(n.ref)}n.isDeploymentRef=a;function o(n){return`elementKind`in n&&`isEqual`in n}n.isElementKindExpr=o;function s(n){return`elementTag`in n&&`isEqual`in n}n.isElementTagExpr=s;function c(n){return`where`in n&&u(n.where.expr)}n.isWhere=c;function l(n){return`custom`in n&&(u(n.custom.expr)||c(n.custom.expr))}n.isCustom=l;function u(n){return r(n)||i(n)||a(n)||o(n)||s(n)}n.is=u;function d(n){return l(n)&&(n=n.custom.expr),c(n)&&(n=n.where.expr),n}n.unwrap=d})(FqnExpr||={});let RelationExpr;(function(n){function r(n){return`source`in n&&`target`in n}n.isDirect=r;function i(n){return`incoming`in n}n.isIncoming=i;function a(n){return`outgoing`in n}n.isOutgoing=a;function o(n){return`inout`in n}n.isInOut=o;function s(n){return`where`in n&&(r(n.where.expr)||i(n.where.expr)||a(n.where.expr)||o(n.where.expr))}n.isWhere=s;function c(n){return`customRelation`in n}n.isCustom=c;function l(n){return r(n)||i(n)||a(n)||o(n)}n.is=l;function u(n){return c(n)&&(n=n.customRelation.expr),s(n)&&(n=n.where.expr),n}n.unwrap=u})(RelationExpr||={});let Expression;(function(n){function r(n){return`where`in n}n.isWhere=r;function i(n){return RelationExpr.isWhere(n)}n.isRelationWhere=i;function a(n){return FqnExpr.isWhere(n)}n.isFqnExprWhere=a;function o(n){return FqnExpr.is(n)||FqnExpr.isWhere(n)||FqnExpr.isCustom(n)}n.isFqnExpr=o;function s(n){return RelationExpr.is(n)||RelationExpr.isWhere(n)||RelationExpr.isCustom(n)}n.isRelation=s})(Expression||={});let ModelFqnExpr;(function(n){function r(n){return`wildcard`in n&&n.wildcard===!0}n.isWildcard=r;function i(n){return`ref`in n&&FqnRef.isModelRef(n.ref)}n.isModelRef=i;function a(n){return`elementKind`in n&&`isEqual`in n}n.isElementKindExpr=a;function o(n){return`elementTag`in n&&`isEqual`in n}n.isElementTagExpr=o;function s(n){return`where`in n&&l(n.where.expr)}n.isWhere=s;function c(n){return`custom`in n&&(l(n.custom.expr)||s(n.custom.expr))}n.isCustom=c;function l(n){return r(n)||i(n)||a(n)||o(n)}n.is=l;function u(n){return c(n)&&(n=n.custom.expr),s(n)&&(n=n.where.expr),n}n.unwrap=u})(ModelFqnExpr||={});let ModelRelationExpr;(function(n){function r(n){return`source`in n&&`target`in n}n.isDirect=r;function i(n){return`incoming`in n}n.isIncoming=i;function a(n){return`outgoing`in n}n.isOutgoing=a;function o(n){return`inout`in n}n.isInOut=o;function s(n){return`where`in n&&(r(n.where.expr)||i(n.where.expr)||a(n.where.expr)||o(n.where.expr))}n.isWhere=s;function c(n){return`customRelation`in n}n.isCustom=c;function l(n){return r(n)||i(n)||a(n)||o(n)}n.is=l;function u(n){return c(n)&&(n=n.customRelation.expr),s(n)&&(n=n.where.expr),n}n.unwrap=u})(ModelRelationExpr||={});let ModelExpression;(function(n){function r(n){return`where`in n}n.isWhere=r;function i(n){return ModelRelationExpr.isWhere(n)}n.isRelationWhere=i;function a(n){return ModelFqnExpr.isWhere(n)}n.isFqnExprWhere=a;function o(n){return ModelFqnExpr.is(n)||ModelFqnExpr.isWhere(n)||ModelFqnExpr.isCustom(n)}n.isFqnExpr=o;function s(n){return ModelRelationExpr.is(n)||ModelRelationExpr.isWhere(n)||ModelRelationExpr.isCustom(n)}n.isRelationExpr=s})(ModelExpression||={});function isDeploymentNode(n){return e$2(n.kind)&&!e$2(n.element)}function isDeployedInstance(n){return e$2(n.element)&&!e$2(n.kind)}const blue$1={fill:`#3b82f6`,stroke:`#2563eb`,hiContrast:`#eff6ff`,loContrast:`#bfdbfe`},sky$1={fill:`#0284c7`,stroke:`#0369a1`,hiContrast:`#f0f9ff`,loContrast:`#B6ECF7`},slate$1={fill:`#64748b`,stroke:`#475569`,hiContrast:`#f8fafc`,loContrast:`#cbd5e1`},ElementColors={primary:blue$1,blue:blue$1,secondary:sky$1,sky:sky$1,muted:slate$1,slate:slate$1,gray:{fill:`#737373`,stroke:`#525252`,hiContrast:`#fafafa`,loContrast:`#d4d4d4`},red:{fill:`#AC4D39`,stroke:`#853A2D`,hiContrast:`#FBD3CB`,loContrast:`#f5b2a3`},green:{fill:`#428a4f`,stroke:`#2d5d39`,hiContrast:`#f8fafc`,loContrast:`#c2f0c2`},amber:{fill:`#A35829`,stroke:`#7E451D`,hiContrast:`#FFE0C2`,loContrast:`#f9b27c`},indigo:{fill:`#6366f1`,stroke:`#4f46e5`,hiContrast:`#eef2ff`,loContrast:`#c7d2fe`}},gray={line:`#8D8D8D`,labelBg:`#18191B`,label:`#C9C9C9`},slate={line:`#64748b`,labelBg:`#0f172a`,label:`#cbd5e1`},blue={line:`#3b82f6`,labelBg:`#172554`,label:`#60a5fa`},sky={line:`#0ea5e9`,labelBg:`#082f49`,label:`#38bdf8`},RelationshipColors={amber:{line:`#b45309`,labelBg:`#78350f`,label:`#FFE0C2`},blue,gray,green:{line:`#15803d`,labelBg:`#052e16`,label:`#22c55e`},indigo:{line:`#6366f1`,labelBg:`#1e1b4b`,label:`#818cf8`},muted:slate,primary:blue,red:{line:`#AC4D39`,labelBg:`#b91c1c`,label:`#f5b2a3`},secondary:sky,sky,slate},defaultSizes={sizes:{xs:{width:180,height:100},sm:{width:240,height:135},md:{width:320,height:180},lg:{width:420,height:234},xl:{width:520,height:290}},spacing:{xs:8,sm:10,md:16,lg:24,xl:32},textSizes:{xs:13.33,sm:16,md:19.2,lg:23.04,xl:27.65},iconSizes:{xs:24,sm:36,md:60,lg:82,xl:90}},Sizes=[`xs`,`sm`,`md`,`lg`,`xl`],IconPositions=[`left`,`right`,`top`,`bottom`],BorderStyles=[`solid`,`dashed`,`dotted`,`none`],ElementShapes=[`rectangle`,`person`,`browser`,`mobile`,`cylinder`,`storage`,`queue`,`bucket`,`document`,`component`],ThemeColors=[`amber`,`blue`,`gray`,`slate`,`green`,`indigo`,`muted`,`primary`,`red`,`secondary`,`sky`],DefaultTagColors=[`tomato`,`grass`,`blue`,`ruby`,`orange`,`indigo`,`pink`,`teal`,`purple`,`amber`,`crimson`,`red`,`lime`,`yellow`,`violet`],DefaultTagColorValues={tomato:tomato.tomato9,grass:grass.grass9,blue:blue$2.blue9,ruby:ruby.ruby9,orange:orange.orange9,indigo:indigo.indigo9,pink:pink.pink9,teal:teal.teal9,purple:purple.purple9,amber:amber.amber9,crimson:crimson.crimson9,red:red.red9,lime:lime.lime9,yellow:yellow.yellow9,violet:violet.violet9};function isDefaultTagColor(n){return n in DefaultTagColorValues}const defaultTheme$1={colors:ThemeColors.reduce((n,r)=>(n[r]={elements:ElementColors[r],relationships:RelationshipColors[r]},n),{}),...defaultSizes};function computeColorValues(n){invariant(chroma_js_default.valid(n),`Invalid color: ${n}`);let r=generateColors(n),i=r[6],a=getContrastedColorsAPCA(i);return{elements:{fill:i,stroke:r[7],...a},relationships:{line:r[4],label:r[3],labelBg:r[9]}}}function getContrastedColorsAPCA(n){let r=chroma_js_default(n),i=r.brighten(2),a=r.darken(2),o,s,c,l;do o=i,s=a,i=i.brighten(1),a=a.darken(1),c=chroma_js_default.contrastAPCA(r,i),l=chroma_js_default.contrastAPCA(r,a);while(Math.abs(c)<60&&Math.abs(l)<60&&(!t$1(i,o)||!t$1(a,s)));return Math.abs(c)>Math.abs(l)?{hiContrast:i.brighten(.4).hex(),loContrast:i.hex()}:{hiContrast:a.darken(.4).hex(),loContrast:a.hex()}}function computeCompoundColorValues(n,r){let i=r??6,a=chroma_js_default(n.fill),o=chroma_js_default(n.stroke),s=a.luminance()>.8,c=t$2(t$3(chroma_js_default.scale(s?[a.darken(.02).desaturate(.05),a.darken(.1).desaturate(.1)]:[a.shade(.12,`lch`).desaturate(.05),a.shade(.35,`lch`).desaturate(.4)]).mode(`oklch`).correctLightness().colors(i,null),chroma_js_default.scale(s?[o.darken(.04).desaturate(.05),o.darken(.12).desaturate(.1)]:[o.shade(.15,`lch`).desaturate(.08),o.shade(.4,`lch`).desaturate(.4)]).mode(`oklch`).correctLightness().colors(i,null)),t$4(([r,i])=>({...n,fill:r.hex(),stroke:i.hex()})));return invariant(c.length===i,`Expected ${i} colors, got ${c.length}`),c}const styleDefaults={color:`primary`,size:`md`,opacity:15,shape:`rectangle`,group:{opacity:15,border:`dashed`},relationship:{color:`gray`,line:`dashed`,arrow:`normal`}},defaultTheme=defaultTheme$1,defaultStyle={theme:defaultTheme,defaults:styleDefaults};var LikeC4Styles=class n{theme;defaults;static DEFAULT=new n(defaultStyle);static from(i,o){if(!i&&!o)return this.DEFAULT;let{customCss:s,theme:c,defaults:l}={...i},d=defu({theme:c},{defaults:{...l}},{theme:{colors:{...o}}},defaultStyle);return e(s?.content)&&t$1(d,defaultStyle)?this.DEFAULT:new n(d,s)}constructor(n,r){this.config=n,this.customCss=r,this.theme=n.theme,this.defaults=n.defaults}get elementColors(){return this.theme.colors[this.defaults.color].elements}get relationshipColors(){return this.theme.colors[this.defaults.relationship.color].relationships}get groupColors(){let n=this.defaults.group?.color;if(!n)return this.elementColors;if(!this.isThemeColor(n))throw Error(`Default group color not found in theme: ${n}`);return memoizeProp(this,`defaultGroup`,()=>({...this.elementColors,...this.theme.colors[n].elements}))}isDefaultColor(n){return n===this.defaults.color}colors(n){return this.computeFrom(n??=this.defaults.color)}compoundColorsCache=new import_default_weak_map.default(n=>new import_default_map.default(r=>computeCompoundColorValues(n,r)));colorsForCompounds(n,r){return this.compoundColorsCache.get(n).get(r??6)}fontSize(n){return n??=this.defaults.text??this.defaults.size,this.theme.textSizes[n]}padding(n){return n??=this.defaults.padding??this.defaults.size,this.theme.spacing[n]}iconSize(n){return n??=this.defaults.size,this.theme.iconSizes[n]}isThemeColor(n){return n in this.theme.colors}nodeSizes(n){let r=ensureSizes(n,this.defaults.size);return{sizes:r,values:{sizes:this.theme.sizes[r.size],padding:this.padding(r.padding),textSize:this.fontSize(r.textSize),iconSize:this.iconSize(r.iconSize)}}}computeFrom(n){if(this.isThemeColor(n))return this.theme.colors[n];if(!chroma_js_default.valid(n))throw Error(`Invalid color value: "${n}" (not a theme color and not a valid CSS color)`);return computeColorValues(n)}equals(n){return n===this?!0:this.constructor===n.constructor?t$1(this.config,n.config)&&t$1(this.customCss??null,n.customCss??null):!1}tagColor(n){return this.isThemeColor(n)?this.theme.colors[n].elements:isDefaultTagColor(n)?this.computeFrom(DefaultTagColorValues[n]).elements:this.computeFrom(n).elements}};function ensureSizes({size:n,padding:r,textSize:i,iconSize:a,...o},s=defaultStyle.defaults.size){return n??=s,i??=n,r??=n,a??=n,{...o,size:n,padding:r,textSize:i,iconSize:a}}function isTagColorSpecified(n){let r=typeof n==`string`?n:n.color;return r.startsWith(`#`)||r.startsWith(`rgb`)}function isTagEqual(n){return`tag`in n}function isKindEqual(n){return`kind`in n}function isParticipantOperator(n){return`participant`in n}function isNotOperator(n){return`not`in n}function isAndOperator(n){return`and`in n}function isOrOperator(n){return`or`in n}function whereOperatorAsPredicate(n){switch(!0){case isParticipantOperator(n):{let r=n.participant;return participantIs(r,whereOperatorAsPredicate(n.operator))}case isTagEqual(n):{if(e$1(n.tag)||`eq`in n.tag){let r=e$1(n.tag)?n.tag:n.tag.eq;return n=>Array.isArray(n.tags)&&n.tags.includes(r)}let r=n.tag.neq;return n=>!Array.isArray(n.tags)||!n.tags.includes(r)}case isKindEqual(n):{if(e$1(n.kind)||`eq`in n.kind){let r=e$1(n.kind)?n.kind:n.kind.eq;return n=>n.kind===r}let r=n.kind.neq;return n=>e$3(n.kind)||n.kind!==r}case isNotOperator(n):return e$4(whereOperatorAsPredicate(n.not));case isAndOperator(n):return t$5(n.and.map(whereOperatorAsPredicate));case isOrOperator(n):return t$6(n.or.map(whereOperatorAsPredicate));default:nonexhaustive(n)}}function participantIs(n,r){return i=>{if(!i.source||!i.target)return!1;switch(n){case`source`:return r(i.source);case`target`:return r(i.target)}}}function isViewRulePredicate(n){return`include`in n||`exclude`in n}function isViewRuleStyle(n){return`targets`in n&&`style`in n}function isComputedView(n){return n._stage===`computed`}function isDiagramView(n){return n._stage===`layouted`}function isElementView(n){return n._type===`element`}function isScopedElementView(n){return isElementView(n)&&e$2(n.viewOf)}function isExtendsElementView(n){return isElementView(n)&&e$2(n.extends)}function isDeploymentView(n){return n._type===`deployment`}function isDynamicView(n){return n._type===`dynamic`}function isViewRuleGlobalStyle(n){return`styleId`in n}function isViewRuleGlobalPredicateRef(n){return`predicateId`in n}function isAutoLayoutDirection(n){return n===`TB`||n===`BT`||n===`LR`||n===`RL`}function isViewRuleAutoLayout(n){return`direction`in n}function getParallelStepsPrefix(n){return isStepEdgeId(n)&&n.includes(`.`)?n.slice(0,n.indexOf(`.`)+1):null}function isDynamicStep(n){return!!n&&!(`__series`in n||`__parallel`in n)}function isDynamicStepsParallel(n){return!!n&&`__parallel`in n&&e$5(n.__parallel)}function isDynamicStepsSeries(n){return!!n&&`__series`in n&&e$5(n.__series)}function isViewRuleGroup(n){return`title`in n&&`groupRules`in n&&Array.isArray(n.groupRules)}function isViewRuleRank(n){return`rank`in n&&Array.isArray(n.targets)}const symb_text=Symbol.for(`text`),symb_html=Symbol.for(`html`);var RichText=class n{static mdcache=new import_lru_map.default(500);static txtcache=new import_lru_map.default(500);static getOrCreateFromText(r){if(r=r.trimEnd(),r===``)return n.EMPTY;let i=n.txtcache.get(r);return i||(i=new n({txt:r}),n.txtcache.set(r,i),i)}static getOrCreateFromMarkdown(r){if(r=r.trimEnd(),r===``)return n.EMPTY;let i=n.mdcache.get(r);return i||(i=new n({md:r}),n.mdcache.set(r,i),i)}static memoize(r,i,a){return memoizeProp(r,i,()=>n.from(a))}static from(r){return r==null||r===n.EMPTY?n.EMPTY:r instanceof n?r:typeof r==`string`?this.getOrCreateFromText(r):`isEmpty`in r&&r.isEmpty?n.EMPTY:`md`in r?this.getOrCreateFromMarkdown(r.md):this.getOrCreateFromText(r.txt)}static EMPTY=new class extends n{isEmpty=!0;nonEmpty=!1;isMarkdown=!1;$source=null;constructor(){super({txt:``})}get text(){return null}get md(){return null}get html(){return null}};$source;isEmpty;nonEmpty;isMarkdown;constructor(n){this.isMarkdown=!1,typeof n==`string`?(this.$source={txt:n},this.isEmpty=n.trim()===``):(this.$source=n,this.isEmpty=!0,`md`in n?(this.isEmpty=n.md===``,this.isMarkdown=!0):this.isEmpty=n.txt===``),this.nonEmpty=!this.isEmpty}get text(){if(this.isEmpty||this.$source===null)return``;let n=this.$source;return`txt`in n?n.txt:memoizeProp(this,symb_text,()=>markdownToText(n.md))}get md(){if(this.isEmpty||this.$source===null)return``;let n=this.$source;if(`md`in n)return n.md;if(`txt`in n)return n.txt;nonexhaustive(n)}get html(){if(this.isEmpty||this.$source===null)return``;let n=this.$source;return`txt`in n?n.txt:memoizeProp(this,symb_html,()=>markdownToHtml(n.md))}equals(r){return this===r?!0:r instanceof n?this.isEmpty&&r.isEmpty?!0:this.isEmpty!==r.isEmpty||this.isMarkdown!==r.isMarkdown?!1:this.isMarkdown?this.$source?.md===r.$source?.md:this.$source?.txt===r.$source?.txt:!1}};export{GroupElementKind as $,LikeC4Styles as A,isDeployedInstance as B,isNotOperator as C,whereOperatorAsPredicate as D,isTagEqual as E,DefaultTagColors as F,Expression as G,ModelExpression as H,ElementShapes as I,FqnRef as J,FqnExpr as K,IconPositions as L,styleDefaults as M,computeColorValues as N,isTagColorSpecified as O,BorderStyles as P,GlobalFqn as Q,Sizes as R,isKindEqual as S,isParticipantOperator as T,ModelFqnExpr as U,isDeploymentNode as V,ModelRelationExpr as W,EdgeId as X,DeploymentFqn as Y,Fqn as Z,isExtendsElementView as _,_type as _t,isDynamicStep as a,StepEdgeKind as at,isViewRuleStyle as b,preferSummary as bt,isAutoLayoutDirection as c,flattenMarkdownOrString as ct,isViewRuleGlobalStyle as d,isStepEdgeId as dt,MarkdownOrString as et,isComputedView as f,scalar_exports as ft,isElementView as g,_stage as gt,isDynamicView as h,_layout as ht,getParallelStepsPrefix as i,RelationId as it,defaultTheme as j,ensureSizes as k,isViewRuleAutoLayout as l,isGlobalFqn as lt,isDiagramView as m,stepEdgeId as mt,isViewRuleGroup as n,NoneIcon as nt,isDynamicStepsParallel as o,ViewId as ot,isDeploymentView as p,splitGlobalFqn as pt,RelationExpr as q,isViewRuleRank as r,ProjectId as rt,isDynamicStepsSeries as s,extractStep as st,RichText as t,NodeId as tt,isViewRuleGlobalPredicateRef as u,isGroupElementKind as ut,isScopedElementView as v,isOnStage as vt,isOrOperator as w,isAndOperator as x,exact as xt,isViewRulePredicate as y,preferDescription as yt,ThemeColors as z};
|
|
@@ -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 "./guards.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 "./guards.mjs";
|
|
2
|
+
import { i as BBox } from "./vector.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$3,X as t,et as t$1,l as t$2,m as e$1,nt as t$4,p as t$5}from"./libs/remeda.mjs";import{F as DefaultTagColors}from"./RichText.mjs";import{$ as nonNullable,J as compareNatural}from"./to-text.mjs";function assignTagColors(a){let o=[],s=[];for(let[r,i]of t(a))e(i.color)?o.push({tag:r,spec:{color:i.color}}):s.push(r);return t$1(s,t$2(compareNatural),t$3((n,r)=>({tag:n,spec:{color:nonNullable(DefaultTagColors[r%DefaultTagColors.length])}})),t$4(o),t$2((n,r)=>compareNatural(n.tag,r.tag)),t$5(e$1(`tag`),e$1(`spec`)))}export{assignTagColors as t};
|