@likec4/core
Advanced tools
Comparing version 1.15.1 to 1.16.0
@@ -1,2 +0,2 @@ | ||
export { aC as AndOperator, G as AsFqn, A as AutoLayoutDirection, bz as BBox, b6 as BasicElementView, b5 as BasicView, B as BorderStyle, J as BorderStyles, C as Color, aO as ColorLiteral, bw as ComputedDynamicView, q as ComputedEdge, bv as ComputedElementView, r as ComputedLikeC4Model, n as ComputedNode, l as ComputedView, y as CustomColor, bi as CustomColorDefinitions, g as CustomElementExpr, h as CustomRelationExpr, aL as DefaultArrowType, O as DefaultElementShape, aK as DefaultLineStyle, aM as DefaultRelationshipColor, M as DefaultThemeColor, v as DiagramEdge, u as DiagramNode, D as DiagramView, bg as DynamicView, bd as DynamicViewIncludeRule, bb as DynamicViewParallelSteps, bf as DynamicViewRule, ba as DynamicViewStep, bc as DynamicViewStepOrParallel, k as EdgeId, d as Element, a8 as ElementExpression, p as ElementKind, a4 as ElementKindExpr, E as ElementKindSpecification, Y as ElementKindSpecificationStyle, bD as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, a as ElementShape, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aQ as ElementThemeColorValues, aR as ElementThemeColors, b9 as ElementView, aa as ElementWhereExpr, av as EqualOperator, $ as ExpandedElementExpr, f as Expression, b8 as ExtendsElementView, aH as Filterable, F as Fqn, au as GlobalStyle, at as GlobalStyleID, H as HexColorLiteral, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, ay as KindEqual, s as LayoutedLikeC4Model, aU as LikeC4Theme, L as LikeC4View, U as Link, o as NodeId, N as NonEmptyArray, x as NonEmptyReadonlyArray, aA as NotOperator, aE as OrOperator, ak as OutgoingExpr, aJ as OverviewGraph, P as ParsedLikeC4Model, z as Point, e as Relation, ae as RelationExpr, am as RelationExpression, i as RelationID, ar as RelationPredicateExpression, ao as RelationWhereExpr, b as RelationshipArrowType, t as RelationshipKind, R as RelationshipKindSpecification, c as RelationshipLineType, aS as RelationshipThemeColorValues, aT as RelationshipThemeColors, b7 as ScopedElementView, bo as StepEdgeId, bn as StepEdgeIdLiteral, m as Tag, aw as TagEqual, S as TagSpec, aN as ThemeColor, T as ThemeColorValues, W as TypedElement, bu as ViewAutoLayout, bC as ViewChange, j as ViewID, bB as ViewManualLayout, b4 as ViewRule, b0 as ViewRuleAutoLayout, aY as ViewRuleGlobalStyle, b2 as ViewRuleGroup, aV as ViewRulePredicate, V as ViewRuleStyle, a_ as ViewRuleStyleOrGlobalRef, bs as ViewWithHash, bt as ViewWithNotation, aG as WhereOperator, a2 as WildcardExpr, X as XYPoint, bq as extractStep, bA as getBBoxCenter, br as getParallelStepsPrefix, aD as isAndOperator, a$ as isAutoLayoutDirection, bx as isComputedDynamicView, by as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bj as isDynamicView, be as isDynamicViewIncludeRule, bh as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bk as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, bl as isExtendsElementView, ah as isInOut, aj as isIncoming, az as isKindEqual, aB as isNotOperator, aF as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, bm as isScopedElementView, bp as isStepEdgeId, ax as isTagEqual, aP as isThemeColor, b1 as isViewRuleAutoLayout, aZ as isViewRuleGlobalStyle, b3 as isViewRuleGroup, aW as isViewRulePredicate, aX as isViewRuleStyle, a3 as isWildcard, aI as whereOperatorAsPredicate } from '../shared/core.CpdWcGpN.js'; | ||
export { aG as AndOperator, G as AsFqn, A as AutoLayoutDirection, bF as BBox, bc as BasicElementView, bb as BasicView, B as BorderStyle, J as BorderStyles, C as Color, aS as ColorLiteral, bC as ComputedDynamicView, q as ComputedEdge, bB as ComputedElementView, r as ComputedLikeC4Model, n as ComputedNode, l as ComputedView, y as CustomColor, bo as CustomColorDefinitions, g as CustomElementExpr, h as CustomRelationExpr, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, v as DiagramEdge, u as DiagramNode, D as DiagramView, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, k as EdgeId, d as Element, a8 as ElementExpression, p as ElementKind, a4 as ElementKindExpr, E as ElementKindSpecification, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, a as ElementShape, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aU as ElementThemeColorValues, aV as ElementThemeColors, bf as ElementView, aa as ElementWhereExpr, az as EqualOperator, $ as ExpandedElementExpr, f as Expression, be as ExtendsElementView, aL as Filterable, F as Fqn, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, H as HexColorLiteral, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, s as LayoutedLikeC4Model, aY as LikeC4Theme, L as LikeC4View, U as Link, ay as ModelGlobals, o as NodeId, N as NonEmptyArray, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, P as ParsedLikeC4Model, z as Point, e as Relation, ae as RelationExpr, am as RelationExpression, i as RelationID, ar as RelationPredicateExpression, ao as RelationWhereExpr, b as RelationshipArrowType, t as RelationshipKind, R as RelationshipKindSpecification, c as RelationshipLineType, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, m as Tag, aA as TagEqual, S as TagSpec, aR as ThemeColor, T as ThemeColorValues, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, j as ViewID, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, V as ViewRuleStyle, b4 as ViewRuleStyleOrGlobalRef, by as ViewWithHash, bz as ViewWithNotation, aK as WhereOperator, a2 as WildcardExpr, X as XYPoint, bw as extractStep, bG as getBBoxCenter, bx as getParallelStepsPrefix, aH as isAndOperator, b5 as isAutoLayoutDirection, bD as isComputedDynamicView, bE as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bp as isDynamicView, bk as isDynamicViewIncludeRule, bn as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bq as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, br as isExtendsElementView, ah as isInOut, aj as isIncoming, aD as isKindEqual, aF as isNotOperator, aJ as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, bs as isScopedElementView, bv as isStepEdgeId, aB as isTagEqual, aT as isThemeColor, b7 as isViewRuleAutoLayout, b0 as isViewRuleGlobalPredicateRef, b3 as isViewRuleGlobalStyle, b9 as isViewRuleGroup, a_ as isViewRulePredicate, b1 as isViewRuleStyle, a3 as isWildcard, aM as whereOperatorAsPredicate } from '../shared/core.gZyGTUZz.js'; | ||
import 'type-fest'; |
{ | ||
"name": "@likec4/core", | ||
"version": "1.15.1", | ||
"version": "1.16.0", | ||
"license": "MIT", | ||
@@ -83,3 +83,3 @@ "homepage": "https://likec4.dev", | ||
"devDependencies": { | ||
"@likec4/tsconfig": "1.15.1", | ||
"@likec4/tsconfig": "1.16.0", | ||
"@mantine/colors-generator": "7.13.4", | ||
@@ -94,5 +94,5 @@ "@types/natural-compare-lite": "^1.4.2", | ||
"unbuild": "^3.0.0-rc.11", | ||
"vitest": "^2.1.3" | ||
"vitest": "^2.1.4" | ||
}, | ||
"packageManager": "yarn@4.5.1" | ||
} |
@@ -13,3 +13,2 @@ import defu from 'defu' | ||
type Fqn, | ||
type GlobalStyle, | ||
type IconUrl, | ||
@@ -19,2 +18,3 @@ isScopedElementView, | ||
type Link, | ||
type ModelGlobals, | ||
type NonEmptyArray, | ||
@@ -225,6 +225,8 @@ type Relation, | ||
_relations = [] as Relation[], | ||
_globals = { styles: [] } as { | ||
styles: GlobalStyle[] | ||
}, | ||
_views = new Map<string, LikeC4View>() | ||
_views = new Map<string, LikeC4View>(), | ||
_globals = { | ||
predicates: {}, | ||
dynamicPredicates: {}, | ||
styles: {} | ||
} as ModelGlobals | ||
): Builder<T> { | ||
@@ -293,4 +295,4 @@ const toLikeC4Specification = (): Types.ToParsedLikeC4Model<T>['specification'] => ({ | ||
structuredClone(_relations), | ||
structuredClone(_globals), | ||
structuredClone(_views) | ||
structuredClone(_views), | ||
structuredClone(_globals) | ||
), | ||
@@ -350,5 +352,3 @@ __model: () => ({ | ||
relations: mapToObj(_relations, r => [r.id, r]), | ||
globals: { | ||
styles: mapToObj(_globals.styles, s => [s.id, s]) | ||
}, | ||
globals: structuredClone(_globals), | ||
views: fromEntries(Array.from(_views.entries())) as any | ||
@@ -355,0 +355,0 @@ }), |
@@ -338,2 +338,4 @@ import { mapToObj } from 'remeda' | ||
globals: { | ||
predicates: {}, | ||
dynamicPredicates: {}, | ||
styles: {} | ||
@@ -340,0 +342,0 @@ }, |
@@ -1,10 +0,19 @@ | ||
import type { Tagged } from 'type-fest' | ||
import type { NonEmptyTuple, Tagged } from 'type-fest' | ||
import type { NonEmptyArray } from './_common' | ||
import type { ViewRuleStyle } from './view' | ||
import type { DynamicViewIncludeRule, ViewRulePredicate, ViewRuleStyle } from './view' | ||
export type GlobalPredicateId = Tagged<string, 'GlobalPredicateId'> | ||
export type GlobalPredicates = NonEmptyArray<ViewRulePredicate> | ||
export type GlobalDynamicPredicates = NonEmptyArray<DynamicViewIncludeRule> | ||
export type GlobalStyleID = Tagged<string, 'GlobalStyleID'> | ||
export interface GlobalStyle { | ||
readonly id: GlobalStyleID | ||
readonly styles: NonEmptyArray<ViewRuleStyle> | ||
export type GlobalStyles = NonEmptyTuple<ViewRuleStyle> | ||
export interface ModelGlobals { | ||
predicates: Record<GlobalPredicateId, GlobalPredicates> | ||
dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates> | ||
styles: Record<GlobalStyleID, GlobalStyles> | ||
} |
import type { ElementKindSpecification, Tag, TypedElement } from './element' | ||
import type { GlobalStyle, GlobalStyleID } from './global' | ||
import type { ModelGlobals } from './global' | ||
import type { Relation, RelationID, RelationshipKindSpecification } from './relation' | ||
@@ -23,5 +23,3 @@ import type { ComputedView, DiagramView, LikeC4View, ViewID } from './view' | ||
relations: Record<RelationID, Relation> | ||
globals: { | ||
styles: Record<GlobalStyleID, GlobalStyle> | ||
} | ||
globals: ModelGlobals | ||
views: Record<Views, LikeC4View<Views, Tags>> | ||
@@ -28,0 +26,0 @@ } |
@@ -14,3 +14,3 @@ import { isArray, isNullish } from 'remeda' | ||
import type { ElementExpression, ElementPredicateExpression, Expression } from './expression' | ||
import type { GlobalStyleID } from './global' | ||
import type { GlobalPredicateId, GlobalStyleID } from './global' | ||
import type { RelationID, RelationshipArrowType, RelationshipKind, RelationshipLineType } from './relation' | ||
@@ -38,2 +38,9 @@ import type { Color, ThemeColorValues } from './theme' | ||
export interface ViewRuleGlobalPredicateRef { | ||
predicateId: GlobalPredicateId | ||
} | ||
export function isViewRuleGlobalPredicateRef(rule: ViewRule): rule is ViewRuleGlobalPredicateRef { | ||
return 'predicateId' in rule | ||
} | ||
export interface ViewRuleStyle { | ||
@@ -88,3 +95,9 @@ targets: ElementExpression[] | ||
export type ViewRule = ViewRulePredicate | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout | ||
export type ViewRule = | ||
| ViewRulePredicate | ||
| ViewRuleGlobalPredicateRef | ||
| ViewRuleGroup | ||
| ViewRuleStyle | ||
| ViewRuleGlobalStyle | ||
| ViewRuleAutoLayout | ||
@@ -184,3 +197,8 @@ export interface BasicView< | ||
export type DynamicViewRule = DynamicViewIncludeRule | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout | ||
export type DynamicViewRule = | ||
| DynamicViewIncludeRule | ||
| ViewRuleGlobalPredicateRef | ||
| ViewRuleStyle | ||
| ViewRuleGlobalStyle | ||
| ViewRuleAutoLayout | ||
export interface DynamicView< | ||
@@ -187,0 +205,0 @@ ViewIDs extends string = string, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
817554
17415