@likec4/core 1.20.3 → 1.21.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 (77) hide show
  1. package/dist/builder/index.cjs +24 -18
  2. package/dist/builder/index.d.cts +11 -5
  3. package/dist/builder/index.d.mts +11 -5
  4. package/dist/builder/index.d.ts +11 -5
  5. package/dist/builder/index.mjs +10 -4
  6. package/dist/compute-view/index.cjs +6 -6
  7. package/dist/compute-view/index.d.cts +4 -4
  8. package/dist/compute-view/index.d.mts +4 -4
  9. package/dist/compute-view/index.d.ts +4 -4
  10. package/dist/compute-view/index.mjs +6 -6
  11. package/dist/index.cjs +52 -14
  12. package/dist/index.d.cts +6 -6
  13. package/dist/index.d.mts +6 -6
  14. package/dist/index.d.ts +6 -6
  15. package/dist/index.mjs +46 -11
  16. package/dist/model/index.cjs +1 -1
  17. package/dist/model/index.d.cts +5 -5
  18. package/dist/model/index.d.mts +5 -5
  19. package/dist/model/index.d.ts +5 -5
  20. package/dist/model/index.mjs +1 -1
  21. package/dist/shared/{core.Cmfo_N4F.d.mts → core.5Z5cpENq.d.mts} +5 -4
  22. package/dist/shared/{core.D4wZW7zR.d.ts → core.BJfq046m.d.ts} +5 -4
  23. package/dist/shared/{core.C0ygs98j.d.cts → core.BS_nXBsP.d.cts} +9 -2
  24. package/dist/shared/{core.CajOK_t3.d.mts → core.BYs5deiY.d.cts} +1 -1
  25. package/dist/shared/{core.Bezy7K65.mjs → core.BfZZXtur.mjs} +2 -2
  26. package/dist/shared/{core.CwZmAghJ.d.cts → core.BgPZ8Tl8.d.cts} +5 -4
  27. package/dist/shared/{core.FACQZmma.cjs → core.BjR0D3IO.cjs} +15 -15
  28. package/dist/shared/{core.uxHtIZaH.cjs → core.CAkSSvJ6.cjs} +11 -5
  29. package/dist/shared/{core.El-gigOM.mjs → core.CE-kCVHA.mjs} +1 -1
  30. package/dist/shared/{core.DjMYkPMQ.d.mts → core.CJaCUZQ9.d.mts} +9 -2
  31. package/dist/shared/{core.88YY6vtF.d.mts → core.CT1nzYjO.d.cts} +2 -2
  32. package/dist/shared/{core.0PxLtLpP.mjs → core.CYNYaH2U.mjs} +5 -2
  33. package/dist/shared/{core.CCyhaU-4.mjs → core.CeefT_JU.mjs} +6 -6
  34. package/dist/shared/{core.BG1hfxpq.mjs → core.Cz9Oy_FA.mjs} +475 -409
  35. package/dist/shared/{core.BIZD3l1g.d.cts → core.D0KD4FiT.d.mts} +1 -1
  36. package/dist/shared/{core.DRfrKNT6.cjs → core.D91uYrqI.cjs} +551 -485
  37. package/dist/shared/{core.BtISRjMA.d.ts → core.DQCc-Jxk.d.ts} +1 -1
  38. package/dist/shared/{core.Db_OTRdC.cjs → core.DnPc_NDM.cjs} +1 -1
  39. package/dist/shared/{core.CNUzoKM7.d.ts → core.Dp3HTiRV.d.ts} +2 -2
  40. package/dist/shared/{core.CKYxnFEl.cjs → core.DqQrj2oQ.cjs} +2 -2
  41. package/dist/shared/{core.Bs71hdR4.d.ts → core.DsDq-blc.d.ts} +9 -2
  42. package/dist/shared/{core.Lh2RFJf1.d.cts → core.DuuS_BrY.d.mts} +2 -2
  43. package/dist/shared/{core.BJfn72tj.d.ts → core.QP35c488.d.cts} +33 -1
  44. package/dist/shared/{core.BJfn72tj.d.cts → core.QP35c488.d.mts} +33 -1
  45. package/dist/shared/{core.BJfn72tj.d.mts → core.QP35c488.d.ts} +33 -1
  46. package/dist/types/index.cjs +4 -1
  47. package/dist/types/index.d.cts +4 -4
  48. package/dist/types/index.d.mts +4 -4
  49. package/dist/types/index.d.ts +4 -4
  50. package/dist/types/index.mjs +1 -1
  51. package/dist/utils/index.cjs +3 -3
  52. package/dist/utils/index.d.cts +2 -2
  53. package/dist/utils/index.d.mts +2 -2
  54. package/dist/utils/index.d.ts +2 -2
  55. package/dist/utils/index.mjs +3 -3
  56. package/package.json +6 -6
  57. package/src/builder/Builder.ts +11 -5
  58. package/src/builder/Builder.view-common.ts +1 -0
  59. package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +16 -4
  60. package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +21 -5
  61. package/src/builder/_types.ts +9 -0
  62. package/src/colors/index.ts +41 -5
  63. package/src/compute-view/deployment-view/predicates/{elements.ts → deploymentRefs.ts} +32 -21
  64. package/src/compute-view/deployment-view/predicates/index.ts +1 -1
  65. package/src/compute-view/deployment-view/predicates/utils.ts +56 -1
  66. package/src/compute-view/deployment-view/predicates/wildcard.ts +20 -9
  67. package/src/compute-view/memory/AbstractStageExclude.ts +1 -1
  68. package/src/compute-view/utils/applyCustomElementProperties.ts +18 -1
  69. package/src/compute-view/utils/applyViewRuleStyles.ts +9 -0
  70. package/src/compute-view/utils/buildComputedNodes.ts +13 -9
  71. package/src/model/DeploymentElementModel.ts +5 -2
  72. package/src/model/ElementModel.ts +10 -0
  73. package/src/types/element.ts +19 -1
  74. package/src/types/expression.ts +4 -1
  75. package/src/types/index.ts +6 -0
  76. package/src/types/theme.ts +22 -1
  77. package/src/types/view.ts +5 -1
@@ -1,6 +1,6 @@
1
1
  import type { Tagged, TupleToUnion } from 'type-fest'
2
2
  import type { IconUrl, NonEmptyArray } from './_common'
3
- import type { Color, ThemeColor } from './theme'
3
+ import type { Color, ShapeSize, SpacingSize, TextSize, ThemeColor } from './theme'
4
4
 
5
5
  // Full-qualified-name
6
6
  export type Fqn<Id extends string = string> = Tagged<Id, 'Fqn'>
@@ -30,6 +30,9 @@ export const ElementShapes = [
30
30
  export type ElementShape = TupleToUnion<typeof ElementShapes>
31
31
  export const DefaultThemeColor: ThemeColor = 'primary'
32
32
  export const DefaultElementShape: ElementShape = 'rectangle'
33
+ export const DefaultShapeSize: ShapeSize = 'md'
34
+ export const DefaultPaddingSize: SpacingSize = 'md'
35
+ export const DefaultTextSize: TextSize = 'md'
33
36
 
34
37
  export interface ElementStyle {
35
38
  readonly border?: BorderStyle
@@ -44,6 +47,17 @@ export interface ElementStyle {
44
47
  * @default false
45
48
  */
46
49
  readonly multiple?: boolean
50
+
51
+ /**
52
+ * Shape size
53
+ *
54
+ * @default 'md'
55
+ */
56
+ readonly size?: ShapeSize
57
+
58
+ readonly padding?: SpacingSize
59
+
60
+ readonly textSize?: TextSize
47
61
  }
48
62
 
49
63
  export type Tag<Tags extends string = string> = Tagged<Tags, 'Tag'>
@@ -91,7 +105,11 @@ export interface ElementKindSpecificationStyle {
91
105
  color?: Color
92
106
  border?: BorderStyle
93
107
  opacity?: number
108
+ size?: ShapeSize
109
+ padding?: SpacingSize
110
+ textSize?: TextSize
94
111
  }
112
+
95
113
  export interface ElementKindSpecification {
96
114
  readonly technology?: string
97
115
  readonly notation?: string
@@ -2,7 +2,7 @@ import type { IconUrl } from './_common'
2
2
  import type { BorderStyle, ElementKind, ElementShape, Fqn, Tag } from './element'
3
3
  import type { WhereOperator } from './operators'
4
4
  import type { RelationshipArrowType, RelationshipLineType } from './relation'
5
- import type { Color } from './theme'
5
+ import type { Color, ShapeSize } from './theme'
6
6
  import type { ViewId } from './view'
7
7
 
8
8
  interface BaseExpr {
@@ -54,6 +54,9 @@ export interface CustomElementExpr extends Omit<BaseExpr, 'custom'> {
54
54
  opacity?: number
55
55
  navigateTo?: ViewId
56
56
  multiple?: boolean
57
+ size?: ShapeSize
58
+ padding?: ShapeSize
59
+ textSize?: ShapeSize
57
60
  }
58
61
  }
59
62
 
@@ -28,6 +28,9 @@ export {
28
28
  AsFqn,
29
29
  BorderStyles,
30
30
  DefaultElementShape,
31
+ DefaultPaddingSize,
32
+ DefaultShapeSize,
33
+ DefaultTextSize,
31
34
  DefaultThemeColor,
32
35
  ElementKind,
33
36
  ElementShapes,
@@ -147,6 +150,9 @@ export type {
147
150
  LikeC4Theme,
148
151
  RelationshipThemeColors,
149
152
  RelationshipThemeColorValues,
153
+ ShapeSize,
154
+ SpacingSize,
155
+ TextSize,
150
156
  ThemeColor,
151
157
  ThemeColorValues,
152
158
  } from './theme'
@@ -11,7 +11,7 @@ const ThemeColors = [
11
11
  'primary',
12
12
  'red',
13
13
  'secondary',
14
- 'sky'
14
+ 'sky',
15
15
  ] as const
16
16
  export type ThemeColor = typeof ThemeColors[number]
17
17
 
@@ -21,6 +21,15 @@ export type ColorLiteral = HexColorLiteral
21
21
 
22
22
  export type Color = LiteralUnion<ThemeColor, string>
23
23
 
24
+ export type ShapeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
25
+
26
+ /**
27
+ * For padding, margin, etc.
28
+ */
29
+ export type SpacingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
30
+
31
+ export type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
32
+
24
33
  export function isThemeColor(color: Color): color is ThemeColor {
25
34
  return color in ThemeColors
26
35
  }
@@ -58,4 +67,16 @@ export interface LikeC4Theme {
58
67
  shadow: ColorLiteral
59
68
  relationships: RelationshipThemeColors
60
69
  elements: ElementThemeColors
70
+ sizes: {
71
+ [key in ShapeSize]: {
72
+ width: number
73
+ height: number
74
+ }
75
+ }
76
+ spacing: {
77
+ [key in SpacingSize]: number
78
+ }
79
+ textSizes: {
80
+ [key in TextSize]: number
81
+ }
61
82
  }
package/src/types/view.ts CHANGED
@@ -14,7 +14,7 @@ import type { ElementExpression, ElementPredicateExpression, Expression } from '
14
14
  import type { ExpressionV2, FqnExpr } from './expression-v2'
15
15
  import type { GlobalPredicateId, GlobalStyleID } from './global'
16
16
  import type { RelationId, RelationshipArrowType, RelationshipKind, RelationshipLineType } from './relation'
17
- import type { Color, ThemeColorValues } from './theme'
17
+ import type { Color, ShapeSize, SpacingSize, TextSize, ThemeColorValues } from './theme'
18
18
  import type { ElementNotation } from './view-notation'
19
19
 
20
20
  export type ViewId<Id extends string = string> = Tagged<Id, 'ViewID'>
@@ -94,6 +94,10 @@ export interface ViewRuleGroup {
94
94
  border?: BorderStyle
95
95
  // 0-100
96
96
  opacity?: number
97
+ multiple?: boolean
98
+ size?: ShapeSize
99
+ padding?: SpacingSize
100
+ textSize?: TextSize
97
101
  }
98
102
 
99
103
  export function isViewRuleGroup(rule: ViewRule): rule is ViewRuleGroup {