likec4 1.51.0 → 1.53.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.
Files changed (43) hide show
  1. package/__app__/src/ProjectsOverview.js +1 -1
  2. package/__app__/src/likec4.js +295 -190
  3. package/__app__/src/routes/index.js +11 -2
  4. package/__app__/src/routes/projects.js +1 -1
  5. package/__app__/src/routes/single.js +460 -81
  6. package/__app__/src/style.css +1 -1
  7. package/__app__/src/vendors.js +2206 -1685
  8. package/__app__/src/webcomponent.js +1 -1
  9. package/config/schema.json +57 -1
  10. package/dist/THIRD-PARTY-LICENSES.md +32 -226
  11. package/dist/_chunks/filesystem.mjs +71 -70
  12. package/dist/_chunks/index.d.mts +10 -1
  13. package/dist/_chunks/index2.d.mts +112 -8
  14. package/dist/_chunks/libs/@hono/mcp.mjs +9 -9
  15. package/dist/_chunks/libs/@hono/node-server.mjs +1 -1
  16. package/dist/_chunks/libs/@logtape/logtape.d.mts +1021 -0
  17. package/dist/_chunks/libs/@logtape/logtape.mjs +4 -6
  18. package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +14 -14
  19. package/dist/_chunks/libs/@nanostores/react.d.mts +5 -5
  20. package/dist/_chunks/libs/destr.mjs +1 -0
  21. package/dist/_chunks/libs/fast-equals.mjs +1 -1
  22. package/dist/_chunks/libs/langium.mjs +1 -1
  23. package/dist/_chunks/libs/remeda.mjs +2 -2
  24. package/dist/_chunks/libs/tinyrainbow.mjs +1 -1
  25. package/dist/_chunks/libs/unstorage.mjs +1 -0
  26. package/dist/_chunks/node.mjs +1 -0
  27. package/dist/_chunks/sequence.mjs +1 -1
  28. package/dist/_chunks/src.mjs +14 -12
  29. package/dist/_chunks/src2.mjs +46 -46
  30. package/dist/cli/index.mjs +164 -83
  31. package/dist/index.d.mts +47 -819
  32. package/dist/index.mjs +1 -1
  33. package/dist/vite-plugin/index.mjs +1 -1
  34. package/dist/vite-plugin/internal.mjs +1 -1
  35. package/package.json +38 -37
  36. package/react/index.d.mts +80 -22
  37. package/react/index.mjs +692 -465
  38. package/vite-plugin-modules.d.ts +5 -0
  39. package/dist/_chunks/LikeC4.mjs +0 -1
  40. package/dist/_chunks/libs/@msgpack/msgpack.mjs +0 -1
  41. package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +0 -1
  42. package/dist/_chunks/libs/@smithy/util-base64.mjs +0 -1
  43. package/dist/_chunks/libs/boxen.d.mts +0 -1
@@ -1,4 +1,4 @@
1
- import { S as $strip, _ as ZodUnion, a as ZodBoolean, b as $partial, c as ZodEnum, d as ZodObject, f as ZodOptional, g as ZodTransform, h as ZodString, i as ZodArray, l as ZodInt, m as ZodRecord, o as ZodCustom, p as ZodPipe, r as ZodAny, s as ZodDefault, u as ZodNumber, v as input, x as $strict, y as output } from "./libs/@modelcontextprotocol/sdk.mjs";
1
+ import { C as $strip, S as $strict, _ as ZodTransform, a as ZodBoolean, b as output, c as ZodEnum, d as ZodNumber, f as ZodObject, g as ZodString, h as ZodRecord, i as ZodArray, l as ZodInt, m as ZodPipe, o as ZodCustom, p as ZodOptional, r as ZodAny, s as ZodDefault, u as ZodLiteral, v as ZodUnion, x as $partial, y as input } from "./libs/@modelcontextprotocol/sdk.mjs";
2
2
  import { DeploymentElementModel, DeploymentRelationModel, ElementModel, LikeC4Model, LikeC4ViewModel, RelationshipModel } from "@likec4/core/model";
3
3
  import { LikeC4ProjectStylesConfig, LikeC4ProjectTheme, ProjectId, ThemeColorValues as ThemeColorValues$1, aux } from "@likec4/core/types";
4
4
 
@@ -143,6 +143,13 @@ declare const LikeC4ProjectJsonConfigSchema: ZodObject<{
143
143
  }, $strict>>;
144
144
  inferTechnologyFromIcon: ZodOptional<ZodBoolean>;
145
145
  implicitViews: ZodOptional<ZodBoolean>;
146
+ landingPage: ZodOptional<ZodUnion<readonly [ZodObject<{
147
+ redirect: ZodLiteral<true>;
148
+ }, $strict>, ZodObject<{
149
+ include: ZodArray<ZodString>;
150
+ }, $strict>, ZodObject<{
151
+ exclude: ZodArray<ZodString>;
152
+ }, $strict>]>>;
146
153
  }, $strip>;
147
154
  type LikeC4ProjectJsonConfig = input<typeof LikeC4ProjectJsonConfigSchema>;
148
155
  /**
@@ -272,6 +279,8 @@ type LikeC4ProjectConfigInput = LikeC4ProjectJsonConfig & {
272
279
  };
273
280
  /**
274
281
  * Validates Object into a LikeC4ProjectConfig object.
282
+ * Zod v4 can strip optional union keys (e.g. landingPage) from parse output;
283
+ * we validate landingPage once with LandingPageSchema and merge onto the result.
275
284
  */
276
285
  declare function validateProjectConfig<C extends Record<string, unknown>>(config: C): LikeC4ProjectConfig;
277
286
  /**
@@ -304,6 +304,7 @@ declare class GraphvizLayouter implements Disposable {
304
304
  [Symbol.dispose](): void;
305
305
  get graphvizPort(): GraphvizPort;
306
306
  changePort(graphviz: GraphvizPort): void;
307
+ printToDot(params: LayoutTaskParams): DotSource;
307
308
  dotToJson(dot: DotSource): Promise<GraphvizJson>;
308
309
  layout<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<LayoutResult<A>>;
309
310
  svg<A extends AnyAux>(params: LayoutTaskParams<A>): Promise<{
@@ -557,11 +558,46 @@ type ManualLayoutsSnapshot = {
557
558
  hash: string;
558
559
  views: Record<ViewId$1, LayoutedView$1>;
559
560
  };
561
+ type ManualLayoutUpdateEvent = {
562
+ updated: URI;
563
+ projectId: ProjectId$1;
564
+ viewId: ViewId$1;
565
+ } | {
566
+ removed: URI;
567
+ projectId: ProjectId$1;
568
+ /**
569
+ * Missing if triggered by FS event (file was deleted)
570
+ */
571
+ viewId?: ViewId$1;
572
+ };
573
+ type ManualLayoutUpdateListener = (event: ManualLayoutUpdateEvent) => void;
560
574
  interface LikeC4ManualLayouts {
575
+ /**
576
+ * Reads a single layouted view from the file system by its URI.
577
+ * Used by the language server to get the current layout state.
578
+ */
579
+ readSnapshot(uri: URI): Promise<LayoutedView$1 | null>;
561
580
  read(project: Project): Promise<ManualLayoutsSnapshot | null>;
562
581
  write(project: Project, layouted: LayoutedView$1): Promise<Location>;
563
582
  remove(project: Project, view: ViewId$1): Promise<Location | null>;
564
583
  clearCaches(): void;
584
+ /**
585
+ * Registers a listener for manual layout updates.
586
+ * The listener will be called when a manual layout is created, updated, or deleted.
587
+ */
588
+ onManualLayoutUpdate(listener: ManualLayoutUpdateListener): Disposable$1;
589
+ /**
590
+ * Handles file system updates for manual layouts.
591
+ * Used by the file system watcher to notify the manual layouts module of changes.
592
+ * @param event The file system event
593
+ */
594
+ handleFileSystemUpdate(event: {
595
+ update: URI;
596
+ delete?: never;
597
+ } | {
598
+ delete: URI;
599
+ update?: never;
600
+ }): Promise<void>;
565
601
  } //#endregion
566
602
  //#region src/filesystem/noop.d.ts
567
603
  //#endregion
@@ -676,6 +712,7 @@ type Id = 'deployment' | 'element' | 'group' | 'instance' | 'model' | 'node' | A
676
712
  type LikeC4View = DeploymentView | DynamicView | ElementView;
677
713
  declare const LikeC4View = "LikeC4View";
678
714
  type LineOptions = 'dashed' | 'dotted' | 'solid';
715
+ type MetadataFilterValue = boolean | string;
679
716
  type MetadataProperty = MetadataBody;
680
717
  declare const MetadataProperty = "MetadataProperty";
681
718
  type MetadataValue = MarkdownOrString | MetadataArray;
@@ -712,7 +749,7 @@ type ViewRule = ViewRuleAutoLayout | ViewRuleGlobalPredicateRef | ViewRuleGroup
712
749
  declare const ViewRule = "ViewRule";
713
750
  type ViewRuleStyleOrGlobalRef = ViewRuleGlobalStyle | ViewRuleStyle;
714
751
  declare const ViewRuleStyleOrGlobalRef = "ViewRuleStyleOrGlobalRef";
715
- type WhereElement = WhereElementKind | WhereElementTag;
752
+ type WhereElement = WhereElementKind | WhereElementMetadata | WhereElementTag;
716
753
  declare const WhereElement = "WhereElement";
717
754
  type WhereElementExpression = WhereBinaryExpression | WhereElement | WhereElementNegation;
718
755
  declare const WhereElementExpression = "WhereElementExpression";
@@ -720,7 +757,9 @@ type WhereExpression = WhereElementExpression | WhereRelationExpression;
720
757
  declare const WhereExpression = "WhereExpression";
721
758
  type WhereKindEqual = WhereElementKind | WhereRelationKind | WhereRelationParticipantKind;
722
759
  declare const WhereKindEqual = "WhereKindEqual";
723
- type WhereRelation = WhereRelationKind | WhereRelationParticipantKind | WhereRelationParticipantTag | WhereRelationTag;
760
+ type WhereMetadataEqual = WhereElementMetadata | WhereRelationMetadata | WhereRelationParticipantMetadata;
761
+ declare const WhereMetadataEqual = "WhereMetadataEqual";
762
+ type WhereRelation = WhereRelationKind | WhereRelationMetadata | WhereRelationParticipantKind | WhereRelationParticipantMetadata | WhereRelationParticipantTag | WhereRelationTag;
724
763
  declare const WhereRelation = "WhereRelation";
725
764
  type WhereRelationExpression = WhereBinaryExpression | WhereRelation | WhereRelationNegation;
726
765
  declare const WhereRelationExpression = "WhereRelationExpression";
@@ -1251,8 +1290,9 @@ declare const MetadataArray = "MetadataArray";
1251
1290
  interface MetadataAttribute extends AstNode {
1252
1291
  readonly $container: MetadataBody;
1253
1292
  readonly $type: 'MetadataAttribute';
1293
+ boolValue: boolean;
1254
1294
  key: string;
1255
- value: MetadataValue;
1295
+ value?: MetadataValue;
1256
1296
  }
1257
1297
  declare const MetadataAttribute = "MetadataAttribute";
1258
1298
  interface MetadataBody extends AstNode {
@@ -1606,6 +1646,15 @@ interface WhereElementKind extends AstNode {
1606
1646
  value: Reference<DeploymentNodeOrElementKind>;
1607
1647
  }
1608
1648
  declare const WhereElementKind = "WhereElementKind";
1649
+ interface WhereElementMetadata extends AstNode {
1650
+ readonly $container: FqnExprWhere | WhereBinaryExpression | WhereElementNegation;
1651
+ readonly $type: 'WhereElementMetadata';
1652
+ key: Id;
1653
+ not: boolean;
1654
+ operator?: 'is' | string;
1655
+ value?: MetadataFilterValue;
1656
+ }
1657
+ declare const WhereElementMetadata = "WhereElementMetadata";
1609
1658
  interface WhereElementNegation extends AstNode {
1610
1659
  readonly $container: FqnExprWhere | WhereBinaryExpression | WhereElementNegation;
1611
1660
  readonly $type: 'WhereElementNegation';
@@ -1628,6 +1677,15 @@ interface WhereRelationKind extends AstNode {
1628
1677
  value: Reference<RelationshipKind>;
1629
1678
  }
1630
1679
  declare const WhereRelationKind = "WhereRelationKind";
1680
+ interface WhereRelationMetadata extends AstNode {
1681
+ readonly $container: RelationExprWhere | WhereBinaryExpression | WhereRelationNegation;
1682
+ readonly $type: 'WhereRelationMetadata';
1683
+ key: Id;
1684
+ not: boolean;
1685
+ operator?: 'is' | string;
1686
+ value?: MetadataFilterValue;
1687
+ }
1688
+ declare const WhereRelationMetadata = "WhereRelationMetadata";
1631
1689
  interface WhereRelationNegation extends AstNode {
1632
1690
  readonly $container: RelationExprWhere | WhereBinaryExpression | WhereRelationNegation;
1633
1691
  readonly $type: 'WhereRelationNegation';
@@ -1643,6 +1701,16 @@ interface WhereRelationParticipantKind extends AstNode {
1643
1701
  value: Reference<DeploymentNodeOrElementKind>;
1644
1702
  }
1645
1703
  declare const WhereRelationParticipantKind = "WhereRelationParticipantKind";
1704
+ interface WhereRelationParticipantMetadata extends AstNode {
1705
+ readonly $container: RelationExprWhere | WhereBinaryExpression | WhereRelationNegation;
1706
+ readonly $type: 'WhereRelationParticipantMetadata';
1707
+ key: Id;
1708
+ not: boolean;
1709
+ operator?: 'is' | string;
1710
+ participant: Participant;
1711
+ value?: MetadataFilterValue;
1712
+ }
1713
+ declare const WhereRelationParticipantMetadata = "WhereRelationParticipantMetadata";
1646
1714
  interface WhereRelationParticipantTag extends AstNode {
1647
1715
  readonly $container: RelationExprWhere | WhereBinaryExpression | WhereRelationNegation;
1648
1716
  readonly $type: 'WhereRelationParticipantTag';
@@ -1836,15 +1904,19 @@ type LikeC4AstType = {
1836
1904
  WhereElement: WhereElement;
1837
1905
  WhereElementExpression: WhereElementExpression;
1838
1906
  WhereElementKind: WhereElementKind;
1907
+ WhereElementMetadata: WhereElementMetadata;
1839
1908
  WhereElementNegation: WhereElementNegation;
1840
1909
  WhereElementTag: WhereElementTag;
1841
1910
  WhereExpression: WhereExpression;
1842
1911
  WhereKindEqual: WhereKindEqual;
1912
+ WhereMetadataEqual: WhereMetadataEqual;
1843
1913
  WhereRelation: WhereRelation;
1844
1914
  WhereRelationExpression: WhereRelationExpression;
1845
1915
  WhereRelationKind: WhereRelationKind;
1916
+ WhereRelationMetadata: WhereRelationMetadata;
1846
1917
  WhereRelationNegation: WhereRelationNegation;
1847
1918
  WhereRelationParticipantKind: WhereRelationParticipantKind;
1919
+ WhereRelationParticipantMetadata: WhereRelationParticipantMetadata;
1848
1920
  WhereRelationParticipantTag: WhereRelationParticipantTag;
1849
1921
  WhereRelationTag: WhereRelationTag;
1850
1922
  WhereTagEqual: WhereTagEqual;
@@ -2005,7 +2077,6 @@ interface ParsedAstElementView {
2005
2077
  tags: c4.NonEmptyArray<c4.Tag> | null;
2006
2078
  links: c4.NonEmptyArray<c4.Link> | null;
2007
2079
  rules: c4.ElementViewRule[];
2008
- manualLayout?: c4.ViewManualLayout;
2009
2080
  }
2010
2081
  interface ParsedAstDynamicView {
2011
2082
  id: c4.ViewId;
@@ -2017,7 +2088,6 @@ interface ParsedAstDynamicView {
2017
2088
  steps: c4.DynamicViewStep[];
2018
2089
  rules: Array<c4.DynamicViewRule>;
2019
2090
  variant: c4.DynamicViewDisplayVariant | undefined;
2020
- manualLayout?: c4.ViewManualLayout;
2021
2091
  }
2022
2092
  interface ParsedAstDeploymentView {
2023
2093
  id: c4.ViewId;
@@ -2027,7 +2097,6 @@ interface ParsedAstDeploymentView {
2027
2097
  tags: c4.NonEmptyArray<c4.Tag> | null;
2028
2098
  links: c4.NonEmptyArray<c4.Link> | null;
2029
2099
  rules: Array<c4.DeploymentViewRule>;
2030
- manualLayout?: c4.ViewManualLayout;
2031
2100
  }
2032
2101
  type ParsedAstView = ParsedAstElementView | ParsedAstDynamicView | ParsedAstDeploymentView;
2033
2102
  interface AstNodeDescriptionWithFqn extends AstNodeDescription {
@@ -2367,7 +2436,7 @@ declare class LastSeenArtifacts {
2367
2436
  model(projectId: c4.ProjectId): LikeC4Model.Computed | undefined;
2368
2437
  } //#endregion
2369
2438
  //#region src/model/model-builder.d.ts
2370
- type ModelParsedListener = (docs: URI[]) => void;
2439
+ type ModelParsedListener = (projectId: ProjectId, docs: URI[]) => void;
2371
2440
  interface LikeC4ModelBuilder extends Disposable$1 {
2372
2441
  parseModel(projectId?: ProjectId | undefined, cancelToken?: CancellationToken$1): Promise<LikeC4Model<UnknownParsed> | null>;
2373
2442
  unsafeSyncComputeModel(projectId: ProjectId): LikeC4Model<UnknownComputed>;
@@ -3317,7 +3386,42 @@ interface LikeC4LanguageServices {
3317
3386
  * Returns the location of the specified element, relation, view or deployment element
3318
3387
  */
3319
3388
  locate(params: Locate.Params): Locate.Res;
3389
+ /**
3390
+ * Formats documents and returns a map of document URI → formatted source text.
3391
+ *
3392
+ * Target selection uses union semantics:
3393
+ * - No options: formats all documents across all projects
3394
+ * - `projectIds`: includes all documents from those projects
3395
+ * - `documentUris`: includes specific documents
3396
+ * - Both: formats the union (deduplicated)
3397
+ */
3398
+ format(options?: FormatOptions): Promise<Map<string, string>>;
3320
3399
  dispose(): Promise<void>;
3400
+ }
3401
+ /**
3402
+ * Options for {@link LikeC4LanguageServices.format}.
3403
+ *
3404
+ * Target selection uses union semantics:
3405
+ * - Omit both `projectIds` and `documentUris` to format **all** documents.
3406
+ * - Provide `projectIds` to include all documents from those projects.
3407
+ * - Provide `documentUris` to include specific documents.
3408
+ * - Provide both to format the **union** of project documents and specified documents.
3409
+ */
3410
+ interface FormatOptions {
3411
+ /** Include all documents from these projects. */
3412
+ projectIds?: ReadonlyArray<ProjectId>;
3413
+ /** Include these specific documents (by URI string). */
3414
+ documentUris?: ReadonlyArray<string>;
3415
+ /** Size of a tab in spaces (default: 2). */
3416
+ tabSize?: number;
3417
+ /** Prefer spaces over tabs (default: true). */
3418
+ insertSpaces?: boolean;
3419
+ /** Trim trailing whitespace on a line. */
3420
+ trimTrailingWhitespace?: boolean;
3421
+ /** Insert a newline character at the end of the file if one does not exist. */
3422
+ insertFinalNewline?: boolean;
3423
+ /** Trim all newlines after the final newline at the end of the file. */
3424
+ trimFinalNewlines?: boolean;
3321
3425
  } //#endregion
3322
3426
  //#region src/lsp/CodeLensProvider.d.ts
3323
3427
  declare class LikeC4CodeLensProvider implements CodeLensProvider {
@@ -3424,7 +3528,7 @@ declare class LikeC4CodeActionProvider implements CodeActionProvider {
3424
3528
  * @throws `OperationCancelled` if cancellation is detected during execution
3425
3529
  * @throws `ResponseError` if an error is detected that should be sent as response to the client
3426
3530
  */
3427
- getCodeActions(document: LangiumDocument, params: CodeActionParams): CommandOrCodeAction[] | undefined;
3531
+ getCodeActions(_document: LangiumDocument, _params: CodeActionParams): CommandOrCodeAction[] | undefined;
3428
3532
  } //#endregion
3429
3533
  //#region src/lsp/SemanticTokenProvider.d.ts
3430
3534
  declare class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {