likec4 1.48.0 → 1.50.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 +5941 -4496
- package/__app__/src/routes/index.js +3 -153
- package/__app__/src/routes/projects.js +21 -1087
- package/__app__/src/routes/single.js +1228 -16
- package/__app__/src/style.css +1 -1
- package/__app__/src/vendors.js +4649 -1897
- package/__app__/src/webcomponent.js +1 -1
- package/config/schema.json +169 -141
- package/dist/THIRD-PARTY-LICENSES.md +1769 -0
- package/dist/_chunks/LikeC4.mjs +1154 -202
- package/dist/_chunks/binary.mjs +72 -0
- package/dist/_chunks/index.d.mts +234 -140
- package/dist/_chunks/index2.d.mts +2043 -1828
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +30 -0
- 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 +114 -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.d.mts +61 -1
- package/dist/_chunks/libs/@nanostores/react.mjs +1 -30
- package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +1 -10
- 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 +2913 -2876
- package/dist/_chunks/libs/langium.mjs +33 -20351
- package/dist/_chunks/libs/merge-error-cause.mjs +2 -746
- 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/pako.mjs +1 -0
- 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 +2 -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/rolldown-runtime.mjs +1 -48
- package/dist/_chunks/sequence.mjs +1 -0
- package/dist/_chunks/src.mjs +15 -0
- package/dist/_chunks/src2.mjs +499 -0
- package/dist/cli/index.mjs +77 -1952
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +1 -6
- package/dist/index.d.mts +150 -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 +7 -3
- package/dist/vite-plugin/index.mjs +1 -22
- package/dist/vite-plugin/internal.d.mts +6 -7
- package/dist/vite-plugin/internal.mjs +1 -68
- package/package.json +64 -45
- package/react/{index.d.ts → index.d.mts} +114 -72
- package/react/{index.js → index.mjs} +21320 -22041
- package/react/package.json +2 -5
- package/vite-plugin-modules.d.ts +10 -5
- package/dist/_chunks/LikeC4.d.mts +0 -121
- 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/libs/@chevrotain/gast.mjs +0 -3969
- package/dist/_chunks/libs/hono.mjs +0 -1829
- package/dist/_chunks/libs/nanoid.mjs +0 -29
- package/dist/_chunks/libs/nanostores.d.mts +0 -63
- package/dist/_chunks/libs/nanostores.mjs +0 -198
- 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/plugin.mjs +0 -996
- package/dist/_chunks/sequence-view.mjs +0 -575
- 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
- /package/dist/_chunks/{index4.d.mts → libs/@chevrotain/types.d.mts} +0 -0
|
@@ -1,240 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const r = String.fromCharCode;
|
|
3
|
-
const HASH_RE = /#/g;
|
|
4
|
-
const AMPERSAND_RE = /&/g;
|
|
5
|
-
const SLASH_RE = /\//g;
|
|
6
|
-
const EQUAL_RE = /=/g;
|
|
7
|
-
const PLUS_RE = /\+/g;
|
|
8
|
-
const ENC_CARET_RE = /%5e/gi;
|
|
9
|
-
const ENC_BACKTICK_RE = /%60/gi;
|
|
10
|
-
const ENC_PIPE_RE = /%7c/gi;
|
|
11
|
-
const ENC_SPACE_RE = /%20/gi;
|
|
12
|
-
function encode(text) {
|
|
13
|
-
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
|
|
14
|
-
}
|
|
15
|
-
function encodeQueryValue(input) {
|
|
16
|
-
return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
|
|
17
|
-
}
|
|
18
|
-
function encodeQueryKey(text) {
|
|
19
|
-
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
20
|
-
}
|
|
21
|
-
function decode(text = "") {
|
|
22
|
-
try {
|
|
23
|
-
return decodeURIComponent("" + text);
|
|
24
|
-
} catch {
|
|
25
|
-
return "" + text;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function decodeQueryKey(text) {
|
|
29
|
-
return decode(text.replace(PLUS_RE, " "));
|
|
30
|
-
}
|
|
31
|
-
function decodeQueryValue(text) {
|
|
32
|
-
return decode(text.replace(PLUS_RE, " "));
|
|
33
|
-
}
|
|
34
|
-
function parseQuery(parametersString = "") {
|
|
35
|
-
const object = /* @__PURE__ */ Object.create(null);
|
|
36
|
-
if (parametersString[0] === "?") parametersString = parametersString.slice(1);
|
|
37
|
-
for (const parameter of parametersString.split("&")) {
|
|
38
|
-
const s = parameter.match(/([^=]+)=?(.*)/) || [];
|
|
39
|
-
if (s.length < 2) continue;
|
|
40
|
-
const key = decodeQueryKey(s[1]);
|
|
41
|
-
if (key === "__proto__" || key === "constructor") continue;
|
|
42
|
-
const value = decodeQueryValue(s[2] || "");
|
|
43
|
-
if (object[key] === void 0) object[key] = value;
|
|
44
|
-
else if (Array.isArray(object[key])) object[key].push(value);
|
|
45
|
-
else object[key] = [object[key], value];
|
|
46
|
-
}
|
|
47
|
-
return object;
|
|
48
|
-
}
|
|
49
|
-
function encodeQueryItem(key, value) {
|
|
50
|
-
if (typeof value === "number" || typeof value === "boolean") value = String(value);
|
|
51
|
-
if (!value) return encodeQueryKey(key);
|
|
52
|
-
if (Array.isArray(value)) return value.map((_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`).join("&");
|
|
53
|
-
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
|
|
54
|
-
}
|
|
55
|
-
function stringifyQuery(query) {
|
|
56
|
-
return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
|
|
57
|
-
}
|
|
58
|
-
const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
|
|
59
|
-
const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
|
|
60
|
-
const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
|
|
61
|
-
const TRAILING_SLASH_RE = /\/$|\/\?|\/#/;
|
|
62
|
-
const JOIN_LEADING_SLASH_RE = /^\.?\//;
|
|
63
|
-
function isRelative(inputString) {
|
|
64
|
-
return ["./", "../"].some((string_) => inputString.startsWith(string_));
|
|
65
|
-
}
|
|
66
|
-
function hasProtocol(inputString, opts = {}) {
|
|
67
|
-
if (typeof opts === "boolean") opts = { acceptRelative: opts };
|
|
68
|
-
if (opts.strict) return PROTOCOL_STRICT_REGEX.test(inputString);
|
|
69
|
-
return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
|
|
70
|
-
}
|
|
71
|
-
function hasTrailingSlash(input = "", respectQueryAndFragment) {
|
|
72
|
-
if (!respectQueryAndFragment) return input.endsWith("/");
|
|
73
|
-
return TRAILING_SLASH_RE.test(input);
|
|
74
|
-
}
|
|
75
|
-
function withoutTrailingSlash(input = "", respectQueryAndFragment) {
|
|
76
|
-
if (!respectQueryAndFragment) return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
|
|
77
|
-
if (!hasTrailingSlash(input, true)) return input || "/";
|
|
78
|
-
let path = input;
|
|
79
|
-
let fragment = "";
|
|
80
|
-
const fragmentIndex = input.indexOf("#");
|
|
81
|
-
if (fragmentIndex !== -1) {
|
|
82
|
-
path = input.slice(0, fragmentIndex);
|
|
83
|
-
fragment = input.slice(fragmentIndex);
|
|
84
|
-
}
|
|
85
|
-
const [s0, ...s] = path.split("?");
|
|
86
|
-
return ((s0.endsWith("/") ? s0.slice(0, -1) : s0) || "/") + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
87
|
-
}
|
|
88
|
-
function withTrailingSlash(input = "", respectQueryAndFragment) {
|
|
89
|
-
if (!respectQueryAndFragment) return input.endsWith("/") ? input : input + "/";
|
|
90
|
-
if (hasTrailingSlash(input, true)) return input || "/";
|
|
91
|
-
let path = input;
|
|
92
|
-
let fragment = "";
|
|
93
|
-
const fragmentIndex = input.indexOf("#");
|
|
94
|
-
if (fragmentIndex !== -1) {
|
|
95
|
-
path = input.slice(0, fragmentIndex);
|
|
96
|
-
fragment = input.slice(fragmentIndex);
|
|
97
|
-
if (!path) return fragment;
|
|
98
|
-
}
|
|
99
|
-
const [s0, ...s] = path.split("?");
|
|
100
|
-
return s0 + "/" + (s.length > 0 ? `?${s.join("?")}` : "") + fragment;
|
|
101
|
-
}
|
|
102
|
-
function hasLeadingSlash(input = "") {
|
|
103
|
-
return input.startsWith("/");
|
|
104
|
-
}
|
|
105
|
-
function withoutLeadingSlash(input = "") {
|
|
106
|
-
return (hasLeadingSlash(input) ? input.slice(1) : input) || "/";
|
|
107
|
-
}
|
|
108
|
-
function withLeadingSlash(input = "") {
|
|
109
|
-
return hasLeadingSlash(input) ? input : "/" + input;
|
|
110
|
-
}
|
|
111
|
-
function cleanDoubleSlashes(input = "") {
|
|
112
|
-
return input.split("://").map((string_) => string_.replace(/\/{2,}/g, "/")).join("://");
|
|
113
|
-
}
|
|
114
|
-
function withoutBase(input, base) {
|
|
115
|
-
if (isEmptyURL(base)) return input;
|
|
116
|
-
const _base = withoutTrailingSlash(base);
|
|
117
|
-
if (!input.startsWith(_base)) return input;
|
|
118
|
-
const nextChar = input[_base.length];
|
|
119
|
-
if (nextChar && nextChar !== "/" && nextChar !== "?") return input;
|
|
120
|
-
const trimmed = input.slice(_base.length);
|
|
121
|
-
return trimmed[0] === "/" ? trimmed : "/" + trimmed;
|
|
122
|
-
}
|
|
123
|
-
function withQuery(input, query) {
|
|
124
|
-
const parsed = parseURL(input);
|
|
125
|
-
parsed.search = stringifyQuery({
|
|
126
|
-
...parseQuery(parsed.search),
|
|
127
|
-
...query
|
|
128
|
-
});
|
|
129
|
-
return stringifyParsedURL(parsed);
|
|
130
|
-
}
|
|
131
|
-
function isEmptyURL(url) {
|
|
132
|
-
return !url || url === "/";
|
|
133
|
-
}
|
|
134
|
-
function isNonEmptyURL(url) {
|
|
135
|
-
return url && url !== "/";
|
|
136
|
-
}
|
|
137
|
-
function joinURL(base, ...input) {
|
|
138
|
-
let url = base || "";
|
|
139
|
-
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) if (url) {
|
|
140
|
-
const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
|
|
141
|
-
url = withTrailingSlash(url) + _segment;
|
|
142
|
-
} else url = segment;
|
|
143
|
-
return url;
|
|
144
|
-
}
|
|
145
|
-
function joinRelativeURL(..._input) {
|
|
146
|
-
const JOIN_SEGMENT_SPLIT_RE = /\/(?!\/)/;
|
|
147
|
-
const input = _input.filter(Boolean);
|
|
148
|
-
const segments = [];
|
|
149
|
-
let segmentsDepth = 0;
|
|
150
|
-
for (const i of input) {
|
|
151
|
-
if (!i || i === "/") continue;
|
|
152
|
-
for (const [sindex, s] of i.split(JOIN_SEGMENT_SPLIT_RE).entries()) {
|
|
153
|
-
if (!s || s === ".") continue;
|
|
154
|
-
if (s === "..") {
|
|
155
|
-
if (segments.length === 1 && hasProtocol(segments[0])) continue;
|
|
156
|
-
segments.pop();
|
|
157
|
-
segmentsDepth--;
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
if (sindex === 1 && segments[segments.length - 1]?.endsWith(":/")) {
|
|
161
|
-
segments[segments.length - 1] += "/" + s;
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
segments.push(s);
|
|
165
|
-
segmentsDepth++;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
let url = segments.join("/");
|
|
169
|
-
if (segmentsDepth >= 0) {
|
|
170
|
-
if (input[0]?.startsWith("/") && !url.startsWith("/")) url = "/" + url;
|
|
171
|
-
else if (input[0]?.startsWith("./") && !url.startsWith("./")) url = "./" + url;
|
|
172
|
-
} else url = "../".repeat(-1 * segmentsDepth) + url;
|
|
173
|
-
if (input[input.length - 1]?.endsWith("/") && !url.endsWith("/")) url += "/";
|
|
174
|
-
return url;
|
|
175
|
-
}
|
|
176
|
-
function withoutProtocol(input) {
|
|
177
|
-
return withProtocol(input, "");
|
|
178
|
-
}
|
|
179
|
-
function withProtocol(input, protocol) {
|
|
180
|
-
let match = input.match(PROTOCOL_REGEX);
|
|
181
|
-
if (!match) match = input.match(/^\/{2,}/);
|
|
182
|
-
if (!match) return protocol + input;
|
|
183
|
-
return protocol + input.slice(match[0].length);
|
|
184
|
-
}
|
|
185
|
-
const protocolRelative = Symbol.for("ufo:protocolRelative");
|
|
186
|
-
function parseURL(input = "", defaultProto) {
|
|
187
|
-
const _specialProtoMatch = input.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);
|
|
188
|
-
if (_specialProtoMatch) {
|
|
189
|
-
const [, _proto, _pathname = ""] = _specialProtoMatch;
|
|
190
|
-
return {
|
|
191
|
-
protocol: _proto.toLowerCase(),
|
|
192
|
-
pathname: _pathname,
|
|
193
|
-
href: _proto + _pathname,
|
|
194
|
-
auth: "",
|
|
195
|
-
host: "",
|
|
196
|
-
search: "",
|
|
197
|
-
hash: ""
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
if (!hasProtocol(input, { acceptRelative: true })) return defaultProto ? parseURL(defaultProto + input) : parsePath(input);
|
|
201
|
-
const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
|
|
202
|
-
let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
|
|
203
|
-
if (protocol === "file:") path = path.replace(/\/(?=[A-Za-z]:)/, "");
|
|
204
|
-
const { pathname, search, hash } = parsePath(path);
|
|
205
|
-
return {
|
|
206
|
-
protocol: protocol.toLowerCase(),
|
|
207
|
-
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
|
|
208
|
-
host,
|
|
209
|
-
pathname,
|
|
210
|
-
search,
|
|
211
|
-
hash,
|
|
212
|
-
[protocolRelative]: !protocol
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
function parsePath(input = "") {
|
|
216
|
-
const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
|
|
217
|
-
return {
|
|
218
|
-
pathname,
|
|
219
|
-
search,
|
|
220
|
-
hash
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function stringifyParsedURL(parsed) {
|
|
224
|
-
const pathname = parsed.pathname || "";
|
|
225
|
-
const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
|
|
226
|
-
const hash = parsed.hash || "";
|
|
227
|
-
const auth = parsed.auth ? parsed.auth + "@" : "";
|
|
228
|
-
const host = parsed.host || "";
|
|
229
|
-
return (parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "") + auth + host + pathname + search + hash;
|
|
230
|
-
}
|
|
231
|
-
const FILENAME_STRICT_REGEX = /\/([^/]+\.[^/]+)$/;
|
|
232
|
-
const FILENAME_REGEX = /\/([^/]+)$/;
|
|
233
|
-
function parseFilename(input = "", opts) {
|
|
234
|
-
const { pathname } = parseURL(input);
|
|
235
|
-
const matches = opts?.strict ? pathname.match(FILENAME_STRICT_REGEX) : pathname.match(FILENAME_REGEX);
|
|
236
|
-
return matches ? matches[1] : void 0;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
//#endregion
|
|
240
|
-
export { joinRelativeURL as a, withLeadingSlash as c, withoutBase as d, withoutLeadingSlash as f, isRelative as i, withQuery as l, withoutTrailingSlash as m, hasLeadingSlash as n, joinURL as o, withoutProtocol as p, hasProtocol as r, parseFilename as s, cleanDoubleSlashes as t, withTrailingSlash as u };
|
|
1
|
+
String.fromCharCode;const e=/#/g,t=/&/g,n=/\//g,r=/=/g,i=/\+/g,a=/%5e/gi,o=/%60/gi,s=/%7c/gi,c=/%20/gi;function l(e){return encodeURI(``+e).replace(s,`|`)}function u(r){return l(typeof r==`string`?r:JSON.stringify(r)).replace(i,`%2B`).replace(c,`+`).replace(e,`%23`).replace(t,`%26`).replace(o,"`").replace(a,`^`).replace(n,`%2F`)}function d(e){return u(e).replace(r,`%3D`)}function f(e=``){try{return decodeURIComponent(``+e)}catch{return``+e}}function p(e){return f(e.replace(i,` `))}function m(e){return f(e.replace(i,` `))}function h(e=``){let t=Object.create(null);e[0]===`?`&&(e=e.slice(1));for(let n of e.split(`&`)){let e=n.match(/([^=]+)=?(.*)/)||[];if(e.length<2)continue;let r=p(e[1]);if(r===`__proto__`||r===`constructor`)continue;let i=m(e[2]||``);t[r]===void 0?t[r]=i:Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]}return t}function g(e,t){return(typeof t==`number`||typeof t==`boolean`)&&(t=String(t)),t?Array.isArray(t)?t.map(t=>`${d(e)}=${u(t)}`).join(`&`):`${d(e)}=${u(t)}`:d(e)}function _(e){return Object.keys(e).filter(t=>e[t]!==void 0).map(t=>g(t,e[t])).filter(Boolean).join(`&`)}const v=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,y=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,b=/^([/\\]\s*){2,}[^/\\]/,x=/\/$|\/\?|\/#/,S=/^\.?\//;function C(e){return[`./`,`../`].some(t=>e.startsWith(t))}function w(e,t={}){return typeof t==`boolean`&&(t={acceptRelative:t}),t.strict?v.test(e):y.test(e)||(t.acceptRelative?b.test(e):!1)}function T(e=``,t){return t?x.test(e):e.endsWith(`/`)}function E(e=``,t){if(!t)return(T(e)?e.slice(0,-1):e)||`/`;if(!T(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);i!==-1&&(n=e.slice(0,i),r=e.slice(i));let[a,...o]=n.split(`?`);return((a.endsWith(`/`)?a.slice(0,-1):a)||`/`)+(o.length>0?`?${o.join(`?`)}`:``)+r}function D(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(T(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function O(e=``){return e.startsWith(`/`)}function k(e=``){return(O(e)?e.slice(1):e)||`/`}function A(e=``){return O(e)?e:`/`+e}function j(e=``){return e.split(`://`).map(e=>e.replace(/\/{2,}/g,`/`)).join(`://`)}function M(e,t){if(P(t))return e;let n=E(t);if(!e.startsWith(n))return e;let r=e[n.length];if(r&&r!==`/`&&r!==`?`)return e;let i=e.slice(n.length);return i[0]===`/`?i:`/`+i}function N(e,t){let n=V(e);return n.search=_({...h(n.search),...t}),U(n)}function P(e){return!e||e===`/`}function F(e){return e&&e!==`/`}function I(e,...t){let n=e||``;for(let e of t.filter(e=>F(e)))if(n){let t=e.replace(S,``);n=D(n)+t}else n=e;return n}function L(...e){let t=/\/(?!\/)/,n=e.filter(Boolean),r=[],i=0;for(let e of n)if(!(!e||e===`/`)){for(let[n,a]of e.split(t).entries())if(!(!a||a===`.`)){if(a===`..`){if(r.length===1&&w(r[0]))continue;r.pop(),i--;continue}if(n===1&&r[r.length-1]?.endsWith(`:/`)){r[r.length-1]+=`/`+a;continue}r.push(a),i++}}let a=r.join(`/`);return i>=0?n[0]?.startsWith(`/`)&&!a.startsWith(`/`)?a=`/`+a:n[0]?.startsWith(`./`)&&!a.startsWith(`./`)&&(a=`./`+a):a=`../`.repeat(-1*i)+a,n[n.length-1]?.endsWith(`/`)&&!a.endsWith(`/`)&&(a+=`/`),a}function R(e){return z(e,``)}function z(e,t){let n=e.match(y);return n||=e.match(/^\/{2,}/),n?t+e.slice(n[0].length):t+e}const B=Symbol.for(`ufo:protocolRelative`);function V(e=``,t){let n=e.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(n){let[,e,t=``]=n;return{protocol:e.toLowerCase(),pathname:t,href:e+t,auth:``,host:``,search:``,hash:``}}if(!w(e,{acceptRelative:!0}))return t?V(t+e):H(e);let[,r=``,i,a=``]=e.replace(/\\/g,`/`).match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[],[,o=``,s=``]=a.match(/([^#/?]*)(.*)?/)||[];r===`file:`&&(s=s.replace(/\/(?=[A-Za-z]:)/,``));let{pathname:c,search:l,hash:u}=H(s);return{protocol:r.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):``,host:o,pathname:c,search:l,hash:u,[B]:!r}}function H(e=``){let[t=``,n=``,r=``]=(e.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:t,search:n,hash:r}}function U(e){let t=e.pathname||``,n=e.search?(e.search.startsWith(`?`)?``:`?`)+e.search:``,r=e.hash||``,i=e.auth?e.auth+`@`:``,a=e.host||``;return(e.protocol||e[B]?(e.protocol||``)+`//`:``)+i+a+t+n+r}export{L as a,N as c,k as d,R as f,C as i,D as l,O as n,I as o,E as p,w as r,A as s,j as t,M as u};
|
|
@@ -1,84 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { n as mjs_exports, t as init_mjs } from "./isexe.mjs";
|
|
3
|
-
|
|
4
|
-
//#region ../../node_modules/.pnpm/which@5.0.0/node_modules/which/lib/index.js
|
|
5
|
-
var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
|
-
const { isexe, sync: isexeSync } = (init_mjs(), __toCommonJS(mjs_exports));
|
|
7
|
-
const { join, delimiter, sep, posix } = __require("path");
|
|
8
|
-
const isWindows = process.platform === "win32";
|
|
9
|
-
/* istanbul ignore next */
|
|
10
|
-
const rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
|
|
11
|
-
const rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
12
|
-
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
13
|
-
const getPathInfo = (cmd, { path: optPath = process.env.PATH, pathExt: optPathExt = process.env.PATHEXT, delimiter: optDelimiter = delimiter }) => {
|
|
14
|
-
const pathEnv = cmd.match(rSlash) ? [""] : [...isWindows ? [process.cwd()] : [], ...(optPath || "").split(optDelimiter)];
|
|
15
|
-
if (isWindows) {
|
|
16
|
-
const pathExtExe = optPathExt || [
|
|
17
|
-
".EXE",
|
|
18
|
-
".CMD",
|
|
19
|
-
".BAT",
|
|
20
|
-
".COM"
|
|
21
|
-
].join(optDelimiter);
|
|
22
|
-
const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]);
|
|
23
|
-
if (cmd.includes(".") && pathExt[0] !== "") pathExt.unshift("");
|
|
24
|
-
return {
|
|
25
|
-
pathEnv,
|
|
26
|
-
pathExt,
|
|
27
|
-
pathExtExe
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
pathEnv,
|
|
32
|
-
pathExt: [""]
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
const getPathPart = (raw, cmd) => {
|
|
36
|
-
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
37
|
-
return (!pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "") + join(pathPart, cmd);
|
|
38
|
-
};
|
|
39
|
-
const which = async (cmd, opt = {}) => {
|
|
40
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
41
|
-
const found = [];
|
|
42
|
-
for (const envPart of pathEnv) {
|
|
43
|
-
const p = getPathPart(envPart, cmd);
|
|
44
|
-
for (const ext of pathExt) {
|
|
45
|
-
const withExt = p + ext;
|
|
46
|
-
if (await isexe(withExt, {
|
|
47
|
-
pathExt: pathExtExe,
|
|
48
|
-
ignoreErrors: true
|
|
49
|
-
})) {
|
|
50
|
-
if (!opt.all) return withExt;
|
|
51
|
-
found.push(withExt);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (opt.all && found.length) return found;
|
|
56
|
-
if (opt.nothrow) return null;
|
|
57
|
-
throw getNotFoundError(cmd);
|
|
58
|
-
};
|
|
59
|
-
const whichSync = (cmd, opt = {}) => {
|
|
60
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
61
|
-
const found = [];
|
|
62
|
-
for (const pathEnvPart of pathEnv) {
|
|
63
|
-
const p = getPathPart(pathEnvPart, cmd);
|
|
64
|
-
for (const ext of pathExt) {
|
|
65
|
-
const withExt = p + ext;
|
|
66
|
-
if (isexeSync(withExt, {
|
|
67
|
-
pathExt: pathExtExe,
|
|
68
|
-
ignoreErrors: true
|
|
69
|
-
})) {
|
|
70
|
-
if (!opt.all) return withExt;
|
|
71
|
-
found.push(withExt);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (opt.all && found.length) return found;
|
|
76
|
-
if (opt.nothrow) return null;
|
|
77
|
-
throw getNotFoundError(cmd);
|
|
78
|
-
};
|
|
79
|
-
module.exports = which;
|
|
80
|
-
which.sync = whichSync;
|
|
81
|
-
}));
|
|
82
|
-
|
|
83
|
-
//#endregion
|
|
84
|
-
export { require_lib as t };
|
|
1
|
+
import{a as e,o as t,t as n}from"../rolldown-runtime.mjs";import{n as r,t as i}from"./isexe.mjs";var a=n(((n,a)=>{let{isexe:o,sync:s}=(i(),t(r)),{join:c,delimiter:l,sep:u,posix:d}=e(`path`),f=process.platform===`win32`,p=new RegExp(`[${d.sep}${u===d.sep?``:u}]`.replace(/(\\)/g,`\\$1`)),m=RegExp(`^\\.${p.source}`),h=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),g=(e,{path:t=process.env.PATH,pathExt:n=process.env.PATHEXT,delimiter:r=l})=>{let i=e.match(p)?[``]:[...f?[process.cwd()]:[],...(t||``).split(r)];if(f){let t=n||[`.EXE`,`.CMD`,`.BAT`,`.COM`].join(r),a=t.split(r).flatMap(e=>[e,e.toLowerCase()]);return e.includes(`.`)&&a[0]!==``&&a.unshift(``),{pathEnv:i,pathExt:a,pathExtExe:t}}return{pathEnv:i,pathExt:[``]}},_=(e,t)=>{let n=/^".*"$/.test(e)?e.slice(1,-1):e;return(!n&&m.test(t)?t.slice(0,2):``)+c(n,t)},v=async(e,t={})=>{let{pathEnv:n,pathExt:r,pathExtExe:i}=g(e,t),a=[];for(let s of n){let n=_(s,e);for(let e of r){let r=n+e;if(await o(r,{pathExt:i,ignoreErrors:!0})){if(!t.all)return r;a.push(r)}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw h(e)},y=(e,t={})=>{let{pathEnv:n,pathExt:r,pathExtExe:i}=g(e,t),a=[];for(let o of n){let n=_(o,e);for(let e of r){let r=n+e;if(s(r,{pathExt:i,ignoreErrors:!0})){if(!t.all)return r;a.push(r)}}}if(t.all&&a.length)return a;if(t.nothrow)return null;throw h(e)};a.exports=v,v.sync=y}));export{a as t};
|
|
@@ -1,43 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let lastChar = str[lastCharPos];
|
|
14
|
-
while (lastChar === " " || lastChar === " ") lastChar = str[--lastCharPos];
|
|
15
|
-
return str.substring(0, lastCharPos + 1);
|
|
16
|
-
}
|
|
17
|
-
function trimTabAndSpaces(str) {
|
|
18
|
-
return str.split("\n").map((line) => trimEnd(line)).join("\n");
|
|
19
|
-
}
|
|
20
|
-
module.exports = function(str, options) {
|
|
21
|
-
options = options || {};
|
|
22
|
-
if (str == null) return str;
|
|
23
|
-
var width = options.width || 50;
|
|
24
|
-
var indent = typeof options.indent === "string" ? options.indent : " ";
|
|
25
|
-
var newline = options.newline || "\n" + indent;
|
|
26
|
-
var escape = typeof options.escape === "function" ? options.escape : identity;
|
|
27
|
-
var regexString = ".{1," + width + "}";
|
|
28
|
-
if (options.cut !== true) regexString += "([\\s]+|$)|[^\\s]+?([\\s]+|$)";
|
|
29
|
-
var re = new RegExp(regexString, "g");
|
|
30
|
-
var result = indent + (str.match(re) || []).map(function(line) {
|
|
31
|
-
if (line.slice(-1) === "\n") line = line.slice(0, line.length - 1);
|
|
32
|
-
return escape(line);
|
|
33
|
-
}).join(newline);
|
|
34
|
-
if (options.trim === true) result = trimTabAndSpaces(result);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
function identity(str) {
|
|
38
|
-
return str;
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
export { require_word_wrap as t };
|
|
1
|
+
import{t as e}from"../rolldown-runtime.mjs";var t=e(((e,t)=>{
|
|
2
|
+
/*!
|
|
3
|
+
* word-wrap <https://github.com/jonschlinkert/word-wrap>
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2014-2023, Jon Schlinkert.
|
|
6
|
+
* Released under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
function n(e){let t=e.length-1,n=e[t];for(;n===` `||n===` `;)n=e[--t];return e.substring(0,t+1)}function r(e){return e.split(`
|
|
9
|
+
`).map(e=>n(e)).join(`
|
|
10
|
+
`)}t.exports=function(e,t){if(t||={},e==null)return e;var n=t.width||50,a=typeof t.indent==`string`?t.indent:` `,o=t.newline||`
|
|
11
|
+
`+a,s=typeof t.escape==`function`?t.escape:i,c=`.{1,`+n+`}`;t.cut!==!0&&(c+=`([\\s]+|$)|[^\\s]+?([\\s]+|$)`);var l=new RegExp(c,`g`),u=a+(e.match(l)||[]).map(function(e){return e.slice(-1)===`
|
|
12
|
+
`&&(e=e.slice(0,e.length-1)),s(e)}).join(o);return t.trim===!0&&(u=r(u)),u};function i(e){return e}}));export{t};
|
|
@@ -1,48 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region rolldown:runtime
|
|
4
|
-
var __create = Object.create;
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
11
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
12
|
-
var __exportAll = (all, symbols) => {
|
|
13
|
-
let target = {};
|
|
14
|
-
for (var name in all) {
|
|
15
|
-
__defProp(target, name, {
|
|
16
|
-
get: all[name],
|
|
17
|
-
enumerable: true
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
if (symbols) {
|
|
21
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
22
|
-
}
|
|
23
|
-
return target;
|
|
24
|
-
};
|
|
25
|
-
var __copyProps = (to, from, except, desc) => {
|
|
26
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
28
|
-
key = keys[i];
|
|
29
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
30
|
-
__defProp(to, key, {
|
|
31
|
-
get: ((k) => from[k]).bind(null, key),
|
|
32
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return to;
|
|
38
|
-
};
|
|
39
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
40
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
41
|
-
value: mod,
|
|
42
|
-
enumerable: true
|
|
43
|
-
}) : target, mod));
|
|
44
|
-
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
export { __require as a, __reExport as i, __esmMin as n, __toCommonJS as o, __exportAll as r, __toESM as s, __commonJSMin as t };
|
|
1
|
+
import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(e&&(t=e(e=0)),t),c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,t,n)=>(u(e,t,`default`),n&&u(n,t,`default`)),f=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),p=e=>o.call(e,`module.exports`)?e[`module.exports`]:u(n({},`__esModule`,{value:!0}),e),m=e(import.meta.url);export{m as a,d as i,s as n,p as o,l as r,f as s,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as e,I as t,J as n,L as r,X as i,_ as a,b as o,p as s,t as c,y as l}from"./libs/remeda.mjs";import{a as u,i as d,n as f,r as p,t as m}from"./libs/@lume/kiwi.mjs";import{getParallelStepsPrefix as h,isStepEdgeId as g}from"@likec4/core/types";import{DefaultMap as _,Stack as v,invariant as y,isAncestor as b,nonNullable as x,nonexhaustive as S}from"@likec4/core/utils";function C(e){return i(e,r(e=>e.parallelPrefix??void 0),a((e,t)=>e.reduce((e,t)=>(e.min.column=Math.min(e.min.column,t.from.column,t.to.column),e.min.row=Math.min(e.min.row,t.from.row,t.to.row),e.max.column=Math.max(e.max.column,t.from.column,t.to.column),e.max.row=Math.max(e.max.row,t.from.row,t.to.row),e),{parallelPrefix:t,min:{column:1/0,row:1/0},max:{column:-1/0,row:-1/0}})),c())}function w(e,t){if(e.length===0||e.length===t.length)return[];let n=e=>x(t.find(t=>t.id===e));function r(e){let t=e.parent?n(e.parent):null;return t?[t,...r(t)]:[]}let i=new v,a=[];return e.forEach(e=>{let t=r(e);if(t.length===0){i.clear();return}let n=v.from(t),o,s;for(;o=i.peek()?.node,s=n.peek(),!(!s||!o);){if(b(s.id,o.id)||s.id===o.id){n.pop();continue}if(!b(o.id,s.id)){i.pop();continue}break}for(;s=n.pop();){let t={node:s,from:e,to:e,nested:[]},n=i.peek();n?n.nested.push(t):a.push(t),i.push(t)}i.forEach(t=>t.to=e)}),a}var T=class{#e=new m;#t;#n=[];#r;#i;#a;#o=[];#s=[];constructor({actors:e,steps:t,compounds:n}){this.#a=this.newVar(30),this.#r=this.newVar(0),this.#i=this.newVar(0),this.#t=this.addActors(e);for(let e of n){let t=this.addCompound(e),n=t[0];this.constraint(n.y1,`==`,0,d.strong),this.put(this.#i).after(n.bottom),this.put(this.#a).after(n.y2),this.#n.push(...t)}for(let e of t)this.addStep(e);for(let e of C(t))this.addParallelRect(e);let r=this.#t[0];this.constraint(r.offset.left,`==`,0,d.strong);let i=this.#t.reduce((e,t)=>(this.put(t.x).after(e.right,60),this.put(t.offset.left,d.strong).after(e.offset.right,32),this.constraint(t.centerY,`==`,e.centerY,d.strong),this.put(this.#a).after(t.offset.bottom),t));if(this.put(this.#r).after(i.offset.right),this.put(this.#i).after(o(this.#o)?.bottom??this.#a),n.length>0)for(let e of this.#n){let t=e.from.column,n=e.to.column,r=Math.max(e.from.maxRow,e.to.maxRow);for(let e=t+1;e<n;e++){let t=this.actorBox(e);r=Math.max(r,t.maxRow)}let i=x(this.#o[r],`row ${r} not found`);this.put(e.bottom).after(i.bottom,16),this.put(this.#i).after(e.bottom)}this.#e.updateVariables()}getParallelBoxes(){return this.#s.map(({parallelPrefix:e,x1:t,y1:n,x2:r,y2:i})=>({parallelPrefix:e,x:t.value(),y:n.value(),width:r.value()-t.value(),height:i.value()-n.value()}))}getActorBox(e){let t=this.actorBox(e);return{x:t.x.value(),y:t.y.value(),width:t.width,height:t.height}}getCompoundBoxes(){return this.#n.map(({node:e,depth:t,x1:n,y1:r,x2:i,bottom:a})=>({node:e,depth:t,x:n.value(),y:r.value(),width:i.value()-n.value(),height:a.value()-r.value()}))}getPortCenter(e,t){let{column:n,row:r}=t===`source`?e.from:e.to,i=this.actorBox(n).centerX,{y:a}=x(this.#o[r]);return{cx:i.value(),cy:a.value()+32/2+e.offset,height:t===`source`?40:24}}getViewBounds(){return{x:0,y:0,width:this.#r.value(),height:this.#i.value()}}actorBox(e){if(typeof e!=`number`){let t=typeof e==`string`?e:e.id;e=this.#t.findIndex(e=>e.actor.id===t),y(e>=0,`actor ${t} not found`)}return x(this.#t[e],`actor at index ${e} not found`)}addActors(e){let t=0;return l(e,(e,n)=>{let r=this.newVar(t);t+=e.width+60;let i=this.newVar(0),a={column:n,actor:e,x:r,y:i,centerX:r.plus(Math.round(e.width/2)),centerY:i.plus(Math.round(e.height/2)),width:e.width,height:e.height,right:r.plus(e.width),bottom:i.plus(e.height),minRow:1/0,maxRow:-1/0},o=this.newVar(0),s=this.newVar(0),c=this.newVar(0),l=this.newVar(0);return this.put(o,d.strong).before(i),this.put(s,d.strong).before(r),this.put(c,d.strong).after(a.right),this.put(l,d.strong).after(a.bottom),{...a,offset:{top:o,left:s,right:c,bottom:l}}})}addStep(e){let t=this.actorBox(e.source),n=this.actorBox(e.target);t.minRow=Math.min(t.minRow,e.from.row),t.maxRow=Math.max(t.maxRow,e.from.row),n.minRow=Math.min(n.minRow,e.to.row),n.maxRow=Math.max(n.maxRow,e.to.row);let[r,i]=t.column<=n.column?[t,n]:[n,t],a=(e.label?.width??100)+50;r===i?this.constraint(r.centerX.plus(a),`<=`,r.offset.right):this.constraint(r.centerX.plus(a),`<=`,i.centerX);let o=e.label?.height?e.label.height+50+32/2:80;return o=Math.max(o,80)+e.offset,this.ensureRow(e.from.row,o),e.isSelfLoop&&this.ensureRow(e.to.row,80),this}addParallelRect({parallelPrefix:e,min:t,max:n}){let r=this.actorBox(t.column).centerX.minus(30),i=this.actorBox(n.column).centerX.plus(30),a=this.#o[t.row],o=this.#o[n.row];y(a&&o,`parallel box invalid minRow=${t.row} maxRow=${n.row}`);let s=this.newVar(0);this.put(s).before(a.y,40);let c=o.bottom,l=t.row>0&&this.#o[t.row-1];l&&this.put(s).after(l.bottom,16);let u=n.row<this.#o.length-1&&this.#o[n.row+1];u&&this.put(c).before(u.y,16),this.#s.push({parallelPrefix:e,x1:r,y1:s,x2:i,y2:c})}addCompound(e){let t=[],n=e.nested.flatMap(e=>{let n=this.addCompound(e);return t.push(n[0]),n}),r=Math.max(...n.map(e=>e.depth+1),0),i=this.actorBox(e.from),a=this.actorBox(e.to),o=i.offset.left.minus(32);i.offset.left=o;let c=a.offset.right.plus(32);a.offset.right=c;let l=this.newVar(0),u=s(t),d,f;switch(!0){case!!u:d=u.y1.minus(40),f=u.y2.plus(32),this.put(l).after(u.bottom,32);break;case a===i:d=this.newVar(0),f=this.newVar(0),this.put(d).before(i.offset.top,52),this.put(f).after(i.offset.bottom,32),this.put(l).after(f);break;case t.length>0:d=this.newVar(0),f=this.newVar(0);for(let e of t)this.put(d).before(e.y1,32),this.put(f).after(e.y2,32),this.put(l).after(e.bottom,32);break;default:d=this.newVar(0),f=this.newVar(0);for(var p=i.column;p<=a.column;p++){let e=this.actorBox(p).offset;this.put(d).before(e.top,52),this.put(f).after(e.bottom,32)}this.put(l).after(f);break}for(var p=i.column;p<=a.column;p++){let e=this.actorBox(p).offset;e.top=d,e.bottom=f}return[{node:e.node,depth:r,from:i,to:a,x1:o,y1:d,x2:c,y2:f,bottom:l},...n]}ensureRow(e,t){for(;e>=this.#o.length;){let e=this.#o.length>0&&this.#o[this.#o.length-1]?.bottom||this.#a.plus(30),t=this.newVar(this.#o.length*80);this.put(t).after(e);let n=this.newVar(80);this.require(n,`>=`,80),this.#o.push({y:t,height:n,bottom:t.plus(n),lastHeight:80})}let n=x(this.#o[e]);t>n.lastHeight&&(n.lastHeight=t,this.require(n.height,`>=`,t),this.#e.suggestValue(n.height,t))}newVar(e){let t=new u;return this.#e.addEditVariable(t,d.weak),typeof e==`number`&&(this.#e.suggestValue(t,e),this.constraint(t,`>=`,0,d.strong)),t}require(e,t,n=void 0){switch(this.constraint(e,t,n,d.required),t){case`<=`:case`>=`:this.constraint(e,`==`,n,d.weak);break;case`<= 0`:case`>= 0`:this.constraint(e,`== 0`,void 0,d.weak);break}}constraint(e,t,n=void 0,r=d.medium){let i;switch(t){case`==`:i=p.Eq;break;case`>=`:i=p.Ge;break;case`<=`:i=p.Le;break;case`== 0`:i=p.Eq,n=0;break;case`>= 0`:i=p.Ge,n=0;break;case`<= 0`:i=p.Le,n=0;break;default:S(t)}this.#e.addConstraint(new f(e,i,n??0,r))}put(e,t=d.required){let n=t===d.required?d.medium:d.weak;return{before:(r,i)=>{i&&(r=r.minus(i)),this.constraint(e,`<=`,r,t),this.constraint(e,`==`,r,n)},after:(r,i)=>{i&&(r=r.plus(i)),this.constraint(e,`>=`,r,t),this.constraint(e,`==`,r,n)}}}};function E(r){let o=new Set,s=e=>x(r.nodes.find(t=>t.id===e)),u=[];for(let e of r.edges.filter(e=>g(e.id))){let t=s(e.source),n=s(e.target);if(t.children.length||n.children.length){console.error(`Sequence view does not support nested actors`);continue}o.add(t),o.add(n),u.push({edge:e,source:t,target:n})}let d=r.nodes.filter(e=>o.has(e));y(n(d,1),`actors array must not be empty`);let f=new _(()=>[]),p=[],m=0;for(let{edge:e,source:t,target:n}of u){let r=p.at(-1),i=d.indexOf(t),a=d.indexOf(n),o=t===n,s=i>a,c=h(e.id),l=!1;r&&r.target==t&&r.parallelPrefix===c&&(l=r.isSelfLoop!==o||r.isBack===s),l||m++;let u={id:e.id,from:{column:i,row:m},to:{column:a,row:o?++m:m},edge:e,isSelfLoop:o,isBack:s,parallelPrefix:c,offset:l?(r?.offset??0)+22:0,source:t,target:n,label:e.labelBBox?{height:e.labelBBox.height+8+(e.navigateTo?20:0),width:e.labelBBox.width+16,text:e.label}:null};p.push(u),f.get(t).push({step:u,row:m,type:`source`,position:s&&!o?`left`:`right`}),f.get(n).push({step:u,row:m,type:`target`,position:s||o?`right`:`left`})}let v=new T({actors:d,steps:p,compounds:w(d,r.nodes)}),b=v.getViewBounds(),S=i(v.getCompoundBoxes(),l(({node:e,...t})=>({...t,id:e.id,origin:e.id})),t(`id`),a((e,t)=>n(e,2)?l(e,(e,n)=>({...e,id:`${t}-${n+1}`})):e),c(),e());return{actors:d.map(e=>D({actor:e,ports:f.get(e),layout:v})),compounds:S,steps:l(p,e=>({id:e.id,sourceHandle:e.id+`_source`,targetHandle:e.id+`_target`,...e.label&&{labelBBox:{width:e.label.width,height:e.label.height}}})),parallelAreas:v.getParallelBoxes(),bounds:b}}function D({actor:e,ports:t,layout:n}){let{x:r,y:i,width:a,height:o}=n.getActorBox(e);return{id:e.id,x:r,y:i,width:a,height:o,ports:t.map(e=>{let t=n.getPortCenter(e.step,e.type);return{id:`${e.step.id}_${e.type}`,cx:t.cx-r,cy:t.cy-i,height:t.height,type:e.type,position:e.position}})}}export{E as t};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{t as e}from"./libs/json5.mjs";import{J as t}from"./libs/@hono/mcp.mjs";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`}),ee=t.enum([`dashed`,`solid`,`dotted`]).meta({id:`LineType`}),te=t.enum(s).meta({id:`ThemeColorName`}),C=t.custom().refine(e=>typeof e==`string`,`Custom color name must be a string`).transform(e=>e).meta({id:`CustomColorName`}),w=te.or(C).transform(e=>e).meta({id:`ColorName`}),T=t.string().min(1,`Color value cannot be empty`).meta({id:`ColorLiteral`}),E=t.strictObject({fill:T.meta({description:`Background color`}),stroke:T.meta({description:`Stroke color (border, paths above background)`}),hiContrast:T.meta({description:`High contrast text color (title)`}),loContrast:T.meta({description:`Low contrast text color (description)`})}).meta({id:`ElementColorValues`}).transform(e=>e),D=t.strictObject({line:T.meta({description:`Line color`}),label:T.meta({description:`Label text color`}),labelBg:T.optional().default(`rgba(0, 0, 0, 0.5)`).meta({description:`Label background color`})}).meta({id:`RelationshipColorValues`}).transform(e=>e),O=t.strictObject({elements:E.or(T.transform(e=>c(e).elements)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),relationships:D.or(T.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(T.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`}),k=t.partialRecord(w,O).transform(e=>e),A=t.strictObject({width:t.number().min(50),height:t.number().min(50)}).meta({id:`Dimensions`,description:`Defines dimensions for theme size`}),j=t.partialRecord(b,A),M=t.strictObject({colors:k.optional().meta({description:`Override theme colors`}),sizes:j.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})),N=t.strictObject({color:w.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`}),P=t.strictObject({color:w.optional().meta({description:`Default color for relationships
|
|
7
|
+
(must be a valid color name from the theme)`}),line:ee.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`}),F=t.strictObject({color:w.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:N.optional().meta({description:`Override default values for group style properties
|
|
10
|
+
These values will be used if such property is not defined`}),relationship:P.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`}),I=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`}),L=t.strictObject({theme:M.optional().meta({description:`Project theme customization`}),defaults:F.optional().meta({description:`Override default values for style properties
|
|
12
|
+
These values will be used if such property is not defined`}),customCss:I.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:R(t),customCss:ne(n),theme:e}));function R(e){if(!e)return;let{relationship:t,group:n,...r}=e;return l({...r,relationship:t&&l(t),group:n&&l(n)})}function ne(e){if(!e)return;let t=(Array.isArray(e)?e:[e]).filter(Boolean);if(t.length!==0)return{paths:t,content:``}}const z=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`}),B=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:L.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:z.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 true.`})}).meta({id:`LikeC4ProjectConfig`,description:`LikeC4 Project Configuration`}),V=t.instanceof(Function),H=t.record(t.string(),V),U=B.extend({generators:H.optional()});function W(e){let n=U.safeParse(e);if(n.success)return n.data;throw Error(`Config validation failed:
|
|
15
|
+
`+t.prettifyError(n.error))}function G(t){return W(e.parse(t.trim()||`{}`))}const K={parse:G,validate:W,normalizeInclude:e=>{let t=g.safeParse(e);return t.success?t.data:{paths:[],maxDepth:3,fileThreshold:30}}};function q(e){let t=e.length;for(;t>0&&(e[t-1]===`/`||e[t-1]===`\\`);)t--;return e.slice(0,t)}function J(e){return e.split(`/`).flatMap(e=>e.split(`\\`))}function Y(e){let t=q(e),n=J(t);return n[n.length-1]||t}const X=[`.likec4rc`,`.likec4.config.json`,`likec4.config.json`],Z=[`likec4.config.js`,`likec4.config.cjs`,`likec4.config.mjs`,`likec4.config.ts`,`likec4.config.cts`,`likec4.config.mts`];[...X,...Z];function Q(e){return X.includes(Y(e))}function $(e){return Z.includes(Y(e))}function re(e){return Q(e)||$(e)}function ie(e){return U.parse(e)}function ae(e){return H.parse(e)}function oe(e){return O.parse(e)}function se(e){return M.parse(e)}function ce(e){return L.parse(e)}export{oe as a,$ as c,W as d,se as i,K as l,ae as n,re as o,ce as r,Q as s,ie as t,B as u};
|