@likec4/config 1.42.1 → 1.44.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.mjs CHANGED
@@ -1 +1 @@
1
- export { C as ConfigFilenames, d as defineConfig, c as defineGenerators, e as defineStyle, f as defineTheme, g as defineThemeColor, i as isLikeC4Config, a as isLikeC4JsonConfig, b as isLikeC4NonJsonConfig, s as serializableLikeC4ProjectConfig, v as validateProjectConfig } from './shared/config.C9KUVBb7.mjs';
1
+ export { C as ConfigFilenames, d as defineConfig, c as defineGenerators, e as defineStyle, f as defineTheme, g as defineThemeColor, i as isLikeC4Config, a as isLikeC4JsonConfig, b as isLikeC4NonJsonConfig, s as serializableLikeC4ProjectConfig, v as validateProjectConfig } from './shared/config.FegrYs1S.mjs';
@@ -1,11 +1,11 @@
1
1
  import { URI } from 'vscode-uri';
2
2
  import { LikeC4ProjectConfig } from '../index.mjs';
3
- export { ConfigFilenames, GeneratorFn, GeneratorFnContext, GeneratorFnParams, LikeC4ProjectConfigInput, LikeC4ProjectJsonConfig, LikeC4StylesConfig, LikeC4StylesConfigInput, defineConfig, defineGenerators, defineStyle, defineTheme, defineThemeColor, isLikeC4Config, isLikeC4JsonConfig, isLikeC4NonJsonConfig, serializableLikeC4ProjectConfig, validateProjectConfig } from '../index.mjs';
3
+ export { ConfigFilenames, GeneratorFn, GeneratorFnContext, GeneratorFnParams, LikeC4ProjectConfigInput, LikeC4ProjectJsonConfig, LikeC4StylesConfig, LikeC4StylesConfigInput, LocateResult, ManualLayoutsConfigSchema, defineConfig, defineGenerators, defineStyle, defineTheme, defineThemeColor, isLikeC4Config, isLikeC4JsonConfig, isLikeC4NonJsonConfig, serializableLikeC4ProjectConfig, validateProjectConfig } from '../index.mjs';
4
4
  import '@likec4/core';
5
5
  import '@likec4/core/model';
6
6
  import '@likec4/core/types';
7
7
  import 'type-fest';
8
- import 'zod/v4';
8
+ import 'zod';
9
9
  import '@likec4/core/styles';
10
10
 
11
11
  /**
@@ -2,8 +2,8 @@ import { invariant } from '@likec4/core';
2
2
  import { bundleRequire } from 'bundle-require';
3
3
  import * as fs from 'node:fs/promises';
4
4
  import { dirname } from 'node:path';
5
- import { a as isLikeC4JsonConfig, v as validateProjectConfig, b as isLikeC4NonJsonConfig, d as defineConfig } from '../shared/config.C9KUVBb7.mjs';
6
- export { C as ConfigFilenames, c as defineGenerators, e as defineStyle, f as defineTheme, g as defineThemeColor, i as isLikeC4Config, s as serializableLikeC4ProjectConfig } from '../shared/config.C9KUVBb7.mjs';
5
+ import { a as isLikeC4JsonConfig, v as validateProjectConfig, b as isLikeC4NonJsonConfig, d as defineConfig } from '../shared/config.FegrYs1S.mjs';
6
+ export { C as ConfigFilenames, c as defineGenerators, e as defineStyle, f as defineTheme, g as defineThemeColor, i as isLikeC4Config, s as serializableLikeC4ProjectConfig } from '../shared/config.FegrYs1S.mjs';
7
7
  import { rootLogger } from '@likec4/log';
8
8
 
9
9
  const logger = rootLogger.getChild("config");
@@ -1,6 +1,5 @@
1
1
  import JSON5 from 'json5';
2
- import * as z from 'zod/v4';
3
- import z__default from 'zod/v4';
2
+ import * as z from 'zod';
4
3
  import { computeColorValues, ElementShapes, Sizes, BorderStyles, RelationshipArrowTypes, ThemeColors } from '@likec4/core/styles';
5
4
  import { exact } from '@likec4/core/types';
6
5
 
@@ -52,73 +51,46 @@ function t$1(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)ret
52
51
 
53
52
  function t(...t){return t$1(n,t)}function n(e,t){let n={};for(let[r,i]of e.entries())n[i]=t(i,r,e);return n}
54
53
 
55
- const opacity = z__default.number().min(0, "Opacity must be between 0 and 100").max(100, "Opacity must be between 0 and 100").meta({
54
+ const opacity = z.int().min(0, "Opacity must be between 0 and 100").max(100, "Opacity must be between 0 and 100").meta({
56
55
  id: "Opacity",
57
- description: "Opacity 0%-100%"
56
+ description: "Opacity 0-100%"
58
57
  });
59
- const shape = z__default.literal(ElementShapes).meta({
60
- id: "ElementShape",
61
- description: "Element shape"
62
- });
63
- const border = z__default.literal(BorderStyles).meta({
64
- id: "BorderStyle",
65
- description: "Border style"
66
- });
67
- const size = z__default.literal(Sizes).meta({
68
- id: "ElementSize",
69
- description: "Element size"
70
- });
71
- const arrow = z__default.literal(RelationshipArrowTypes).meta({
72
- id: "ArrowType",
73
- description: "Relationship arrow type"
74
- });
75
- const line = z__default.literal(["dashed", "solid", "dotted"]).meta({
76
- id: "LineType",
77
- description: "Default line type for relationships"
78
- });
79
- const themeColor = z__default.literal(ThemeColors).meta({
80
- id: "ThemeColor",
81
- description: "Reserved theme color name"
82
- });
83
- const color = z__default.union([
58
+ const shape = z.literal(ElementShapes).meta({ id: "ElementShape" });
59
+ const border = z.literal(BorderStyles).meta({ id: "BorderStyle" });
60
+ const size = z.literal(Sizes).meta({ id: "ElementSize" });
61
+ const arrow = z.literal(RelationshipArrowTypes).meta({ id: "ArrowType" });
62
+ const line = z.literal(["dashed", "solid", "dotted"]).meta({ id: "LineType" });
63
+ const themeColor = z.literal(ThemeColors).meta({ id: "ThemeColor" });
64
+ const color = z.union([
84
65
  themeColor,
85
- z__default.string().nonempty("Color name cannot be empty")
86
- ]).transform((value) => value).meta({
87
- id: "ColorName",
88
- description: "Color name (Theme color name or custom color name)"
89
- });
90
- const colorValue = z__default.string().nonempty("Color value cannot be empty").transform((value) => value).meta({
66
+ z.string().nonempty("Color name cannot be empty")
67
+ ]).transform((value) => value).meta({ id: "ColorName" });
68
+ const colorValue = z.string().nonempty("Color value cannot be empty").transform((value) => value).meta({
91
69
  id: "ColorLiteral",
92
70
  description: "Color value in any valid CSS format: hex, rgb, rgba, hsl, hsla ..."
93
71
  });
94
72
  const colorSchema = colorValue;
95
- const ElementColorValuesSchema = z__default.object({
73
+ const ElementColorValuesSchema = z.strictObject({
96
74
  fill: colorSchema.meta({ description: "Background color" }),
97
75
  stroke: colorSchema.meta({ description: "Stroke color (border, paths above background)" }),
98
76
  hiContrast: colorSchema.meta({ description: "High contrast text color (title)" }),
99
77
  loContrast: colorSchema.meta({ description: "Low contrast text color (description)" })
100
- }).meta({
101
- id: "ElementColorValues",
102
- description: "Specific element colors"
103
- }).transform((value) => value);
104
- const RelationshipColorValuesSchema = z__default.object({
78
+ }).meta({ id: "ElementColorValues" }).transform((value) => value);
79
+ const RelationshipColorValuesSchema = z.strictObject({
105
80
  line: colorSchema.meta({ description: "Line color" }),
106
81
  label: colorSchema.meta({ description: "Label text color" }),
107
82
  labelBg: colorSchema.optional().default("rgba(0, 0, 0, 0)").meta({ description: "Label background color" })
108
- }).meta({
109
- id: "RelationshipColorValues",
110
- description: "Specefic relationship colors"
111
- }).transform((value) => value);
112
- const ThemeColorValuesSchema = z__default.union([
83
+ }).meta({ id: "RelationshipColorValues" }).transform((value) => value);
84
+ const ThemeColorValuesSchema = z.union([
113
85
  colorSchema,
114
- z__default.object({
115
- elements: z__default.union([colorSchema, ElementColorValuesSchema]).transform((value) => {
86
+ z.strictObject({
87
+ elements: z.union([colorSchema, ElementColorValuesSchema]).meta({ description: "Element color value (or a breakdown of specific color values)" }).transform((value) => {
116
88
  if (typeof value === "string") {
117
89
  return computeColorValues(value).elements;
118
90
  }
119
91
  return value;
120
92
  }),
121
- relationships: z__default.union([colorSchema, RelationshipColorValuesSchema]).transform((value) => {
93
+ relationships: z.union([colorSchema, RelationshipColorValuesSchema]).meta({ description: "Relationship color value (or a breakdown of specific color values)" }).transform((value) => {
122
94
  if (typeof value === "string") {
123
95
  return computeColorValues(value).relationships;
124
96
  }
@@ -134,29 +106,35 @@ const ThemeColorValuesSchema = z__default.union([
134
106
  }
135
107
  return value;
136
108
  });
137
- const ThemeColorsSchema = z__default.union([
138
- z__default.record(
109
+ const ThemeColorsSchema = z.union([
110
+ z.record(
139
111
  color,
140
112
  ThemeColorValuesSchema
141
113
  ),
142
- z__default.object(
114
+ z.object(
143
115
  t(ThemeColors, () => ThemeColorValuesSchema.optional())
144
116
  )
145
117
  ]).meta({
146
118
  id: "ThemeColors",
147
- description: "Override of theme colors"
119
+ description: "Override theme colors"
148
120
  });
149
- const DimensionsSchema = z__default.object({
150
- width: z__default.number(),
151
- height: z__default.number()
121
+ const DimensionsSchema = z.strictObject({
122
+ width: z.number().min(50),
123
+ height: z.number().min(50)
152
124
  }).meta({
153
125
  id: "Dimensions",
154
126
  description: "Dimensions"
155
127
  });
156
- const LikeC4Config_Styles_Theme = z__default.object({
157
- colors: ThemeColorsSchema,
158
- sizes: z__default.object(t(Sizes, () => DimensionsSchema.optional())).meta({ description: "Map of theme sizes." })
159
- }).partial().meta({
128
+ const LikeC4Config_Styles_Theme_Sizes = z.strictObject(
129
+ t(Sizes, () => DimensionsSchema.optional())
130
+ ).meta({
131
+ id: "ThemeSizes",
132
+ description: "Override theme sizes"
133
+ });
134
+ const LikeC4Config_Styles_Theme = z.strictObject({
135
+ colors: ThemeColorsSchema.optional(),
136
+ sizes: LikeC4Config_Styles_Theme_Sizes.optional()
137
+ }).meta({
160
138
  id: "ThemeCustomization",
161
139
  description: "Theme customization"
162
140
  }).transform(({ colors, sizes }) => {
@@ -165,33 +143,53 @@ const LikeC4Config_Styles_Theme = z__default.object({
165
143
  sizes: sizes ? exact(sizes) : void 0
166
144
  });
167
145
  });
168
- const LikeC4Config_Styles_Defaults = z__default.object({
169
- color,
170
- opacity,
171
- border,
172
- size,
173
- shape,
174
- group: z__default.object({
175
- color,
176
- opacity,
177
- border
178
- }).partial(),
179
- relationship: z__default.object({
180
- color,
181
- line,
182
- arrow
183
- }).partial()
184
- }).partial().meta({
146
+ const LikeC4Config_Styles_Defaults_Group = z.strictObject({
147
+ color: color.optional().meta({
148
+ description: "Default color for groups\n(must be a valid color name from the theme)"
149
+ }),
150
+ opacity: opacity.optional().meta({ description: "Default opacity for groups" }),
151
+ border: border.optional().meta({ description: "Default border for groups" })
152
+ }).meta({
153
+ id: "GroupDefaultStyleValues",
154
+ description: "Override default values for group style properties\nThese values will be used if such property is not defined"
155
+ });
156
+ const LikeC4Config_Styles_Defaults_Relationship = z.strictObject({
157
+ color: color.optional().meta({
158
+ description: "Default color for relationships\n(must be a valid color name from the theme)"
159
+ }),
160
+ line: line.optional().meta({ description: "Default line style for relationships" }),
161
+ arrow: arrow.optional().meta({ description: "Default arrow style for relationships" })
162
+ }).meta({
163
+ id: "RelationshipDefaultStyleValues",
164
+ description: "Override default values for relationship style properties\nThese values will be used if such property is not defined"
165
+ });
166
+ const LikeC4Config_Styles_Defaults = z.strictObject({
167
+ color: color.optional().meta({
168
+ description: "Default color for elements\n(must be a valid color name from the theme)"
169
+ }),
170
+ opacity: opacity.optional().meta({
171
+ description: "Default opacity (0-100%) for elements when displayed as a group (like a container)"
172
+ }),
173
+ border: border.optional().meta({
174
+ description: "Default border style for elements when displayed as a group (like a container)"
175
+ }),
176
+ size: size.optional().meta({ description: "Default size for elements" }),
177
+ shape: shape.optional().meta({ description: "Default shape for elements" }),
178
+ group: LikeC4Config_Styles_Defaults_Group.optional().meta({ description: "Default style values for groups" }),
179
+ relationship: LikeC4Config_Styles_Defaults_Relationship.optional().meta({
180
+ description: "Default style values for relationships"
181
+ })
182
+ }).meta({
185
183
  id: "DefaultStyleValues",
186
184
  description: "Override default values for style properties\nThese values will be used if such property is not defined"
187
185
  });
188
- const LikeC4StylesConfigSchema = z__default.object({
189
- theme: LikeC4Config_Styles_Theme,
190
- defaults: LikeC4Config_Styles_Defaults
186
+ const LikeC4StylesConfigSchema = z.strictObject({
187
+ theme: LikeC4Config_Styles_Theme.optional(),
188
+ defaults: LikeC4Config_Styles_Defaults.optional()
191
189
  // customCss: z
192
190
  // .array(z.string())
193
191
  // .meta({ description: 'List of custom CSS files' }),
194
- }).partial().meta({
192
+ }).meta({
195
193
  id: "StylesConfiguration",
196
194
  description: "Project styles customization"
197
195
  }).transform(
@@ -212,6 +210,14 @@ function normalizeDefaults(defaults) {
212
210
  });
213
211
  }
214
212
 
213
+ const ManualLayoutsConfigSchema = z.object({
214
+ outDir: z.string().meta({
215
+ description: "Path to the directory where manual layouts will be stored, relative to the folder containing the project config"
216
+ })
217
+ }).meta({
218
+ id: "manual-layouts-config",
219
+ description: "Configuration for manual layouts"
220
+ });
215
221
  const LikeC4ProjectJsonConfigSchema = z.object({
216
222
  name: z.string().nonempty("Project name cannot be empty").refine((value) => value !== "default", {
217
223
  abort: true,
@@ -224,7 +230,8 @@ const LikeC4ProjectJsonConfigSchema = z.object({
224
230
  contactPerson: z.string().nonempty("Contact person cannot be empty if specified").optional().meta({ description: "A person who has been involved in creating or maintaining this project" }),
225
231
  imageAliases: ImageAliasesSchema.optional(),
226
232
  styles: LikeC4StylesConfigSchema.optional(),
227
- exclude: z.array(z.string()).optional().meta({ description: 'List of file patterns to exclude from the project, default is ["**/node_modules/**"]' })
233
+ exclude: z.array(z.string()).optional().meta({ description: 'List of file patterns to exclude from the project, default is ["**/node_modules/**"]' }),
234
+ manualLayouts: ManualLayoutsConfigSchema.optional()
228
235
  }).meta({
229
236
  description: "LikeC4 project configuration"
230
237
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/config",
3
- "version": "1.42.1",
3
+ "version": "1.44.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://likec4.dev",
6
6
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -58,14 +58,14 @@
58
58
  "bundle-require": "^5.1.0",
59
59
  "defu": "^6.1.4",
60
60
  "json5": "^2.2.3",
61
- "zod": "^3.25.76",
61
+ "zod": "^4.1.12",
62
62
  "type-fest": "^4.41.0"
63
63
  },
64
64
  "peerDependencies": {
65
- "esbuild": "^0.25.9",
65
+ "esbuild": "^0.25.11",
66
66
  "vscode-uri": "3.1.0",
67
- "@likec4/core": "1.42.1",
68
- "@likec4/log": "1.42.1"
67
+ "@likec4/core": "1.44.0",
68
+ "@likec4/log": "1.44.0"
69
69
  },
70
70
  "peerDependenciesMeta": {
71
71
  "vscode-uri": {
@@ -73,18 +73,18 @@
73
73
  }
74
74
  },
75
75
  "devDependencies": {
76
- "@types/node": "~20.19.11",
77
- "remeda": "^2.31.1",
76
+ "@types/node": "~20.19.22",
77
+ "remeda": "^2.32.0",
78
78
  "tsx": "4.20.6",
79
- "turbo": "2.5.8",
80
- "typescript": "5.9.2",
79
+ "turbo": "2.6.0",
80
+ "typescript": "5.9.3",
81
81
  "unbuild": "3.5.0",
82
82
  "nano-spawn": "^1.0.3",
83
- "vitest": "3.2.4",
84
- "@likec4/core": "1.42.1",
85
- "@likec4/log": "1.42.1",
86
- "@likec4/tsconfig": "1.42.1",
87
- "@likec4/devops": "1.42.0"
83
+ "vitest": "4.0.8",
84
+ "@likec4/core": "1.44.0",
85
+ "@likec4/devops": "1.42.0",
86
+ "@likec4/log": "1.44.0",
87
+ "@likec4/tsconfig": "1.44.0"
88
88
  },
89
89
  "scripts": {
90
90
  "typecheck": "tsc -b --verbose",