@likec4/core 1.16.0 → 1.17.1

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,33 +1,35 @@
1
1
  'use strict';
2
2
 
3
- const types_index = require('./shared/core.zN6ZscFQ.cjs');
3
+ const types_index = require('./shared/core.DIYZvpVg.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 r$1(...t){return types_index.u(Object.values,t)}
11
+
12
+ function d$2(...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
13
 
12
14
  var s={done:!1,hasNext:!1};
13
15
 
14
16
  function x(t,...o){let n=t,u=o.map(e=>"lazy"in e?f(e):void 0),p=0;for(;p<o.length;){if(u[p]===void 0||!B(n)){let i=o[p];n=i(n),p+=1;continue}let r=[];for(let i=p;i<o.length;i++){let l=u[i];if(l===void 0||(r.push(l),l.isSingle))break}let a=[];for(let i of n)if(A(i,a,r))break;let{isSingle:y}=r.at(-1);n=y?a[0]:a,p+=r.length;}return n}function A(t,o,n){if(n.length===0)return o.push(t),!1;let u=t,p=s,e=!1;for(let[r,a]of n.entries()){let{index:y,items:i}=a;if(i.push(u),p=a(u,y,i),a.index+=1,p.hasNext){if(p.hasMany??!1){for(let l of p.next)if(A(l,o,n.slice(r+1)))return !0;return e}u=p.next;}if(!p.hasNext)break;p.done&&(e=!0);}return p.hasNext&&o.push(u),e}function f(t){let{lazy:o,lazyArgs:n}=t,u=o(...n);return Object.assign(u,{isSingle:o.single??!1,index:0,items:[]})}function B(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}
15
17
 
16
- function r$1(...n){return types_index.u(Object.values,n)}
17
-
18
18
  function i$3(...e){return types_index.u(r,e)}var r=(e,t)=>e.length>=t;
19
19
 
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}
20
+ function u(...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
+
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}
21
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
- 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}
26
+ function d$1(...e){return types_index.u(i$1,e)}function i$1(e,o){let t={};for(let[r,n]of Object.entries(e))o(n,r,e)&&(t[r]=n);return t}
25
27
 
26
- function m(...a){return types_index.u(o$1,a,p)}var o$1=(a,e)=>a.map(e),p=a=>(e,r,t)=>({done:!1,hasNext:!0,next:a(e,r,t)});
28
+ function m(...a){return types_index.u(o$1,a,p)}var o$1=(a,e)=>a.map(e),p=a=>(e,t,r)=>({done:!1,hasNext:!0,next:a(e,t,r)});
27
29
 
28
30
  function l$1(...n){return types_index.u(d,n)}function d(n,o){let e={};for(let[a,t]of n.entries()){let[y,u]=o(t,a,n);e[y]=u;}return e}
29
31
 
30
- function i(...e){return types_index.u(o,e)}function o(e,u){let a={};for(let[n,r]of Object.entries(e)){let l=u(r,n,e);a[n]=l;}return a}
32
+ function i(...e){return types_index.u(o,e)}function o(e,r){let a={};for(let[n,u]of Object.entries(e)){let l=r(u,n,e);a[n]=l;}return a}
31
33
 
32
34
  function t$1(r){return typeof r=="string"}
33
35
 
@@ -394,7 +396,7 @@ function $expr(expr) {
394
396
  }
395
397
  function $style(element, { notation, ...style }) {
396
398
  return (b) => b.style({
397
- targets: (types_index.n(element) ? element : [element]).map((e) => $expr(e)),
399
+ targets: (types_index.o(element) ? element : [element]).map((e) => $expr(e)),
398
400
  ...notation ? { notation } : {},
399
401
  style: {
400
402
  ...style
@@ -605,7 +607,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
605
607
  tags: null,
606
608
  color: specStyle?.color ?? types_index.DefaultThemeColor,
607
609
  shape: specStyle?.shape ?? types_index.DefaultElementShape,
608
- style: i$1({
610
+ style: d$1({
609
611
  border: specStyle?.border,
610
612
  opacity: specStyle?.opacity,
611
613
  ...style
@@ -4410,7 +4412,7 @@ class LikeC4DiagramModel {
4410
4412
  for (const node of view.nodes) {
4411
4413
  const el = new LikeC4DiagramModel.Element(node, this);
4412
4414
  this._elements.set(node.id, el);
4413
- if (types_index.e(node.parent)) {
4415
+ if (types_index.n(node.parent)) {
4414
4416
  this._rootElements.add(el);
4415
4417
  }
4416
4418
  }
@@ -4429,7 +4431,7 @@ class LikeC4DiagramModel {
4429
4431
  return this.view.title;
4430
4432
  }
4431
4433
  get viewOf() {
4432
- if (types_index.e(this.view.__) || this.view.__ === "element") {
4434
+ if (types_index.n(this.view.__) || this.view.__ === "element") {
4433
4435
  const computedView = this.view;
4434
4436
  return computedView.viewOf ? this.model.element(computedView.viewOf) : null;
4435
4437
  }
@@ -4548,7 +4550,7 @@ class LikeC4DiagramModel {
4548
4550
  return this.node.kind;
4549
4551
  }
4550
4552
  get isRoot() {
4551
- return types_index.e(this.node.parent);
4553
+ return types_index.n(this.node.parent);
4552
4554
  }
4553
4555
  get hasNested() {
4554
4556
  return this.node.children.length > 0;
@@ -4646,7 +4648,7 @@ class LikeC4ViewModel {
4646
4648
  for (const node of view.nodes) {
4647
4649
  const el = new LikeC4ViewModel.Element(node, this);
4648
4650
  this._elements.set(node.id, el);
4649
- if (types_index.e(node.parent)) {
4651
+ if (types_index.n(node.parent)) {
4650
4652
  this._rootElements.add(el);
4651
4653
  }
4652
4654
  }
@@ -4780,7 +4782,7 @@ class LikeC4ViewModel {
4780
4782
  return this.node.kind;
4781
4783
  }
4782
4784
  get isRoot() {
4783
- return types_index.e(this.node.parent);
4785
+ return types_index.n(this.node.parent);
4784
4786
  }
4785
4787
  get hasNested() {
4786
4788
  return this.node.children.length > 0;
@@ -4873,7 +4875,11 @@ class LikeC4Model {
4873
4875
  this.addRelation(rel);
4874
4876
  }
4875
4877
  this._views = new Map(
4876
- 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
+ )
4877
4883
  );
4878
4884
  }
4879
4885
  _elements = /* @__PURE__ */ new Map();
@@ -5255,6 +5261,12 @@ class LikeC4Model {
5255
5261
  children() {
5256
5262
  return this.model.children(this);
5257
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
+ }
5258
5270
  /**
5259
5271
  * All views 'view of' current element
5260
5272
  */
@@ -5302,8 +5314,8 @@ function commonHead(sources, targets, equals) {
5302
5314
  }
5303
5315
  equals ??= Object.is;
5304
5316
  return x(
5305
- d$1(sources, targets),
5306
- u$1(([source, target]) => equals(source, target)),
5317
+ d$2(sources, targets),
5318
+ u(([source, target]) => equals(source, target)),
5307
5319
  m(([source, _]) => source)
5308
5320
  );
5309
5321
  }
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.gZyGTUZz.cjs';
3
- export { aG as AndOperator, G as AsFqn, bF as BBox, bc as BasicElementView, bb as BasicView, J as BorderStyles, aS as ColorLiteral, bC as ComputedDynamicView, bB as ComputedElementView, y as CustomColor, bo as CustomColorDefinitions, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aU as ElementThemeColorValues, aV as ElementThemeColors, bf as ElementView, aa as ElementWhereExpr, az as EqualOperator, $ as ExpandedElementExpr, w as Expr, be as ExtendsElementView, aL as Filterable, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, aY as LikeC4Theme, U as Link, ay as ModelGlobals, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, aA as TagEqual, S as TagSpec, aR as ThemeColor, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, b4 as ViewRuleStyleOrGlobalRef, by as ViewWithHash, bz as ViewWithNotation, aK as WhereOperator, a2 as WildcardExpr, X as XYPoint, bw as extractStep, bG as getBBoxCenter, bx as getParallelStepsPrefix, aH as isAndOperator, b5 as isAutoLayoutDirection, bD as isComputedDynamicView, bE as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bp as isDynamicView, bk as isDynamicViewIncludeRule, bn as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bq as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, br as isExtendsElementView, ah as isInOut, aj as isIncoming, aD as isKindEqual, aF as isNotOperator, aJ as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, bs as isScopedElementView, bv as isStepEdgeId, aB as isTagEqual, aT as isThemeColor, b7 as isViewRuleAutoLayout, b0 as isViewRuleGlobalPredicateRef, b3 as isViewRuleGlobalStyle, b9 as isViewRuleGroup, a_ as isViewRulePredicate, b1 as isViewRuleStyle, a3 as isWildcard, aM as whereOperatorAsPredicate } from './shared/core.gZyGTUZz.cjs';
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
  */
@@ -958,7 +962,8 @@ declare function sortNaturalByFqn<T extends {
958
962
  * and of the form [x, ...y[]], etc...), and their readonly equivalent. This
959
963
  * allows us to be more inclusive to what functions can process.
960
964
  *
961
- * @example map<T extends ArrayLike>(items: T) { ... }
965
+ * @example
966
+ * function map<T extends IterableContainer>(items: T) { ... }
962
967
  *
963
968
  * We would've named this `ArrayLike`, but that's already used by typescript...
964
969
  * @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21)
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.gZyGTUZz.mjs';
3
- export { aG as AndOperator, G as AsFqn, bF as BBox, bc as BasicElementView, bb as BasicView, J as BorderStyles, aS as ColorLiteral, bC as ComputedDynamicView, bB as ComputedElementView, y as CustomColor, bo as CustomColorDefinitions, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aU as ElementThemeColorValues, aV as ElementThemeColors, bf as ElementView, aa as ElementWhereExpr, az as EqualOperator, $ as ExpandedElementExpr, w as Expr, be as ExtendsElementView, aL as Filterable, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, aY as LikeC4Theme, U as Link, ay as ModelGlobals, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, aA as TagEqual, S as TagSpec, aR as ThemeColor, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, b4 as ViewRuleStyleOrGlobalRef, by as ViewWithHash, bz as ViewWithNotation, aK as WhereOperator, a2 as WildcardExpr, X as XYPoint, bw as extractStep, bG as getBBoxCenter, bx as getParallelStepsPrefix, aH as isAndOperator, b5 as isAutoLayoutDirection, bD as isComputedDynamicView, bE as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bp as isDynamicView, bk as isDynamicViewIncludeRule, bn as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bq as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, br as isExtendsElementView, ah as isInOut, aj as isIncoming, aD as isKindEqual, aF as isNotOperator, aJ as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, bs as isScopedElementView, bv as isStepEdgeId, aB as isTagEqual, aT as isThemeColor, b7 as isViewRuleAutoLayout, b0 as isViewRuleGlobalPredicateRef, b3 as isViewRuleGlobalStyle, b9 as isViewRuleGroup, a_ as isViewRulePredicate, b1 as isViewRuleStyle, a3 as isWildcard, aM as whereOperatorAsPredicate } from './shared/core.gZyGTUZz.mjs';
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
  */
@@ -958,7 +962,8 @@ declare function sortNaturalByFqn<T extends {
958
962
  * and of the form [x, ...y[]], etc...), and their readonly equivalent. This
959
963
  * allows us to be more inclusive to what functions can process.
960
964
  *
961
- * @example map<T extends ArrayLike>(items: T) { ... }
965
+ * @example
966
+ * function map<T extends IterableContainer>(items: T) { ... }
962
967
  *
963
968
  * We would've named this `ArrayLike`, but that's already used by typescript...
964
969
  * @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21)
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.gZyGTUZz.js';
3
- export { aG as AndOperator, G as AsFqn, bF as BBox, bc as BasicElementView, bb as BasicView, J as BorderStyles, aS as ColorLiteral, bC as ComputedDynamicView, bB as ComputedElementView, y as CustomColor, bo as CustomColorDefinitions, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aU as ElementThemeColorValues, aV as ElementThemeColors, bf as ElementView, aa as ElementWhereExpr, az as EqualOperator, $ as ExpandedElementExpr, w as Expr, be as ExtendsElementView, aL as Filterable, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, aY as LikeC4Theme, U as Link, ay as ModelGlobals, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, aA as TagEqual, S as TagSpec, aR as ThemeColor, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, b4 as ViewRuleStyleOrGlobalRef, by as ViewWithHash, bz as ViewWithNotation, aK as WhereOperator, a2 as WildcardExpr, X as XYPoint, bw as extractStep, bG as getBBoxCenter, bx as getParallelStepsPrefix, aH as isAndOperator, b5 as isAutoLayoutDirection, bD as isComputedDynamicView, bE as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bp as isDynamicView, bk as isDynamicViewIncludeRule, bn as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bq as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, br as isExtendsElementView, ah as isInOut, aj as isIncoming, aD as isKindEqual, aF as isNotOperator, aJ as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, bs as isScopedElementView, bv as isStepEdgeId, aB as isTagEqual, aT as isThemeColor, b7 as isViewRuleAutoLayout, b0 as isViewRuleGlobalPredicateRef, b3 as isViewRuleGlobalStyle, b9 as isViewRuleGroup, a_ as isViewRulePredicate, b1 as isViewRuleStyle, a3 as isWildcard, aM as whereOperatorAsPredicate } from './shared/core.gZyGTUZz.js';
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
  */
@@ -958,7 +962,8 @@ declare function sortNaturalByFqn<T extends {
958
962
  * and of the form [x, ...y[]], etc...), and their readonly equivalent. This
959
963
  * allows us to be more inclusive to what functions can process.
960
964
  *
961
- * @example map<T extends ArrayLike>(items: T) { ... }
965
+ * @example
966
+ * function map<T extends IterableContainer>(items: T) { ... }
962
967
  *
963
968
  * We would've named this `ArrayLike`, but that's already used by typescript...
964
969
  * @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21)
package/dist/index.mjs CHANGED
@@ -1,28 +1,30 @@
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';
1
+ import { u as u$1, i as isElementPredicateExpr, o as o$5, a as invariant, b as isScopedElementView, D as DefaultThemeColor, c as DefaultElementShape, n as n$2, d as nonNullable, e as DefaultRelationshipColor } from './shared/core.BXTs-8n7.mjs';
2
+ export { A as AsFqn, B as BorderStyles, a3 as ComputedNode, N as DefaultArrowType, M as DefaultLineStyle, a7 as DiagramNode, E as ElementKind, h as ElementShapes, f 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, l as isCustomElement, C as isCustomRelationExpr, Y as isDynamicView, W as isDynamicViewIncludeRule, X as isDynamicViewParallelSteps, r as isElement, p as isElementKindExpr, j as isElementRef, q as isElementTagExpr, Z as isElementView, s as isElementWhere, k 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, m as isWildcard, g as nonexhaustive, L as whereOperatorAsPredicate } from './shared/core.BXTs-8n7.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 r$1(...t){return u$1(Object.values,t)}
6
+
7
+ function d$2(...e){return u$1(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
8
 
7
9
  var s={done:!1,hasNext:!1};
8
10
 
9
11
  function x(t,...o){let n=t,u=o.map(e=>"lazy"in e?f(e):void 0),p=0;for(;p<o.length;){if(u[p]===void 0||!B(n)){let i=o[p];n=i(n),p+=1;continue}let r=[];for(let i=p;i<o.length;i++){let l=u[i];if(l===void 0||(r.push(l),l.isSingle))break}let a=[];for(let i of n)if(A(i,a,r))break;let{isSingle:y}=r.at(-1);n=y?a[0]:a,p+=r.length;}return n}function A(t,o,n){if(n.length===0)return o.push(t),!1;let u=t,p=s,e=!1;for(let[r,a]of n.entries()){let{index:y,items:i}=a;if(i.push(u),p=a(u,y,i),a.index+=1,p.hasNext){if(p.hasMany??!1){for(let l of p.next)if(A(l,o,n.slice(r+1)))return !0;return e}u=p.next;}if(!p.hasNext)break;p.done&&(e=!0);}return p.hasNext&&o.push(u),e}function f(t){let{lazy:o,lazyArgs:n}=t,u=o(...n);return Object.assign(u,{isSingle:o.single??!1,index:0,items:[]})}function B(t){return typeof t=="string"||typeof t=="object"&&t!==null&&Symbol.iterator in t}
10
12
 
11
- function r$1(...n){return u$2(Object.values,n)}
13
+ function i$3(...e){return u$1(r,e)}var r=(e,t)=>e.length>=t;
12
14
 
13
- function i$3(...e){return u$2(r,e)}var r=(e,t)=>e.length>=t;
15
+ function u(...e){return u$1(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}
14
16
 
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}
17
+ function m$1(...r){return u$1(o$3,r)}function o$3(r,t){let e=[...r];return e.sort(t),e}
16
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
- 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}
21
+ function d$1(...e){return u$1(i$1,e)}function i$1(e,o){let t={};for(let[r,n]of Object.entries(e))o(n,r,e)&&(t[r]=n);return t}
20
22
 
21
- function m(...a){return u$2(o$1,a,p)}var o$1=(a,e)=>a.map(e),p=a=>(e,r,t)=>({done:!1,hasNext:!0,next:a(e,r,t)});
23
+ function m(...a){return u$1(o$1,a,p)}var o$1=(a,e)=>a.map(e),p=a=>(e,t,r)=>({done:!1,hasNext:!0,next:a(e,t,r)});
22
24
 
23
- function l$1(...n){return u$2(d,n)}function d(n,o){let e={};for(let[a,t]of n.entries()){let[y,u]=o(t,a,n);e[y]=u;}return e}
25
+ function l$1(...n){return u$1(d,n)}function d(n,o){let e={};for(let[a,t]of n.entries()){let[y,u]=o(t,a,n);e[y]=u;}return e}
24
26
 
25
- function i(...e){return u$2(o,e)}function o(e,u){let a={};for(let[n,r]of Object.entries(e)){let l=u(r,n,e);a[n]=l;}return a}
27
+ function i(...e){return u$1(o,e)}function o(e,r){let a={};for(let[n,u]of Object.entries(e)){let l=r(u,n,e);a[n]=l;}return a}
26
28
 
27
29
  function t$1(r){return typeof r=="string"}
28
30
 
@@ -32,7 +34,7 @@ function t(n){return typeof n=="function"}
32
34
 
33
35
  function l(n){return n!=null}
34
36
 
35
- function n(...r){return u$2(Object.fromEntries,r)}
37
+ function n(...r){return u$1(Object.fromEntries,r)}
36
38
 
37
39
  function getDefaultExportFromCjs (x) {
38
40
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -389,7 +391,7 @@ function $expr(expr) {
389
391
  }
390
392
  function $style(element, { notation, ...style }) {
391
393
  return (b) => b.style({
392
- targets: (n$2(element) ? element : [element]).map((e) => $expr(e)),
394
+ targets: (o$5(element) ? element : [element]).map((e) => $expr(e)),
393
395
  ...notation ? { notation } : {},
394
396
  style: {
395
397
  ...style
@@ -600,7 +602,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
600
602
  tags: null,
601
603
  color: specStyle?.color ?? DefaultThemeColor,
602
604
  shape: specStyle?.shape ?? DefaultElementShape,
603
- style: i$1({
605
+ style: d$1({
604
606
  border: specStyle?.border,
605
607
  opacity: specStyle?.opacity,
606
608
  ...style
@@ -4405,7 +4407,7 @@ class LikeC4DiagramModel {
4405
4407
  for (const node of view.nodes) {
4406
4408
  const el = new LikeC4DiagramModel.Element(node, this);
4407
4409
  this._elements.set(node.id, el);
4408
- if (e(node.parent)) {
4410
+ if (n$2(node.parent)) {
4409
4411
  this._rootElements.add(el);
4410
4412
  }
4411
4413
  }
@@ -4424,7 +4426,7 @@ class LikeC4DiagramModel {
4424
4426
  return this.view.title;
4425
4427
  }
4426
4428
  get viewOf() {
4427
- if (e(this.view.__) || this.view.__ === "element") {
4429
+ if (n$2(this.view.__) || this.view.__ === "element") {
4428
4430
  const computedView = this.view;
4429
4431
  return computedView.viewOf ? this.model.element(computedView.viewOf) : null;
4430
4432
  }
@@ -4543,7 +4545,7 @@ class LikeC4DiagramModel {
4543
4545
  return this.node.kind;
4544
4546
  }
4545
4547
  get isRoot() {
4546
- return e(this.node.parent);
4548
+ return n$2(this.node.parent);
4547
4549
  }
4548
4550
  get hasNested() {
4549
4551
  return this.node.children.length > 0;
@@ -4641,7 +4643,7 @@ class LikeC4ViewModel {
4641
4643
  for (const node of view.nodes) {
4642
4644
  const el = new LikeC4ViewModel.Element(node, this);
4643
4645
  this._elements.set(node.id, el);
4644
- if (e(node.parent)) {
4646
+ if (n$2(node.parent)) {
4645
4647
  this._rootElements.add(el);
4646
4648
  }
4647
4649
  }
@@ -4775,7 +4777,7 @@ class LikeC4ViewModel {
4775
4777
  return this.node.kind;
4776
4778
  }
4777
4779
  get isRoot() {
4778
- return e(this.node.parent);
4780
+ return n$2(this.node.parent);
4779
4781
  }
4780
4782
  get hasNested() {
4781
4783
  return this.node.children.length > 0;
@@ -4868,7 +4870,11 @@ class LikeC4Model {
4868
4870
  this.addRelation(rel);
4869
4871
  }
4870
4872
  this._views = new Map(
4871
- 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
+ )
4872
4878
  );
4873
4879
  }
4874
4880
  _elements = /* @__PURE__ */ new Map();
@@ -5250,6 +5256,12 @@ class LikeC4Model {
5250
5256
  children() {
5251
5257
  return this.model.children(this);
5252
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
+ }
5253
5265
  /**
5254
5266
  * All views 'view of' current element
5255
5267
  */
@@ -5297,8 +5309,8 @@ function commonHead(sources, targets, equals) {
5297
5309
  }
5298
5310
  equals ??= Object.is;
5299
5311
  return x(
5300
- d$1(sources, targets),
5301
- u$1(([source, target]) => equals(source, target)),
5312
+ d$2(sources, targets),
5313
+ u(([source, target]) => equals(source, target)),
5302
5314
  m(([source, _]) => source)
5303
5315
  );
5304
5316
  }
@@ -2,11 +2,11 @@ function u$1(t,n,a){let o=r=>t(r,...n);return a===void 0?o:Object.assign(o,{lazy
2
2
 
3
3
  function u(r,n,a){let o=r.length-n.length;if(o===0)return r(...n);if(o===1)return u$1(r,n,a);throw new Error("Wrong number of arguments")}
4
4
 
5
- function o(a){return t=>!a(t)}
5
+ function o$1(a){return t=>!a(t)}
6
6
 
7
- function e$1(n){return n==null}
7
+ function n(e){return e==null}
8
8
 
9
- function n(r){return Array.isArray(r)}
9
+ function o(r){return Array.isArray(r)}
10
10
 
11
11
  function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
12
12
 
@@ -159,12 +159,12 @@ function whereOperatorAsPredicate(operator) {
159
159
  }
160
160
  const kind = operator.kind.neq;
161
161
  return (value) => {
162
- return e$1(value.kind) || value.kind !== kind;
162
+ return n(value.kind) || value.kind !== kind;
163
163
  };
164
164
  }
165
165
  case isNotOperator(operator): {
166
166
  const predicate = whereOperatorAsPredicate(operator.not);
167
- return o(predicate);
167
+ return o$1(predicate);
168
168
  }
169
169
  case isAndOperator(operator): {
170
170
  const predicates = operator.and.map(whereOperatorAsPredicate);
@@ -225,13 +225,13 @@ function isDynamicViewIncludeRule(rule) {
225
225
  return "include" in rule && Array.isArray(rule.include);
226
226
  }
227
227
  function isDynamicViewParallelSteps(step) {
228
- return "__parallel" in step && n(step.__parallel);
228
+ return "__parallel" in step && o(step.__parallel);
229
229
  }
230
230
  function isDynamicView(view) {
231
231
  return view.__ === "dynamic";
232
232
  }
233
233
  function isElementView(view) {
234
- return e$1(view.__) || view.__ === "element";
234
+ return n(view.__) || view.__ === "element";
235
235
  }
236
236
  function isExtendsElementView(view) {
237
237
  return isElementView(view) && "extends" in view;
@@ -269,7 +269,7 @@ function isComputedDynamicView(view) {
269
269
  return view.__ === "dynamic";
270
270
  }
271
271
  function isComputedElementView(view) {
272
- return e$1(view.__) || view.__ === "element";
272
+ return n(view.__) || view.__ === "element";
273
273
  }
274
274
  function getBBoxCenter({
275
275
  x,
@@ -290,4 +290,4 @@ var DiagramNode;
290
290
  DiagramNode2.isNodesGroup = isNodesGroup;
291
291
  })(DiagramNode || (DiagramNode = {}));
292
292
 
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 };
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, DefaultRelationshipColor as e, expression as f, nonexhaustive as g, ElementShapes as h, isElementPredicateExpr as i, isElementRef as j, isExpandedElementExpr as k, isCustomElement as l, isWildcard as m, n, 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 };
@@ -2,7 +2,7 @@ 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 {
@@ -2,7 +2,7 @@ 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 {
@@ -2,7 +2,7 @@ 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 {
@@ -4,11 +4,11 @@ function u$1(t,n,a){let o=r=>t(r,...n);return a===void 0?o:Object.assign(o,{lazy
4
4
 
5
5
  function u(r,n,a){let o=r.length-n.length;if(o===0)return r(...n);if(o===1)return u$1(r,n,a);throw new Error("Wrong number of arguments")}
6
6
 
7
- function o(a){return t=>!a(t)}
7
+ function o$1(a){return t=>!a(t)}
8
8
 
9
- function e$1(n){return n==null}
9
+ function n(e){return e==null}
10
10
 
11
- function n(r){return Array.isArray(r)}
11
+ function o(r){return Array.isArray(r)}
12
12
 
13
13
  function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
14
14
 
@@ -161,12 +161,12 @@ function whereOperatorAsPredicate(operator) {
161
161
  }
162
162
  const kind = operator.kind.neq;
163
163
  return (value) => {
164
- return e$1(value.kind) || value.kind !== kind;
164
+ return n(value.kind) || value.kind !== kind;
165
165
  };
166
166
  }
167
167
  case isNotOperator(operator): {
168
168
  const predicate = whereOperatorAsPredicate(operator.not);
169
- return o(predicate);
169
+ return o$1(predicate);
170
170
  }
171
171
  case isAndOperator(operator): {
172
172
  const predicates = operator.and.map(whereOperatorAsPredicate);
@@ -227,13 +227,13 @@ function isDynamicViewIncludeRule(rule) {
227
227
  return "include" in rule && Array.isArray(rule.include);
228
228
  }
229
229
  function isDynamicViewParallelSteps(step) {
230
- return "__parallel" in step && n(step.__parallel);
230
+ return "__parallel" in step && o(step.__parallel);
231
231
  }
232
232
  function isDynamicView(view) {
233
233
  return view.__ === "dynamic";
234
234
  }
235
235
  function isElementView(view) {
236
- return e$1(view.__) || view.__ === "element";
236
+ return n(view.__) || view.__ === "element";
237
237
  }
238
238
  function isExtendsElementView(view) {
239
239
  return isElementView(view) && "extends" in view;
@@ -271,7 +271,7 @@ function isComputedDynamicView(view) {
271
271
  return view.__ === "dynamic";
272
272
  }
273
273
  function isComputedElementView(view) {
274
- return e$1(view.__) || view.__ === "element";
274
+ return n(view.__) || view.__ === "element";
275
275
  }
276
276
  function getBBoxCenter({
277
277
  x,
@@ -301,7 +301,6 @@ exports.DefaultRelationshipColor = DefaultRelationshipColor;
301
301
  exports.DefaultThemeColor = DefaultThemeColor;
302
302
  exports.ElementShapes = ElementShapes;
303
303
  exports.StepEdgeId = StepEdgeId;
304
- exports.e = e$1;
305
304
  exports.expression = expression;
306
305
  exports.extractStep = extractStep;
307
306
  exports.getBBoxCenter = getBBoxCenter;
@@ -349,5 +348,6 @@ exports.isWildcard = isWildcard;
349
348
  exports.n = n;
350
349
  exports.nonNullable = nonNullable;
351
350
  exports.nonexhaustive = nonexhaustive;
351
+ exports.o = o;
352
352
  exports.u = u;
353
353
  exports.whereOperatorAsPredicate = whereOperatorAsPredicate;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const types_index = require('../shared/core.zN6ZscFQ.cjs');
3
+ const types_index = require('../shared/core.DIYZvpVg.cjs');
4
4
 
5
5
 
6
6
 
@@ -1,2 +1,2 @@
1
- export { aG as AndOperator, G as AsFqn, A as AutoLayoutDirection, bF as BBox, bc as BasicElementView, bb as BasicView, B as BorderStyle, J as BorderStyles, C as Color, aS as ColorLiteral, bC as ComputedDynamicView, q as ComputedEdge, bB as ComputedElementView, r as ComputedLikeC4Model, n as ComputedNode, l as ComputedView, y as CustomColor, bo as CustomColorDefinitions, g as CustomElementExpr, h as CustomRelationExpr, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, v as DiagramEdge, u as DiagramNode, D as DiagramView, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, k as EdgeId, d as Element, a8 as ElementExpression, p as ElementKind, a4 as ElementKindExpr, E as ElementKindSpecification, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, a as ElementShape, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aU as ElementThemeColorValues, aV as ElementThemeColors, bf as ElementView, aa as ElementWhereExpr, az as EqualOperator, $ as ExpandedElementExpr, f as Expression, be as ExtendsElementView, aL as Filterable, F as Fqn, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, H as HexColorLiteral, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, s as LayoutedLikeC4Model, aY as LikeC4Theme, L as LikeC4View, U as Link, ay as ModelGlobals, o as NodeId, N as NonEmptyArray, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, P as ParsedLikeC4Model, z as Point, e as Relation, ae as RelationExpr, am as RelationExpression, i as RelationID, ar as RelationPredicateExpression, ao as RelationWhereExpr, b as RelationshipArrowType, t as RelationshipKind, R as RelationshipKindSpecification, c as RelationshipLineType, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, m as Tag, aA as TagEqual, S as TagSpec, aR as ThemeColor, T as ThemeColorValues, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, j as ViewID, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, V as ViewRuleStyle, b4 as ViewRuleStyleOrGlobalRef, by as ViewWithHash, bz as ViewWithNotation, aK as WhereOperator, a2 as WildcardExpr, X as XYPoint, bw as extractStep, bG as getBBoxCenter, bx as getParallelStepsPrefix, aH as isAndOperator, b5 as isAutoLayoutDirection, bD as isComputedDynamicView, bE as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bp as isDynamicView, bk as isDynamicViewIncludeRule, bn as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bq as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, br as isExtendsElementView, ah as isInOut, aj as isIncoming, aD as isKindEqual, aF as isNotOperator, aJ as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, bs as isScopedElementView, bv as isStepEdgeId, aB as isTagEqual, aT as isThemeColor, b7 as isViewRuleAutoLayout, b0 as isViewRuleGlobalPredicateRef, b3 as isViewRuleGlobalStyle, b9 as isViewRuleGroup, a_ as isViewRulePredicate, b1 as isViewRuleStyle, a3 as isWildcard, aM as whereOperatorAsPredicate } from '../shared/core.gZyGTUZz.cjs';
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 { aG as AndOperator, G as AsFqn, A as AutoLayoutDirection, bF as BBox, bc as BasicElementView, bb as BasicView, B as BorderStyle, J as BorderStyles, C as Color, aS as ColorLiteral, bC as ComputedDynamicView, q as ComputedEdge, bB as ComputedElementView, r as ComputedLikeC4Model, n as ComputedNode, l as ComputedView, y as CustomColor, bo as CustomColorDefinitions, g as CustomElementExpr, h as CustomRelationExpr, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, v as DiagramEdge, u as DiagramNode, D as DiagramView, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, k as EdgeId, d as Element, a8 as ElementExpression, p as ElementKind, a4 as ElementKindExpr, E as ElementKindSpecification, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, a as ElementShape, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aU as ElementThemeColorValues, aV as ElementThemeColors, bf as ElementView, aa as ElementWhereExpr, az as EqualOperator, $ as ExpandedElementExpr, f as Expression, be as ExtendsElementView, aL as Filterable, F as Fqn, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, H as HexColorLiteral, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, s as LayoutedLikeC4Model, aY as LikeC4Theme, L as LikeC4View, U as Link, ay as ModelGlobals, o as NodeId, N as NonEmptyArray, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, P as ParsedLikeC4Model, z as Point, e as Relation, ae as RelationExpr, am as RelationExpression, i as RelationID, ar as RelationPredicateExpression, ao as RelationWhereExpr, b as RelationshipArrowType, t as RelationshipKind, R as RelationshipKindSpecification, c as RelationshipLineType, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, m as Tag, aA as TagEqual, S as TagSpec, aR as ThemeColor, T as ThemeColorValues, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, j as ViewID, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, V as ViewRuleStyle, b4 as ViewRuleStyleOrGlobalRef, by as ViewWithHash, bz as ViewWithNotation, aK as WhereOperator, a2 as WildcardExpr, X as XYPoint, bw as extractStep, bG as getBBoxCenter, bx as getParallelStepsPrefix, aH as isAndOperator, b5 as isAutoLayoutDirection, bD as isComputedDynamicView, bE as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bp as isDynamicView, bk as isDynamicViewIncludeRule, bn as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bq as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, br as isExtendsElementView, ah as isInOut, aj as isIncoming, aD as isKindEqual, aF as isNotOperator, aJ as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, bs as isScopedElementView, bv as isStepEdgeId, aB as isTagEqual, aT as isThemeColor, b7 as isViewRuleAutoLayout, b0 as isViewRuleGlobalPredicateRef, b3 as isViewRuleGlobalStyle, b9 as isViewRuleGroup, a_ as isViewRulePredicate, b1 as isViewRuleStyle, a3 as isWildcard, aM as whereOperatorAsPredicate } from '../shared/core.gZyGTUZz.mjs';
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 { aG as AndOperator, G as AsFqn, A as AutoLayoutDirection, bF as BBox, bc as BasicElementView, bb as BasicView, B as BorderStyle, J as BorderStyles, C as Color, aS as ColorLiteral, bC as ComputedDynamicView, q as ComputedEdge, bB as ComputedElementView, r as ComputedLikeC4Model, n as ComputedNode, l as ComputedView, y as CustomColor, bo as CustomColorDefinitions, g as CustomElementExpr, h as CustomRelationExpr, aP as DefaultArrowType, O as DefaultElementShape, aO as DefaultLineStyle, aQ as DefaultRelationshipColor, M as DefaultThemeColor, v as DiagramEdge, u as DiagramNode, D as DiagramView, bm as DynamicView, bj as DynamicViewIncludeRule, bh as DynamicViewParallelSteps, bl as DynamicViewRule, bg as DynamicViewStep, bi as DynamicViewStepOrParallel, k as EdgeId, d as Element, a8 as ElementExpression, p as ElementKind, a4 as ElementKindExpr, E as ElementKindSpecification, Y as ElementKindSpecificationStyle, bJ as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, a as ElementShape, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aU as ElementThemeColorValues, aV as ElementThemeColors, bf as ElementView, aa as ElementWhereExpr, az as EqualOperator, $ as ExpandedElementExpr, f as Expression, be as ExtendsElementView, aL as Filterable, F as Fqn, av as GlobalDynamicPredicates, at as GlobalPredicateId, au as GlobalPredicates, aw as GlobalStyleID, ax as GlobalStyles, H as HexColorLiteral, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, aC as KindEqual, s as LayoutedLikeC4Model, aY as LikeC4Theme, L as LikeC4View, U as Link, ay as ModelGlobals, o as NodeId, N as NonEmptyArray, x as NonEmptyReadonlyArray, aE as NotOperator, aI as OrOperator, ak as OutgoingExpr, aN as OverviewGraph, P as ParsedLikeC4Model, z as Point, e as Relation, ae as RelationExpr, am as RelationExpression, i as RelationID, ar as RelationPredicateExpression, ao as RelationWhereExpr, b as RelationshipArrowType, t as RelationshipKind, R as RelationshipKindSpecification, c as RelationshipLineType, aW as RelationshipThemeColorValues, aX as RelationshipThemeColors, bd as ScopedElementView, bu as StepEdgeId, bt as StepEdgeIdLiteral, m as Tag, aA as TagEqual, S as TagSpec, aR as ThemeColor, T as ThemeColorValues, W as TypedElement, bA as ViewAutoLayout, bI as ViewChange, j as ViewID, bH as ViewManualLayout, ba as ViewRule, b6 as ViewRuleAutoLayout, a$ as ViewRuleGlobalPredicateRef, b2 as ViewRuleGlobalStyle, b8 as ViewRuleGroup, aZ as ViewRulePredicate, V as ViewRuleStyle, b4 as ViewRuleStyleOrGlobalRef, by as ViewWithHash, bz as ViewWithNotation, aK as WhereOperator, a2 as WildcardExpr, X as XYPoint, bw as extractStep, bG as getBBoxCenter, bx as getParallelStepsPrefix, aH as isAndOperator, b5 as isAutoLayoutDirection, bD as isComputedDynamicView, bE as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bp as isDynamicView, bk as isDynamicViewIncludeRule, bn as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bq as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, br as isExtendsElementView, ah as isInOut, aj as isIncoming, aD as isKindEqual, aF as isNotOperator, aJ as isOrOperator, al as isOutgoing, af as isRelation, an as isRelationExpression, as as isRelationPredicateExpr, ap as isRelationWhere, bs as isScopedElementView, bv as isStepEdgeId, aB as isTagEqual, aT as isThemeColor, b7 as isViewRuleAutoLayout, b0 as isViewRuleGlobalPredicateRef, b3 as isViewRuleGlobalStyle, b9 as isViewRuleGroup, a_ as isViewRulePredicate, b1 as isViewRuleStyle, a3 as isWildcard, aM as whereOperatorAsPredicate } from '../shared/core.gZyGTUZz.js';
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, 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';
1
+ export { A as AsFqn, B as BorderStyles, a3 as ComputedNode, N as DefaultArrowType, c as DefaultElementShape, M as DefaultLineStyle, e as DefaultRelationshipColor, D as DefaultThemeColor, a7 as DiagramNode, E as ElementKind, h 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, l as isCustomElement, C as isCustomRelationExpr, Y as isDynamicView, W as isDynamicViewIncludeRule, X as isDynamicViewParallelSteps, r as isElement, p as isElementKindExpr, i as isElementPredicateExpr, j as isElementRef, q as isElementTagExpr, Z as isElementView, s as isElementWhere, k 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, m as isWildcard, L as whereOperatorAsPredicate } from '../shared/core.BXTs-8n7.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/core",
3
- "version": "1.16.0",
3
+ "version": "1.17.1",
4
4
  "license": "MIT",
5
5
  "homepage": "https://likec4.dev",
6
6
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -77,20 +77,20 @@
77
77
  },
78
78
  "dependencies": {
79
79
  "defu": "^6.1.4",
80
- "type-fest": "4.26.1"
80
+ "type-fest": "4.27.1"
81
81
  },
82
82
  "devDependencies": {
83
- "@likec4/tsconfig": "1.16.0",
84
- "@mantine/colors-generator": "7.13.4",
83
+ "@likec4/tsconfig": "1.17.1",
84
+ "@mantine/colors-generator": "7.14.1",
85
85
  "@types/natural-compare-lite": "^1.4.2",
86
86
  "chroma-js": "^3.1.2",
87
87
  "execa": "^9.3.1",
88
88
  "natural-compare-lite": "^1.4.0",
89
- "remeda": "^2.16.0",
90
- "turbo": "^2.2.3",
91
- "typescript": "^5.6.3",
89
+ "remeda": "^2.17.3",
90
+ "turbo": "^2.3.1",
91
+ "typescript": "^5.7.2",
92
92
  "unbuild": "^3.0.0-rc.11",
93
- "vitest": "^2.1.4"
93
+ "vitest": "^2.1.5"
94
94
  },
95
- "packageManager": "yarn@4.5.1"
95
+ "packageManager": "yarn@4.5.3"
96
96
  }
@@ -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
  */
@@ -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