@likec4/core 1.32.0 → 1.32.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/index.d.mts +7 -5
- package/dist/compute-view/index.d.mts +3 -3
- package/dist/compute-view/relationships-view/index.d.mts +3 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +5 -5
- package/dist/shared/{core.Dpq3P3YJ.d.mts → core.Bdz6fBF1.d.mts} +10 -11
- package/dist/shared/{core.BaYE_r29.d.mts → core.CBxTtXMi.d.mts} +1 -1
- package/dist/shared/{core.CCWXGc6G.d.mts → core.DaAyklhe.d.mts} +21 -22
- package/dist/types/aux.d.mts +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/index.mjs +4 -1
- package/package.json +7 -7
- package/src/builder/_types.ts +6 -2
- package/src/model/DeploymentElementModel.ts +2 -2
- package/src/model/ElementModel.ts +5 -7
- package/src/model/RelationModel.ts +2 -5
- package/src/model/index.ts +2 -0
- package/src/model/types.ts +10 -0
- package/src/model/view/EdgeModel.ts +2 -2
- package/src/model/view/LikeC4ViewModel.ts +5 -4
- package/src/model/view/NodeModel.ts +2 -2
- package/src/types/aux.ts +1 -1
- package/src/types/styles.ts +10 -11
- package/src/types/view-parsed.deployment.ts +0 -1
- package/src/types/view.ts +0 -27
- package/src/utils/index.ts +1 -1
- package/src/utils/promises.ts +4 -0
package/dist/builder/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LastArrayElement, Split, Simplify, IsLiteral, Writable, IfNever, TupleToUnion, Tagged } from 'type-fest';
|
|
2
|
-
import { L as LikeC4Model } from '../shared/core.
|
|
1
|
+
import { LastArrayElement, Split, Simplify, IsLiteral, Writable, IfNever, IsNever, TupleToUnion, Tagged } from 'type-fest';
|
|
2
|
+
import { L as LikeC4Model } from '../shared/core.DaAyklhe.mjs';
|
|
3
3
|
import { D as DeploymentFqn, F as Fqn, d as NonEmptyArray, K as KeysOf } from '../shared/core.BuO4ncfY.mjs';
|
|
4
|
-
import { q as DeploymentElement, u as DeploymentRelationship, O as Element, Z as ModelRelation, a8 as Participant, M as ModelFqnExpr, a as ModelRelationExpr, aZ as AnyViewRuleStyle, b2 as AutoLayoutDirection, E as Expression, aF as ParsedView, bt as ParsedDeploymentView, bJ as ParsedElementView, k as ParsedLikeC4ModelData, ar as ElementShape, ay as ThemeColor, ap as BorderStyle, an as ShapeSize, al as SpacingSize, am as TextSize, aw as RelationshipArrowType, av as RelationshipLineType, _ as ElementSpecification$1, a1 as RelationshipSpecification, $ as TagSpecification } from '../shared/core.
|
|
5
|
-
import { b as Aux, S as SpecAux, A as Any } from '../shared/core.
|
|
4
|
+
import { q as DeploymentElement, u as DeploymentRelationship, O as Element, Z as ModelRelation, a8 as Participant, M as ModelFqnExpr, a as ModelRelationExpr, aZ as AnyViewRuleStyle, b2 as AutoLayoutDirection, E as Expression, aF as ParsedView, bt as ParsedDeploymentView, bJ as ParsedElementView, k as ParsedLikeC4ModelData, ar as ElementShape, ay as ThemeColor, ap as BorderStyle, an as ShapeSize, al as SpacingSize, am as TextSize, aw as RelationshipArrowType, av as RelationshipLineType, _ as ElementSpecification$1, a1 as RelationshipSpecification, $ as TagSpecification } from '../shared/core.Bdz6fBF1.mjs';
|
|
5
|
+
import { b as Aux, S as SpecAux, A as Any } from '../shared/core.CBxTtXMi.mjs';
|
|
6
6
|
import '../shared/core.CywrQs86.mjs';
|
|
7
7
|
|
|
8
8
|
type ToNested$1<T, Id extends string> = T extends TypesNested<infer P, any, any, any, any, any, any, any, infer F> ? TypesNested<`${P}.${Id}`, T['ElementKind'], T['Fqn'], T['ViewId'], T['RelationshipKind'], T['Tag'], T['MetadataKey'], T['DeploymentKind'], `${P}.${Id}` | F> : T extends AnyTypes ? TypesNested<Id, T['ElementKind'], T['Fqn'], T['ViewId'], T['RelationshipKind'], T['Tag'], T['MetadataKey'], T['DeploymentKind'], Id | T['DeploymentFqn']> : never;
|
|
@@ -579,7 +579,9 @@ type BuilderSpecification = {
|
|
|
579
579
|
};
|
|
580
580
|
metadataKeys?: string[];
|
|
581
581
|
};
|
|
582
|
-
type Metadata<MetadataKey extends string> =
|
|
582
|
+
type Metadata<MetadataKey extends string> = IsNever<MetadataKey> extends true ? never : IsLiteral<MetadataKey> extends true ? {
|
|
583
|
+
[key in MetadataKey]?: string;
|
|
584
|
+
} : Record<string, string>;
|
|
583
585
|
type NewElementProps<Tag, Metadata> = {
|
|
584
586
|
title?: string;
|
|
585
587
|
description?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as Any } from '../shared/core.
|
|
2
|
-
import { L as LikeC4Model } from '../shared/core.
|
|
3
|
-
import { k as ParsedLikeC4ModelData, l as ComputedLikeC4ModelData, aF as ParsedView, aI as ComputedView } from '../shared/core.
|
|
1
|
+
import { A as Any } from '../shared/core.CBxTtXMi.mjs';
|
|
2
|
+
import { L as LikeC4Model } from '../shared/core.DaAyklhe.mjs';
|
|
3
|
+
import { k as ParsedLikeC4ModelData, l as ComputedLikeC4ModelData, aF as ParsedView, aI as ComputedView } from '../shared/core.Bdz6fBF1.mjs';
|
|
4
4
|
import 'type-fest';
|
|
5
5
|
import '../shared/core.BuO4ncfY.mjs';
|
|
6
6
|
import '../shared/core.CywrQs86.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as Any, U as Unknown, g as ElementId, V as ViewId } from '../../shared/core.
|
|
2
|
-
import { E as ElementModel, R as RelationshipModel, L as LikeC4Model } from '../../shared/core.
|
|
1
|
+
import { A as Any, U as Unknown, g as ElementId, V as ViewId } from '../../shared/core.CBxTtXMi.mjs';
|
|
2
|
+
import { E as ElementModel, R as RelationshipModel, L as LikeC4Model } from '../../shared/core.DaAyklhe.mjs';
|
|
3
3
|
import 'type-fest';
|
|
4
4
|
import '../../shared/core.BuO4ncfY.mjs';
|
|
5
5
|
import '../../shared/core.CywrQs86.mjs';
|
|
6
|
-
import '../../shared/core.
|
|
6
|
+
import '../../shared/core.Bdz6fBF1.mjs';
|
|
7
7
|
|
|
8
8
|
type RelationshipsViewData<M extends Any = Unknown> = {
|
|
9
9
|
incomers: ReadonlySet<ElementModel<M>>;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as ColorLiteral, T as ThemeColorValues, L as LikeC4Theme } from './shared/core.
|
|
2
|
-
export { W as AbstractRelationship, ad as AndOperator, aY as AnyExcludePredicate, aX as AnyIncludePredicate, aK as AnyView, aZ as AnyViewRuleStyle, b2 as AutoLayoutDirection, y as AuxFromDump, A as AuxFromLikeC4ModelData, B as BBox, ba as BaseParsedViewProperties, b9 as BaseViewProperties, ap as BorderStyle, ao as BorderStyles, az as Color, bh as ComputedDeploymentView, bi as ComputedDynamicView, bf as ComputedEdge, bg as ComputedElementView, l as ComputedLikeC4ModelData, be as ComputedNode, aI as ComputedView, at as CustomColor, au as CustomColorDefinitions, U as DefaultArrowType, H as DefaultElementShape, Q as DefaultLineStyle, J as DefaultPaddingSize, V as DefaultRelationshipColor, I as DefaultShapeSize, K as DefaultTextSize, z as DefaultThemeColor, p as DeployedInstance, q as DeploymentElement, r as DeploymentElementRef, D as DeploymentElementStyle, o as DeploymentNode, v as DeploymentRelation, u as DeploymentRelationship, bp as DeploymentViewExcludePredicate, bo as DeploymentViewIncludePredicate, bq as DeploymentViewPredicate, bs as DeploymentViewRule, br as DeploymentViewRuleStyle, bk as DiagramEdge, bj as DiagramNode, aG as DiagramView, by as DynamicViewIncludeRule, bv as DynamicViewParallelSteps, bz as DynamicViewRule, bu as DynamicViewStep, bx as DynamicViewStepOrParallel, O as Element, ar as ElementShape, aq as ElementShapes, _ as ElementSpecification, N as ElementStyle, aB as ElementThemeColorValues, aC as ElementThemeColors, bD as ElementViewExcludePredicate, bC as ElementViewIncludePredicate, bE as ElementViewPredicate, bI as ElementViewRule, bF as ElementViewRuleGroup, bH as ElementViewRuleStyle, a3 as EqualOperator, E as Expression, ai as Filterable, F as FqnExpr, c as FqnRef, g as GlobalDynamicPredicates, G as GlobalPredicateId, f as GlobalPredicates, h as GlobalStyleID, i as GlobalStyles, as as HexColor, a6 as KindEqual, bm as LayoutedDeploymentView, bn as LayoutedDynamicView, bl as LayoutedElementView, m as LayoutedLikeC4ModelData, aG as LayoutedView, n as LikeC4ModelData, x as LikeC4ModelDump, aF as LikeC4View, b as ModelExpression, M as ModelFqnExpr, j as ModelGlobals, Z as ModelRelation, a as ModelRelationExpr, bb as NodeNotation, ab as NotOperator, aj as OperatorPredicate, af as OrOperator, bt as ParsedDeploymentView, bA as ParsedDynamicView, bJ as ParsedElementView, k as ParsedLikeC4ModelData, aF as ParsedView, a8 as Participant, a9 as ParticipantOperator, d as Point, P as PredicateSelector, aJ as ProcessedView, e as RectBox, R as RelationExpr, Y as Relationship, aw as RelationshipArrowType, av as RelationshipLineType, a1 as RelationshipSpecification, aD as RelationshipThemeColorValues, aE as RelationshipThemeColors, an as ShapeSize, al as SpacingSize, w as SpecTypesFromDump, a2 as Specification, S as SpecificationDump, a4 as TagEqual, $ as TagSpecification, am as TextSize, ay as ThemeColor, ax as ThemeColors, b6 as ViewAutoLayout, b7 as ViewManualLayout, aL as ViewOnStage, aN as ViewRule, b4 as ViewRuleAutoLayout, b0 as ViewRuleGlobalPredicateRef, a_ as ViewRuleGlobalStyle, aO as ViewRulePredicate, b8 as ViewType, bd as ViewWithHash, bc as ViewWithNotation, aM as ViewWithType, ah as WhereOperator, X as XYPoint, bw as getParallelStepsPrefix, ae as isAndOperator, b3 as isAutoLayoutDirection, aR as isComputedView, t as isDeployedInstance, s as isDeploymentNode, aV as isDeploymentView, aH as isDiagramView, aW as isDynamicView, bB as isDynamicViewParallelSteps, aS as isElementView, aU as isExtendsElementView, a7 as isKindEqual, aH as isLayoutedView, ac as isNotOperator, ag as isOrOperator, aa as isParticipantOperator, aT as isScopedElementView, a0 as isTagColorSpecified, a5 as isTagEqual, aA as isThemeColor, b5 as isViewRuleAutoLayout, b1 as isViewRuleGlobalPredicateRef, a$ as isViewRuleGlobalStyle, bG as isViewRuleGroup, aP as isViewRulePredicate, aQ as isViewRuleStyle, ak as whereOperatorAsPredicate } from './shared/core.
|
|
3
|
-
export { BiMap, DefaultWeakMap, LinkedList, MultiMap, Queue, Stack, commonHead, compareNatural, compareNaturalHierarchically, compareRelations, delay, difference, equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, ihead, imap, intersection, invariant, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, memoizeProp, nonNullable, nonexhaustive, objectHash, stringHash, symmetricDifference, toArray, toSet, union } from './utils/index.mjs';
|
|
1
|
+
import { C as ColorLiteral, T as ThemeColorValues, L as LikeC4Theme } from './shared/core.Bdz6fBF1.mjs';
|
|
2
|
+
export { W as AbstractRelationship, ad as AndOperator, aY as AnyExcludePredicate, aX as AnyIncludePredicate, aK as AnyView, aZ as AnyViewRuleStyle, b2 as AutoLayoutDirection, y as AuxFromDump, A as AuxFromLikeC4ModelData, B as BBox, ba as BaseParsedViewProperties, b9 as BaseViewProperties, ap as BorderStyle, ao as BorderStyles, az as Color, bh as ComputedDeploymentView, bi as ComputedDynamicView, bf as ComputedEdge, bg as ComputedElementView, l as ComputedLikeC4ModelData, be as ComputedNode, aI as ComputedView, at as CustomColor, au as CustomColorDefinitions, U as DefaultArrowType, H as DefaultElementShape, Q as DefaultLineStyle, J as DefaultPaddingSize, V as DefaultRelationshipColor, I as DefaultShapeSize, K as DefaultTextSize, z as DefaultThemeColor, p as DeployedInstance, q as DeploymentElement, r as DeploymentElementRef, D as DeploymentElementStyle, o as DeploymentNode, v as DeploymentRelation, u as DeploymentRelationship, bp as DeploymentViewExcludePredicate, bo as DeploymentViewIncludePredicate, bq as DeploymentViewPredicate, bs as DeploymentViewRule, br as DeploymentViewRuleStyle, bk as DiagramEdge, bj as DiagramNode, aG as DiagramView, by as DynamicViewIncludeRule, bv as DynamicViewParallelSteps, bz as DynamicViewRule, bu as DynamicViewStep, bx as DynamicViewStepOrParallel, O as Element, ar as ElementShape, aq as ElementShapes, _ as ElementSpecification, N as ElementStyle, aB as ElementThemeColorValues, aC as ElementThemeColors, bD as ElementViewExcludePredicate, bC as ElementViewIncludePredicate, bE as ElementViewPredicate, bI as ElementViewRule, bF as ElementViewRuleGroup, bH as ElementViewRuleStyle, a3 as EqualOperator, E as Expression, ai as Filterable, F as FqnExpr, c as FqnRef, g as GlobalDynamicPredicates, G as GlobalPredicateId, f as GlobalPredicates, h as GlobalStyleID, i as GlobalStyles, as as HexColor, a6 as KindEqual, bm as LayoutedDeploymentView, bn as LayoutedDynamicView, bl as LayoutedElementView, m as LayoutedLikeC4ModelData, aG as LayoutedView, n as LikeC4ModelData, x as LikeC4ModelDump, aF as LikeC4View, b as ModelExpression, M as ModelFqnExpr, j as ModelGlobals, Z as ModelRelation, a as ModelRelationExpr, bb as NodeNotation, ab as NotOperator, aj as OperatorPredicate, af as OrOperator, bt as ParsedDeploymentView, bA as ParsedDynamicView, bJ as ParsedElementView, k as ParsedLikeC4ModelData, aF as ParsedView, a8 as Participant, a9 as ParticipantOperator, d as Point, P as PredicateSelector, aJ as ProcessedView, e as RectBox, R as RelationExpr, Y as Relationship, aw as RelationshipArrowType, av as RelationshipLineType, a1 as RelationshipSpecification, aD as RelationshipThemeColorValues, aE as RelationshipThemeColors, an as ShapeSize, al as SpacingSize, w as SpecTypesFromDump, a2 as Specification, S as SpecificationDump, a4 as TagEqual, $ as TagSpecification, am as TextSize, ay as ThemeColor, ax as ThemeColors, b6 as ViewAutoLayout, b7 as ViewManualLayout, aL as ViewOnStage, aN as ViewRule, b4 as ViewRuleAutoLayout, b0 as ViewRuleGlobalPredicateRef, a_ as ViewRuleGlobalStyle, aO as ViewRulePredicate, b8 as ViewType, bd as ViewWithHash, bc as ViewWithNotation, aM as ViewWithType, ah as WhereOperator, X as XYPoint, bw as getParallelStepsPrefix, ae as isAndOperator, b3 as isAutoLayoutDirection, aR as isComputedView, t as isDeployedInstance, s as isDeploymentNode, aV as isDeploymentView, aH as isDiagramView, aW as isDynamicView, bB as isDynamicViewParallelSteps, aS as isElementView, aU as isExtendsElementView, a7 as isKindEqual, aH as isLayoutedView, ac as isNotOperator, ag as isOrOperator, aa as isParticipantOperator, aT as isScopedElementView, a0 as isTagColorSpecified, a5 as isTagEqual, aA as isThemeColor, b5 as isViewRuleAutoLayout, b1 as isViewRuleGlobalPredicateRef, a$ as isViewRuleGlobalStyle, bG as isViewRuleGroup, aP as isViewRulePredicate, aQ as isViewRuleStyle, ak as whereOperatorAsPredicate } from './shared/core.Bdz6fBF1.mjs';
|
|
3
|
+
export { BiMap, DefaultWeakMap, LinkedList, MultiMap, Queue, Stack, commonHead, compareNatural, compareNaturalHierarchically, compareRelations, delay, difference, equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, ihead, imap, intersection, invariant, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, memoizeProp, nonNullable, nonexhaustive, objectHash, promiseNextTick, stringHash, symmetricDifference, toArray, toSet, union } from './utils/index.mjs';
|
|
4
4
|
export { D as DefaultMap } from './shared/core.CywrQs86.mjs';
|
|
5
|
-
export { A as Any, A as AnyAux, b as Aux, E as ExtractOnStage, M as ModelStage, S as SpecAux, U as Unknown, c as UnknownComputed, d as UnknownLayouted, e as UnknownParsed, _ as _stage, f as _type, a as aux, i as isOnStage } from './shared/core.
|
|
5
|
+
export { A as Any, A as AnyAux, b as Aux, E as ExtractOnStage, M as ModelStage, S as SpecAux, U as Unknown, c as UnknownComputed, d as UnknownLayouted, e as UnknownParsed, _ as _stage, f as _type, a as aux, i as isOnStage } from './shared/core.CBxTtXMi.mjs';
|
|
6
6
|
export { A as AnyFqn, B as BuiltInIcon, C as Coalesce, D as DeploymentFqn, b as DeploymentKind, E as EdgeId, a as ElementKind, f as ExclusiveUnion, F as Fqn, m as GlobalFqn, G as GroupElementKind, i as Icon, j as IconUrl, I as IteratorLike, K as KeysOf, L as Link, g as NTuple, N as NodeId, d as NonEmptyArray, e as NonEmptyReadonlyArray, h as Predicate, P as ProjectId, R as RelationId, l as RelationKind, c as RelationshipKind, p as StepEdgeId, S as StepEdgeIdLiteral, r as StepEdgeKind, T as Tag, V as ViewId, u as extractStep, n as isGlobalFqn, k as isGroupElementKind, t as isStepEdgeId, s as scalar, o as splitGlobalFqn, q as stepEdgeId } from './shared/core.BuO4ncfY.mjs';
|
|
7
7
|
export { ViewChange } from './types/index.mjs';
|
|
8
8
|
export { I as IterableContainer, R as ReorderedArray, a as ancestorsFqn, c as commonAncestor, b as compareByFqnHierarchically, d as compareFqnHierarchically, h as hierarchyDistance, e as hierarchyLevel, i as isAncestor, f as isDescendantOf, g as isSameHierarchy, n as nameFromFqn, p as parentFqn, s as sortByFqnHierarchically, j as sortNaturalByFqn, k as sortParentsFirst } from './shared/core.Pf5I9o0e.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { f as DefaultArrowType, D as DefaultElementShape, g as DefaultLineStyle, m as DefaultPaddingSize, h as DefaultRelationshipColor, l as DefaultShapeSize, p as DefaultTextSize, a as DefaultThemeColor, A as DeploymentFqn, H as EdgeId, z as Fqn, F as FqnRef, B as GlobalFqn, G as GroupElementKind, N as NodeId, R as RelationId, S as StepEdgeKind, V as ViewId, b as _stage, _ as _type, I as extractStep, v as isAndOperator, i as isDeployedInstance, k as isDeploymentNode, C as isGlobalFqn, e as isGroupElementKind, r as isKindEqual, u as isNotOperator, j as isOnStage, x as isOrOperator, t as isParticipantOperator, d as isStepEdgeId, q as isTagEqual, E as splitGlobalFqn, s as stepEdgeId, w as whereOperatorAsPredicate } from './shared/core.CUYDgv2-.mjs';
|
|
2
2
|
export { E as Expression, F as FqnExpr, k as ModelExpression, M as ModelFqnExpr, j as ModelRelationExpr, R as RelationExpr, s as getParallelStepsPrefix, r as isAutoLayoutDirection, n as isComputedView, m as isDeploymentView, p as isDiagramView, l as isDynamicView, h as isDynamicViewParallelSteps, a as isElementView, i as isExtendsElementView, p as isLayoutedView, q as isScopedElementView, d as isViewRuleAutoLayout, f as isViewRuleGlobalPredicateRef, g as isViewRuleGlobalStyle, e as isViewRuleGroup, c as isViewRulePredicate, b as isViewRuleStyle } from './shared/core.Bk7wEZFG.mjs';
|
|
3
3
|
export { BBox, BorderStyles, ElementShapes, RectBox, ThemeColors, isTagColorSpecified, isThemeColor } from './types/index.mjs';
|
|
4
|
-
export { BiMap, DefaultWeakMap, LinkedList, MultiMap, Queue, compareRelations, delay, ireduce } from './utils/index.mjs';
|
|
4
|
+
export { BiMap, DefaultWeakMap, LinkedList, MultiMap, Queue, compareRelations, delay, ireduce, promiseNextTick } from './utils/index.mjs';
|
|
5
5
|
export { D as DefaultMap, l as ancestorsFqn, k as commonAncestor, h as compareByFqnHierarchically, q as compareFqnHierarchically, m as compareNatural, o as compareNaturalHierarchically, r as hierarchyDistance, u as hierarchyLevel, b as ifilter, a as isAncestor, i as isDescendantOf, c as isNonEmptyArray, d as isSameHierarchy, w as isString, n as nameFromFqn, p as parentFqn, j as sortByFqnHierarchically, v as sortNaturalByFqn, s as sortParentsFirst } from './shared/core.rmvsy0n3.mjs';
|
|
6
6
|
export { S as Stack, c as commonHead, e as iflat, i as isIterable, b as iunique, o as objectHash } from './shared/core.CpXlRyE5.mjs';
|
|
7
7
|
export { i as invariant, n as nonNullable, a as nonexhaustive } from './shared/core.Cy9smucx.mjs';
|
package/dist/model/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { E as ElementModel, D as DeploymentElementModel, a as RelationshipsAccum, b as DeploymentNodeModel, R as RelationshipModel, c as DeploymentRelationModel, d as DeployedInstanceModel, A as AnyRelationshipModel, N as NestedElementOfDeployedInstanceModel, e as LikeC4ViewModel, f as NodeModel, g as EdgeModel } from '../shared/core.
|
|
2
|
-
export { h as AnyLikeC4Model, k as DeploymentOrFqn, i as DeploymentRelationEndpoint, l as EdgeOrId, m as ElementOrFqn, I as IncomingFilter, j as LikeC4DeploymentModel, L as LikeC4Model, n as NodeOrId, O as OutgoingFilter } from '../shared/core.
|
|
3
|
-
import { A as Any, h as EdgeId, U as Unknown } from '../shared/core.
|
|
4
|
-
export { b as Aux, S as SpecAux, a as aux } from '../shared/core.
|
|
1
|
+
import { E as ElementModel, D as DeploymentElementModel, a as RelationshipsAccum, b as DeploymentNodeModel, R as RelationshipModel, c as DeploymentRelationModel, d as DeployedInstanceModel, A as AnyRelationshipModel, N as NestedElementOfDeployedInstanceModel, e as LikeC4ViewModel, f as NodeModel, g as EdgeModel } from '../shared/core.DaAyklhe.mjs';
|
|
2
|
+
export { h as AnyLikeC4Model, k as DeploymentOrFqn, i as DeploymentRelationEndpoint, l as EdgeOrId, m as ElementOrFqn, I as IncomingFilter, j as LikeC4DeploymentModel, L as LikeC4Model, n as NodeOrId, O as OutgoingFilter, W as WithMetadata, o as WithTags } from '../shared/core.DaAyklhe.mjs';
|
|
3
|
+
import { A as Any, h as EdgeId, U as Unknown } from '../shared/core.CBxTtXMi.mjs';
|
|
4
|
+
export { b as Aux, S as SpecAux, a as aux } from '../shared/core.CBxTtXMi.mjs';
|
|
5
5
|
import { F as Fqn, I as IteratorLike } from '../shared/core.BuO4ncfY.mjs';
|
|
6
6
|
import { I as IterableContainer, R as ReorderedArray } from '../shared/core.Pf5I9o0e.mjs';
|
|
7
|
-
export { y as AuxFromDump, A as AuxFromLikeC4ModelData } from '../shared/core.
|
|
7
|
+
export { y as AuxFromDump, A as AuxFromLikeC4ModelData } from '../shared/core.Bdz6fBF1.mjs';
|
|
8
8
|
import '../shared/core.CywrQs86.mjs';
|
|
9
9
|
import 'type-fest';
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TupleToUnion, Tagged, Simplify, MergeExclusive, NonEmptyTuple, IsNever, IsAny } from 'type-fest';
|
|
2
2
|
import { f as ExclusiveUnion, d as NonEmptyArray, i as Icon, L as Link, R as RelationId, T as Tag$1, N as NodeId, E as EdgeId, r as StepEdgeKind, K as KeysOf } from './core.BuO4ncfY.mjs';
|
|
3
|
-
import { A as Any, U as Unknown, g as ElementId, P as ProjectId, F as Fqn, u as DeploymentId, v as Tag, y as AllKinds, T as Tags, n as StrictViewId, l as ElementKind, W as WithOptionalTags, z as WithOptionalLinks, _ as _stage, f as _type, B as WithMetadata, j as Metadata, R as RelationKind, V as ViewId, q as DeploymentFqn, D as DeploymentKind, k as MetadataKey, E as ExtractOnStage, M as ModelStage, e as UnknownParsed, c as UnknownComputed, d as UnknownLayouted, S as SpecAux, b as Aux, N as Never } from './core.
|
|
3
|
+
import { A as Any, U as Unknown, g as ElementId, P as ProjectId, F as Fqn, u as DeploymentId, v as Tag, y as AllKinds, T as Tags, n as StrictViewId, l as ElementKind, W as WithOptionalTags, z as WithOptionalLinks, _ as _stage, f as _type, B as WithMetadata, j as Metadata, R as RelationKind, V as ViewId, q as DeploymentFqn, D as DeploymentKind, k as MetadataKey, E as ExtractOnStage, M as ModelStage, e as UnknownParsed, c as UnknownComputed, d as UnknownLayouted, S as SpecAux, b as Aux, N as Never } from './core.CBxTtXMi.mjs';
|
|
4
4
|
|
|
5
5
|
declare namespace FqnRef {
|
|
6
6
|
/**
|
|
@@ -118,8 +118,7 @@ type BorderStyle = TupleToUnion<typeof BorderStyles>;
|
|
|
118
118
|
declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue"];
|
|
119
119
|
type ElementShape = TupleToUnion<typeof ElementShapes>;
|
|
120
120
|
type HexColor = `#${string}`;
|
|
121
|
-
type
|
|
122
|
-
type ColorLiteral = HexColor | `rgb(${number}${Comma}${number}${Comma}${number})` | `rgba(${number}${Comma}${number}${Comma}${number}${Comma}${number})`;
|
|
121
|
+
type ColorLiteral = HexColor | `rgb(${number},${number},${number})` | `rgba(${number},${number},${number},${number})`;
|
|
123
122
|
type CustomColor<T = string> = Tagged<T, 'CustomColor'>;
|
|
124
123
|
type CustomColorDefinitions = {
|
|
125
124
|
[key: string]: ThemeColorValues;
|
|
@@ -132,21 +131,21 @@ type ThemeColor = typeof ThemeColors[number];
|
|
|
132
131
|
* Backward compatibility alias
|
|
133
132
|
* @deprecated Use {@link ThemeColor} instead
|
|
134
133
|
*/
|
|
135
|
-
type Color = ThemeColor |
|
|
134
|
+
type Color = ThemeColor | ColorLiteral;
|
|
136
135
|
declare function isThemeColor(color: string): color is ThemeColor;
|
|
137
136
|
interface ElementThemeColorValues {
|
|
138
|
-
fill:
|
|
139
|
-
stroke:
|
|
140
|
-
hiContrast:
|
|
141
|
-
loContrast:
|
|
137
|
+
fill: ColorLiteral;
|
|
138
|
+
stroke: ColorLiteral;
|
|
139
|
+
hiContrast: ColorLiteral;
|
|
140
|
+
loContrast: ColorLiteral;
|
|
142
141
|
}
|
|
143
142
|
type ElementThemeColors = {
|
|
144
143
|
[key in ThemeColor]: ElementThemeColorValues;
|
|
145
144
|
};
|
|
146
145
|
interface RelationshipThemeColorValues {
|
|
147
|
-
lineColor:
|
|
148
|
-
labelBgColor:
|
|
149
|
-
labelColor:
|
|
146
|
+
lineColor: ColorLiteral;
|
|
147
|
+
labelBgColor: ColorLiteral;
|
|
148
|
+
labelColor: ColorLiteral;
|
|
150
149
|
}
|
|
151
150
|
interface ThemeColorValues {
|
|
152
151
|
elements: ElementThemeColorValues;
|
|
@@ -153,7 +153,7 @@ type MetadataKey<A> = A extends infer T extends Any ? Coalesce<T['MetadataKey']>
|
|
|
153
153
|
* Metadata object from Aux
|
|
154
154
|
*/
|
|
155
155
|
type Metadata<A extends Any> = IsNever<A['MetadataKey']> extends true ? never : IsLiteral<A['MetadataKey']> extends true ? {
|
|
156
|
-
[key in
|
|
156
|
+
[key in A['MetadataKey']]?: string;
|
|
157
157
|
} : Record<string, string>;
|
|
158
158
|
/**
|
|
159
159
|
* All known kinds from Aux as a literal union.
|
|
@@ -1,32 +1,28 @@
|
|
|
1
|
-
import { A as Any,
|
|
1
|
+
import { A as Any, R as RelationKind, T as Tags, j as Metadata, k as MetadataKey, L as LooseTag, F as Fqn, g as ElementId, l as ElementKind, D as DeploymentKind, E as ExtractOnStage, m as RelationId$1, f as _type, n as StrictViewId, o as LooseElementId, p as LooseDeploymentId, q as DeploymentFqn, t as toComputed, r as toLayouted, s as Stage, u as DeploymentId, U as Unknown, V as ViewId, v as Tag, w as toParsed, P as ProjectId$1, x as LooseViewId, b as Aux, S as SpecAux, e as UnknownParsed, c as UnknownComputed, d as UnknownLayouted } from './core.CBxTtXMi.mjs';
|
|
2
2
|
import { D as DefaultMap } from './core.CywrQs86.mjs';
|
|
3
3
|
import { SetRequired } from 'type-fest';
|
|
4
|
-
import { az as Color, av as RelationshipLineType, Y as Relationship, O as Element, ar as ElementShape, N as ElementStyle, aM as ViewWithType, aI as ComputedView, aG as LayoutedView, k as ParsedLikeC4ModelData, l as ComputedLikeC4ModelData, m as LayoutedLikeC4ModelData, b8 as ViewType, c as FqnRef, p as DeployedInstance, D as DeploymentElementStyle, u as DeploymentRelationship, q as DeploymentElement, o as DeploymentNode, x as LikeC4ModelDump, y as AuxFromDump, a2 as Specification, j as ModelGlobals, ah as WhereOperator } from './core.Dpq3P3YJ.mjs';
|
|
5
4
|
import { I as IteratorLike, R as RelationId, L as Link, P as ProjectId, j as IconUrl, N as NodeId, G as GroupElementKind, E as EdgeId, p as StepEdgeId, V as ViewId$1 } from './core.BuO4ncfY.mjs';
|
|
5
|
+
import { az as Color, av as RelationshipLineType, Y as Relationship, O as Element, ar as ElementShape, N as ElementStyle, aM as ViewWithType, aI as ComputedView, aG as LayoutedView, k as ParsedLikeC4ModelData, l as ComputedLikeC4ModelData, m as LayoutedLikeC4ModelData, c as FqnRef, p as DeployedInstance, D as DeploymentElementStyle, u as DeploymentRelationship, q as DeploymentElement, o as DeploymentNode, x as LikeC4ModelDump, y as AuxFromDump, a2 as Specification, j as ModelGlobals, ah as WhereOperator } from './core.Bdz6fBF1.mjs';
|
|
6
6
|
|
|
7
7
|
type RelationshipsIterator<A extends Any> = IteratorLike<RelationshipModel<A>>;
|
|
8
8
|
/**
|
|
9
9
|
* A relationship between two elements (in logical or deployment model)
|
|
10
10
|
* use {@link isDeploymentRelationModel} guard to check if the relationship is a deployment relationship
|
|
11
11
|
*/
|
|
12
|
-
interface AnyRelationshipModel<A extends Any> {
|
|
12
|
+
interface AnyRelationshipModel<A extends Any> extends WithTags<A>, WithMetadata<A> {
|
|
13
13
|
get id(): RelationId;
|
|
14
14
|
get expression(): string;
|
|
15
15
|
get title(): string | null;
|
|
16
16
|
get technology(): string | null;
|
|
17
17
|
get description(): string | null;
|
|
18
18
|
get navigateTo(): LikeC4ViewModel<A> | null;
|
|
19
|
-
get tags(): Tags<A>;
|
|
20
19
|
get kind(): RelationKind<A> | null;
|
|
21
20
|
get links(): ReadonlyArray<Link>;
|
|
22
21
|
get color(): Color;
|
|
23
22
|
get line(): RelationshipLineType;
|
|
24
23
|
isDeploymentRelation(): this is DeploymentRelationModel<A>;
|
|
25
24
|
isModelRelation(): this is RelationshipModel<A>;
|
|
26
|
-
getMetadata(): Metadata<A>;
|
|
27
|
-
getMetadata(field: MetadataKey<A>): string | undefined;
|
|
28
25
|
views(): ViewsIterator<A>;
|
|
29
|
-
isTagged(tag: LooseTag<A>): boolean;
|
|
30
26
|
}
|
|
31
27
|
declare class RelationshipModel<A extends Any = Any> implements AnyRelationshipModel<A> {
|
|
32
28
|
readonly model: LikeC4Model<A>;
|
|
@@ -65,7 +61,7 @@ declare class RelationshipModel<A extends Any = Any> implements AnyRelationshipM
|
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
type ElementsIterator<M extends Any> = IteratorLike<ElementModel<M>>;
|
|
68
|
-
declare class ElementModel<A extends Any = Any> {
|
|
64
|
+
declare class ElementModel<A extends Any = Any> implements WithTags<A>, WithMetadata<A> {
|
|
69
65
|
readonly $model: LikeC4Model<A>;
|
|
70
66
|
readonly $element: Element<A>;
|
|
71
67
|
readonly id: Fqn<A>;
|
|
@@ -90,9 +86,7 @@ declare class ElementModel<A extends Any = Any> {
|
|
|
90
86
|
get description(): string | null;
|
|
91
87
|
get technology(): string | null;
|
|
92
88
|
get links(): ReadonlyArray<Link>;
|
|
93
|
-
get defaultView(): LikeC4ViewModel<A
|
|
94
|
-
viewOf: Fqn<A>;
|
|
95
|
-
}> | null;
|
|
89
|
+
get defaultView(): LikeC4ViewModel.ScopedElementView<A> | null;
|
|
96
90
|
get isRoot(): boolean;
|
|
97
91
|
get style(): SetRequired<ElementStyle, 'size'>;
|
|
98
92
|
isAncestorOf(another: ElementModel<A>): boolean;
|
|
@@ -139,9 +133,7 @@ declare class ElementModel<A extends Any = Any> {
|
|
|
139
133
|
* Iterate over all views that scope this element.
|
|
140
134
|
* It is possible that element is not included in the view.
|
|
141
135
|
*/
|
|
142
|
-
scopedViews(): ReadonlySet<LikeC4ViewModel<A
|
|
143
|
-
viewOf: Fqn<A>;
|
|
144
|
-
}>>;
|
|
136
|
+
scopedViews(): ReadonlySet<LikeC4ViewModel.ScopedElementView<A>>;
|
|
145
137
|
/**
|
|
146
138
|
* @returns true if the element is deployed
|
|
147
139
|
*/
|
|
@@ -156,7 +148,7 @@ declare class ElementModel<A extends Any = Any> {
|
|
|
156
148
|
}
|
|
157
149
|
|
|
158
150
|
type NodesIterator<M extends Any, V extends $View<M>> = IteratorLike<NodeModel<M, V>>;
|
|
159
|
-
declare class NodeModel<A extends Any = Any, V extends $View<A> = $View<A>> {
|
|
151
|
+
declare class NodeModel<A extends Any = Any, V extends $View<A> = $View<A>> implements WithTags<A> {
|
|
160
152
|
#private;
|
|
161
153
|
readonly $view: LikeC4ViewModel<A, V>;
|
|
162
154
|
readonly $node: V['nodes'][number];
|
|
@@ -234,7 +226,7 @@ declare namespace NodeModel {
|
|
|
234
226
|
}
|
|
235
227
|
|
|
236
228
|
type EdgesIterator<A extends Any, V extends $View<A>> = IteratorLike<EdgeModel<A, V>>;
|
|
237
|
-
declare class EdgeModel<A extends Any = Any, View extends $View<A> = $View<A>> {
|
|
229
|
+
declare class EdgeModel<A extends Any = Any, View extends $View<A> = $View<A>> implements WithTags<A> {
|
|
238
230
|
#private;
|
|
239
231
|
readonly view: LikeC4ViewModel<A, View>;
|
|
240
232
|
readonly $edge: View['edges'][number];
|
|
@@ -272,7 +264,7 @@ declare namespace EdgeModel {
|
|
|
272
264
|
}
|
|
273
265
|
|
|
274
266
|
type ViewsIterator<A extends Any, V extends $View<A> = $View<A>> = IteratorLike<LikeC4ViewModel<A, V>>;
|
|
275
|
-
declare class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>> {
|
|
267
|
+
declare class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>> implements WithTags<A> {
|
|
276
268
|
#private;
|
|
277
269
|
/**
|
|
278
270
|
* Don't use in runtime, only for type inference
|
|
@@ -350,14 +342,14 @@ declare class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>
|
|
|
350
342
|
isComputed(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel<toComputed<A>>;
|
|
351
343
|
isDiagram(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel<toLayouted<A>>;
|
|
352
344
|
isElementView(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel.ElementView<A, V>;
|
|
353
|
-
isScopedElementView(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel.ScopedElementView<A
|
|
345
|
+
isScopedElementView(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel.ScopedElementView<A>;
|
|
354
346
|
isDeploymentView(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel.DeploymentView<A, V>;
|
|
355
347
|
isDynamicView(this: LikeC4ViewModel<any, any>): this is LikeC4ViewModel.DynamicView<A, V>;
|
|
356
348
|
}
|
|
357
349
|
declare namespace LikeC4ViewModel {
|
|
358
350
|
interface ElementView<A extends Any, V extends $View<A> = $View<A>> extends LikeC4ViewModel<A, ViewWithType<V, 'element'>> {
|
|
359
351
|
}
|
|
360
|
-
interface ScopedElementView<A extends Any
|
|
352
|
+
interface ScopedElementView<A extends Any> extends LikeC4ViewModel<A, ViewWithType<$View<A>, 'element'> & {
|
|
361
353
|
viewOf: Fqn<A>;
|
|
362
354
|
}> {
|
|
363
355
|
viewOf: ElementModel<A>;
|
|
@@ -390,7 +382,6 @@ type $View<A extends Any> = {
|
|
|
390
382
|
computed: ComputedView<A>;
|
|
391
383
|
layouted: LayoutedView<A>;
|
|
392
384
|
}[Stage<A>];
|
|
393
|
-
type $ViewWithType<A extends Any, V extends ViewType> = ViewWithType<$View<A>, V>;
|
|
394
385
|
type $ViewModel<A extends Any> = {
|
|
395
386
|
parsed: never;
|
|
396
387
|
computed: LikeC4ViewModel<A>;
|
|
@@ -401,6 +392,14 @@ type $ModelData<A extends Any> = {
|
|
|
401
392
|
computed: ComputedLikeC4ModelData<A>;
|
|
402
393
|
layouted: LayoutedLikeC4ModelData<A>;
|
|
403
394
|
}[Stage<A>];
|
|
395
|
+
interface WithTags<A extends Any> {
|
|
396
|
+
get tags(): Tags<A>;
|
|
397
|
+
isTagged(tag: LooseTag<A>): boolean;
|
|
398
|
+
}
|
|
399
|
+
interface WithMetadata<A extends Any> {
|
|
400
|
+
getMetadata(): Metadata<A>;
|
|
401
|
+
getMetadata(field: MetadataKey<A>): string | undefined;
|
|
402
|
+
}
|
|
404
403
|
|
|
405
404
|
declare class LikeC4DeploymentModel<A extends Any = Any> {
|
|
406
405
|
#private;
|
|
@@ -486,7 +485,7 @@ type DeploymentElementsIterator<A extends Any> = IteratorLike<DeploymentElementM
|
|
|
486
485
|
type DeployedInstancesIterator<A extends Any> = IteratorLike<DeployedInstanceModel<A>>;
|
|
487
486
|
type DeploymentNodesIterator<A extends Any> = IteratorLike<DeploymentNodeModel<A>>;
|
|
488
487
|
type DeploymentElementModel<A extends Any = Any> = DeploymentNodeModel<A> | DeployedInstanceModel<A>;
|
|
489
|
-
declare abstract class AbstractDeploymentElementModel<A extends Any> {
|
|
488
|
+
declare abstract class AbstractDeploymentElementModel<A extends Any> implements WithTags<A>, WithMetadata<A> {
|
|
490
489
|
abstract readonly id: DeploymentFqn<A>;
|
|
491
490
|
abstract readonly _literalId: DeploymentId<A>;
|
|
492
491
|
abstract readonly parent: DeploymentNodeModel<A> | null;
|
|
@@ -917,4 +916,4 @@ declare namespace LikeC4Model {
|
|
|
917
916
|
type AnyRelation<M = Unknown> = M extends Any ? RelationshipModel<M> | DeploymentRelationModel<M> : never;
|
|
918
917
|
}
|
|
919
918
|
|
|
920
|
-
export { type AnyRelationshipModel as A, type DeploymentElementModel as D, ElementModel as E, type IncomingFilter as I, LikeC4Model as L, NestedElementOfDeployedInstanceModel as N, type OutgoingFilter as O, RelationshipModel as R, RelationshipsAccum as a, DeploymentNodeModel as b, DeploymentRelationModel as c, DeployedInstanceModel as d, LikeC4ViewModel as e, NodeModel as f, EdgeModel as g, type AnyLikeC4Model as h, type DeploymentRelationEndpoint as i, LikeC4DeploymentModel as j, type DeploymentOrFqn as k, type EdgeOrId as l, type ElementOrFqn as m, type NodeOrId as n };
|
|
919
|
+
export { type AnyRelationshipModel as A, type DeploymentElementModel as D, ElementModel as E, type IncomingFilter as I, LikeC4Model as L, NestedElementOfDeployedInstanceModel as N, type OutgoingFilter as O, RelationshipModel as R, type WithMetadata as W, RelationshipsAccum as a, DeploymentNodeModel as b, DeploymentRelationModel as c, DeployedInstanceModel as d, LikeC4ViewModel as e, NodeModel as f, EdgeModel as g, type AnyLikeC4Model as h, type DeploymentRelationEndpoint as i, LikeC4DeploymentModel as j, type DeploymentOrFqn as k, type EdgeOrId as l, type ElementOrFqn as m, type NodeOrId as n, type WithTags as o };
|
package/dist/types/aux.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'type-fest';
|
|
2
2
|
import '../shared/core.BuO4ncfY.mjs';
|
|
3
|
-
export { y as AllKinds, A as Any, A as AnyAux, C as AnySpec, b as Aux, q as DeploymentFqn, u as DeploymentId, D as DeploymentKind, h as EdgeId, g as ElementId, l as ElementKind, F as Fqn, p as LooseDeploymentId, a3 as LooseDeploymentKind, o as LooseElementId, a2 as LooseElementKind, a4 as LooseRelationKind, L as LooseTag, a1 as LooseTags, x as LooseViewId, j as Metadata, k as MetadataKey, N as Never, I as NodeId, a0 as OrString, G as PickByStage, P as ProjectId, m as RelationId, R as RelationKind, J as Spec, S as SpecAux, s as Stage, q as StrictDeploymentFqn, X as StrictDeploymentKind, Q as StrictElementKind, F as StrictFqn, K as StrictProjectId, Y as StrictRelationKind, O as StrictTag, n as StrictViewId, v as Tag, T as Tags, U as Unknown, c as UnknownComputed, d as UnknownLayouted, e as UnknownParsed, V as ViewId, $ as WithLinks, B as WithMetadata, z as WithOptionalLinks, W as WithOptionalTags, Z as WithTags, H as setStage, t as toComputed, r as toLayouted, w as toParsed } from '../shared/core.
|
|
3
|
+
export { y as AllKinds, A as Any, A as AnyAux, C as AnySpec, b as Aux, q as DeploymentFqn, u as DeploymentId, D as DeploymentKind, h as EdgeId, g as ElementId, l as ElementKind, F as Fqn, p as LooseDeploymentId, a3 as LooseDeploymentKind, o as LooseElementId, a2 as LooseElementKind, a4 as LooseRelationKind, L as LooseTag, a1 as LooseTags, x as LooseViewId, j as Metadata, k as MetadataKey, N as Never, I as NodeId, a0 as OrString, G as PickByStage, P as ProjectId, m as RelationId, R as RelationKind, J as Spec, S as SpecAux, s as Stage, q as StrictDeploymentFqn, X as StrictDeploymentKind, Q as StrictElementKind, F as StrictFqn, K as StrictProjectId, Y as StrictRelationKind, O as StrictTag, n as StrictViewId, v as Tag, T as Tags, U as Unknown, c as UnknownComputed, d as UnknownLayouted, e as UnknownParsed, V as ViewId, $ as WithLinks, B as WithMetadata, z as WithOptionalLinks, W as WithOptionalTags, Z as WithTags, H as setStage, t as toComputed, r as toLayouted, w as toParsed } from '../shared/core.CBxTtXMi.mjs';
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { d as NonEmptyArray, F as Fqn, D as DeploymentFqn } from '../shared/core.BuO4ncfY.mjs';
|
|
2
2
|
export { A as AnyFqn, B as BuiltInIcon, C as Coalesce, b as DeploymentKind, E as EdgeId, a as ElementKind, f as ExclusiveUnion, m as GlobalFqn, G as GroupElementKind, i as Icon, j as IconUrl, I as IteratorLike, K as KeysOf, L as Link, g as NTuple, N as NodeId, e as NonEmptyReadonlyArray, h as Predicate, P as ProjectId, R as RelationId, l as RelationKind, c as RelationshipKind, p as StepEdgeId, S as StepEdgeIdLiteral, r as StepEdgeKind, T as Tag, V as ViewId, u as extractStep, n as isGlobalFqn, k as isGroupElementKind, t as isStepEdgeId, s as scalar, o as splitGlobalFqn, q as stepEdgeId } from '../shared/core.BuO4ncfY.mjs';
|
|
3
|
-
export { A as Any, A as AnyAux, b as Aux, E as ExtractOnStage, M as ModelStage, S as SpecAux, U as Unknown, c as UnknownComputed, d as UnknownLayouted, e as UnknownParsed, _ as _stage, f as _type, a as aux, i as isOnStage } from '../shared/core.
|
|
4
|
-
import { ap as BorderStyle, ar as ElementShape, ay as ThemeColor, b7 as ViewManualLayout, b2 as AutoLayoutDirection } from '../shared/core.
|
|
5
|
-
export { W as AbstractRelationship, ad as AndOperator, aY as AnyExcludePredicate, aX as AnyIncludePredicate, aK as AnyView, aZ as AnyViewRuleStyle, y as AuxFromDump, A as AuxFromLikeC4ModelData, B as BBox, ba as BaseParsedViewProperties, b9 as BaseViewProperties, ao as BorderStyles, az as Color, C as ColorLiteral, bh as ComputedDeploymentView, bi as ComputedDynamicView, bf as ComputedEdge, bg as ComputedElementView, l as ComputedLikeC4ModelData, be as ComputedNode, aI as ComputedView, at as CustomColor, au as CustomColorDefinitions, U as DefaultArrowType, H as DefaultElementShape, Q as DefaultLineStyle, J as DefaultPaddingSize, V as DefaultRelationshipColor, I as DefaultShapeSize, K as DefaultTextSize, z as DefaultThemeColor, p as DeployedInstance, q as DeploymentElement, r as DeploymentElementRef, D as DeploymentElementStyle, o as DeploymentNode, v as DeploymentRelation, u as DeploymentRelationship, bp as DeploymentViewExcludePredicate, bo as DeploymentViewIncludePredicate, bq as DeploymentViewPredicate, bs as DeploymentViewRule, br as DeploymentViewRuleStyle, bk as DiagramEdge, bj as DiagramNode, aG as DiagramView, by as DynamicViewIncludeRule, bv as DynamicViewParallelSteps, bz as DynamicViewRule, bu as DynamicViewStep, bx as DynamicViewStepOrParallel, O as Element, aq as ElementShapes, _ as ElementSpecification, N as ElementStyle, aB as ElementThemeColorValues, aC as ElementThemeColors, bD as ElementViewExcludePredicate, bC as ElementViewIncludePredicate, bE as ElementViewPredicate, bI as ElementViewRule, bF as ElementViewRuleGroup, bH as ElementViewRuleStyle, a3 as EqualOperator, E as Expression, ai as Filterable, F as FqnExpr, c as FqnRef, g as GlobalDynamicPredicates, G as GlobalPredicateId, f as GlobalPredicates, h as GlobalStyleID, i as GlobalStyles, as as HexColor, a6 as KindEqual, bm as LayoutedDeploymentView, bn as LayoutedDynamicView, bl as LayoutedElementView, m as LayoutedLikeC4ModelData, aG as LayoutedView, n as LikeC4ModelData, x as LikeC4ModelDump, L as LikeC4Theme, aF as LikeC4View, b as ModelExpression, M as ModelFqnExpr, j as ModelGlobals, Z as ModelRelation, a as ModelRelationExpr, bb as NodeNotation, ab as NotOperator, aj as OperatorPredicate, af as OrOperator, bt as ParsedDeploymentView, bA as ParsedDynamicView, bJ as ParsedElementView, k as ParsedLikeC4ModelData, aF as ParsedView, a8 as Participant, a9 as ParticipantOperator, d as Point, P as PredicateSelector, aJ as ProcessedView, e as RectBox, R as RelationExpr, Y as Relationship, aw as RelationshipArrowType, av as RelationshipLineType, a1 as RelationshipSpecification, aD as RelationshipThemeColorValues, aE as RelationshipThemeColors, an as ShapeSize, al as SpacingSize, w as SpecTypesFromDump, a2 as Specification, S as SpecificationDump, a4 as TagEqual, $ as TagSpecification, am as TextSize, T as ThemeColorValues, ax as ThemeColors, b6 as ViewAutoLayout, aL as ViewOnStage, aN as ViewRule, b4 as ViewRuleAutoLayout, b0 as ViewRuleGlobalPredicateRef, a_ as ViewRuleGlobalStyle, aO as ViewRulePredicate, b8 as ViewType, bd as ViewWithHash, bc as ViewWithNotation, aM as ViewWithType, ah as WhereOperator, X as XYPoint, bw as getParallelStepsPrefix, ae as isAndOperator, b3 as isAutoLayoutDirection, aR as isComputedView, t as isDeployedInstance, s as isDeploymentNode, aV as isDeploymentView, aH as isDiagramView, aW as isDynamicView, bB as isDynamicViewParallelSteps, aS as isElementView, aU as isExtendsElementView, a7 as isKindEqual, aH as isLayoutedView, ac as isNotOperator, ag as isOrOperator, aa as isParticipantOperator, aT as isScopedElementView, a0 as isTagColorSpecified, a5 as isTagEqual, aA as isThemeColor, b5 as isViewRuleAutoLayout, b1 as isViewRuleGlobalPredicateRef, a$ as isViewRuleGlobalStyle, bG as isViewRuleGroup, aP as isViewRulePredicate, aQ as isViewRuleStyle, ak as whereOperatorAsPredicate } from '../shared/core.
|
|
3
|
+
export { A as Any, A as AnyAux, b as Aux, E as ExtractOnStage, M as ModelStage, S as SpecAux, U as Unknown, c as UnknownComputed, d as UnknownLayouted, e as UnknownParsed, _ as _stage, f as _type, a as aux, i as isOnStage } from '../shared/core.CBxTtXMi.mjs';
|
|
4
|
+
import { ap as BorderStyle, ar as ElementShape, ay as ThemeColor, b7 as ViewManualLayout, b2 as AutoLayoutDirection } from '../shared/core.Bdz6fBF1.mjs';
|
|
5
|
+
export { W as AbstractRelationship, ad as AndOperator, aY as AnyExcludePredicate, aX as AnyIncludePredicate, aK as AnyView, aZ as AnyViewRuleStyle, y as AuxFromDump, A as AuxFromLikeC4ModelData, B as BBox, ba as BaseParsedViewProperties, b9 as BaseViewProperties, ao as BorderStyles, az as Color, C as ColorLiteral, bh as ComputedDeploymentView, bi as ComputedDynamicView, bf as ComputedEdge, bg as ComputedElementView, l as ComputedLikeC4ModelData, be as ComputedNode, aI as ComputedView, at as CustomColor, au as CustomColorDefinitions, U as DefaultArrowType, H as DefaultElementShape, Q as DefaultLineStyle, J as DefaultPaddingSize, V as DefaultRelationshipColor, I as DefaultShapeSize, K as DefaultTextSize, z as DefaultThemeColor, p as DeployedInstance, q as DeploymentElement, r as DeploymentElementRef, D as DeploymentElementStyle, o as DeploymentNode, v as DeploymentRelation, u as DeploymentRelationship, bp as DeploymentViewExcludePredicate, bo as DeploymentViewIncludePredicate, bq as DeploymentViewPredicate, bs as DeploymentViewRule, br as DeploymentViewRuleStyle, bk as DiagramEdge, bj as DiagramNode, aG as DiagramView, by as DynamicViewIncludeRule, bv as DynamicViewParallelSteps, bz as DynamicViewRule, bu as DynamicViewStep, bx as DynamicViewStepOrParallel, O as Element, aq as ElementShapes, _ as ElementSpecification, N as ElementStyle, aB as ElementThemeColorValues, aC as ElementThemeColors, bD as ElementViewExcludePredicate, bC as ElementViewIncludePredicate, bE as ElementViewPredicate, bI as ElementViewRule, bF as ElementViewRuleGroup, bH as ElementViewRuleStyle, a3 as EqualOperator, E as Expression, ai as Filterable, F as FqnExpr, c as FqnRef, g as GlobalDynamicPredicates, G as GlobalPredicateId, f as GlobalPredicates, h as GlobalStyleID, i as GlobalStyles, as as HexColor, a6 as KindEqual, bm as LayoutedDeploymentView, bn as LayoutedDynamicView, bl as LayoutedElementView, m as LayoutedLikeC4ModelData, aG as LayoutedView, n as LikeC4ModelData, x as LikeC4ModelDump, L as LikeC4Theme, aF as LikeC4View, b as ModelExpression, M as ModelFqnExpr, j as ModelGlobals, Z as ModelRelation, a as ModelRelationExpr, bb as NodeNotation, ab as NotOperator, aj as OperatorPredicate, af as OrOperator, bt as ParsedDeploymentView, bA as ParsedDynamicView, bJ as ParsedElementView, k as ParsedLikeC4ModelData, aF as ParsedView, a8 as Participant, a9 as ParticipantOperator, d as Point, P as PredicateSelector, aJ as ProcessedView, e as RectBox, R as RelationExpr, Y as Relationship, aw as RelationshipArrowType, av as RelationshipLineType, a1 as RelationshipSpecification, aD as RelationshipThemeColorValues, aE as RelationshipThemeColors, an as ShapeSize, al as SpacingSize, w as SpecTypesFromDump, a2 as Specification, S as SpecificationDump, a4 as TagEqual, $ as TagSpecification, am as TextSize, T as ThemeColorValues, ax as ThemeColors, b6 as ViewAutoLayout, aL as ViewOnStage, aN as ViewRule, b4 as ViewRuleAutoLayout, b0 as ViewRuleGlobalPredicateRef, a_ as ViewRuleGlobalStyle, aO as ViewRulePredicate, b8 as ViewType, bd as ViewWithHash, bc as ViewWithNotation, aM as ViewWithType, ah as WhereOperator, X as XYPoint, bw as getParallelStepsPrefix, ae as isAndOperator, b3 as isAutoLayoutDirection, aR as isComputedView, t as isDeployedInstance, s as isDeploymentNode, aV as isDeploymentView, aH as isDiagramView, aW as isDynamicView, bB as isDynamicViewParallelSteps, aS as isElementView, aU as isExtendsElementView, a7 as isKindEqual, aH as isLayoutedView, ac as isNotOperator, ag as isOrOperator, aa as isParticipantOperator, aT as isScopedElementView, a0 as isTagColorSpecified, a5 as isTagEqual, aA as isThemeColor, b5 as isViewRuleAutoLayout, b1 as isViewRuleGlobalPredicateRef, a$ as isViewRuleGlobalStyle, bG as isViewRuleGroup, aP as isViewRulePredicate, aQ as isViewRuleStyle, ak as whereOperatorAsPredicate } from '../shared/core.Bdz6fBF1.mjs';
|
|
6
6
|
import 'type-fest';
|
|
7
7
|
|
|
8
8
|
declare namespace ViewChange {
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -588,6 +588,7 @@ declare function memoizeProp<Tag extends symbol | string, Res>(obj: object, tag:
|
|
|
588
588
|
declare function delay(): Promise<string>;
|
|
589
589
|
declare function delay(ms: number): Promise<string>;
|
|
590
590
|
declare function delay(randomFrom: number, randomTo: number): Promise<string>;
|
|
591
|
+
declare function promiseNextTick(): Promise<void>;
|
|
591
592
|
|
|
592
593
|
type RelationshipLike = {
|
|
593
594
|
source: {
|
|
@@ -624,4 +625,4 @@ declare function stringHash(str: string): string;
|
|
|
624
625
|
|
|
625
626
|
declare function objectHash(value: any): string;
|
|
626
627
|
|
|
627
|
-
export { BiMap, DefaultWeakMap, LinkedList, MultiMap, Queue, Stack, commonHead, compareNatural, compareNaturalHierarchically, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, ihead, imap, intersection, invariant, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, memoizeProp, nonNullable, nonexhaustive, objectHash, stringHash, symmetricDifference, toArray, toSet, union };
|
|
628
|
+
export { BiMap, DefaultWeakMap, LinkedList, MultiMap, Queue, Stack, commonHead, compareNatural, compareNaturalHierarchically, compareRelations, delay, difference, equals as equalsSet, getOrCreate, hasAtLeast, ifilter, ifind, iflat, ihead, imap, intersection, invariant, ireduce, isIterable, isNonEmptyArray, isString, isome, iunique, memoizeProp, nonNullable, nonexhaustive, objectHash, promiseNextTick, stringHash, symmetricDifference, toArray, toSet, union };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1289,6 +1289,9 @@ function delay(...args) {
|
|
|
1289
1289
|
}, ms ?? 100);
|
|
1290
1290
|
});
|
|
1291
1291
|
}
|
|
1292
|
+
function promiseNextTick() {
|
|
1293
|
+
return Promise.resolve().then(() => void 0);
|
|
1294
|
+
}
|
|
1292
1295
|
|
|
1293
1296
|
const compareRelations = (a, b) => {
|
|
1294
1297
|
const parentA = commonAncestor(a.source.model, a.target.model);
|
|
@@ -1310,4 +1313,4 @@ const compareRelations = (a, b) => {
|
|
|
1310
1313
|
return compareFqnHierarchically(a.target.model, b.target.model);
|
|
1311
1314
|
};
|
|
1312
1315
|
|
|
1313
|
-
export { biMap as BiMap, defaultWeakMap as DefaultWeakMap, linkedList as LinkedList, multiMap as MultiMap, queue as Queue, commonAncestor, compareFqnHierarchically, compareRelations, delay, invariant, ireduce };
|
|
1316
|
+
export { biMap as BiMap, defaultWeakMap as DefaultWeakMap, linkedList as LinkedList, multiMap as MultiMap, queue as Queue, commonAncestor, compareFqnHierarchically, compareRelations, delay, invariant, ireduce, promiseNextTick };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/core",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://likec4.dev",
|
|
6
6
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -111,11 +111,11 @@
|
|
|
111
111
|
"object-hash": "^3.0.0",
|
|
112
112
|
"obliterator": "^2.0.5",
|
|
113
113
|
"remeda": "^2.23.0",
|
|
114
|
-
"turbo": "
|
|
115
|
-
"typescript": "
|
|
116
|
-
"unbuild": "
|
|
117
|
-
"vitest": "
|
|
118
|
-
"@likec4/tsconfig": "1.32.
|
|
114
|
+
"turbo": "2.5.4",
|
|
115
|
+
"typescript": "5.8.3",
|
|
116
|
+
"unbuild": "3.5.0",
|
|
117
|
+
"vitest": "3.2.3",
|
|
118
|
+
"@likec4/tsconfig": "1.32.2"
|
|
119
119
|
},
|
|
120
120
|
"scripts": {
|
|
121
121
|
"typecheck": "tsc -b --verbose",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"lint": "run -T eslint src/ --fix",
|
|
124
124
|
"test": "vitest run --no-isolate",
|
|
125
125
|
"test:watch": "vitest",
|
|
126
|
-
"clean": "
|
|
126
|
+
"clean": "pnpm rimraf dist lib",
|
|
127
127
|
"pack": "pnpm pack"
|
|
128
128
|
}
|
|
129
129
|
}
|
package/src/builder/_types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IfNever, IsLiteral, Tagged, TupleToUnion } from 'type-fest'
|
|
1
|
+
import type { IfNever, IsLiteral, IsNever, Tagged, TupleToUnion } from 'type-fest'
|
|
2
2
|
import type {
|
|
3
3
|
AnyAux,
|
|
4
4
|
Aux,
|
|
@@ -41,7 +41,11 @@ export type BuilderSpecification = {
|
|
|
41
41
|
metadataKeys?: string[]
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export type Metadata<MetadataKey extends string> =
|
|
44
|
+
export type Metadata<MetadataKey extends string> = IsNever<MetadataKey> extends true ? never :
|
|
45
|
+
IsLiteral<MetadataKey> extends true ? {
|
|
46
|
+
[key in MetadataKey]?: string
|
|
47
|
+
} :
|
|
48
|
+
Record<string, string>
|
|
45
49
|
|
|
46
50
|
export type NewElementProps<Tag, Metadata> = {
|
|
47
51
|
title?: string
|
|
@@ -24,7 +24,7 @@ import { difference, intersection, union } from '../utils/set'
|
|
|
24
24
|
import type { LikeC4DeploymentModel } from './DeploymentModel'
|
|
25
25
|
import type { ElementModel } from './ElementModel'
|
|
26
26
|
import type { AnyRelationshipModel, RelationshipModel, RelationshipsIterator } from './RelationModel'
|
|
27
|
-
import type { IncomingFilter, OutgoingFilter } from './types'
|
|
27
|
+
import type { IncomingFilter, OutgoingFilter, WithMetadata, WithTags } from './types'
|
|
28
28
|
import type { LikeC4ViewModel } from './view/LikeC4ViewModel'
|
|
29
29
|
|
|
30
30
|
export type DeploymentElementsIterator<A extends Any> = IteratorLike<DeploymentElementModel<A>>
|
|
@@ -33,7 +33,7 @@ export type DeploymentNodesIterator<A extends Any> = IteratorLike<DeploymentNode
|
|
|
33
33
|
|
|
34
34
|
export type DeploymentElementModel<A extends Any = Any> = DeploymentNodeModel<A> | DeployedInstanceModel<A>
|
|
35
35
|
|
|
36
|
-
abstract class AbstractDeploymentElementModel<A extends Any> {
|
|
36
|
+
abstract class AbstractDeploymentElementModel<A extends Any> implements WithTags<A>, WithMetadata<A> {
|
|
37
37
|
abstract readonly id: aux.DeploymentFqn<A>
|
|
38
38
|
abstract readonly _literalId: aux.DeploymentId<A>
|
|
39
39
|
abstract readonly parent: DeploymentNodeModel<A> | null
|
|
@@ -18,12 +18,12 @@ import { commonAncestor, hierarchyLevel, ihead, isAncestor, memoizeProp, sortNat
|
|
|
18
18
|
import { type DeployedInstancesIterator } from './DeploymentElementModel'
|
|
19
19
|
import type { LikeC4Model } from './LikeC4Model'
|
|
20
20
|
import type { RelationshipModel, RelationshipsIterator } from './RelationModel'
|
|
21
|
-
import type {
|
|
21
|
+
import type { IncomingFilter, OutgoingFilter, WithMetadata, WithTags } from './types'
|
|
22
22
|
import type { LikeC4ViewModel } from './view/LikeC4ViewModel'
|
|
23
23
|
|
|
24
24
|
export type ElementsIterator<M extends AnyAux> = IteratorLike<ElementModel<M>>
|
|
25
25
|
|
|
26
|
-
export class ElementModel<A extends AnyAux = Any> {
|
|
26
|
+
export class ElementModel<A extends AnyAux = Any> implements WithTags<A>, WithMetadata<A> {
|
|
27
27
|
readonly id: aux.Fqn<A>
|
|
28
28
|
readonly _literalId: aux.ElementId<A>
|
|
29
29
|
readonly hierarchyLevel: number
|
|
@@ -101,7 +101,7 @@ export class ElementModel<A extends AnyAux = Any> {
|
|
|
101
101
|
return this.$element.links ?? []
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
get defaultView(): LikeC4ViewModel
|
|
104
|
+
get defaultView(): LikeC4ViewModel.ScopedElementView<A> | null {
|
|
105
105
|
return memoizeProp(this, Symbol.for('defaultView'), () => ihead(this.scopedViews()) ?? null)
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -242,11 +242,9 @@ export class ElementModel<A extends AnyAux = Any> {
|
|
|
242
242
|
* Iterate over all views that scope this element.
|
|
243
243
|
* It is possible that element is not included in the view.
|
|
244
244
|
*/
|
|
245
|
-
public scopedViews(): ReadonlySet<
|
|
246
|
-
LikeC4ViewModel<A, $ViewWithType<A, 'element'> & { viewOf: aux.StrictFqn<A> }>
|
|
247
|
-
> {
|
|
245
|
+
public scopedViews(): ReadonlySet<LikeC4ViewModel.ScopedElementView<A>> {
|
|
248
246
|
return memoizeProp(this, Symbol.for('scopedViews'), () => {
|
|
249
|
-
const views = new Set<LikeC4ViewModel
|
|
247
|
+
const views = new Set<LikeC4ViewModel.ScopedElementView<A>>()
|
|
250
248
|
for (const vm of this.$model.views()) {
|
|
251
249
|
if (vm.isScopedElementView() && vm.viewOf.id === this.id) {
|
|
252
250
|
views.add(vm)
|
|
@@ -13,6 +13,7 @@ import type { DeploymentRelationModel } from './DeploymentElementModel'
|
|
|
13
13
|
import type { ElementModel } from './ElementModel'
|
|
14
14
|
import type { isDeploymentRelationModel } from './guards'
|
|
15
15
|
import type { LikeC4Model } from './LikeC4Model'
|
|
16
|
+
import type { WithMetadata, WithTags } from './types'
|
|
16
17
|
import type { LikeC4ViewModel, ViewsIterator } from './view/LikeC4ViewModel'
|
|
17
18
|
|
|
18
19
|
export type RelationshipsIterator<A extends AnyAux> = IteratorLike<RelationshipModel<A>>
|
|
@@ -21,24 +22,20 @@ export type RelationshipsIterator<A extends AnyAux> = IteratorLike<RelationshipM
|
|
|
21
22
|
* A relationship between two elements (in logical or deployment model)
|
|
22
23
|
* use {@link isDeploymentRelationModel} guard to check if the relationship is a deployment relationship
|
|
23
24
|
*/
|
|
24
|
-
export interface AnyRelationshipModel<A extends AnyAux> {
|
|
25
|
+
export interface AnyRelationshipModel<A extends AnyAux> extends WithTags<A>, WithMetadata<A> {
|
|
25
26
|
get id(): scalar.RelationId
|
|
26
27
|
get expression(): string
|
|
27
28
|
get title(): string | null
|
|
28
29
|
get technology(): string | null
|
|
29
30
|
get description(): string | null
|
|
30
31
|
get navigateTo(): LikeC4ViewModel<A> | null
|
|
31
|
-
get tags(): aux.Tags<A>
|
|
32
32
|
get kind(): aux.RelationKind<A> | null
|
|
33
33
|
get links(): ReadonlyArray<Link>
|
|
34
34
|
get color(): Color
|
|
35
35
|
get line(): RelationshipLineType
|
|
36
36
|
isDeploymentRelation(): this is DeploymentRelationModel<A>
|
|
37
37
|
isModelRelation(): this is RelationshipModel<A>
|
|
38
|
-
getMetadata(): aux.Metadata<A>
|
|
39
|
-
getMetadata(field: aux.MetadataKey<A>): string | undefined
|
|
40
38
|
views(): ViewsIterator<A>
|
|
41
|
-
isTagged(tag: aux.LooseTag<A>): boolean
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
export class RelationshipModel<A extends AnyAux = AnyAux> implements AnyRelationshipModel<A> {
|
package/src/model/index.ts
CHANGED
package/src/model/types.ts
CHANGED
|
@@ -61,3 +61,13 @@ export type $ModelData<A extends AnyAux> = {
|
|
|
61
61
|
computed: ComputedLikeC4ModelData<A>
|
|
62
62
|
layouted: LayoutedLikeC4ModelData<A>
|
|
63
63
|
}[aux.Stage<A>]
|
|
64
|
+
|
|
65
|
+
export interface WithTags<A extends AnyAux> {
|
|
66
|
+
get tags(): aux.Tags<A>
|
|
67
|
+
isTagged(tag: aux.LooseTag<A>): boolean
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface WithMetadata<A extends AnyAux> {
|
|
71
|
+
getMetadata(): aux.Metadata<A>
|
|
72
|
+
getMetadata(field: aux.MetadataKey<A>): string | undefined
|
|
73
|
+
}
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
} from '../../types'
|
|
14
14
|
import type { DeploymentRelationModel } from '../DeploymentElementModel'
|
|
15
15
|
import type { RelationshipModel } from '../RelationModel'
|
|
16
|
-
import type { $View } from '../types'
|
|
16
|
+
import type { $View, WithTags } from '../types'
|
|
17
17
|
import type { LikeC4ViewModel } from './LikeC4ViewModel'
|
|
18
18
|
import type { NodeModel } from './NodeModel'
|
|
19
19
|
|
|
20
20
|
export type EdgesIterator<A extends Any, V extends $View<A>> = IteratorLike<EdgeModel<A, V>>
|
|
21
21
|
|
|
22
|
-
export class EdgeModel<A extends Any = Any, View extends $View<A> = $View<A>> {
|
|
22
|
+
export class EdgeModel<A extends Any = Any, View extends $View<A> = $View<A>> implements WithTags<A> {
|
|
23
23
|
#edge: ComputedEdge<A> | DiagramEdge<A>
|
|
24
24
|
constructor(
|
|
25
25
|
public readonly view: LikeC4ViewModel<A, View>,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
type $View,
|
|
17
17
|
type EdgeOrId,
|
|
18
18
|
type NodeOrId,
|
|
19
|
+
type WithTags,
|
|
19
20
|
getId,
|
|
20
21
|
} from '../types'
|
|
21
22
|
import { type EdgesIterator, EdgeModel } from './EdgeModel'
|
|
@@ -25,7 +26,7 @@ export type ViewsIterator<A extends Any, V extends $View<A> = $View<A>> = Iterat
|
|
|
25
26
|
|
|
26
27
|
export type InferViewType<V> = V extends AnyView<any> ? V[_type] : never
|
|
27
28
|
|
|
28
|
-
export class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>> {
|
|
29
|
+
export class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>> implements WithTags<A> {
|
|
29
30
|
/**
|
|
30
31
|
* Don't use in runtime, only for type inference
|
|
31
32
|
*/
|
|
@@ -245,7 +246,7 @@ export class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>>
|
|
|
245
246
|
|
|
246
247
|
public isScopedElementView(
|
|
247
248
|
this: LikeC4ViewModel<any, any>,
|
|
248
|
-
): this is LikeC4ViewModel.ScopedElementView<A
|
|
249
|
+
): this is LikeC4ViewModel.ScopedElementView<A> {
|
|
249
250
|
return this.$view[_type] === 'element' && isTruthy(this.$view.viewOf)
|
|
250
251
|
}
|
|
251
252
|
|
|
@@ -264,8 +265,8 @@ export namespace LikeC4ViewModel {
|
|
|
264
265
|
{
|
|
265
266
|
}
|
|
266
267
|
|
|
267
|
-
export interface ScopedElementView<A extends Any
|
|
268
|
-
extends LikeC4ViewModel<A, ViewWithType<
|
|
268
|
+
export interface ScopedElementView<A extends Any>
|
|
269
|
+
extends LikeC4ViewModel<A, ViewWithType<$View<A>, 'element'> & { viewOf: aux.StrictFqn<A> }>
|
|
269
270
|
{
|
|
270
271
|
viewOf: ElementModel<A>
|
|
271
272
|
}
|
|
@@ -18,13 +18,13 @@ import type * as aux from '../../types/aux'
|
|
|
18
18
|
import { memoizeProp } from '../../utils'
|
|
19
19
|
import type { DeployedInstanceModel, DeploymentElementModel } from '../DeploymentElementModel'
|
|
20
20
|
import type { ElementModel } from '../ElementModel'
|
|
21
|
-
import type { $View, IncomingFilter, OutgoingFilter } from '../types'
|
|
21
|
+
import type { $View, IncomingFilter, OutgoingFilter, WithTags } from '../types'
|
|
22
22
|
import type { EdgesIterator } from './EdgeModel'
|
|
23
23
|
import type { LikeC4ViewModel } from './LikeC4ViewModel'
|
|
24
24
|
|
|
25
25
|
export type NodesIterator<M extends Any, V extends $View<M>> = IteratorLike<NodeModel<M, V>>
|
|
26
26
|
|
|
27
|
-
export class NodeModel<A extends Any = Any, V extends $View<A> = $View<A>> {
|
|
27
|
+
export class NodeModel<A extends Any = Any, V extends $View<A> = $View<A>> implements WithTags<A> {
|
|
28
28
|
#node: ComputedNode<A> | DiagramNode<A>
|
|
29
29
|
|
|
30
30
|
constructor(
|
package/src/types/aux.ts
CHANGED
package/src/types/styles.ts
CHANGED
|
@@ -25,11 +25,10 @@ export type ElementShape = TupleToUnion<typeof ElementShapes>
|
|
|
25
25
|
|
|
26
26
|
export type HexColor = `#${string}`
|
|
27
27
|
|
|
28
|
-
type Comma = ',' | ', '
|
|
29
28
|
export type ColorLiteral =
|
|
30
29
|
| HexColor
|
|
31
|
-
| `rgb(${number}
|
|
32
|
-
| `rgba(${number}
|
|
30
|
+
| `rgb(${number},${number},${number})`
|
|
31
|
+
| `rgba(${number},${number},${number},${number})`
|
|
33
32
|
|
|
34
33
|
export type CustomColor<T = string> = Tagged<T, 'CustomColor'>
|
|
35
34
|
|
|
@@ -69,19 +68,19 @@ export type ThemeColor = typeof ThemeColors[number]
|
|
|
69
68
|
* Backward compatibility alias
|
|
70
69
|
* @deprecated Use {@link ThemeColor} instead
|
|
71
70
|
*/
|
|
72
|
-
export type Color = ThemeColor |
|
|
71
|
+
export type Color = ThemeColor | ColorLiteral
|
|
73
72
|
|
|
74
73
|
export function isThemeColor(color: string): color is ThemeColor {
|
|
75
74
|
return ThemeColors.includes(color as ThemeColor)
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
export interface ElementThemeColorValues {
|
|
79
|
-
fill:
|
|
80
|
-
stroke:
|
|
78
|
+
fill: ColorLiteral
|
|
79
|
+
stroke: ColorLiteral
|
|
81
80
|
// Main text (title, etc.)
|
|
82
|
-
hiContrast:
|
|
81
|
+
hiContrast: ColorLiteral
|
|
83
82
|
// Secondary text (description, etc.)
|
|
84
|
-
loContrast:
|
|
83
|
+
loContrast: ColorLiteral
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
export type ElementThemeColors = {
|
|
@@ -89,9 +88,9 @@ export type ElementThemeColors = {
|
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
export interface RelationshipThemeColorValues {
|
|
92
|
-
lineColor:
|
|
93
|
-
labelBgColor:
|
|
94
|
-
labelColor:
|
|
91
|
+
lineColor: ColorLiteral
|
|
92
|
+
labelBgColor: ColorLiteral
|
|
93
|
+
labelColor: ColorLiteral
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
export interface ThemeColorValues {
|
package/src/types/view.ts
CHANGED
|
@@ -22,11 +22,6 @@ export type ParsedView<A extends Any = Any> =
|
|
|
22
22
|
| ParsedDeploymentView<A>
|
|
23
23
|
| ParsedDynamicView<A>
|
|
24
24
|
|
|
25
|
-
// export type ParsedView<A extends Any = Any> = ExclusiveUnion<{
|
|
26
|
-
// Element: ParsedElementView<A>
|
|
27
|
-
// Deployment: ParsedDeploymentView<A>
|
|
28
|
-
// Dynamic: ParsedDynamicView<A>
|
|
29
|
-
// }>
|
|
30
25
|
/**
|
|
31
26
|
* Should be `ParsedView` but keep it for backward compatibility
|
|
32
27
|
* @deprecated use `ParsedView`
|
|
@@ -37,17 +32,6 @@ export type ComputedView<A extends Any = Any> =
|
|
|
37
32
|
| ComputedElementView<A>
|
|
38
33
|
| ComputedDeploymentView<A>
|
|
39
34
|
| ComputedDynamicView<A>
|
|
40
|
-
// export type ComputedView<A extends Any = Any> = ExclusiveUnion<{
|
|
41
|
-
// Element: ComputedElementView<A>
|
|
42
|
-
// Deployment: ComputedDeploymentView<A>
|
|
43
|
-
// Dynamic: ComputedDynamicView<A>
|
|
44
|
-
// }>
|
|
45
|
-
|
|
46
|
-
// export type LayoutedView<A extends Any = Any> = ExclusiveUnion<{
|
|
47
|
-
// Element: LayoutedElementView<A>
|
|
48
|
-
// Deployment: LayoutedDeploymentView<A>
|
|
49
|
-
// Dynamic: LayoutedDynamicView<A>
|
|
50
|
-
// }>
|
|
51
35
|
|
|
52
36
|
export type LayoutedView<A extends Any = Any> =
|
|
53
37
|
| LayoutedElementView<A>
|
|
@@ -72,17 +56,6 @@ export type AnyView<A extends Any = Any> =
|
|
|
72
56
|
| LayoutedElementView<A>
|
|
73
57
|
| LayoutedDeploymentView<A>
|
|
74
58
|
| LayoutedDynamicView<A>
|
|
75
|
-
// export type AnyView<A extends Any = Any> = ExclusiveUnion<{
|
|
76
|
-
// ParsedElement: ParsedElementView<A>
|
|
77
|
-
// ParsedDeployment: ParsedDeploymentView<A>
|
|
78
|
-
// ParsedDynamic: ParsedDynamicView<A>
|
|
79
|
-
// ComputedElement: ComputedElementView<A>
|
|
80
|
-
// ComputedDeployment: ComputedDeploymentView<A>
|
|
81
|
-
// ComputedDynamic: ComputedDynamicView<A>
|
|
82
|
-
// LayoutedElement: LayoutedElementView<A>
|
|
83
|
-
// LayoutedDeployment: LayoutedDeploymentView<A>
|
|
84
|
-
// LayoutedDynamic: LayoutedDynamicView<A>
|
|
85
|
-
// }>
|
|
86
59
|
|
|
87
60
|
export type ViewOnStage<V extends AnyView<Any>, T extends ModelStage> = Extract<V, { [_stage]: T }>
|
|
88
61
|
export type ViewWithType<V extends AnyView<Any>, T extends ViewType> = Extract<V, { [_type]: T }>
|
package/src/utils/index.ts
CHANGED