@likec4/core 1.20.1 → 1.20.3
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/builder/index.cjs +6 -6
- package/dist/builder/index.d.cts +3 -3
- package/dist/builder/index.d.mts +3 -3
- package/dist/builder/index.d.ts +3 -3
- package/dist/builder/index.mjs +6 -6
- package/dist/compute-view/index.cjs +5 -5
- package/dist/compute-view/index.d.cts +4 -4
- package/dist/compute-view/index.d.mts +4 -4
- package/dist/compute-view/index.d.ts +4 -4
- package/dist/compute-view/index.mjs +6 -6
- package/dist/index.cjs +71 -573
- package/dist/index.d.cts +9 -133
- package/dist/index.d.mts +9 -133
- package/dist/index.d.ts +9 -133
- package/dist/index.mjs +8 -512
- package/dist/model/index.cjs +1 -1
- package/dist/model/index.d.cts +5 -5
- package/dist/model/index.d.mts +5 -5
- package/dist/model/index.d.ts +5 -5
- package/dist/model/index.mjs +1 -1
- package/dist/shared/{core.DunIMHRf.mjs → core.0PxLtLpP.mjs} +1 -1
- package/dist/shared/{core.BvdNMbcA.d.cts → core.88YY6vtF.d.mts} +2 -2
- package/dist/shared/{core.CqCTxzMY.mjs → core.BG1hfxpq.mjs} +29 -620
- package/dist/shared/{core.ByNgh-mC.d.cts → core.BIZD3l1g.d.cts} +1 -1
- package/dist/shared/{core.D74xkKkG.d.ts → core.BJfn72tj.d.cts} +5 -0
- package/dist/shared/{core.D74xkKkG.d.cts → core.BJfn72tj.d.mts} +5 -0
- package/dist/shared/{core.D74xkKkG.d.mts → core.BJfn72tj.d.ts} +5 -0
- package/dist/shared/{core.M-JWF7SS.mjs → core.Bezy7K65.mjs} +1 -1
- package/dist/shared/{core.D_Gc58Gt.d.ts → core.Bs71hdR4.d.ts} +2 -1
- package/dist/shared/{core.D6-fWbM3.d.ts → core.BtISRjMA.d.ts} +1 -1
- package/dist/shared/{core.B72vUaNB.d.cts → core.C0ygs98j.d.cts} +2 -1
- package/dist/shared/core.CCyhaU-4.mjs +14819 -0
- package/dist/shared/{core.DsoCu540.cjs → core.CKYxnFEl.cjs} +1 -1
- package/dist/shared/{core.Damrzla-.d.ts → core.CNUzoKM7.d.ts} +2 -2
- package/dist/shared/{core.sLaWHBjR.d.mts → core.CajOK_t3.d.mts} +1 -1
- package/dist/shared/{core.BdbFkE_p.d.cts → core.Cmfo_N4F.d.mts} +3 -3
- package/dist/shared/{core.jy6z2iRn.d.mts → core.CwZmAghJ.d.cts} +3 -3
- package/dist/shared/{core.ZWiGANIJ.d.ts → core.D4wZW7zR.d.ts} +3 -3
- package/dist/shared/{core.BGus30EM.cjs → core.DRfrKNT6.cjs} +48 -643
- package/dist/shared/{core.gv1bMwCC.cjs → core.Db_OTRdC.cjs} +1 -1
- package/dist/shared/{core.Dfzrh1VA.d.mts → core.DjMYkPMQ.d.mts} +2 -1
- package/dist/shared/{core.m3rCQAv6.mjs → core.El-gigOM.mjs} +1 -1
- package/dist/shared/core.FACQZmma.cjs +14874 -0
- package/dist/shared/{core.BRuJ3Wzf.d.mts → core.Lh2RFJf1.d.cts} +2 -2
- package/dist/shared/{core.B2QYWlYe.cjs → core.uxHtIZaH.cjs} +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.mjs +1 -1
- package/dist/utils/index.cjs +6 -2
- package/dist/utils/index.d.cts +129 -145
- package/dist/utils/index.d.mts +129 -145
- package/dist/utils/index.d.ts +129 -145
- package/dist/utils/index.mjs +3 -3
- package/package.json +7 -6
- package/src/compute-view/deployment-view/clean-connections.ts +1 -1
- package/src/compute-view/deployment-view/stages/stage-final.ts +1 -1
- package/src/compute-view/element-view/__test__/fixture.ts +2 -0
- package/src/compute-view/element-view/compute.ts +1 -1
- package/src/compute-view/element-view/memory/memory.ts +3 -3
- package/src/compute-view/memory/ops.ts +1 -1
- package/src/compute-view/relationships-view/layout.ts +1 -1
- package/src/compute-view/relationships-view/utils.ts +1 -1
- package/src/compute-view/utils/applyCustomElementProperties.ts +9 -6
- package/src/compute-view/utils/applyViewRuleStyles.ts +7 -4
- package/src/index.ts +0 -8
- package/src/model/DeploymentModel.ts +1 -1
- package/src/model/LikeC4Model.ts +3 -3
- package/src/types/element.ts +7 -2
- package/src/types/expression.ts +1 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/set.ts +5 -2
- package/dist/shared/core.BxvDITEI.mjs +0 -859
- package/dist/shared/core.C9DCnJh8.cjs +0 -908
- package/src/builder/Builder-style1.test-d.ts +0 -190
- package/src/builder/Builder-style2.test-d.ts +0 -175
- package/src/compute-view/utils/uniqueTags.test.ts +0 -42
- package/src/model/LikeC4Model.test-d.ts +0 -152
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import dagre, { type EdgeConfig, type GraphLabel } from '@dagrejs/dagre'
|
|
2
|
-
import DefaultMap from 'mnemonist
|
|
2
|
+
import { DefaultMap } from 'mnemonist'
|
|
3
3
|
import { concat, filter, forEachObj, groupBy, map, mapToObj, pipe, prop, reduce, tap } from 'remeda'
|
|
4
4
|
import { invariant } from '../../errors'
|
|
5
5
|
import type { ElementModel } from '../../model/ElementModel'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isEmpty, isNullish, omitBy } from 'remeda'
|
|
2
|
-
import { ComputedNode, isCustomElement, isViewRuleGroup, isViewRulePredicate
|
|
2
|
+
import { type ViewRule, ComputedNode, isCustomElement, isViewRuleGroup, isViewRulePredicate } from '../../types'
|
|
3
3
|
import type { Expression } from '../../types/expression'
|
|
4
4
|
import { elementExprToPredicate } from './elementExpressionToPredicate'
|
|
5
5
|
|
|
@@ -24,10 +24,10 @@ export function applyCustomElementProperties(_rules: ViewRule[], _nodes: Compute
|
|
|
24
24
|
const nodes = [..._nodes]
|
|
25
25
|
for (
|
|
26
26
|
const {
|
|
27
|
-
custom: { expr, ...props }
|
|
27
|
+
custom: { expr, ...props },
|
|
28
28
|
} of rules
|
|
29
29
|
) {
|
|
30
|
-
const { border, opacity, ...rest } = omitBy(props, isNullish)
|
|
30
|
+
const { border, opacity, multiple, ...rest } = omitBy(props, isNullish)
|
|
31
31
|
const notEmpty = !isEmpty(rest)
|
|
32
32
|
const satisfies = elementExprToPredicate(expr)
|
|
33
33
|
nodes.forEach((node, i) => {
|
|
@@ -38,7 +38,7 @@ export function applyCustomElementProperties(_rules: ViewRule[], _nodes: Compute
|
|
|
38
38
|
node = {
|
|
39
39
|
...node,
|
|
40
40
|
isCustomized: true,
|
|
41
|
-
...rest
|
|
41
|
+
...rest,
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -49,14 +49,17 @@ export function applyCustomElementProperties(_rules: ViewRule[], _nodes: Compute
|
|
|
49
49
|
if (opacity !== undefined) {
|
|
50
50
|
styleOverride = { ...styleOverride, opacity }
|
|
51
51
|
}
|
|
52
|
+
if (multiple !== undefined) {
|
|
53
|
+
styleOverride = { ...styleOverride, multiple }
|
|
54
|
+
}
|
|
52
55
|
if (styleOverride) {
|
|
53
56
|
node = {
|
|
54
57
|
...node,
|
|
55
58
|
isCustomized: true,
|
|
56
59
|
style: {
|
|
57
60
|
...node.style,
|
|
58
|
-
...styleOverride
|
|
59
|
-
}
|
|
61
|
+
...styleOverride,
|
|
62
|
+
},
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
nodes[i] = node
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { anyPass, filter, forEach, isDefined, isNot, pipe } from 'remeda'
|
|
2
|
-
import {
|
|
2
|
+
import { type ViewRule, type ViewRuleStyle, ComputedNode, isViewRuleStyle } from '../../types'
|
|
3
3
|
import { elementExprToPredicate } from './elementExpressionToPredicate'
|
|
4
4
|
|
|
5
5
|
type Predicate<T> = (x: T) => boolean
|
|
@@ -9,7 +9,7 @@ type CommonViewRuleStyle = Pick<ViewRuleStyle, 'style' | 'notation'>
|
|
|
9
9
|
export function applyViewRuleStyle<Rule extends CommonViewRuleStyle>(
|
|
10
10
|
rule: Rule,
|
|
11
11
|
predicates: Predicate<ComputedNode>[],
|
|
12
|
-
nodes: ComputedNode[]
|
|
12
|
+
nodes: ComputedNode[],
|
|
13
13
|
) {
|
|
14
14
|
pipe(
|
|
15
15
|
nodes,
|
|
@@ -31,13 +31,16 @@ export function applyViewRuleStyle<Rule extends CommonViewRuleStyle>(
|
|
|
31
31
|
if (isDefined(rule.style.opacity)) {
|
|
32
32
|
styleOverride = { ...styleOverride, opacity: rule.style.opacity }
|
|
33
33
|
}
|
|
34
|
+
if (isDefined(rule.style.multiple)) {
|
|
35
|
+
styleOverride = { ...styleOverride, multiple: rule.style.multiple }
|
|
36
|
+
}
|
|
34
37
|
if (styleOverride) {
|
|
35
38
|
n.style = {
|
|
36
39
|
...n.style,
|
|
37
|
-
...styleOverride
|
|
40
|
+
...styleOverride,
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
|
-
})
|
|
43
|
+
}),
|
|
41
44
|
)
|
|
42
45
|
}
|
|
43
46
|
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import DefaultMap from 'mnemonist/default-map'
|
|
2
|
-
import LinkedList from 'mnemonist/linked-list'
|
|
3
|
-
import Queue from 'mnemonist/queue'
|
|
4
|
-
import Stack from 'mnemonist/stack'
|
|
5
|
-
// import dagre from '@dagrejs/dagre'
|
|
6
|
-
|
|
7
|
-
export { DefaultMap, LinkedList, Queue, Stack }
|
|
8
|
-
|
|
9
1
|
export {
|
|
10
2
|
computeColorValues,
|
|
11
3
|
defaultTheme,
|
package/src/model/LikeC4Model.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import DefaultMap from 'mnemonist
|
|
1
|
+
import { DefaultMap } from 'mnemonist'
|
|
2
2
|
import { mapValues, pipe, sort, values } from 'remeda'
|
|
3
3
|
import type { LiteralUnion } from 'type-fest'
|
|
4
4
|
import { computeView, unsafeComputeView } from '../compute-view'
|
|
@@ -27,9 +27,9 @@ import { NodeModel } from './view/NodeModel'
|
|
|
27
27
|
|
|
28
28
|
export class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Don't use in runtime, only for type inference
|
|
31
31
|
*/
|
|
32
|
-
readonly Aux
|
|
32
|
+
readonly Aux: M = {} as M
|
|
33
33
|
|
|
34
34
|
readonly #elements = new Map<M['Element'], ElementModel<M>>()
|
|
35
35
|
// Parent element for given FQN
|
package/src/types/element.ts
CHANGED
|
@@ -24,7 +24,7 @@ export const ElementShapes = [
|
|
|
24
24
|
'mobile',
|
|
25
25
|
'cylinder',
|
|
26
26
|
'storage',
|
|
27
|
-
'queue'
|
|
27
|
+
'queue',
|
|
28
28
|
] as const
|
|
29
29
|
|
|
30
30
|
export type ElementShape = TupleToUnion<typeof ElementShapes>
|
|
@@ -39,6 +39,11 @@ export interface ElementStyle {
|
|
|
39
39
|
* @default 100
|
|
40
40
|
*/
|
|
41
41
|
readonly opacity?: number
|
|
42
|
+
/**
|
|
43
|
+
* If true, the element is rendered as multiple shapes
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
readonly multiple?: boolean
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
export type Tag<Tags extends string = string> = Tagged<Tags, 'Tag'>
|
|
@@ -60,7 +65,7 @@ export interface TypedElement<
|
|
|
60
65
|
Ids extends string,
|
|
61
66
|
Kinds extends string,
|
|
62
67
|
Tags extends string,
|
|
63
|
-
MetadataKeys extends string = never
|
|
68
|
+
MetadataKeys extends string = never,
|
|
64
69
|
> {
|
|
65
70
|
readonly id: Fqn<Ids>
|
|
66
71
|
readonly kind: ElementKind<Kinds>
|
package/src/types/expression.ts
CHANGED
package/src/utils/index.ts
CHANGED
package/src/utils/set.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { set } from 'mnemonist'
|
|
2
|
+
import { hasAtLeast } from 'remeda'
|
|
2
3
|
import type { NonEmptyArray } from '../types/_common'
|
|
3
4
|
|
|
5
|
+
const { intersection: _intersection, symmetricDifference: _symmetricDifference } = set
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* Returns new set as a union of given sets
|
|
6
9
|
* Keeps order of elements
|
|
@@ -25,7 +28,7 @@ export function intersection<T>(first: ReadonlySet<T>, ...sets: NonEmptyArray<Re
|
|
|
25
28
|
if (first.size === 0) {
|
|
26
29
|
return result
|
|
27
30
|
}
|
|
28
|
-
let other = sets
|
|
31
|
+
let other = hasAtLeast(sets, 2) ? _intersection(...sets) : sets[0]
|
|
29
32
|
if (other.size === 0) {
|
|
30
33
|
return result
|
|
31
34
|
}
|