@likec4/core 1.13.0 → 1.15.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 +54 -5
- package/dist/index.d.cts +8 -3
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.mjs +48 -14
- package/dist/shared/{core.C4jDMQ1i.d.cts → core.CYtN9Czk.d.cts} +40 -3
- package/dist/shared/{core.C4jDMQ1i.d.mts → core.CYtN9Czk.d.mts} +40 -3
- package/dist/shared/{core.C4jDMQ1i.d.ts → core.CYtN9Czk.d.ts} +40 -3
- package/dist/shared/{core.IR7XOEkQ.cjs → core.Cq_6j35U.cjs} +26 -0
- package/dist/shared/{core.BJDxVHFh.mjs → core.zYtlWYjW.mjs} +25 -1
- package/dist/types/index.cjs +15 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.mjs +1 -1
- package/package.json +8 -8
- package/src/builder/Builder.ts +8 -0
- package/src/index.ts +1 -0
- package/src/model/__test__/fixture.ts +3 -0
- package/src/types/element.ts +3 -0
- package/src/types/global.ts +10 -0
- package/src/types/index.ts +1 -0
- package/src/types/model.ts +4 -0
- package/src/types/view.ts +51 -3
- package/src/utils/commonHead.ts +20 -0
- package/src/utils/index.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const types_index = require('./shared/core.
|
|
3
|
+
const types_index = require('./shared/core.Cq_6j35U.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
|
+
var s={done:!1,hasNext:!1};
|
|
11
|
+
|
|
12
|
+
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}
|
|
13
|
+
|
|
10
14
|
function r$1(...n){return types_index.u(Object.values,n)}
|
|
11
15
|
|
|
16
|
+
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});
|
|
17
|
+
|
|
18
|
+
function u$1(...e){return types_index.u(i$3,e)}function i$3(e,a){let n=[];for(let[o,r]of e.entries()){if(!a(r,o,e))break;n.push(r);}return n}
|
|
19
|
+
|
|
12
20
|
function i$2(...e){return types_index.u(r,e)}var r=(e,t)=>e.length>=t;
|
|
13
21
|
|
|
14
22
|
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)}
|
|
@@ -400,7 +408,7 @@ function $rules(...rules) {
|
|
|
400
408
|
return (b) => rules.reduce((b2, rule) => rule(b2), b);
|
|
401
409
|
}
|
|
402
410
|
|
|
403
|
-
function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _views = /* @__PURE__ */ new Map()) {
|
|
411
|
+
function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _globals = { styles: [] }, _views = /* @__PURE__ */ new Map()) {
|
|
404
412
|
const toLikeC4Specification = () => ({
|
|
405
413
|
tags: spec.tags ?? [],
|
|
406
414
|
elements: {
|
|
@@ -459,6 +467,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
|
|
|
459
467
|
structuredClone(spec),
|
|
460
468
|
structuredClone(_elements),
|
|
461
469
|
structuredClone(_relations),
|
|
470
|
+
structuredClone(_globals),
|
|
462
471
|
structuredClone(_views)
|
|
463
472
|
),
|
|
464
473
|
__model: () => ({
|
|
@@ -514,6 +523,9 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
|
|
|
514
523
|
specification: toLikeC4Specification(),
|
|
515
524
|
elements: n(Array.from(_elements.entries())),
|
|
516
525
|
relations: l$1(_relations, (r) => [r.id, r]),
|
|
526
|
+
globals: {
|
|
527
|
+
styles: l$1(_globals.styles, (s) => [s.id, s])
|
|
528
|
+
},
|
|
517
529
|
views: n(Array.from(_views.entries()))
|
|
518
530
|
}),
|
|
519
531
|
helpers: () => ({
|
|
@@ -793,6 +805,16 @@ const PITHIRD = PI$2 / 3;
|
|
|
793
805
|
const DEG2RAD = PI$2 / 180;
|
|
794
806
|
const RAD2DEG = 180 / PI$2;
|
|
795
807
|
|
|
808
|
+
/**
|
|
809
|
+
* Reverse the first three elements of an array
|
|
810
|
+
*
|
|
811
|
+
* @param {any[]} arr
|
|
812
|
+
* @returns {any[]}
|
|
813
|
+
*/
|
|
814
|
+
function reverse3(arr) {
|
|
815
|
+
return [...arr.slice(0, 3).reverse(), ...arr.slice(3)];
|
|
816
|
+
}
|
|
817
|
+
|
|
796
818
|
const input = {
|
|
797
819
|
format: {},
|
|
798
820
|
autodetect: []
|
|
@@ -845,7 +867,7 @@ class Color {
|
|
|
845
867
|
}
|
|
846
868
|
|
|
847
869
|
// this gets updated automatically
|
|
848
|
-
const version = '3.1.
|
|
870
|
+
const version = '3.1.2';
|
|
849
871
|
|
|
850
872
|
const chroma = (...args) => {
|
|
851
873
|
return new Color(...args);
|
|
@@ -1573,7 +1595,7 @@ const lch2rgb = (...args) => {
|
|
|
1573
1595
|
};
|
|
1574
1596
|
|
|
1575
1597
|
const hcl2rgb = (...args) => {
|
|
1576
|
-
const hcl = unpack(args, 'hcl')
|
|
1598
|
+
const hcl = reverse3(unpack(args, 'hcl'));
|
|
1577
1599
|
return lch2rgb(...hcl);
|
|
1578
1600
|
};
|
|
1579
1601
|
|
|
@@ -1598,7 +1620,7 @@ Color.prototype.lch = function () {
|
|
|
1598
1620
|
return rgb2lch(this._rgb);
|
|
1599
1621
|
};
|
|
1600
1622
|
Color.prototype.hcl = function () {
|
|
1601
|
-
return rgb2lch(this._rgb)
|
|
1623
|
+
return reverse3(rgb2lch(this._rgb));
|
|
1602
1624
|
};
|
|
1603
1625
|
|
|
1604
1626
|
const lch$1 = (...args) => new Color(...args, 'lch');
|
|
@@ -5272,6 +5294,18 @@ class LikeC4Model {
|
|
|
5272
5294
|
LikeC4Model2.ElementModel = ElementModel;
|
|
5273
5295
|
})(LikeC4Model || (LikeC4Model = {}));
|
|
5274
5296
|
|
|
5297
|
+
function commonHead(sources, targets, equals) {
|
|
5298
|
+
if (sources.length === 0 || targets.length === 0) {
|
|
5299
|
+
return [];
|
|
5300
|
+
}
|
|
5301
|
+
equals ??= Object.is;
|
|
5302
|
+
return x(
|
|
5303
|
+
d$1(sources, targets),
|
|
5304
|
+
u$1(([source, target]) => equals(source, target)),
|
|
5305
|
+
m(([source, _]) => source)
|
|
5306
|
+
);
|
|
5307
|
+
}
|
|
5308
|
+
|
|
5275
5309
|
const DELAY = "LIKEC4_DELAY";
|
|
5276
5310
|
function delay(...args) {
|
|
5277
5311
|
let ms = 100;
|
|
@@ -5309,11 +5343,23 @@ const compareRelations = (a, b) => {
|
|
|
5309
5343
|
|
|
5310
5344
|
exports.AsFqn = types_index.AsFqn;
|
|
5311
5345
|
exports.BorderStyles = types_index.BorderStyles;
|
|
5346
|
+
Object.defineProperty(exports, "ComputedNode", {
|
|
5347
|
+
enumerable: true,
|
|
5348
|
+
get: function () { return types_index.ComputedNode; }
|
|
5349
|
+
});
|
|
5312
5350
|
exports.DefaultArrowType = types_index.DefaultArrowType;
|
|
5313
5351
|
exports.DefaultElementShape = types_index.DefaultElementShape;
|
|
5314
5352
|
exports.DefaultLineStyle = types_index.DefaultLineStyle;
|
|
5315
5353
|
exports.DefaultRelationshipColor = types_index.DefaultRelationshipColor;
|
|
5316
5354
|
exports.DefaultThemeColor = types_index.DefaultThemeColor;
|
|
5355
|
+
Object.defineProperty(exports, "DiagramNode", {
|
|
5356
|
+
enumerable: true,
|
|
5357
|
+
get: function () { return types_index.DiagramNode; }
|
|
5358
|
+
});
|
|
5359
|
+
Object.defineProperty(exports, "ElementKind", {
|
|
5360
|
+
enumerable: true,
|
|
5361
|
+
get: function () { return types_index.ElementKind; }
|
|
5362
|
+
});
|
|
5317
5363
|
exports.ElementShapes = types_index.ElementShapes;
|
|
5318
5364
|
exports.Expr = types_index.expression;
|
|
5319
5365
|
exports.StepEdgeId = types_index.StepEdgeId;
|
|
@@ -5354,6 +5400,8 @@ exports.isStepEdgeId = types_index.isStepEdgeId;
|
|
|
5354
5400
|
exports.isTagEqual = types_index.isTagEqual;
|
|
5355
5401
|
exports.isThemeColor = types_index.isThemeColor;
|
|
5356
5402
|
exports.isViewRuleAutoLayout = types_index.isViewRuleAutoLayout;
|
|
5403
|
+
exports.isViewRuleGlobalStyle = types_index.isViewRuleGlobalStyle;
|
|
5404
|
+
exports.isViewRuleGroup = types_index.isViewRuleGroup;
|
|
5357
5405
|
exports.isViewRulePredicate = types_index.isViewRulePredicate;
|
|
5358
5406
|
exports.isViewRuleStyle = types_index.isViewRuleStyle;
|
|
5359
5407
|
exports.isWildcard = types_index.isWildcard;
|
|
@@ -5367,6 +5415,7 @@ exports.LikeC4ViewModel = LikeC4ViewModel;
|
|
|
5367
5415
|
exports.RelationshipColors = RelationshipColors;
|
|
5368
5416
|
exports.ancestorsFqn = ancestorsFqn;
|
|
5369
5417
|
exports.commonAncestor = commonAncestor;
|
|
5418
|
+
exports.commonHead = commonHead;
|
|
5370
5419
|
exports.compareByFqnHierarchically = compareByFqnHierarchically;
|
|
5371
5420
|
exports.compareFqnHierarchically = compareFqnHierarchically;
|
|
5372
5421
|
exports.compareNatural = compareNatural;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IfNever, TupleToUnion, Tagged, Simplify, LiteralUnion, Class, IsNumericLiteral } from 'type-fest';
|
|
2
|
-
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.
|
|
3
|
-
export {
|
|
2
|
+
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.CYtN9Czk.cjs';
|
|
3
|
+
export { aC as AndOperator, G as AsFqn, by as BBox, b5 as BasicElementView, b4 as BasicView, J as BorderStyles, aN as ColorLiteral, bv as ComputedDynamicView, bu as ComputedElementView, y as CustomColor, bh as CustomColorDefinitions, aK as DefaultArrowType, O as DefaultElementShape, aJ as DefaultLineStyle, aL as DefaultRelationshipColor, M as DefaultThemeColor, bf as DynamicView, bc as DynamicViewIncludeRule, ba as DynamicViewParallelSteps, be as DynamicViewRule, b9 as DynamicViewStep, bb as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bC as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aP as ElementThemeColorValues, aQ as ElementThemeColors, b8 as ElementView, aa as ElementWhereExpr, av as EqualOperator, $ as ExpandedElementExpr, w as Expr, b7 as ExtendsElementView, au as GlobalStyle, at as GlobalStyleID, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, ay as KindEqual, aT as LikeC4Theme, U as Link, x as NonEmptyReadonlyArray, aA as NotOperator, aE as OrOperator, ak as OutgoingExpr, aI as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aR as RelationshipThemeColorValues, aS as RelationshipThemeColors, b6 as ScopedElementView, bn as StepEdgeId, bm as StepEdgeIdLiteral, aw as TagEqual, S as TagSpec, aM as ThemeColor, W as TypedElement, bt as ViewAutoLayout, bB as ViewChange, bA as ViewManualLayout, b3 as ViewRule, a$ as ViewRuleAutoLayout, aX as ViewRuleGlobalStyle, b1 as ViewRuleGroup, aU as ViewRulePredicate, aZ as ViewRuleStyleOrGlobalRef, br as ViewWithHash, bs as ViewWithNotation, aG as WhereOperator, a2 as WildcardExpr, X as XYPoint, bp as extractStep, bz as getBBoxCenter, bq as getParallelStepsPrefix, aD as isAndOperator, a_ as isAutoLayoutDirection, bw as isComputedDynamicView, bx as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bi as isDynamicView, bd as isDynamicViewIncludeRule, bg as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bj as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, bk 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, bl as isScopedElementView, bo as isStepEdgeId, ax as isTagEqual, aO as isThemeColor, b0 as isViewRuleAutoLayout, aY as isViewRuleGlobalStyle, b2 as isViewRuleGroup, aV as isViewRulePredicate, aW as isViewRuleStyle, a3 as isWildcard, aH as whereOperatorAsPredicate } from './shared/core.CYtN9Czk.cjs';
|
|
4
4
|
|
|
5
5
|
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
6
6
|
type BuilderSpecification = {
|
|
@@ -898,6 +898,11 @@ declare namespace LikeC4DiagramModel {
|
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
900
|
|
|
901
|
+
/**
|
|
902
|
+
* Common head of two arrays
|
|
903
|
+
*/
|
|
904
|
+
declare function commonHead<T>(sources: ReadonlyArray<T>, targets: ReadonlyArray<T>, equals?: (a: T, b: T) => boolean): T[];
|
|
905
|
+
|
|
901
906
|
declare function compareNatural(a: string | undefined, b: string | undefined): -1 | 0 | 1;
|
|
902
907
|
|
|
903
908
|
type Predicate<T> = (x: T) => boolean;
|
|
@@ -1040,4 +1045,4 @@ declare const compareRelations: <T extends {
|
|
|
1040
1045
|
target: string;
|
|
1041
1046
|
}>(a: T, b: T) => 0 | 1 | -1;
|
|
1042
1047
|
|
|
1043
|
-
export { type AnyTypes, type AnyTypesNested, AutoLayoutDirection, BorderStyle, Builder, type BuilderSpecification, Color, ComputedEdge, ComputedLikeC4Model, ComputedNode, ComputedView, CustomElementExpr, CustomRelationExpr, DiagramEdge, DiagramNode, DiagramView, EdgeId$1 as EdgeId, Element, ElementColors, ElementKind, ElementKindSpecification, ElementShape, type Expression, Fqn$1 as Fqn, HexColorLiteral, LayoutedLikeC4Model, LikeC4DiagramModel, LikeC4Model, LikeC4View, LikeC4ViewModel, type ModelBuilder, type ModelHelpers, NodeId, NonEmptyArray, ParsedLikeC4Model, Relation, RelationID$1 as RelationID, RelationshipArrowType, RelationshipColors, RelationshipKind, RelationshipKindSpecification, RelationshipLineType, Tag, ThemeColorValues, Types, type TypesNested, type ViewBuilder, type ViewHelpers, ViewID$1 as ViewID, ViewRuleStyle, type ViewsBuilder, ancestorsFqn, commonAncestor, compareByFqnHierarchically, compareFqnHierarchically, compareNatural, compareRelations, computeColorValues, defaultTheme, delay, hasAtLeast, invariant, isAncestor, isDescendantOf, isNonEmptyArray, isSameHierarchy, isString, nameFromFqn, nonNullable, nonexhaustive, notDescendantOf, parentFqn, parentFqnPredicate, sortByFqnHierarchically, sortNaturalByFqn };
|
|
1048
|
+
export { type AnyTypes, type AnyTypesNested, AutoLayoutDirection, BorderStyle, Builder, type BuilderSpecification, Color, ComputedEdge, ComputedLikeC4Model, ComputedNode, ComputedView, CustomElementExpr, CustomRelationExpr, DiagramEdge, DiagramNode, DiagramView, EdgeId$1 as EdgeId, Element, ElementColors, ElementKind, ElementKindSpecification, ElementShape, type Expression, Fqn$1 as Fqn, HexColorLiteral, LayoutedLikeC4Model, LikeC4DiagramModel, LikeC4Model, LikeC4View, LikeC4ViewModel, type ModelBuilder, type ModelHelpers, NodeId, NonEmptyArray, ParsedLikeC4Model, Relation, RelationID$1 as RelationID, RelationshipArrowType, RelationshipColors, RelationshipKind, RelationshipKindSpecification, RelationshipLineType, Tag, ThemeColorValues, Types, type TypesNested, type ViewBuilder, type ViewHelpers, ViewID$1 as ViewID, ViewRuleStyle, type ViewsBuilder, ancestorsFqn, commonAncestor, commonHead, compareByFqnHierarchically, compareFqnHierarchically, compareNatural, compareRelations, computeColorValues, defaultTheme, delay, hasAtLeast, invariant, isAncestor, isDescendantOf, isNonEmptyArray, isSameHierarchy, isString, nameFromFqn, nonNullable, nonexhaustive, notDescendantOf, parentFqn, parentFqnPredicate, sortByFqnHierarchically, sortNaturalByFqn };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IfNever, TupleToUnion, Tagged, Simplify, LiteralUnion, Class, IsNumericLiteral } from 'type-fest';
|
|
2
|
-
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.
|
|
3
|
-
export {
|
|
2
|
+
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.CYtN9Czk.mjs';
|
|
3
|
+
export { aC as AndOperator, G as AsFqn, by as BBox, b5 as BasicElementView, b4 as BasicView, J as BorderStyles, aN as ColorLiteral, bv as ComputedDynamicView, bu as ComputedElementView, y as CustomColor, bh as CustomColorDefinitions, aK as DefaultArrowType, O as DefaultElementShape, aJ as DefaultLineStyle, aL as DefaultRelationshipColor, M as DefaultThemeColor, bf as DynamicView, bc as DynamicViewIncludeRule, ba as DynamicViewParallelSteps, be as DynamicViewRule, b9 as DynamicViewStep, bb as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bC as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aP as ElementThemeColorValues, aQ as ElementThemeColors, b8 as ElementView, aa as ElementWhereExpr, av as EqualOperator, $ as ExpandedElementExpr, w as Expr, b7 as ExtendsElementView, au as GlobalStyle, at as GlobalStyleID, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, ay as KindEqual, aT as LikeC4Theme, U as Link, x as NonEmptyReadonlyArray, aA as NotOperator, aE as OrOperator, ak as OutgoingExpr, aI as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aR as RelationshipThemeColorValues, aS as RelationshipThemeColors, b6 as ScopedElementView, bn as StepEdgeId, bm as StepEdgeIdLiteral, aw as TagEqual, S as TagSpec, aM as ThemeColor, W as TypedElement, bt as ViewAutoLayout, bB as ViewChange, bA as ViewManualLayout, b3 as ViewRule, a$ as ViewRuleAutoLayout, aX as ViewRuleGlobalStyle, b1 as ViewRuleGroup, aU as ViewRulePredicate, aZ as ViewRuleStyleOrGlobalRef, br as ViewWithHash, bs as ViewWithNotation, aG as WhereOperator, a2 as WildcardExpr, X as XYPoint, bp as extractStep, bz as getBBoxCenter, bq as getParallelStepsPrefix, aD as isAndOperator, a_ as isAutoLayoutDirection, bw as isComputedDynamicView, bx as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bi as isDynamicView, bd as isDynamicViewIncludeRule, bg as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bj as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, bk 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, bl as isScopedElementView, bo as isStepEdgeId, ax as isTagEqual, aO as isThemeColor, b0 as isViewRuleAutoLayout, aY as isViewRuleGlobalStyle, b2 as isViewRuleGroup, aV as isViewRulePredicate, aW as isViewRuleStyle, a3 as isWildcard, aH as whereOperatorAsPredicate } from './shared/core.CYtN9Czk.mjs';
|
|
4
4
|
|
|
5
5
|
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
6
6
|
type BuilderSpecification = {
|
|
@@ -898,6 +898,11 @@ declare namespace LikeC4DiagramModel {
|
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
900
|
|
|
901
|
+
/**
|
|
902
|
+
* Common head of two arrays
|
|
903
|
+
*/
|
|
904
|
+
declare function commonHead<T>(sources: ReadonlyArray<T>, targets: ReadonlyArray<T>, equals?: (a: T, b: T) => boolean): T[];
|
|
905
|
+
|
|
901
906
|
declare function compareNatural(a: string | undefined, b: string | undefined): -1 | 0 | 1;
|
|
902
907
|
|
|
903
908
|
type Predicate<T> = (x: T) => boolean;
|
|
@@ -1040,4 +1045,4 @@ declare const compareRelations: <T extends {
|
|
|
1040
1045
|
target: string;
|
|
1041
1046
|
}>(a: T, b: T) => 0 | 1 | -1;
|
|
1042
1047
|
|
|
1043
|
-
export { type AnyTypes, type AnyTypesNested, AutoLayoutDirection, BorderStyle, Builder, type BuilderSpecification, Color, ComputedEdge, ComputedLikeC4Model, ComputedNode, ComputedView, CustomElementExpr, CustomRelationExpr, DiagramEdge, DiagramNode, DiagramView, EdgeId$1 as EdgeId, Element, ElementColors, ElementKind, ElementKindSpecification, ElementShape, type Expression, Fqn$1 as Fqn, HexColorLiteral, LayoutedLikeC4Model, LikeC4DiagramModel, LikeC4Model, LikeC4View, LikeC4ViewModel, type ModelBuilder, type ModelHelpers, NodeId, NonEmptyArray, ParsedLikeC4Model, Relation, RelationID$1 as RelationID, RelationshipArrowType, RelationshipColors, RelationshipKind, RelationshipKindSpecification, RelationshipLineType, Tag, ThemeColorValues, Types, type TypesNested, type ViewBuilder, type ViewHelpers, ViewID$1 as ViewID, ViewRuleStyle, type ViewsBuilder, ancestorsFqn, commonAncestor, compareByFqnHierarchically, compareFqnHierarchically, compareNatural, compareRelations, computeColorValues, defaultTheme, delay, hasAtLeast, invariant, isAncestor, isDescendantOf, isNonEmptyArray, isSameHierarchy, isString, nameFromFqn, nonNullable, nonexhaustive, notDescendantOf, parentFqn, parentFqnPredicate, sortByFqnHierarchically, sortNaturalByFqn };
|
|
1048
|
+
export { type AnyTypes, type AnyTypesNested, AutoLayoutDirection, BorderStyle, Builder, type BuilderSpecification, Color, ComputedEdge, ComputedLikeC4Model, ComputedNode, ComputedView, CustomElementExpr, CustomRelationExpr, DiagramEdge, DiagramNode, DiagramView, EdgeId$1 as EdgeId, Element, ElementColors, ElementKind, ElementKindSpecification, ElementShape, type Expression, Fqn$1 as Fqn, HexColorLiteral, LayoutedLikeC4Model, LikeC4DiagramModel, LikeC4Model, LikeC4View, LikeC4ViewModel, type ModelBuilder, type ModelHelpers, NodeId, NonEmptyArray, ParsedLikeC4Model, Relation, RelationID$1 as RelationID, RelationshipArrowType, RelationshipColors, RelationshipKind, RelationshipKindSpecification, RelationshipLineType, Tag, ThemeColorValues, Types, type TypesNested, type ViewBuilder, type ViewHelpers, ViewID$1 as ViewID, ViewRuleStyle, type ViewsBuilder, ancestorsFqn, commonAncestor, commonHead, compareByFqnHierarchically, compareFqnHierarchically, compareNatural, compareRelations, computeColorValues, defaultTheme, delay, hasAtLeast, invariant, isAncestor, isDescendantOf, isNonEmptyArray, isSameHierarchy, isString, nameFromFqn, nonNullable, nonexhaustive, notDescendantOf, parentFqn, parentFqnPredicate, sortByFqnHierarchically, sortNaturalByFqn };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IfNever, TupleToUnion, Tagged, Simplify, LiteralUnion, Class, IsNumericLiteral } from 'type-fest';
|
|
2
|
-
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.
|
|
3
|
-
export {
|
|
2
|
+
import { E as ElementKindSpecification, R as RelationshipKindSpecification, P as ParsedLikeC4Model, a as ElementShape, C as Color, B as BorderStyle, b as RelationshipArrowType, c as RelationshipLineType, d as Element, e as Relation, F as Fqn$1, L as LikeC4View, f as Expression, V as ViewRuleStyle, A as AutoLayoutDirection, N as NonEmptyArray, g as CustomElementExpr, h as CustomRelationExpr, H as HexColorLiteral, T as ThemeColorValues, i as RelationID$1, j as ViewID$1, k as EdgeId$1, l as ComputedView, m as Tag, n as ComputedNode, o as NodeId, p as ElementKind, q as ComputedEdge, r as ComputedLikeC4Model, s as LayoutedLikeC4Model, t as RelationshipKind, D as DiagramView, u as DiagramNode, v as DiagramEdge } from './shared/core.CYtN9Czk.js';
|
|
3
|
+
export { aC as AndOperator, G as AsFqn, by as BBox, b5 as BasicElementView, b4 as BasicView, J as BorderStyles, aN as ColorLiteral, bv as ComputedDynamicView, bu as ComputedElementView, y as CustomColor, bh as CustomColorDefinitions, aK as DefaultArrowType, O as DefaultElementShape, aJ as DefaultLineStyle, aL as DefaultRelationshipColor, M as DefaultThemeColor, bf as DynamicView, bc as DynamicViewIncludeRule, ba as DynamicViewParallelSteps, be as DynamicViewRule, b9 as DynamicViewStep, bb as DynamicViewStepOrParallel, a8 as ElementExpression, a4 as ElementKindExpr, Y as ElementKindSpecificationStyle, bC as ElementNotation, ac as ElementPredicateExpression, Z as ElementRefExpr, K as ElementShapes, Q as ElementStyle, a6 as ElementTagExpr, aP as ElementThemeColorValues, aQ as ElementThemeColors, b8 as ElementView, aa as ElementWhereExpr, av as EqualOperator, $ as ExpandedElementExpr, w as Expr, b7 as ExtendsElementView, au as GlobalStyle, at as GlobalStyleID, I as IconUrl, ag as InOutExpr, ai as IncomingExpr, ay as KindEqual, aT as LikeC4Theme, U as Link, x as NonEmptyReadonlyArray, aA as NotOperator, aE as OrOperator, ak as OutgoingExpr, aI as OverviewGraph, z as Point, ae as RelationExpr, am as RelationExpression, ar as RelationPredicateExpression, ao as RelationWhereExpr, aR as RelationshipThemeColorValues, aS as RelationshipThemeColors, b6 as ScopedElementView, bn as StepEdgeId, bm as StepEdgeIdLiteral, aw as TagEqual, S as TagSpec, aM as ThemeColor, W as TypedElement, bt as ViewAutoLayout, bB as ViewChange, bA as ViewManualLayout, b3 as ViewRule, a$ as ViewRuleAutoLayout, aX as ViewRuleGlobalStyle, b1 as ViewRuleGroup, aU as ViewRulePredicate, aZ as ViewRuleStyleOrGlobalRef, br as ViewWithHash, bs as ViewWithNotation, aG as WhereOperator, a2 as WildcardExpr, X as XYPoint, bp as extractStep, bz as getBBoxCenter, bq as getParallelStepsPrefix, aD as isAndOperator, a_ as isAutoLayoutDirection, bw as isComputedDynamicView, bx as isComputedElementView, a1 as isCustomElement, aq as isCustomRelationExpr, bi as isDynamicView, bd as isDynamicViewIncludeRule, bg as isDynamicViewParallelSteps, a9 as isElement, a5 as isElementKindExpr, ad as isElementPredicateExpr, _ as isElementRef, a7 as isElementTagExpr, bj as isElementView, ab as isElementWhere, a0 as isExpandedElementExpr, bk 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, bl as isScopedElementView, bo as isStepEdgeId, ax as isTagEqual, aO as isThemeColor, b0 as isViewRuleAutoLayout, aY as isViewRuleGlobalStyle, b2 as isViewRuleGroup, aV as isViewRulePredicate, aW as isViewRuleStyle, a3 as isWildcard, aH as whereOperatorAsPredicate } from './shared/core.CYtN9Czk.js';
|
|
4
4
|
|
|
5
5
|
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
6
6
|
type BuilderSpecification = {
|
|
@@ -898,6 +898,11 @@ declare namespace LikeC4DiagramModel {
|
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
900
|
|
|
901
|
+
/**
|
|
902
|
+
* Common head of two arrays
|
|
903
|
+
*/
|
|
904
|
+
declare function commonHead<T>(sources: ReadonlyArray<T>, targets: ReadonlyArray<T>, equals?: (a: T, b: T) => boolean): T[];
|
|
905
|
+
|
|
901
906
|
declare function compareNatural(a: string | undefined, b: string | undefined): -1 | 0 | 1;
|
|
902
907
|
|
|
903
908
|
type Predicate<T> = (x: T) => boolean;
|
|
@@ -1040,4 +1045,4 @@ declare const compareRelations: <T extends {
|
|
|
1040
1045
|
target: string;
|
|
1041
1046
|
}>(a: T, b: T) => 0 | 1 | -1;
|
|
1042
1047
|
|
|
1043
|
-
export { type AnyTypes, type AnyTypesNested, AutoLayoutDirection, BorderStyle, Builder, type BuilderSpecification, Color, ComputedEdge, ComputedLikeC4Model, ComputedNode, ComputedView, CustomElementExpr, CustomRelationExpr, DiagramEdge, DiagramNode, DiagramView, EdgeId$1 as EdgeId, Element, ElementColors, ElementKind, ElementKindSpecification, ElementShape, type Expression, Fqn$1 as Fqn, HexColorLiteral, LayoutedLikeC4Model, LikeC4DiagramModel, LikeC4Model, LikeC4View, LikeC4ViewModel, type ModelBuilder, type ModelHelpers, NodeId, NonEmptyArray, ParsedLikeC4Model, Relation, RelationID$1 as RelationID, RelationshipArrowType, RelationshipColors, RelationshipKind, RelationshipKindSpecification, RelationshipLineType, Tag, ThemeColorValues, Types, type TypesNested, type ViewBuilder, type ViewHelpers, ViewID$1 as ViewID, ViewRuleStyle, type ViewsBuilder, ancestorsFqn, commonAncestor, compareByFqnHierarchically, compareFqnHierarchically, compareNatural, compareRelations, computeColorValues, defaultTheme, delay, hasAtLeast, invariant, isAncestor, isDescendantOf, isNonEmptyArray, isSameHierarchy, isString, nameFromFqn, nonNullable, nonexhaustive, notDescendantOf, parentFqn, parentFqnPredicate, sortByFqnHierarchically, sortNaturalByFqn };
|
|
1048
|
+
export { type AnyTypes, type AnyTypesNested, AutoLayoutDirection, BorderStyle, Builder, type BuilderSpecification, Color, ComputedEdge, ComputedLikeC4Model, ComputedNode, ComputedView, CustomElementExpr, CustomRelationExpr, DiagramEdge, DiagramNode, DiagramView, EdgeId$1 as EdgeId, Element, ElementColors, ElementKind, ElementKindSpecification, ElementShape, type Expression, Fqn$1 as Fqn, HexColorLiteral, LayoutedLikeC4Model, LikeC4DiagramModel, LikeC4Model, LikeC4View, LikeC4ViewModel, type ModelBuilder, type ModelHelpers, NodeId, NonEmptyArray, ParsedLikeC4Model, Relation, RelationID$1 as RelationID, RelationshipArrowType, RelationshipColors, RelationshipKind, RelationshipKindSpecification, RelationshipLineType, Tag, ThemeColorValues, Types, type TypesNested, type ViewBuilder, type ViewHelpers, ViewID$1 as ViewID, ViewRuleStyle, type ViewsBuilder, ancestorsFqn, commonAncestor, commonHead, compareByFqnHierarchically, compareFqnHierarchically, compareNatural, compareRelations, computeColorValues, defaultTheme, delay, hasAtLeast, invariant, isAncestor, isDescendantOf, isNonEmptyArray, isSameHierarchy, isString, nameFromFqn, nonNullable, nonexhaustive, notDescendantOf, parentFqn, parentFqnPredicate, sortByFqnHierarchically, sortNaturalByFqn };
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import { u as u$
|
|
2
|
-
export { A as AsFqn, B as BorderStyles,
|
|
1
|
+
import { u as u$2, i as isElementPredicateExpr, n as n$2, a as invariant, b as isScopedElementView, D as DefaultThemeColor, c as DefaultElementShape, e, d as nonNullable, f as DefaultRelationshipColor } from './shared/core.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';
|
|
3
3
|
import defu from 'defu';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var s={done:!1,hasNext:!1};
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
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}
|
|
8
|
+
|
|
9
|
+
function r$1(...n){return u$2(Object.values,n)}
|
|
10
|
+
|
|
11
|
+
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});
|
|
12
|
+
|
|
13
|
+
function u$1(...e){return u$2(i$3,e)}function i$3(e,a){let n=[];for(let[o,r]of e.entries()){if(!a(r,o,e))break;n.push(r);}return n}
|
|
14
|
+
|
|
15
|
+
function i$2(...e){return u$2(r,e)}var r=(e,t)=>e.length>=t;
|
|
8
16
|
|
|
9
17
|
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)}
|
|
10
18
|
|
|
11
|
-
function i$1(...e){return u$
|
|
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}
|
|
12
20
|
|
|
13
|
-
function m(...a){return u$
|
|
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)});
|
|
14
22
|
|
|
15
|
-
function l$1(...n){return u$
|
|
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}
|
|
16
24
|
|
|
17
|
-
function i(...e){return u$
|
|
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}
|
|
18
26
|
|
|
19
27
|
function t$1(r){return typeof r=="string"}
|
|
20
28
|
|
|
@@ -24,7 +32,7 @@ function t(n){return typeof n=="function"}
|
|
|
24
32
|
|
|
25
33
|
function l(n){return n!=null}
|
|
26
34
|
|
|
27
|
-
function n(...r){return u$
|
|
35
|
+
function n(...r){return u$2(Object.fromEntries,r)}
|
|
28
36
|
|
|
29
37
|
function getDefaultExportFromCjs (x) {
|
|
30
38
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -395,7 +403,7 @@ function $rules(...rules) {
|
|
|
395
403
|
return (b) => rules.reduce((b2, rule) => rule(b2), b);
|
|
396
404
|
}
|
|
397
405
|
|
|
398
|
-
function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _views = /* @__PURE__ */ new Map()) {
|
|
406
|
+
function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _globals = { styles: [] }, _views = /* @__PURE__ */ new Map()) {
|
|
399
407
|
const toLikeC4Specification = () => ({
|
|
400
408
|
tags: spec.tags ?? [],
|
|
401
409
|
elements: {
|
|
@@ -454,6 +462,7 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
|
|
|
454
462
|
structuredClone(spec),
|
|
455
463
|
structuredClone(_elements),
|
|
456
464
|
structuredClone(_relations),
|
|
465
|
+
structuredClone(_globals),
|
|
457
466
|
structuredClone(_views)
|
|
458
467
|
),
|
|
459
468
|
__model: () => ({
|
|
@@ -509,6 +518,9 @@ function builder(spec, _elements = /* @__PURE__ */ new Map(), _relations = [], _
|
|
|
509
518
|
specification: toLikeC4Specification(),
|
|
510
519
|
elements: n(Array.from(_elements.entries())),
|
|
511
520
|
relations: l$1(_relations, (r) => [r.id, r]),
|
|
521
|
+
globals: {
|
|
522
|
+
styles: l$1(_globals.styles, (s) => [s.id, s])
|
|
523
|
+
},
|
|
512
524
|
views: n(Array.from(_views.entries()))
|
|
513
525
|
}),
|
|
514
526
|
helpers: () => ({
|
|
@@ -788,6 +800,16 @@ const PITHIRD = PI$2 / 3;
|
|
|
788
800
|
const DEG2RAD = PI$2 / 180;
|
|
789
801
|
const RAD2DEG = 180 / PI$2;
|
|
790
802
|
|
|
803
|
+
/**
|
|
804
|
+
* Reverse the first three elements of an array
|
|
805
|
+
*
|
|
806
|
+
* @param {any[]} arr
|
|
807
|
+
* @returns {any[]}
|
|
808
|
+
*/
|
|
809
|
+
function reverse3(arr) {
|
|
810
|
+
return [...arr.slice(0, 3).reverse(), ...arr.slice(3)];
|
|
811
|
+
}
|
|
812
|
+
|
|
791
813
|
const input = {
|
|
792
814
|
format: {},
|
|
793
815
|
autodetect: []
|
|
@@ -840,7 +862,7 @@ class Color {
|
|
|
840
862
|
}
|
|
841
863
|
|
|
842
864
|
// this gets updated automatically
|
|
843
|
-
const version = '3.1.
|
|
865
|
+
const version = '3.1.2';
|
|
844
866
|
|
|
845
867
|
const chroma = (...args) => {
|
|
846
868
|
return new Color(...args);
|
|
@@ -1568,7 +1590,7 @@ const lch2rgb = (...args) => {
|
|
|
1568
1590
|
};
|
|
1569
1591
|
|
|
1570
1592
|
const hcl2rgb = (...args) => {
|
|
1571
|
-
const hcl = unpack(args, 'hcl')
|
|
1593
|
+
const hcl = reverse3(unpack(args, 'hcl'));
|
|
1572
1594
|
return lch2rgb(...hcl);
|
|
1573
1595
|
};
|
|
1574
1596
|
|
|
@@ -1593,7 +1615,7 @@ Color.prototype.lch = function () {
|
|
|
1593
1615
|
return rgb2lch(this._rgb);
|
|
1594
1616
|
};
|
|
1595
1617
|
Color.prototype.hcl = function () {
|
|
1596
|
-
return rgb2lch(this._rgb)
|
|
1618
|
+
return reverse3(rgb2lch(this._rgb));
|
|
1597
1619
|
};
|
|
1598
1620
|
|
|
1599
1621
|
const lch$1 = (...args) => new Color(...args, 'lch');
|
|
@@ -5267,6 +5289,18 @@ class LikeC4Model {
|
|
|
5267
5289
|
LikeC4Model2.ElementModel = ElementModel;
|
|
5268
5290
|
})(LikeC4Model || (LikeC4Model = {}));
|
|
5269
5291
|
|
|
5292
|
+
function commonHead(sources, targets, equals) {
|
|
5293
|
+
if (sources.length === 0 || targets.length === 0) {
|
|
5294
|
+
return [];
|
|
5295
|
+
}
|
|
5296
|
+
equals ??= Object.is;
|
|
5297
|
+
return x(
|
|
5298
|
+
d$1(sources, targets),
|
|
5299
|
+
u$1(([source, target]) => equals(source, target)),
|
|
5300
|
+
m(([source, _]) => source)
|
|
5301
|
+
);
|
|
5302
|
+
}
|
|
5303
|
+
|
|
5270
5304
|
const DELAY = "LIKEC4_DELAY";
|
|
5271
5305
|
function delay(...args) {
|
|
5272
5306
|
let ms = 100;
|
|
@@ -5302,4 +5336,4 @@ const compareRelations = (a, b) => {
|
|
|
5302
5336
|
return compareFqnHierarchically(a.target, b.target);
|
|
5303
5337
|
};
|
|
5304
5338
|
|
|
5305
|
-
export { Builder, DefaultElementShape, DefaultRelationshipColor, DefaultThemeColor, ElementColors, LikeC4DiagramModel, LikeC4Model, LikeC4ViewModel, RelationshipColors, ancestorsFqn, commonAncestor, compareByFqnHierarchically, compareFqnHierarchically, compareNatural, compareRelations, computeColorValues, defaultTheme, delay, i$2 as hasAtLeast, invariant, isAncestor, isDescendantOf, isElementPredicateExpr, isNonEmptyArray, isSameHierarchy, isScopedElementView, isString, nameFromFqn, nonNullable, notDescendantOf, parentFqn, parentFqnPredicate, sortByFqnHierarchically, sortNaturalByFqn };
|
|
5339
|
+
export { Builder, DefaultElementShape, DefaultRelationshipColor, DefaultThemeColor, ElementColors, LikeC4DiagramModel, LikeC4Model, LikeC4ViewModel, RelationshipColors, ancestorsFqn, commonAncestor, commonHead, compareByFqnHierarchically, compareFqnHierarchically, compareNatural, compareRelations, computeColorValues, defaultTheme, delay, i$2 as hasAtLeast, invariant, isAncestor, isDescendantOf, isElementPredicateExpr, isNonEmptyArray, isSameHierarchy, isScopedElementView, isString, nameFromFqn, nonNullable, notDescendantOf, parentFqn, parentFqnPredicate, sortByFqnHierarchically, sortNaturalByFqn };
|
|
@@ -49,6 +49,9 @@ declare function AsFqn(name: string, parent?: Fqn | null): Fqn;
|
|
|
49
49
|
declare const BorderStyles: readonly ["solid", "dashed", "dotted", "none"];
|
|
50
50
|
type BorderStyle = TupleToUnion<typeof BorderStyles>;
|
|
51
51
|
type ElementKind<Kinds extends string = string> = Tagged<Kinds, 'ElementKind'>;
|
|
52
|
+
declare namespace ElementKind {
|
|
53
|
+
const Group: ElementKind;
|
|
54
|
+
}
|
|
52
55
|
declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue"];
|
|
53
56
|
type ElementShape = TupleToUnion<typeof ElementShapes>;
|
|
54
57
|
declare const DefaultThemeColor = "primary";
|
|
@@ -139,6 +142,12 @@ type Filterable<FTag extends string = string, FKind extends string = string> = {
|
|
|
139
142
|
type OperatorPredicate<V extends Filterable> = (value: V) => boolean;
|
|
140
143
|
declare function whereOperatorAsPredicate<FTag extends string = string, FKind extends string = string>(operator: WhereOperator<FTag, FKind>): OperatorPredicate<Filterable<FTag, FKind>>;
|
|
141
144
|
|
|
145
|
+
type GlobalStyleID = Tagged<string, 'GlobalStyleID'>;
|
|
146
|
+
interface GlobalStyle {
|
|
147
|
+
readonly id: GlobalStyleID;
|
|
148
|
+
readonly styles: NonEmptyArray<ViewRuleStyle>;
|
|
149
|
+
}
|
|
150
|
+
|
|
142
151
|
type ElementNotation = {
|
|
143
152
|
kinds: ElementKind[];
|
|
144
153
|
shape: ElementShape;
|
|
@@ -165,6 +174,11 @@ interface ViewRuleStyle {
|
|
|
165
174
|
};
|
|
166
175
|
}
|
|
167
176
|
declare function isViewRuleStyle(rule: ViewRule): rule is ViewRuleStyle;
|
|
177
|
+
interface ViewRuleGlobalStyle {
|
|
178
|
+
styleId: GlobalStyleID;
|
|
179
|
+
}
|
|
180
|
+
declare function isViewRuleGlobalStyle(rule: ViewRule): rule is ViewRuleGlobalStyle;
|
|
181
|
+
type ViewRuleStyleOrGlobalRef = ViewRuleStyle | ViewRuleGlobalStyle;
|
|
168
182
|
type AutoLayoutDirection = 'TB' | 'BT' | 'LR' | 'RL';
|
|
169
183
|
declare function isAutoLayoutDirection(autoLayout: unknown): autoLayout is AutoLayoutDirection;
|
|
170
184
|
interface ViewRuleAutoLayout {
|
|
@@ -173,7 +187,15 @@ interface ViewRuleAutoLayout {
|
|
|
173
187
|
rankSep?: number;
|
|
174
188
|
}
|
|
175
189
|
declare function isViewRuleAutoLayout(rule: ViewRule): rule is ViewRuleAutoLayout;
|
|
176
|
-
|
|
190
|
+
interface ViewRuleGroup {
|
|
191
|
+
groupRules: Array<ViewRulePredicate | ViewRuleGroup>;
|
|
192
|
+
title: string | null;
|
|
193
|
+
color?: Color;
|
|
194
|
+
border?: BorderStyle;
|
|
195
|
+
opacity?: number;
|
|
196
|
+
}
|
|
197
|
+
declare function isViewRuleGroup(rule: ViewRule): rule is ViewRuleGroup;
|
|
198
|
+
type ViewRule = ViewRulePredicate | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
177
199
|
interface BasicView<ViewType extends 'element' | 'dynamic', ViewIDs extends string, Tags extends string> {
|
|
178
200
|
readonly __?: ViewType;
|
|
179
201
|
readonly id: ViewID<ViewIDs>;
|
|
@@ -236,7 +258,7 @@ type DynamicViewIncludeRule = {
|
|
|
236
258
|
include: ElementPredicateExpression[];
|
|
237
259
|
};
|
|
238
260
|
declare function isDynamicViewIncludeRule(rule: DynamicViewRule): rule is DynamicViewIncludeRule;
|
|
239
|
-
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleStyle | ViewRuleAutoLayout;
|
|
261
|
+
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
240
262
|
interface DynamicView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<'dynamic', ViewIDs, Tags> {
|
|
241
263
|
readonly __: 'dynamic';
|
|
242
264
|
readonly steps: DynamicViewStepOrParallel[];
|
|
@@ -290,6 +312,12 @@ interface ComputedNode {
|
|
|
290
312
|
*/
|
|
291
313
|
isCustomized?: boolean;
|
|
292
314
|
}
|
|
315
|
+
declare namespace ComputedNode {
|
|
316
|
+
/**
|
|
317
|
+
* Nodes group is a special kind of node, exisiting only in view
|
|
318
|
+
*/
|
|
319
|
+
function isNodesGroup(node: ComputedNode): boolean;
|
|
320
|
+
}
|
|
293
321
|
interface ComputedEdge {
|
|
294
322
|
id: EdgeId;
|
|
295
323
|
parent: NodeId | null;
|
|
@@ -367,6 +395,12 @@ interface DiagramNode extends ComputedNode {
|
|
|
367
395
|
position: Point;
|
|
368
396
|
labelBBox: BBox;
|
|
369
397
|
}
|
|
398
|
+
declare namespace DiagramNode {
|
|
399
|
+
/**
|
|
400
|
+
* Nodes group is a special kind of node, exisiting only in view
|
|
401
|
+
*/
|
|
402
|
+
function isNodesGroup(node: DiagramNode): boolean;
|
|
403
|
+
}
|
|
370
404
|
interface DiagramEdge extends ComputedEdge {
|
|
371
405
|
points: NonEmptyArray<Point>;
|
|
372
406
|
controlPoints?: NonEmptyArray<XYPoint>;
|
|
@@ -605,6 +639,9 @@ interface ParsedLikeC4Model<ElementKinds extends string = string, RelationKinds
|
|
|
605
639
|
};
|
|
606
640
|
elements: Record<Fqns, TypedElement<Fqns, ElementKinds, Tags>>;
|
|
607
641
|
relations: Record<RelationID, Relation>;
|
|
642
|
+
globals: {
|
|
643
|
+
styles: Record<GlobalStyleID, GlobalStyle>;
|
|
644
|
+
};
|
|
608
645
|
views: Record<Views, LikeC4View<Views, Tags>>;
|
|
609
646
|
}
|
|
610
647
|
/**
|
|
@@ -687,4 +724,4 @@ declare namespace ViewChange {
|
|
|
687
724
|
}
|
|
688
725
|
type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
|
|
689
726
|
|
|
690
|
-
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
|
|
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, type ViewRuleAutoLayout 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, whereOperatorAsPredicate as aH, OverviewGraph as aI, DefaultLineStyle as aJ, DefaultArrowType as aK, DefaultRelationshipColor as aL, type ThemeColor as aM, type ColorLiteral as aN, isThemeColor as aO, type ElementThemeColorValues as aP, type ElementThemeColors as aQ, type RelationshipThemeColorValues as aR, type RelationshipThemeColors as aS, type LikeC4Theme as aT, type ViewRulePredicate as aU, isViewRulePredicate as aV, isViewRuleStyle as aW, type ViewRuleGlobalStyle as aX, isViewRuleGlobalStyle as aY, type ViewRuleStyleOrGlobalRef as aZ, isAutoLayoutDirection 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, isViewRuleAutoLayout as b0, type ViewRuleGroup as b1, isViewRuleGroup as b2, type ViewRule as b3, type BasicView as b4, type BasicElementView as b5, type ScopedElementView as b6, type ExtendsElementView as b7, type ElementView as b8, type DynamicViewStep as b9, type ViewManualLayout as bA, ViewChange as bB, type ElementNotation as bC, type DynamicViewParallelSteps as ba, type DynamicViewStepOrParallel as bb, type DynamicViewIncludeRule as bc, isDynamicViewIncludeRule as bd, type DynamicViewRule as be, type DynamicView as bf, isDynamicViewParallelSteps as bg, type CustomColorDefinitions as bh, isDynamicView as bi, isElementView as bj, isExtendsElementView as bk, isScopedElementView as bl, type StepEdgeIdLiteral as bm, StepEdgeId as bn, isStepEdgeId as bo, extractStep as bp, getParallelStepsPrefix as bq, type ViewWithHash as br, type ViewWithNotation as bs, type ViewAutoLayout as bt, type ComputedElementView as bu, type ComputedDynamicView as bv, isComputedDynamicView as bw, isComputedElementView as bx, type BBox as by, getBBoxCenter 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 };
|