@likec4/config 1.47.0 → 1.48.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/LICENSE +1 -1
- package/dist/_chunks/libs/remeda.mjs +31 -0
- package/dist/index.d.mts +324 -2217
- package/dist/index.mjs +407 -1
- package/dist/node/index.d.mts +504 -12
- package/dist/node/index.mjs +472 -51
- package/package.json +20 -22
- package/schema.json +85 -83
- package/src/define-config.ts +4 -9
- package/src/filenames.ts +2 -0
- package/src/node/index.ts +39 -1
- package/src/node/load-config.ts +7 -6
- package/src/schema.image-alias.ts +1 -1
- package/src/schema.include.ts +4 -4
- package/src/schema.theme.ts +98 -51
- package/src/schema.ts +16 -7
- package/dist/shared/config.CUC_rqhf.mjs +0 -376
- package/src/logger.ts +0 -3
package/dist/node/index.d.mts
CHANGED
|
@@ -1,17 +1,509 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import '@likec4/core/model';
|
|
6
|
-
import '@likec4/core/types';
|
|
7
|
-
import 'type-fest';
|
|
8
|
-
import 'zod';
|
|
9
|
-
import '@likec4/core/styles';
|
|
1
|
+
import z from "zod/v4";
|
|
2
|
+
import { LikeC4ProjectStylesConfig, LikeC4ProjectTheme, ProjectId, ThemeColorValues as ThemeColorValues$1, aux } from "@likec4/core/types";
|
|
3
|
+
import { DeploymentElementModel, DeploymentRelationModel, ElementModel, LikeC4Model, LikeC4ViewModel, RelationshipModel } from "@likec4/core/model";
|
|
4
|
+
import { SimplifyDeep } from "type-fest";
|
|
10
5
|
|
|
6
|
+
//#region src/schema.d.ts
|
|
7
|
+
interface VscodeURI {
|
|
8
|
+
readonly scheme: string;
|
|
9
|
+
readonly authority: string;
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly fsPath: string;
|
|
12
|
+
readonly query: string;
|
|
13
|
+
readonly fragment: string;
|
|
14
|
+
toString(): string;
|
|
15
|
+
}
|
|
16
|
+
declare const ManualLayoutsConfigSchema: z.ZodObject<{
|
|
17
|
+
outDir: z.ZodDefault<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
declare const LikeC4ProjectJsonConfigSchema: z.ZodObject<{
|
|
20
|
+
name: z.ZodString;
|
|
21
|
+
title: z.ZodOptional<z.ZodString>;
|
|
22
|
+
contactPerson: z.ZodOptional<z.ZodString>;
|
|
23
|
+
imageAliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
24
|
+
include: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
paths: z.ZodArray<z.ZodString>;
|
|
26
|
+
maxDepth: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
fileThreshold: z.ZodDefault<z.ZodNumber>;
|
|
28
|
+
}, z.core.$strict>>;
|
|
29
|
+
styles: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
30
|
+
theme: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
31
|
+
colors: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<any>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>, z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodObject<{
|
|
32
|
+
elements: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodObject<{
|
|
33
|
+
fill: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
34
|
+
stroke: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
35
|
+
hiContrast: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
36
|
+
loContrast: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
37
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
38
|
+
fill: any;
|
|
39
|
+
stroke: any;
|
|
40
|
+
hiContrast: any;
|
|
41
|
+
loContrast: any;
|
|
42
|
+
}>>]>, z.ZodTransform<any, any>>;
|
|
43
|
+
relationships: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodObject<{
|
|
44
|
+
line: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
45
|
+
label: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
46
|
+
labelBg: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>>>;
|
|
47
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
48
|
+
line: any;
|
|
49
|
+
label: any;
|
|
50
|
+
labelBg: any;
|
|
51
|
+
}>>]>, z.ZodTransform<any, any>>;
|
|
52
|
+
}, z.core.$strict>]>, z.ZodTransform<any, any>>>, z.ZodTransform<Record<ThemeColor, ThemeColorValues>, Record<any, any>>>>;
|
|
53
|
+
sizes: z.ZodOptional<z.ZodObject<any, z.core.$strict>>;
|
|
54
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
55
|
+
colors?: Record<ThemeColor, ThemeColorValues> | undefined;
|
|
56
|
+
sizes?: any;
|
|
57
|
+
}>>>;
|
|
58
|
+
defaults: z.ZodOptional<z.ZodObject<{
|
|
59
|
+
color: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<any>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>>;
|
|
60
|
+
opacity: z.ZodOptional<z.ZodInt>;
|
|
61
|
+
border: z.ZodOptional<z.ZodLiteral<any>>;
|
|
62
|
+
size: z.ZodOptional<z.ZodLiteral<any>>;
|
|
63
|
+
shape: z.ZodOptional<z.ZodLiteral<any>>;
|
|
64
|
+
iconPosition: z.ZodOptional<z.ZodLiteral<any>>;
|
|
65
|
+
group: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
color: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<any>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>>;
|
|
67
|
+
opacity: z.ZodOptional<z.ZodInt>;
|
|
68
|
+
border: z.ZodOptional<z.ZodLiteral<any>>;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
relationship: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
color: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<any>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>>;
|
|
72
|
+
line: z.ZodOptional<z.ZodLiteral<"dashed" | "solid" | "dotted">>;
|
|
73
|
+
arrow: z.ZodOptional<z.ZodLiteral<any>>;
|
|
74
|
+
}, z.core.$strict>>;
|
|
75
|
+
}, z.core.$strict>>;
|
|
76
|
+
customCss: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
77
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
78
|
+
theme?: any;
|
|
79
|
+
defaults?: {
|
|
80
|
+
color?: any;
|
|
81
|
+
opacity?: number | undefined;
|
|
82
|
+
border?: any;
|
|
83
|
+
size?: any;
|
|
84
|
+
shape?: any;
|
|
85
|
+
iconPosition?: any;
|
|
86
|
+
group?: {
|
|
87
|
+
color?: any;
|
|
88
|
+
opacity?: number | undefined;
|
|
89
|
+
border?: any;
|
|
90
|
+
} | undefined;
|
|
91
|
+
relationship?: {
|
|
92
|
+
color?: any;
|
|
93
|
+
line?: "dashed" | "solid" | "dotted" | undefined;
|
|
94
|
+
arrow?: any;
|
|
95
|
+
} | undefined;
|
|
96
|
+
} | undefined;
|
|
97
|
+
customCss?: string | string[] | undefined;
|
|
98
|
+
}>>>;
|
|
99
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
100
|
+
manualLayouts: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
outDir: z.ZodDefault<z.ZodString>;
|
|
102
|
+
}, z.core.$strict>>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
type LikeC4ProjectJsonConfig = SimplifyDeep<z.input<typeof LikeC4ProjectJsonConfigSchema>>;
|
|
105
|
+
/**
|
|
106
|
+
* Result of the {@link GeneratorFnContext.locate} function
|
|
107
|
+
*/
|
|
108
|
+
type LocateResult = {
|
|
109
|
+
/**
|
|
110
|
+
* Range inside the source file
|
|
111
|
+
*/
|
|
112
|
+
range: {
|
|
113
|
+
start: {
|
|
114
|
+
line: number;
|
|
115
|
+
character: number;
|
|
116
|
+
};
|
|
117
|
+
end: {
|
|
118
|
+
line: number;
|
|
119
|
+
character: number;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Full path to the source file
|
|
124
|
+
*/
|
|
125
|
+
document: VscodeURI;
|
|
126
|
+
/**
|
|
127
|
+
* Document path relative to the project folder
|
|
128
|
+
*/
|
|
129
|
+
relativePath: string;
|
|
130
|
+
/**
|
|
131
|
+
* Folder, containing the source file ("dirname" of document)
|
|
132
|
+
*/
|
|
133
|
+
folder: string;
|
|
134
|
+
/**
|
|
135
|
+
* Source file name ("basename" of document)
|
|
136
|
+
*/
|
|
137
|
+
filename: string;
|
|
138
|
+
};
|
|
139
|
+
interface GeneratorFnContext {
|
|
140
|
+
/**
|
|
141
|
+
* Workspace root directory
|
|
142
|
+
*/
|
|
143
|
+
readonly workspace: VscodeURI;
|
|
144
|
+
/**
|
|
145
|
+
* Current project
|
|
146
|
+
*/
|
|
147
|
+
readonly project: {
|
|
148
|
+
/**
|
|
149
|
+
* Project name
|
|
150
|
+
*/
|
|
151
|
+
readonly id: ProjectId;
|
|
152
|
+
readonly title?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Project folder
|
|
155
|
+
*/
|
|
156
|
+
readonly folder: VscodeURI;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Returns the location of the specified element, relation, view or deployment element
|
|
160
|
+
*/
|
|
161
|
+
locate(target: ElementModel | RelationshipModel | DeploymentRelationModel | LikeC4ViewModel | DeploymentElementModel): LocateResult;
|
|
162
|
+
/**
|
|
163
|
+
* Write a file
|
|
164
|
+
* @param path - Path to the file, either absolute or relative to the project folder
|
|
165
|
+
* All folders will be created automatically
|
|
166
|
+
* @param content - Content of the file
|
|
167
|
+
*/
|
|
168
|
+
write(file: {
|
|
169
|
+
path: string | string[] | VscodeURI;
|
|
170
|
+
content: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | NodeJS.ReadableStream;
|
|
171
|
+
}): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Abort the process
|
|
174
|
+
*/
|
|
175
|
+
abort(reason?: string): never;
|
|
176
|
+
}
|
|
177
|
+
type GeneratorFnParams = {
|
|
178
|
+
/**
|
|
179
|
+
* LikeC4 model
|
|
180
|
+
*/
|
|
181
|
+
likec4model: LikeC4Model<aux.UnknownLayouted>;
|
|
182
|
+
/**
|
|
183
|
+
* Generator context
|
|
184
|
+
*/
|
|
185
|
+
ctx: GeneratorFnContext;
|
|
186
|
+
};
|
|
187
|
+
interface GeneratorFn {
|
|
188
|
+
(params: GeneratorFnParams): Promise<void> | void;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* LikeC4 project configuration
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* export default defineConfig({
|
|
196
|
+
* name: 'my-project',
|
|
197
|
+
* generators: {
|
|
198
|
+
* 'my-generator': async ({ likec4model, ctx }) => {
|
|
199
|
+
* await ctx.write('my-generator.txt', likec4model.project.id)
|
|
200
|
+
* }
|
|
201
|
+
* }
|
|
202
|
+
* })
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
type LikeC4ProjectConfig = z.infer<typeof LikeC4ProjectJsonConfigSchema> & {
|
|
206
|
+
/**
|
|
207
|
+
* Add custom generators to the project
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* export default defineConfig({
|
|
211
|
+
* name: 'my-project',
|
|
212
|
+
* generators: {
|
|
213
|
+
* 'my-generator': async ({ likec4model, ctx }) => {
|
|
214
|
+
* await ctx.write('my-generator.txt', likec4model.project.id)
|
|
215
|
+
* }
|
|
216
|
+
* }
|
|
217
|
+
* })
|
|
218
|
+
* ```
|
|
219
|
+
*
|
|
220
|
+
* Execute generator:
|
|
221
|
+
* ```bash
|
|
222
|
+
* likec4 gen my-generator
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
generators?: Record<string, GeneratorFn> | undefined;
|
|
226
|
+
};
|
|
227
|
+
type LikeC4ProjectConfigInput = SimplifyDeep<z.input<typeof LikeC4ProjectJsonConfigSchema> & {
|
|
228
|
+
generators?: Record<string, GeneratorFn> | undefined;
|
|
229
|
+
}>;
|
|
230
|
+
/**
|
|
231
|
+
* Validates JSON string or JSON object into a LikeC4ProjectConfig object.
|
|
232
|
+
*/
|
|
233
|
+
declare function validateProjectConfig<C extends string | Record<string, unknown>>(config: C): LikeC4ProjectConfig;
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/schema.include.d.ts
|
|
236
|
+
declare const IncludeConfigSchema: z.ZodObject<{
|
|
237
|
+
paths: z.ZodArray<z.ZodString>;
|
|
238
|
+
maxDepth: z.ZodDefault<z.ZodNumber>;
|
|
239
|
+
fileThreshold: z.ZodDefault<z.ZodNumber>;
|
|
240
|
+
}, z.core.$strict>;
|
|
241
|
+
type IncludeConfig = z.infer<typeof IncludeConfigSchema>;
|
|
242
|
+
declare const IncludeSchema: z.ZodOptional<z.ZodObject<{
|
|
243
|
+
paths: z.ZodArray<z.ZodString>;
|
|
244
|
+
maxDepth: z.ZodDefault<z.ZodNumber>;
|
|
245
|
+
fileThreshold: z.ZodDefault<z.ZodNumber>;
|
|
246
|
+
}, z.core.$strict>>;
|
|
247
|
+
type LikeC4IncludeConfig = z.infer<typeof IncludeSchema>;
|
|
248
|
+
declare function normalizeIncludeConfig(include?: LikeC4IncludeConfig): IncludeConfig;
|
|
249
|
+
declare function validateIncludePaths(include?: LikeC4IncludeConfig): void;
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/schema.theme.d.ts
|
|
252
|
+
declare const ThemeColorValuesSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodObject<{
|
|
253
|
+
elements: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodObject<{
|
|
254
|
+
fill: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
255
|
+
stroke: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
256
|
+
hiContrast: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
257
|
+
loContrast: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
258
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
259
|
+
fill: any;
|
|
260
|
+
stroke: any;
|
|
261
|
+
hiContrast: any;
|
|
262
|
+
loContrast: any;
|
|
263
|
+
}>>]>, z.ZodTransform<any, any>>;
|
|
264
|
+
relationships: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodObject<{
|
|
265
|
+
line: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
266
|
+
label: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
267
|
+
labelBg: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>>>;
|
|
268
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
269
|
+
line: any;
|
|
270
|
+
label: any;
|
|
271
|
+
labelBg: any;
|
|
272
|
+
}>>]>, z.ZodTransform<any, any>>;
|
|
273
|
+
}, z.core.$strict>]>, z.ZodTransform<any, any>>;
|
|
274
|
+
type ThemeColorValuesInput = z.input<typeof ThemeColorValuesSchema>;
|
|
275
|
+
declare const LikeC4Config_Styles_Theme: z.ZodPipe<z.ZodObject<{
|
|
276
|
+
colors: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<any>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>, z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodObject<{
|
|
277
|
+
elements: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodObject<{
|
|
278
|
+
fill: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
279
|
+
stroke: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
280
|
+
hiContrast: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
281
|
+
loContrast: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
282
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
283
|
+
fill: any;
|
|
284
|
+
stroke: any;
|
|
285
|
+
hiContrast: any;
|
|
286
|
+
loContrast: any;
|
|
287
|
+
}>>]>, z.ZodTransform<any, any>>;
|
|
288
|
+
relationships: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodObject<{
|
|
289
|
+
line: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
290
|
+
label: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
291
|
+
labelBg: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>>>;
|
|
292
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
293
|
+
line: any;
|
|
294
|
+
label: any;
|
|
295
|
+
labelBg: any;
|
|
296
|
+
}>>]>, z.ZodTransform<any, any>>;
|
|
297
|
+
}, z.core.$strict>]>, z.ZodTransform<any, any>>>, z.ZodTransform<Record<ThemeColor, ThemeColorValues>, Record<any, any>>>>;
|
|
298
|
+
sizes: z.ZodOptional<z.ZodObject<any, z.core.$strict>>;
|
|
299
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
300
|
+
colors?: Record<ThemeColor, ThemeColorValues> | undefined;
|
|
301
|
+
sizes?: any;
|
|
302
|
+
}>>;
|
|
303
|
+
type LikeC4ConfigThemeInput = z.input<typeof LikeC4Config_Styles_Theme>;
|
|
304
|
+
declare const LikeC4StylesConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
305
|
+
theme: z.ZodOptional<z.ZodPipe<z.ZodObject<{
|
|
306
|
+
colors: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<any>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>, z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodObject<{
|
|
307
|
+
elements: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodObject<{
|
|
308
|
+
fill: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
309
|
+
stroke: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
310
|
+
hiContrast: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
311
|
+
loContrast: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
312
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
313
|
+
fill: any;
|
|
314
|
+
stroke: any;
|
|
315
|
+
hiContrast: any;
|
|
316
|
+
loContrast: any;
|
|
317
|
+
}>>]>, z.ZodTransform<any, any>>;
|
|
318
|
+
relationships: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodObject<{
|
|
319
|
+
line: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
320
|
+
label: z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>;
|
|
321
|
+
labelBg: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>>>;
|
|
322
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
323
|
+
line: any;
|
|
324
|
+
label: any;
|
|
325
|
+
labelBg: any;
|
|
326
|
+
}>>]>, z.ZodTransform<any, any>>;
|
|
327
|
+
}, z.core.$strict>]>, z.ZodTransform<any, any>>>, z.ZodTransform<Record<ThemeColor, ThemeColorValues>, Record<any, any>>>>;
|
|
328
|
+
sizes: z.ZodOptional<z.ZodObject<any, z.core.$strict>>;
|
|
329
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
330
|
+
colors?: Record<ThemeColor, ThemeColorValues> | undefined;
|
|
331
|
+
sizes?: any;
|
|
332
|
+
}>>>;
|
|
333
|
+
defaults: z.ZodOptional<z.ZodObject<{
|
|
334
|
+
color: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<any>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>>;
|
|
335
|
+
opacity: z.ZodOptional<z.ZodInt>;
|
|
336
|
+
border: z.ZodOptional<z.ZodLiteral<any>>;
|
|
337
|
+
size: z.ZodOptional<z.ZodLiteral<any>>;
|
|
338
|
+
shape: z.ZodOptional<z.ZodLiteral<any>>;
|
|
339
|
+
iconPosition: z.ZodOptional<z.ZodLiteral<any>>;
|
|
340
|
+
group: z.ZodOptional<z.ZodObject<{
|
|
341
|
+
color: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<any>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>>;
|
|
342
|
+
opacity: z.ZodOptional<z.ZodInt>;
|
|
343
|
+
border: z.ZodOptional<z.ZodLiteral<any>>;
|
|
344
|
+
}, z.core.$strict>>;
|
|
345
|
+
relationship: z.ZodOptional<z.ZodObject<{
|
|
346
|
+
color: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<any>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>>;
|
|
347
|
+
line: z.ZodOptional<z.ZodLiteral<"dashed" | "solid" | "dotted">>;
|
|
348
|
+
arrow: z.ZodOptional<z.ZodLiteral<any>>;
|
|
349
|
+
}, z.core.$strict>>;
|
|
350
|
+
}, z.core.$strict>>;
|
|
351
|
+
customCss: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
352
|
+
}, z.core.$strict>, z.ZodTransform<any, {
|
|
353
|
+
theme?: any;
|
|
354
|
+
defaults?: {
|
|
355
|
+
color?: any;
|
|
356
|
+
opacity?: number | undefined;
|
|
357
|
+
border?: any;
|
|
358
|
+
size?: any;
|
|
359
|
+
shape?: any;
|
|
360
|
+
iconPosition?: any;
|
|
361
|
+
group?: {
|
|
362
|
+
color?: any;
|
|
363
|
+
opacity?: number | undefined;
|
|
364
|
+
border?: any;
|
|
365
|
+
} | undefined;
|
|
366
|
+
relationship?: {
|
|
367
|
+
color?: any;
|
|
368
|
+
line?: "dashed" | "solid" | "dotted" | undefined;
|
|
369
|
+
arrow?: any;
|
|
370
|
+
} | undefined;
|
|
371
|
+
} | undefined;
|
|
372
|
+
customCss?: string | string[] | undefined;
|
|
373
|
+
}>>;
|
|
374
|
+
interface LikeC4StylesConfig extends z.infer<typeof LikeC4StylesConfigSchema> {}
|
|
375
|
+
type LikeC4StylesConfigInput = z.input<typeof LikeC4StylesConfigSchema>;
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/filenames.d.ts
|
|
378
|
+
declare const configJsonFilenames: readonly [".likec4rc", ".likec4.config.json", "likec4.config.json"];
|
|
379
|
+
declare const configNonJsonFilenames: readonly ["likec4.config.js", "likec4.config.cjs", "likec4.config.mjs", "likec4.config.ts", "likec4.config.cts", "likec4.config.mts"];
|
|
380
|
+
declare const ConfigFilenames: readonly [".likec4rc", ".likec4.config.json", "likec4.config.json", "likec4.config.js", "likec4.config.cjs", "likec4.config.mjs", "likec4.config.ts", "likec4.config.cts", "likec4.config.mts"];
|
|
381
|
+
/**
|
|
382
|
+
* Checks if the given filename is a LikeC4 JSON config file (JSON, RC).
|
|
383
|
+
*/
|
|
384
|
+
declare function isLikeC4JsonConfig(filename: string): filename is typeof configJsonFilenames[number];
|
|
385
|
+
/**
|
|
386
|
+
* Checks if the given filename is a LikeC4 non-JSON config file (JS, MJS, TS, MTS)
|
|
387
|
+
*/
|
|
388
|
+
declare function isLikeC4NonJsonConfig(filename: string): filename is typeof configNonJsonFilenames[number];
|
|
389
|
+
/**
|
|
390
|
+
* Checks if the given filename is a LikeC4 config file (JSON or non-JSON)
|
|
391
|
+
*/
|
|
392
|
+
declare function isLikeC4Config(filename: string): filename is typeof ConfigFilenames[number];
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/define-config.d.ts
|
|
395
|
+
/**
|
|
396
|
+
* Defines LikeC4 Project, allows custom generators that can be executed using CLI:
|
|
397
|
+
*
|
|
398
|
+
* `$ likec4 gen <generator-name>`
|
|
399
|
+
*
|
|
400
|
+
* or VSCode command `LikeC4: Run code generator`
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```ts
|
|
404
|
+
* export default defineConfig({
|
|
405
|
+
* name: 'my-project',
|
|
406
|
+
* title: 'My Project',
|
|
407
|
+
*
|
|
408
|
+
* exclude: ['picomatch pattern'],
|
|
409
|
+
* generators: {
|
|
410
|
+
* '<generator-name>': async ({ likec4model, ctx }) => {
|
|
411
|
+
* await ctx.write('my-generator.txt', likec4model.project.id)
|
|
412
|
+
* }
|
|
413
|
+
* }
|
|
414
|
+
* })
|
|
415
|
+
* ```
|
|
416
|
+
*/
|
|
417
|
+
declare function defineConfig<C extends LikeC4ProjectConfigInput>(config: C): LikeC4ProjectConfig;
|
|
418
|
+
/**
|
|
419
|
+
* Define reusable custom generators
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```ts
|
|
423
|
+
* // generators.ts
|
|
424
|
+
* export default defineGenerators({
|
|
425
|
+
* 'my-generator': async ({ likec4model, ctx }) => {
|
|
426
|
+
* await ctx.write('my-generator.txt', likec4model.project.id)
|
|
427
|
+
* }
|
|
428
|
+
* })
|
|
429
|
+
*
|
|
430
|
+
* // likec4.config.ts
|
|
431
|
+
* import generators from './generators'
|
|
432
|
+
*
|
|
433
|
+
* export default defineConfig({
|
|
434
|
+
* name: 'my-project',
|
|
435
|
+
* generators,
|
|
436
|
+
* })
|
|
437
|
+
* ```
|
|
438
|
+
*/
|
|
439
|
+
declare function defineGenerators<const G extends Record<string, GeneratorFn>>(generators: G): G;
|
|
440
|
+
/**
|
|
441
|
+
* Define reusable custom theme color
|
|
442
|
+
* @example
|
|
443
|
+
* ```ts
|
|
444
|
+
* export default defineThemeColor({
|
|
445
|
+
* element: {
|
|
446
|
+
* fill: 'red'
|
|
447
|
+
* }
|
|
448
|
+
* })
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
declare function defineThemeColor<const S extends ThemeColorValuesInput>(colors: S): ThemeColorValues$1;
|
|
452
|
+
/**
|
|
453
|
+
* Define reusable custom theme
|
|
454
|
+
* @example
|
|
455
|
+
* ```ts
|
|
456
|
+
* import { defineThemeColor, defineTheme } from 'likec4/config'
|
|
457
|
+
*
|
|
458
|
+
* export default defineTheme({
|
|
459
|
+
* colors: {
|
|
460
|
+
* primary: '#FF0000',
|
|
461
|
+
* // Or use defineThemeColor
|
|
462
|
+
* red: defineThemeColor({
|
|
463
|
+
* elements: {
|
|
464
|
+
* fill: 'red'
|
|
465
|
+
* }
|
|
466
|
+
* })
|
|
467
|
+
* }
|
|
468
|
+
* })
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
declare function defineTheme<const S extends LikeC4ConfigThemeInput>(theme: S): LikeC4ProjectTheme;
|
|
472
|
+
/**
|
|
473
|
+
* Define reusable custom style
|
|
474
|
+
* @example
|
|
475
|
+
* ```ts
|
|
476
|
+
* import { defineStyle, defineThemeColor } from 'likec4/config'
|
|
477
|
+
*
|
|
478
|
+
* export default defineStyle({
|
|
479
|
+
* theme: {
|
|
480
|
+
* colors: {
|
|
481
|
+
* red: defineThemeColor({
|
|
482
|
+
* elements: {
|
|
483
|
+
* fill: 'red'
|
|
484
|
+
* }
|
|
485
|
+
* })
|
|
486
|
+
* }
|
|
487
|
+
* },
|
|
488
|
+
* defaults: {
|
|
489
|
+
* color: 'red',
|
|
490
|
+
* opacity: 50,
|
|
491
|
+
* border: 'solid',
|
|
492
|
+
* size: 'sm',
|
|
493
|
+
* relationship: {
|
|
494
|
+
* color: 'grey',
|
|
495
|
+
* line: 'solid',
|
|
496
|
+
* }
|
|
497
|
+
* }
|
|
498
|
+
* })
|
|
499
|
+
*/
|
|
500
|
+
declare function defineStyle<const S extends LikeC4StylesConfigInput>(styles: S): LikeC4ProjectStylesConfig;
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/node/load-config.d.ts
|
|
11
503
|
/**
|
|
12
504
|
* Load LikeC4 Project config file.
|
|
13
505
|
* If filepath is a non-JSON file, it will be bundled and required
|
|
14
506
|
*/
|
|
15
|
-
declare function loadConfig(filepath:
|
|
16
|
-
|
|
17
|
-
export { LikeC4ProjectConfig, loadConfig };
|
|
507
|
+
declare function loadConfig(filepath: VscodeURI): Promise<LikeC4ProjectConfig>;
|
|
508
|
+
//#endregion
|
|
509
|
+
export { ConfigFilenames, type GeneratorFn, type GeneratorFnContext, type GeneratorFnParams, type IncludeConfig, type LikeC4ProjectConfig, type LikeC4ProjectConfigInput, type LikeC4ProjectJsonConfig, type LikeC4StylesConfig, type LikeC4StylesConfigInput, type LocateResult, type ManualLayoutsConfigSchema, defineConfig, defineGenerators, defineStyle, defineTheme, defineThemeColor, isLikeC4Config, isLikeC4JsonConfig, isLikeC4NonJsonConfig, loadConfig, normalizeIncludeConfig, validateIncludePaths, validateProjectConfig };
|