@likec4/config 1.57.0 → 1.59.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.
@@ -0,0 +1,596 @@
1
+ import { t as __name } from "./rolldown-runtime.mjs";
2
+ import z from "zod/v4";
3
+ import { LikeC4ProjectStylesConfig, LikeC4ProjectTheme, ProjectId, ThemeColorValues as ThemeColorValues$1, aux } from "@likec4/core/types";
4
+ import { DeploymentElementModel, DeploymentRelationModel, ElementModel, LikeC4Model, LikeC4ViewModel, RelationshipModel } from "@likec4/core/model";
5
+ //#region src/schema.include.d.ts
6
+ declare const IncludeSchema: z.ZodObject<{
7
+ paths: z.ZodArray<z.ZodString>;
8
+ maxDepth: z.ZodDefault<z.ZodNumber>;
9
+ fileThreshold: z.ZodDefault<z.ZodNumber>;
10
+ }, z.core.$strict>;
11
+ type IncludeConfig = z.infer<typeof IncludeSchema>;
12
+ //#endregion
13
+ //#region src/schema.d.ts
14
+ interface VscodeURI {
15
+ readonly scheme: string;
16
+ readonly authority: string;
17
+ readonly path: string;
18
+ readonly fsPath: string;
19
+ readonly query: string;
20
+ readonly fragment: string;
21
+ toString(): string;
22
+ }
23
+ declare const LikeC4ProjectJsonConfigSchema: z.ZodObject<{
24
+ name: z.ZodString;
25
+ extends: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
26
+ title: z.ZodOptional<z.ZodString>;
27
+ contactPerson: z.ZodOptional<z.ZodString>;
28
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
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<[z.ZodEnum<{
32
+ [x: string]: any;
33
+ }>, z.ZodPipe<z.ZodCustom<string & Record<never, never>, string & Record<never, never>>, z.ZodTransform<any, string & Record<never, never>>>]>, z.ZodTransform<any, any>> & z.core.$partial, z.ZodPipe<z.ZodUnion<[z.ZodPipe<z.ZodObject<{
34
+ elements: z.ZodUnion<[z.ZodPipe<z.ZodObject<{
35
+ fill: z.ZodString;
36
+ stroke: z.ZodString;
37
+ hiContrast: z.ZodString;
38
+ loContrast: z.ZodString;
39
+ }, z.core.$strict>, z.ZodTransform<any, {
40
+ fill: string;
41
+ stroke: string;
42
+ hiContrast: string;
43
+ loContrast: string;
44
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>;
45
+ relationships: z.ZodUnion<[z.ZodPipe<z.ZodObject<{
46
+ line: z.ZodString;
47
+ label: z.ZodString;
48
+ labelBg: z.ZodDefault<z.ZodOptional<z.ZodString>>;
49
+ }, z.core.$strict>, z.ZodTransform<any, {
50
+ line: string;
51
+ label: string;
52
+ labelBg: string;
53
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>;
54
+ }, z.core.$strict>, z.ZodTransform<any, {
55
+ elements: any;
56
+ relationships: any;
57
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>>, z.ZodTransform<Record<ThemeColor, ThemeColorValues>, Partial<Record<any, any>>>>>;
58
+ sizes: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
59
+ [x: string]: any;
60
+ }> & z.core.$partial, z.ZodObject<{
61
+ width: z.ZodNumber;
62
+ height: z.ZodNumber;
63
+ }, z.core.$strict>>>;
64
+ }, z.core.$strict>, z.ZodTransform<any, {
65
+ colors?: Record<ThemeColor, ThemeColorValues> | undefined;
66
+ sizes?: Partial<Record<any, {
67
+ width: number;
68
+ height: number;
69
+ }>> | undefined;
70
+ }>>>;
71
+ defaults: z.ZodOptional<z.ZodObject<{
72
+ color: z.ZodOptional<z.ZodPipe<z.ZodUnion<[z.ZodEnum<{
73
+ [x: string]: any;
74
+ }>, z.ZodPipe<z.ZodCustom<string & Record<never, never>, string & Record<never, never>>, z.ZodTransform<any, string & Record<never, never>>>]>, z.ZodTransform<any, any>>>;
75
+ opacity: z.ZodOptional<z.ZodInt>;
76
+ border: z.ZodOptional<z.ZodEnum<{
77
+ [x: string]: any;
78
+ }>>;
79
+ size: z.ZodOptional<z.ZodEnum<{
80
+ [x: string]: any;
81
+ }>>;
82
+ shape: z.ZodOptional<z.ZodEnum<{
83
+ [x: string]: any;
84
+ }>>;
85
+ iconPosition: z.ZodOptional<z.ZodEnum<{
86
+ [x: string]: any;
87
+ }>>;
88
+ group: z.ZodOptional<z.ZodObject<{
89
+ color: z.ZodOptional<z.ZodPipe<z.ZodUnion<[z.ZodEnum<{
90
+ [x: string]: any;
91
+ }>, z.ZodPipe<z.ZodCustom<string & Record<never, never>, string & Record<never, never>>, z.ZodTransform<any, string & Record<never, never>>>]>, z.ZodTransform<any, any>>>;
92
+ opacity: z.ZodOptional<z.ZodInt>;
93
+ border: z.ZodOptional<z.ZodEnum<{
94
+ [x: string]: any;
95
+ }>>;
96
+ }, z.core.$strict>>;
97
+ relationship: z.ZodOptional<z.ZodObject<{
98
+ color: z.ZodOptional<z.ZodPipe<z.ZodUnion<[z.ZodEnum<{
99
+ [x: string]: any;
100
+ }>, z.ZodPipe<z.ZodCustom<string & Record<never, never>, string & Record<never, never>>, z.ZodTransform<any, string & Record<never, never>>>]>, z.ZodTransform<any, any>>>;
101
+ line: z.ZodOptional<z.ZodEnum<{
102
+ dashed: "dashed";
103
+ solid: "solid";
104
+ dotted: "dotted";
105
+ }>>;
106
+ arrow: z.ZodOptional<z.ZodEnum<{
107
+ [x: string]: any;
108
+ }>>;
109
+ }, z.core.$strict>>;
110
+ }, z.core.$strict>>;
111
+ customCss: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
112
+ }, z.core.$strict>, z.ZodTransform<any, {
113
+ theme?: any;
114
+ defaults?: {
115
+ color?: any;
116
+ opacity?: number | undefined;
117
+ border?: any;
118
+ size?: any;
119
+ shape?: any;
120
+ iconPosition?: any;
121
+ group?: {
122
+ color?: any;
123
+ opacity?: number | undefined;
124
+ border?: any;
125
+ } | undefined;
126
+ relationship?: {
127
+ color?: any;
128
+ line?: "dashed" | "solid" | "dotted" | undefined;
129
+ arrow?: any;
130
+ } | undefined;
131
+ } | undefined;
132
+ customCss?: string | string[] | undefined;
133
+ }>>>;
134
+ imageAliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
135
+ include: z.ZodOptional<z.ZodObject<{
136
+ paths: z.ZodArray<z.ZodString>;
137
+ maxDepth: z.ZodDefault<z.ZodNumber>;
138
+ fileThreshold: z.ZodDefault<z.ZodNumber>;
139
+ }, z.core.$strict>>;
140
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ manualLayouts: z.ZodOptional<z.ZodObject<{
142
+ outDir: z.ZodDefault<z.ZodString>;
143
+ }, z.core.$strict>>;
144
+ inferTechnologyFromIcon: z.ZodOptional<z.ZodBoolean>;
145
+ implicitViews: z.ZodOptional<z.ZodBoolean>;
146
+ landingPage: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
147
+ redirect: z.ZodLiteral<true>;
148
+ }, z.core.$strict>, z.ZodObject<{
149
+ include: z.ZodArray<z.ZodString>;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ exclude: z.ZodArray<z.ZodString>;
152
+ }, z.core.$strict>]>>;
153
+ }, z.core.$strip>;
154
+ type LikeC4ProjectJsonConfig = z.input<typeof LikeC4ProjectJsonConfigSchema>;
155
+ /**
156
+ * Result of the {@link GeneratorFnContext.locate} function
157
+ */
158
+ type LocateResult = {
159
+ /**
160
+ * Range inside the source file
161
+ */
162
+ range: {
163
+ start: {
164
+ line: number;
165
+ character: number;
166
+ };
167
+ end: {
168
+ line: number;
169
+ character: number;
170
+ };
171
+ };
172
+ /**
173
+ * Full path to the source file
174
+ */
175
+ document: VscodeURI;
176
+ /**
177
+ * Document path relative to the project folder
178
+ */
179
+ relativePath: string;
180
+ /**
181
+ * Folder, containing the source file ("dirname" of document)
182
+ */
183
+ folder: string;
184
+ /**
185
+ * Source file name ("basename" of document)
186
+ */
187
+ filename: string;
188
+ };
189
+ interface GeneratorFnContext {
190
+ /**
191
+ * Workspace root directory
192
+ */
193
+ readonly workspace: VscodeURI;
194
+ /**
195
+ * Current project
196
+ */
197
+ readonly project: {
198
+ /**
199
+ * Project name
200
+ */
201
+ readonly id: ProjectId;
202
+ readonly title?: string;
203
+ /**
204
+ * Project folder
205
+ */
206
+ readonly folder: VscodeURI;
207
+ };
208
+ /**
209
+ * Returns the location of the specified element, relation, view or deployment element
210
+ */
211
+ locate(target: ElementModel | RelationshipModel | DeploymentRelationModel | LikeC4ViewModel | DeploymentElementModel): LocateResult;
212
+ /**
213
+ * Write a file
214
+ * @param path - Path to the file, either absolute or relative to the project folder
215
+ * All folders will be created automatically
216
+ * @param content - Content of the file
217
+ */
218
+ write(file: {
219
+ path: string | string[] | VscodeURI;
220
+ content: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | NodeJS.ReadableStream;
221
+ }): Promise<void>;
222
+ /**
223
+ * Abort the process
224
+ */
225
+ abort(reason?: string): never;
226
+ }
227
+ type GeneratorFnParams = {
228
+ /**
229
+ * LikeC4 model
230
+ */
231
+ likec4model: LikeC4Model<aux.UnknownLayouted>;
232
+ /**
233
+ * Generator context
234
+ */
235
+ ctx: GeneratorFnContext;
236
+ };
237
+ interface GeneratorFn {
238
+ (params: GeneratorFnParams): Promise<void> | void;
239
+ }
240
+ /**
241
+ * LikeC4 project configuration
242
+ *
243
+ * @example
244
+ * ```ts
245
+ * export default defineConfig({
246
+ * name: 'my-project',
247
+ * generators: {
248
+ * 'my-generator': async ({ likec4model, ctx }) => {
249
+ * await ctx.write('my-generator.txt', likec4model.project.id)
250
+ * }
251
+ * }
252
+ * })
253
+ * ```
254
+ */
255
+ type LikeC4ProjectConfig = z.infer<typeof LikeC4ProjectJsonConfigSchema> & {
256
+ /**
257
+ * Add custom generators to the project
258
+ * @example
259
+ * ```ts
260
+ * export default defineConfig({
261
+ * name: 'my-project',
262
+ * generators: {
263
+ * 'my-generator': async ({ likec4model, ctx }) => {
264
+ * await ctx.write('my-generator.txt', likec4model.project.id)
265
+ * }
266
+ * }
267
+ * })
268
+ * ```
269
+ *
270
+ * Execute generator:
271
+ * ```bash
272
+ * likec4 gen my-generator
273
+ * ```
274
+ */
275
+ generators?: Record<string, GeneratorFn> | undefined;
276
+ };
277
+ type LikeC4ProjectConfigInput = LikeC4ProjectJsonConfig & {
278
+ generators?: Record<string, GeneratorFn> | undefined;
279
+ };
280
+ /**
281
+ * Validates Object into a LikeC4ProjectConfig object.
282
+ * Zod v4 can strip optional union keys (e.g. landingPage) from parse output;
283
+ * we validate landingPage once with LandingPageSchema and merge onto the result.
284
+ */
285
+ declare function validateProjectConfig<C extends Record<string, unknown>>(config: C): LikeC4ProjectConfig;
286
+ /**
287
+ * Parses JSON string into a LikeC4ProjectConfig object.
288
+ * Does not process "extends" - use `loadConfig` function instead
289
+ */
290
+ declare function parseProjectConfigJSON(config: string): LikeC4ProjectConfig;
291
+ declare const LikeC4ProjectConfigOps: {
292
+ parse: typeof parseProjectConfigJSON;
293
+ validate: typeof validateProjectConfig;
294
+ normalizeInclude: (include: z.input<typeof IncludeSchema> | undefined) => IncludeConfig;
295
+ };
296
+ //#endregion
297
+ //#region src/schema.theme.d.ts
298
+ declare const ThemeColorValuesSchema: z.ZodPipe<z.ZodUnion<[z.ZodPipe<z.ZodObject<{
299
+ elements: z.ZodUnion<[z.ZodPipe<z.ZodObject<{
300
+ fill: z.ZodString;
301
+ stroke: z.ZodString;
302
+ hiContrast: z.ZodString;
303
+ loContrast: z.ZodString;
304
+ }, z.core.$strict>, z.ZodTransform<any, {
305
+ fill: string;
306
+ stroke: string;
307
+ hiContrast: string;
308
+ loContrast: string;
309
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>;
310
+ relationships: z.ZodUnion<[z.ZodPipe<z.ZodObject<{
311
+ line: z.ZodString;
312
+ label: z.ZodString;
313
+ labelBg: z.ZodDefault<z.ZodOptional<z.ZodString>>;
314
+ }, z.core.$strict>, z.ZodTransform<any, {
315
+ line: string;
316
+ label: string;
317
+ labelBg: string;
318
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>;
319
+ }, z.core.$strict>, z.ZodTransform<any, {
320
+ elements: any;
321
+ relationships: any;
322
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>;
323
+ type ThemeColorValuesInput = z.input<typeof ThemeColorValuesSchema>;
324
+ declare const LikeC4Config_Styles_Theme: z.ZodPipe<z.ZodObject<{
325
+ colors: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodPipe<z.ZodUnion<[z.ZodEnum<{
326
+ [x: string]: any;
327
+ }>, z.ZodPipe<z.ZodCustom<string & Record<never, never>, string & Record<never, never>>, z.ZodTransform<any, string & Record<never, never>>>]>, z.ZodTransform<any, any>> & z.core.$partial, z.ZodPipe<z.ZodUnion<[z.ZodPipe<z.ZodObject<{
328
+ elements: z.ZodUnion<[z.ZodPipe<z.ZodObject<{
329
+ fill: z.ZodString;
330
+ stroke: z.ZodString;
331
+ hiContrast: z.ZodString;
332
+ loContrast: z.ZodString;
333
+ }, z.core.$strict>, z.ZodTransform<any, {
334
+ fill: string;
335
+ stroke: string;
336
+ hiContrast: string;
337
+ loContrast: string;
338
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>;
339
+ relationships: z.ZodUnion<[z.ZodPipe<z.ZodObject<{
340
+ line: z.ZodString;
341
+ label: z.ZodString;
342
+ labelBg: z.ZodDefault<z.ZodOptional<z.ZodString>>;
343
+ }, z.core.$strict>, z.ZodTransform<any, {
344
+ line: string;
345
+ label: string;
346
+ labelBg: string;
347
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>;
348
+ }, z.core.$strict>, z.ZodTransform<any, {
349
+ elements: any;
350
+ relationships: any;
351
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>>, z.ZodTransform<Record<ThemeColor, ThemeColorValues>, Partial<Record<any, any>>>>>;
352
+ sizes: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
353
+ [x: string]: any;
354
+ }> & z.core.$partial, z.ZodObject<{
355
+ width: z.ZodNumber;
356
+ height: z.ZodNumber;
357
+ }, z.core.$strict>>>;
358
+ }, z.core.$strict>, z.ZodTransform<any, {
359
+ colors?: Record<ThemeColor, ThemeColorValues> | undefined;
360
+ sizes?: Partial<Record<any, {
361
+ width: number;
362
+ height: number;
363
+ }>> | undefined;
364
+ }>>;
365
+ type LikeC4ConfigThemeInput = z.input<typeof LikeC4Config_Styles_Theme>;
366
+ declare const LikeC4StylesConfigSchema: z.ZodPipe<z.ZodObject<{
367
+ theme: z.ZodOptional<z.ZodPipe<z.ZodObject<{
368
+ colors: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodPipe<z.ZodUnion<[z.ZodEnum<{
369
+ [x: string]: any;
370
+ }>, z.ZodPipe<z.ZodCustom<string & Record<never, never>, string & Record<never, never>>, z.ZodTransform<any, string & Record<never, never>>>]>, z.ZodTransform<any, any>> & z.core.$partial, z.ZodPipe<z.ZodUnion<[z.ZodPipe<z.ZodObject<{
371
+ elements: z.ZodUnion<[z.ZodPipe<z.ZodObject<{
372
+ fill: z.ZodString;
373
+ stroke: z.ZodString;
374
+ hiContrast: z.ZodString;
375
+ loContrast: z.ZodString;
376
+ }, z.core.$strict>, z.ZodTransform<any, {
377
+ fill: string;
378
+ stroke: string;
379
+ hiContrast: string;
380
+ loContrast: string;
381
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>;
382
+ relationships: z.ZodUnion<[z.ZodPipe<z.ZodObject<{
383
+ line: z.ZodString;
384
+ label: z.ZodString;
385
+ labelBg: z.ZodDefault<z.ZodOptional<z.ZodString>>;
386
+ }, z.core.$strict>, z.ZodTransform<any, {
387
+ line: string;
388
+ label: string;
389
+ labelBg: string;
390
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>;
391
+ }, z.core.$strict>, z.ZodTransform<any, {
392
+ elements: any;
393
+ relationships: any;
394
+ }>>, z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>]>, z.ZodTransform<any, any>>>, z.ZodTransform<Record<ThemeColor, ThemeColorValues>, Partial<Record<any, any>>>>>;
395
+ sizes: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
396
+ [x: string]: any;
397
+ }> & z.core.$partial, z.ZodObject<{
398
+ width: z.ZodNumber;
399
+ height: z.ZodNumber;
400
+ }, z.core.$strict>>>;
401
+ }, z.core.$strict>, z.ZodTransform<any, {
402
+ colors?: Record<ThemeColor, ThemeColorValues> | undefined;
403
+ sizes?: Partial<Record<any, {
404
+ width: number;
405
+ height: number;
406
+ }>> | undefined;
407
+ }>>>;
408
+ defaults: z.ZodOptional<z.ZodObject<{
409
+ color: z.ZodOptional<z.ZodPipe<z.ZodUnion<[z.ZodEnum<{
410
+ [x: string]: any;
411
+ }>, z.ZodPipe<z.ZodCustom<string & Record<never, never>, string & Record<never, never>>, z.ZodTransform<any, string & Record<never, never>>>]>, z.ZodTransform<any, any>>>;
412
+ opacity: z.ZodOptional<z.ZodInt>;
413
+ border: z.ZodOptional<z.ZodEnum<{
414
+ [x: string]: any;
415
+ }>>;
416
+ size: z.ZodOptional<z.ZodEnum<{
417
+ [x: string]: any;
418
+ }>>;
419
+ shape: z.ZodOptional<z.ZodEnum<{
420
+ [x: string]: any;
421
+ }>>;
422
+ iconPosition: z.ZodOptional<z.ZodEnum<{
423
+ [x: string]: any;
424
+ }>>;
425
+ group: z.ZodOptional<z.ZodObject<{
426
+ color: z.ZodOptional<z.ZodPipe<z.ZodUnion<[z.ZodEnum<{
427
+ [x: string]: any;
428
+ }>, z.ZodPipe<z.ZodCustom<string & Record<never, never>, string & Record<never, never>>, z.ZodTransform<any, string & Record<never, never>>>]>, z.ZodTransform<any, any>>>;
429
+ opacity: z.ZodOptional<z.ZodInt>;
430
+ border: z.ZodOptional<z.ZodEnum<{
431
+ [x: string]: any;
432
+ }>>;
433
+ }, z.core.$strict>>;
434
+ relationship: z.ZodOptional<z.ZodObject<{
435
+ color: z.ZodOptional<z.ZodPipe<z.ZodUnion<[z.ZodEnum<{
436
+ [x: string]: any;
437
+ }>, z.ZodPipe<z.ZodCustom<string & Record<never, never>, string & Record<never, never>>, z.ZodTransform<any, string & Record<never, never>>>]>, z.ZodTransform<any, any>>>;
438
+ line: z.ZodOptional<z.ZodEnum<{
439
+ dashed: "dashed";
440
+ solid: "solid";
441
+ dotted: "dotted";
442
+ }>>;
443
+ arrow: z.ZodOptional<z.ZodEnum<{
444
+ [x: string]: any;
445
+ }>>;
446
+ }, z.core.$strict>>;
447
+ }, z.core.$strict>>;
448
+ customCss: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
449
+ }, z.core.$strict>, z.ZodTransform<any, {
450
+ theme?: any;
451
+ defaults?: {
452
+ color?: any;
453
+ opacity?: number | undefined;
454
+ border?: any;
455
+ size?: any;
456
+ shape?: any;
457
+ iconPosition?: any;
458
+ group?: {
459
+ color?: any;
460
+ opacity?: number | undefined;
461
+ border?: any;
462
+ } | undefined;
463
+ relationship?: {
464
+ color?: any;
465
+ line?: "dashed" | "solid" | "dotted" | undefined;
466
+ arrow?: any;
467
+ } | undefined;
468
+ } | undefined;
469
+ customCss?: string | string[] | undefined;
470
+ }>>;
471
+ interface LikeC4StylesConfig extends z.infer<typeof LikeC4StylesConfigSchema> {}
472
+ type LikeC4StylesConfigInput = z.input<typeof LikeC4StylesConfigSchema>;
473
+ //#endregion
474
+ //#region src/filenames.d.ts
475
+ /** All known LikeC4 config filenames (JSON and non-JSON). */
476
+ 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"];
477
+ /** Returns true if the **basename** of the given path matches a known config filename. */
478
+ declare function isLikeC4JsonConfig(filename: string): boolean;
479
+ /**
480
+ * Returns true if the **basename** of the given path matches a known non-JSON config filename (JS, MJS, TS, MTS).
481
+ */
482
+ declare function isLikeC4NonJsonConfig(filename: string): boolean;
483
+ /**
484
+ * Returns true if the **basename** of the given path matches a known LikeC4 config file (JSON or non-JSON).
485
+ */
486
+ declare function isLikeC4Config(filename: string): boolean;
487
+ //#endregion
488
+ //#region src/define-config.d.ts
489
+ /**
490
+ * Defines LikeC4 Project, allows custom generators that can be executed using CLI:
491
+ *
492
+ * `$ likec4 gen <generator-name>`
493
+ *
494
+ * or VSCode command `LikeC4: Run code generator`
495
+ *
496
+ * @example
497
+ * ```ts
498
+ * export default defineConfig({
499
+ * name: 'my-project',
500
+ * title: 'My Project',
501
+ *
502
+ * exclude: ['picomatch pattern'],
503
+ * generators: {
504
+ * '<generator-name>': async ({ likec4model, ctx }) => {
505
+ * await ctx.write('my-generator.txt', likec4model.project.id)
506
+ * }
507
+ * }
508
+ * })
509
+ * ```
510
+ */
511
+ declare function defineConfig<C extends LikeC4ProjectConfigInput>(config: C): LikeC4ProjectConfig;
512
+ /**
513
+ * Define reusable custom generators
514
+ *
515
+ * @example
516
+ * ```ts
517
+ * // generators.ts
518
+ * export default defineGenerators({
519
+ * 'my-generator': async ({ likec4model, ctx }) => {
520
+ * await ctx.write('my-generator.txt', likec4model.project.id)
521
+ * }
522
+ * })
523
+ *
524
+ * // likec4.config.ts
525
+ * import generators from './generators'
526
+ *
527
+ * export default defineConfig({
528
+ * name: 'my-project',
529
+ * generators,
530
+ * })
531
+ * ```
532
+ */
533
+ declare function defineGenerators<const G extends Record<string, GeneratorFn>>(generators: G): G;
534
+ /**
535
+ * Define reusable custom theme color
536
+ * @example
537
+ * ```ts
538
+ * export default defineThemeColor({
539
+ * element: {
540
+ * fill: 'red'
541
+ * }
542
+ * })
543
+ * ```
544
+ */
545
+ declare function defineThemeColor<const S extends ThemeColorValuesInput>(colors: S): ThemeColorValues$1;
546
+ /**
547
+ * Define reusable custom theme
548
+ * @example
549
+ * ```ts
550
+ * import { defineThemeColor, defineTheme } from 'likec4/config'
551
+ *
552
+ * export default defineTheme({
553
+ * colors: {
554
+ * primary: '#FF0000',
555
+ * // Or use defineThemeColor
556
+ * red: defineThemeColor({
557
+ * elements: {
558
+ * fill: 'red'
559
+ * }
560
+ * })
561
+ * }
562
+ * })
563
+ * ```
564
+ */
565
+ declare function defineTheme<const S extends LikeC4ConfigThemeInput>(theme: S): LikeC4ProjectTheme;
566
+ /**
567
+ * Define reusable custom style
568
+ * @example
569
+ * ```ts
570
+ * import { defineStyle, defineThemeColor } from 'likec4/config'
571
+ *
572
+ * export default defineStyle({
573
+ * theme: {
574
+ * colors: {
575
+ * red: defineThemeColor({
576
+ * elements: {
577
+ * fill: 'red'
578
+ * }
579
+ * })
580
+ * }
581
+ * },
582
+ * defaults: {
583
+ * color: 'red',
584
+ * opacity: 50,
585
+ * border: 'solid',
586
+ * size: 'sm',
587
+ * relationship: {
588
+ * color: 'grey',
589
+ * line: 'solid',
590
+ * }
591
+ * }
592
+ * })
593
+ */
594
+ declare function defineStyle<const S extends LikeC4StylesConfigInput>(styles: S): LikeC4ProjectStylesConfig;
595
+ //#endregion
596
+ export { VscodeURI as C, LocateResult as S, GeneratorFnParams as _, defineThemeColor as a, LikeC4ProjectConfigOps as b, isLikeC4JsonConfig as c, LikeC4StylesConfig as d, LikeC4StylesConfigInput as f, GeneratorFnContext as g, GeneratorFn as h, defineTheme as i, isLikeC4NonJsonConfig as l, ThemeColorValuesInput as m, defineGenerators as n, ConfigFilenames as o, LikeC4StylesConfigSchema as p, defineStyle as r, isLikeC4Config as s, defineConfig as t, LikeC4ConfigThemeInput as u, LikeC4ProjectConfig as v, IncludeConfig as w, LikeC4ProjectJsonConfig as x, LikeC4ProjectConfigInput as y };
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});export{__name as t};
@@ -0,0 +1,17 @@
1
+ import"./rolldown-runtime.mjs";import e from"json5";import t from"zod/v4";import{BorderStyles as n,ElementShapes as r,IconPositions as i,RelationshipArrowTypes as a,Sizes as o,ThemeColors as s,computeColorValues as c}from"@likec4/core/styles";import{exact as l}from"@likec4/core/types";const u=/^@[A-Za-z0-9_-]*$/,d=/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,f=t.string().min(1,`Image alias key cannot be empty`).regex(u,`Image alias key must match /^@\\w+$/`),p=t.string().min(1,`Image alias value cannot be empty`).regex(d,`Image alias value must be a relative path (no leading slash or protocol)`),m=t.record(f,p).meta({id:`ImageAliases`,description:`Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash).`}),h=t.string().min(1,`Include path cannot be empty`).regex(/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,`Include path must be a relative path (no leading slash, drive letter, or protocol)`),g=t.strictObject({paths:t.array(h).meta({description:[`Additional relative directory paths to include LikeC4 source files from, searched recursively.`,`Paths are relative to the project folder (the folder containing this config file).`,`Example: ["../shared", "../common/specs"]`].join(`
2
+ `)}),maxDepth:t.number().int().min(1).max(20).default(3).meta({description:[`Maximum directory depth to scan when searching for .c4 files in include paths.`,`Prevents excessive scanning of deeply nested directories.`,`Default: 3`].join(`
3
+ `)}),fileThreshold:t.number().int().min(1).max(1e4).default(30).meta({description:[`Maximum number of files to load from include paths before warning.`,`Helps identify performance issues from accidentally including large directories.`,`Default: 30`].join(`
4
+ `)})}).meta({id:`include-config`,description:[`Configuration for including additional LikeC4 source files from other directories.`,`Example: { "paths": ["../shared", "../common/specs"], "maxDepth": 5, "fileThreshold": 50 }`].join(`
5
+ `)}),_=t.int().min(0,`Opacity must be between 0 and 100`).max(100,`Opacity must be between 0 and 100`).meta({id:`Opacity`,description:`Opacity 0-100%`}),v=t.enum(r).meta({id:`ElementShape`}),y=t.enum(n).meta({id:`BorderStyle`}),b=t.enum(o).meta({id:`ElementSize`}),x=t.enum(i).meta({id:`IconPosition`}),S=t.enum(a).meta({id:`ArrowType`}),C=t.enum([`dashed`,`solid`,`dotted`]).meta({id:`LineType`}),w=t.enum(s).meta({id:`ThemeColorName`}),T=t.custom().refine(e=>typeof e==`string`,`Custom color name must be a string`).transform(e=>e).meta({id:`CustomColorName`}),E=w.or(T).transform(e=>e).meta({id:`ColorName`}),D=t.string().min(1,`Color value cannot be empty`).meta({id:`ColorLiteral`}),O=t.strictObject({fill:D.meta({description:`Background color`}),stroke:D.meta({description:`Stroke color (border, paths above background)`}),hiContrast:D.meta({description:`High contrast text color (title)`}),loContrast:D.meta({description:`Low contrast text color (description)`})}).meta({id:`ElementColorValues`}).transform(e=>e),k=t.strictObject({line:D.meta({description:`Line color`}),label:D.meta({description:`Label text color`}),labelBg:D.optional().default(`rgba(0, 0, 0, 0.5)`).meta({description:`Label background color`})}).meta({id:`RelationshipColorValues`}).transform(e=>e),A=t.strictObject({elements:O.or(D.transform(e=>c(e).elements)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),relationships:k.or(D.transform(e=>c(e).relationships)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`})}).transform(e=>e).meta({id:`StrictThemeColorValues`,description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color value`}).or(D.transform(e=>c(e))).transform(e=>e).meta({id:`ThemeColorValues`,description:`Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),j=t.partialRecord(E,A).transform(e=>e),M=t.strictObject({width:t.number().min(50),height:t.number().min(50)}).meta({id:`Dimensions`,description:`Defines dimensions for theme size`}),N=t.partialRecord(b,M),P=t.strictObject({colors:j.optional().meta({description:`Override theme colors`}),sizes:N.optional().meta({description:`Override theme sizes`})}).meta({id:`ThemeCustomization`,description:`Customize theme colors and sizes`}).transform(({colors:e,sizes:t})=>l({colors:e?l(e):void 0,sizes:t?l(t):void 0})),F=t.strictObject({color:E.optional().meta({description:`Default color for groups
6
+ (must be a valid color name from the theme)`}),opacity:_.optional().meta({description:`Default opacity for groups`}),border:y.optional().meta({description:`Default border for groups`})}).meta({id:`GroupDefaultStyleValues`}),I=t.strictObject({color:E.optional().meta({description:`Default color for relationships
7
+ (must be a valid color name from the theme)`}),line:C.optional().meta({description:`Default line style for relationships`}),arrow:S.optional().meta({description:`Default arrow style for relationships`})}).meta({id:`RelationshipDefaultStyleValues`,description:`Override default values for relationship style properties
8
+ These values will be used if such property is not defined`}),L=t.strictObject({color:E.optional().meta({description:`Default color for elements
9
+ (must be a valid color name from the theme)`}),opacity:_.optional().meta({description:`Default opacity (0-100%) for elements when displayed as a group (like a container)`}),border:y.optional().meta({description:`Default border style for elements when displayed as a group (like a container)`}),size:b.optional().meta({description:`Default size for elements`}),shape:v.optional().meta({description:`Default shape for elements`}),iconPosition:x.optional().meta({description:`Default icon position for elements`}),group:F.optional().meta({description:`Override default values for group style properties
10
+ These values will be used if such property is not defined`}),relationship:I.optional().meta({description:`Override default values for relationship style properties
11
+ These values will be used if such property is not defined`})}).meta({id:`DefaultStyleValues`}),R=t.union([t.string().min(1,`Custom CSS file path cannot be empty`),t.array(t.string().min(1,`Custom CSS file path cannot be empty`))]).meta({id:`CustomStylesheets`}),z=t.strictObject({theme:P.optional().meta({description:`Project theme customization`}),defaults:L.optional().meta({description:`Override default values for style properties
12
+ These values will be used if such property is not defined`}),customCss:R.optional().meta({description:`Custom CSS (or list of CSS files) to be included in the generated diagrams`})}).transform(({theme:e,defaults:t,customCss:n})=>l({defaults:normalizeDefaults(t),customCss:normalizeStylesheets(n),theme:e}));function normalizeDefaults(e){if(!e)return;let{relationship:t,group:n,...r}=e;return l({...r,relationship:t&&l(t),group:n&&l(n)})}function normalizeStylesheets(e){if(!e)return;let t=(Array.isArray(e)?e:[e]).filter(Boolean);if(t.length!==0)return{paths:t,content:``}}const B=t.strictObject({outDir:t.string().default(`.likec4`).meta({description:[`Path to the directory where manual layouts will be stored,`,`relative to the folder containing the project config. `,``,`Defaults to '.likec4'.`].join(`
13
+ `)})}).meta({id:`ManualLayoutsConfig`,description:`Configuration for manual layouts`}),V=t.union([t.strictObject({redirect:t.literal(!0)}),t.strictObject({include:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`include list cannot be empty`)}),t.strictObject({exclude:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`exclude list cannot be empty`)})]).meta({id:`LandingPageConfig`,description:`Configure the landing page. Use redirect to go to the index view, or include/exclude to filter the view grid.`}),H=t.object({name:t.string().nonempty(`Project name cannot be empty`).refine(e=>e!=="default",{abort:!0,error:`Project name cannot be "default"`}).refine(e=>!e.includes(`.`)&&!e.includes(`@`)&&!e.includes(`#`),{abort:!0,error:`Project name cannot contain ".", "@" or "#", try to use A-z, 0-9, _ and -`}).meta({description:`Project name, must be unique in the workspace`}),extends:t.union([t.string().min(1,`Extend path cannot be empty`),t.array(t.string().min(1,`Extend path cannot be empty`)).min(1,`Extend list cannot be empty`)]).optional().meta({description:`Extend styles from other config files`}),title:t.string().nonempty(`Project title cannot be empty if specified`).optional().meta({description:`A human readable title for the project`}),contactPerson:t.string().nonempty(`Contact person cannot be empty if specified`).optional().meta({description:`A person who has been involved in creating or maintaining this project`}),metadata:t.record(t.string(),t.any()).optional().meta({description:`Arbitrary metadata as key-value pairs for custom project information`}),styles:z.optional().meta({description:`Project styles customization`}),imageAliases:m.optional(),include:g.optional(),exclude:t.array(t.string()).optional().meta({description:`List of file patterns to exclude from the project, default is ["**/node_modules/**"]`}),manualLayouts:B.optional(),inferTechnologyFromIcon:t.boolean().optional().meta({description:[`Automatically derive element technology from icon name when technology is not set explicitly.`,`Applies to aws:, azure:, gcp:, and tech: icons. Bootstrap icons are excluded.`,`Defaults to true.`].join(`
14
+ `)}),implicitViews:t.boolean().optional().meta({description:`Auto-generate scoped views for elements without explicit views. Defaults to false.`}),landingPage:V.optional()}).meta({id:`LikeC4ProjectConfig`,description:`LikeC4 Project Configuration`}),U=t.instanceof(Function),W=t.record(t.string(),U),G=H.extend({generators:W.optional()});function validateProjectConfig(e){let n=e.landingPage,r=null;if(n!=null){let e=V.safeParse(n);if(!e.success)throw Error(`Config validation failed:
15
+ `+t.prettifyError(e.error));r=e.data}let i=H.safeParse(e);if(!i.success)throw Error(`Config validation failed:
16
+ `+t.prettifyError(i.error));let a=i.data;r!==null&&(a={...a,landingPage:r});let o=e.generators;if(typeof o==`object`&&o&&!Array.isArray(o)){let e=W.safeParse(o);if(!e.success)throw Error(`Config validation failed (generators):
17
+ `+t.prettifyError(e.error));return{...a,generators:e.data}}return a}function parseProjectConfigJSON(t){return validateProjectConfig(e.parse(t.trim()||`{}`))}const K={parse:parseProjectConfigJSON,validate:validateProjectConfig,normalizeInclude:e=>{let t=g.safeParse(e);return t.success?t.data:{paths:[],maxDepth:3,fileThreshold:30}}};function trimTrailingSlashes(e){let t=e.length;for(;t>0&&(e[t-1]===`/`||e[t-1]===`\\`);)t--;return e.slice(0,t)}function splitPath(e){return e.split(`/`).flatMap(e=>e.split(`\\`))}function basename(e){let t=trimTrailingSlashes(e),n=splitPath(t);return n[n.length-1]||t}const q=[`.likec4rc`,`.likec4.config.json`,`likec4.config.json`],J=[`likec4.config.js`,`likec4.config.cjs`,`likec4.config.mjs`,`likec4.config.ts`,`likec4.config.cts`,`likec4.config.mts`],Y=[...q,...J];function isLikeC4JsonConfig(e){return q.includes(basename(e))}function isLikeC4NonJsonConfig(e){return J.includes(basename(e))}function isLikeC4Config(e){return isLikeC4JsonConfig(e)||isLikeC4NonJsonConfig(e)}function defineConfig(e){return G.parse(e)}function defineGenerators(e){return W.parse(e)}function defineThemeColor(e){return A.parse(e)}function defineTheme(e){return P.parse(e)}function defineStyle(e){return z.parse(e)}export{defineThemeColor as a,isLikeC4JsonConfig as c,H as d,validateProjectConfig as f,defineTheme as i,isLikeC4NonJsonConfig as l,defineGenerators as n,Y as o,z as p,defineStyle as r,isLikeC4Config as s,defineConfig as t,K as u};