@likec4/core 1.34.2 → 1.36.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 (79) hide show
  1. package/README.md +1 -1
  2. package/dist/builder/index.d.mts +15 -4
  3. package/dist/builder/index.mjs +19 -15
  4. package/dist/compute-view/index.d.mts +3 -3
  5. package/dist/compute-view/index.mjs +16 -13
  6. package/dist/compute-view/relationships-view/index.d.mts +3 -3
  7. package/dist/compute-view/relationships-view/index.mjs +2 -2
  8. package/dist/index.d.mts +3 -3
  9. package/dist/index.mjs +14 -9
  10. package/dist/model/connection/deployment/index.d.mts +5 -5
  11. package/dist/model/connection/deployment/index.mjs +5 -4
  12. package/dist/model/connection/index.d.mts +6 -6
  13. package/dist/model/connection/index.mjs +6 -5
  14. package/dist/model/connection/model/index.d.mts +5 -5
  15. package/dist/model/connection/model/index.mjs +3 -3
  16. package/dist/model/index.d.mts +33 -9
  17. package/dist/model/index.mjs +12 -10
  18. package/dist/shared/{core.DAj3LuFH.d.mts → core.BFb3p5d-.d.mts} +4 -2
  19. package/dist/shared/{core.PqNe5WxQ.mjs → core.BlwZ4tBa.mjs} +98 -92
  20. package/dist/shared/core.BpJu1RrF.mjs +5 -0
  21. package/dist/shared/{core.CJSFKrYf.d.mts → core.Bt3kuGUN.d.mts} +3 -3
  22. package/dist/shared/{core.D5qVzkws.mjs → core.Bus32P0S.mjs} +4 -3
  23. package/dist/shared/{core.4SpVCM9m.mjs → core.BvIGRozf.mjs} +364 -28
  24. package/dist/shared/{core.C80Z37Eu.mjs → core.C1GV0WWV.mjs} +1 -1
  25. package/dist/shared/{core.DXRAwwDB.mjs → core.CaJp8Amg.mjs} +3 -2
  26. package/dist/shared/{core.D56nCp7e.mjs → core.CaaYNQDM.mjs} +1 -3
  27. package/dist/shared/core.CnIyafWn.mjs +3 -0
  28. package/dist/shared/{core.D3xEWj5B.d.mts → core.D8bTI5KC.d.mts} +2 -2
  29. package/dist/shared/{core.Di7__sMg.d.mts → core.DHYd2-VU.d.mts} +3 -3
  30. package/dist/shared/{core.C_C-3c1S.mjs → core.DQj9iv_y.mjs} +3 -5
  31. package/dist/shared/{core.DrS4Bf4y.d.mts → core.DoNP3Yl-.d.mts} +187 -11
  32. package/dist/shared/{core.IWLie-Ma.d.mts → core.DxDn5nB5.d.mts} +24 -6
  33. package/dist/shared/{core.CtKXPqN_.mjs → core.HUONfQfd.mjs} +1 -1
  34. package/dist/shared/{core.BTnf14gD.mjs → core.Y3j3s-oq.mjs} +2 -2
  35. package/dist/shared/{core.Br7Fab9l.mjs → core._jnYNUQ-.mjs} +8 -70
  36. package/dist/shared/{core.XptQjhMA.mjs → core.b2BzqGz0.mjs} +2 -2
  37. package/dist/shared/{core.BMCb0wJI.mjs → core.yaRvRnMW.mjs} +1 -1
  38. package/dist/theme/index.mjs +34 -3510
  39. package/dist/types/_aux.d.mts +1 -1
  40. package/dist/types/index.d.mts +3 -3
  41. package/dist/types/index.mjs +6 -4
  42. package/dist/types/scalar.d.mts +2 -0
  43. package/dist/types/scalar.mjs +68 -0
  44. package/dist/utils/index.d.mts +6 -8
  45. package/dist/utils/index.mjs +5 -5
  46. package/dist/utils/iterable/index.d.mts +18 -1
  47. package/dist/utils/iterable/index.mjs +22 -2
  48. package/package.json +11 -16
  49. package/src/builder/Builder.ts +17 -6
  50. package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +9 -0
  51. package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +3 -0
  52. package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +3 -0
  53. package/src/builder/_types.ts +10 -0
  54. package/src/compute-view/dynamic-view/compute.ts +2 -0
  55. package/src/compute-view/element-view/__test__/fixture.ts +1 -0
  56. package/src/compute-view/element-view/predicates/relation-direct.ts +8 -2
  57. package/src/compute-view/utils/applyCustomRelationProperties.ts +2 -0
  58. package/src/model/DeploymentModel.ts +1 -1
  59. package/src/model/LikeC4Model.ts +162 -13
  60. package/src/model/index.ts +8 -0
  61. package/src/model/types.ts +1 -8
  62. package/src/model/utils.ts +66 -0
  63. package/src/model/view/LikeC4ViewModel.ts +62 -7
  64. package/src/model/view/LikeC4ViewsFolder.ts +151 -0
  65. package/src/theme/__test__/theme-index.ts +29 -0
  66. package/src/theme/element.ts +0 -19
  67. package/src/theme/index.ts +49 -3
  68. package/src/types/_aux.ts +6 -0
  69. package/src/types/index.ts +1 -0
  70. package/src/types/model-data.ts +2 -0
  71. package/src/types/model-dump.ts +8 -1
  72. package/src/types/model-spec.ts +4 -0
  73. package/src/types/project.ts +9 -0
  74. package/src/types/view-computed.ts +1 -1
  75. package/src/types/view-parsed.dynamic.ts +2 -2
  76. package/src/utils/compare-natural.ts +14 -12
  77. package/src/utils/index.ts +1 -0
  78. package/src/utils/iterable/first.ts +48 -0
  79. package/src/utils/iterable/index.ts +1 -0
@@ -1,9 +1,9 @@
1
- import { A as Any, R as RelationKind, T as Tags, h as Metadata, j as MetadataKey, L as LooseTag, F as Fqn, g as ElementId, k as ElementKind, D as DeploymentKind, E as ExtractOnStage, l as RelationId$1, f as _type, m as StrictViewId, n as LooseElementId, o as LooseDeploymentId, p as DeploymentFqn, t as toComputed, q as toLayouted, r as Stage, s as DeploymentId, U as Unknown, V as ViewId, u as Tag, v as toParsed, P as ProjectId$1, w as LooseViewId, a as Aux, S as SpecAux, d as UnknownParsed, b as UnknownComputed, c as UnknownLayouted } from './core.DAj3LuFH.mjs';
1
+ import { A as Any, R as RelationKind, T as Tags, h as Metadata, j as MetadataKey, L as LooseTag, F as Fqn, g as ElementId, k as ElementKind, D as DeploymentKind, E as ExtractOnStage, l as RelationId$1, m as StrictViewId, f as _type, n as LooseElementId, o as LooseDeploymentId, p as DeploymentFqn, t as toComputed, q as toLayouted, r as Stage, s as DeploymentId, U as Unknown, V as ViewId, u as Tag, v as toParsed, P as ProjectId$1, w as LooseViewId, a as Aux, S as SpecAux, d as UnknownParsed, b as UnknownComputed, c as UnknownLayouted } from './core.BFb3p5d-.mjs';
2
2
  import { D as DefaultMap } from './core.CywrQs86.mjs';
3
3
  import { SetRequired } from 'type-fest';
4
4
  import { d as RelationId, P as ProjectId, a as IconUrl, N as NodeId, G as GroupElementKind, j as EdgeId, k as StepEdgeId, V as ViewId$1 } from './core.668kXpZq.mjs';
5
- import { b as RichTextOrEmpty, Y as Relationship, Q as Element, O as ElementStyle, as as ViewWithType, ao as ComputedView, am as LayoutedView, n as ParsedLikeC4ModelData, C as ComputedLikeC4ModelData, L as LayoutedLikeC4ModelData, f as FqnRef, q as DeployedInstance, D as DeploymentElementStyle, v as DeploymentRelationship, r as DeploymentElement, p as DeploymentNode, y as LikeC4ModelDump, z as AuxFromDump, a2 as Specification, m as ModelGlobals, ah as WhereOperator } from './core.IWLie-Ma.mjs';
6
- import { I as IteratorLike, L as Link } from './core.DuSLYTG6.mjs';
5
+ import { b as RichTextOrEmpty, Z as Relationship, T as Element, Q as ElementStyle, au as ViewWithType, aq as ComputedView, ao as LayoutedView, n as ParsedLikeC4ModelData, C as ComputedLikeC4ModelData, L as LayoutedLikeC4ModelData, f as FqnRef, q as DeployedInstance, D as DeploymentElementStyle, v as DeploymentRelationship, r as DeploymentElement, p as DeploymentNode, y as LikeC4ModelDump, H as AuxFromDump, am as LikeC4Project, a3 as Specification, m as ModelGlobals, ai as WhereOperator } from './core.DxDn5nB5.mjs';
6
+ import { I as IteratorLike, L as Link, N as NonEmptyArray } from './core.DuSLYTG6.mjs';
7
7
  import { i as Color, R as RelationshipLineType, c as ElementShape } from './core.CzdwsPmY.mjs';
8
8
 
9
9
  type RelationshipsIterator<A extends Any> = IteratorLike<RelationshipModel<A>>;
@@ -268,6 +268,80 @@ declare namespace EdgeModel {
268
268
  }
269
269
  }
270
270
 
271
+ declare class LikeC4ViewsFolder<A extends Any = Any> {
272
+ readonly $model: LikeC4Model<A>;
273
+ /**
274
+ * Path to this view folder, processed by {@link normalizeViewPath}
275
+ *
276
+ * @example
277
+ * "Folder 1/Folder 2/Folder 3"
278
+ */
279
+ readonly path: string;
280
+ /**
281
+ * Title of this view folder.
282
+ *
283
+ * @example
284
+ * // title is the last segment of the path
285
+ * path = "Folder 1/Folder 2/Folder 3"
286
+ * title = "Folder 3"
287
+ */
288
+ readonly title: string;
289
+ /**
290
+ * Whether this is the root view folder.
291
+ *
292
+ * !NOTE
293
+ * Root folder is special folder with an empty path and used only for internal purposes. \
294
+ * It is not visible to the user and should not be used in the code.
295
+ */
296
+ readonly isRoot: boolean;
297
+ protected readonly parentPath: string | undefined;
298
+ protected readonly defaultViewId: StrictViewId<A> | undefined;
299
+ constructor($model: LikeC4Model<A>, path: NonEmptyArray<string>, defaultViewId: StrictViewId<A> | undefined);
300
+ /**
301
+ * Default view of this view folder.\
302
+ * It is for the case when there is a view at the same path as this folder.\
303
+ * (if there are multiple views at the same path, the first one is chosen)
304
+ *
305
+ * @example
306
+ * ```
307
+ * // Assume the following views exist:
308
+ * const views = [
309
+ * "Folder 1/ Folder 2 / View",
310
+ * "Folder 1/ Folder 2 / View / Subview",
311
+ * ]
312
+ * ```
313
+ * Group with path `Folder 1/ Folder 2 / View`\
314
+ * will have default view `Folder 1/ Folder 2 / View`
315
+ */
316
+ get defaultView(): LikeC4ViewModel<A> | null;
317
+ /**
318
+ * Returns path to this view folder as an array of ancestors (excluding root) and this view folder as the last element
319
+ *
320
+ * @throws Error if this is the root folder.
321
+ */
322
+ get breadcrumbs(): [...LikeC4ViewsFolder<A>[], this];
323
+ /**
324
+ * Returns parent folder
325
+ *
326
+ * @throws Error if this is the root folder.
327
+ */
328
+ get parent(): LikeC4ViewsFolder<A> | null;
329
+ /**
330
+ * Returns sorted set of children
331
+ * - First folders
332
+ * - Then views
333
+ */
334
+ get children(): ReadonlySet<LikeC4ViewsFolder<A> | LikeC4ViewModel<A>>;
335
+ /**
336
+ * Returns sorted array of children folders
337
+ */
338
+ get folders(): ReadonlyArray<LikeC4ViewsFolder<A>>;
339
+ /**
340
+ * Returns all views in this view folder.
341
+ */
342
+ get views(): ReadonlyArray<LikeC4ViewModel<A>>;
343
+ }
344
+
271
345
  type ViewsIterator<A extends Any, V extends $View<A> = $View<A>> = IteratorLike<LikeC4ViewModel<A, V>>;
272
346
  declare class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>> implements WithTags<A> {
273
347
  #private;
@@ -277,10 +351,44 @@ declare class LikeC4ViewModel<A extends Any = Any, V extends $View<A> = $View<A>
277
351
  readonly Aux: A;
278
352
  readonly $view: V;
279
353
  readonly $model: LikeC4Model<A>;
280
- constructor(model: LikeC4Model<A>, view: V);
354
+ readonly title: string | null;
355
+ /**
356
+ * View folder this view belongs to.
357
+ * If view is top-level, this is the root folder.
358
+ */
359
+ readonly folder: LikeC4ViewsFolder<A>;
360
+ /**
361
+ * Path to this view, processed by {@link normalizeViewPath}
362
+ *
363
+ * @example
364
+ * "Group 1/Group 2/View"
365
+ */
366
+ readonly viewPath: string;
367
+ constructor(model: LikeC4Model<A>, view: V, folder: LikeC4ViewsFolder<A>);
281
368
  get _type(): V[_type];
282
369
  get id(): StrictViewId<A>;
283
- get title(): string | null;
370
+ /**
371
+ * Returns title if defined, otherwise returns its {@link id}
372
+ */
373
+ get titleOrId(): string;
374
+ /**
375
+ * Returns title if defined, otherwise returns `Untitled`.
376
+ */
377
+ get titleOrUntitled(): string;
378
+ /**
379
+ * Returns path to this view as an array of groups and this view as the last element
380
+ * If view is top-level, returns only this view.
381
+ *
382
+ * @example
383
+ * viewPath = "Group 1/Group 2/View"
384
+ *
385
+ * breadcrumbs = [
386
+ * "Group 1", // folder
387
+ * "Group 1/Group 2", // folder
388
+ * "Group 1/Group 2/View" // view
389
+ * ]
390
+ */
391
+ get breadcrumbs(): [...LikeC4ViewsFolder<A>[], this];
284
392
  get description(): RichTextOrEmpty;
285
393
  get tags(): Tags<A>;
286
394
  get links(): ReadonlyArray<Link>;
@@ -715,7 +823,10 @@ declare class LikeC4Model<A extends Any = Unknown> {
715
823
  protected readonly _outgoing: DefaultMap<Fqn<A>, Set<RelationshipModel<A>>>;
716
824
  protected readonly _internal: DefaultMap<Fqn<A>, Set<RelationshipModel<A>>>;
717
825
  protected readonly _views: Map<ViewId<A>, LikeC4ViewModel<A, $View<A>>>;
718
- protected readonly _allTags: DefaultMap<Tag<A>, Set<ElementModel<A> | LikeC4ViewModel<A, $View<A>> | RelationshipModel<A>>>;
826
+ protected readonly _rootViewFolder: LikeC4ViewsFolder<A>;
827
+ protected readonly _viewFolders: Map<string, LikeC4ViewsFolder<A>>;
828
+ protected readonly _viewFolderItems: DefaultMap<string, Set<LikeC4ViewModel<A, $View<A>> | LikeC4ViewsFolder<A>>>;
829
+ protected readonly _allTags: DefaultMap<Tag<A>, Set<LikeC4ViewModel<A, $View<A>> | ElementModel<A> | RelationshipModel<A>>>;
719
830
  static fromParsed<T extends Any>(model: ParsedLikeC4ModelData<T>): LikeC4Model.Parsed<T>;
720
831
  /**
721
832
  * Creates a new LikeC4Model instance from the provided model data.
@@ -775,9 +886,34 @@ declare class LikeC4Model<A extends Any = Unknown> {
775
886
  get $model(): $ModelData<A>;
776
887
  get stage(): Stage<A>;
777
888
  get projectId(): ProjectId$1<A>;
889
+ get project(): LikeC4Project;
778
890
  get specification(): Specification<A>;
779
891
  get globals(): ModelGlobals;
892
+ /**
893
+ * Returns the element with the given FQN.
894
+ *
895
+ * @throws Error if element is not found\
896
+ * Use {@link findElement} if you don't want to throw an error
897
+ *
898
+ * @note Method is type-safe for typed model
899
+
900
+ * @example
901
+ * model.element('cloud.frontend')
902
+ * // or object with id property of scalar.Fqn
903
+ * model.element({
904
+ * id: 'dashboard',
905
+ * })
906
+ */
780
907
  element(el: ElementOrFqn<A>): ElementModel<A>;
908
+ /**
909
+ * Returns the element with the given FQN.
910
+ *
911
+ * @returns Element if found, null otherwise
912
+ * @note Method is not type-safe as {@link element}
913
+ *
914
+ * @example
915
+ * model.findElement('cloud.frontend')
916
+ */
781
917
  findElement(el: LooseElementId<A>): ElementModel<A> | null;
782
918
  /**
783
919
  * Returns the root elements of the model.
@@ -808,11 +944,50 @@ declare class LikeC4Model<A extends Any = Unknown> {
808
944
  views(): IteratorLike<LikeC4ViewModel<A, $View<A>>>;
809
945
  /**
810
946
  * Returns a specific view by its ID.
947
+ * @note Method is type-safe for typed model
948
+ * @throws Error if view is not found\
949
+ * Use {@link findView} if you don't want to throw an error
950
+ *
951
+ * @example
952
+ * model.view('index')
953
+ * // or object with id property of scalar.ViewId
954
+ * model.view({
955
+ * id: 'index',
956
+ * })
811
957
  */
812
958
  view(viewId: ViewId<A> | {
813
959
  id: ViewId$1<ViewId<A>>;
814
960
  }): LikeC4ViewModel<A, $View<A>>;
961
+ /**
962
+ * Returns a specific view by its ID.
963
+ * @note Method is not type-safe as {@link view}
964
+ *
965
+ * @example
966
+ * model.findView('index')
967
+ */
815
968
  findView(viewId: LooseViewId<A>): LikeC4ViewModel<A, $View<A>> | null;
969
+ /**
970
+ * Returns a view folder by its path.
971
+ * Path is extracted from the view title, e.g. "Group 1/Group 2/View" -> "Group 1/Group 2"
972
+ * @throws Error if view folder is not found.
973
+ */
974
+ viewFolder(path: string): LikeC4ViewsFolder<A>;
975
+ /**
976
+ * Root folder is a special one with an empty path and used only for internal purposes.
977
+ * It is not visible to the user and should be used only to get top-level folders and views.
978
+ */
979
+ get rootViewFolder(): LikeC4ViewsFolder<A>;
980
+ /**
981
+ * Whether the model has any view folders.
982
+ */
983
+ get hasViewFolders(): boolean;
984
+ /**
985
+ * Returns all children of a view folder.
986
+ * Path is extracted from the view title, e.g. "Group 1/Group 2/View" -> "Group 1/Group 2"
987
+ *
988
+ * @throws Error if view folder is not found.
989
+ */
990
+ viewFolderItems(path: string): ReadonlySet<LikeC4ViewsFolder<A> | LikeC4ViewModel<A>>;
816
991
  /**
817
992
  * Returns the parent element of given element.
818
993
  * @see ancestors
@@ -847,7 +1022,8 @@ declare class LikeC4Model<A extends Any = Unknown> {
847
1022
  */
848
1023
  outgoing(element: ElementOrFqn<A>, filter?: OutgoingFilter): RelationshipsIterator<A>;
849
1024
  /**
850
- * Returns all tags used in the model, sorted alphabetically.
1025
+ * Returns array of all tags used in the model, sorted naturally.\
1026
+ * Use {@link specification.tags} to get all defined tags
851
1027
  */
852
1028
  get tags(): Tags<A>;
853
1029
  /**
@@ -913,9 +1089,9 @@ declare class LikeC4Model<A extends Any = Unknown> {
913
1089
  }
914
1090
  declare namespace LikeC4Model {
915
1091
  const EMPTY: LikeC4Model<Aux<"computed", string, string, string, string, SpecAux<string, string, string, string, string>>>;
916
- type Parsed<A = Unknown> = Unknown extends A ? LikeC4Model<UnknownParsed> : A extends Aux<any, infer E, infer D, infer V, infer P, infer Spec> ? LikeC4Model<Aux<'parsed', E, D, V, P, Spec>> : never;
917
- type Computed<A = Unknown> = Unknown extends A ? LikeC4Model<UnknownComputed> : A extends Aux<any, infer E, infer D, infer V, infer P, infer Spec> ? LikeC4Model<Aux<'computed', E, D, V, P, Spec>> : never;
918
- type Layouted<A = Unknown> = Unknown extends A ? LikeC4Model<UnknownLayouted> : A extends Aux<any, infer E, infer D, infer V, infer P, infer Spec> ? LikeC4Model<Aux<'layouted', E, D, V, P, Spec>> : never;
1092
+ type Parsed<A = Unknown> = Unknown extends A ? LikeC4Model<UnknownParsed> : A extends Aux<any, infer E, infer D, infer V, infer PID, infer Spec> ? LikeC4Model<Aux<'parsed', E, D, V, PID, Spec>> : never;
1093
+ type Computed<A = Unknown> = Unknown extends A ? LikeC4Model<UnknownComputed> : A extends Aux<any, infer E, infer D, infer V, infer PID, infer Spec> ? LikeC4Model<Aux<'computed', E, D, V, PID, Spec>> : never;
1094
+ type Layouted<A = Unknown> = Unknown extends A ? LikeC4Model<UnknownLayouted> : A extends Aux<any, infer E, infer D, infer V, infer PID, infer Spec> ? LikeC4Model<Aux<'layouted', E, D, V, PID, Spec>> : never;
919
1095
  type Node<A = Unknown> = A extends Any ? NodeModel<A> : never;
920
1096
  type Element<A = Unknown> = A extends Any ? ElementModel<A> : never;
921
1097
  type Relationship<A = Unknown> = A extends Any ? RelationshipModel<A> : never;
@@ -925,4 +1101,4 @@ declare namespace LikeC4Model {
925
1101
  type AnyRelation<M = Unknown> = M extends Any ? RelationshipModel<M> | DeploymentRelationModel<M> : never;
926
1102
  }
927
1103
 
928
- export { type AnyRelationshipModel as A, DeploymentNodeModel as D, ElementModel as E, type IncomingFilter as I, LikeC4ViewModel as L, NestedElementOfDeployedInstanceModel as N, type OutgoingFilter as O, RelationshipModel as R, type WithMetadata as W, DeployedInstanceModel as a, DeploymentRelationModel as b, NodeModel as c, EdgeModel as d, type DeploymentElementModel as e, type AnyLikeC4Model as f, LikeC4Model as g, type DeploymentRelationEndpoint as h, RelationshipsAccum as i, LikeC4DeploymentModel as j, type DeploymentOrFqn as k, type EdgeOrId as l, type ElementOrFqn as m, type NodeOrId as n, type WithTags as o };
1104
+ export { type AnyRelationshipModel as A, DeploymentNodeModel as D, ElementModel as E, type IncomingFilter as I, LikeC4ViewModel as L, NestedElementOfDeployedInstanceModel as N, type OutgoingFilter as O, RelationshipModel as R, type WithMetadata as W, DeployedInstanceModel as a, DeploymentRelationModel as b, NodeModel as c, EdgeModel as d, type DeploymentElementModel as e, type AnyLikeC4Model as f, LikeC4Model as g, type DeploymentRelationEndpoint as h, RelationshipsAccum as i, LikeC4DeploymentModel as j, LikeC4ViewsFolder as k, type DeploymentOrFqn as l, type EdgeOrId as m, type ElementOrFqn as n, type NodeOrId as o, type WithTags as p };
@@ -1,7 +1,7 @@
1
1
  import { Simplify, MergeExclusive, Tagged, NonEmptyTuple, IsNever, IsAny } from 'type-fest';
2
- import { A as Any, U as Unknown, g as ElementId, P as ProjectId, F as Fqn, s as DeploymentId, u as Tag, x as AllKinds, T as Tags, m as StrictViewId, k as ElementKind, W as WithOptionalTags, y as WithOptionalLinks, e as _stage, f as _type, z as WithMetadata, h as Metadata, R as RelationKind, V as ViewId, p as DeploymentFqn, D as DeploymentKind, j as MetadataKey, E as ExtractOnStage, M as ModelStage, d as UnknownParsed, b as UnknownComputed, c as UnknownLayouted, S as SpecAux, a as Aux, N as Never } from './core.DAj3LuFH.mjs';
2
+ import { A as Any, U as Unknown, g as ElementId, P as ProjectId, F as Fqn, s as DeploymentId, u as Tag, y as AllKinds, T as Tags, m as StrictViewId, k as ElementKind, W as WithOptionalTags, z as WithOptionalLinks, e as _stage, f as _type, B as WithMetadata, h as Metadata, R as RelationKind, V as ViewId, p as DeploymentFqn, D as DeploymentKind, j as MetadataKey, E as ExtractOnStage, M as ModelStage, d as UnknownParsed, b as UnknownComputed, c as UnknownLayouted, S as SpecAux, a as Aux, N as Never } from './core.BFb3p5d-.mjs';
3
3
  import { E as ExclusiveUnion, N as NonEmptyArray, L as Link, K as KeysOf } from './core.DuSLYTG6.mjs';
4
- import { I as Icon, M as MarkdownOrString, d as RelationId, T as Tag$1, N as NodeId, j as EdgeId, m as StepEdgeKind } from './core.668kXpZq.mjs';
4
+ import { I as Icon, M as MarkdownOrString, d as RelationId, T as Tag$1, P as ProjectId$1, N as NodeId, j as EdgeId, m as StepEdgeKind } from './core.668kXpZq.mjs';
5
5
  import { i as Color, R as RelationshipLineType, f as RelationshipArrowType, c as ElementShape, b as BorderStyle, a as ShapeSize, S as SpacingSize, T as TextSize, h as ThemeColor, C as ColorLiteral, e as CustomColorDefinitions } from './core.CzdwsPmY.mjs';
6
6
 
7
7
  declare namespace FqnRef {
@@ -673,7 +673,7 @@ interface DynamicViewStep<A extends Any = Any> {
673
673
  readonly description?: string;
674
674
  readonly technology?: string;
675
675
  readonly notation?: string;
676
- readonly notes?: string;
676
+ readonly notes?: MarkdownOrString;
677
677
  readonly color?: Color;
678
678
  readonly line?: RelationshipLineType;
679
679
  readonly head?: RelationshipArrowType;
@@ -847,8 +847,11 @@ type DeploymentRelation<A extends Any = Unknown> = DeploymentRelationship<A>;
847
847
  */
848
848
  interface ElementSpecification {
849
849
  tags?: Tag$1[];
850
+ title?: string;
851
+ description?: MarkdownOrString;
850
852
  technology?: string;
851
853
  notation?: string;
854
+ links?: NonEmptyArray<Link>;
852
855
  style: {
853
856
  shape?: ElementShape;
854
857
  icon?: Icon;
@@ -896,6 +899,14 @@ type Specification<A> = A extends Any ? {
896
899
  customColors?: CustomColorDefinitions;
897
900
  } : never;
898
901
 
902
+ /**
903
+ * LikeC4 projects encapsulate model, and can import from each other
904
+ */
905
+ interface LikeC4Project {
906
+ id: ProjectId$1;
907
+ title?: string;
908
+ }
909
+
899
910
  interface ComputedNode<A extends Any = Any> extends WithOptionalLinks {
900
911
  id: NodeId;
901
912
  kind: ElementKind<A> | DeploymentKind<A> | '@group';
@@ -939,7 +950,7 @@ interface ComputedEdge<A extends Any = Any> extends WithOptionalTags<A> {
939
950
  relations: RelationId[];
940
951
  kind?: RelationKind<A> | typeof StepEdgeKind;
941
952
  notation?: string;
942
- notes?: string;
953
+ notes?: MarkdownOrString;
943
954
  color?: Color;
944
955
  line?: RelationshipLineType;
945
956
  head?: RelationshipArrowType;
@@ -1105,6 +1116,7 @@ declare function isDynamicView<V extends AnyView<any>>(view: V): view is ViewWit
1105
1116
 
1106
1117
  interface BaseLikeC4ModelData<A extends Any> {
1107
1118
  projectId: ProjectId<A>;
1119
+ project: LikeC4Project;
1108
1120
  specification: Specification<A>;
1109
1121
  elements: Record<ElementId<A>, Element<A>>;
1110
1122
  deployments: {
@@ -1172,6 +1184,7 @@ type SpecTypesFromDump<J> = J extends SpecificationDump ? SpecAux<KeysOf<J['elem
1172
1184
  type LikeC4ModelDump = {
1173
1185
  [_stage]?: 'computed' | 'layouted';
1174
1186
  projectId?: string;
1187
+ project?: ProjectDump;
1175
1188
  specification: SpecificationDump;
1176
1189
  elements?: {
1177
1190
  [kind: string]: object;
@@ -1193,7 +1206,12 @@ type LikeC4ModelDump = {
1193
1206
  };
1194
1207
  imports?: {};
1195
1208
  };
1196
- type AuxFromDump<D> = D extends LikeC4ModelDump ? Aux<D[_stage] extends infer S extends string & 'computed' | 'layouted' ? S : 'computed' | 'layouted' | 'parsed', KeysOf<D['elements']>, KeysOf<D['deployments']['elements']>, KeysOf<D['views']>, D['projectId'] extends infer P extends string ? P : never, SpecTypesFromDump<D['specification']>> : Never;
1209
+ type ProjectDump = {
1210
+ id: string;
1211
+ name?: string;
1212
+ title?: string | undefined;
1213
+ };
1214
+ type AuxFromDump<D> = D extends LikeC4ModelDump ? Aux<D[_stage] extends infer S extends string & 'computed' | 'layouted' ? S : 'computed' | 'layouted' | 'parsed', KeysOf<D['elements']>, KeysOf<D['deployments']['elements']>, KeysOf<D['views']>, D['projectId'] extends infer PID extends string ? PID : never, SpecTypesFromDump<D['specification']>> : Never;
1197
1215
 
1198
1216
  interface RichTextEmpty {
1199
1217
  readonly isEmpty: true;
@@ -1272,4 +1290,4 @@ declare class RichText {
1272
1290
  equals(other: unknown): boolean;
1273
1291
  }
1274
1292
 
1275
- export { type TagSpecification as $, type AuxFromLikeC4ModelData as A, BBox as B, type ComputedLikeC4ModelData as C, type DeploymentElementStyle as D, Expression as E, FqnExpr as F, type GlobalPredicateId as G, DefaultThemeColor as H, DefaultElementShape as I, DefaultShapeSize as J, DefaultPaddingSize as K, type LayoutedLikeC4ModelData as L, ModelFqnExpr as M, DefaultTextSize as N, type ElementStyle as O, type PredicateSelector as P, type Element as Q, RichText as R, type SpecificationDump as S, DefaultLineStyle as T, DefaultArrowType as U, DefaultRelationshipColor as V, type AbstractRelationship as W, type XYPoint as X, type Relationship as Y, type ModelRelation as Z, type ElementSpecification as _, type RichTextEmpty as a, type DiagramNode as a$, isTagColorSpecified as a0, type RelationshipSpecification as a1, type Specification as a2, type EqualOperator as a3, type TagEqual as a4, isTagEqual as a5, type KindEqual as a6, isKindEqual as a7, type Participant as a8, type ParticipantOperator as a9, isExtendsElementView as aA, isDeploymentView as aB, isDynamicView as aC, type AnyIncludePredicate as aD, type AnyExcludePredicate as aE, type AnyViewRuleStyle as aF, type ViewRuleGlobalStyle as aG, isViewRuleGlobalStyle as aH, type ViewRuleGlobalPredicateRef as aI, isViewRuleGlobalPredicateRef as aJ, type AutoLayoutDirection as aK, isAutoLayoutDirection as aL, type ViewRuleAutoLayout as aM, isViewRuleAutoLayout as aN, type ViewAutoLayout as aO, type ViewManualLayout as aP, type ViewType as aQ, type BaseViewProperties as aR, type BaseParsedViewProperties as aS, type NodeNotation as aT, type ViewWithNotation as aU, type ViewWithHash as aV, type ComputedNode as aW, type ComputedEdge as aX, type ComputedElementView as aY, type ComputedDeploymentView as aZ, type ComputedDynamicView as a_, isParticipantOperator as aa, type NotOperator as ab, isNotOperator as ac, type AndOperator as ad, isAndOperator as ae, type OrOperator as af, isOrOperator as ag, type WhereOperator as ah, type Filterable as ai, type OperatorPredicate as aj, whereOperatorAsPredicate as ak, type ParsedView as al, type LayoutedView as am, isDiagramView as an, type ComputedView as ao, type ProcessedView as ap, type AnyView as aq, type ViewOnStage as ar, type ViewWithType as as, type ViewRule as at, type ViewRulePredicate as au, isViewRulePredicate as av, isViewRuleStyle as aw, isComputedView as ax, isElementView as ay, isScopedElementView as az, type RichTextOrEmpty as b, type DiagramEdge as b0, type LayoutedElementView as b1, type LayoutedDeploymentView as b2, type LayoutedDynamicView as b3, type DeploymentViewIncludePredicate as b4, type DeploymentViewExcludePredicate as b5, type DeploymentViewPredicate as b6, type DeploymentViewRuleStyle as b7, type DeploymentViewRule as b8, type ParsedDeploymentView as b9, type DynamicViewStep as ba, type DynamicViewParallelSteps as bb, getParallelStepsPrefix as bc, type DynamicViewStepOrParallel as bd, type DynamicViewIncludeRule as be, type DynamicViewRule as bf, type ParsedDynamicView as bg, isDynamicViewParallelSteps as bh, type ElementViewIncludePredicate as bi, type ElementViewExcludePredicate as bj, type ElementViewPredicate as bk, type ElementViewRuleGroup as bl, isViewRuleGroup as bm, type ElementViewRuleStyle as bn, type ElementViewRule as bo, type ParsedElementView as bp, RelationExpr as c, ModelRelationExpr as d, ModelExpression as e, FqnRef as f, type Point as g, RectBox as h, type GlobalPredicates as i, type GlobalDynamicPredicates as j, type GlobalStyleID as k, type GlobalStyles as l, type ModelGlobals as m, type ParsedLikeC4ModelData as n, type LikeC4ModelData as o, type DeploymentNode as p, type DeployedInstance as q, type DeploymentElement as r, type DeploymentElementRef as s, isDeploymentNode as t, isDeployedInstance as u, type DeploymentRelationship as v, type DeploymentRelation as w, type SpecTypesFromDump as x, type LikeC4ModelDump as y, type AuxFromDump as z };
1293
+ export { type ElementSpecification as $, type AuxFromLikeC4ModelData as A, BBox as B, type ComputedLikeC4ModelData as C, type DeploymentElementStyle as D, Expression as E, FqnExpr as F, type GlobalPredicateId as G, type AuxFromDump as H, DefaultThemeColor as I, DefaultElementShape as J, DefaultShapeSize as K, type LayoutedLikeC4ModelData as L, ModelFqnExpr as M, DefaultPaddingSize as N, DefaultTextSize as O, type PredicateSelector as P, type ElementStyle as Q, RichText as R, type SpecificationDump as S, type Element as T, DefaultLineStyle as U, DefaultArrowType as V, DefaultRelationshipColor as W, type XYPoint as X, type AbstractRelationship as Y, type Relationship as Z, type ModelRelation as _, type RichTextEmpty as a, type ComputedDeploymentView as a$, type TagSpecification as a0, isTagColorSpecified as a1, type RelationshipSpecification as a2, type Specification as a3, type EqualOperator as a4, type TagEqual as a5, isTagEqual as a6, type KindEqual as a7, isKindEqual as a8, type Participant as a9, isElementView as aA, isScopedElementView as aB, isExtendsElementView as aC, isDeploymentView as aD, isDynamicView as aE, type AnyIncludePredicate as aF, type AnyExcludePredicate as aG, type AnyViewRuleStyle as aH, type ViewRuleGlobalStyle as aI, isViewRuleGlobalStyle as aJ, type ViewRuleGlobalPredicateRef as aK, isViewRuleGlobalPredicateRef as aL, type AutoLayoutDirection as aM, isAutoLayoutDirection as aN, type ViewRuleAutoLayout as aO, isViewRuleAutoLayout as aP, type ViewAutoLayout as aQ, type ViewManualLayout as aR, type ViewType as aS, type BaseViewProperties as aT, type BaseParsedViewProperties as aU, type NodeNotation as aV, type ViewWithNotation as aW, type ViewWithHash as aX, type ComputedNode as aY, type ComputedEdge as aZ, type ComputedElementView as a_, type ParticipantOperator as aa, isParticipantOperator as ab, type NotOperator as ac, isNotOperator as ad, type AndOperator as ae, isAndOperator as af, type OrOperator as ag, isOrOperator as ah, type WhereOperator as ai, type Filterable as aj, type OperatorPredicate as ak, whereOperatorAsPredicate as al, type LikeC4Project as am, type ParsedView as an, type LayoutedView as ao, isDiagramView as ap, type ComputedView as aq, type ProcessedView as ar, type AnyView as as, type ViewOnStage as at, type ViewWithType as au, type ViewRule as av, type ViewRulePredicate as aw, isViewRulePredicate as ax, isViewRuleStyle as ay, isComputedView as az, type RichTextOrEmpty as b, type ComputedDynamicView as b0, type DiagramNode as b1, type DiagramEdge as b2, type LayoutedElementView as b3, type LayoutedDeploymentView as b4, type LayoutedDynamicView as b5, type DeploymentViewIncludePredicate as b6, type DeploymentViewExcludePredicate as b7, type DeploymentViewPredicate as b8, type DeploymentViewRuleStyle as b9, type DeploymentViewRule as ba, type ParsedDeploymentView as bb, type DynamicViewStep as bc, type DynamicViewParallelSteps as bd, getParallelStepsPrefix as be, type DynamicViewStepOrParallel as bf, type DynamicViewIncludeRule as bg, type DynamicViewRule as bh, type ParsedDynamicView as bi, isDynamicViewParallelSteps as bj, type ElementViewIncludePredicate as bk, type ElementViewExcludePredicate as bl, type ElementViewPredicate as bm, type ElementViewRuleGroup as bn, isViewRuleGroup as bo, type ElementViewRuleStyle as bp, type ElementViewRule as bq, type ParsedElementView as br, RelationExpr as c, ModelRelationExpr as d, ModelExpression as e, FqnRef as f, type Point as g, RectBox as h, type GlobalPredicates as i, type GlobalDynamicPredicates as j, type GlobalStyleID as k, type GlobalStyles as l, type ModelGlobals as m, type ParsedLikeC4ModelData as n, type LikeC4ModelData as o, type DeploymentNode as p, type DeployedInstance as q, type DeploymentElement as r, type DeploymentElementRef as s, isDeploymentNode as t, isDeployedInstance as u, type DeploymentRelationship as v, type DeploymentRelation as w, type SpecTypesFromDump as x, type LikeC4ModelDump as y, type ProjectDump as z };
@@ -1,4 +1,4 @@
1
- import { r as getDefaultExportFromCjs, C } from './core.C_C-3c1S.mjs';
1
+ import { r as getDefaultExportFromCjs, C } from './core.DQj9iv_y.mjs';
2
2
  import { u as u$1 } from './core.DbRvwARP.mjs';
3
3
  import { m } from './core.ByrmCl9I.mjs';
4
4
  import { l } from './core.8KM0D6va.mjs';
@@ -1,9 +1,9 @@
1
- import { c as customInspectSymbol } from './core.C80Z37Eu.mjs';
1
+ import { c as customInspectSymbol } from './core.C1GV0WWV.mjs';
2
2
  import { o } from './core.BgvIuGGU.mjs';
3
3
  import { a as intersection, b as stringHash, u as union, d as difference, e as equals } from './core.CpwrZi3D.mjs';
4
4
  import { u } from './core.DbRvwARP.mjs';
5
5
  import { m } from './core.ByrmCl9I.mjs';
6
- import { j as isDescendantOf, i as isAncestor, q as isString, C, l as sortNaturalByFqn, k as isSameHierarchy } from './core.C_C-3c1S.mjs';
6
+ import { j as isDescendantOf, i as isAncestor, q as isString, C, l as sortNaturalByFqn, k as isSameHierarchy } from './core.DQj9iv_y.mjs';
7
7
  import { i as isome } from './core.BoyJPEen.mjs';
8
8
  import { i as ifilter } from './core.BH9nN-_I.mjs';
9
9
  import { i as invariant } from './core.D4npX2q8.mjs';
@@ -1,14 +1,9 @@
1
1
  import { t as t$1 } from './core.zLlww-07.mjs';
2
- import { n as n$1 } from './core.D56nCp7e.mjs';
3
- import { i as invariant, n as nonexhaustive } from './core.D4npX2q8.mjs';
2
+ import { GlobalFqn } from '../types/scalar.mjs';
3
+ import { n as n$1 } from './core.CnIyafWn.mjs';
4
4
  import { o } from './core.BgvIuGGU.mjs';
5
5
  import { u } from './core.DbRvwARP.mjs';
6
-
7
- function isOnStage(value, stage) {
8
- return value[_stage] === stage;
9
- }
10
- const _stage = "_stage";
11
- const _type = "_type";
6
+ import { n as nonexhaustive } from './core.D4npX2q8.mjs';
12
7
 
13
8
  function n(e){return e==null}
14
9
 
@@ -16,68 +11,11 @@ function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
16
11
 
17
12
  function y(...a){return u(r,a)}var r=(a,o)=>o.some(e=>e(a));
18
13
 
19
- function flattenMarkdownOrString(value) {
20
- if (value === null || value === void 0) {
21
- return null;
22
- }
23
- const content = t$1(value) ? value : value.txt ?? value.md;
24
- return n$1(content?.trim()) ? content : null;
25
- }
26
- function Fqn(name, parent) {
27
- return parent ? parent + "." + name : name;
28
- }
29
- const GroupElementKind = "@group";
30
- function isGroupElementKind(v) {
31
- return v.kind === GroupElementKind;
32
- }
33
- function DeploymentFqn(name, parent) {
34
- return parent ? parent + "." + name : name;
35
- }
36
- function ViewId(id) {
37
- return id;
38
- }
39
- function RelationId(id) {
40
- return id;
41
- }
42
- function GlobalFqn(projectId, name) {
43
- invariant(n$1(projectId), "Project ID must start with @");
44
- return "@" + projectId + "." + name;
45
- }
46
- function isGlobalFqn(fqn) {
47
- return fqn.startsWith("@");
48
- }
49
- function splitGlobalFqn(fqn) {
50
- if (!fqn.startsWith("@")) {
51
- return [null, fqn];
52
- }
53
- const firstDot = fqn.indexOf(".");
54
- if (firstDot < 2) {
55
- throw new Error("Invalid global FQN");
56
- }
57
- const projectId = fqn.slice(1, firstDot);
58
- const name = fqn.slice(firstDot + 1);
59
- return [projectId, name];
60
- }
61
- function NodeId(id) {
62
- return id;
63
- }
64
- function EdgeId(id) {
65
- return id;
66
- }
67
- function stepEdgeId(step, parallelStep) {
68
- const id = `step-${String(step).padStart(2, "0")}`;
69
- return parallelStep ? `${id}.${parallelStep}` : id;
70
- }
71
- const StepEdgeKind = "@step";
72
- function isStepEdgeId(id) {
73
- return id.startsWith("step-");
74
- }
75
- function extractStep(id) {
76
- if (!isStepEdgeId(id)) {
77
- throw new Error(`Invalid step edge id: ${id}`);
78
- }
79
- return parseFloat(id.slice("step-".length));
14
+ function isOnStage(value, stage) {
15
+ return value[_stage] === stage;
80
16
  }
17
+ const _stage = "_stage";
18
+ const _type = "_type";
81
19
 
82
20
  var FqnRef;
83
21
  ((FqnRef2) => {
@@ -208,4 +146,4 @@ function participantIs(participant, predicate) {
208
146
  };
209
147
  }
210
148
 
211
- export { DeploymentFqn as D, EdgeId as E, FqnRef as F, GroupElementKind as G, NodeId as N, RelationId as R, StepEdgeKind as S, ViewId as V, _stage as _, _type as a, isDeploymentNode as b, isDeployedInstance as c, isTagEqual as d, isKindEqual as e, isParticipantOperator as f, isNotOperator as g, isAndOperator as h, isOnStage as i, isOrOperator as j, flattenMarkdownOrString as k, Fqn as l, isGroupElementKind as m, GlobalFqn as n, isGlobalFqn as o, stepEdgeId as p, isStepEdgeId as q, extractStep as r, splitGlobalFqn as s, n as t, whereOperatorAsPredicate as w, y };
149
+ export { FqnRef as F, _stage as _, _type as a, isDeploymentNode as b, isDeployedInstance as c, isTagEqual as d, isKindEqual as e, isParticipantOperator as f, isNotOperator as g, isAndOperator as h, isOnStage as i, isOrOperator as j, n, whereOperatorAsPredicate as w, y };
@@ -1,5 +1,5 @@
1
- import { r as getDefaultExportFromCjs, d as commonAncestor, f as compareFqnHierarchically } from './core.C_C-3c1S.mjs';
2
- import { r as requireForeach, a as requireIterator } from './core.CtKXPqN_.mjs';
1
+ import { r as getDefaultExportFromCjs, d as commonAncestor, f as compareFqnHierarchically } from './core.DQj9iv_y.mjs';
2
+ import { r as requireForeach, a as requireIterator } from './core.HUONfQfd.mjs';
3
3
 
4
4
  function o(r,n){let e=Math.ceil(r),t=Math.floor(n);if(t<e)throw new RangeError(`randomInteger: The range [${r.toString()},${n.toString()}] contains no integer`);return Math.floor(Math.random()*(t-e+1)+e)}
5
5
 
@@ -1,4 +1,4 @@
1
- import { r as getDefaultExportFromCjs } from './core.C_C-3c1S.mjs';
1
+ import { r as getDefaultExportFromCjs } from './core.DQj9iv_y.mjs';
2
2
 
3
3
  /**
4
4
  * Mnemonist DefaultMap