@likec4/core 1.15.1 → 1.16.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/index.cjs +10 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +10 -8
- package/dist/shared/{core.CpdWcGpN.d.cts → core.gZyGTUZz.d.cts} +17 -10
- package/dist/shared/{core.CpdWcGpN.d.mts → core.gZyGTUZz.d.mts} +17 -10
- package/dist/shared/{core.CpdWcGpN.d.ts → core.gZyGTUZz.d.ts} +17 -10
- package/dist/shared/{core.zYtlWYjW.mjs → core.v5DxGcX6.mjs} +4 -1
- package/dist/shared/{core.Cq_6j35U.cjs → core.zN6ZscFQ.cjs} +4 -0
- package/dist/types/index.cjs +2 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.mjs +1 -1
- package/package.json +3 -3
- package/src/builder/Builder.ts +10 -10
- package/src/model/__test__/fixture.ts +2 -0
- package/src/types/global.ts +14 -5
- package/src/types/model.ts +2 -4
- package/src/types/view.ts +21 -3
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const types_index = require('./shared/core.
|
|
3
|
+
const types_index = require('./shared/core.zN6ZscFQ.cjs');
|
|
4
4
|
const defu = require('defu');
|
|
5
5
|
|
|
6
6
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
@@ -408,7 +408,11 @@ function $rules(...rules) {
|
|
|
408
408
|
return (b) => rules.reduce((b2, rule) => rule(b2), b);
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [],
|
|
411
|
+
function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _views = /* @__PURE__ */ new Map(), _globals = {
|
|
412
|
+
predicates: {},
|
|
413
|
+
dynamicPredicates: {},
|
|
414
|
+
styles: {}
|
|
415
|
+
}) {
|
|
412
416
|
const toLikeC4Specification = () => ({
|
|
413
417
|
tags: spec.tags ?? [],
|
|
414
418
|
elements: {
|
|
@@ -467,8 +471,8 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
|
|
|
467
471
|
structuredClone(spec),
|
|
468
472
|
structuredClone(_elements),
|
|
469
473
|
structuredClone(_relations),
|
|
470
|
-
structuredClone(
|
|
471
|
-
structuredClone(
|
|
474
|
+
structuredClone(_views),
|
|
475
|
+
structuredClone(_globals)
|
|
472
476
|
),
|
|
473
477
|
__model: () => ({
|
|
474
478
|
addElement: (element) => {
|
|
@@ -523,9 +527,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
|
|
|
523
527
|
specification: toLikeC4Specification(),
|
|
524
528
|
elements: n(Array.from(_elements.entries())),
|
|
525
529
|
relations: l$1(_relations, (r) => [r.id, r]),
|
|
526
|
-
globals:
|
|
527
|
-
styles: l$1(_globals.styles, (s) => [s.id, s])
|
|
528
|
-
},
|
|
530
|
+
globals: structuredClone(_globals),
|
|
529
531
|
views: n(Array.from(_views.entries()))
|
|
530
532
|
}),
|
|
531
533
|
helpers: () => ({
|
|
@@ -5400,6 +5402,7 @@ exports.isStepEdgeId = types_index.isStepEdgeId;
|
|
|
5400
5402
|
exports.isTagEqual = types_index.isTagEqual;
|
|
5401
5403
|
exports.isThemeColor = types_index.isThemeColor;
|
|
5402
5404
|
exports.isViewRuleAutoLayout = types_index.isViewRuleAutoLayout;
|
|
5405
|
+
exports.isViewRuleGlobalPredicateRef = types_index.isViewRuleGlobalPredicateRef;
|
|
5403
5406
|
exports.isViewRuleGlobalStyle = types_index.isViewRuleGlobalStyle;
|
|
5404
5407
|
exports.isViewRuleGroup = types_index.isViewRuleGroup;
|
|
5405
5408
|
exports.isViewRulePredicate = types_index.isViewRulePredicate;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IfNever, TupleToUnion, Tagged, Simplify, LiteralUnion, Class, IsNumericLiteral } from 'type-fest';
|
|
2
|
-
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.
|
|
3
|
-
export {
|
|
2
|
+
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.gZyGTUZz.cjs';
|
|
3
|
+
export { aG as AndOperator, G as AsFqn, bF as BBox, bc as BasicElementView, bb as BasicView, J as BorderStyles, aS as ColorLiteral, bC as ComputedDynamicView, bB as ComputedElementView, y as CustomColor, bo as CustomColorDefinitions, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, 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, w as Expr, be as ExtendsElementView, aL as Filterable, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, aY as LikeC4Theme, U as Link, ay as ModelGlobals, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, aA as TagEqual, S as TagSpec, aR as ThemeColor, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, 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.cjs';
|
|
4
4
|
|
|
5
5
|
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
6
6
|
type BuilderSpecification = {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IfNever, TupleToUnion, Tagged, Simplify, LiteralUnion, Class, IsNumericLiteral } from 'type-fest';
|
|
2
|
-
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.
|
|
3
|
-
export {
|
|
2
|
+
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.gZyGTUZz.mjs';
|
|
3
|
+
export { aG as AndOperator, G as AsFqn, bF as BBox, bc as BasicElementView, bb as BasicView, J as BorderStyles, aS as ColorLiteral, bC as ComputedDynamicView, bB as ComputedElementView, y as CustomColor, bo as CustomColorDefinitions, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, 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, w as Expr, be as ExtendsElementView, aL as Filterable, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, aY as LikeC4Theme, U as Link, ay as ModelGlobals, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, aA as TagEqual, S as TagSpec, aR as ThemeColor, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, 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.mjs';
|
|
4
4
|
|
|
5
5
|
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
6
6
|
type BuilderSpecification = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IfNever, TupleToUnion, Tagged, Simplify, LiteralUnion, Class, IsNumericLiteral } from 'type-fest';
|
|
2
|
-
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.
|
|
3
|
-
export {
|
|
2
|
+
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.gZyGTUZz.js';
|
|
3
|
+
export { aG as AndOperator, G as AsFqn, bF as BBox, bc as BasicElementView, bb as BasicView, J as BorderStyles, aS as ColorLiteral, bC as ComputedDynamicView, bB as ComputedElementView, y as CustomColor, bo as CustomColorDefinitions, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, 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, w as Expr, be as ExtendsElementView, aL as Filterable, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, aY as LikeC4Theme, U as Link, ay as ModelGlobals, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, aA as TagEqual, S as TagSpec, aR as ThemeColor, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, 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';
|
|
4
4
|
|
|
5
5
|
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
6
6
|
type BuilderSpecification = {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as u$2, i as isElementPredicateExpr, n as n$2, a as invariant, b as isScopedElementView, D as DefaultThemeColor, c as DefaultElementShape, e, d as nonNullable, f as DefaultRelationshipColor } from './shared/core.
|
|
2
|
-
export { A as AsFqn, B as BorderStyles,
|
|
1
|
+
import { u as u$2, i as isElementPredicateExpr, n as n$2, a as invariant, b as isScopedElementView, D as DefaultThemeColor, c as DefaultElementShape, e, d as nonNullable, f as DefaultRelationshipColor } from './shared/core.v5DxGcX6.mjs';
|
|
2
|
+
export { A as AsFqn, B as BorderStyles, a3 as ComputedNode, N as DefaultArrowType, M as DefaultLineStyle, a7 as DiagramNode, E as ElementKind, j as ElementShapes, g as Expr, $ as StepEdgeId, a1 as extractStep, a6 as getBBoxCenter, a2 as getParallelStepsPrefix, J as isAndOperator, T as isAutoLayoutDirection, a4 as isComputedDynamicView, a5 as isComputedElementView, m as isCustomElement, C as isCustomRelationExpr, Y as isDynamicView, W as isDynamicViewIncludeRule, X as isDynamicViewParallelSteps, r as isElement, p as isElementKindExpr, k as isElementRef, q as isElementTagExpr, Z as isElementView, s as isElementWhere, l as isExpandedElementExpr, _ as isExtendsElementView, v as isInOut, w as isIncoming, H as isKindEqual, I as isNotOperator, K as isOrOperator, x as isOutgoing, t as isRelation, y as isRelationExpression, F as isRelationPredicateExpr, z as isRelationWhere, a0 as isStepEdgeId, G as isTagEqual, O as isThemeColor, U as isViewRuleAutoLayout, Q as isViewRuleGlobalPredicateRef, S as isViewRuleGlobalStyle, V as isViewRuleGroup, P as isViewRulePredicate, R as isViewRuleStyle, o as isWildcard, h as nonexhaustive, L as whereOperatorAsPredicate } from './shared/core.v5DxGcX6.mjs';
|
|
3
3
|
import defu from 'defu';
|
|
4
4
|
|
|
5
5
|
function d$1(...e){return u$2(a,e,o$3)}var a=(e,n)=>e.length<n.length?e.map((t,r)=>[t,n[r]]):n.map((t,r)=>[e[r],t]),o$3=e=>(n,t)=>({hasNext:!0,next:[n,e[t]],done:t>=e.length-1});
|
|
@@ -403,7 +403,11 @@ function $rules(...rules) {
|
|
|
403
403
|
return (b) => rules.reduce((b2, rule) => rule(b2), b);
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [],
|
|
406
|
+
function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _views = /* @__PURE__ */ new Map(), _globals = {
|
|
407
|
+
predicates: {},
|
|
408
|
+
dynamicPredicates: {},
|
|
409
|
+
styles: {}
|
|
410
|
+
}) {
|
|
407
411
|
const toLikeC4Specification = () => ({
|
|
408
412
|
tags: spec.tags ?? [],
|
|
409
413
|
elements: {
|
|
@@ -462,8 +466,8 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
|
|
|
462
466
|
structuredClone(spec),
|
|
463
467
|
structuredClone(_elements),
|
|
464
468
|
structuredClone(_relations),
|
|
465
|
-
structuredClone(
|
|
466
|
-
structuredClone(
|
|
469
|
+
structuredClone(_views),
|
|
470
|
+
structuredClone(_globals)
|
|
467
471
|
),
|
|
468
472
|
__model: () => ({
|
|
469
473
|
addElement: (element) => {
|
|
@@ -518,9 +522,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
|
|
|
518
522
|
specification: toLikeC4Specification(),
|
|
519
523
|
elements: n(Array.from(_elements.entries())),
|
|
520
524
|
relations: l$1(_relations, (r) => [r.id, r]),
|
|
521
|
-
globals:
|
|
522
|
-
styles: l$1(_globals.styles, (s) => [s.id, s])
|
|
523
|
-
},
|
|
525
|
+
globals: structuredClone(_globals),
|
|
524
526
|
views: n(Array.from(_views.entries()))
|
|
525
527
|
}),
|
|
526
528
|
helpers: () => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tagged, LiteralUnion, TupleToUnion } from 'type-fest';
|
|
1
|
+
import { Tagged, LiteralUnion, TupleToUnion, NonEmptyTuple } from 'type-fest';
|
|
2
2
|
|
|
3
3
|
type NonEmptyArray<T> = [T, ...T[]];
|
|
4
4
|
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
@@ -142,10 +142,15 @@ type Filterable<FTag extends string = string, FKind extends string = string> = {
|
|
|
142
142
|
type OperatorPredicate<V extends Filterable> = (value: V) => boolean;
|
|
143
143
|
declare function whereOperatorAsPredicate<FTag extends string = string, FKind extends string = string>(operator: WhereOperator<FTag, FKind>): OperatorPredicate<Filterable<FTag, FKind>>;
|
|
144
144
|
|
|
145
|
+
type GlobalPredicateId = Tagged<string, 'GlobalPredicateId'>;
|
|
146
|
+
type GlobalPredicates = NonEmptyArray<ViewRulePredicate>;
|
|
147
|
+
type GlobalDynamicPredicates = NonEmptyArray<DynamicViewIncludeRule>;
|
|
145
148
|
type GlobalStyleID = Tagged<string, 'GlobalStyleID'>;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
type GlobalStyles = NonEmptyTuple<ViewRuleStyle>;
|
|
150
|
+
interface ModelGlobals {
|
|
151
|
+
predicates: Record<GlobalPredicateId, GlobalPredicates>;
|
|
152
|
+
dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates>;
|
|
153
|
+
styles: Record<GlobalStyleID, GlobalStyles>;
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
type ElementNotation = {
|
|
@@ -164,6 +169,10 @@ type ViewRulePredicate = {
|
|
|
164
169
|
exclude: Expression[];
|
|
165
170
|
};
|
|
166
171
|
declare function isViewRulePredicate(rule: ViewRule): rule is ViewRulePredicate;
|
|
172
|
+
interface ViewRuleGlobalPredicateRef {
|
|
173
|
+
predicateId: GlobalPredicateId;
|
|
174
|
+
}
|
|
175
|
+
declare function isViewRuleGlobalPredicateRef(rule: ViewRule): rule is ViewRuleGlobalPredicateRef;
|
|
167
176
|
interface ViewRuleStyle {
|
|
168
177
|
targets: ElementExpression[];
|
|
169
178
|
notation?: string;
|
|
@@ -195,7 +204,7 @@ interface ViewRuleGroup {
|
|
|
195
204
|
opacity?: number;
|
|
196
205
|
}
|
|
197
206
|
declare function isViewRuleGroup(rule: ViewRule): rule is ViewRuleGroup;
|
|
198
|
-
type ViewRule = ViewRulePredicate | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
207
|
+
type ViewRule = ViewRulePredicate | ViewRuleGlobalPredicateRef | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
199
208
|
interface BasicView<ViewType extends 'element' | 'dynamic', ViewIDs extends string, Tags extends string> {
|
|
200
209
|
readonly __?: ViewType;
|
|
201
210
|
readonly id: ViewID<ViewIDs>;
|
|
@@ -258,7 +267,7 @@ type DynamicViewIncludeRule = {
|
|
|
258
267
|
include: ElementPredicateExpression[];
|
|
259
268
|
};
|
|
260
269
|
declare function isDynamicViewIncludeRule(rule: DynamicViewRule): rule is DynamicViewIncludeRule;
|
|
261
|
-
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
270
|
+
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleGlobalPredicateRef | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
262
271
|
interface DynamicView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<'dynamic', ViewIDs, Tags> {
|
|
263
272
|
readonly __: 'dynamic';
|
|
264
273
|
readonly steps: DynamicViewStepOrParallel[];
|
|
@@ -639,9 +648,7 @@ interface ParsedLikeC4Model<ElementKinds extends string = string, RelationKinds
|
|
|
639
648
|
};
|
|
640
649
|
elements: Record<Fqns, TypedElement<Fqns, ElementKinds, Tags>>;
|
|
641
650
|
relations: Record<RelationID, Relation>;
|
|
642
|
-
globals:
|
|
643
|
-
styles: Record<GlobalStyleID, GlobalStyle>;
|
|
644
|
-
};
|
|
651
|
+
globals: ModelGlobals;
|
|
645
652
|
views: Record<Views, LikeC4View<Views, Tags>>;
|
|
646
653
|
}
|
|
647
654
|
/**
|
|
@@ -724,4 +731,4 @@ declare namespace ViewChange {
|
|
|
724
731
|
}
|
|
725
732
|
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
|
|
726
733
|
|
|
727
|
-
export { type ExpandedElementExpr as $, type AutoLayoutDirection as A, type BorderStyle as B, type Color as C, type DiagramView as D, type ElementKindSpecification as E, type Fqn as F, AsFqn as G, type HexColorLiteral as H, type IconUrl as I, BorderStyles as J, ElementShapes as K, type LikeC4View as L, DefaultThemeColor as M, type NonEmptyArray as N, DefaultElementShape as O, type ParsedLikeC4Model as P, type ElementStyle as Q, type RelationshipKindSpecification as R, type TagSpec as S, type ThemeColorValues as T, type Link as U, type ViewRuleStyle as V, type TypedElement as W, type XYPoint as X, type ElementKindSpecificationStyle as Y, type ElementRefExpr as Z, isElementRef as _, type ElementShape as a,
|
|
734
|
+
export { type ExpandedElementExpr as $, type AutoLayoutDirection as A, type BorderStyle as B, type Color as C, type DiagramView as D, type ElementKindSpecification as E, type Fqn as F, AsFqn as G, type HexColorLiteral as H, type IconUrl as I, BorderStyles as J, ElementShapes as K, type LikeC4View as L, DefaultThemeColor as M, type NonEmptyArray as N, DefaultElementShape as O, type ParsedLikeC4Model as P, type ElementStyle as Q, type RelationshipKindSpecification as R, type TagSpec as S, type ThemeColorValues as T, type Link as U, type ViewRuleStyle as V, type TypedElement as W, type XYPoint as X, type ElementKindSpecificationStyle as Y, type ElementRefExpr as Z, isElementRef as _, type ElementShape as a, type ViewRuleGlobalPredicateRef as a$, isExpandedElementExpr as a0, isCustomElement as a1, type WildcardExpr as a2, isWildcard as a3, type ElementKindExpr as a4, isElementKindExpr as a5, type ElementTagExpr as a6, isElementTagExpr as a7, type ElementExpression as a8, isElement as a9, type TagEqual as aA, isTagEqual as aB, type KindEqual as aC, isKindEqual as aD, type NotOperator as aE, isNotOperator as aF, type AndOperator as aG, isAndOperator as aH, type OrOperator as aI, isOrOperator as aJ, type WhereOperator as aK, type Filterable as aL, whereOperatorAsPredicate as aM, OverviewGraph as aN, DefaultLineStyle as aO, DefaultArrowType as aP, DefaultRelationshipColor as aQ, type ThemeColor as aR, type ColorLiteral as aS, isThemeColor as aT, type ElementThemeColorValues as aU, type ElementThemeColors as aV, type RelationshipThemeColorValues as aW, type RelationshipThemeColors as aX, type LikeC4Theme as aY, type ViewRulePredicate as aZ, isViewRulePredicate as a_, type ElementWhereExpr as aa, isElementWhere as ab, type ElementPredicateExpression as ac, isElementPredicateExpr as ad, type RelationExpr as ae, isRelation as af, type InOutExpr as ag, isInOut as ah, type IncomingExpr as ai, isIncoming as aj, type OutgoingExpr as ak, isOutgoing as al, type RelationExpression as am, isRelationExpression as an, type RelationWhereExpr as ao, isRelationWhere as ap, isCustomRelationExpr as aq, type RelationPredicateExpression as ar, isRelationPredicateExpr as as, type GlobalPredicateId as at, type GlobalPredicates as au, type GlobalDynamicPredicates as av, type GlobalStyleID as aw, type GlobalStyles as ax, type ModelGlobals as ay, type EqualOperator as az, type RelationshipArrowType as b, isViewRuleGlobalPredicateRef as b0, isViewRuleStyle as b1, type ViewRuleGlobalStyle as b2, isViewRuleGlobalStyle as b3, type ViewRuleStyleOrGlobalRef as b4, isAutoLayoutDirection as b5, type ViewRuleAutoLayout as b6, isViewRuleAutoLayout as b7, type ViewRuleGroup as b8, isViewRuleGroup as b9, type ViewAutoLayout as bA, type ComputedElementView as bB, type ComputedDynamicView as bC, isComputedDynamicView as bD, isComputedElementView as bE, type BBox as bF, getBBoxCenter as bG, type ViewManualLayout as bH, ViewChange as bI, type ElementNotation as bJ, type ViewRule as ba, type BasicView as bb, type BasicElementView as bc, type ScopedElementView as bd, type ExtendsElementView as be, type ElementView as bf, type DynamicViewStep as bg, type DynamicViewParallelSteps as bh, type DynamicViewStepOrParallel as bi, type DynamicViewIncludeRule as bj, isDynamicViewIncludeRule as bk, type DynamicViewRule as bl, type DynamicView as bm, isDynamicViewParallelSteps as bn, type CustomColorDefinitions as bo, isDynamicView as bp, isElementView as bq, isExtendsElementView as br, isScopedElementView as bs, type StepEdgeIdLiteral as bt, StepEdgeId as bu, isStepEdgeId as bv, extractStep as bw, getParallelStepsPrefix as bx, type ViewWithHash as by, type ViewWithNotation as bz, type RelationshipLineType as c, type Element as d, type Relation as e, type Expression as f, type CustomElementExpr as g, type CustomRelationExpr as h, type RelationID as i, type ViewID as j, type EdgeId as k, type ComputedView as l, type Tag as m, ComputedNode as n, type NodeId as o, ElementKind as p, type ComputedEdge as q, type ComputedLikeC4Model as r, type LayoutedLikeC4Model as s, type RelationshipKind as t, DiagramNode as u, type DiagramEdge as v, expression as w, type NonEmptyReadonlyArray as x, type CustomColor as y, type Point as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tagged, LiteralUnion, TupleToUnion } from 'type-fest';
|
|
1
|
+
import { Tagged, LiteralUnion, TupleToUnion, NonEmptyTuple } from 'type-fest';
|
|
2
2
|
|
|
3
3
|
type NonEmptyArray<T> = [T, ...T[]];
|
|
4
4
|
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
@@ -142,10 +142,15 @@ type Filterable<FTag extends string = string, FKind extends string = string> = {
|
|
|
142
142
|
type OperatorPredicate<V extends Filterable> = (value: V) => boolean;
|
|
143
143
|
declare function whereOperatorAsPredicate<FTag extends string = string, FKind extends string = string>(operator: WhereOperator<FTag, FKind>): OperatorPredicate<Filterable<FTag, FKind>>;
|
|
144
144
|
|
|
145
|
+
type GlobalPredicateId = Tagged<string, 'GlobalPredicateId'>;
|
|
146
|
+
type GlobalPredicates = NonEmptyArray<ViewRulePredicate>;
|
|
147
|
+
type GlobalDynamicPredicates = NonEmptyArray<DynamicViewIncludeRule>;
|
|
145
148
|
type GlobalStyleID = Tagged<string, 'GlobalStyleID'>;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
type GlobalStyles = NonEmptyTuple<ViewRuleStyle>;
|
|
150
|
+
interface ModelGlobals {
|
|
151
|
+
predicates: Record<GlobalPredicateId, GlobalPredicates>;
|
|
152
|
+
dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates>;
|
|
153
|
+
styles: Record<GlobalStyleID, GlobalStyles>;
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
type ElementNotation = {
|
|
@@ -164,6 +169,10 @@ type ViewRulePredicate = {
|
|
|
164
169
|
exclude: Expression[];
|
|
165
170
|
};
|
|
166
171
|
declare function isViewRulePredicate(rule: ViewRule): rule is ViewRulePredicate;
|
|
172
|
+
interface ViewRuleGlobalPredicateRef {
|
|
173
|
+
predicateId: GlobalPredicateId;
|
|
174
|
+
}
|
|
175
|
+
declare function isViewRuleGlobalPredicateRef(rule: ViewRule): rule is ViewRuleGlobalPredicateRef;
|
|
167
176
|
interface ViewRuleStyle {
|
|
168
177
|
targets: ElementExpression[];
|
|
169
178
|
notation?: string;
|
|
@@ -195,7 +204,7 @@ interface ViewRuleGroup {
|
|
|
195
204
|
opacity?: number;
|
|
196
205
|
}
|
|
197
206
|
declare function isViewRuleGroup(rule: ViewRule): rule is ViewRuleGroup;
|
|
198
|
-
type ViewRule = ViewRulePredicate | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
207
|
+
type ViewRule = ViewRulePredicate | ViewRuleGlobalPredicateRef | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
199
208
|
interface BasicView<ViewType extends 'element' | 'dynamic', ViewIDs extends string, Tags extends string> {
|
|
200
209
|
readonly __?: ViewType;
|
|
201
210
|
readonly id: ViewID<ViewIDs>;
|
|
@@ -258,7 +267,7 @@ type DynamicViewIncludeRule = {
|
|
|
258
267
|
include: ElementPredicateExpression[];
|
|
259
268
|
};
|
|
260
269
|
declare function isDynamicViewIncludeRule(rule: DynamicViewRule): rule is DynamicViewIncludeRule;
|
|
261
|
-
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
270
|
+
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleGlobalPredicateRef | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
262
271
|
interface DynamicView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<'dynamic', ViewIDs, Tags> {
|
|
263
272
|
readonly __: 'dynamic';
|
|
264
273
|
readonly steps: DynamicViewStepOrParallel[];
|
|
@@ -639,9 +648,7 @@ interface ParsedLikeC4Model<ElementKinds extends string = string, RelationKinds
|
|
|
639
648
|
};
|
|
640
649
|
elements: Record<Fqns, TypedElement<Fqns, ElementKinds, Tags>>;
|
|
641
650
|
relations: Record<RelationID, Relation>;
|
|
642
|
-
globals:
|
|
643
|
-
styles: Record<GlobalStyleID, GlobalStyle>;
|
|
644
|
-
};
|
|
651
|
+
globals: ModelGlobals;
|
|
645
652
|
views: Record<Views, LikeC4View<Views, Tags>>;
|
|
646
653
|
}
|
|
647
654
|
/**
|
|
@@ -724,4 +731,4 @@ declare namespace ViewChange {
|
|
|
724
731
|
}
|
|
725
732
|
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
|
|
726
733
|
|
|
727
|
-
export { type ExpandedElementExpr as $, type AutoLayoutDirection as A, type BorderStyle as B, type Color as C, type DiagramView as D, type ElementKindSpecification as E, type Fqn as F, AsFqn as G, type HexColorLiteral as H, type IconUrl as I, BorderStyles as J, ElementShapes as K, type LikeC4View as L, DefaultThemeColor as M, type NonEmptyArray as N, DefaultElementShape as O, type ParsedLikeC4Model as P, type ElementStyle as Q, type RelationshipKindSpecification as R, type TagSpec as S, type ThemeColorValues as T, type Link as U, type ViewRuleStyle as V, type TypedElement as W, type XYPoint as X, type ElementKindSpecificationStyle as Y, type ElementRefExpr as Z, isElementRef as _, type ElementShape as a,
|
|
734
|
+
export { type ExpandedElementExpr as $, type AutoLayoutDirection as A, type BorderStyle as B, type Color as C, type DiagramView as D, type ElementKindSpecification as E, type Fqn as F, AsFqn as G, type HexColorLiteral as H, type IconUrl as I, BorderStyles as J, ElementShapes as K, type LikeC4View as L, DefaultThemeColor as M, type NonEmptyArray as N, DefaultElementShape as O, type ParsedLikeC4Model as P, type ElementStyle as Q, type RelationshipKindSpecification as R, type TagSpec as S, type ThemeColorValues as T, type Link as U, type ViewRuleStyle as V, type TypedElement as W, type XYPoint as X, type ElementKindSpecificationStyle as Y, type ElementRefExpr as Z, isElementRef as _, type ElementShape as a, type ViewRuleGlobalPredicateRef as a$, isExpandedElementExpr as a0, isCustomElement as a1, type WildcardExpr as a2, isWildcard as a3, type ElementKindExpr as a4, isElementKindExpr as a5, type ElementTagExpr as a6, isElementTagExpr as a7, type ElementExpression as a8, isElement as a9, type TagEqual as aA, isTagEqual as aB, type KindEqual as aC, isKindEqual as aD, type NotOperator as aE, isNotOperator as aF, type AndOperator as aG, isAndOperator as aH, type OrOperator as aI, isOrOperator as aJ, type WhereOperator as aK, type Filterable as aL, whereOperatorAsPredicate as aM, OverviewGraph as aN, DefaultLineStyle as aO, DefaultArrowType as aP, DefaultRelationshipColor as aQ, type ThemeColor as aR, type ColorLiteral as aS, isThemeColor as aT, type ElementThemeColorValues as aU, type ElementThemeColors as aV, type RelationshipThemeColorValues as aW, type RelationshipThemeColors as aX, type LikeC4Theme as aY, type ViewRulePredicate as aZ, isViewRulePredicate as a_, type ElementWhereExpr as aa, isElementWhere as ab, type ElementPredicateExpression as ac, isElementPredicateExpr as ad, type RelationExpr as ae, isRelation as af, type InOutExpr as ag, isInOut as ah, type IncomingExpr as ai, isIncoming as aj, type OutgoingExpr as ak, isOutgoing as al, type RelationExpression as am, isRelationExpression as an, type RelationWhereExpr as ao, isRelationWhere as ap, isCustomRelationExpr as aq, type RelationPredicateExpression as ar, isRelationPredicateExpr as as, type GlobalPredicateId as at, type GlobalPredicates as au, type GlobalDynamicPredicates as av, type GlobalStyleID as aw, type GlobalStyles as ax, type ModelGlobals as ay, type EqualOperator as az, type RelationshipArrowType as b, isViewRuleGlobalPredicateRef as b0, isViewRuleStyle as b1, type ViewRuleGlobalStyle as b2, isViewRuleGlobalStyle as b3, type ViewRuleStyleOrGlobalRef as b4, isAutoLayoutDirection as b5, type ViewRuleAutoLayout as b6, isViewRuleAutoLayout as b7, type ViewRuleGroup as b8, isViewRuleGroup as b9, type ViewAutoLayout as bA, type ComputedElementView as bB, type ComputedDynamicView as bC, isComputedDynamicView as bD, isComputedElementView as bE, type BBox as bF, getBBoxCenter as bG, type ViewManualLayout as bH, ViewChange as bI, type ElementNotation as bJ, type ViewRule as ba, type BasicView as bb, type BasicElementView as bc, type ScopedElementView as bd, type ExtendsElementView as be, type ElementView as bf, type DynamicViewStep as bg, type DynamicViewParallelSteps as bh, type DynamicViewStepOrParallel as bi, type DynamicViewIncludeRule as bj, isDynamicViewIncludeRule as bk, type DynamicViewRule as bl, type DynamicView as bm, isDynamicViewParallelSteps as bn, type CustomColorDefinitions as bo, isDynamicView as bp, isElementView as bq, isExtendsElementView as br, isScopedElementView as bs, type StepEdgeIdLiteral as bt, StepEdgeId as bu, isStepEdgeId as bv, extractStep as bw, getParallelStepsPrefix as bx, type ViewWithHash as by, type ViewWithNotation as bz, type RelationshipLineType as c, type Element as d, type Relation as e, type Expression as f, type CustomElementExpr as g, type CustomRelationExpr as h, type RelationID as i, type ViewID as j, type EdgeId as k, type ComputedView as l, type Tag as m, ComputedNode as n, type NodeId as o, ElementKind as p, type ComputedEdge as q, type ComputedLikeC4Model as r, type LayoutedLikeC4Model as s, type RelationshipKind as t, DiagramNode as u, type DiagramEdge as v, expression as w, type NonEmptyReadonlyArray as x, type CustomColor as y, type Point as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tagged, LiteralUnion, TupleToUnion } from 'type-fest';
|
|
1
|
+
import { Tagged, LiteralUnion, TupleToUnion, NonEmptyTuple } from 'type-fest';
|
|
2
2
|
|
|
3
3
|
type NonEmptyArray<T> = [T, ...T[]];
|
|
4
4
|
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
@@ -142,10 +142,15 @@ type Filterable<FTag extends string = string, FKind extends string = string> = {
|
|
|
142
142
|
type OperatorPredicate<V extends Filterable> = (value: V) => boolean;
|
|
143
143
|
declare function whereOperatorAsPredicate<FTag extends string = string, FKind extends string = string>(operator: WhereOperator<FTag, FKind>): OperatorPredicate<Filterable<FTag, FKind>>;
|
|
144
144
|
|
|
145
|
+
type GlobalPredicateId = Tagged<string, 'GlobalPredicateId'>;
|
|
146
|
+
type GlobalPredicates = NonEmptyArray<ViewRulePredicate>;
|
|
147
|
+
type GlobalDynamicPredicates = NonEmptyArray<DynamicViewIncludeRule>;
|
|
145
148
|
type GlobalStyleID = Tagged<string, 'GlobalStyleID'>;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
type GlobalStyles = NonEmptyTuple<ViewRuleStyle>;
|
|
150
|
+
interface ModelGlobals {
|
|
151
|
+
predicates: Record<GlobalPredicateId, GlobalPredicates>;
|
|
152
|
+
dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates>;
|
|
153
|
+
styles: Record<GlobalStyleID, GlobalStyles>;
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
type ElementNotation = {
|
|
@@ -164,6 +169,10 @@ type ViewRulePredicate = {
|
|
|
164
169
|
exclude: Expression[];
|
|
165
170
|
};
|
|
166
171
|
declare function isViewRulePredicate(rule: ViewRule): rule is ViewRulePredicate;
|
|
172
|
+
interface ViewRuleGlobalPredicateRef {
|
|
173
|
+
predicateId: GlobalPredicateId;
|
|
174
|
+
}
|
|
175
|
+
declare function isViewRuleGlobalPredicateRef(rule: ViewRule): rule is ViewRuleGlobalPredicateRef;
|
|
167
176
|
interface ViewRuleStyle {
|
|
168
177
|
targets: ElementExpression[];
|
|
169
178
|
notation?: string;
|
|
@@ -195,7 +204,7 @@ interface ViewRuleGroup {
|
|
|
195
204
|
opacity?: number;
|
|
196
205
|
}
|
|
197
206
|
declare function isViewRuleGroup(rule: ViewRule): rule is ViewRuleGroup;
|
|
198
|
-
type ViewRule = ViewRulePredicate | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
207
|
+
type ViewRule = ViewRulePredicate | ViewRuleGlobalPredicateRef | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
199
208
|
interface BasicView<ViewType extends 'element' | 'dynamic', ViewIDs extends string, Tags extends string> {
|
|
200
209
|
readonly __?: ViewType;
|
|
201
210
|
readonly id: ViewID<ViewIDs>;
|
|
@@ -258,7 +267,7 @@ type DynamicViewIncludeRule = {
|
|
|
258
267
|
include: ElementPredicateExpression[];
|
|
259
268
|
};
|
|
260
269
|
declare function isDynamicViewIncludeRule(rule: DynamicViewRule): rule is DynamicViewIncludeRule;
|
|
261
|
-
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
270
|
+
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleGlobalPredicateRef | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
262
271
|
interface DynamicView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<'dynamic', ViewIDs, Tags> {
|
|
263
272
|
readonly __: 'dynamic';
|
|
264
273
|
readonly steps: DynamicViewStepOrParallel[];
|
|
@@ -639,9 +648,7 @@ interface ParsedLikeC4Model<ElementKinds extends string = string, RelationKinds
|
|
|
639
648
|
};
|
|
640
649
|
elements: Record<Fqns, TypedElement<Fqns, ElementKinds, Tags>>;
|
|
641
650
|
relations: Record<RelationID, Relation>;
|
|
642
|
-
globals:
|
|
643
|
-
styles: Record<GlobalStyleID, GlobalStyle>;
|
|
644
|
-
};
|
|
651
|
+
globals: ModelGlobals;
|
|
645
652
|
views: Record<Views, LikeC4View<Views, Tags>>;
|
|
646
653
|
}
|
|
647
654
|
/**
|
|
@@ -724,4 +731,4 @@ declare namespace ViewChange {
|
|
|
724
731
|
}
|
|
725
732
|
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
|
|
726
733
|
|
|
727
|
-
export { type ExpandedElementExpr as $, type AutoLayoutDirection as A, type BorderStyle as B, type Color as C, type DiagramView as D, type ElementKindSpecification as E, type Fqn as F, AsFqn as G, type HexColorLiteral as H, type IconUrl as I, BorderStyles as J, ElementShapes as K, type LikeC4View as L, DefaultThemeColor as M, type NonEmptyArray as N, DefaultElementShape as O, type ParsedLikeC4Model as P, type ElementStyle as Q, type RelationshipKindSpecification as R, type TagSpec as S, type ThemeColorValues as T, type Link as U, type ViewRuleStyle as V, type TypedElement as W, type XYPoint as X, type ElementKindSpecificationStyle as Y, type ElementRefExpr as Z, isElementRef as _, type ElementShape as a,
|
|
734
|
+
export { type ExpandedElementExpr as $, type AutoLayoutDirection as A, type BorderStyle as B, type Color as C, type DiagramView as D, type ElementKindSpecification as E, type Fqn as F, AsFqn as G, type HexColorLiteral as H, type IconUrl as I, BorderStyles as J, ElementShapes as K, type LikeC4View as L, DefaultThemeColor as M, type NonEmptyArray as N, DefaultElementShape as O, type ParsedLikeC4Model as P, type ElementStyle as Q, type RelationshipKindSpecification as R, type TagSpec as S, type ThemeColorValues as T, type Link as U, type ViewRuleStyle as V, type TypedElement as W, type XYPoint as X, type ElementKindSpecificationStyle as Y, type ElementRefExpr as Z, isElementRef as _, type ElementShape as a, type ViewRuleGlobalPredicateRef as a$, isExpandedElementExpr as a0, isCustomElement as a1, type WildcardExpr as a2, isWildcard as a3, type ElementKindExpr as a4, isElementKindExpr as a5, type ElementTagExpr as a6, isElementTagExpr as a7, type ElementExpression as a8, isElement as a9, type TagEqual as aA, isTagEqual as aB, type KindEqual as aC, isKindEqual as aD, type NotOperator as aE, isNotOperator as aF, type AndOperator as aG, isAndOperator as aH, type OrOperator as aI, isOrOperator as aJ, type WhereOperator as aK, type Filterable as aL, whereOperatorAsPredicate as aM, OverviewGraph as aN, DefaultLineStyle as aO, DefaultArrowType as aP, DefaultRelationshipColor as aQ, type ThemeColor as aR, type ColorLiteral as aS, isThemeColor as aT, type ElementThemeColorValues as aU, type ElementThemeColors as aV, type RelationshipThemeColorValues as aW, type RelationshipThemeColors as aX, type LikeC4Theme as aY, type ViewRulePredicate as aZ, isViewRulePredicate as a_, type ElementWhereExpr as aa, isElementWhere as ab, type ElementPredicateExpression as ac, isElementPredicateExpr as ad, type RelationExpr as ae, isRelation as af, type InOutExpr as ag, isInOut as ah, type IncomingExpr as ai, isIncoming as aj, type OutgoingExpr as ak, isOutgoing as al, type RelationExpression as am, isRelationExpression as an, type RelationWhereExpr as ao, isRelationWhere as ap, isCustomRelationExpr as aq, type RelationPredicateExpression as ar, isRelationPredicateExpr as as, type GlobalPredicateId as at, type GlobalPredicates as au, type GlobalDynamicPredicates as av, type GlobalStyleID as aw, type GlobalStyles as ax, type ModelGlobals as ay, type EqualOperator as az, type RelationshipArrowType as b, isViewRuleGlobalPredicateRef as b0, isViewRuleStyle as b1, type ViewRuleGlobalStyle as b2, isViewRuleGlobalStyle as b3, type ViewRuleStyleOrGlobalRef as b4, isAutoLayoutDirection as b5, type ViewRuleAutoLayout as b6, isViewRuleAutoLayout as b7, type ViewRuleGroup as b8, isViewRuleGroup as b9, type ViewAutoLayout as bA, type ComputedElementView as bB, type ComputedDynamicView as bC, isComputedDynamicView as bD, isComputedElementView as bE, type BBox as bF, getBBoxCenter as bG, type ViewManualLayout as bH, ViewChange as bI, type ElementNotation as bJ, type ViewRule as ba, type BasicView as bb, type BasicElementView as bc, type ScopedElementView as bd, type ExtendsElementView as be, type ElementView as bf, type DynamicViewStep as bg, type DynamicViewParallelSteps as bh, type DynamicViewStepOrParallel as bi, type DynamicViewIncludeRule as bj, isDynamicViewIncludeRule as bk, type DynamicViewRule as bl, type DynamicView as bm, isDynamicViewParallelSteps as bn, type CustomColorDefinitions as bo, isDynamicView as bp, isElementView as bq, isExtendsElementView as br, isScopedElementView as bs, type StepEdgeIdLiteral as bt, StepEdgeId as bu, isStepEdgeId as bv, extractStep as bw, getParallelStepsPrefix as bx, type ViewWithHash as by, type ViewWithNotation as bz, type RelationshipLineType as c, type Element as d, type Relation as e, type Expression as f, type CustomElementExpr as g, type CustomRelationExpr as h, type RelationID as i, type ViewID as j, type EdgeId as k, type ComputedView as l, type Tag as m, ComputedNode as n, type NodeId as o, ElementKind as p, type ComputedEdge as q, type ComputedLikeC4Model as r, type LayoutedLikeC4Model as s, type RelationshipKind as t, DiagramNode as u, type DiagramEdge as v, expression as w, type NonEmptyReadonlyArray as x, type CustomColor as y, type Point as z };
|
|
@@ -203,6 +203,9 @@ function isThemeColor(color) {
|
|
|
203
203
|
function isViewRulePredicate(rule) {
|
|
204
204
|
return "include" in rule && Array.isArray(rule.include) || "exclude" in rule && Array.isArray(rule.exclude);
|
|
205
205
|
}
|
|
206
|
+
function isViewRuleGlobalPredicateRef(rule) {
|
|
207
|
+
return "predicateId" in rule;
|
|
208
|
+
}
|
|
206
209
|
function isViewRuleStyle(rule) {
|
|
207
210
|
return "style" in rule && "targets" in rule;
|
|
208
211
|
}
|
|
@@ -287,4 +290,4 @@ var DiagramNode;
|
|
|
287
290
|
DiagramNode2.isNodesGroup = isNodesGroup;
|
|
288
291
|
})(DiagramNode || (DiagramNode = {}));
|
|
289
292
|
|
|
290
|
-
export {
|
|
293
|
+
export { StepEdgeId as $, AsFqn as A, BorderStyles as B, isCustomRelationExpr as C, DefaultThemeColor as D, ElementKind as E, isRelationPredicateExpr as F, isTagEqual as G, isKindEqual as H, isNotOperator as I, isAndOperator as J, isOrOperator as K, whereOperatorAsPredicate as L, DefaultLineStyle as M, DefaultArrowType as N, isThemeColor as O, isViewRulePredicate as P, isViewRuleGlobalPredicateRef as Q, isViewRuleStyle as R, isViewRuleGlobalStyle as S, isAutoLayoutDirection as T, isViewRuleAutoLayout as U, isViewRuleGroup as V, isDynamicViewIncludeRule as W, isDynamicViewParallelSteps as X, isDynamicView as Y, isElementView as Z, isExtendsElementView as _, invariant as a, isStepEdgeId as a0, extractStep as a1, getParallelStepsPrefix as a2, ComputedNode as a3, isComputedDynamicView as a4, isComputedElementView as a5, getBBoxCenter as a6, DiagramNode as a7, isScopedElementView as b, DefaultElementShape as c, nonNullable as d, e$1 as e, DefaultRelationshipColor as f, expression as g, nonexhaustive as h, isElementPredicateExpr as i, ElementShapes as j, isElementRef as k, isExpandedElementExpr as l, isCustomElement as m, n, isWildcard as o, isElementKindExpr as p, isElementTagExpr as q, isElement as r, isElementWhere as s, isRelation as t, u, isInOut as v, isIncoming as w, isOutgoing as x, isRelationExpression as y, isRelationWhere as z };
|
|
@@ -205,6 +205,9 @@ function isThemeColor(color) {
|
|
|
205
205
|
function isViewRulePredicate(rule) {
|
|
206
206
|
return "include" in rule && Array.isArray(rule.include) || "exclude" in rule && Array.isArray(rule.exclude);
|
|
207
207
|
}
|
|
208
|
+
function isViewRuleGlobalPredicateRef(rule) {
|
|
209
|
+
return "predicateId" in rule;
|
|
210
|
+
}
|
|
208
211
|
function isViewRuleStyle(rule) {
|
|
209
212
|
return "style" in rule && "targets" in rule;
|
|
210
213
|
}
|
|
@@ -337,6 +340,7 @@ exports.isStepEdgeId = isStepEdgeId;
|
|
|
337
340
|
exports.isTagEqual = isTagEqual;
|
|
338
341
|
exports.isThemeColor = isThemeColor;
|
|
339
342
|
exports.isViewRuleAutoLayout = isViewRuleAutoLayout;
|
|
343
|
+
exports.isViewRuleGlobalPredicateRef = isViewRuleGlobalPredicateRef;
|
|
340
344
|
exports.isViewRuleGlobalStyle = isViewRuleGlobalStyle;
|
|
341
345
|
exports.isViewRuleGroup = isViewRuleGroup;
|
|
342
346
|
exports.isViewRulePredicate = isViewRulePredicate;
|
package/dist/types/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const types_index = require('../shared/core.
|
|
3
|
+
const types_index = require('../shared/core.zN6ZscFQ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -61,6 +61,7 @@ exports.isStepEdgeId = types_index.isStepEdgeId;
|
|
|
61
61
|
exports.isTagEqual = types_index.isTagEqual;
|
|
62
62
|
exports.isThemeColor = types_index.isThemeColor;
|
|
63
63
|
exports.isViewRuleAutoLayout = types_index.isViewRuleAutoLayout;
|
|
64
|
+
exports.isViewRuleGlobalPredicateRef = types_index.isViewRuleGlobalPredicateRef;
|
|
64
65
|
exports.isViewRuleGlobalStyle = types_index.isViewRuleGlobalStyle;
|
|
65
66
|
exports.isViewRuleGroup = types_index.isViewRuleGroup;
|
|
66
67
|
exports.isViewRulePredicate = types_index.isViewRulePredicate;
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
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.cjs';
|
|
2
2
|
import 'type-fest';
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
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.mjs';
|
|
2
2
|
import 'type-fest';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
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';
|
|
2
2
|
import 'type-fest';
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AsFqn, B as BorderStyles,
|
|
1
|
+
export { A as AsFqn, B as BorderStyles, a3 as ComputedNode, N as DefaultArrowType, c as DefaultElementShape, M as DefaultLineStyle, f as DefaultRelationshipColor, D as DefaultThemeColor, a7 as DiagramNode, E as ElementKind, j as ElementShapes, $ as StepEdgeId, a1 as extractStep, a6 as getBBoxCenter, a2 as getParallelStepsPrefix, J as isAndOperator, T as isAutoLayoutDirection, a4 as isComputedDynamicView, a5 as isComputedElementView, m as isCustomElement, C as isCustomRelationExpr, Y as isDynamicView, W as isDynamicViewIncludeRule, X as isDynamicViewParallelSteps, r as isElement, p as isElementKindExpr, i as isElementPredicateExpr, k as isElementRef, q as isElementTagExpr, Z as isElementView, s as isElementWhere, l as isExpandedElementExpr, _ as isExtendsElementView, v as isInOut, w as isIncoming, H as isKindEqual, I as isNotOperator, K as isOrOperator, x as isOutgoing, t as isRelation, y as isRelationExpression, F as isRelationPredicateExpr, z as isRelationWhere, b as isScopedElementView, a0 as isStepEdgeId, G as isTagEqual, O as isThemeColor, U as isViewRuleAutoLayout, Q as isViewRuleGlobalPredicateRef, S as isViewRuleGlobalStyle, V as isViewRuleGroup, P as isViewRulePredicate, R as isViewRuleStyle, o as isWildcard, L as whereOperatorAsPredicate } from '../shared/core.v5DxGcX6.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://likec4.dev",
|
|
6
6
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"type-fest": "4.26.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@likec4/tsconfig": "1.
|
|
83
|
+
"@likec4/tsconfig": "1.16.0",
|
|
84
84
|
"@mantine/colors-generator": "7.13.4",
|
|
85
85
|
"@types/natural-compare-lite": "^1.4.2",
|
|
86
86
|
"chroma-js": "^3.1.2",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"turbo": "^2.2.3",
|
|
91
91
|
"typescript": "^5.6.3",
|
|
92
92
|
"unbuild": "^3.0.0-rc.11",
|
|
93
|
-
"vitest": "^2.1.
|
|
93
|
+
"vitest": "^2.1.4"
|
|
94
94
|
},
|
|
95
95
|
"packageManager": "yarn@4.5.1"
|
|
96
96
|
}
|
package/src/builder/Builder.ts
CHANGED
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
type ElementShape,
|
|
11
11
|
type ElementView,
|
|
12
12
|
type Fqn,
|
|
13
|
-
type GlobalStyle,
|
|
14
13
|
type IconUrl,
|
|
15
14
|
isScopedElementView,
|
|
16
15
|
type LikeC4View,
|
|
17
16
|
type Link,
|
|
17
|
+
type ModelGlobals,
|
|
18
18
|
type NonEmptyArray,
|
|
19
19
|
type Relation,
|
|
20
20
|
type RelationID,
|
|
@@ -220,10 +220,12 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
|
|
|
220
220
|
spec: Spec,
|
|
221
221
|
_elements = new Map<string, Element>(),
|
|
222
222
|
_relations = [] as Relation[],
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
_views = new Map<string, LikeC4View>(),
|
|
224
|
+
_globals = {
|
|
225
|
+
predicates: {},
|
|
226
|
+
dynamicPredicates: {},
|
|
227
|
+
styles: {}
|
|
228
|
+
} as ModelGlobals
|
|
227
229
|
): Builder<T> {
|
|
228
230
|
const toLikeC4Specification = (): Types.ToParsedLikeC4Model<T>['specification'] => ({
|
|
229
231
|
tags: (spec.tags ?? []) as Tag<T['Tag']>[],
|
|
@@ -287,8 +289,8 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
|
|
|
287
289
|
structuredClone(spec),
|
|
288
290
|
structuredClone(_elements),
|
|
289
291
|
structuredClone(_relations),
|
|
290
|
-
structuredClone(
|
|
291
|
-
structuredClone(
|
|
292
|
+
structuredClone(_views),
|
|
293
|
+
structuredClone(_globals)
|
|
292
294
|
),
|
|
293
295
|
__model: () => ({
|
|
294
296
|
addElement: (element) => {
|
|
@@ -343,9 +345,7 @@ function builder<Spec extends BuilderSpecification, T extends AnyTypes>(
|
|
|
343
345
|
specification: toLikeC4Specification(),
|
|
344
346
|
elements: fromEntries(Array.from(_elements.entries())) as any,
|
|
345
347
|
relations: mapToObj(_relations, r => [r.id, r]),
|
|
346
|
-
globals:
|
|
347
|
-
styles: mapToObj(_globals.styles, s => [s.id, s])
|
|
348
|
-
},
|
|
348
|
+
globals: structuredClone(_globals),
|
|
349
349
|
views: fromEntries(Array.from(_views.entries())) as any
|
|
350
350
|
}),
|
|
351
351
|
helpers: () => ({
|
package/src/types/global.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import type { Tagged } from 'type-fest'
|
|
1
|
+
import type { NonEmptyTuple, Tagged } from 'type-fest'
|
|
2
2
|
import type { NonEmptyArray } from './_common'
|
|
3
|
-
import type { ViewRuleStyle } from './view'
|
|
3
|
+
import type { DynamicViewIncludeRule, ViewRulePredicate, ViewRuleStyle } from './view'
|
|
4
|
+
|
|
5
|
+
export type GlobalPredicateId = Tagged<string, 'GlobalPredicateId'>
|
|
6
|
+
|
|
7
|
+
export type GlobalPredicates = NonEmptyArray<ViewRulePredicate>
|
|
8
|
+
|
|
9
|
+
export type GlobalDynamicPredicates = NonEmptyArray<DynamicViewIncludeRule>
|
|
4
10
|
|
|
5
11
|
export type GlobalStyleID = Tagged<string, 'GlobalStyleID'>
|
|
6
12
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
export type GlobalStyles = NonEmptyTuple<ViewRuleStyle>
|
|
14
|
+
|
|
15
|
+
export interface ModelGlobals {
|
|
16
|
+
predicates: Record<GlobalPredicateId, GlobalPredicates>
|
|
17
|
+
dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates>
|
|
18
|
+
styles: Record<GlobalStyleID, GlobalStyles>
|
|
10
19
|
}
|
package/src/types/model.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementKindSpecification, Tag, TypedElement } from './element'
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelGlobals } from './global'
|
|
3
3
|
import type { Relation, RelationID, RelationshipKindSpecification } from './relation'
|
|
4
4
|
import type { ComputedView, DiagramView, LikeC4View, ViewID } from './view'
|
|
5
5
|
|
|
@@ -20,9 +20,7 @@ export interface ParsedLikeC4Model<
|
|
|
20
20
|
}
|
|
21
21
|
elements: Record<Fqns, TypedElement<Fqns, ElementKinds, Tags>>
|
|
22
22
|
relations: Record<RelationID, Relation>
|
|
23
|
-
globals:
|
|
24
|
-
styles: Record<GlobalStyleID, GlobalStyle>
|
|
25
|
-
}
|
|
23
|
+
globals: ModelGlobals
|
|
26
24
|
views: Record<Views, LikeC4View<Views, Tags>>
|
|
27
25
|
}
|
|
28
26
|
|
package/src/types/view.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type Tag
|
|
12
12
|
} from './element'
|
|
13
13
|
import type { ElementExpression, ElementPredicateExpression, Expression } from './expression'
|
|
14
|
-
import type { GlobalStyleID } from './global'
|
|
14
|
+
import type { GlobalPredicateId, GlobalStyleID } from './global'
|
|
15
15
|
import type { RelationID, RelationshipArrowType, RelationshipKind, RelationshipLineType } from './relation'
|
|
16
16
|
import type { Color, ThemeColorValues } from './theme'
|
|
17
17
|
import type { ElementNotation } from './view-notation'
|
|
@@ -34,6 +34,13 @@ export function isViewRulePredicate(rule: ViewRule): rule is ViewRulePredicate {
|
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export interface ViewRuleGlobalPredicateRef {
|
|
38
|
+
predicateId: GlobalPredicateId
|
|
39
|
+
}
|
|
40
|
+
export function isViewRuleGlobalPredicateRef(rule: ViewRule): rule is ViewRuleGlobalPredicateRef {
|
|
41
|
+
return 'predicateId' in rule
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
export interface ViewRuleStyle {
|
|
38
45
|
targets: ElementExpression[]
|
|
39
46
|
notation?: string
|
|
@@ -83,7 +90,13 @@ export function isViewRuleGroup(rule: ViewRule): rule is ViewRuleGroup {
|
|
|
83
90
|
return 'title' in rule && 'groupRules' in rule && Array.isArray(rule.groupRules)
|
|
84
91
|
}
|
|
85
92
|
|
|
86
|
-
export type ViewRule =
|
|
93
|
+
export type ViewRule =
|
|
94
|
+
| ViewRulePredicate
|
|
95
|
+
| ViewRuleGlobalPredicateRef
|
|
96
|
+
| ViewRuleGroup
|
|
97
|
+
| ViewRuleStyle
|
|
98
|
+
| ViewRuleGlobalStyle
|
|
99
|
+
| ViewRuleAutoLayout
|
|
87
100
|
|
|
88
101
|
export interface BasicView<
|
|
89
102
|
ViewType extends 'element' | 'dynamic',
|
|
@@ -178,7 +191,12 @@ export function isDynamicViewIncludeRule(rule: DynamicViewRule): rule is Dynamic
|
|
|
178
191
|
return 'include' in rule && Array.isArray(rule.include)
|
|
179
192
|
}
|
|
180
193
|
|
|
181
|
-
export type DynamicViewRule =
|
|
194
|
+
export type DynamicViewRule =
|
|
195
|
+
| DynamicViewIncludeRule
|
|
196
|
+
| ViewRuleGlobalPredicateRef
|
|
197
|
+
| ViewRuleStyle
|
|
198
|
+
| ViewRuleGlobalStyle
|
|
199
|
+
| ViewRuleAutoLayout
|
|
182
200
|
export interface DynamicView<
|
|
183
201
|
ViewIDs extends string = string,
|
|
184
202
|
Tags extends string = string
|