@likec4/config 1.43.0 → 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.d.mts +493 -484
- package/dist/index.mjs +1 -1
- package/dist/node/index.d.mts +2 -2
- package/dist/node/index.mjs +2 -2
- package/dist/shared/{config.oj-2w-Kh.mjs → config.FegrYs1S.mjs} +39 -31
- package/package.json +10 -10
- package/schema.json +68 -227
- package/src/index.ts +2 -0
- package/src/schema.image-alias.ts +1 -1
- package/src/schema.theme.ts +1 -1
- package/src/schema.ts +54 -32
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.
|
|
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';
|
package/dist/node/index.d.mts
CHANGED
|
@@ -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
|
|
8
|
+
import 'zod';
|
|
9
9
|
import '@likec4/core/styles';
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/node/index.mjs
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
|
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,46 +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 =
|
|
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
56
|
description: "Opacity 0-100%"
|
|
58
57
|
});
|
|
59
|
-
const shape =
|
|
60
|
-
const border =
|
|
61
|
-
const size =
|
|
62
|
-
const arrow =
|
|
63
|
-
const line =
|
|
64
|
-
const themeColor =
|
|
65
|
-
const color =
|
|
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([
|
|
66
65
|
themeColor,
|
|
67
|
-
|
|
66
|
+
z.string().nonempty("Color name cannot be empty")
|
|
68
67
|
]).transform((value) => value).meta({ id: "ColorName" });
|
|
69
|
-
const colorValue =
|
|
68
|
+
const colorValue = z.string().nonempty("Color value cannot be empty").transform((value) => value).meta({
|
|
70
69
|
id: "ColorLiteral",
|
|
71
70
|
description: "Color value in any valid CSS format: hex, rgb, rgba, hsl, hsla ..."
|
|
72
71
|
});
|
|
73
72
|
const colorSchema = colorValue;
|
|
74
|
-
const ElementColorValuesSchema =
|
|
73
|
+
const ElementColorValuesSchema = z.strictObject({
|
|
75
74
|
fill: colorSchema.meta({ description: "Background color" }),
|
|
76
75
|
stroke: colorSchema.meta({ description: "Stroke color (border, paths above background)" }),
|
|
77
76
|
hiContrast: colorSchema.meta({ description: "High contrast text color (title)" }),
|
|
78
77
|
loContrast: colorSchema.meta({ description: "Low contrast text color (description)" })
|
|
79
78
|
}).meta({ id: "ElementColorValues" }).transform((value) => value);
|
|
80
|
-
const RelationshipColorValuesSchema =
|
|
79
|
+
const RelationshipColorValuesSchema = z.strictObject({
|
|
81
80
|
line: colorSchema.meta({ description: "Line color" }),
|
|
82
81
|
label: colorSchema.meta({ description: "Label text color" }),
|
|
83
82
|
labelBg: colorSchema.optional().default("rgba(0, 0, 0, 0)").meta({ description: "Label background color" })
|
|
84
83
|
}).meta({ id: "RelationshipColorValues" }).transform((value) => value);
|
|
85
|
-
const ThemeColorValuesSchema =
|
|
84
|
+
const ThemeColorValuesSchema = z.union([
|
|
86
85
|
colorSchema,
|
|
87
|
-
|
|
88
|
-
elements:
|
|
86
|
+
z.strictObject({
|
|
87
|
+
elements: z.union([colorSchema, ElementColorValuesSchema]).meta({ description: "Element color value (or a breakdown of specific color values)" }).transform((value) => {
|
|
89
88
|
if (typeof value === "string") {
|
|
90
89
|
return computeColorValues(value).elements;
|
|
91
90
|
}
|
|
92
91
|
return value;
|
|
93
92
|
}),
|
|
94
|
-
relationships:
|
|
93
|
+
relationships: z.union([colorSchema, RelationshipColorValuesSchema]).meta({ description: "Relationship color value (or a breakdown of specific color values)" }).transform((value) => {
|
|
95
94
|
if (typeof value === "string") {
|
|
96
95
|
return computeColorValues(value).relationships;
|
|
97
96
|
}
|
|
@@ -107,32 +106,32 @@ const ThemeColorValuesSchema = z__default.union([
|
|
|
107
106
|
}
|
|
108
107
|
return value;
|
|
109
108
|
});
|
|
110
|
-
const ThemeColorsSchema =
|
|
111
|
-
|
|
109
|
+
const ThemeColorsSchema = z.union([
|
|
110
|
+
z.record(
|
|
112
111
|
color,
|
|
113
112
|
ThemeColorValuesSchema
|
|
114
113
|
),
|
|
115
|
-
|
|
114
|
+
z.object(
|
|
116
115
|
t(ThemeColors, () => ThemeColorValuesSchema.optional())
|
|
117
116
|
)
|
|
118
117
|
]).meta({
|
|
119
118
|
id: "ThemeColors",
|
|
120
119
|
description: "Override theme colors"
|
|
121
120
|
});
|
|
122
|
-
const DimensionsSchema =
|
|
123
|
-
width:
|
|
124
|
-
height:
|
|
121
|
+
const DimensionsSchema = z.strictObject({
|
|
122
|
+
width: z.number().min(50),
|
|
123
|
+
height: z.number().min(50)
|
|
125
124
|
}).meta({
|
|
126
125
|
id: "Dimensions",
|
|
127
126
|
description: "Dimensions"
|
|
128
127
|
});
|
|
129
|
-
const LikeC4Config_Styles_Theme_Sizes =
|
|
128
|
+
const LikeC4Config_Styles_Theme_Sizes = z.strictObject(
|
|
130
129
|
t(Sizes, () => DimensionsSchema.optional())
|
|
131
130
|
).meta({
|
|
132
131
|
id: "ThemeSizes",
|
|
133
132
|
description: "Override theme sizes"
|
|
134
133
|
});
|
|
135
|
-
const LikeC4Config_Styles_Theme =
|
|
134
|
+
const LikeC4Config_Styles_Theme = z.strictObject({
|
|
136
135
|
colors: ThemeColorsSchema.optional(),
|
|
137
136
|
sizes: LikeC4Config_Styles_Theme_Sizes.optional()
|
|
138
137
|
}).meta({
|
|
@@ -144,7 +143,7 @@ const LikeC4Config_Styles_Theme = z__default.strictObject({
|
|
|
144
143
|
sizes: sizes ? exact(sizes) : void 0
|
|
145
144
|
});
|
|
146
145
|
});
|
|
147
|
-
const LikeC4Config_Styles_Defaults_Group =
|
|
146
|
+
const LikeC4Config_Styles_Defaults_Group = z.strictObject({
|
|
148
147
|
color: color.optional().meta({
|
|
149
148
|
description: "Default color for groups\n(must be a valid color name from the theme)"
|
|
150
149
|
}),
|
|
@@ -154,7 +153,7 @@ const LikeC4Config_Styles_Defaults_Group = z__default.strictObject({
|
|
|
154
153
|
id: "GroupDefaultStyleValues",
|
|
155
154
|
description: "Override default values for group style properties\nThese values will be used if such property is not defined"
|
|
156
155
|
});
|
|
157
|
-
const LikeC4Config_Styles_Defaults_Relationship =
|
|
156
|
+
const LikeC4Config_Styles_Defaults_Relationship = z.strictObject({
|
|
158
157
|
color: color.optional().meta({
|
|
159
158
|
description: "Default color for relationships\n(must be a valid color name from the theme)"
|
|
160
159
|
}),
|
|
@@ -164,7 +163,7 @@ const LikeC4Config_Styles_Defaults_Relationship = z__default.strictObject({
|
|
|
164
163
|
id: "RelationshipDefaultStyleValues",
|
|
165
164
|
description: "Override default values for relationship style properties\nThese values will be used if such property is not defined"
|
|
166
165
|
});
|
|
167
|
-
const LikeC4Config_Styles_Defaults =
|
|
166
|
+
const LikeC4Config_Styles_Defaults = z.strictObject({
|
|
168
167
|
color: color.optional().meta({
|
|
169
168
|
description: "Default color for elements\n(must be a valid color name from the theme)"
|
|
170
169
|
}),
|
|
@@ -184,7 +183,7 @@ const LikeC4Config_Styles_Defaults = z__default.strictObject({
|
|
|
184
183
|
id: "DefaultStyleValues",
|
|
185
184
|
description: "Override default values for style properties\nThese values will be used if such property is not defined"
|
|
186
185
|
});
|
|
187
|
-
const LikeC4StylesConfigSchema =
|
|
186
|
+
const LikeC4StylesConfigSchema = z.strictObject({
|
|
188
187
|
theme: LikeC4Config_Styles_Theme.optional(),
|
|
189
188
|
defaults: LikeC4Config_Styles_Defaults.optional()
|
|
190
189
|
// customCss: z
|
|
@@ -211,6 +210,14 @@ function normalizeDefaults(defaults) {
|
|
|
211
210
|
});
|
|
212
211
|
}
|
|
213
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
|
+
});
|
|
214
221
|
const LikeC4ProjectJsonConfigSchema = z.object({
|
|
215
222
|
name: z.string().nonempty("Project name cannot be empty").refine((value) => value !== "default", {
|
|
216
223
|
abort: true,
|
|
@@ -223,7 +230,8 @@ const LikeC4ProjectJsonConfigSchema = z.object({
|
|
|
223
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" }),
|
|
224
231
|
imageAliases: ImageAliasesSchema.optional(),
|
|
225
232
|
styles: LikeC4StylesConfigSchema.optional(),
|
|
226
|
-
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()
|
|
227
235
|
}).meta({
|
|
228
236
|
description: "LikeC4 project configuration"
|
|
229
237
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/config",
|
|
3
|
-
"version": "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": "^
|
|
61
|
+
"zod": "^4.1.12",
|
|
62
62
|
"type-fest": "^4.41.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"esbuild": "^0.25.11",
|
|
66
66
|
"vscode-uri": "3.1.0",
|
|
67
|
-
"@likec4/core": "1.
|
|
68
|
-
"@likec4/log": "1.
|
|
67
|
+
"@likec4/core": "1.44.0",
|
|
68
|
+
"@likec4/log": "1.44.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|
|
71
71
|
"vscode-uri": {
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
"@types/node": "~20.19.22",
|
|
77
77
|
"remeda": "^2.32.0",
|
|
78
78
|
"tsx": "4.20.6",
|
|
79
|
-
"turbo": "2.
|
|
79
|
+
"turbo": "2.6.0",
|
|
80
80
|
"typescript": "5.9.3",
|
|
81
81
|
"unbuild": "3.5.0",
|
|
82
82
|
"nano-spawn": "^1.0.3",
|
|
83
|
-
"vitest": "
|
|
84
|
-
"@likec4/
|
|
85
|
-
"@likec4/
|
|
86
|
-
"@likec4/
|
|
87
|
-
"@likec4/
|
|
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",
|