@likec4/core 1.21.0 → 1.22.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.
Files changed (47) hide show
  1. package/dist/builder/index.cjs +6 -6
  2. package/dist/builder/index.d.cts +1 -1
  3. package/dist/builder/index.d.mts +1 -1
  4. package/dist/builder/index.d.ts +1 -1
  5. package/dist/builder/index.mjs +6 -6
  6. package/dist/compute-view/index.cjs +5 -5
  7. package/dist/compute-view/index.d.cts +2 -2
  8. package/dist/compute-view/index.d.mts +2 -2
  9. package/dist/compute-view/index.d.ts +2 -2
  10. package/dist/compute-view/index.mjs +6 -6
  11. package/dist/index.cjs +13 -12
  12. package/dist/index.d.cts +2 -2
  13. package/dist/index.d.mts +2 -2
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.mjs +13 -12
  16. package/dist/model/index.cjs +1 -1
  17. package/dist/model/index.d.cts +2 -2
  18. package/dist/model/index.d.mts +2 -2
  19. package/dist/model/index.d.ts +2 -2
  20. package/dist/model/index.mjs +1 -1
  21. package/dist/shared/{core.BJfq046m.d.ts → core.1pNr6Ryk.d.ts} +1 -0
  22. package/dist/shared/{core.CT1nzYjO.d.cts → core.3xeQpJ_K.d.cts} +1 -1
  23. package/dist/shared/{core.DuuS_BrY.d.mts → core.BHQYwEvc.d.mts} +1 -1
  24. package/dist/shared/{core.CYNYaH2U.mjs → core.BNaXALvz.mjs} +2 -2
  25. package/dist/shared/{core.DnPc_NDM.cjs → core.BYiA0A6H.cjs} +1 -1
  26. package/dist/shared/{core.BfZZXtur.mjs → core.Btj1m6H6.mjs} +1 -1
  27. package/dist/shared/{core.CAkSSvJ6.cjs → core.CEJQrbXY.cjs} +1 -1
  28. package/dist/shared/{core.BjR0D3IO.cjs → core.DEzbhxsA.cjs} +4 -4
  29. package/dist/shared/{core.5Z5cpENq.d.mts → core.DKJ2y3NP.d.mts} +1 -0
  30. package/dist/shared/{core.DqQrj2oQ.cjs → core.DUbKSpjd.cjs} +1 -1
  31. package/dist/shared/{core.D91uYrqI.cjs → core.DqmAHWZs.cjs} +19 -16
  32. package/dist/shared/{core.CE-kCVHA.mjs → core.GIZxdz4M.mjs} +1 -1
  33. package/dist/shared/{core.BgPZ8Tl8.d.cts → core.OjOfEBRQ.d.cts} +1 -0
  34. package/dist/shared/{core.CeefT_JU.mjs → core.f1tiPwpd.mjs} +4 -4
  35. package/dist/shared/{core.Dp3HTiRV.d.ts → core.s6UB2oA0.d.ts} +1 -1
  36. package/dist/shared/{core.Cz9Oy_FA.mjs → core.uGbvOLGK.mjs} +19 -16
  37. package/dist/types/index.cjs +1 -1
  38. package/dist/types/index.mjs +1 -1
  39. package/dist/utils/index.cjs +2 -2
  40. package/dist/utils/index.mjs +3 -3
  41. package/package.json +5 -5
  42. package/src/compute-view/utils/view-hash.ts +5 -5
  43. package/src/index.ts +1 -1
  44. package/src/model/LikeC4Model.ts +4 -0
  45. package/src/{colors → theme}/element.ts +9 -9
  46. package/src/{colors → theme}/index.ts +7 -7
  47. package/src/{colors → theme}/relationships.ts +9 -9
@@ -11,17 +11,17 @@ export function calcViewLayoutHash<V extends ComputedView>(view: SetOptional<V,
11
11
  nodes: pipe(
12
12
  view.nodes,
13
13
  map(pick(['id', 'title', 'description', 'technology', 'shape', 'icon', 'children'])),
14
- mapToObj(({ id, icon, ...node }) => [id, { ...node, icon: isTruthy(icon) ? 'Y' : 'N' }])
14
+ mapToObj(({ id, icon, ...node }) => [id, { ...node, icon: isTruthy(icon) ? 'Y' : 'N' }]),
15
15
  ),
16
16
  edges: pipe(
17
17
  view.edges,
18
18
  map(pick(['source', 'target', 'label', 'description', 'technology', 'dir', 'head', 'tail', 'line'])),
19
- mapToObj(({ source, target, ...edge }) => [`${source}:${target}`, edge])
20
- )
19
+ mapToObj(({ source, target, ...edge }) => [`${source}:${target}`, edge]),
20
+ ),
21
21
  }
22
22
  view.hash = objectHash(tohash, {
23
23
  ignoreUnknown: true,
24
- respectType: false
24
+ respectType: false,
25
25
  })
26
- return view as V
26
+ return view as unknown as V
27
27
  }
package/src/index.ts CHANGED
@@ -3,7 +3,7 @@ export {
3
3
  defaultTheme,
4
4
  ElementColors,
5
5
  RelationshipColors,
6
- } from './colors'
6
+ } from './theme'
7
7
 
8
8
  export {
9
9
  invariant,
@@ -357,6 +357,10 @@ export class LikeC4Model<M extends AnyAux = LikeC4Model.Any> {
357
357
  }
358
358
  }
359
359
 
360
+ public allTags(): ReadonlyArray<C4Tag> {
361
+ return Array.from(this.#allTags.keys())
362
+ }
363
+
360
364
  private addElement(element: Element) {
361
365
  if (this.#elements.has(element.id)) {
362
366
  throw new Error(`Element ${element.id} already exists`)
@@ -4,21 +4,21 @@ const blue = {
4
4
  fill: '#3b82f6',
5
5
  stroke: '#2563eb',
6
6
  hiContrast: '#eff6ff',
7
- loContrast: '#bfdbfe'
7
+ loContrast: '#bfdbfe',
8
8
  } satisfies ElementThemeColorValues
9
9
 
10
10
  const sky = {
11
11
  fill: '#0284c7',
12
12
  stroke: '#0369a1',
13
13
  hiContrast: '#f0f9ff',
14
- loContrast: '#B6ECF7'
14
+ loContrast: '#B6ECF7',
15
15
  } satisfies ElementThemeColorValues
16
16
 
17
17
  const slate = {
18
18
  fill: '#64748b',
19
19
  stroke: '#475569',
20
20
  hiContrast: '#f8fafc',
21
- loContrast: '#cbd5e1'
21
+ loContrast: '#cbd5e1',
22
22
  } satisfies ElementThemeColorValues
23
23
 
24
24
  export const ElementColors = {
@@ -36,7 +36,7 @@ export const ElementColors = {
36
36
  fill: '#737373',
37
37
  stroke: '#525252',
38
38
  hiContrast: '#fafafa',
39
- loContrast: '#d4d4d4'
39
+ loContrast: '#d4d4d4',
40
40
  },
41
41
  red: {
42
42
  // fill: colors.red[500],
@@ -53,19 +53,19 @@ export const ElementColors = {
53
53
  hiContrast: '#FBD3CB',
54
54
  // hiContrast: '#f8fafc',
55
55
  // loContrast: '#fdd8d8' // radix black red 12
56
- loContrast: '#f5b2a3'
56
+ loContrast: '#f5b2a3',
57
57
  },
58
58
  green: {
59
59
  fill: '#428a4f',
60
60
  stroke: '#2d5d39',
61
61
  hiContrast: '#f8fafc',
62
- loContrast: '#c2f0c2'
62
+ loContrast: '#c2f0c2',
63
63
  },
64
64
  amber: {
65
65
  fill: '#A35829',
66
66
  stroke: '#7E451D',
67
67
  hiContrast: '#FFE0C2',
68
- loContrast: '#f9b27c'
68
+ loContrast: '#f9b27c',
69
69
  },
70
70
  indigo: {
71
71
  // fill: colors.indigo[500],
@@ -75,6 +75,6 @@ export const ElementColors = {
75
75
  fill: '#6366f1',
76
76
  stroke: '#4f46e5',
77
77
  hiContrast: '#eef2ff',
78
- loContrast: '#c7d2fe'
79
- }
78
+ loContrast: '#c7d2fe',
79
+ },
80
80
  } as const satisfies ElementThemeColors
@@ -10,12 +10,12 @@ export const defaultTheme: LikeC4Theme = {
10
10
  shadow: '#0a0a0a',
11
11
  sizes: {
12
12
  xs: {
13
- width: 120,
14
- height: 80,
13
+ width: 180,
14
+ height: 100,
15
15
  },
16
16
  sm: {
17
- width: 180,
18
- height: 110,
17
+ width: 240,
18
+ height: 135,
19
19
  },
20
20
  md: {
21
21
  width: 320,
@@ -33,9 +33,9 @@ export const defaultTheme: LikeC4Theme = {
33
33
  spacing: {
34
34
  xs: 8, // 0.5rem
35
35
  sm: 10, // 0.625rem
36
- md: 24, // 1.5rem = 16px + 8px
37
- lg: 32, // 2rem
38
- xl: 48,
36
+ md: 16, // 1rem
37
+ lg: 24, // 1.5rem = 16px + 8px
38
+ xl: 32, // 2rem
39
39
  },
40
40
  textSizes: {
41
41
  xs: 12,
@@ -3,52 +3,52 @@ import type { RelationshipThemeColors, RelationshipThemeColorValues } from '../t
3
3
  const gray = {
4
4
  lineColor: '#6E6E6E',
5
5
  labelBgColor: '#18191b',
6
- labelColor: '#C6C6C6'
6
+ labelColor: '#C6C6C6',
7
7
  } satisfies RelationshipThemeColorValues
8
8
  const slate = {
9
9
  lineColor: '#64748b', // 500
10
10
  labelBgColor: '#0f172a', // 900
11
- labelColor: '#cbd5e1' // 300
11
+ labelColor: '#cbd5e1', // 300
12
12
  } satisfies RelationshipThemeColorValues
13
13
 
14
14
  const blue = {
15
15
  lineColor: '#3b82f6', // 500
16
16
  labelBgColor: '#172554', // 950
17
- labelColor: '#60a5fa' // 400
17
+ labelColor: '#60a5fa', // 400
18
18
  } satisfies RelationshipThemeColorValues
19
19
 
20
20
  const sky = {
21
21
  lineColor: '#0ea5e9', // 500
22
22
  labelBgColor: '#082f49', // 950
23
- labelColor: '#38bdf8' // 400
23
+ labelColor: '#38bdf8', // 400
24
24
  } satisfies RelationshipThemeColorValues
25
25
 
26
26
  export const RelationshipColors = {
27
27
  amber: {
28
28
  lineColor: '#b45309',
29
29
  labelBgColor: '#78350f',
30
- labelColor: '#FFE0C2'
30
+ labelColor: '#FFE0C2',
31
31
  },
32
32
  blue,
33
33
  gray,
34
34
  green: {
35
35
  lineColor: '#15803d', // 700
36
36
  labelBgColor: '#052e16', // 950
37
- labelColor: '#22c55e' // 500
37
+ labelColor: '#22c55e', // 500
38
38
  },
39
39
  indigo: {
40
40
  lineColor: '#6366f1', // 500
41
41
  labelBgColor: '#1e1b4b', // 950
42
- labelColor: '#818cf8' // 400
42
+ labelColor: '#818cf8', // 400
43
43
  },
44
44
  muted: slate,
45
45
  primary: blue,
46
46
  red: {
47
47
  lineColor: '#AC4D39',
48
48
  labelBgColor: '#b91c1c',
49
- labelColor: '#f5b2a3'
49
+ labelColor: '#f5b2a3',
50
50
  },
51
51
  secondary: sky,
52
52
  sky,
53
- slate
53
+ slate,
54
54
  } satisfies RelationshipThemeColors