@likec4/core 1.15.1 → 1.17.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 CHANGED
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const types_index = require('./shared/core.Cq_6j35U.cjs');
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; }
7
7
 
8
8
  const defu__default = /*#__PURE__*/_interopDefaultCompat(defu);
9
9
 
10
- function d$1(...e){return types_index.u(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});
10
+ function d$1(...e){return types_index.u(a,e,o$4)}var a=(e,n)=>e.length<n.length?e.map((t,r)=>[t,n[r]]):n.map((t,r)=>[e[r],t]),o$4=e=>(n,t)=>({hasNext:!0,next:[n,e[t]],done:t>=e.length-1});
11
11
 
12
12
  var s={done:!1,hasNext:!1};
13
13
 
@@ -19,6 +19,8 @@ function i$3(...e){return types_index.u(r,e)}var r=(e,t)=>e.length>=t;
19
19
 
20
20
  function u$1(...e){return types_index.u(i$2,e)}function i$2(e,a){let n=[];for(let[o,r]of e.entries()){if(!a(r,o,e))break;n.push(r);}return n}
21
21
 
22
+ function m$1(...r){return types_index.u(o$3,r)}function o$3(r,t){let e=[...r];return e.sort(t),e}
23
+
22
24
  function o$2(r,n){let e=Math.ceil(r),t=Math.floor(n);if(t<e)throw new RangeError(`randomInteger: The range [${r.toString()},${n.toString()}] contains no integer`);return Math.floor(Math.random()*(t-e+1)+e)}
23
25
 
24
26
  function i$1(...e){return types_index.u(u,e)}function u(e,o){let t={};for(let[r,n]of Object.entries(e))o(n,r,e)&&(t[r]=n);return t}
@@ -408,7 +410,11 @@ function $rules(...rules) {
408
410
  return (b) => rules.reduce((b2, rule) => rule(b2), b);
409
411
  }
410
412
 
411
- function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _globals = { styles: [] }, _views = /* @__PURE__ */ new Map()) {
413
+ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _views = /* @__PURE__ */ new Map(), _globals = {
414
+ predicates: {},
415
+ dynamicPredicates: {},
416
+ styles: {}
417
+ }) {
412
418
  const toLikeC4Specification = () => ({
413
419
  tags: spec.tags ?? [],
414
420
  elements: {
@@ -467,8 +473,8 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
467
473
  structuredClone(spec),
468
474
  structuredClone(_elements),
469
475
  structuredClone(_relations),
470
- structuredClone(_globals),
471
- structuredClone(_views)
476
+ structuredClone(_views),
477
+ structuredClone(_globals)
472
478
  ),
473
479
  __model: () => ({
474
480
  addElement: (element) => {
@@ -523,9 +529,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
523
529
  specification: toLikeC4Specification(),
524
530
  elements: n(Array.from(_elements.entries())),
525
531
  relations: l$1(_relations, (r) => [r.id, r]),
526
- globals: {
527
- styles: l$1(_globals.styles, (s) => [s.id, s])
528
- },
532
+ globals: structuredClone(_globals),
529
533
  views: n(Array.from(_views.entries()))
530
534
  }),
531
535
  helpers: () => ({
@@ -4871,7 +4875,11 @@ class LikeC4Model {
4871
4875
  this.addRelation(rel);
4872
4876
  }
4873
4877
  this._views = new Map(
4874
- r$1(views).map((view) => [view.id, new ViewModelClass(view, this)])
4878
+ x(
4879
+ r$1(views),
4880
+ m$1((a, b) => compareNatural(a.title ?? "untitled", b.title ?? "untitled")),
4881
+ m((view) => [view.id, new ViewModelClass(view, this)])
4882
+ )
4875
4883
  );
4876
4884
  }
4877
4885
  _elements = /* @__PURE__ */ new Map();
@@ -5253,6 +5261,12 @@ class LikeC4Model {
5253
5261
  children() {
5254
5262
  return this.model.children(this);
5255
5263
  }
5264
+ /**
5265
+ * First 'view of' current element
5266
+ */
5267
+ viewOf() {
5268
+ return this.model.views().find((v) => v.viewOf?.id === this.id) ?? null;
5269
+ }
5256
5270
  /**
5257
5271
  * All views 'view of' current element
5258
5272
  */
@@ -5400,6 +5414,7 @@ exports.isStepEdgeId = types_index.isStepEdgeId;
5400
5414
  exports.isTagEqual = types_index.isTagEqual;
5401
5415
  exports.isThemeColor = types_index.isThemeColor;
5402
5416
  exports.isViewRuleAutoLayout = types_index.isViewRuleAutoLayout;
5417
+ exports.isViewRuleGlobalPredicateRef = types_index.isViewRuleGlobalPredicateRef;
5403
5418
  exports.isViewRuleGlobalStyle = types_index.isViewRuleGlobalStyle;
5404
5419
  exports.isViewRuleGroup = types_index.isViewRuleGroup;
5405
5420
  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.CpdWcGpN.cjs';
3
- export { aC as AndOperator, G as AsFqn, bz as BBox, b6 as BasicElementView, b5 as BasicView, J as BorderStyles, aO as ColorLiteral, bw as ComputedDynamicView, bv as ComputedElementView, y as CustomColor, bi as CustomColorDefinitions, aL as DefaultArrowType, O as DefaultElementShape, aK as DefaultLineStyle, aM as DefaultRelationshipColor, M as DefaultThemeColor, bg as DynamicView, bd as DynamicViewIncludeRule, bb as DynamicViewParallelSteps, bf as DynamicViewRule, ba as DynamicViewStep, bc as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bD as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, 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, w as Expr, b8 as ExtendsElementView, aH as Filterable, au as GlobalStyle, at as GlobalStyleID, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, ay as KindEqual, aU as LikeC4Theme, U as Link, x as NonEmptyReadonlyArray, aA as NotOperator, aE as OrOperator, ak as OutgoingExpr, aJ as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aS as RelationshipThemeColorValues, aT as RelationshipThemeColors, b7 as ScopedElementView, bo as StepEdgeId, bn as StepEdgeIdLiteral, aw as TagEqual, S as TagSpec, aN as ThemeColor, W as TypedElement, bu as ViewAutoLayout, bC as ViewChange, bB as ViewManualLayout, b4 as ViewRule, b0 as ViewRuleAutoLayout, aY as ViewRuleGlobalStyle, b2 as ViewRuleGroup, aV as ViewRulePredicate, 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.cjs';
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.CoLQkcYL.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.CoLQkcYL.cjs';
4
4
 
5
5
  type KeysOf<T> = keyof T extends infer K extends string ? K : never;
6
6
  type BuilderSpecification = {
@@ -784,6 +784,10 @@ declare namespace LikeC4Model {
784
784
  siblings(): readonly ElementModel<M>[];
785
785
  descendants(): readonly ElementModel<M>[];
786
786
  children(): readonly ElementModel<M>[];
787
+ /**
788
+ * First 'view of' current element
789
+ */
790
+ viewOf(): M;
787
791
  /**
788
792
  * All views 'view of' current element
789
793
  */
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.CpdWcGpN.mjs';
3
- export { aC as AndOperator, G as AsFqn, bz as BBox, b6 as BasicElementView, b5 as BasicView, J as BorderStyles, aO as ColorLiteral, bw as ComputedDynamicView, bv as ComputedElementView, y as CustomColor, bi as CustomColorDefinitions, aL as DefaultArrowType, O as DefaultElementShape, aK as DefaultLineStyle, aM as DefaultRelationshipColor, M as DefaultThemeColor, bg as DynamicView, bd as DynamicViewIncludeRule, bb as DynamicViewParallelSteps, bf as DynamicViewRule, ba as DynamicViewStep, bc as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bD as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, 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, w as Expr, b8 as ExtendsElementView, aH as Filterable, au as GlobalStyle, at as GlobalStyleID, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, ay as KindEqual, aU as LikeC4Theme, U as Link, x as NonEmptyReadonlyArray, aA as NotOperator, aE as OrOperator, ak as OutgoingExpr, aJ as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aS as RelationshipThemeColorValues, aT as RelationshipThemeColors, b7 as ScopedElementView, bo as StepEdgeId, bn as StepEdgeIdLiteral, aw as TagEqual, S as TagSpec, aN as ThemeColor, W as TypedElement, bu as ViewAutoLayout, bC as ViewChange, bB as ViewManualLayout, b4 as ViewRule, b0 as ViewRuleAutoLayout, aY as ViewRuleGlobalStyle, b2 as ViewRuleGroup, aV as ViewRulePredicate, 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.mjs';
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.CoLQkcYL.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.CoLQkcYL.mjs';
4
4
 
5
5
  type KeysOf<T> = keyof T extends infer K extends string ? K : never;
6
6
  type BuilderSpecification = {
@@ -784,6 +784,10 @@ declare namespace LikeC4Model {
784
784
  siblings(): readonly ElementModel<M>[];
785
785
  descendants(): readonly ElementModel<M>[];
786
786
  children(): readonly ElementModel<M>[];
787
+ /**
788
+ * First 'view of' current element
789
+ */
790
+ viewOf(): M;
787
791
  /**
788
792
  * All views 'view of' current element
789
793
  */
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.CpdWcGpN.js';
3
- export { aC as AndOperator, G as AsFqn, bz as BBox, b6 as BasicElementView, b5 as BasicView, J as BorderStyles, aO as ColorLiteral, bw as ComputedDynamicView, bv as ComputedElementView, y as CustomColor, bi as CustomColorDefinitions, aL as DefaultArrowType, O as DefaultElementShape, aK as DefaultLineStyle, aM as DefaultRelationshipColor, M as DefaultThemeColor, bg as DynamicView, bd as DynamicViewIncludeRule, bb as DynamicViewParallelSteps, bf as DynamicViewRule, ba as DynamicViewStep, bc as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bD as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, 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, w as Expr, b8 as ExtendsElementView, aH as Filterable, au as GlobalStyle, at as GlobalStyleID, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, ay as KindEqual, aU as LikeC4Theme, U as Link, x as NonEmptyReadonlyArray, aA as NotOperator, aE as OrOperator, ak as OutgoingExpr, aJ as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aS as RelationshipThemeColorValues, aT as RelationshipThemeColors, b7 as ScopedElementView, bo as StepEdgeId, bn as StepEdgeIdLiteral, aw as TagEqual, S as TagSpec, aN as ThemeColor, W as TypedElement, bu as ViewAutoLayout, bC as ViewChange, bB as ViewManualLayout, b4 as ViewRule, b0 as ViewRuleAutoLayout, aY as ViewRuleGlobalStyle, b2 as ViewRuleGroup, aV as ViewRulePredicate, 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';
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.CoLQkcYL.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.CoLQkcYL.js';
4
4
 
5
5
  type KeysOf<T> = keyof T extends infer K extends string ? K : never;
6
6
  type BuilderSpecification = {
@@ -784,6 +784,10 @@ declare namespace LikeC4Model {
784
784
  siblings(): readonly ElementModel<M>[];
785
785
  descendants(): readonly ElementModel<M>[];
786
786
  children(): readonly ElementModel<M>[];
787
+ /**
788
+ * First 'view of' current element
789
+ */
790
+ viewOf(): M;
787
791
  /**
788
792
  * All views 'view of' current element
789
793
  */
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
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.zYtlWYjW.mjs';
2
- export { A as AsFqn, B as BorderStyles, a2 as ComputedNode, N as DefaultArrowType, M as DefaultLineStyle, a6 as DiagramNode, E as ElementKind, j as ElementShapes, g as Expr, _ as StepEdgeId, a0 as extractStep, a5 as getBBoxCenter, a1 as getParallelStepsPrefix, J as isAndOperator, S as isAutoLayoutDirection, a3 as isComputedDynamicView, a4 as isComputedElementView, m as isCustomElement, C as isCustomRelationExpr, X as isDynamicView, V as isDynamicViewIncludeRule, W as isDynamicViewParallelSteps, r as isElement, p as isElementKindExpr, k as isElementRef, q as isElementTagExpr, Y as isElementView, s as isElementWhere, l as isExpandedElementExpr, Z 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, $ as isStepEdgeId, G as isTagEqual, O as isThemeColor, T as isViewRuleAutoLayout, R as isViewRuleGlobalStyle, U as isViewRuleGroup, P as isViewRulePredicate, Q as isViewRuleStyle, o as isWildcard, h as nonexhaustive, L as whereOperatorAsPredicate } from './shared/core.zYtlWYjW.mjs';
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
- 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});
5
+ function d$1(...e){return u$2(a,e,o$4)}var a=(e,n)=>e.length<n.length?e.map((t,r)=>[t,n[r]]):n.map((t,r)=>[e[r],t]),o$4=e=>(n,t)=>({hasNext:!0,next:[n,e[t]],done:t>=e.length-1});
6
6
 
7
7
  var s={done:!1,hasNext:!1};
8
8
 
@@ -14,6 +14,8 @@ function i$3(...e){return u$2(r,e)}var r=(e,t)=>e.length>=t;
14
14
 
15
15
  function u$1(...e){return u$2(i$2,e)}function i$2(e,a){let n=[];for(let[o,r]of e.entries()){if(!a(r,o,e))break;n.push(r);}return n}
16
16
 
17
+ function m$1(...r){return u$2(o$3,r)}function o$3(r,t){let e=[...r];return e.sort(t),e}
18
+
17
19
  function o$2(r,n){let e=Math.ceil(r),t=Math.floor(n);if(t<e)throw new RangeError(`randomInteger: The range [${r.toString()},${n.toString()}] contains no integer`);return Math.floor(Math.random()*(t-e+1)+e)}
18
20
 
19
21
  function i$1(...e){return u$2(u,e)}function u(e,o){let t={};for(let[r,n]of Object.entries(e))o(n,r,e)&&(t[r]=n);return t}
@@ -403,7 +405,11 @@ function $rules(...rules) {
403
405
  return (b) => rules.reduce((b2, rule) => rule(b2), b);
404
406
  }
405
407
 
406
- function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _globals = { styles: [] }, _views = /* @__PURE__ */ new Map()) {
408
+ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _views = /* @__PURE__ */ new Map(), _globals = {
409
+ predicates: {},
410
+ dynamicPredicates: {},
411
+ styles: {}
412
+ }) {
407
413
  const toLikeC4Specification = () => ({
408
414
  tags: spec.tags ?? [],
409
415
  elements: {
@@ -462,8 +468,8 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
462
468
  structuredClone(spec),
463
469
  structuredClone(_elements),
464
470
  structuredClone(_relations),
465
- structuredClone(_globals),
466
- structuredClone(_views)
471
+ structuredClone(_views),
472
+ structuredClone(_globals)
467
473
  ),
468
474
  __model: () => ({
469
475
  addElement: (element) => {
@@ -518,9 +524,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
518
524
  specification: toLikeC4Specification(),
519
525
  elements: n(Array.from(_elements.entries())),
520
526
  relations: l$1(_relations, (r) => [r.id, r]),
521
- globals: {
522
- styles: l$1(_globals.styles, (s) => [s.id, s])
523
- },
527
+ globals: structuredClone(_globals),
524
528
  views: n(Array.from(_views.entries()))
525
529
  }),
526
530
  helpers: () => ({
@@ -4866,7 +4870,11 @@ class LikeC4Model {
4866
4870
  this.addRelation(rel);
4867
4871
  }
4868
4872
  this._views = new Map(
4869
- r$1(views).map((view) => [view.id, new ViewModelClass(view, this)])
4873
+ x(
4874
+ r$1(views),
4875
+ m$1((a, b) => compareNatural(a.title ?? "untitled", b.title ?? "untitled")),
4876
+ m((view) => [view.id, new ViewModelClass(view, this)])
4877
+ )
4870
4878
  );
4871
4879
  }
4872
4880
  _elements = /* @__PURE__ */ new Map();
@@ -5248,6 +5256,12 @@ class LikeC4Model {
5248
5256
  children() {
5249
5257
  return this.model.children(this);
5250
5258
  }
5259
+ /**
5260
+ * First 'view of' current element
5261
+ */
5262
+ viewOf() {
5263
+ return this.model.views().find((v) => v.viewOf?.id === this.id) ?? null;
5264
+ }
5251
5265
  /**
5252
5266
  * All views 'view of' current element
5253
5267
  */
@@ -1,8 +1,8 @@
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[]];
5
- type IconUrl = Tagged<string, 'IconUrl'>;
5
+ type IconUrl = Tagged<string, 'IconUrl'> | 'none';
6
6
  type CustomColor = string;
7
7
  type Point = readonly [x: number, y: number];
8
8
  interface XYPoint {
@@ -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
- interface GlobalStyle {
147
- readonly id: GlobalStyleID;
148
- readonly styles: NonEmptyArray<ViewRuleStyle>;
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, isAutoLayoutDirection 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 NotOperator as aA, isNotOperator as aB, type AndOperator as aC, isAndOperator as aD, type OrOperator as aE, isOrOperator as aF, type WhereOperator as aG, type Filterable as aH, whereOperatorAsPredicate as aI, OverviewGraph as aJ, DefaultLineStyle as aK, DefaultArrowType as aL, DefaultRelationshipColor as aM, type ThemeColor as aN, type ColorLiteral as aO, isThemeColor as aP, type ElementThemeColorValues as aQ, type ElementThemeColors as aR, type RelationshipThemeColorValues as aS, type RelationshipThemeColors as aT, type LikeC4Theme as aU, type ViewRulePredicate as aV, isViewRulePredicate as aW, isViewRuleStyle as aX, type ViewRuleGlobalStyle as aY, isViewRuleGlobalStyle as aZ, type ViewRuleStyleOrGlobalRef 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 GlobalStyleID as at, type GlobalStyle as au, type EqualOperator as av, type TagEqual as aw, isTagEqual as ax, type KindEqual as ay, isKindEqual as az, type RelationshipArrowType as b, type ViewRuleAutoLayout as b0, isViewRuleAutoLayout as b1, type ViewRuleGroup as b2, isViewRuleGroup as b3, type ViewRule as b4, type BasicView as b5, type BasicElementView as b6, type ScopedElementView as b7, type ExtendsElementView as b8, type ElementView as b9, getBBoxCenter as bA, type ViewManualLayout as bB, ViewChange as bC, type ElementNotation as bD, type DynamicViewStep as ba, type DynamicViewParallelSteps as bb, type DynamicViewStepOrParallel as bc, type DynamicViewIncludeRule as bd, isDynamicViewIncludeRule as be, type DynamicViewRule as bf, type DynamicView as bg, isDynamicViewParallelSteps as bh, type CustomColorDefinitions as bi, isDynamicView as bj, isElementView as bk, isExtendsElementView as bl, isScopedElementView as bm, type StepEdgeIdLiteral as bn, StepEdgeId as bo, isStepEdgeId as bp, extractStep as bq, getParallelStepsPrefix as br, type ViewWithHash as bs, type ViewWithNotation as bt, type ViewAutoLayout as bu, type ComputedElementView as bv, type ComputedDynamicView as bw, isComputedDynamicView as bx, isComputedElementView as by, type BBox 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 };
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,8 +1,8 @@
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[]];
5
- type IconUrl = Tagged<string, 'IconUrl'>;
5
+ type IconUrl = Tagged<string, 'IconUrl'> | 'none';
6
6
  type CustomColor = string;
7
7
  type Point = readonly [x: number, y: number];
8
8
  interface XYPoint {
@@ -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
- interface GlobalStyle {
147
- readonly id: GlobalStyleID;
148
- readonly styles: NonEmptyArray<ViewRuleStyle>;
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, isAutoLayoutDirection 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 NotOperator as aA, isNotOperator as aB, type AndOperator as aC, isAndOperator as aD, type OrOperator as aE, isOrOperator as aF, type WhereOperator as aG, type Filterable as aH, whereOperatorAsPredicate as aI, OverviewGraph as aJ, DefaultLineStyle as aK, DefaultArrowType as aL, DefaultRelationshipColor as aM, type ThemeColor as aN, type ColorLiteral as aO, isThemeColor as aP, type ElementThemeColorValues as aQ, type ElementThemeColors as aR, type RelationshipThemeColorValues as aS, type RelationshipThemeColors as aT, type LikeC4Theme as aU, type ViewRulePredicate as aV, isViewRulePredicate as aW, isViewRuleStyle as aX, type ViewRuleGlobalStyle as aY, isViewRuleGlobalStyle as aZ, type ViewRuleStyleOrGlobalRef 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 GlobalStyleID as at, type GlobalStyle as au, type EqualOperator as av, type TagEqual as aw, isTagEqual as ax, type KindEqual as ay, isKindEqual as az, type RelationshipArrowType as b, type ViewRuleAutoLayout as b0, isViewRuleAutoLayout as b1, type ViewRuleGroup as b2, isViewRuleGroup as b3, type ViewRule as b4, type BasicView as b5, type BasicElementView as b6, type ScopedElementView as b7, type ExtendsElementView as b8, type ElementView as b9, getBBoxCenter as bA, type ViewManualLayout as bB, ViewChange as bC, type ElementNotation as bD, type DynamicViewStep as ba, type DynamicViewParallelSteps as bb, type DynamicViewStepOrParallel as bc, type DynamicViewIncludeRule as bd, isDynamicViewIncludeRule as be, type DynamicViewRule as bf, type DynamicView as bg, isDynamicViewParallelSteps as bh, type CustomColorDefinitions as bi, isDynamicView as bj, isElementView as bk, isExtendsElementView as bl, isScopedElementView as bm, type StepEdgeIdLiteral as bn, StepEdgeId as bo, isStepEdgeId as bp, extractStep as bq, getParallelStepsPrefix as br, type ViewWithHash as bs, type ViewWithNotation as bt, type ViewAutoLayout as bu, type ComputedElementView as bv, type ComputedDynamicView as bw, isComputedDynamicView as bx, isComputedElementView as by, type BBox 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 };
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,8 +1,8 @@
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[]];
5
- type IconUrl = Tagged<string, 'IconUrl'>;
5
+ type IconUrl = Tagged<string, 'IconUrl'> | 'none';
6
6
  type CustomColor = string;
7
7
  type Point = readonly [x: number, y: number];
8
8
  interface XYPoint {
@@ -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
- interface GlobalStyle {
147
- readonly id: GlobalStyleID;
148
- readonly styles: NonEmptyArray<ViewRuleStyle>;
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, isAutoLayoutDirection 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 NotOperator as aA, isNotOperator as aB, type AndOperator as aC, isAndOperator as aD, type OrOperator as aE, isOrOperator as aF, type WhereOperator as aG, type Filterable as aH, whereOperatorAsPredicate as aI, OverviewGraph as aJ, DefaultLineStyle as aK, DefaultArrowType as aL, DefaultRelationshipColor as aM, type ThemeColor as aN, type ColorLiteral as aO, isThemeColor as aP, type ElementThemeColorValues as aQ, type ElementThemeColors as aR, type RelationshipThemeColorValues as aS, type RelationshipThemeColors as aT, type LikeC4Theme as aU, type ViewRulePredicate as aV, isViewRulePredicate as aW, isViewRuleStyle as aX, type ViewRuleGlobalStyle as aY, isViewRuleGlobalStyle as aZ, type ViewRuleStyleOrGlobalRef 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 GlobalStyleID as at, type GlobalStyle as au, type EqualOperator as av, type TagEqual as aw, isTagEqual as ax, type KindEqual as ay, isKindEqual as az, type RelationshipArrowType as b, type ViewRuleAutoLayout as b0, isViewRuleAutoLayout as b1, type ViewRuleGroup as b2, isViewRuleGroup as b3, type ViewRule as b4, type BasicView as b5, type BasicElementView as b6, type ScopedElementView as b7, type ExtendsElementView as b8, type ElementView as b9, getBBoxCenter as bA, type ViewManualLayout as bB, ViewChange as bC, type ElementNotation as bD, type DynamicViewStep as ba, type DynamicViewParallelSteps as bb, type DynamicViewStepOrParallel as bc, type DynamicViewIncludeRule as bd, isDynamicViewIncludeRule as be, type DynamicViewRule as bf, type DynamicView as bg, isDynamicViewParallelSteps as bh, type CustomColorDefinitions as bi, isDynamicView as bj, isElementView as bk, isExtendsElementView as bl, isScopedElementView as bm, type StepEdgeIdLiteral as bn, StepEdgeId as bo, isStepEdgeId as bp, extractStep as bq, getParallelStepsPrefix as br, type ViewWithHash as bs, type ViewWithNotation as bt, type ViewAutoLayout as bu, type ComputedElementView as bv, type ComputedDynamicView as bw, isComputedDynamicView as bx, isComputedElementView as by, type BBox 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 };
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 { isStepEdgeId 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, isViewRuleStyle as Q, isViewRuleGlobalStyle as R, isAutoLayoutDirection as S, isViewRuleAutoLayout as T, isViewRuleGroup as U, isDynamicViewIncludeRule as V, isDynamicViewParallelSteps as W, isDynamicView as X, isElementView as Y, isExtendsElementView as Z, StepEdgeId as _, invariant as a, extractStep as a0, getParallelStepsPrefix as a1, ComputedNode as a2, isComputedDynamicView as a3, isComputedElementView as a4, getBBoxCenter as a5, DiagramNode as a6, 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 };
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;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const types_index = require('../shared/core.Cq_6j35U.cjs');
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;
@@ -1,2 +1,2 @@
1
- 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.cjs';
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.CoLQkcYL.cjs';
2
2
  import 'type-fest';
@@ -1,2 +1,2 @@
1
- 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.mjs';
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.CoLQkcYL.mjs';
2
2
  import 'type-fest';
@@ -1,2 +1,2 @@
1
- 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';
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.CoLQkcYL.js';
2
2
  import 'type-fest';
@@ -1 +1 @@
1
- export { A as AsFqn, B as BorderStyles, a2 as ComputedNode, N as DefaultArrowType, c as DefaultElementShape, M as DefaultLineStyle, f as DefaultRelationshipColor, D as DefaultThemeColor, a6 as DiagramNode, E as ElementKind, j as ElementShapes, _ as StepEdgeId, a0 as extractStep, a5 as getBBoxCenter, a1 as getParallelStepsPrefix, J as isAndOperator, S as isAutoLayoutDirection, a3 as isComputedDynamicView, a4 as isComputedElementView, m as isCustomElement, C as isCustomRelationExpr, X as isDynamicView, V as isDynamicViewIncludeRule, W as isDynamicViewParallelSteps, r as isElement, p as isElementKindExpr, i as isElementPredicateExpr, k as isElementRef, q as isElementTagExpr, Y as isElementView, s as isElementWhere, l as isExpandedElementExpr, Z 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, $ as isStepEdgeId, G as isTagEqual, O as isThemeColor, T as isViewRuleAutoLayout, R as isViewRuleGlobalStyle, U as isViewRuleGroup, P as isViewRulePredicate, Q as isViewRuleStyle, o as isWildcard, L as whereOperatorAsPredicate } from '../shared/core.zYtlWYjW.mjs';
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.15.1",
3
+ "version": "1.17.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.15.1",
83
+ "@likec4/tsconfig": "1.17.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.3"
93
+ "vitest": "^2.1.5"
94
94
  },
95
95
  "packageManager": "yarn@4.5.1"
96
96
  }
@@ -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
- _globals = { styles: [] } as {
224
- styles: GlobalStyle[]
225
- },
226
- _views = new Map<string, LikeC4View>()
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(_globals),
291
- structuredClone(_views)
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: () => ({
@@ -1,4 +1,4 @@
1
- import { isString, isTruthy, values } from 'remeda'
1
+ import { isString, isTruthy, map, pipe, sort, values } from 'remeda'
2
2
  import type { Class } from 'type-fest'
3
3
  import { nonNullable } from '../errors'
4
4
  import type {
@@ -14,7 +14,8 @@ import type {
14
14
  } from '../types/model'
15
15
  import type { Relation as C4Relation } from '../types/relation'
16
16
  import type { Color as C4Color } from '../types/theme'
17
- import { ancestorsFqn, commonAncestor, parentFqn } from '../utils/fqn'
17
+ import { compareNatural } from '../utils/compare-natural'
18
+ import { ancestorsFqn, commonAncestor, parentFqn, sortNaturalByFqn } from '../utils/fqn'
18
19
  import { LikeC4DiagramModel } from './LikeC4DiagramModel'
19
20
  import { LikeC4ViewModel } from './LikeC4ViewModel'
20
21
  import type { ElementOrFqn, Fqn, IncomingFilter, OutgoingFilter, RelationID, ViewID } from './types'
@@ -65,7 +66,11 @@ export class LikeC4Model<M extends LikeC4Model.ViewModel = LikeC4Model.ViewModel
65
66
  this.addRelation(rel)
66
67
  }
67
68
  this._views = new Map(
68
- values(views).map(view => [view.id, new ViewModelClass(view, this)] as [Fqn, M])
69
+ pipe(
70
+ values(views),
71
+ sort((a, b) => compareNatural(a.title ?? 'untitled', b.title ?? 'untitled')),
72
+ map(view => [view.id, new ViewModelClass(view, this)] as [Fqn, M])
73
+ )
69
74
  )
70
75
  }
71
76
 
@@ -530,6 +535,13 @@ export namespace LikeC4Model {
530
535
  return this.model.children(this)
531
536
  }
532
537
 
538
+ /**
539
+ * First 'view of' current element
540
+ */
541
+ public viewOf() {
542
+ return this.model.views().find(v => v.viewOf?.id === this.id) ?? null
543
+ }
544
+
533
545
  /**
534
546
  * All views 'view of' current element
535
547
  */
@@ -335,6 +335,8 @@ export const fakeComputedModel = {
335
335
  elements: fakeElements,
336
336
  relations: fakeRelations,
337
337
  globals: {
338
+ predicates: {},
339
+ dynamicPredicates: {},
338
340
  styles: {}
339
341
  },
340
342
  views: {}
@@ -4,7 +4,7 @@ export type NonEmptyArray<T> = [T, ...T[]]
4
4
 
5
5
  export type NonEmptyReadonlyArray<T> = readonly [T, ...T[]]
6
6
 
7
- export type IconUrl = Tagged<string, 'IconUrl'>
7
+ export type IconUrl = Tagged<string, 'IconUrl'> | 'none'
8
8
 
9
9
  export type CustomColor = string
10
10
 
@@ -1,4 +1,4 @@
1
- import type { IfNever, Tagged, TupleToUnion } from 'type-fest'
1
+ import type { Tagged, TupleToUnion } from 'type-fest'
2
2
  import type { IconUrl, NonEmptyArray } from './_common'
3
3
  import type { Color, ThemeColor } from './theme'
4
4
 
@@ -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 interface GlobalStyle {
8
- readonly id: GlobalStyleID
9
- readonly styles: NonEmptyArray<ViewRuleStyle>
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
  }
@@ -1,5 +1,5 @@
1
1
  import type { ElementKindSpecification, Tag, TypedElement } from './element'
2
- import type { GlobalStyle, GlobalStyleID } from './global'
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 = ViewRulePredicate | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout
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 = DynamicViewIncludeRule | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout
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