likec4 1.48.0 → 1.49.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/README.md +11 -1
- package/__app__/src/likec4.js +5595 -4127
- package/__app__/src/routes/index.js +3 -153
- package/__app__/src/routes/projects.js +21 -1087
- package/__app__/src/routes/single.js +1221 -16
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +3507 -894
- package/__app__/src/webcomponent.js +1 -1
- package/config/schema.json +155 -143
- package/dist/THIRD-PARTY-LICENSES.md +1739 -0
- package/dist/_chunks/GraphvizBinaryAdapter.mjs +72 -0
- package/dist/_chunks/filenames.mjs +14 -0
- package/dist/_chunks/index.d.mts +224 -129
- package/dist/_chunks/index2.d.mts +2033 -1908
- package/dist/_chunks/libs/@chevrotain/gast.mjs +1 -3969
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -785
- package/dist/_chunks/libs/@chevrotain/utils.mjs +1 -37
- package/dist/_chunks/libs/@hono/mcp.mjs +34 -0
- package/dist/_chunks/libs/@hono/node-server.mjs +1 -436
- package/dist/_chunks/libs/@logtape/logtape.d.mts +741 -0
- package/dist/_chunks/libs/@logtape/logtape.mjs +6 -1354
- package/dist/_chunks/libs/@lume/kiwi.mjs +1 -1355
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +14 -14
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +12 -25105
- package/dist/_chunks/libs/@msgpack/msgpack.mjs +1 -1503
- package/dist/_chunks/libs/@nanostores/react.mjs +1 -30
- package/dist/_chunks/libs/@smithy/util-base64.mjs +1 -100
- package/dist/_chunks/libs/ajv.mjs +1 -777
- package/dist/_chunks/libs/atomically.mjs +1 -362
- package/dist/_chunks/libs/birpc.mjs +1 -201
- package/dist/_chunks/libs/chevrotain-allstar.mjs +2 -850
- package/dist/_chunks/libs/chevrotain.mjs +55 -6229
- package/dist/_chunks/libs/conf.mjs +1 -2258
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/esm-env.mjs +1 -5
- package/dist/_chunks/libs/eventemitter3.mjs +1 -243
- package/dist/_chunks/libs/fast-equals.mjs +1 -446
- package/dist/_chunks/libs/find-up-simple.mjs +1 -24
- package/dist/_chunks/libs/get-port.mjs +1 -107
- package/dist/_chunks/libs/is-docker.mjs +1 -26
- package/dist/_chunks/libs/is-error-instance.mjs +1 -26
- package/dist/_chunks/libs/is-inside-container.mjs +1 -20
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/isexe.mjs +1 -127
- package/dist/_chunks/libs/json5.mjs +14 -959
- package/dist/_chunks/libs/khroma.mjs +1 -605
- package/dist/_chunks/libs/ky.mjs +2 -807
- package/dist/_chunks/libs/langium.d.mts +2880 -2844
- package/dist/_chunks/libs/langium.mjs +32 -20351
- package/dist/_chunks/libs/merge-error-cause.mjs +2 -746
- package/dist/_chunks/libs/nanostores.mjs +1 -198
- package/dist/_chunks/libs/p-limit.mjs +1 -120
- package/dist/_chunks/libs/p-queue.mjs +1 -449
- package/dist/_chunks/libs/package-manager-detector.mjs +1 -559
- package/dist/_chunks/libs/package-up.mjs +1 -10
- package/dist/_chunks/libs/parse-ms.mjs +1 -36
- package/dist/_chunks/libs/pathe.mjs +1 -0
- package/dist/_chunks/libs/picomatch.mjs +1 -1673
- package/dist/_chunks/libs/pretty-ms.mjs +1 -80
- package/dist/_chunks/libs/remeda.mjs +1 -690
- package/dist/_chunks/libs/safe-stringify.mjs +1 -21
- package/dist/_chunks/libs/strip-indent.mjs +1 -15
- package/dist/_chunks/libs/tinyrainbow.mjs +1 -88
- package/dist/_chunks/libs/ts-graphviz.mjs +4 -725
- package/dist/_chunks/libs/ufo.mjs +1 -240
- package/dist/_chunks/libs/which.mjs +1 -84
- package/dist/_chunks/libs/word-wrap.mjs +12 -43
- package/dist/_chunks/node.mjs +481 -0
- package/dist/_chunks/plugin.mjs +98 -772
- package/dist/_chunks/rolldown-runtime.mjs +1 -48
- package/dist/_chunks/sequence-view.mjs +1 -575
- package/dist/cli/index.mjs +127 -1846
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +1 -6
- package/dist/index.d.mts +148 -7
- package/dist/index.mjs +1 -21
- package/dist/model/builder.mjs +1 -3
- package/dist/model/index.d.mts +57 -3
- package/dist/model/index.mjs +1 -5
- package/dist/vite-plugin/index.d.mts +4 -3
- package/dist/vite-plugin/index.mjs +1 -22
- package/dist/vite-plugin/internal.d.mts +5 -5
- package/dist/vite-plugin/internal.mjs +1 -68
- package/package.json +60 -41
- package/react/{index.d.ts → index.d.mts} +112 -70
- package/react/{index.js → index.mjs} +21361 -22064
- package/react/package.json +2 -5
- package/vite-plugin-modules.d.ts +5 -5
- package/dist/_chunks/LikeC4.d.mts +0 -121
- package/dist/_chunks/LikeC4.mjs +0 -202
- package/dist/_chunks/config-app.prod.d.mts +0 -18
- package/dist/_chunks/config-app.prod.mjs +0 -188
- package/dist/_chunks/config-webcomponent.prod.mjs +0 -71
- package/dist/_chunks/define-config.mjs +0 -409
- package/dist/_chunks/index3.d.mts +0 -60
- package/dist/_chunks/index4.d.mts +0 -1
- package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +0 -10
- package/dist/_chunks/libs/hono.mjs +0 -1829
- package/dist/_chunks/libs/nanoid.mjs +0 -29
- package/dist/_chunks/model.mjs +0 -12
- package/dist/_chunks/module.d.mts +0 -71
- package/dist/_chunks/module.mjs +0 -18657
- package/dist/_chunks/vite-build.mjs +0 -69
- package/dist/_chunks/vite-dev.mjs +0 -79
- package/dist/_chunks/vite-preview.mjs +0 -27
- package/dist/language/module.d.mts +0 -5
- package/dist/language/module.mjs +0 -20
- package/dist/vite/vite-build.d.mts +0 -26
- package/dist/vite/vite-build.mjs +0 -27
- package/dist/vite/vite-dev.d.mts +0 -34
- package/dist/vite/vite-dev.mjs +0 -29
- package/dist/vite/vite-preview.d.mts +0 -20
- package/dist/vite/vite-preview.mjs +0 -26
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import { s as __toESM } from "./rolldown-runtime.mjs";
|
|
2
|
-
import { F as t } from "./libs/remeda.mjs";
|
|
3
|
-
import { t as require_lib } from "./libs/json5.mjs";
|
|
4
|
-
import { A as v4_default } from "./libs/@modelcontextprotocol/sdk.mjs";
|
|
5
|
-
import { BorderStyles, ElementShapes, IconPositions, RelationshipArrowTypes, Sizes, ThemeColors, computeColorValues } from "@likec4/core/styles";
|
|
6
|
-
import { exact } from "@likec4/core/types";
|
|
7
|
-
|
|
8
|
-
//#region ../config/src/schema.image-alias.ts
|
|
9
|
-
const IMAGE_ALIAS_KEY_REGEX = /^@[A-Za-z0-9_-]*$/;
|
|
10
|
-
const IMAGE_ALIAS_VALUE_REGEX = /^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/;
|
|
11
|
-
const ImageAliasValue = v4_default.string().min(1, "Image alias value cannot be empty").regex(IMAGE_ALIAS_VALUE_REGEX, "Image alias value must be a relative path (no leading slash or protocol)");
|
|
12
|
-
const ImageAliasesSchema = v4_default.record(v4_default.string(), ImageAliasValue).meta({ description: "Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash)." });
|
|
13
|
-
function validateImageAliases(imageAliases) {
|
|
14
|
-
const invalidKeys = [];
|
|
15
|
-
const invalidValues = [];
|
|
16
|
-
if (imageAliases) for (const [key, value] of Object.entries(imageAliases)) {
|
|
17
|
-
if (!IMAGE_ALIAS_KEY_REGEX.test(key)) invalidKeys.push(key);
|
|
18
|
-
if (!IMAGE_ALIAS_VALUE_REGEX.test(value)) invalidValues.push(`${key} -> ${value}`);
|
|
19
|
-
}
|
|
20
|
-
if (invalidKeys.length || invalidValues.length) {
|
|
21
|
-
const parts = [];
|
|
22
|
-
if (invalidKeys.length) parts.push(`Invalid image alias key(s): ${invalidKeys.map((k) => JSON.stringify(k)).join(", ")} (must match ${IMAGE_ALIAS_KEY_REGEX})`);
|
|
23
|
-
if (invalidValues.length) parts.push(`Invalid image alias value(s): ${invalidValues.map((kv) => JSON.stringify(kv)).join(", ")} (must match ${IMAGE_ALIAS_VALUE_REGEX})`);
|
|
24
|
-
throw new Error(parts.join(" | "));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region ../config/src/schema.include.ts
|
|
30
|
-
const RELATIVE_PATH_REGEX = /^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/;
|
|
31
|
-
const IncludePathValue = v4_default.string().min(1, "Include path cannot be empty").regex(RELATIVE_PATH_REGEX, "Include path must be a relative path (no leading slash, drive letter, or protocol)");
|
|
32
|
-
const IncludeConfigSchema = v4_default.strictObject({
|
|
33
|
-
paths: v4_default.array(IncludePathValue).min(1, "Include paths cannot be empty").meta({ description: [
|
|
34
|
-
"Additional relative directory paths to include LikeC4 source files from, searched recursively.",
|
|
35
|
-
"Paths are relative to the project folder (the folder containing this config file).",
|
|
36
|
-
"Example: [\"../shared\", \"../common/specs\"]"
|
|
37
|
-
].join("\n") }),
|
|
38
|
-
maxDepth: v4_default.number().int().min(1).max(20).default(3).meta({ description: [
|
|
39
|
-
"Maximum directory depth to scan when searching for .c4 files in include paths.",
|
|
40
|
-
"Prevents excessive scanning of deeply nested directories.",
|
|
41
|
-
"Default: 3"
|
|
42
|
-
].join("\n") }),
|
|
43
|
-
fileThreshold: v4_default.number().int().min(1).default(30).meta({ description: [
|
|
44
|
-
"Maximum number of files to load from include paths before warning.",
|
|
45
|
-
"Helps identify performance issues from accidentally including large directories.",
|
|
46
|
-
"Default: 30"
|
|
47
|
-
].join("\n") })
|
|
48
|
-
}).meta({
|
|
49
|
-
id: "include-config",
|
|
50
|
-
description: "Configuration for including additional LikeC4 source files"
|
|
51
|
-
});
|
|
52
|
-
const IncludeSchema = IncludeConfigSchema.optional().meta({ description: ["Configuration for including additional LikeC4 source files from other directories.", "Example: { \"paths\": [\"../shared\", \"../common/specs\"], \"maxDepth\": 5, \"fileThreshold\": 50 }"].join("\n") });
|
|
53
|
-
function normalizeIncludeConfig(include) {
|
|
54
|
-
if (!include) return {
|
|
55
|
-
paths: [],
|
|
56
|
-
maxDepth: 3,
|
|
57
|
-
fileThreshold: 30
|
|
58
|
-
};
|
|
59
|
-
return include;
|
|
60
|
-
}
|
|
61
|
-
function validateIncludePaths(include) {
|
|
62
|
-
if (!include?.paths) return;
|
|
63
|
-
const invalidPaths = [];
|
|
64
|
-
for (const path of include.paths) if (!RELATIVE_PATH_REGEX.test(path)) invalidPaths.push(path);
|
|
65
|
-
if (invalidPaths.length > 0) throw new Error(`Invalid include path(s): ${invalidPaths.map((p) => JSON.stringify(p)).join(", ")} (must be relative paths without leading slash, drive letter, or protocol)`);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region ../config/src/schema.theme.ts
|
|
70
|
-
const opacity = v4_default.int().min(0, "Opacity must be between 0 and 100").max(100, "Opacity must be between 0 and 100").meta({
|
|
71
|
-
id: "Opacity",
|
|
72
|
-
description: "Opacity 0-100%"
|
|
73
|
-
});
|
|
74
|
-
const shape = v4_default.literal(ElementShapes).meta({ id: "ElementShape" });
|
|
75
|
-
const border = v4_default.literal(BorderStyles).meta({ id: "BorderStyle" });
|
|
76
|
-
const size = v4_default.literal(Sizes).meta({ id: "ElementSize" });
|
|
77
|
-
const iconPosition = v4_default.literal(IconPositions).meta({ id: "IconPosition" });
|
|
78
|
-
const arrow = v4_default.literal(RelationshipArrowTypes).meta({ id: "ArrowType" });
|
|
79
|
-
const line = v4_default.literal([
|
|
80
|
-
"dashed",
|
|
81
|
-
"solid",
|
|
82
|
-
"dotted"
|
|
83
|
-
]).meta({ id: "LineType" });
|
|
84
|
-
const themeColor = v4_default.literal(ThemeColors).meta({ id: "ThemeColor" });
|
|
85
|
-
const customColor = v4_default.string().min(1, "Custom color name cannot be empty").transform((value) => value).meta({ id: "CustomColorName" });
|
|
86
|
-
const color = v4_default.union([themeColor, customColor]).transform((value) => value).meta({ id: "ColorName" });
|
|
87
|
-
const colorSchema = v4_default.string().min(1, "Color value cannot be empty").transform((value) => value).meta({
|
|
88
|
-
id: "ColorLiteral",
|
|
89
|
-
description: "Color value in any valid CSS format: hex, rgb, rgba, hsl, hsla ..."
|
|
90
|
-
});
|
|
91
|
-
const ElementColorValuesSchema = v4_default.strictObject({
|
|
92
|
-
fill: colorSchema.meta({ description: "Background color" }),
|
|
93
|
-
stroke: colorSchema.meta({ description: "Stroke color (border, paths above background)" }),
|
|
94
|
-
hiContrast: colorSchema.meta({ description: "High contrast text color (title)" }),
|
|
95
|
-
loContrast: colorSchema.meta({ description: "Low contrast text color (description)" })
|
|
96
|
-
}).meta({ id: "ElementColorValues" }).transform((value) => value);
|
|
97
|
-
const RelationshipColorValuesSchema = v4_default.strictObject({
|
|
98
|
-
line: colorSchema.meta({ description: "Line color" }),
|
|
99
|
-
label: colorSchema.meta({ description: "Label text color" }),
|
|
100
|
-
labelBg: colorSchema.optional().default("rgba(0, 0, 0, 0.5)").meta({ description: "Label background color" })
|
|
101
|
-
}).meta({ id: "RelationshipColorValues" }).transform((value) => value);
|
|
102
|
-
const StrictThemeColorValuesSchema = v4_default.strictObject({
|
|
103
|
-
elements: v4_default.union([colorSchema, ElementColorValuesSchema]).meta({ description: "Element color value (or a breakdown of specific color values)" }).transform((value) => {
|
|
104
|
-
if (typeof value === "string") return computeColorValues(value).elements;
|
|
105
|
-
return value;
|
|
106
|
-
}),
|
|
107
|
-
relationships: v4_default.union([colorSchema, RelationshipColorValuesSchema]).meta({ description: "Relationship color value (or a breakdown of specific color values)" }).transform((value) => {
|
|
108
|
-
if (typeof value === "string") return computeColorValues(value).relationships;
|
|
109
|
-
return value;
|
|
110
|
-
})
|
|
111
|
-
}).meta({ id: "StrictThemeColorValues" });
|
|
112
|
-
const ThemeColorValuesSchema = v4_default.union([colorSchema, StrictThemeColorValuesSchema]).meta({
|
|
113
|
-
id: "ThemeColorValues",
|
|
114
|
-
description: "Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values"
|
|
115
|
-
}).transform((value) => {
|
|
116
|
-
if (typeof value === "string") return computeColorValues(value);
|
|
117
|
-
return value;
|
|
118
|
-
});
|
|
119
|
-
const ThemeColorsSchema = v4_default.record(color, ThemeColorValuesSchema).meta({
|
|
120
|
-
id: "ThemeColors",
|
|
121
|
-
description: "Override theme colors"
|
|
122
|
-
}).transform((value) => value);
|
|
123
|
-
const DimensionsSchema = v4_default.strictObject({
|
|
124
|
-
width: v4_default.number().min(50),
|
|
125
|
-
height: v4_default.number().min(50)
|
|
126
|
-
}).meta({
|
|
127
|
-
id: "Dimensions",
|
|
128
|
-
description: "Dimensions"
|
|
129
|
-
});
|
|
130
|
-
const LikeC4Config_Styles_Theme_Sizes = v4_default.strictObject(t(Sizes, () => DimensionsSchema.optional())).meta({
|
|
131
|
-
id: "ThemeSizes",
|
|
132
|
-
description: "Override theme sizes"
|
|
133
|
-
});
|
|
134
|
-
const LikeC4Config_Styles_Theme = v4_default.strictObject({
|
|
135
|
-
colors: ThemeColorsSchema.optional(),
|
|
136
|
-
sizes: LikeC4Config_Styles_Theme_Sizes.optional()
|
|
137
|
-
}).meta({
|
|
138
|
-
id: "ThemeCustomization",
|
|
139
|
-
description: "Theme customization"
|
|
140
|
-
}).transform(({ colors, sizes }) => {
|
|
141
|
-
return exact({
|
|
142
|
-
colors: colors ? exact(colors) : void 0,
|
|
143
|
-
sizes: sizes ? exact(sizes) : void 0
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
const LikeC4Config_Styles_Defaults_Group = v4_default.strictObject({
|
|
147
|
-
color: color.optional().meta({ description: "Default color for groups\n(must be a valid color name from the theme)" }),
|
|
148
|
-
opacity: opacity.optional().meta({ description: "Default opacity for groups" }),
|
|
149
|
-
border: border.optional().meta({ description: "Default border for groups" })
|
|
150
|
-
}).meta({
|
|
151
|
-
id: "GroupDefaultStyleValues",
|
|
152
|
-
description: "Override default values for group style properties\nThese values will be used if such property is not defined"
|
|
153
|
-
});
|
|
154
|
-
const LikeC4Config_Styles_Defaults_Relationship = v4_default.strictObject({
|
|
155
|
-
color: color.optional().meta({ description: "Default color for relationships\n(must be a valid color name from the theme)" }),
|
|
156
|
-
line: line.optional().meta({ description: "Default line style for relationships" }),
|
|
157
|
-
arrow: arrow.optional().meta({ description: "Default arrow style for relationships" })
|
|
158
|
-
}).meta({
|
|
159
|
-
id: "RelationshipDefaultStyleValues",
|
|
160
|
-
description: "Override default values for relationship style properties\nThese values will be used if such property is not defined"
|
|
161
|
-
});
|
|
162
|
-
const LikeC4Config_Styles_Defaults = v4_default.strictObject({
|
|
163
|
-
color: color.optional().meta({ description: "Default color for elements\n(must be a valid color name from the theme)" }),
|
|
164
|
-
opacity: opacity.optional().meta({ description: "Default opacity (0-100%) for elements when displayed as a group (like a container)" }),
|
|
165
|
-
border: border.optional().meta({ description: "Default border style for elements when displayed as a group (like a container)" }),
|
|
166
|
-
size: size.optional().meta({ description: "Default size for elements" }),
|
|
167
|
-
shape: shape.optional().meta({ description: "Default shape for elements" }),
|
|
168
|
-
iconPosition: iconPosition.optional().meta({ description: "Default icon position for elements" }),
|
|
169
|
-
group: LikeC4Config_Styles_Defaults_Group.optional().meta({ description: "Default style values for groups" }),
|
|
170
|
-
relationship: LikeC4Config_Styles_Defaults_Relationship.optional().meta({ description: "Default style values for relationships" })
|
|
171
|
-
}).meta({
|
|
172
|
-
id: "DefaultStyleValues",
|
|
173
|
-
description: "Override default values for style properties\nThese values will be used if such property is not defined"
|
|
174
|
-
});
|
|
175
|
-
const LikeC4Config_Styles_CustomStylesheets = v4_default.union([v4_default.string().min(1, "Custom CSS file path cannot be empty"), v4_default.array(v4_default.string().min(1, "Custom CSS file path cannot be empty"))]).meta({
|
|
176
|
-
id: "CustomStylesheets",
|
|
177
|
-
description: "Custom CSS (or list of CSS files) to be included in the generated diagrams"
|
|
178
|
-
});
|
|
179
|
-
const LikeC4StylesConfigSchema = v4_default.strictObject({
|
|
180
|
-
theme: LikeC4Config_Styles_Theme.optional(),
|
|
181
|
-
defaults: LikeC4Config_Styles_Defaults.optional(),
|
|
182
|
-
customCss: LikeC4Config_Styles_CustomStylesheets.optional()
|
|
183
|
-
}).meta({
|
|
184
|
-
id: "StylesConfiguration",
|
|
185
|
-
description: "Project styles customization"
|
|
186
|
-
}).transform(({ theme, defaults, customCss }) => exact({
|
|
187
|
-
defaults: normalizeDefaults(defaults),
|
|
188
|
-
customCss: normalizeStylesheets(customCss),
|
|
189
|
-
theme
|
|
190
|
-
}));
|
|
191
|
-
function normalizeDefaults(defaults) {
|
|
192
|
-
if (!defaults) return;
|
|
193
|
-
const { relationship, group, ...rest } = defaults;
|
|
194
|
-
return exact({
|
|
195
|
-
...rest,
|
|
196
|
-
relationship: relationship && exact(relationship),
|
|
197
|
-
group: group && exact(group)
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
function normalizeStylesheets(stylesheets) {
|
|
201
|
-
if (!stylesheets) return;
|
|
202
|
-
const paths = (Array.isArray(stylesheets) ? stylesheets : [stylesheets]).filter(Boolean);
|
|
203
|
-
if (paths.length === 0) return;
|
|
204
|
-
return {
|
|
205
|
-
paths,
|
|
206
|
-
content: ""
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region ../config/src/schema.ts
|
|
212
|
-
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
213
|
-
const ManualLayoutsConfigSchema = v4_default.strictObject({ outDir: v4_default.string().default(".likec4").meta({ description: [
|
|
214
|
-
"Path to the directory where manual layouts will be stored,",
|
|
215
|
-
"relative to the folder containing the project config. ",
|
|
216
|
-
"",
|
|
217
|
-
"Defaults to '.likec4'."
|
|
218
|
-
].join("\n") }) }).meta({
|
|
219
|
-
id: "manual-layouts-config",
|
|
220
|
-
description: "Configuration for manual layouts"
|
|
221
|
-
});
|
|
222
|
-
const LikeC4ProjectJsonConfigSchema = v4_default.object({
|
|
223
|
-
name: v4_default.string().nonempty("Project name cannot be empty").refine((value) => value !== "default", {
|
|
224
|
-
abort: true,
|
|
225
|
-
error: "Project name cannot be \"default\""
|
|
226
|
-
}).refine((value) => !value.includes(".") && !value.includes("@") && !value.includes("#"), {
|
|
227
|
-
abort: true,
|
|
228
|
-
error: "Project name cannot contain \".\", \"@\" or \"#\", try to use A-z, 0-9, _ and -"
|
|
229
|
-
}).meta({ description: "Project name, must be unique in the workspace" }),
|
|
230
|
-
title: v4_default.string().nonempty("Project title cannot be empty if specified").optional().meta({ description: "A human readable title for the project" }),
|
|
231
|
-
contactPerson: v4_default.string().nonempty("Contact person cannot be empty if specified").optional().meta({ description: "A person who has been involved in creating or maintaining this project" }),
|
|
232
|
-
imageAliases: ImageAliasesSchema.optional(),
|
|
233
|
-
include: IncludeSchema,
|
|
234
|
-
styles: LikeC4StylesConfigSchema.optional(),
|
|
235
|
-
exclude: v4_default.array(v4_default.string()).optional().meta({ description: "List of file patterns to exclude from the project, default is [\"**/node_modules/**\"]" }),
|
|
236
|
-
manualLayouts: ManualLayoutsConfigSchema.optional()
|
|
237
|
-
}).meta({ description: "LikeC4 project configuration" });
|
|
238
|
-
const FunctionType = v4_default.instanceof(Function);
|
|
239
|
-
const GeneratorsSchema = v4_default.record(v4_default.string(), FunctionType);
|
|
240
|
-
const LikeC4ProjectConfigSchema = LikeC4ProjectJsonConfigSchema.extend({ generators: GeneratorsSchema.optional() });
|
|
241
|
-
/**
|
|
242
|
-
* Validates JSON string or JSON object into a LikeC4ProjectConfig object.
|
|
243
|
-
*/
|
|
244
|
-
function validateProjectConfig(config) {
|
|
245
|
-
const parsed = LikeC4ProjectConfigSchema.safeParse(typeof config === "string" ? import_lib.default.parse(config) : config);
|
|
246
|
-
if (!parsed.success) throw new Error("Config validation failed:\n" + v4_default.prettifyError(parsed.error));
|
|
247
|
-
if (parsed.data.imageAliases) validateImageAliases(parsed.data.imageAliases);
|
|
248
|
-
if (parsed.data.include) validateIncludePaths(parsed.data.include);
|
|
249
|
-
return parsed.data;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
//#endregion
|
|
253
|
-
//#region ../config/src/filenames.ts
|
|
254
|
-
const configJsonFilenames = [
|
|
255
|
-
".likec4rc",
|
|
256
|
-
".likec4.config.json",
|
|
257
|
-
"likec4.config.json"
|
|
258
|
-
];
|
|
259
|
-
const configNonJsonFilenames = [
|
|
260
|
-
"likec4.config.js",
|
|
261
|
-
"likec4.config.cjs",
|
|
262
|
-
"likec4.config.mjs",
|
|
263
|
-
"likec4.config.ts",
|
|
264
|
-
"likec4.config.cts",
|
|
265
|
-
"likec4.config.mts"
|
|
266
|
-
];
|
|
267
|
-
const ConfigFilenames = [...configJsonFilenames, ...configNonJsonFilenames];
|
|
268
|
-
/**
|
|
269
|
-
* Checks if the given filename is a LikeC4 JSON config file (JSON, RC).
|
|
270
|
-
*/
|
|
271
|
-
function isLikeC4JsonConfig(filename) {
|
|
272
|
-
for (const ext of configJsonFilenames) if (filename.endsWith(ext)) return true;
|
|
273
|
-
return false;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Checks if the given filename is a LikeC4 non-JSON config file (JS, MJS, TS, MTS)
|
|
277
|
-
*/
|
|
278
|
-
function isLikeC4NonJsonConfig(filename) {
|
|
279
|
-
for (const ext of configNonJsonFilenames) if (filename.endsWith(ext)) return true;
|
|
280
|
-
return false;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Checks if the given filename is a LikeC4 config file (JSON or non-JSON)
|
|
284
|
-
*/
|
|
285
|
-
function isLikeC4Config(filename) {
|
|
286
|
-
return isLikeC4JsonConfig(filename) || isLikeC4NonJsonConfig(filename);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
//#endregion
|
|
290
|
-
//#region ../config/src/define-config.ts
|
|
291
|
-
/**
|
|
292
|
-
* Defines LikeC4 Project, allows custom generators that can be executed using CLI:
|
|
293
|
-
*
|
|
294
|
-
* `$ likec4 gen <generator-name>`
|
|
295
|
-
*
|
|
296
|
-
* or VSCode command `LikeC4: Run code generator`
|
|
297
|
-
*
|
|
298
|
-
* @example
|
|
299
|
-
* ```ts
|
|
300
|
-
* export default defineConfig({
|
|
301
|
-
* name: 'my-project',
|
|
302
|
-
* title: 'My Project',
|
|
303
|
-
*
|
|
304
|
-
* exclude: ['picomatch pattern'],
|
|
305
|
-
* generators: {
|
|
306
|
-
* '<generator-name>': async ({ likec4model, ctx }) => {
|
|
307
|
-
* await ctx.write('my-generator.txt', likec4model.project.id)
|
|
308
|
-
* }
|
|
309
|
-
* }
|
|
310
|
-
* })
|
|
311
|
-
* ```
|
|
312
|
-
*/
|
|
313
|
-
function defineConfig(config) {
|
|
314
|
-
return LikeC4ProjectConfigSchema.parse(config);
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Define reusable custom generators
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* ```ts
|
|
321
|
-
* // generators.ts
|
|
322
|
-
* export default defineGenerators({
|
|
323
|
-
* 'my-generator': async ({ likec4model, ctx }) => {
|
|
324
|
-
* await ctx.write('my-generator.txt', likec4model.project.id)
|
|
325
|
-
* }
|
|
326
|
-
* })
|
|
327
|
-
*
|
|
328
|
-
* // likec4.config.ts
|
|
329
|
-
* import generators from './generators'
|
|
330
|
-
*
|
|
331
|
-
* export default defineConfig({
|
|
332
|
-
* name: 'my-project',
|
|
333
|
-
* generators,
|
|
334
|
-
* })
|
|
335
|
-
* ```
|
|
336
|
-
*/
|
|
337
|
-
function defineGenerators(generators) {
|
|
338
|
-
return GeneratorsSchema.parse(generators);
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Define reusable custom theme color
|
|
342
|
-
* @example
|
|
343
|
-
* ```ts
|
|
344
|
-
* export default defineThemeColor({
|
|
345
|
-
* element: {
|
|
346
|
-
* fill: 'red'
|
|
347
|
-
* }
|
|
348
|
-
* })
|
|
349
|
-
* ```
|
|
350
|
-
*/
|
|
351
|
-
function defineThemeColor(colors) {
|
|
352
|
-
return ThemeColorValuesSchema.parse(colors);
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Define reusable custom theme
|
|
356
|
-
* @example
|
|
357
|
-
* ```ts
|
|
358
|
-
* import { defineThemeColor, defineTheme } from 'likec4/config'
|
|
359
|
-
*
|
|
360
|
-
* export default defineTheme({
|
|
361
|
-
* colors: {
|
|
362
|
-
* primary: '#FF0000',
|
|
363
|
-
* // Or use defineThemeColor
|
|
364
|
-
* red: defineThemeColor({
|
|
365
|
-
* elements: {
|
|
366
|
-
* fill: 'red'
|
|
367
|
-
* }
|
|
368
|
-
* })
|
|
369
|
-
* }
|
|
370
|
-
* })
|
|
371
|
-
* ```
|
|
372
|
-
*/
|
|
373
|
-
function defineTheme(theme) {
|
|
374
|
-
return LikeC4Config_Styles_Theme.parse(theme);
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Define reusable custom style
|
|
378
|
-
* @example
|
|
379
|
-
* ```ts
|
|
380
|
-
* import { defineStyle, defineThemeColor } from 'likec4/config'
|
|
381
|
-
*
|
|
382
|
-
* export default defineStyle({
|
|
383
|
-
* theme: {
|
|
384
|
-
* colors: {
|
|
385
|
-
* red: defineThemeColor({
|
|
386
|
-
* elements: {
|
|
387
|
-
* fill: 'red'
|
|
388
|
-
* }
|
|
389
|
-
* })
|
|
390
|
-
* }
|
|
391
|
-
* },
|
|
392
|
-
* defaults: {
|
|
393
|
-
* color: 'red',
|
|
394
|
-
* opacity: 50,
|
|
395
|
-
* border: 'solid',
|
|
396
|
-
* size: 'sm',
|
|
397
|
-
* relationship: {
|
|
398
|
-
* color: 'grey',
|
|
399
|
-
* line: 'solid',
|
|
400
|
-
* }
|
|
401
|
-
* }
|
|
402
|
-
* })
|
|
403
|
-
*/
|
|
404
|
-
function defineStyle(styles) {
|
|
405
|
-
return LikeC4StylesConfigSchema.parse(styles);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
//#endregion
|
|
409
|
-
export { defineThemeColor as a, isLikeC4NonJsonConfig as c, defineTheme as i, validateProjectConfig as l, defineGenerators as n, isLikeC4Config as o, defineStyle as r, isLikeC4JsonConfig as s, defineConfig as t, normalizeIncludeConfig as u };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { i as __reExport, r as __exportAll } from "./rolldown-runtime.mjs";
|
|
2
|
-
import * as types from "@likec4/core/types";
|
|
3
|
-
import { BBox, LayoutedDynamicView, NodeId, ViewId } from "@likec4/core/types";
|
|
4
|
-
import { Connection, ConnectionModel, DeployedInstanceModel, DeploymentConnectionModel, DeploymentElementModel as DeploymentElementModel$1, DeploymentNodeModel, DeploymentRelationEndpoint, DeploymentRelationModel as DeploymentRelationModel$1, EdgeModel, ElementModel as ElementModel$1, LikeC4DeploymentModel, LikeC4Model, LikeC4Model as LikeC4Model$1, LikeC4ViewModel as LikeC4ViewModel$1, NodeModel, RelationshipModel as RelationshipModel$1, deploymentConnection, differenceConnections, findAscendingConnections, findDeepestNestedConnection, findDescendantConnections, hasSameSource, hasSameSourceTarget, hasSameTarget, isAnyInOut, isDeployedInstanceModel, isDeploymentElementModel as isDeploymentElementModel$1, isDeploymentNodeModel, isDeploymentRelationModel as isDeploymentRelationModel$1, isEdgeModel, isElementModel as isElementModel$1, isIncoming, isLikeC4ViewModel as isLikeC4ViewModel$1, isNestedConnection, isNestedElementOfDeployedInstanceModel, isNodeModel, isOutgoing, isRelationModel as isRelationModel$1, mergeConnections, modelConnection as modelConnection$1, sortConnectionsByBoundaryHierarchy, sortDeepestFirst } from "@likec4/core/model";
|
|
5
|
-
import { ComputedProjectEdge, ComputedProjectNode, ComputedProjectsView as ComputedProjectsView$1, LayoutedProjectEdge, LayoutedProjectNode, LayoutedProjectsView as LayoutedProjectsView$1 } from "@likec4/core/compute-view";
|
|
6
|
-
|
|
7
|
-
//#region ../layouts/dist/sequence/index.d.mts
|
|
8
|
-
//#region src/sequence/_types.d.ts
|
|
9
|
-
interface SequenceActorStepPort {
|
|
10
|
-
id: string;
|
|
11
|
-
cx: number;
|
|
12
|
-
cy: number;
|
|
13
|
-
height: number;
|
|
14
|
-
type: 'target' | 'source';
|
|
15
|
-
position: 'left' | 'right' | 'top' | 'bottom';
|
|
16
|
-
}
|
|
17
|
-
interface SequenceActor {
|
|
18
|
-
id: NodeId;
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
ports: Array<SequenceActorStepPort>;
|
|
24
|
-
}
|
|
25
|
-
interface SequenceCompound {
|
|
26
|
-
id: NodeId;
|
|
27
|
-
origin: NodeId;
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
depth: number;
|
|
33
|
-
}
|
|
34
|
-
interface SequenceParallelArea {
|
|
35
|
-
parallelPrefix: string;
|
|
36
|
-
x: number;
|
|
37
|
-
y: number;
|
|
38
|
-
width: number;
|
|
39
|
-
height: number;
|
|
40
|
-
}
|
|
41
|
-
interface SequenceViewLayout {
|
|
42
|
-
id: ViewId;
|
|
43
|
-
actors: Array<SequenceActor>;
|
|
44
|
-
compounds: Array<SequenceCompound>;
|
|
45
|
-
parallelAreas: Array<SequenceParallelArea>;
|
|
46
|
-
bounds: BBox;
|
|
47
|
-
} //#endregion
|
|
48
|
-
//#region src/sequence/sequence-view.d.ts
|
|
49
|
-
declare function calcSequenceLayout(view: LayoutedDynamicView): LayoutedDynamicView.Sequence.Layout; //#endregion
|
|
50
|
-
declare namespace index_d_exports {
|
|
51
|
-
export { ComputedProjectEdge, ComputedProjectNode, ComputedProjectsView$1 as ComputedProjectsView, Connection, ConnectionModel, DeployedInstanceModel, DeploymentConnectionModel, DeploymentElementModel$1 as DeploymentElementModel, DeploymentNodeModel, DeploymentRelationEndpoint, DeploymentRelationModel$1 as DeploymentRelationModel, EdgeModel, ElementModel$1 as ElementModel, LayoutedProjectEdge, LayoutedProjectNode, LayoutedProjectsView$1 as LayoutedProjectsView, LikeC4DeploymentModel, LikeC4Model$1 as LikeC4Model, LikeC4ViewModel$1 as LikeC4ViewModel, NodeModel, RelationshipModel$1 as RelationshipModel, SequenceViewLayout, UnknownLayouted, calcSequenceLayout, createLikeC4Model, deploymentConnection, differenceConnections, findAscendingConnections, findDeepestNestedConnection, findDescendantConnections, hasSameSource, hasSameSourceTarget, hasSameTarget, isAnyInOut, isDeployedInstanceModel, isDeploymentElementModel$1 as isDeploymentElementModel, isDeploymentNodeModel, isDeploymentRelationModel$1 as isDeploymentRelationModel, isEdgeModel, isElementModel$1 as isElementModel, isIncoming, isLikeC4ViewModel$1 as isLikeC4ViewModel, isNestedConnection, isNestedElementOfDeployedInstanceModel, isNodeModel, isOutgoing, isRelationModel$1 as isRelationModel, mergeConnections, modelConnection$1 as modelConnection, sortConnectionsByBoundaryHierarchy, sortDeepestFirst };
|
|
52
|
-
}
|
|
53
|
-
import * as import__likec4_core_types from "@likec4/core/types";
|
|
54
|
-
type UnknownLayouted = types.UnknownLayouted;
|
|
55
|
-
/**
|
|
56
|
-
* Used by vite plugin to generate `virtual:likec4/model`
|
|
57
|
-
*/
|
|
58
|
-
declare function createLikeC4Model(model: any): LikeC4Model<UnknownLayouted>;
|
|
59
|
-
//#endregion
|
|
60
|
-
export { hasSameSourceTarget as A, isIncoming as B, createLikeC4Model as C, findDeepestNestedConnection as D, findAscendingConnections as E, isDeploymentElementModel$1 as F, isOutgoing as G, isNestedConnection as H, isDeploymentNodeModel as I, modelConnection$1 as J, isRelationModel$1 as K, isDeploymentRelationModel$1 as L, index_d_exports as M, isAnyInOut as N, findDescendantConnections as O, isDeployedInstanceModel as P, calcSequenceLayout as Q, isEdgeModel as R, UnknownLayouted as S, differenceConnections as T, isNestedElementOfDeployedInstanceModel as U, isLikeC4ViewModel$1 as V, isNodeModel as W, sortDeepestFirst as X, sortConnectionsByBoundaryHierarchy as Y, SequenceViewLayout as Z, LikeC4DeploymentModel as _, ConnectionModel as a, NodeModel as b, DeploymentElementModel$1 as c, DeploymentRelationModel$1 as d, EdgeModel as f, LayoutedProjectsView$1 as g, LayoutedProjectNode as h, Connection as i, hasSameTarget as j, hasSameSource as k, DeploymentNodeModel as l, LayoutedProjectEdge as m, ComputedProjectNode as n, DeployedInstanceModel as o, ElementModel$1 as p, mergeConnections as q, ComputedProjectsView$1 as r, DeploymentConnectionModel as s, ComputedProjectEdge as t, DeploymentRelationEndpoint as u, LikeC4Model$1 as v, deploymentConnection as w, RelationshipModel$1 as x, LikeC4ViewModel$1 as y, isElementModel$1 as z };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { t as __commonJSMin } from "../../rolldown-runtime.mjs";
|
|
2
|
-
|
|
3
|
-
//#region ../../node_modules/.pnpm/@smithy+is-array-buffer@4.2.0/node_modules/@smithy/is-array-buffer/dist-cjs/index.js
|
|
4
|
-
var require_dist_cjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
|
-
const isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
|
|
6
|
-
exports.isArrayBuffer = isArrayBuffer;
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { require_dist_cjs as t };
|