likec4 1.8.2-next.0 → 1.8.2-next.1
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 +7 -1
- package/dist/cli/index.mjs +9 -10
- package/dist/index.d.mts +163 -162
- package/dist/index.d.ts +163 -162
- package/dist/index.mjs +1 -1
- package/dist/shared/{likec4.BOI-5rb_.mjs → likec4.DNb51-HM.mjs} +114 -104
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Features:
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
14
14
|
> **Compatibility Note:**\
|
|
15
|
-
> LikeC4 requires [Node.js](https://nodejs.org/en/) version
|
|
15
|
+
> LikeC4 requires [Node.js](https://nodejs.org/en/) version 20+
|
|
16
16
|
|
|
17
17
|
### Local installation
|
|
18
18
|
|
|
@@ -154,6 +154,12 @@ likec4 codegen ts ...
|
|
|
154
154
|
> Output file should have `.ts` extension\
|
|
155
155
|
> By default, it generates `likec4.generated.ts` in current directory
|
|
156
156
|
|
|
157
|
+
## API Usage
|
|
158
|
+
|
|
159
|
+
LikeC4 model can be accessed
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
157
163
|
## Development
|
|
158
164
|
|
|
159
165
|
In root workspace:
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import {X as getDocument,Y as findNodesForProperty,Z as TreeStreamImpl,_ as NEWLINE_REGEXP,$ as isAstNode,a0 as e,a1 as x,a2 as i,a3 as T,a4 as n,a5 as t,a6 as f,a7 as pLimit,a8 as logger,a9 as l,aa as createLikeC4Logger,ab as withTrailingSlash,ac as hasProtocol,ad as withLeadingSlash,ae as d,af as u,L as LikeC4,ag as i3,ah as inMillis,ai as startTimer,aj as nonexhaustive,ak as invariant,al as stripIndent,am as i$1,an as delay,ao as LogLevels,ap as pkg}from'../shared/likec4.DNb51-HM.mjs';import {hrtime,cwd,argv,stdout,exit}from'node:process';import yargs from'yargs';import {hideBin}from'yargs/helpers';import {resolve,dirname,join,extname,relative,isAbsolute,basename}from'node:path';import {existsSync,copyFileSync,rmSync}from'node:fs';import {mkdtemp,writeFile,mkdir,stat,copyFile,rm}from'node:fs/promises';import os,{tmpdir}from'node:os';import {fileURLToPath}from'node:url';import {build,createServer,preview}from'vite';import {chromium}from'playwright';import net from'node:net';import {setTimeout as setTimeout$1}from'node:timers/promises';import {resolve as resolve$1}from'path';import react from'@vitejs/plugin-react';const path = {
|
|
3
3
|
type: "string",
|
|
4
4
|
desc: "<directory> with LikeC4 sources (default is current directory)",
|
|
5
5
|
normalize: true,
|
|
@@ -3920,7 +3920,7 @@ async function pngHandler({
|
|
|
3920
3920
|
}) {
|
|
3921
3921
|
const logger = createLikeC4Logger("c4:export");
|
|
3922
3922
|
const startTakeScreenshot = hrtime();
|
|
3923
|
-
const languageServices = await LikeC4.
|
|
3923
|
+
const languageServices = await LikeC4.fromWorkspace(path, {
|
|
3924
3924
|
logger: "vite",
|
|
3925
3925
|
graphviz: useDotBin ? "binary" : "wasm"
|
|
3926
3926
|
});
|
|
@@ -3992,8 +3992,7 @@ async function buildHandler({
|
|
|
3992
3992
|
base
|
|
3993
3993
|
}) {
|
|
3994
3994
|
const logger = createLikeC4Logger("c4:build");
|
|
3995
|
-
const languageServices = await LikeC4.
|
|
3996
|
-
logger: "vite",
|
|
3995
|
+
const languageServices = await LikeC4.fromWorkspace(path, {
|
|
3997
3996
|
graphviz: useDotBin ? "binary" : "wasm"
|
|
3998
3997
|
});
|
|
3999
3998
|
const outDir = outputDir ?? resolve(languageServices.workspace, "dist");
|
|
@@ -4146,7 +4145,7 @@ async function multipleFilesCodegenAction(languageServices, format, outdir, logg
|
|
|
4146
4145
|
async function reactLegacyHandler({ path, useDotBin, ...outparams }) {
|
|
4147
4146
|
const logger = createLikeC4Logger("c4:codegen");
|
|
4148
4147
|
const timer = startTimer(logger);
|
|
4149
|
-
const languageServices = await LikeC4.
|
|
4148
|
+
const languageServices = await LikeC4.fromWorkspace(path, {
|
|
4150
4149
|
logger: "vite",
|
|
4151
4150
|
graphviz: useDotBin ? "binary" : "wasm"
|
|
4152
4151
|
});
|
|
@@ -4256,7 +4255,7 @@ async function reactLegacyHandler({ path, useDotBin, ...outparams }) {
|
|
|
4256
4255
|
}async function reactHandler({ path, useDotBin, outfile }) {
|
|
4257
4256
|
const logger$1 = createLikeC4Logger("c4:codegen");
|
|
4258
4257
|
const timer = startTimer(logger$1);
|
|
4259
|
-
const languageServices = await LikeC4.
|
|
4258
|
+
const languageServices = await LikeC4.fromWorkspace(path, {
|
|
4260
4259
|
logger: "vite",
|
|
4261
4260
|
graphviz: useDotBin ? "binary" : "wasm"
|
|
4262
4261
|
});
|
|
@@ -4368,7 +4367,7 @@ export declare function LikeC4View({viewId, ...props}: LikeC4ViewProps): JSX.Ele
|
|
|
4368
4367
|
}) {
|
|
4369
4368
|
const logger$1 = createLikeC4Logger("c4:codegen");
|
|
4370
4369
|
const timer = startTimer(logger$1);
|
|
4371
|
-
const languageServices = await LikeC4.
|
|
4370
|
+
const languageServices = await LikeC4.fromWorkspace(path, {
|
|
4372
4371
|
logger: "vite",
|
|
4373
4372
|
graphviz: useDotBin ? "binary" : "wasm"
|
|
4374
4373
|
});
|
|
@@ -4549,7 +4548,7 @@ export declare function LikeC4View({viewId, ...props}: LikeC4ViewProps): JSX.Ele
|
|
|
4549
4548
|
};async function handler$2({ path, useDotBin, outfile }) {
|
|
4550
4549
|
const logger = createLikeC4Logger("c4:export");
|
|
4551
4550
|
const timer = startTimer(logger);
|
|
4552
|
-
const languageServices = await LikeC4.
|
|
4551
|
+
const languageServices = await LikeC4.fromWorkspace(path, {
|
|
4553
4552
|
logger: "vite",
|
|
4554
4553
|
graphviz: useDotBin ? "binary" : "wasm"
|
|
4555
4554
|
});
|
|
@@ -4681,7 +4680,7 @@ export declare function LikeC4View({viewId, ...props}: LikeC4ViewProps): JSX.Ele
|
|
|
4681
4680
|
output: outputDir,
|
|
4682
4681
|
base
|
|
4683
4682
|
}) {
|
|
4684
|
-
const languageServices = await LikeC4.
|
|
4683
|
+
const languageServices = await LikeC4.fromWorkspace(path, {
|
|
4685
4684
|
logger: "vite"
|
|
4686
4685
|
});
|
|
4687
4686
|
const server = await vitePreview({ base, languageServices, outputDir, open: true });
|
|
@@ -4716,7 +4715,7 @@ export declare function LikeC4View({viewId, ...props}: LikeC4ViewProps): JSX.Ele
|
|
|
4716
4715
|
useOverview = false,
|
|
4717
4716
|
base
|
|
4718
4717
|
}) {
|
|
4719
|
-
const languageServices = await LikeC4.
|
|
4718
|
+
const languageServices = await LikeC4.fromWorkspace(path, {
|
|
4720
4719
|
graphviz: useDotBin ? "binary" : "wasm"
|
|
4721
4720
|
});
|
|
4722
4721
|
const likec4AssetsDir = await mkdtemp(join(tmpdir(), ".likec4-assets-"));
|
package/dist/index.d.mts
CHANGED
|
@@ -1152,61 +1152,11 @@ type RelationID = LiteralUnion<RelationID$1, string>;
|
|
|
1152
1152
|
type ViewID = LiteralUnion<ViewID$1, string>;
|
|
1153
1153
|
type EdgeId = LiteralUnion<EdgeId$1, string>;
|
|
1154
1154
|
|
|
1155
|
-
|
|
1156
|
-
* Represents an element in the view. (Diagram node)
|
|
1157
|
-
* All methods are view-scoped, i.e. `children` returns only children of the element in the view.
|
|
1158
|
-
*/
|
|
1159
|
-
declare class ViewElement {
|
|
1160
|
-
readonly node: ComputedNode;
|
|
1161
|
-
private viewmodel;
|
|
1162
|
-
constructor(node: ComputedNode, viewmodel: ViewModel);
|
|
1163
|
-
get id(): NodeId;
|
|
1164
|
-
get title(): string;
|
|
1165
|
-
get kind(): ElementKind$1;
|
|
1166
|
-
get isRoot(): boolean;
|
|
1167
|
-
get hasNested(): boolean;
|
|
1168
|
-
get shape(): ElementShape$1;
|
|
1169
|
-
get color(): ThemeColor$1;
|
|
1170
|
-
get tags(): Tag$1[];
|
|
1171
|
-
model(): LikeC4Model.Element;
|
|
1172
|
-
parent(): ViewElement | null;
|
|
1173
|
-
metadata(key: string): string | undefined;
|
|
1174
|
-
metadata(key: string, defaultValue: string): string;
|
|
1175
|
-
hasMetadata(key: string): boolean;
|
|
1176
|
-
ancestors(): ReadonlyArray<ViewElement>;
|
|
1177
|
-
siblings(): ReadonlyArray<ViewElement>;
|
|
1178
|
-
descendants(): ReadonlyArray<ViewElement>;
|
|
1179
|
-
children(): ReadonlyArray<ViewElement>;
|
|
1180
|
-
incoming(filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<ViewConnection>;
|
|
1181
|
-
incomers(filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<ViewElement>;
|
|
1182
|
-
outgoing(filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<ViewConnection>;
|
|
1183
|
-
outgoers(filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<ViewElement>;
|
|
1184
|
-
connectionsTo(target: Fqn | ViewElement): ReadonlyArray<ViewConnection>;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* Represents a connection between two elements.
|
|
1189
|
-
* May be source from multiple model relationships.
|
|
1190
|
-
*/
|
|
1191
|
-
declare class ViewConnection {
|
|
1192
|
-
readonly edge: ComputedEdge;
|
|
1193
|
-
private viewmodel;
|
|
1194
|
-
constructor(edge: ComputedEdge, viewmodel: ViewModel);
|
|
1195
|
-
get id(): EdgeId$1;
|
|
1196
|
-
get source(): ViewElement;
|
|
1197
|
-
get target(): ViewElement;
|
|
1198
|
-
get tags(): Tag$1[];
|
|
1199
|
-
/**
|
|
1200
|
-
* Model relationships
|
|
1201
|
-
*/
|
|
1202
|
-
relationships(): ReadonlyArray<LikeC4Model.Relationship>;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
type ElementOrFqn$1 = Fqn | ViewElement;
|
|
1155
|
+
type ElementOrFqn$1 = Fqn | LikeC4ViewModel.Element;
|
|
1206
1156
|
/**
|
|
1207
1157
|
* All methods are view-scoped, i.e. only return elements and connections in the view.
|
|
1208
1158
|
*/
|
|
1209
|
-
declare class
|
|
1159
|
+
declare class LikeC4ViewModel {
|
|
1210
1160
|
#private;
|
|
1211
1161
|
readonly view: ComputedView;
|
|
1212
1162
|
readonly model: LikeC4Model;
|
|
@@ -1215,29 +1165,79 @@ declare class ViewModel {
|
|
|
1215
1165
|
get title(): string;
|
|
1216
1166
|
get viewOf(): LikeC4Model.Element;
|
|
1217
1167
|
get tags(): Tag$1[];
|
|
1218
|
-
roots(): ReadonlyArray<
|
|
1219
|
-
elements(): ReadonlyArray<
|
|
1220
|
-
element(id: Fqn):
|
|
1168
|
+
roots(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1169
|
+
elements(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1170
|
+
element(id: Fqn): LikeC4ViewModel.Element;
|
|
1221
1171
|
hasElement(id: Fqn): boolean;
|
|
1222
|
-
connections(): ReadonlyArray<
|
|
1223
|
-
connection(id: EdgeId):
|
|
1224
|
-
findConnections(source: ElementOrFqn$1, target: ElementOrFqn$1, direction?: 'both' | 'direct'): ReadonlyArray<
|
|
1225
|
-
parent(element: ElementOrFqn$1):
|
|
1226
|
-
children(element: ElementOrFqn$1): ReadonlyArray<
|
|
1227
|
-
siblings(element: ElementOrFqn$1): ReadonlyArray<
|
|
1172
|
+
connections(): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1173
|
+
connection(id: EdgeId): LikeC4ViewModel.Connection;
|
|
1174
|
+
findConnections(source: ElementOrFqn$1, target: ElementOrFqn$1, direction?: 'both' | 'direct'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1175
|
+
parent(element: ElementOrFqn$1): LikeC4ViewModel.Element | null;
|
|
1176
|
+
children(element: ElementOrFqn$1): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1177
|
+
siblings(element: ElementOrFqn$1): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1228
1178
|
/**
|
|
1229
1179
|
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
1230
1180
|
* (from closest to root)
|
|
1231
1181
|
*/
|
|
1232
|
-
ancestors(element: ElementOrFqn$1): ReadonlyArray<
|
|
1233
|
-
descendants(element: ElementOrFqn$1): ReadonlyArray<
|
|
1234
|
-
incoming(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<
|
|
1235
|
-
incomers(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<
|
|
1182
|
+
ancestors(element: ElementOrFqn$1): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1183
|
+
descendants(element: ElementOrFqn$1): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1184
|
+
incoming(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1185
|
+
incomers(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1236
1186
|
/**
|
|
1237
1187
|
* Outgoing relationships from the element and its descendants
|
|
1238
1188
|
*/
|
|
1239
|
-
outgoing(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<
|
|
1240
|
-
outgoers(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<
|
|
1189
|
+
outgoing(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1190
|
+
outgoers(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1191
|
+
}
|
|
1192
|
+
declare namespace LikeC4ViewModel {
|
|
1193
|
+
/**
|
|
1194
|
+
* Represents an element in the view. (Diagram node)
|
|
1195
|
+
* All methods are view-scoped, i.e. `children` returns only children of the element in the view.
|
|
1196
|
+
*/
|
|
1197
|
+
class Element {
|
|
1198
|
+
readonly node: ComputedNode;
|
|
1199
|
+
private viewmodel;
|
|
1200
|
+
constructor(node: ComputedNode, viewmodel: LikeC4ViewModel);
|
|
1201
|
+
get id(): NodeId;
|
|
1202
|
+
get title(): string;
|
|
1203
|
+
get kind(): ElementKind$1;
|
|
1204
|
+
get isRoot(): boolean;
|
|
1205
|
+
get hasNested(): boolean;
|
|
1206
|
+
get shape(): ElementShape$1;
|
|
1207
|
+
get color(): ThemeColor$1;
|
|
1208
|
+
get tags(): Tag$1[];
|
|
1209
|
+
model(): LikeC4Model.Element;
|
|
1210
|
+
parent(): LikeC4ViewModel.Element | null;
|
|
1211
|
+
metadata(key: string): string | undefined;
|
|
1212
|
+
metadata(key: string, defaultValue: string): string;
|
|
1213
|
+
hasMetadata(key: string): boolean;
|
|
1214
|
+
ancestors(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1215
|
+
siblings(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1216
|
+
descendants(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1217
|
+
children(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1218
|
+
incoming(filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1219
|
+
incomers(filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1220
|
+
outgoing(filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1221
|
+
outgoers(filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1222
|
+
connectionsTo(target: Fqn | LikeC4ViewModel.Element): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Represents a connection between two elements.
|
|
1226
|
+
* May be source from multiple model relationships.
|
|
1227
|
+
*/
|
|
1228
|
+
class Connection {
|
|
1229
|
+
readonly edge: ComputedEdge;
|
|
1230
|
+
private viewmodel;
|
|
1231
|
+
constructor(edge: ComputedEdge, viewmodel: LikeC4ViewModel);
|
|
1232
|
+
get id(): EdgeId$1;
|
|
1233
|
+
get source(): LikeC4ViewModel.Element;
|
|
1234
|
+
get target(): LikeC4ViewModel.Element;
|
|
1235
|
+
get tags(): Tag$1[];
|
|
1236
|
+
/**
|
|
1237
|
+
* Model relationships
|
|
1238
|
+
*/
|
|
1239
|
+
relationships(): ReadonlyArray<LikeC4Model.Relationship>;
|
|
1240
|
+
}
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
1243
|
type ElementOrFqn = Fqn | LikeC4Model.Element;
|
|
@@ -1269,11 +1269,11 @@ declare class LikeC4Model {
|
|
|
1269
1269
|
/**
|
|
1270
1270
|
* Returns all views in the model.
|
|
1271
1271
|
*/
|
|
1272
|
-
views(): ReadonlyArray<
|
|
1272
|
+
views(): ReadonlyArray<LikeC4ViewModel>;
|
|
1273
1273
|
/**
|
|
1274
1274
|
* Returns a specific view by its ID.
|
|
1275
1275
|
*/
|
|
1276
|
-
view(viewId: ViewID):
|
|
1276
|
+
view(viewId: ViewID): LikeC4ViewModel;
|
|
1277
1277
|
/**
|
|
1278
1278
|
* Returns the parent element of a given element.
|
|
1279
1279
|
*/
|
|
@@ -1294,7 +1294,6 @@ declare class LikeC4Model {
|
|
|
1294
1294
|
descendants(element: ElementOrFqn): ReadonlyArray<LikeC4Model.Element>;
|
|
1295
1295
|
/**
|
|
1296
1296
|
* Incoming relationships to the element and its descendants
|
|
1297
|
-
* @param onlyDirect - only direct incoming relationships, ignore descendants
|
|
1298
1297
|
*/
|
|
1299
1298
|
incoming(element: ElementOrFqn, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4Model.Relationship>;
|
|
1300
1299
|
/**
|
|
@@ -1321,7 +1320,7 @@ declare class LikeC4Model {
|
|
|
1321
1320
|
/**
|
|
1322
1321
|
* Resolve all views that contain the element
|
|
1323
1322
|
*/
|
|
1324
|
-
viewsWithElement(element: ElementOrFqn): ReadonlyArray<
|
|
1323
|
+
viewsWithElement(element: ElementOrFqn): ReadonlyArray<LikeC4ViewModel>;
|
|
1325
1324
|
private addElement;
|
|
1326
1325
|
private addRelation;
|
|
1327
1326
|
private _childrenOf;
|
|
@@ -1353,7 +1352,7 @@ declare namespace LikeC4Model {
|
|
|
1353
1352
|
/**
|
|
1354
1353
|
* Views that contain this element
|
|
1355
1354
|
*/
|
|
1356
|
-
views(): readonly
|
|
1355
|
+
views(): readonly LikeC4ViewModel[];
|
|
1357
1356
|
incoming(filter?: 'all' | 'direct' | 'to-descendants'): readonly Relationship[];
|
|
1358
1357
|
incomers(filter?: 'all' | 'direct' | 'to-descendants'): readonly Element[];
|
|
1359
1358
|
outgoing(filter?: 'all' | 'direct' | 'from-descendants'): readonly Relationship[];
|
|
@@ -4229,6 +4228,68 @@ declare namespace WorkspaceFolder {
|
|
|
4229
4228
|
function is(value: any): value is WorkspaceFolder;
|
|
4230
4229
|
}
|
|
4231
4230
|
|
|
4231
|
+
/**
|
|
4232
|
+
* @hidden
|
|
4233
|
+
*/
|
|
4234
|
+
type $keywords<T extends string> = {
|
|
4235
|
+
[key in T]: key;
|
|
4236
|
+
};
|
|
4237
|
+
|
|
4238
|
+
declare module 'ts-graphviz' {
|
|
4239
|
+
namespace ClusterSubgraphAttributeKey {
|
|
4240
|
+
interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
namespace NodeAttributeKey {
|
|
4244
|
+
interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level'> {
|
|
4245
|
+
}
|
|
4246
|
+
}
|
|
4247
|
+
namespace EdgeAttributeKey {
|
|
4248
|
+
interface $values extends $keywords<'likec4_id'> {
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4251
|
+
namespace Attribute {
|
|
4252
|
+
interface $keys extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {
|
|
4253
|
+
}
|
|
4254
|
+
interface $types {
|
|
4255
|
+
likec4_type: 'folder' | 'file' | 'view';
|
|
4256
|
+
likec4_path: string;
|
|
4257
|
+
likec4_id: string;
|
|
4258
|
+
likec4_level: number;
|
|
4259
|
+
likec4_depth: number;
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
}
|
|
4263
|
+
type DotSource = Tagged<string, 'DotSource'>;
|
|
4264
|
+
type DotLayoutResult = {
|
|
4265
|
+
dot: DotSource;
|
|
4266
|
+
diagram: DiagramView;
|
|
4267
|
+
};
|
|
4268
|
+
|
|
4269
|
+
interface GraphvizPort {
|
|
4270
|
+
unflatten(dot: DotSource): Promise<DotSource>;
|
|
4271
|
+
acyclic(dot: DotSource): Promise<DotSource>;
|
|
4272
|
+
layoutJson(dot: DotSource): Promise<string>;
|
|
4273
|
+
svg(dot: DotSource): Promise<string>;
|
|
4274
|
+
}
|
|
4275
|
+
type LayoutResult = {
|
|
4276
|
+
dot: DotSource;
|
|
4277
|
+
diagram: DiagramView;
|
|
4278
|
+
};
|
|
4279
|
+
declare class GraphvizLayouter {
|
|
4280
|
+
private graphviz;
|
|
4281
|
+
constructor(graphviz: GraphvizPort);
|
|
4282
|
+
get port(): GraphvizPort;
|
|
4283
|
+
changePort(graphviz: GraphvizPort): void;
|
|
4284
|
+
layout(view: ComputedView): Promise<LayoutResult>;
|
|
4285
|
+
svg(view: ComputedView): Promise<{
|
|
4286
|
+
svg: string;
|
|
4287
|
+
dot: DotSource;
|
|
4288
|
+
}>;
|
|
4289
|
+
dot(computedView: ComputedView): Promise<DotSource>;
|
|
4290
|
+
layoutOverviewGraph(views: ComputedView[]): Promise<OverviewGraph>;
|
|
4291
|
+
}
|
|
4292
|
+
|
|
4232
4293
|
type ParserMethod<ARGS extends unknown[], R> = (...args: ARGS) => R;
|
|
4233
4294
|
|
|
4234
4295
|
/**
|
|
@@ -16101,68 +16162,6 @@ declare class LikeC4ModelParser {
|
|
|
16101
16162
|
private convertLinks;
|
|
16102
16163
|
}
|
|
16103
16164
|
|
|
16104
|
-
/**
|
|
16105
|
-
* @hidden
|
|
16106
|
-
*/
|
|
16107
|
-
type $keywords<T extends string> = {
|
|
16108
|
-
[key in T]: key;
|
|
16109
|
-
};
|
|
16110
|
-
|
|
16111
|
-
declare module 'ts-graphviz' {
|
|
16112
|
-
namespace ClusterSubgraphAttributeKey {
|
|
16113
|
-
interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {
|
|
16114
|
-
}
|
|
16115
|
-
}
|
|
16116
|
-
namespace NodeAttributeKey {
|
|
16117
|
-
interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level'> {
|
|
16118
|
-
}
|
|
16119
|
-
}
|
|
16120
|
-
namespace EdgeAttributeKey {
|
|
16121
|
-
interface $values extends $keywords<'likec4_id'> {
|
|
16122
|
-
}
|
|
16123
|
-
}
|
|
16124
|
-
namespace Attribute {
|
|
16125
|
-
interface $keys extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {
|
|
16126
|
-
}
|
|
16127
|
-
interface $types {
|
|
16128
|
-
likec4_type: 'folder' | 'file' | 'view';
|
|
16129
|
-
likec4_path: string;
|
|
16130
|
-
likec4_id: string;
|
|
16131
|
-
likec4_level: number;
|
|
16132
|
-
likec4_depth: number;
|
|
16133
|
-
}
|
|
16134
|
-
}
|
|
16135
|
-
}
|
|
16136
|
-
type DotSource = Tagged<string, 'DotSource'>;
|
|
16137
|
-
type DotLayoutResult = {
|
|
16138
|
-
dot: DotSource;
|
|
16139
|
-
diagram: DiagramView;
|
|
16140
|
-
};
|
|
16141
|
-
|
|
16142
|
-
interface GraphvizPort {
|
|
16143
|
-
unflatten(dot: DotSource): Promise<DotSource>;
|
|
16144
|
-
acyclic(dot: DotSource): Promise<DotSource>;
|
|
16145
|
-
layoutJson(dot: DotSource): Promise<string>;
|
|
16146
|
-
svg(dot: DotSource): Promise<string>;
|
|
16147
|
-
}
|
|
16148
|
-
type LayoutResult = {
|
|
16149
|
-
dot: DotSource;
|
|
16150
|
-
diagram: DiagramView;
|
|
16151
|
-
};
|
|
16152
|
-
declare class GraphvizLayouter {
|
|
16153
|
-
private graphviz;
|
|
16154
|
-
constructor(graphviz: GraphvizPort);
|
|
16155
|
-
get port(): GraphvizPort;
|
|
16156
|
-
changePort(graphviz: GraphvizPort): void;
|
|
16157
|
-
layout(view: ComputedView): Promise<LayoutResult>;
|
|
16158
|
-
svg(view: ComputedView): Promise<{
|
|
16159
|
-
svg: string;
|
|
16160
|
-
dot: DotSource;
|
|
16161
|
-
}>;
|
|
16162
|
-
dot(computedView: ComputedView): Promise<DotSource>;
|
|
16163
|
-
layoutOverviewGraph(views: ComputedView[]): Promise<OverviewGraph>;
|
|
16164
|
-
}
|
|
16165
|
-
|
|
16166
16165
|
// This definition file follows a somewhat unusual format. ESTree allows
|
|
16167
16166
|
// runtime type checks based on the `type` parameter. In order to explain this
|
|
16168
16167
|
// to typescript we want to use discriminated union types:
|
|
@@ -16777,6 +16776,26 @@ type Logger = {
|
|
|
16777
16776
|
error(err: unknown): void;
|
|
16778
16777
|
};
|
|
16779
16778
|
|
|
16779
|
+
declare class CliWorkspace {
|
|
16780
|
+
private services;
|
|
16781
|
+
private isInitialized;
|
|
16782
|
+
constructor(services: CliServices);
|
|
16783
|
+
initForWorkspace(workspacePath: string): Promise<void>;
|
|
16784
|
+
init(): Promise<void>;
|
|
16785
|
+
}
|
|
16786
|
+
|
|
16787
|
+
type CliAddedServices = {
|
|
16788
|
+
logger: Logger;
|
|
16789
|
+
likec4: {
|
|
16790
|
+
Layouter: GraphvizLayouter;
|
|
16791
|
+
Views: Views;
|
|
16792
|
+
};
|
|
16793
|
+
cli: {
|
|
16794
|
+
Workspace: CliWorkspace;
|
|
16795
|
+
};
|
|
16796
|
+
};
|
|
16797
|
+
type CliServices = LikeC4Services & CliAddedServices;
|
|
16798
|
+
|
|
16780
16799
|
type GraphvizOut = {
|
|
16781
16800
|
id: ViewID$1;
|
|
16782
16801
|
dot: DotSource;
|
|
@@ -16797,51 +16816,33 @@ declare class Views {
|
|
|
16797
16816
|
overviewGraph(): Promise<OverviewGraph>;
|
|
16798
16817
|
}
|
|
16799
16818
|
|
|
16800
|
-
|
|
16801
|
-
private services;
|
|
16802
|
-
private isInitialized;
|
|
16803
|
-
constructor(services: CliServices);
|
|
16804
|
-
initForWorkspace(workspacePath: string): Promise<void>;
|
|
16805
|
-
init(): Promise<void>;
|
|
16806
|
-
}
|
|
16807
|
-
|
|
16808
|
-
type CliAddedServices = {
|
|
16809
|
-
logger: Logger;
|
|
16810
|
-
likec4: {
|
|
16811
|
-
Layouter: GraphvizLayouter;
|
|
16812
|
-
Views: Views;
|
|
16813
|
-
};
|
|
16814
|
-
cli: {
|
|
16815
|
-
Workspace: CliWorkspace;
|
|
16816
|
-
};
|
|
16817
|
-
};
|
|
16818
|
-
type CliServices = LikeC4Services & CliAddedServices;
|
|
16819
|
-
type CreateLanguageServiceOptions = {
|
|
16819
|
+
type LikeC4Options = {
|
|
16820
16820
|
/**
|
|
16821
|
-
*
|
|
16822
|
-
*
|
|
16821
|
+
* If true, initialization will return rejected promise with the LikeC4 instance.
|
|
16822
|
+
* Use `likec4.getErrors()` to get the errors.
|
|
16823
|
+
* @default false
|
|
16823
16824
|
*/
|
|
16824
|
-
|
|
16825
|
+
throwIfInvalid?: boolean;
|
|
16825
16826
|
/**
|
|
16826
16827
|
* Logger to use for the language service.
|
|
16828
|
+
* @default 'default'
|
|
16827
16829
|
*/
|
|
16828
16830
|
logger?: Logger | 'vite' | 'default';
|
|
16829
16831
|
/**
|
|
16830
16832
|
* Whether to use the `dot` binary for layouting or the WebAssembly version.
|
|
16831
|
-
*
|
|
16833
|
+
* @default 'wasm'
|
|
16832
16834
|
*/
|
|
16833
16835
|
graphviz?: 'wasm' | 'binary';
|
|
16834
16836
|
};
|
|
16835
|
-
|
|
16836
16837
|
declare class LikeC4 {
|
|
16837
16838
|
readonly workspace: string;
|
|
16838
16839
|
private langium;
|
|
16839
|
-
static
|
|
16840
|
+
static fromSource(likec4SourceCode: string, opts?: LikeC4Options): Promise<LikeC4>;
|
|
16840
16841
|
/**
|
|
16841
16842
|
* Prevents multiple instances of LikeC4 for the same workspace
|
|
16842
16843
|
*/
|
|
16843
16844
|
private static likec4Instances;
|
|
16844
|
-
static
|
|
16845
|
+
static fromWorkspace(path: string, opts?: LikeC4Options): Promise<LikeC4>;
|
|
16845
16846
|
private cache;
|
|
16846
16847
|
private logger;
|
|
16847
16848
|
private langiumDocuments;
|
|
@@ -16866,4 +16867,4 @@ declare class LikeC4 {
|
|
|
16866
16867
|
dispose(): void;
|
|
16867
16868
|
}
|
|
16868
16869
|
|
|
16869
|
-
export { type AndOperator, AsFqn, type AutoLayoutDirection, type BBox, type BasicElementView, type BasicView, type BorderStyle, BorderStyles, type ColorLiteral, type ComputedDynamicView, type ComputedEdge, type ComputedElementView, type ComputedLikeC4Model, type ComputedNode, type ComputedView, type CustomElementExpr, type CustomRelationExpr, DefaultArrowType, DefaultElementShape, DefaultLineStyle, DefaultRelationshipColor, DefaultThemeColor, type DiagramEdge, type DiagramNode, type DiagramView, type DynamicView$1 as DynamicView, type DynamicViewIncludeRule, type DynamicViewRule$1 as DynamicViewRule, type DynamicViewStep$1 as DynamicViewStep, type EdgeId$1 as EdgeId, type Element$1 as Element, type ElementExpression$1 as ElementExpression, type ElementKind$1 as ElementKind, type ElementKindExpr, type ElementKindSpecification, type ElementKindSpecificationStyle, type ElementNotation, type ElementPredicateExpression, type ElementRefExpr, type ElementShape$1 as ElementShape, ElementShapes, type ElementStyle, type ElementTagExpr, type ElementThemeColorValues, type ElementThemeColors, type ElementView$1 as ElementView, type ElementWhereExpr, type EqualOperator, type ExpandedElementExpr, expression as Expr, type Expression$1 as Expression, type ExtendsElementView, type Fqn$1 as Fqn, type HexColorLiteral, type IconUrl, type InOutExpr, type IncomingExpr, type KindEqual, LikeC4, LikeC4Model, type LikeC4Theme, type LikeC4View$1 as LikeC4View, type Link, type NodeId, type NonEmptyArray, type NotOperator, type OrOperator, type OutgoingExpr, OverviewGraph, type ParsedLikeC4Model, type Point, type Relation$1 as Relation, type RelationExpr, type RelationExpression$1 as RelationExpression, type RelationID$1 as RelationID, type RelationPredicateExpression, type RelationWhereExpr, type RelationshipArrowType, type RelationshipKind$1 as RelationshipKind, type RelationshipKindSpecification, type RelationshipLineType, type RelationshipThemeColorValues, type RelationshipThemeColors, type ScopedElementView, StepEdgeId, type StepEdgeIdLiteral, type Tag$1 as Tag, type TagEqual, type TagSpec, type ThemeColor$1 as ThemeColor, ViewChange,
|
|
16870
|
+
export { type AndOperator, AsFqn, type AutoLayoutDirection, type BBox, type BasicElementView, type BasicView, type BorderStyle, BorderStyles, type ColorLiteral, type ComputedDynamicView, type ComputedEdge, type ComputedElementView, type ComputedLikeC4Model, type ComputedNode, type ComputedView, type CustomElementExpr, type CustomRelationExpr, DefaultArrowType, DefaultElementShape, DefaultLineStyle, DefaultRelationshipColor, DefaultThemeColor, type DiagramEdge, type DiagramNode, type DiagramView, type DynamicView$1 as DynamicView, type DynamicViewIncludeRule, type DynamicViewRule$1 as DynamicViewRule, type DynamicViewStep$1 as DynamicViewStep, type EdgeId$1 as EdgeId, type Element$1 as Element, type ElementExpression$1 as ElementExpression, type ElementKind$1 as ElementKind, type ElementKindExpr, type ElementKindSpecification, type ElementKindSpecificationStyle, type ElementNotation, type ElementPredicateExpression, type ElementRefExpr, type ElementShape$1 as ElementShape, ElementShapes, type ElementStyle, type ElementTagExpr, type ElementThemeColorValues, type ElementThemeColors, type ElementView$1 as ElementView, type ElementWhereExpr, type EqualOperator, type ExpandedElementExpr, expression as Expr, type Expression$1 as Expression, type ExtendsElementView, type Fqn$1 as Fqn, type HexColorLiteral, type IconUrl, type InOutExpr, type IncomingExpr, type KindEqual, LikeC4, LikeC4Model, type LikeC4Theme, type LikeC4View$1 as LikeC4View, LikeC4ViewModel, type Link, type NodeId, type NonEmptyArray, type NotOperator, type OrOperator, type OutgoingExpr, OverviewGraph, type ParsedLikeC4Model, type Point, type Relation$1 as Relation, type RelationExpr, type RelationExpression$1 as RelationExpression, type RelationID$1 as RelationID, type RelationPredicateExpression, type RelationWhereExpr, type RelationshipArrowType, type RelationshipKind$1 as RelationshipKind, type RelationshipKindSpecification, type RelationshipLineType, type RelationshipThemeColorValues, type RelationshipThemeColors, type ScopedElementView, StepEdgeId, type StepEdgeIdLiteral, type Tag$1 as Tag, type TagEqual, type TagSpec, type ThemeColor$1 as ThemeColor, ViewChange, type ViewID$1 as ViewID, type ViewManualLayout, type ViewRule$1 as ViewRule, type ViewRuleAutoLayout$1 as ViewRuleAutoLayout, type ViewRulePredicate$1 as ViewRulePredicate, type ViewRuleStyle$1 as ViewRuleStyle, type ViewWithHash, type ViewWithNotation, type WhereOperator, type WildcardExpr, type XYPoint, extractStep, getBBoxCenter, isAndOperator, isComputedDynamicView, isComputedElementView, isCustomElement, isCustomRelationExpr, isDynamicView, isDynamicViewIncludeRule, isElement, isElementKindExpr, isElementPredicateExpr, isElementRef, isElementTagExpr, isElementView, isElementWhere, isExpandedElementExpr, isExtendsElementView, isInOut, isIncoming, isKindEqual, isNotOperator, isOrOperator, isOutgoing, isRelation, isRelationExpression, isRelationPredicateExpr, isRelationWhere, isScopedElementView, isStepEdgeId, isTagEqual, isViewRuleAutoLayout, isViewRulePredicate, isViewRuleStyle, isWildcard, whereOperatorAsPredicate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1152,61 +1152,11 @@ type RelationID = LiteralUnion<RelationID$1, string>;
|
|
|
1152
1152
|
type ViewID = LiteralUnion<ViewID$1, string>;
|
|
1153
1153
|
type EdgeId = LiteralUnion<EdgeId$1, string>;
|
|
1154
1154
|
|
|
1155
|
-
|
|
1156
|
-
* Represents an element in the view. (Diagram node)
|
|
1157
|
-
* All methods are view-scoped, i.e. `children` returns only children of the element in the view.
|
|
1158
|
-
*/
|
|
1159
|
-
declare class ViewElement {
|
|
1160
|
-
readonly node: ComputedNode;
|
|
1161
|
-
private viewmodel;
|
|
1162
|
-
constructor(node: ComputedNode, viewmodel: ViewModel);
|
|
1163
|
-
get id(): NodeId;
|
|
1164
|
-
get title(): string;
|
|
1165
|
-
get kind(): ElementKind$1;
|
|
1166
|
-
get isRoot(): boolean;
|
|
1167
|
-
get hasNested(): boolean;
|
|
1168
|
-
get shape(): ElementShape$1;
|
|
1169
|
-
get color(): ThemeColor$1;
|
|
1170
|
-
get tags(): Tag$1[];
|
|
1171
|
-
model(): LikeC4Model.Element;
|
|
1172
|
-
parent(): ViewElement | null;
|
|
1173
|
-
metadata(key: string): string | undefined;
|
|
1174
|
-
metadata(key: string, defaultValue: string): string;
|
|
1175
|
-
hasMetadata(key: string): boolean;
|
|
1176
|
-
ancestors(): ReadonlyArray<ViewElement>;
|
|
1177
|
-
siblings(): ReadonlyArray<ViewElement>;
|
|
1178
|
-
descendants(): ReadonlyArray<ViewElement>;
|
|
1179
|
-
children(): ReadonlyArray<ViewElement>;
|
|
1180
|
-
incoming(filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<ViewConnection>;
|
|
1181
|
-
incomers(filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<ViewElement>;
|
|
1182
|
-
outgoing(filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<ViewConnection>;
|
|
1183
|
-
outgoers(filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<ViewElement>;
|
|
1184
|
-
connectionsTo(target: Fqn | ViewElement): ReadonlyArray<ViewConnection>;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* Represents a connection between two elements.
|
|
1189
|
-
* May be source from multiple model relationships.
|
|
1190
|
-
*/
|
|
1191
|
-
declare class ViewConnection {
|
|
1192
|
-
readonly edge: ComputedEdge;
|
|
1193
|
-
private viewmodel;
|
|
1194
|
-
constructor(edge: ComputedEdge, viewmodel: ViewModel);
|
|
1195
|
-
get id(): EdgeId$1;
|
|
1196
|
-
get source(): ViewElement;
|
|
1197
|
-
get target(): ViewElement;
|
|
1198
|
-
get tags(): Tag$1[];
|
|
1199
|
-
/**
|
|
1200
|
-
* Model relationships
|
|
1201
|
-
*/
|
|
1202
|
-
relationships(): ReadonlyArray<LikeC4Model.Relationship>;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
type ElementOrFqn$1 = Fqn | ViewElement;
|
|
1155
|
+
type ElementOrFqn$1 = Fqn | LikeC4ViewModel.Element;
|
|
1206
1156
|
/**
|
|
1207
1157
|
* All methods are view-scoped, i.e. only return elements and connections in the view.
|
|
1208
1158
|
*/
|
|
1209
|
-
declare class
|
|
1159
|
+
declare class LikeC4ViewModel {
|
|
1210
1160
|
#private;
|
|
1211
1161
|
readonly view: ComputedView;
|
|
1212
1162
|
readonly model: LikeC4Model;
|
|
@@ -1215,29 +1165,79 @@ declare class ViewModel {
|
|
|
1215
1165
|
get title(): string;
|
|
1216
1166
|
get viewOf(): LikeC4Model.Element;
|
|
1217
1167
|
get tags(): Tag$1[];
|
|
1218
|
-
roots(): ReadonlyArray<
|
|
1219
|
-
elements(): ReadonlyArray<
|
|
1220
|
-
element(id: Fqn):
|
|
1168
|
+
roots(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1169
|
+
elements(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1170
|
+
element(id: Fqn): LikeC4ViewModel.Element;
|
|
1221
1171
|
hasElement(id: Fqn): boolean;
|
|
1222
|
-
connections(): ReadonlyArray<
|
|
1223
|
-
connection(id: EdgeId):
|
|
1224
|
-
findConnections(source: ElementOrFqn$1, target: ElementOrFqn$1, direction?: 'both' | 'direct'): ReadonlyArray<
|
|
1225
|
-
parent(element: ElementOrFqn$1):
|
|
1226
|
-
children(element: ElementOrFqn$1): ReadonlyArray<
|
|
1227
|
-
siblings(element: ElementOrFqn$1): ReadonlyArray<
|
|
1172
|
+
connections(): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1173
|
+
connection(id: EdgeId): LikeC4ViewModel.Connection;
|
|
1174
|
+
findConnections(source: ElementOrFqn$1, target: ElementOrFqn$1, direction?: 'both' | 'direct'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1175
|
+
parent(element: ElementOrFqn$1): LikeC4ViewModel.Element | null;
|
|
1176
|
+
children(element: ElementOrFqn$1): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1177
|
+
siblings(element: ElementOrFqn$1): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1228
1178
|
/**
|
|
1229
1179
|
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
1230
1180
|
* (from closest to root)
|
|
1231
1181
|
*/
|
|
1232
|
-
ancestors(element: ElementOrFqn$1): ReadonlyArray<
|
|
1233
|
-
descendants(element: ElementOrFqn$1): ReadonlyArray<
|
|
1234
|
-
incoming(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<
|
|
1235
|
-
incomers(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<
|
|
1182
|
+
ancestors(element: ElementOrFqn$1): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1183
|
+
descendants(element: ElementOrFqn$1): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1184
|
+
incoming(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1185
|
+
incomers(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1236
1186
|
/**
|
|
1237
1187
|
* Outgoing relationships from the element and its descendants
|
|
1238
1188
|
*/
|
|
1239
|
-
outgoing(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<
|
|
1240
|
-
outgoers(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<
|
|
1189
|
+
outgoing(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1190
|
+
outgoers(element: ElementOrFqn$1, filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1191
|
+
}
|
|
1192
|
+
declare namespace LikeC4ViewModel {
|
|
1193
|
+
/**
|
|
1194
|
+
* Represents an element in the view. (Diagram node)
|
|
1195
|
+
* All methods are view-scoped, i.e. `children` returns only children of the element in the view.
|
|
1196
|
+
*/
|
|
1197
|
+
class Element {
|
|
1198
|
+
readonly node: ComputedNode;
|
|
1199
|
+
private viewmodel;
|
|
1200
|
+
constructor(node: ComputedNode, viewmodel: LikeC4ViewModel);
|
|
1201
|
+
get id(): NodeId;
|
|
1202
|
+
get title(): string;
|
|
1203
|
+
get kind(): ElementKind$1;
|
|
1204
|
+
get isRoot(): boolean;
|
|
1205
|
+
get hasNested(): boolean;
|
|
1206
|
+
get shape(): ElementShape$1;
|
|
1207
|
+
get color(): ThemeColor$1;
|
|
1208
|
+
get tags(): Tag$1[];
|
|
1209
|
+
model(): LikeC4Model.Element;
|
|
1210
|
+
parent(): LikeC4ViewModel.Element | null;
|
|
1211
|
+
metadata(key: string): string | undefined;
|
|
1212
|
+
metadata(key: string, defaultValue: string): string;
|
|
1213
|
+
hasMetadata(key: string): boolean;
|
|
1214
|
+
ancestors(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1215
|
+
siblings(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1216
|
+
descendants(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1217
|
+
children(): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1218
|
+
incoming(filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1219
|
+
incomers(filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1220
|
+
outgoing(filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1221
|
+
outgoers(filter?: 'all' | 'direct' | 'from-descendants'): ReadonlyArray<LikeC4ViewModel.Element>;
|
|
1222
|
+
connectionsTo(target: Fqn | LikeC4ViewModel.Element): ReadonlyArray<LikeC4ViewModel.Connection>;
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Represents a connection between two elements.
|
|
1226
|
+
* May be source from multiple model relationships.
|
|
1227
|
+
*/
|
|
1228
|
+
class Connection {
|
|
1229
|
+
readonly edge: ComputedEdge;
|
|
1230
|
+
private viewmodel;
|
|
1231
|
+
constructor(edge: ComputedEdge, viewmodel: LikeC4ViewModel);
|
|
1232
|
+
get id(): EdgeId$1;
|
|
1233
|
+
get source(): LikeC4ViewModel.Element;
|
|
1234
|
+
get target(): LikeC4ViewModel.Element;
|
|
1235
|
+
get tags(): Tag$1[];
|
|
1236
|
+
/**
|
|
1237
|
+
* Model relationships
|
|
1238
|
+
*/
|
|
1239
|
+
relationships(): ReadonlyArray<LikeC4Model.Relationship>;
|
|
1240
|
+
}
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
1243
|
type ElementOrFqn = Fqn | LikeC4Model.Element;
|
|
@@ -1269,11 +1269,11 @@ declare class LikeC4Model {
|
|
|
1269
1269
|
/**
|
|
1270
1270
|
* Returns all views in the model.
|
|
1271
1271
|
*/
|
|
1272
|
-
views(): ReadonlyArray<
|
|
1272
|
+
views(): ReadonlyArray<LikeC4ViewModel>;
|
|
1273
1273
|
/**
|
|
1274
1274
|
* Returns a specific view by its ID.
|
|
1275
1275
|
*/
|
|
1276
|
-
view(viewId: ViewID):
|
|
1276
|
+
view(viewId: ViewID): LikeC4ViewModel;
|
|
1277
1277
|
/**
|
|
1278
1278
|
* Returns the parent element of a given element.
|
|
1279
1279
|
*/
|
|
@@ -1294,7 +1294,6 @@ declare class LikeC4Model {
|
|
|
1294
1294
|
descendants(element: ElementOrFqn): ReadonlyArray<LikeC4Model.Element>;
|
|
1295
1295
|
/**
|
|
1296
1296
|
* Incoming relationships to the element and its descendants
|
|
1297
|
-
* @param onlyDirect - only direct incoming relationships, ignore descendants
|
|
1298
1297
|
*/
|
|
1299
1298
|
incoming(element: ElementOrFqn, filter?: 'all' | 'direct' | 'to-descendants'): ReadonlyArray<LikeC4Model.Relationship>;
|
|
1300
1299
|
/**
|
|
@@ -1321,7 +1320,7 @@ declare class LikeC4Model {
|
|
|
1321
1320
|
/**
|
|
1322
1321
|
* Resolve all views that contain the element
|
|
1323
1322
|
*/
|
|
1324
|
-
viewsWithElement(element: ElementOrFqn): ReadonlyArray<
|
|
1323
|
+
viewsWithElement(element: ElementOrFqn): ReadonlyArray<LikeC4ViewModel>;
|
|
1325
1324
|
private addElement;
|
|
1326
1325
|
private addRelation;
|
|
1327
1326
|
private _childrenOf;
|
|
@@ -1353,7 +1352,7 @@ declare namespace LikeC4Model {
|
|
|
1353
1352
|
/**
|
|
1354
1353
|
* Views that contain this element
|
|
1355
1354
|
*/
|
|
1356
|
-
views(): readonly
|
|
1355
|
+
views(): readonly LikeC4ViewModel[];
|
|
1357
1356
|
incoming(filter?: 'all' | 'direct' | 'to-descendants'): readonly Relationship[];
|
|
1358
1357
|
incomers(filter?: 'all' | 'direct' | 'to-descendants'): readonly Element[];
|
|
1359
1358
|
outgoing(filter?: 'all' | 'direct' | 'from-descendants'): readonly Relationship[];
|
|
@@ -4229,6 +4228,68 @@ declare namespace WorkspaceFolder {
|
|
|
4229
4228
|
function is(value: any): value is WorkspaceFolder;
|
|
4230
4229
|
}
|
|
4231
4230
|
|
|
4231
|
+
/**
|
|
4232
|
+
* @hidden
|
|
4233
|
+
*/
|
|
4234
|
+
type $keywords<T extends string> = {
|
|
4235
|
+
[key in T]: key;
|
|
4236
|
+
};
|
|
4237
|
+
|
|
4238
|
+
declare module 'ts-graphviz' {
|
|
4239
|
+
namespace ClusterSubgraphAttributeKey {
|
|
4240
|
+
interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
namespace NodeAttributeKey {
|
|
4244
|
+
interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level'> {
|
|
4245
|
+
}
|
|
4246
|
+
}
|
|
4247
|
+
namespace EdgeAttributeKey {
|
|
4248
|
+
interface $values extends $keywords<'likec4_id'> {
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4251
|
+
namespace Attribute {
|
|
4252
|
+
interface $keys extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {
|
|
4253
|
+
}
|
|
4254
|
+
interface $types {
|
|
4255
|
+
likec4_type: 'folder' | 'file' | 'view';
|
|
4256
|
+
likec4_path: string;
|
|
4257
|
+
likec4_id: string;
|
|
4258
|
+
likec4_level: number;
|
|
4259
|
+
likec4_depth: number;
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
}
|
|
4263
|
+
type DotSource = Tagged<string, 'DotSource'>;
|
|
4264
|
+
type DotLayoutResult = {
|
|
4265
|
+
dot: DotSource;
|
|
4266
|
+
diagram: DiagramView;
|
|
4267
|
+
};
|
|
4268
|
+
|
|
4269
|
+
interface GraphvizPort {
|
|
4270
|
+
unflatten(dot: DotSource): Promise<DotSource>;
|
|
4271
|
+
acyclic(dot: DotSource): Promise<DotSource>;
|
|
4272
|
+
layoutJson(dot: DotSource): Promise<string>;
|
|
4273
|
+
svg(dot: DotSource): Promise<string>;
|
|
4274
|
+
}
|
|
4275
|
+
type LayoutResult = {
|
|
4276
|
+
dot: DotSource;
|
|
4277
|
+
diagram: DiagramView;
|
|
4278
|
+
};
|
|
4279
|
+
declare class GraphvizLayouter {
|
|
4280
|
+
private graphviz;
|
|
4281
|
+
constructor(graphviz: GraphvizPort);
|
|
4282
|
+
get port(): GraphvizPort;
|
|
4283
|
+
changePort(graphviz: GraphvizPort): void;
|
|
4284
|
+
layout(view: ComputedView): Promise<LayoutResult>;
|
|
4285
|
+
svg(view: ComputedView): Promise<{
|
|
4286
|
+
svg: string;
|
|
4287
|
+
dot: DotSource;
|
|
4288
|
+
}>;
|
|
4289
|
+
dot(computedView: ComputedView): Promise<DotSource>;
|
|
4290
|
+
layoutOverviewGraph(views: ComputedView[]): Promise<OverviewGraph>;
|
|
4291
|
+
}
|
|
4292
|
+
|
|
4232
4293
|
type ParserMethod<ARGS extends unknown[], R> = (...args: ARGS) => R;
|
|
4233
4294
|
|
|
4234
4295
|
/**
|
|
@@ -16101,68 +16162,6 @@ declare class LikeC4ModelParser {
|
|
|
16101
16162
|
private convertLinks;
|
|
16102
16163
|
}
|
|
16103
16164
|
|
|
16104
|
-
/**
|
|
16105
|
-
* @hidden
|
|
16106
|
-
*/
|
|
16107
|
-
type $keywords<T extends string> = {
|
|
16108
|
-
[key in T]: key;
|
|
16109
|
-
};
|
|
16110
|
-
|
|
16111
|
-
declare module 'ts-graphviz' {
|
|
16112
|
-
namespace ClusterSubgraphAttributeKey {
|
|
16113
|
-
interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {
|
|
16114
|
-
}
|
|
16115
|
-
}
|
|
16116
|
-
namespace NodeAttributeKey {
|
|
16117
|
-
interface $values extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level'> {
|
|
16118
|
-
}
|
|
16119
|
-
}
|
|
16120
|
-
namespace EdgeAttributeKey {
|
|
16121
|
-
interface $values extends $keywords<'likec4_id'> {
|
|
16122
|
-
}
|
|
16123
|
-
}
|
|
16124
|
-
namespace Attribute {
|
|
16125
|
-
interface $keys extends $keywords<'likec4_type' | 'likec4_path' | 'likec4_id' | 'likec4_level' | 'likec4_depth'> {
|
|
16126
|
-
}
|
|
16127
|
-
interface $types {
|
|
16128
|
-
likec4_type: 'folder' | 'file' | 'view';
|
|
16129
|
-
likec4_path: string;
|
|
16130
|
-
likec4_id: string;
|
|
16131
|
-
likec4_level: number;
|
|
16132
|
-
likec4_depth: number;
|
|
16133
|
-
}
|
|
16134
|
-
}
|
|
16135
|
-
}
|
|
16136
|
-
type DotSource = Tagged<string, 'DotSource'>;
|
|
16137
|
-
type DotLayoutResult = {
|
|
16138
|
-
dot: DotSource;
|
|
16139
|
-
diagram: DiagramView;
|
|
16140
|
-
};
|
|
16141
|
-
|
|
16142
|
-
interface GraphvizPort {
|
|
16143
|
-
unflatten(dot: DotSource): Promise<DotSource>;
|
|
16144
|
-
acyclic(dot: DotSource): Promise<DotSource>;
|
|
16145
|
-
layoutJson(dot: DotSource): Promise<string>;
|
|
16146
|
-
svg(dot: DotSource): Promise<string>;
|
|
16147
|
-
}
|
|
16148
|
-
type LayoutResult = {
|
|
16149
|
-
dot: DotSource;
|
|
16150
|
-
diagram: DiagramView;
|
|
16151
|
-
};
|
|
16152
|
-
declare class GraphvizLayouter {
|
|
16153
|
-
private graphviz;
|
|
16154
|
-
constructor(graphviz: GraphvizPort);
|
|
16155
|
-
get port(): GraphvizPort;
|
|
16156
|
-
changePort(graphviz: GraphvizPort): void;
|
|
16157
|
-
layout(view: ComputedView): Promise<LayoutResult>;
|
|
16158
|
-
svg(view: ComputedView): Promise<{
|
|
16159
|
-
svg: string;
|
|
16160
|
-
dot: DotSource;
|
|
16161
|
-
}>;
|
|
16162
|
-
dot(computedView: ComputedView): Promise<DotSource>;
|
|
16163
|
-
layoutOverviewGraph(views: ComputedView[]): Promise<OverviewGraph>;
|
|
16164
|
-
}
|
|
16165
|
-
|
|
16166
16165
|
// This definition file follows a somewhat unusual format. ESTree allows
|
|
16167
16166
|
// runtime type checks based on the `type` parameter. In order to explain this
|
|
16168
16167
|
// to typescript we want to use discriminated union types:
|
|
@@ -16777,6 +16776,26 @@ type Logger = {
|
|
|
16777
16776
|
error(err: unknown): void;
|
|
16778
16777
|
};
|
|
16779
16778
|
|
|
16779
|
+
declare class CliWorkspace {
|
|
16780
|
+
private services;
|
|
16781
|
+
private isInitialized;
|
|
16782
|
+
constructor(services: CliServices);
|
|
16783
|
+
initForWorkspace(workspacePath: string): Promise<void>;
|
|
16784
|
+
init(): Promise<void>;
|
|
16785
|
+
}
|
|
16786
|
+
|
|
16787
|
+
type CliAddedServices = {
|
|
16788
|
+
logger: Logger;
|
|
16789
|
+
likec4: {
|
|
16790
|
+
Layouter: GraphvizLayouter;
|
|
16791
|
+
Views: Views;
|
|
16792
|
+
};
|
|
16793
|
+
cli: {
|
|
16794
|
+
Workspace: CliWorkspace;
|
|
16795
|
+
};
|
|
16796
|
+
};
|
|
16797
|
+
type CliServices = LikeC4Services & CliAddedServices;
|
|
16798
|
+
|
|
16780
16799
|
type GraphvizOut = {
|
|
16781
16800
|
id: ViewID$1;
|
|
16782
16801
|
dot: DotSource;
|
|
@@ -16797,51 +16816,33 @@ declare class Views {
|
|
|
16797
16816
|
overviewGraph(): Promise<OverviewGraph>;
|
|
16798
16817
|
}
|
|
16799
16818
|
|
|
16800
|
-
|
|
16801
|
-
private services;
|
|
16802
|
-
private isInitialized;
|
|
16803
|
-
constructor(services: CliServices);
|
|
16804
|
-
initForWorkspace(workspacePath: string): Promise<void>;
|
|
16805
|
-
init(): Promise<void>;
|
|
16806
|
-
}
|
|
16807
|
-
|
|
16808
|
-
type CliAddedServices = {
|
|
16809
|
-
logger: Logger;
|
|
16810
|
-
likec4: {
|
|
16811
|
-
Layouter: GraphvizLayouter;
|
|
16812
|
-
Views: Views;
|
|
16813
|
-
};
|
|
16814
|
-
cli: {
|
|
16815
|
-
Workspace: CliWorkspace;
|
|
16816
|
-
};
|
|
16817
|
-
};
|
|
16818
|
-
type CliServices = LikeC4Services & CliAddedServices;
|
|
16819
|
-
type CreateLanguageServiceOptions = {
|
|
16819
|
+
type LikeC4Options = {
|
|
16820
16820
|
/**
|
|
16821
|
-
*
|
|
16822
|
-
*
|
|
16821
|
+
* If true, initialization will return rejected promise with the LikeC4 instance.
|
|
16822
|
+
* Use `likec4.getErrors()` to get the errors.
|
|
16823
|
+
* @default false
|
|
16823
16824
|
*/
|
|
16824
|
-
|
|
16825
|
+
throwIfInvalid?: boolean;
|
|
16825
16826
|
/**
|
|
16826
16827
|
* Logger to use for the language service.
|
|
16828
|
+
* @default 'default'
|
|
16827
16829
|
*/
|
|
16828
16830
|
logger?: Logger | 'vite' | 'default';
|
|
16829
16831
|
/**
|
|
16830
16832
|
* Whether to use the `dot` binary for layouting or the WebAssembly version.
|
|
16831
|
-
*
|
|
16833
|
+
* @default 'wasm'
|
|
16832
16834
|
*/
|
|
16833
16835
|
graphviz?: 'wasm' | 'binary';
|
|
16834
16836
|
};
|
|
16835
|
-
|
|
16836
16837
|
declare class LikeC4 {
|
|
16837
16838
|
readonly workspace: string;
|
|
16838
16839
|
private langium;
|
|
16839
|
-
static
|
|
16840
|
+
static fromSource(likec4SourceCode: string, opts?: LikeC4Options): Promise<LikeC4>;
|
|
16840
16841
|
/**
|
|
16841
16842
|
* Prevents multiple instances of LikeC4 for the same workspace
|
|
16842
16843
|
*/
|
|
16843
16844
|
private static likec4Instances;
|
|
16844
|
-
static
|
|
16845
|
+
static fromWorkspace(path: string, opts?: LikeC4Options): Promise<LikeC4>;
|
|
16845
16846
|
private cache;
|
|
16846
16847
|
private logger;
|
|
16847
16848
|
private langiumDocuments;
|
|
@@ -16866,4 +16867,4 @@ declare class LikeC4 {
|
|
|
16866
16867
|
dispose(): void;
|
|
16867
16868
|
}
|
|
16868
16869
|
|
|
16869
|
-
export { type AndOperator, AsFqn, type AutoLayoutDirection, type BBox, type BasicElementView, type BasicView, type BorderStyle, BorderStyles, type ColorLiteral, type ComputedDynamicView, type ComputedEdge, type ComputedElementView, type ComputedLikeC4Model, type ComputedNode, type ComputedView, type CustomElementExpr, type CustomRelationExpr, DefaultArrowType, DefaultElementShape, DefaultLineStyle, DefaultRelationshipColor, DefaultThemeColor, type DiagramEdge, type DiagramNode, type DiagramView, type DynamicView$1 as DynamicView, type DynamicViewIncludeRule, type DynamicViewRule$1 as DynamicViewRule, type DynamicViewStep$1 as DynamicViewStep, type EdgeId$1 as EdgeId, type Element$1 as Element, type ElementExpression$1 as ElementExpression, type ElementKind$1 as ElementKind, type ElementKindExpr, type ElementKindSpecification, type ElementKindSpecificationStyle, type ElementNotation, type ElementPredicateExpression, type ElementRefExpr, type ElementShape$1 as ElementShape, ElementShapes, type ElementStyle, type ElementTagExpr, type ElementThemeColorValues, type ElementThemeColors, type ElementView$1 as ElementView, type ElementWhereExpr, type EqualOperator, type ExpandedElementExpr, expression as Expr, type Expression$1 as Expression, type ExtendsElementView, type Fqn$1 as Fqn, type HexColorLiteral, type IconUrl, type InOutExpr, type IncomingExpr, type KindEqual, LikeC4, LikeC4Model, type LikeC4Theme, type LikeC4View$1 as LikeC4View, type Link, type NodeId, type NonEmptyArray, type NotOperator, type OrOperator, type OutgoingExpr, OverviewGraph, type ParsedLikeC4Model, type Point, type Relation$1 as Relation, type RelationExpr, type RelationExpression$1 as RelationExpression, type RelationID$1 as RelationID, type RelationPredicateExpression, type RelationWhereExpr, type RelationshipArrowType, type RelationshipKind$1 as RelationshipKind, type RelationshipKindSpecification, type RelationshipLineType, type RelationshipThemeColorValues, type RelationshipThemeColors, type ScopedElementView, StepEdgeId, type StepEdgeIdLiteral, type Tag$1 as Tag, type TagEqual, type TagSpec, type ThemeColor$1 as ThemeColor, ViewChange,
|
|
16870
|
+
export { type AndOperator, AsFqn, type AutoLayoutDirection, type BBox, type BasicElementView, type BasicView, type BorderStyle, BorderStyles, type ColorLiteral, type ComputedDynamicView, type ComputedEdge, type ComputedElementView, type ComputedLikeC4Model, type ComputedNode, type ComputedView, type CustomElementExpr, type CustomRelationExpr, DefaultArrowType, DefaultElementShape, DefaultLineStyle, DefaultRelationshipColor, DefaultThemeColor, type DiagramEdge, type DiagramNode, type DiagramView, type DynamicView$1 as DynamicView, type DynamicViewIncludeRule, type DynamicViewRule$1 as DynamicViewRule, type DynamicViewStep$1 as DynamicViewStep, type EdgeId$1 as EdgeId, type Element$1 as Element, type ElementExpression$1 as ElementExpression, type ElementKind$1 as ElementKind, type ElementKindExpr, type ElementKindSpecification, type ElementKindSpecificationStyle, type ElementNotation, type ElementPredicateExpression, type ElementRefExpr, type ElementShape$1 as ElementShape, ElementShapes, type ElementStyle, type ElementTagExpr, type ElementThemeColorValues, type ElementThemeColors, type ElementView$1 as ElementView, type ElementWhereExpr, type EqualOperator, type ExpandedElementExpr, expression as Expr, type Expression$1 as Expression, type ExtendsElementView, type Fqn$1 as Fqn, type HexColorLiteral, type IconUrl, type InOutExpr, type IncomingExpr, type KindEqual, LikeC4, LikeC4Model, type LikeC4Theme, type LikeC4View$1 as LikeC4View, LikeC4ViewModel, type Link, type NodeId, type NonEmptyArray, type NotOperator, type OrOperator, type OutgoingExpr, OverviewGraph, type ParsedLikeC4Model, type Point, type Relation$1 as Relation, type RelationExpr, type RelationExpression$1 as RelationExpression, type RelationID$1 as RelationID, type RelationPredicateExpression, type RelationWhereExpr, type RelationshipArrowType, type RelationshipKind$1 as RelationshipKind, type RelationshipKindSpecification, type RelationshipLineType, type RelationshipThemeColorValues, type RelationshipThemeColors, type ScopedElementView, StepEdgeId, type StepEdgeIdLiteral, type Tag$1 as Tag, type TagEqual, type TagSpec, type ThemeColor$1 as ThemeColor, ViewChange, type ViewID$1 as ViewID, type ViewManualLayout, type ViewRule$1 as ViewRule, type ViewRuleAutoLayout$1 as ViewRuleAutoLayout, type ViewRulePredicate$1 as ViewRulePredicate, type ViewRuleStyle$1 as ViewRuleStyle, type ViewWithHash, type ViewWithNotation, type WhereOperator, type WildcardExpr, type XYPoint, extractStep, getBBoxCenter, isAndOperator, isComputedDynamicView, isComputedElementView, isCustomElement, isCustomRelationExpr, isDynamicView, isDynamicViewIncludeRule, isElement, isElementKindExpr, isElementPredicateExpr, isElementRef, isElementTagExpr, isElementView, isElementWhere, isExpandedElementExpr, isExtendsElementView, isInOut, isIncoming, isKindEqual, isNotOperator, isOrOperator, isOutgoing, isRelation, isRelationExpression, isRelationPredicateExpr, isRelationWhere, isScopedElementView, isStepEdgeId, isTagEqual, isViewRuleAutoLayout, isViewRulePredicate, isViewRuleStyle, isWildcard, whereOperatorAsPredicate };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{R as AsFqn,T as BorderStyles,D as DefaultArrowType,U as DefaultElementShape,c as DefaultLineStyle,d as DefaultRelationshipColor,V as DefaultThemeColor,W as ElementShapes,e as Expr,L as LikeC4,a as LikeC4Model,b as LikeC4ViewModel,S as StepEdgeId,f as extractStep,g as getBBoxCenter,i as isAndOperator,h as isComputedDynamicView,j as isComputedElementView,k as isCustomElement,l as isCustomRelationExpr,m as isDynamicView,n as isDynamicViewIncludeRule,o as isElement,p as isElementKindExpr,q as isElementPredicateExpr,r as isElementRef,s as isElementTagExpr,t as isElementView,u as isElementWhere,v as isExpandedElementExpr,w as isExtendsElementView,x as isInOut,y as isIncoming,z as isKindEqual,A as isNotOperator,B as isOrOperator,C as isOutgoing,E as isRelation,F as isRelationExpression,G as isRelationPredicateExpr,H as isRelationWhere,I as isScopedElementView,J as isStepEdgeId,K as isTagEqual,M as isViewRuleAutoLayout,N as isViewRulePredicate,O as isViewRuleStyle,P as isWildcard,Q as whereOperatorAsPredicate}from'./shared/likec4.DNb51-HM.mjs';
|
|
@@ -136,111 +136,18 @@ function compareFqnHierarchically(a, b) {
|
|
|
136
136
|
function compareByFqnHierarchically(a, b) {
|
|
137
137
|
return compareFqnHierarchically(a.id, b.id);
|
|
138
138
|
}
|
|
139
|
-
class
|
|
140
|
-
constructor(edge, viewmodel) {
|
|
141
|
-
this.edge = edge;
|
|
142
|
-
this.viewmodel = viewmodel;
|
|
143
|
-
}
|
|
144
|
-
get id() {
|
|
145
|
-
return this.edge.id;
|
|
146
|
-
}
|
|
147
|
-
get source() {
|
|
148
|
-
return this.viewmodel.element(this.edge.source);
|
|
149
|
-
}
|
|
150
|
-
get target() {
|
|
151
|
-
return this.viewmodel.element(this.edge.target);
|
|
152
|
-
}
|
|
153
|
-
get tags() {
|
|
154
|
-
return this.edge.tags ?? [];
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Model relationships
|
|
158
|
-
*/
|
|
159
|
-
relationships() {
|
|
160
|
-
return this.edge.relations.map((r2) => nonNullable(this.viewmodel.model.relationship(r2)));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
class ViewElement {
|
|
164
|
-
constructor(node, viewmodel) {
|
|
165
|
-
this.node = node;
|
|
166
|
-
this.viewmodel = viewmodel;
|
|
167
|
-
}
|
|
168
|
-
get id() {
|
|
169
|
-
return this.node.id;
|
|
170
|
-
}
|
|
171
|
-
get title() {
|
|
172
|
-
return this.node.title;
|
|
173
|
-
}
|
|
174
|
-
get kind() {
|
|
175
|
-
return this.node.kind;
|
|
176
|
-
}
|
|
177
|
-
get isRoot() {
|
|
178
|
-
return e$6(this.node.parent);
|
|
179
|
-
}
|
|
180
|
-
get hasNested() {
|
|
181
|
-
return this.node.children.length > 0;
|
|
182
|
-
}
|
|
183
|
-
get shape() {
|
|
184
|
-
return this.node.shape;
|
|
185
|
-
}
|
|
186
|
-
get color() {
|
|
187
|
-
return this.node.color;
|
|
188
|
-
}
|
|
189
|
-
get tags() {
|
|
190
|
-
return this.node.tags ?? [];
|
|
191
|
-
}
|
|
192
|
-
model() {
|
|
193
|
-
return this.viewmodel.model.element(this.id);
|
|
194
|
-
}
|
|
195
|
-
parent() {
|
|
196
|
-
return this.node.parent ? this.viewmodel.element(this.node.parent) : null;
|
|
197
|
-
}
|
|
198
|
-
metadata(key, defaultValue) {
|
|
199
|
-
return this.model().metadata(key) ?? defaultValue;
|
|
200
|
-
}
|
|
201
|
-
hasMetadata(key) {
|
|
202
|
-
return this.model().hasMetadata(key);
|
|
203
|
-
}
|
|
204
|
-
ancestors() {
|
|
205
|
-
return this.viewmodel.ancestors(this);
|
|
206
|
-
}
|
|
207
|
-
siblings() {
|
|
208
|
-
return this.viewmodel.siblings(this);
|
|
209
|
-
}
|
|
210
|
-
descendants() {
|
|
211
|
-
return this.viewmodel.descendants(this);
|
|
212
|
-
}
|
|
213
|
-
children() {
|
|
214
|
-
return this.viewmodel.children(this);
|
|
215
|
-
}
|
|
216
|
-
incoming(filter = "all") {
|
|
217
|
-
return this.viewmodel.incoming(this, filter);
|
|
218
|
-
}
|
|
219
|
-
incomers(filter = "all") {
|
|
220
|
-
return this.viewmodel.incomers(this, filter);
|
|
221
|
-
}
|
|
222
|
-
outgoing(filter = "all") {
|
|
223
|
-
return this.viewmodel.outgoing(this, filter);
|
|
224
|
-
}
|
|
225
|
-
outgoers(filter = "all") {
|
|
226
|
-
return this.viewmodel.outgoers(this, filter);
|
|
227
|
-
}
|
|
228
|
-
connectionsTo(target) {
|
|
229
|
-
return this.viewmodel.findConnections(this, target);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
class ViewModel {
|
|
139
|
+
class LikeC4ViewModel {
|
|
233
140
|
constructor(view, model) {
|
|
234
141
|
this.view = view;
|
|
235
142
|
this.model = model;
|
|
236
143
|
for (const node of view.nodes) {
|
|
237
|
-
const el = new
|
|
144
|
+
const el = new LikeC4ViewModel.Element(node, this);
|
|
238
145
|
this.#elements.set(node.id, el);
|
|
239
146
|
if (e$6(node.parent)) {
|
|
240
147
|
this.#rootElements.add(el);
|
|
241
148
|
}
|
|
242
149
|
}
|
|
243
|
-
this.#connections = new Map(view.edges.map((e2) => [e2.id, new
|
|
150
|
+
this.#connections = new Map(view.edges.map((e2) => [e2.id, new LikeC4ViewModel.Connection(e2, this)]));
|
|
244
151
|
}
|
|
245
152
|
#rootElements = /* @__PURE__ */ new Set();
|
|
246
153
|
#elements = /* @__PURE__ */ new Map();
|
|
@@ -267,7 +174,7 @@ class ViewModel {
|
|
|
267
174
|
return [...this.#elements.values()];
|
|
268
175
|
}
|
|
269
176
|
element(id) {
|
|
270
|
-
return nonNullable(this.#elements.get(id), `
|
|
177
|
+
return nonNullable(this.#elements.get(id), `LikeC4ViewModel.Element ${id} in view ${this.view.id} not found`);
|
|
271
178
|
}
|
|
272
179
|
hasElement(id) {
|
|
273
180
|
return this.#elements.has(id);
|
|
@@ -354,6 +261,103 @@ class ViewModel {
|
|
|
354
261
|
return this.outgoing(element, filter).map((r2) => r2.target);
|
|
355
262
|
}
|
|
356
263
|
}
|
|
264
|
+
((LikeC4ViewModel2) => {
|
|
265
|
+
class Element {
|
|
266
|
+
constructor(node, viewmodel) {
|
|
267
|
+
this.node = node;
|
|
268
|
+
this.viewmodel = viewmodel;
|
|
269
|
+
}
|
|
270
|
+
get id() {
|
|
271
|
+
return this.node.id;
|
|
272
|
+
}
|
|
273
|
+
get title() {
|
|
274
|
+
return this.node.title;
|
|
275
|
+
}
|
|
276
|
+
get kind() {
|
|
277
|
+
return this.node.kind;
|
|
278
|
+
}
|
|
279
|
+
get isRoot() {
|
|
280
|
+
return e$6(this.node.parent);
|
|
281
|
+
}
|
|
282
|
+
get hasNested() {
|
|
283
|
+
return this.node.children.length > 0;
|
|
284
|
+
}
|
|
285
|
+
get shape() {
|
|
286
|
+
return this.node.shape;
|
|
287
|
+
}
|
|
288
|
+
get color() {
|
|
289
|
+
return this.node.color;
|
|
290
|
+
}
|
|
291
|
+
get tags() {
|
|
292
|
+
return this.node.tags ?? [];
|
|
293
|
+
}
|
|
294
|
+
model() {
|
|
295
|
+
return this.viewmodel.model.element(this.id);
|
|
296
|
+
}
|
|
297
|
+
parent() {
|
|
298
|
+
return this.node.parent ? this.viewmodel.element(this.node.parent) : null;
|
|
299
|
+
}
|
|
300
|
+
metadata(key, defaultValue) {
|
|
301
|
+
return this.model().metadata(key) ?? defaultValue;
|
|
302
|
+
}
|
|
303
|
+
hasMetadata(key) {
|
|
304
|
+
return this.model().hasMetadata(key);
|
|
305
|
+
}
|
|
306
|
+
ancestors() {
|
|
307
|
+
return this.viewmodel.ancestors(this);
|
|
308
|
+
}
|
|
309
|
+
siblings() {
|
|
310
|
+
return this.viewmodel.siblings(this);
|
|
311
|
+
}
|
|
312
|
+
descendants() {
|
|
313
|
+
return this.viewmodel.descendants(this);
|
|
314
|
+
}
|
|
315
|
+
children() {
|
|
316
|
+
return this.viewmodel.children(this);
|
|
317
|
+
}
|
|
318
|
+
incoming(filter = "all") {
|
|
319
|
+
return this.viewmodel.incoming(this, filter);
|
|
320
|
+
}
|
|
321
|
+
incomers(filter = "all") {
|
|
322
|
+
return this.viewmodel.incomers(this, filter);
|
|
323
|
+
}
|
|
324
|
+
outgoing(filter = "all") {
|
|
325
|
+
return this.viewmodel.outgoing(this, filter);
|
|
326
|
+
}
|
|
327
|
+
outgoers(filter = "all") {
|
|
328
|
+
return this.viewmodel.outgoers(this, filter);
|
|
329
|
+
}
|
|
330
|
+
connectionsTo(target) {
|
|
331
|
+
return this.viewmodel.findConnections(this, target);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
LikeC4ViewModel2.Element = Element;
|
|
335
|
+
class Connection {
|
|
336
|
+
constructor(edge, viewmodel) {
|
|
337
|
+
this.edge = edge;
|
|
338
|
+
this.viewmodel = viewmodel;
|
|
339
|
+
}
|
|
340
|
+
get id() {
|
|
341
|
+
return this.edge.id;
|
|
342
|
+
}
|
|
343
|
+
get source() {
|
|
344
|
+
return this.viewmodel.element(this.edge.source);
|
|
345
|
+
}
|
|
346
|
+
get target() {
|
|
347
|
+
return this.viewmodel.element(this.edge.target);
|
|
348
|
+
}
|
|
349
|
+
get tags() {
|
|
350
|
+
return this.edge.tags ?? [];
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Model relationships
|
|
354
|
+
*/
|
|
355
|
+
relationships() {
|
|
356
|
+
return this.edge.relations.map((r2) => nonNullable(this.viewmodel.model.relationship(r2)));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
LikeC4ViewModel2.Connection = Connection;
|
|
360
|
+
})(LikeC4ViewModel || (LikeC4ViewModel = {}));
|
|
357
361
|
const RelationsSet$1 = Set;
|
|
358
362
|
const MapRelations$1 = Map;
|
|
359
363
|
class LikeC4Model {
|
|
@@ -366,7 +370,7 @@ class LikeC4Model {
|
|
|
366
370
|
this.addRelation(rel);
|
|
367
371
|
}
|
|
368
372
|
this.#views = new Map(
|
|
369
|
-
r$7(computed.views).map((v) => [v.id, new
|
|
373
|
+
r$7(computed.views).map((v) => [v.id, new LikeC4ViewModel(v, this)])
|
|
370
374
|
);
|
|
371
375
|
}
|
|
372
376
|
#elements = /* @__PURE__ */ new Map();
|
|
@@ -473,7 +477,6 @@ class LikeC4Model {
|
|
|
473
477
|
}
|
|
474
478
|
/**
|
|
475
479
|
* Incoming relationships to the element and its descendants
|
|
476
|
-
* @param onlyDirect - only direct incoming relationships, ignore descendants
|
|
477
480
|
*/
|
|
478
481
|
incoming(element, filter = "all") {
|
|
479
482
|
const id = t$7(element) ? element : element.id;
|
|
@@ -60948,7 +60951,7 @@ function p(n = !1) {
|
|
|
60948
60951
|
return u;
|
|
60949
60952
|
}// src/browser.ts
|
|
60950
60953
|
var f = p(!1);const name = "likec4";
|
|
60951
|
-
const version = "1.8.2-next.
|
|
60954
|
+
const version = "1.8.2-next.1";
|
|
60952
60955
|
const license = "MIT";
|
|
60953
60956
|
const homepage = "https://likec4.dev";
|
|
60954
60957
|
const author = "Denis Davydkov <denis@davydkov.com>";
|
|
@@ -61798,7 +61801,7 @@ function createLanguageServices(opts) {
|
|
|
61798
61801
|
this.langiumDocuments = langium.shared.workspace.LangiumDocuments;
|
|
61799
61802
|
this.views = langium.likec4.Views;
|
|
61800
61803
|
}
|
|
61801
|
-
static async
|
|
61804
|
+
static async fromSource(likec4SourceCode, opts) {
|
|
61802
61805
|
const langium = createLanguageServices({
|
|
61803
61806
|
useFileSystem: false,
|
|
61804
61807
|
...opts
|
|
@@ -61818,13 +61821,17 @@ function createLanguageServices(opts) {
|
|
|
61818
61821
|
const uri = UriUtils.joinPath(workspaceUri, "source.likec4");
|
|
61819
61822
|
langium.shared.workspace.LangiumDocuments.createDocument(uri, likec4SourceCode);
|
|
61820
61823
|
await langium.cli.Workspace.init();
|
|
61821
|
-
|
|
61824
|
+
const likec4 = new LikeC4(workspaceUri.path, langium);
|
|
61825
|
+
if (opts?.throwIfInvalid === true && likec4.hasErrors()) {
|
|
61826
|
+
return Promise.reject(likec4);
|
|
61827
|
+
}
|
|
61828
|
+
return likec4;
|
|
61822
61829
|
}
|
|
61823
61830
|
/**
|
|
61824
61831
|
* Prevents multiple instances of LikeC4 for the same workspace
|
|
61825
61832
|
*/
|
|
61826
61833
|
static likec4Instances = /* @__PURE__ */ new Map();
|
|
61827
|
-
static async
|
|
61834
|
+
static async fromWorkspace(path, opts) {
|
|
61828
61835
|
const workspace = resolve$1(path);
|
|
61829
61836
|
let likec4 = LikeC4.likec4Instances.get(workspace);
|
|
61830
61837
|
if (!likec4) {
|
|
@@ -61836,6 +61843,9 @@ function createLanguageServices(opts) {
|
|
|
61836
61843
|
likec4 = new LikeC4(workspace, langium);
|
|
61837
61844
|
LikeC4.likec4Instances.set(workspace, likec4);
|
|
61838
61845
|
}
|
|
61846
|
+
if (opts?.throwIfInvalid === true && likec4.hasErrors()) {
|
|
61847
|
+
return Promise.reject(likec4);
|
|
61848
|
+
}
|
|
61839
61849
|
return likec4;
|
|
61840
61850
|
}
|
|
61841
61851
|
cache = /* @__PURE__ */ new WeakMap();
|
|
@@ -61907,4 +61917,4 @@ function createLanguageServices(opts) {
|
|
|
61907
61917
|
}
|
|
61908
61918
|
}
|
|
61909
61919
|
}
|
|
61910
|
-
}export{
|
|
61920
|
+
}export{isAstNode as $,isNotOperator as A,isOrOperator as B,isOutgoing as C,DefaultArrowType as D,isRelation$1 as E,isRelationExpression$1 as F,isRelationPredicateExpr as G,isRelationWhere as H,isScopedElementView as I,isStepEdgeId as J,isTagEqual as K,LikeC4 as L,isViewRuleAutoLayout$1 as M,isViewRulePredicate$1 as N,isViewRuleStyle$1 as O,isWildcard$1 as P,whereOperatorAsPredicate as Q,AsFqn as R,StepEdgeId as S,BorderStyles as T,DefaultElementShape as U,DefaultThemeColor as V,ElementShapes as W,getDocument$4 as X,findNodesForProperty as Y,TreeStreamImpl as Z,NEWLINE_REGEXP as _,LikeC4Model as a,e$3 as a0,x$1 as a1,i$8 as a2,T as a3,n$4 as a4,t$3 as a5,f as a6,pLimit as a7,logger$1 as a8,l$3 as a9,createLikeC4Logger as aa,withTrailingSlash as ab,hasProtocol as ac,withLeadingSlash as ad,d$1 as ae,u$1 as af,i3 as ag,inMillis as ah,startTimer as ai,nonexhaustive as aj,invariant as ak,stripIndent as al,i$7 as am,delay as an,LogLevels as ao,pkg as ap,LikeC4ViewModel as b,DefaultLineStyle as c,DefaultRelationshipColor as d,expression as e,extractStep as f,getBBoxCenter as g,isComputedDynamicView as h,isAndOperator as i,isComputedElementView as j,isCustomElement as k,isCustomRelationExpr as l,isDynamicView as m,isDynamicViewIncludeRule as n,isElement$1 as o,isElementKindExpr as p,isElementPredicateExpr as q,isElementRef$1 as r,isElementTagExpr as s,isElementView$1 as t,isElementWhere as u,isExpandedElementExpr as v,isExtendsElementView as w,isInOut as x,isIncoming as y,isKindEqual as z};
|