likec4 1.19.2 → 1.20.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 (38) hide show
  1. package/__app__/react/likec4.tsx +16 -114
  2. package/__app__/src/chunks/{-index-overview-COSF42be.js → -index-overview-r2wnjkuP.js} +20 -19
  3. package/__app__/src/chunks/{likec4-CusAw_j6.js → likec4-CK8zVxjc.js} +1172 -1209
  4. package/__app__/src/chunks/main-DnSU4JID.js +23887 -0
  5. package/__app__/src/chunks/{mantine-B_6mKFFA.js → mantine-B9NZkjVg.js} +993 -981
  6. package/__app__/src/chunks/tanstack-router-B9I-d36d.js +3032 -0
  7. package/__app__/src/main.js +1 -2
  8. package/__app__/src/style.css +1 -1
  9. package/__app__/webcomponent/webcomponent.js +31797 -32401
  10. package/dist/chunks/prompt.cjs +1 -1
  11. package/dist/chunks/prompt.mjs +1 -1
  12. package/dist/cli/index.cjs +47 -58
  13. package/dist/cli/index.mjs +29 -40
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.d.cts +106 -81
  16. package/dist/index.d.mts +106 -81
  17. package/dist/index.d.ts +106 -81
  18. package/dist/index.mjs +1 -1
  19. package/dist/model/index.cjs +1 -1
  20. package/dist/model/index.d.cts +4 -257
  21. package/dist/model/index.d.mts +4 -257
  22. package/dist/model/index.d.ts +4 -257
  23. package/dist/model/index.mjs +1 -1
  24. package/dist/shared/likec4.DBfW7tKq.cjs +1857 -0
  25. package/dist/shared/likec4.DCOeDSBO.mjs +1857 -0
  26. package/package.json +39 -39
  27. package/react/index.d.ts +771 -1546
  28. package/react/index.js +36748 -37458
  29. package/react/style.css +1 -1
  30. package/__app__/src/chunks/main-CtzxB_vG.js +0 -24136
  31. package/__app__/src/chunks/tanstack-router-BBWuTKWO.js +0 -2373
  32. package/dist/shared/likec4.-U9_Dinu.cjs +0 -1856
  33. package/dist/shared/likec4.CVn8U3Og.cjs +0 -9
  34. package/dist/shared/likec4.Cgd5VecV.mjs +0 -9
  35. package/dist/shared/likec4.D7BM0ZAO.mjs +0 -1856
  36. package/dist/shared/likec4.DJeGiAvE.d.cts +0 -1639
  37. package/dist/shared/likec4.DJeGiAvE.d.mts +0 -1639
  38. package/dist/shared/likec4.DJeGiAvE.d.ts +0 -1639
package/react/index.d.ts CHANGED
@@ -1,1546 +1,771 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- import { CSSProperties, DependencyList, HTMLAttributes, JSX as JSX$1, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactNode } from 'react';
4
- import { LiteralUnion, OverrideProperties, PartialDeep, Simplify, Tagged, TupleToUnion, UnionToIntersection } from 'type-fest';
5
-
6
- declare const ThemeColors: readonly [
7
- "amber",
8
- "blue",
9
- "gray",
10
- "slate",
11
- "green",
12
- "indigo",
13
- "muted",
14
- "primary",
15
- "red",
16
- "secondary",
17
- "sky"
18
- ];
19
- type ThemeColor = typeof ThemeColors[number];
20
- type HexColorLiteral = `#${string}`;
21
- type ColorLiteral = HexColorLiteral;
22
- type Color = LiteralUnion<ThemeColor, string>;
23
- interface ElementThemeColorValues {
24
- fill: ColorLiteral;
25
- stroke: ColorLiteral;
26
- hiContrast: ColorLiteral;
27
- loContrast: ColorLiteral;
28
- }
29
- interface RelationshipThemeColorValues {
30
- lineColor: ColorLiteral;
31
- labelBgColor: ColorLiteral;
32
- labelColor: ColorLiteral;
33
- }
34
- interface ThemeColorValues {
35
- elements: ElementThemeColorValues;
36
- relationships: RelationshipThemeColorValues;
37
- }
38
- type NonEmptyArray<T> = [
39
- T,
40
- ...T[]
41
- ];
42
- type IconUrl = Tagged<string, "IconUrl"> | "none";
43
- type Point = readonly [
44
- x: number,
45
- y: number
46
- ];
47
- interface XYPoint {
48
- x: number;
49
- y: number;
50
- }
51
- type AllNever<Expressions> = UnionToIntersection<{
52
- [Name in keyof Expressions]: {
53
- -readonly [Key in keyof Expressions[Name]]?: never;
54
- };
55
- }[keyof Expressions]>;
56
- type ExclusiveUnion<Expressions> = Expressions extends object ? {
57
- [Name in keyof Expressions]: Simplify<Omit<AllNever<Expressions>, keyof Expressions[Name]> & Expressions[Name]>;
58
- }[keyof Expressions] : Expressions;
59
- type Fqn<Id extends string = string> = Tagged<Id, "Fqn">;
60
- declare const BorderStyles: readonly [
61
- "solid",
62
- "dashed",
63
- "dotted",
64
- "none"
65
- ];
66
- type BorderStyle = TupleToUnion<typeof BorderStyles>;
67
- type ElementKind<Kinds extends string = string> = Tagged<Kinds, "ElementKind">;
68
- declare namespace ElementKind {
69
- const Group: ElementKind;
70
- }
71
- declare const ElementShapes: readonly [
72
- "rectangle",
73
- "person",
74
- "browser",
75
- "mobile",
76
- "cylinder",
77
- "storage",
78
- "queue"
79
- ];
80
- type ElementShape = TupleToUnion<typeof ElementShapes>;
81
- interface ElementStyle {
82
- readonly border?: BorderStyle;
83
- /**
84
- * In percentage 0-100, 0 is fully transparent
85
- *
86
- * @default 100
87
- */
88
- readonly opacity?: number;
89
- }
90
- type Tag<Tags extends string = string> = Tagged<Tags, "Tag">;
91
- interface Link {
92
- readonly title?: string;
93
- readonly url: string;
94
- readonly relative?: string;
95
- }
96
- type EqualOperator<V> = {
97
- eq: V;
98
- neq?: never;
99
- } | {
100
- eq?: never;
101
- neq: V;
102
- };
103
- type AllNever$1 = {
104
- not?: never;
105
- and?: never;
106
- or?: never;
107
- tag?: never;
108
- kind?: never;
109
- };
110
- type TagEqual<Tag> = Omit<AllNever$1, "tag"> & {
111
- tag: EqualOperator<Tag>;
112
- };
113
- type KindEqual<Kind> = Omit<AllNever$1, "kind"> & {
114
- kind: EqualOperator<Kind>;
115
- };
116
- type NotOperator<Tag, Kind> = Omit<AllNever$1, "not"> & {
117
- not: WhereOperator<Tag, Kind>;
118
- };
119
- type AndOperator<Tag, Kind> = Omit<AllNever$1, "and"> & {
120
- and: NonEmptyArray<WhereOperator<Tag, Kind>>;
121
- };
122
- type OrOperator<Tag, Kind> = Omit<AllNever$1, "or"> & {
123
- or: NonEmptyArray<WhereOperator<Tag, Kind>>;
124
- };
125
- type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
126
- interface BaseExpr {
127
- where?: never;
128
- element?: never;
129
- custom?: never;
130
- expanded?: never;
131
- elementKind?: never;
132
- elementTag?: never;
133
- isEqual?: never;
134
- isChildren?: never;
135
- isDescendants?: never;
136
- wildcard?: never;
137
- source?: never;
138
- target?: never;
139
- inout?: never;
140
- incoming?: never;
141
- outgoing?: never;
142
- customRelation?: never;
143
- }
144
- interface ElementRefExpr extends Omit<BaseExpr, "element" | "isChildren" | "isDescendants"> {
145
- element: Fqn;
146
- isChildren?: boolean;
147
- isDescendants?: boolean;
148
- }
149
- interface ExpandedElementExpr extends Omit<BaseExpr, "expanded"> {
150
- expanded: Fqn;
151
- }
152
- interface CustomElementExpr extends Omit<BaseExpr, "custom"> {
153
- custom: {
154
- expr: ElementExpression | ElementWhereExpr;
155
- title?: string;
156
- description?: string;
157
- technology?: string;
158
- notation?: string;
159
- shape?: ElementShape;
160
- color?: Color;
161
- icon?: IconUrl;
162
- border?: BorderStyle;
163
- opacity?: number;
164
- navigateTo?: ViewId;
165
- };
166
- }
167
- interface WildcardExpr extends Omit<BaseExpr, "wildcard"> {
168
- wildcard: true;
169
- }
170
- interface ElementKindExpr extends Omit<BaseExpr, "elementKind" | "isEqual"> {
171
- elementKind: ElementKind;
172
- isEqual: boolean;
173
- }
174
- interface ElementTagExpr extends Omit<BaseExpr, "elementTag" | "isEqual"> {
175
- elementTag: Tag;
176
- isEqual: boolean;
177
- }
178
- type NonWilcard = ElementRefExpr | ElementKindExpr | ElementTagExpr | ExpandedElementExpr;
179
- type ElementExpression = NonWilcard | WildcardExpr;
180
- interface ElementWhereExpr extends Omit<BaseExpr, "where"> {
181
- where: {
182
- expr: ElementExpression;
183
- condition: WhereOperator<string, string>;
184
- };
185
- }
186
- type ElementPredicateExpression = ElementExpression | ElementWhereExpr | CustomElementExpr;
187
- interface DirectRelationExpr extends Omit<BaseExpr, "source" | "target"> {
188
- source: ElementExpression;
189
- target: ElementExpression;
190
- isBidirectional?: boolean;
191
- }
192
- interface InOutExpr extends Omit<BaseExpr, "inout"> {
193
- inout: ElementExpression;
194
- }
195
- interface IncomingExpr extends Omit<BaseExpr, "incoming"> {
196
- incoming: ElementExpression;
197
- }
198
- interface OutgoingExpr extends Omit<BaseExpr, "outgoing"> {
199
- outgoing: ElementExpression;
200
- }
201
- type RelationExpression = DirectRelationExpr | InOutExpr | IncomingExpr | OutgoingExpr;
202
- interface RelationWhereExpr extends Omit<BaseExpr, "where"> {
203
- where: {
204
- expr: RelationExpression;
205
- condition: WhereOperator<string, string>;
206
- };
207
- }
208
- interface CustomRelationExpr extends Omit<BaseExpr, "customRelation"> {
209
- customRelation: {
210
- relation: RelationExpression | RelationWhereExpr;
211
- title?: string;
212
- description?: string;
213
- technology?: string;
214
- notation?: string;
215
- navigateTo?: ViewId;
216
- notes?: string;
217
- color?: Color;
218
- line?: RelationshipLineType;
219
- head?: RelationshipArrowType;
220
- tail?: RelationshipArrowType;
221
- };
222
- }
223
- type RelationPredicateExpression = RelationExpression | RelationWhereExpr | CustomRelationExpr;
224
- type Expression = ElementPredicateExpression | RelationPredicateExpression;
225
- declare namespace FqnRef {
226
- /**
227
- * Represents a reference to an instance within a deployment.
228
- *
229
- * @template D - The type representing the deployment fqn. Defaults to `Fqn`.
230
- * @template M - The type representing the model fqn. Defaults to `Fqn`.
231
- *
232
- * @property {D} deployment - TThe fully qualified name (FQN) of the deployed instance.
233
- * @property {M} element - The element reference within the deployment.
234
- */
235
- type InsideInstanceRef<D = Fqn, M = Fqn> = {
236
- deployment: D;
237
- element: M;
238
- };
239
- const isInsideInstanceRef: (ref: FqnRef) => ref is InsideInstanceRef;
240
- /**
241
- * Represents a reference to a deployment element.
242
- *
243
- * @template F - The type of the fully qualified name (FQN) of the deployment element. Defaults to `Fqn`.
244
- * @property {F} deployment - The fully qualified name (FQN) of the deployment element.
245
- */
246
- type DeploymentElementRef<F = Fqn> = {
247
- deployment: F;
248
- };
249
- const isDeploymentElementRef: (ref: FqnRef) => ref is DeploymentElementRef;
250
- type DeploymentRef<D = Fqn, M = Fqn> = DeploymentElementRef<D> | InsideInstanceRef<D, M>;
251
- const isDeploymentRef: (ref: FqnRef) => ref is DeploymentRef;
252
- /**
253
- * Reference to logical model element
254
- */
255
- type ModelRef<F = Fqn> = {
256
- model: F;
257
- };
258
- const isModelRef: (ref: FqnRef) => ref is ModelRef;
259
- const toDeploymentRef: (ref: FqnRef) => DeploymentRef;
260
- }
261
- type FqnRef<D = Fqn, M = Fqn> = ExclusiveUnion<{
262
- InsideInstanceRef: FqnRef.InsideInstanceRef<D, M>;
263
- DeploymentRef: FqnRef.DeploymentRef<D>;
264
- ModelRef: FqnRef.ModelRef<M>;
265
- }>;
266
- declare namespace FqnExpr {
267
- type Wildcard = {
268
- wildcard: true;
269
- };
270
- const isWildcard: (expr: ExpressionV2) => expr is Wildcard;
271
- type ModelRef<M = Fqn> = {
272
- ref: FqnRef.ModelRef<M>;
273
- selector?: PredicateSelector;
274
- };
275
- const isModelRef: (ref: ExpressionV2) => ref is ModelRef;
276
- type DeploymentRef<D = Fqn, M = Fqn> = {
277
- ref: FqnRef.DeploymentRef<D> | FqnRef.InsideInstanceRef<D, M>;
278
- selector?: PredicateSelector;
279
- };
280
- const isDeploymentRef: (ref: ExpressionV2) => ref is FqnExpr.DeploymentRef;
281
- type NonWildcard<D = Fqn, M = Fqn> = ExclusiveUnion<{
282
- ModelRef: ModelRef<M>;
283
- DeploymentRef: DeploymentRef<D, M>;
284
- }>;
285
- }
286
- type FqnExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
287
- Wildcard: FqnExpr.Wildcard;
288
- ModelRef: FqnExpr.ModelRef<M>;
289
- DeploymentRef: FqnExpr.DeploymentRef<D, M>;
290
- }>;
291
- declare namespace RelationExpr {
292
- type Direct<D = Fqn, M = Fqn> = {
293
- source: FqnExpr<D, M>;
294
- target: FqnExpr<D, M>;
295
- isBidirectional?: boolean;
296
- };
297
- const isDirect: (expr: ExpressionV2) => expr is Direct;
298
- type Incoming<D = Fqn, M = Fqn> = {
299
- incoming: FqnExpr<D, M>;
300
- };
301
- const isIncoming: (expr: ExpressionV2) => expr is Incoming;
302
- type Outgoing<D = Fqn, M = Fqn> = {
303
- outgoing: FqnExpr<D, M>;
304
- };
305
- const isOutgoing: (expr: ExpressionV2) => expr is Outgoing;
306
- type InOut<D = Fqn, M = Fqn> = {
307
- inout: FqnExpr<D, M>;
308
- };
309
- const isInOut: (expr: ExpressionV2) => expr is InOut;
310
- type Where<D = Fqn, M = Fqn> = {
311
- where: {
312
- expr: ExpressionV2<D, M>;
313
- condition: WhereOperator<string, string>;
314
- };
315
- };
316
- const isWhere: (expr: ExpressionV2) => expr is Where;
317
- }
318
- type RelationExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
319
- Direct: RelationExpr.Direct<D, M>;
320
- Incoming: RelationExpr.Incoming<D, M>;
321
- Outgoing: RelationExpr.Outgoing<D, M>;
322
- InOut: RelationExpr.InOut<D, M>;
323
- Where: RelationExpr.Where<D, M>;
324
- }>;
325
- type ExpressionV2<D = Fqn, M = Fqn> = ExclusiveUnion<{
326
- Wildcard: FqnExpr.Wildcard;
327
- ModelRef: FqnExpr.ModelRef<M>;
328
- DeploymentRef: FqnExpr.DeploymentRef<D, M>;
329
- Direct: RelationExpr.Direct<D, M>;
330
- Incoming: RelationExpr.Incoming<D, M>;
331
- Outgoing: RelationExpr.Outgoing<D, M>;
332
- InOut: RelationExpr.InOut<D, M>;
333
- RelationPredicateOrWhere: RelationExpr.Where<D, M>;
334
- }>;
335
- declare namespace ExpressionV2 {
336
- const isFqnExpr: (expr: ExpressionV2) => expr is FqnExpr;
337
- const isRelation: (expr: ExpressionV2) => expr is RelationExpr;
338
- }
339
- type GlobalPredicateId = Tagged<string, "GlobalPredicateId">;
340
- type GlobalStyleID = Tagged<string, "GlobalStyleID">;
341
- type ElementNotation = {
342
- kinds: string[];
343
- shape: ElementShape;
344
- color: Color;
345
- title: string;
346
- };
347
- type ViewId<Id extends string = string> = Tagged<Id, "ViewID">;
348
- type ViewRulePredicate = {
349
- include: Expression[];
350
- exclude?: never;
351
- } | {
352
- include?: never;
353
- exclude: Expression[];
354
- };
355
- interface ViewRuleGlobalPredicateRef {
356
- predicateId: GlobalPredicateId;
357
- }
358
- interface ViewRuleStyle {
359
- targets: ElementExpression[];
360
- notation?: string;
361
- style: ElementStyle & {
362
- color?: Color;
363
- shape?: ElementShape;
364
- icon?: IconUrl;
365
- };
366
- }
367
- interface ViewRuleGlobalStyle {
368
- styleId: GlobalStyleID;
369
- }
370
- type AutoLayoutDirection = "TB" | "BT" | "LR" | "RL";
371
- interface ViewRuleAutoLayout {
372
- direction: AutoLayoutDirection;
373
- nodeSep?: number;
374
- rankSep?: number;
375
- }
376
- interface ViewRuleGroup {
377
- groupRules: Array<ViewRulePredicate | ViewRuleGroup>;
378
- title: string | null;
379
- color?: Color;
380
- border?: BorderStyle;
381
- opacity?: number;
382
- }
383
- type ViewRule = ViewRulePredicate | ViewRuleGlobalPredicateRef | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
384
- interface BasicView<ViewType extends "element" | "dynamic" | "deployment", ViewIDs extends string, Tags extends string> {
385
- readonly __?: ViewType;
386
- readonly id: ViewId<ViewIDs>;
387
- readonly title: string | null;
388
- readonly description: string | null;
389
- readonly tags: NonEmptyArray<Tag<Tags>> | null;
390
- readonly links: NonEmptyArray<Link> | null;
391
- /**
392
- * URI to the source file of this view.
393
- * Undefined if the view is auto-generated.
394
- */
395
- readonly docUri?: string;
396
- /**
397
- * For all views we find common ancestor path.
398
- * This is used to generate relative paths, i.e.:
399
- * - "/home/project/index.c4" becomes "index.c4"
400
- * - "/home/project/subdir/views.c4" becomes "subdir/views.c4"
401
- *
402
- * Undefined if the view is auto-generated.
403
- */
404
- readonly relativePath?: string;
405
- /**
406
- * If the view is changed manually this field contains the layout data.
407
- */
408
- readonly manualLayout?: ViewManualLayout | undefined;
409
- readonly customColorDefinitions: CustomColorDefinitions;
410
- }
411
- interface BasicElementView<ViewIDs extends string, Tags extends string> extends BasicView<"element", ViewIDs, Tags> {
412
- readonly viewOf?: Fqn;
413
- readonly rules: ViewRule[];
414
- }
415
- interface ScopedElementView<ViewIDs extends string, Tags extends string> extends BasicElementView<ViewIDs, Tags> {
416
- readonly viewOf: Fqn;
417
- }
418
- interface ExtendsElementView<ViewIDs extends string, Tags extends string> extends BasicElementView<ViewIDs, Tags> {
419
- readonly extends: ViewId<ViewIDs>;
420
- }
421
- type ElementView<ViewIDs extends string = string, Tags extends string = string> = ScopedElementView<ViewIDs, Tags> | ExtendsElementView<ViewIDs, Tags> | BasicElementView<ViewIDs, Tags>;
422
- interface DynamicViewStep {
423
- readonly source: Fqn;
424
- readonly target: Fqn;
425
- readonly title: string | null;
426
- readonly description?: string;
427
- readonly technology?: string;
428
- readonly notation?: string;
429
- readonly notes?: string;
430
- readonly color?: Color;
431
- readonly line?: RelationshipLineType;
432
- readonly head?: RelationshipArrowType;
433
- readonly tail?: RelationshipArrowType;
434
- readonly isBackward?: boolean;
435
- readonly navigateTo?: ViewId;
436
- __parallel?: never;
437
- }
438
- interface DynamicViewParallelSteps {
439
- readonly __parallel: DynamicViewStep[];
440
- }
441
- type DynamicViewStepOrParallel = DynamicViewStep | DynamicViewParallelSteps;
442
- type DynamicViewIncludeRule = {
443
- include: ElementPredicateExpression[];
444
- };
445
- type DynamicViewRule = DynamicViewIncludeRule | ViewRuleGlobalPredicateRef | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
446
- interface DynamicView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<"dynamic", ViewIDs, Tags> {
447
- readonly __: "dynamic";
448
- readonly steps: DynamicViewStepOrParallel[];
449
- readonly rules: DynamicViewRule[];
450
- }
451
- type CustomColorDefinitions = {
452
- [key: string]: ThemeColorValues;
453
- };
454
- type DeploymentViewRulePredicate = {
455
- include: ExpressionV2[];
456
- exclude?: never;
457
- } | {
458
- include?: never;
459
- exclude: ExpressionV2[];
460
- };
461
- type DeploymentViewRuleStyle = {
462
- targets: FqnExpr[];
463
- notation?: string;
464
- style: ElementStyle & {
465
- color?: Color;
466
- shape?: ElementShape;
467
- icon?: IconUrl;
468
- };
469
- };
470
- type DeploymentViewRule = DeploymentViewRulePredicate | ViewRuleAutoLayout | DeploymentViewRuleStyle;
471
- interface DeploymentView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<"deployment", ViewIDs, Tags> {
472
- readonly __: "deployment";
473
- readonly rules: DeploymentViewRule[];
474
- }
475
- type NodeId<IDs extends string = string> = Tagged<IDs, "Fqn">;
476
- type EdgeId = Tagged<string, "EdgeId">;
477
- interface ComputedNode {
478
- id: NodeId;
479
- kind: string;
480
- parent: NodeId | null;
481
- /**
482
- * Reference to model element
483
- * If 1 - node id is a reference
484
- */
485
- modelRef?: 1 | Fqn;
486
- /**
487
- * Reference to deployment element
488
- * If 1 - node id is a reference
489
- */
490
- deploymentRef?: 1 | Fqn;
491
- title: string;
492
- description: string | null;
493
- technology: string | null;
494
- notation?: string;
495
- tags: NonEmptyArray<Tag> | null;
496
- links: NonEmptyArray<Link> | null;
497
- children: NodeId[];
498
- inEdges: EdgeId[];
499
- outEdges: EdgeId[];
500
- shape: ElementShape;
501
- color: Color;
502
- /**
503
- * @deprecated Use `style` instead
504
- */
505
- icon?: IconUrl;
506
- style: ElementStyle;
507
- navigateTo?: ViewId;
508
- level: number;
509
- depth?: number;
510
- /**
511
- * If this node was customized in the view
512
- */
513
- isCustomized?: boolean;
514
- }
515
- declare namespace ComputedNode {
516
- function modelRef(node: ComputedNode): Fqn | null;
517
- function deploymentRef(node: ComputedNode): Fqn | null;
518
- /**
519
- * Nodes group is a special kind of node, exisiting only in view
520
- */
521
- function isNodesGroup(node: ComputedNode): boolean;
522
- }
523
- interface ComputedEdge {
524
- id: EdgeId;
525
- parent: NodeId | null;
526
- source: NodeId;
527
- target: NodeId;
528
- label: string | null;
529
- description?: string;
530
- technology?: string;
531
- relations: RelationId[];
532
- kind?: RelationshipKind;
533
- notation?: string;
534
- notes?: string;
535
- color?: Color;
536
- line?: RelationshipLineType;
537
- head?: RelationshipArrowType;
538
- tail?: RelationshipArrowType;
539
- tags?: NonEmptyArray<Tag>;
540
- navigateTo?: ViewId;
541
- /**
542
- * If this edge is derived from custom relationship predicate
543
- */
544
- isCustomized?: boolean;
545
- /**
546
- * For layouting purposes
547
- * @default 'forward'
548
- */
549
- dir?: "forward" | "back" | "both";
550
- }
551
- interface ViewWithHash {
552
- /**
553
- * Hash of the view object.
554
- * This is used to detect changes in layout
555
- */
556
- hash: string;
557
- }
558
- interface ViewWithNotation {
559
- notation?: {
560
- elements: ElementNotation[];
561
- };
562
- }
563
- interface ViewAutoLayout {
564
- direction: ViewRuleAutoLayout["direction"];
565
- rankSep?: number;
566
- nodeSep?: number;
567
- }
568
- interface ComputedElementView<ViewIDs extends string = string, Tags extends string = string> extends Omit<ElementView<ViewIDs, Tags>, "rules" | "docUri">, ViewWithHash, ViewWithNotation {
569
- readonly extends?: ViewId<ViewIDs>;
570
- readonly autoLayout: ViewAutoLayout;
571
- readonly nodes: ComputedNode[];
572
- readonly edges: ComputedEdge[];
573
- rules?: never;
574
- docUri?: never;
575
- }
576
- interface ComputedDynamicView<ViewIDs extends string = string, Tags extends string = string> extends Omit<DynamicView<ViewIDs, Tags>, "rules" | "steps" | "docUri">, ViewWithHash, ViewWithNotation {
577
- readonly autoLayout: ViewAutoLayout;
578
- readonly nodes: ComputedNode[];
579
- readonly edges: ComputedEdge[];
580
- steps?: never;
581
- rules?: never;
582
- docUri?: never;
583
- }
584
- interface ComputedDeploymentView<ViewIDs extends string = string, Tags extends string = string> extends Omit<DeploymentView<ViewIDs, Tags>, "rules" | "docUri">, ViewWithHash, ViewWithNotation {
585
- readonly autoLayout: ViewAutoLayout;
586
- readonly nodes: ComputedNode[];
587
- readonly edges: ComputedEdge[];
588
- rules?: never;
589
- docUri?: never;
590
- }
591
- type ComputedView<ViewIDs extends string = string, Tags extends string = string> = ComputedElementView<ViewIDs, Tags> | ComputedDynamicView<ViewIDs, Tags> | ComputedDeploymentView<ViewIDs, Tags>;
592
- declare namespace ComputedView {
593
- function isDeployment(view: ComputedView): view is ComputedDeploymentView;
594
- function isDynamic(view: ComputedView): view is ComputedDynamicView;
595
- function isElement(view: ComputedView): view is ComputedElementView;
596
- }
597
- type BBox = {
598
- x: number;
599
- y: number;
600
- width: number;
601
- height: number;
602
- };
603
- interface DiagramNode extends ComputedNode {
604
- width: number;
605
- height: number;
606
- position: Point;
607
- labelBBox: BBox;
608
- }
609
- declare namespace DiagramNode {
610
- function modelRef(node: DiagramNode): Fqn | null;
611
- function deploymentRef(node: DiagramNode): Fqn | null;
612
- /**
613
- * Nodes group is a special kind of node, exisiting only in view
614
- */
615
- function isNodesGroup(node: DiagramNode): boolean;
616
- }
617
- interface DiagramEdge extends ComputedEdge {
618
- points: NonEmptyArray<Point>;
619
- controlPoints?: NonEmptyArray<XYPoint>;
620
- labelBBox?: BBox | null;
621
- dotpos?: string;
622
- }
623
- export interface DiagramView<ViewIDs extends string = string, Tags extends string = string> extends Omit<ComputedView<ViewIDs, Tags>, "nodes" | "edges" | "manualLayout"> {
624
- readonly nodes: DiagramNode[];
625
- readonly edges: DiagramEdge[];
626
- readonly bounds: BBox;
627
- /**
628
- * If diagram has manual layout
629
- * But was changed and layout should be recalculated
630
- */
631
- hasLayoutDrift?: boolean;
632
- manualLayout?: never;
633
- }
634
- type ViewManualLayout = {
635
- readonly hash: string;
636
- readonly x: number;
637
- readonly y: number;
638
- readonly width: number;
639
- readonly height: number;
640
- readonly autoLayout: ViewAutoLayout;
641
- readonly nodes: Record<string, {
642
- isCompound: boolean;
643
- x: number;
644
- y: number;
645
- width: number;
646
- height: number;
647
- }>;
648
- readonly edges: Record<string, {
649
- dotpos?: string;
650
- points: NonEmptyArray<Point>;
651
- controlPoints?: NonEmptyArray<XYPoint>;
652
- labelBBox?: BBox;
653
- }>;
654
- };
655
- type RelationId = Tagged<string, "RelationID">;
656
- type RelationshipKind<Kinds extends string = string> = Tagged<Kinds, "RelationshipKind">;
657
- type RelationshipLineType = "dashed" | "solid" | "dotted";
658
- type RelationshipArrowType = "none" | "normal" | "onormal" | "dot" | "odot" | "diamond" | "odiamond" | "crow" | "open" | "vee";
659
- type PredicateSelector = "children" | "expanded" | "descendants";
660
- declare namespace ViewChange {
661
- interface ChangeElementStyle {
662
- op: "change-element-style";
663
- style: {
664
- border?: BorderStyle;
665
- opacity?: number;
666
- shape?: ElementShape;
667
- color?: ThemeColor;
668
- };
669
- targets: NonEmptyArray<Fqn>;
670
- }
671
- interface SaveManualLayout {
672
- op: "save-manual-layout";
673
- layout: ViewManualLayout;
674
- }
675
- interface ChangeAutoLayout {
676
- op: "change-autolayout";
677
- layout: {
678
- direction: AutoLayoutDirection;
679
- nodeSep?: number | null;
680
- rankSep?: number | null;
681
- };
682
- }
683
- }
684
- type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
685
- interface VariantColorsResolverInput {
686
- color: MantineColor | undefined;
687
- theme: MantineTheme;
688
- variant: string;
689
- gradient?: MantineGradient;
690
- autoContrast?: boolean;
691
- }
692
- interface VariantColorResolverResult {
693
- background: string;
694
- hover: string;
695
- color: string;
696
- border: string;
697
- hoverColor?: string;
698
- }
699
- type VariantColorsResolver = (input: VariantColorsResolverInput) => VariantColorResolverResult;
700
- interface MantineTheme {
701
- /** Controls focus ring styles. Supports the following options:
702
- * - `auto` – focus ring is displayed only when the user navigates with keyboard (default value)
703
- * - `always` – focus ring is displayed when the user navigates with keyboard and mouse
704
- * - `never` focus ring is always hidden (not recommended)
705
- */
706
- focusRing: "auto" | "always" | "never";
707
- /** Rem units scale, change if you customize font-size of `<html />` element
708
- * default value is `1` (for `100%`/`16px` font-size on `<html />`)
709
- */
710
- scale: number;
711
- /** Determines whether `font-smoothing` property should be set on the body, `true` by default */
712
- fontSmoothing: boolean;
713
- /** White color */
714
- white: string;
715
- /** Black color */
716
- black: string;
717
- /** Object of colors, key is color name, value is an array of at least 10 strings (colors) */
718
- colors: MantineThemeColors;
719
- /** Index of theme.colors[color].
720
- * Primary shade is used in all components to determine which color from theme.colors[color] should be used.
721
- * Can be either a number (0–9) or an object to specify different color shades for light and dark color schemes.
722
- * Default value `{ light: 6, dark: 8 }`
723
- *
724
- * For example,
725
- * { primaryShade: 6 } // shade 6 is used both for dark and light color schemes
726
- * { primaryShade: { light: 6, dark: 7 } } // different shades for dark and light color schemes
727
- * */
728
- primaryShade: MantineColorShade | MantinePrimaryShade;
729
- /** Key of `theme.colors`, hex/rgb/hsl values are not supported.
730
- * Determines which color will be used in all components by default.
731
- * Default value `blue`.
732
- * */
733
- primaryColor: string;
734
- /** Function to resolve colors based on variant.
735
- * Can be used to deeply customize how colors are applied to `Button`, `ActionIcon`, `ThemeIcon`
736
- * and other components that use colors from theme.
737
- * */
738
- variantColorResolver: VariantColorsResolver;
739
- /** Determines whether text color must be changed based on the given `color` prop in filled variant
740
- * For example, if you pass `color="blue.1"` to Button component, text color will be changed to `var(--mantine-color-black)`
741
- * Default value – `false`
742
- * */
743
- autoContrast: boolean;
744
- /** Determines which luminance value is used to determine if text color should be light or dark.
745
- * Used only if `theme.autoContrast` is set to `true`.
746
- * Default value is `0.3`
747
- * */
748
- luminanceThreshold: number;
749
- /** Font-family used in all components, system fonts by default */
750
- fontFamily: string;
751
- /** Monospace font-family, used in code and other similar components, system fonts by default */
752
- fontFamilyMonospace: string;
753
- /** Controls various styles of h1-h6 elements, used in TypographyStylesProvider and Title components */
754
- headings: {
755
- fontFamily: string;
756
- fontWeight: string;
757
- textWrap: "wrap" | "nowrap" | "balance" | "pretty" | "stable";
758
- sizes: {
759
- h1: HeadingStyle;
760
- h2: HeadingStyle;
761
- h3: HeadingStyle;
762
- h4: HeadingStyle;
763
- h5: HeadingStyle;
764
- h6: HeadingStyle;
765
- };
766
- };
767
- /** Object of values that are used to set `border-radius` in all components that support it */
768
- radius: MantineRadiusValues;
769
- /** Key of `theme.radius` or any valid CSS value. Default `border-radius` used by most components */
770
- defaultRadius: MantineRadius;
771
- /** Object of values that are used to set various CSS properties that control spacing between elements */
772
- spacing: MantineSpacingValues;
773
- /** Object of values that are used to control `font-size` property in all components */
774
- fontSizes: MantineFontSizesValues;
775
- /** Object of values that are used to control `line-height` property in `Text` component */
776
- lineHeights: MantineLineHeightValues;
777
- /** Object of values that are used to control breakpoints in all components,
778
- * values are expected to be defined in em
779
- * */
780
- breakpoints: MantineBreakpointsValues;
781
- /** Object of values that are used to add `box-shadow` styles to components that support `shadow` prop */
782
- shadows: MantineShadowsValues;
783
- /** Determines whether user OS settings to reduce motion should be respected, `false` by default */
784
- respectReducedMotion: boolean;
785
- /** Determines which cursor type will be used for interactive elements
786
- * - `default` – cursor that is used by native HTML elements, for example, `input[type="checkbox"]` has `cursor: default` styles
787
- * - `pointer` – sets `cursor: pointer` on interactive elements that do not have these styles by default
788
- */
789
- cursorType: "default" | "pointer";
790
- /** Default gradient configuration for components that support `variant="gradient"` */
791
- defaultGradient: MantineGradient;
792
- /** Class added to the elements that have active styles, for example, `Button` and `ActionIcon` */
793
- activeClassName: string;
794
- /** Class added to the elements that have focus styles, for example, `Button` or `ActionIcon`.
795
- * Overrides `theme.focusRing` property.
796
- */
797
- focusClassName: string;
798
- /** Allows adding `classNames`, `styles` and `defaultProps` to any component */
799
- components: MantineThemeComponents;
800
- /** Any other properties that you want to access with the theme objects */
801
- other: MantineThemeOther;
802
- }
803
- type MantineThemeOverride = PartialDeep<MantineTheme>;
804
- interface MantineThemeComponent {
805
- classNames?: any;
806
- styles?: any;
807
- vars?: any;
808
- defaultProps?: any;
809
- }
810
- type MantineThemeComponents = Record<string, MantineThemeComponent>;
811
- interface HeadingStyle {
812
- fontSize: string;
813
- fontWeight?: string;
814
- lineHeight: string;
815
- }
816
- type MantineSize = "xs" | "sm" | "md" | "lg" | "xl";
817
- type MantineBreakpointsValues = Record<MantineSize | (string & {}), string>;
818
- type MantineFontSizesValues = Record<MantineSize | (string & {}), string>;
819
- type MantineRadiusValues = Record<MantineSize | (string & {}), string>;
820
- type MantineSpacingValues = Record<MantineSize | (string & {}), string>;
821
- type MantineShadowsValues = Record<MantineSize | (string & {}), string>;
822
- type MantineLineHeightValues = Record<MantineSize | (string & {}), string>;
823
- type MantineRadius = keyof MantineRadiusValues | (string & {}) | number;
824
- interface MantineThemeOther {
825
- [key: string]: any;
826
- }
827
- interface MantineGradient {
828
- from: string;
829
- to: string;
830
- deg?: number;
831
- }
832
- type MantineColorsTuple = readonly [
833
- string,
834
- string,
835
- string,
836
- string,
837
- string,
838
- string,
839
- string,
840
- string,
841
- string,
842
- string,
843
- ...string[]
844
- ];
845
- type MantineColorShade = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
846
- interface MantinePrimaryShade {
847
- light: MantineColorShade;
848
- dark: MantineColorShade;
849
- }
850
- type DefaultMantineColor = "dark" | "gray" | "red" | "pink" | "grape" | "violet" | "indigo" | "blue" | "cyan" | "green" | "lime" | "yellow" | "orange" | "teal" | (string & {});
851
- interface MantineThemeColorsOverride {
852
- }
853
- type MantineThemeColors = MantineThemeColorsOverride extends {
854
- colors: Record<infer CustomColors, MantineColorsTuple>;
855
- } ? Record<CustomColors, MantineColorsTuple> : Record<DefaultMantineColor, MantineColorsTuple>;
856
- type MantineColor = keyof MantineThemeColors;
857
- export type ViewData<Views extends string, Tag extends string = string> = DiagramView<Views, Tag>;
858
- type ElementIconRendererProps = {
859
- node: {
860
- id: string;
861
- title: string;
862
- icon?: string | undefined;
863
- };
864
- };
865
- export type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode;
866
- export type LikeC4ViewProps<ViewId extends string, Tag extends string, Kind extends string> = {
867
- /**
868
- * View to display.
869
- */
870
- viewId: ViewId;
871
- /**
872
- * Background pattern
873
- * @default 'transparent'
874
- */
875
- background?: "dots" | "lines" | "cross" | "transparent" | "solid" | undefined;
876
- /**
877
- * Background pattern for the browser view.
878
- * @default 'dots'
879
- */
880
- browserBackground?: "dots" | "lines" | "cross" | "transparent" | "solid" | undefined;
881
- /**
882
- * Click on the view opens a modal with browser.
883
- *
884
- * @default true
885
- */
886
- interactive?: boolean;
887
- /**
888
- * By default determined by the user's system preferences.
889
- */
890
- colorScheme?: "light" | "dark" | undefined;
891
- /**
892
- * LikeC4 views are using 'IBM Plex Sans' font.
893
- * By default, component injects the CSS to document head.
894
- * Set to false if you want to handle the font yourself.
895
- *
896
- * @default true
897
- */
898
- injectFontCss?: boolean | undefined;
899
- /**
900
- * Display webview with diagram title / description
901
- * @default false
902
- */
903
- showDiagramTitle?: boolean | undefined;
904
- /**
905
- * Show back/forward navigation buttons
906
- * @default false
907
- */
908
- showNavigationButtons?: undefined | boolean;
909
- /**
910
- * Display notations of the view
911
- * @default false
912
- */
913
- showNotations?: boolean | undefined;
914
- /**
915
- * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
916
- * Conflicts with `interactive`
917
- *
918
- * @default false
919
- */
920
- enableFocusMode?: boolean | undefined;
921
- /**
922
- * Enable popup with element details
923
- * @default false
924
- */
925
- enableElementDetails?: boolean | undefined;
926
- /**
927
- * Experimental feature to browse relationships
928
- *
929
- * @default enableElementDetails
930
- */
931
- enableRelationshipBrowser?: boolean | undefined;
932
- /**
933
- * Display dropdown with details on relationship's label click
934
- * @default enableRelationshipBrowser
935
- */
936
- enableRelationshipDetails?: boolean | undefined;
937
- where?: WhereOperator<Tag, Kind> | undefined;
938
- className?: string | undefined;
939
- style?: CSSProperties | undefined;
940
- browserClassName?: string | undefined;
941
- browserStyle?: CSSProperties | undefined;
942
- mantineTheme?: MantineThemeOverride | undefined;
943
- /** Function to generate nonce attribute added to all generated `<style />` tags */
944
- styleNonce?: string | (() => string) | undefined;
945
- };
946
- export type LikeC4BrowserProps<ViewId extends string, Tag extends string, Kind extends string> = Pick<HTMLAttributes<HTMLDialogElement>, "style" | "className"> & {
947
- view: ViewData<ViewId>;
948
- /**
949
- * By default determined by the user's system preferences.
950
- */
951
- colorScheme?: "light" | "dark";
952
- /**
953
- * LikeC4 views are using 'IBM Plex Sans' font.
954
- * By default, component injects the CSS to document head.
955
- * Set to false if you want to handle the font yourself.
956
- *
957
- * @default true
958
- */
959
- injectFontCss?: boolean | undefined;
960
- /**
961
- * Background pattern
962
- * @default 'dots'
963
- */
964
- background?: "dots" | "lines" | "cross" | "transparent" | "solid" | undefined;
965
- onNavigateTo: (to: ViewId) => void;
966
- onClose: () => void;
967
- /**
968
- * Render custom icon for a node
969
- * By default, if icon is http:// or https://, it will be rendered as an image
970
- */
971
- renderIcon?: ElementIconRenderer | undefined;
972
- where?: WhereOperator<Tag, Kind> | undefined;
973
- mantineTheme?: MantineThemeOverride | undefined;
974
- /** Function to generate nonce attribute added to all generated `<style />` tags */
975
- styleNonce?: string | (() => string) | undefined;
976
- /**
977
- * Enable popup with element details
978
- * @default true
979
- */
980
- enableElementDetails?: boolean | undefined;
981
- /**
982
- * Experimental feature to browse relationships
983
- *
984
- * @default enableElementDetails
985
- */
986
- enableRelationshipBrowser?: boolean | undefined;
987
- /**
988
- * Display dropdown with details on relationship's label click
989
- * @default enableRelationshipBrowser
990
- */
991
- enableRelationshipDetails?: boolean | undefined;
992
- };
993
- export declare function LikeC4Browser<ViewId extends string = string, Tag extends string = string, Kind extends string = string>({ className, colorScheme, view, injectFontCss, onNavigateTo, onClose, renderIcon, where, style, mantineTheme, background, styleNonce, enableElementDetails, enableRelationshipBrowser, enableRelationshipDetails, }: LikeC4BrowserProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
994
- export type LikeC4ViewEmbeddedProps<ViewId extends string, Tag extends string, Kind extends string> = Pick<HTMLAttributes<HTMLDivElement>, "style" | "className"> & {
995
- view: ViewData<ViewId>;
996
- /**
997
- * By default determined by the user's system preferences.
998
- */
999
- colorScheme?: "light" | "dark";
1000
- /**
1001
- * LikeC4 views are using 'IBM Plex Sans' font.
1002
- * By default, component injects the CSS to document head.
1003
- * Set to false if you want to handle the font yourself.
1004
- *
1005
- * @default true
1006
- */
1007
- injectFontCss?: boolean | undefined;
1008
- /**
1009
- * Background pattern
1010
- * @default 'transparent'
1011
- */
1012
- background?: "dots" | "lines" | "cross" | "transparent" | "solid" | undefined;
1013
- onNavigateTo?: ((to: ViewId) => void) | undefined;
1014
- /**
1015
- * Render custom icon for a node
1016
- * By default, if icon is http:// or https://, it will be rendered as an image
1017
- */
1018
- renderIcon?: ElementIconRenderer | undefined;
1019
- /**
1020
- * Display webview with diagram title / description
1021
- * @default false
1022
- */
1023
- showDiagramTitle?: boolean | undefined;
1024
- /**
1025
- * Show back/forward navigation buttons
1026
- * @default false
1027
- */
1028
- showNavigationButtons?: undefined | boolean;
1029
- /**
1030
- * Display notations of the view
1031
- * @default false
1032
- */
1033
- showNotations?: boolean | undefined;
1034
- /**
1035
- * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
1036
- * @default false
1037
- */
1038
- enableFocusMode?: boolean | undefined;
1039
- where?: WhereOperator<Tag, Kind> | undefined;
1040
- mantineTheme?: MantineThemeOverride | undefined;
1041
- /** Function to generate nonce attribute added to all generated `<style />` tags */
1042
- styleNonce?: string | (() => string) | undefined;
1043
- /**
1044
- * Enable popup with element details
1045
- * @default false
1046
- */
1047
- enableElementDetails?: boolean | undefined;
1048
- /**
1049
- * Experimental feature to browse relationships
1050
- *
1051
- * @default enableElementDetails
1052
- */
1053
- enableRelationshipBrowser?: boolean | undefined;
1054
- /**
1055
- * Display dropdown with details on relationship's label click
1056
- * @default enableRelationshipBrowser
1057
- */
1058
- enableRelationshipDetails?: boolean | undefined;
1059
- };
1060
- export declare function LikeC4ViewEmbedded<ViewId extends string = string, Tag extends string = string, Kind extends string = string>({ onNavigateTo: _onNavigateTo, className, view, injectFontCss, colorScheme, background, renderIcon, showDiagramTitle, showNavigationButtons, enableFocusMode, showNotations, enableElementDetails, enableRelationshipDetails, enableRelationshipBrowser, mantineTheme, where, style, styleNonce, }: LikeC4ViewEmbeddedProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1061
- declare enum BackgroundVariant {
1062
- Lines = "lines",
1063
- Dots = "dots",
1064
- Cross = "cross"
1065
- }
1066
- type BackgroundProps = {
1067
- id?: string;
1068
- /** Color of the pattern */
1069
- color?: string;
1070
- /** Color of the background */
1071
- bgColor?: string;
1072
- /** Class applied to the container */
1073
- className?: string;
1074
- /** Class applied to the pattern */
1075
- patternClassName?: string;
1076
- /** Gap between repetitions of the pattern */
1077
- gap?: number | [
1078
- number,
1079
- number
1080
- ];
1081
- /** Size of a single pattern element */
1082
- size?: number;
1083
- /** Offset of the pattern */
1084
- offset?: number | [
1085
- number,
1086
- number
1087
- ];
1088
- /** Line width of the Line pattern */
1089
- lineWidth?: number;
1090
- /** Variant of the pattern
1091
- * @example BackgroundVariant.Lines, BackgroundVariant.Dots, BackgroundVariant.Cross
1092
- * 'lines', 'dots', 'cross'
1093
- */
1094
- variant?: BackgroundVariant;
1095
- /** Style applied to the container */
1096
- style?: CSSProperties;
1097
- };
1098
- type XYBackgroundVariant = "dots" | "lines" | "cross";
1099
- type XYBackground = XYBackgroundVariant | OverrideProperties<BackgroundProps, {
1100
- variant: XYBackgroundVariant;
1101
- }>;
1102
- type DiagramNodeWithNavigate<ID extends string = ViewId> = Omit<DiagramNode, "navigateTo"> & {
1103
- navigateTo: ID;
1104
- };
1105
- type ElementIconNodeProps = {
1106
- id: string;
1107
- title: string;
1108
- icon?: string | undefined;
1109
- };
1110
- type ElementIconRenderer$1 = (props: {
1111
- node: ElementIconNodeProps;
1112
- }) => ReactNode;
1113
- type OnNavigateTo<ID extends string = ViewId> = (to: ID, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<ID>) => void;
1114
- type OnNodeClick = (node: DiagramNode, event: ReactMouseEvent) => void;
1115
- type OnEdgeClick = (edge: DiagramEdge, event: ReactMouseEvent) => void;
1116
- type OnCanvasClick = (event: ReactMouseEvent) => void;
1117
- type ChangeEvent = {
1118
- change: ViewChange;
1119
- };
1120
- type OnChange = (event: ChangeEvent) => void;
1121
- interface LikeC4DiagramProperties {
1122
- view: DiagramView;
1123
- className?: string | undefined;
1124
- /**
1125
- * Enable/disable panning
1126
- * @default true
1127
- */
1128
- pannable?: boolean | undefined;
1129
- /**
1130
- * Enable/disable zooming
1131
- * @default true
1132
- */
1133
- zoomable?: boolean | undefined;
1134
- /**
1135
- * Disable any editing (dragging still can be enabled with `nodesDraggable`)
1136
- * @default true
1137
- */
1138
- readonly?: boolean | undefined;
1139
- /**
1140
- * Show/hide panel with top left controls,
1141
- *
1142
- * @default true if not readonly
1143
- */
1144
- controls?: boolean | undefined;
1145
- /**
1146
- * If set, initial viewport will show all nodes & edges
1147
- * @default true
1148
- */
1149
- fitView?: boolean | undefined;
1150
- /**
1151
- * Seems like this is percentage of the view size
1152
- * @default 0
1153
- */
1154
- fitViewPadding?: number | undefined;
1155
- /**
1156
- * @default false if readonly
1157
- */
1158
- nodesSelectable?: boolean | undefined;
1159
- /**
1160
- * @default false if readonly
1161
- */
1162
- nodesDraggable?: boolean | undefined;
1163
- initialWidth?: number | undefined;
1164
- initialHeight?: number | undefined;
1165
- /**
1166
- * Keep aspect ratio of the diagram
1167
- * @default false
1168
- */
1169
- keepAspectRatio?: boolean | undefined;
1170
- /**
1171
- * Background pattern
1172
- * @default 'dots'
1173
- */
1174
- background?: "transparent" | "solid" | XYBackground | undefined;
1175
- /**
1176
- * Display webview with diagram title / description
1177
- * @default true
1178
- */
1179
- showDiagramTitle?: boolean | undefined;
1180
- /**
1181
- * Show back/forward history navigation buttons
1182
- * @default true if `onNavigateTo` is set
1183
- */
1184
- showNavigationButtons?: undefined | boolean;
1185
- /**
1186
- * Display notations of the view
1187
- * @default true
1188
- */
1189
- showNotations?: boolean | undefined;
1190
- /**
1191
- * Display dropdown with details on relationship's label click
1192
- * @default false
1193
- */
1194
- enableRelationshipDetails?: boolean | undefined;
1195
- /**
1196
- * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
1197
- * @default false
1198
- */
1199
- enableFocusMode?: boolean | undefined;
1200
- /**
1201
- * Enable search popup for elements and views
1202
- * @default true
1203
- */
1204
- enableSearch?: boolean | undefined;
1205
- /**
1206
- * Enable modal with element details
1207
- * @default false
1208
- */
1209
- enableElementDetails?: boolean | undefined;
1210
- /**
1211
- * Experimental feature to browse relationships
1212
- *
1213
- * @default false
1214
- */
1215
- enableRelationshipBrowser?: boolean | undefined;
1216
- /**
1217
- * If Walkthrough for dynamic views should be enabled
1218
- * @default false
1219
- */
1220
- enableDynamicViewWalkthrough?: boolean | undefined;
1221
- /**
1222
- * Experimental feature to enable edge editing
1223
- * @default false
1224
- */
1225
- experimentalEdgeEditing?: boolean | undefined;
1226
- /**
1227
- * Render icon for an element, bundled or remote
1228
- * By default, if icon is http:// or https://, it will be rendered as an image
1229
- */
1230
- renderIcon?: ElementIconRenderer$1 | undefined;
1231
- /**
1232
- * Dynamic filter, applies both to nodes and edges
1233
- */
1234
- where?: WhereOperator<string, string> | undefined;
1235
- }
1236
- type OpenSourceParams = {
1237
- element: Fqn;
1238
- property?: string;
1239
- } | {
1240
- relation: RelationId;
1241
- } | {
1242
- deployment: Fqn;
1243
- property?: string;
1244
- } | {
1245
- view: ViewId;
1246
- };
1247
- interface LikeC4DiagramEventHandlers {
1248
- onChange?: OnChange | null | undefined;
1249
- onNavigateTo?: OnNavigateTo | null | undefined;
1250
- onNodeClick?: OnNodeClick | null | undefined;
1251
- onNodeContextMenu?: OnNodeClick | null | undefined;
1252
- onCanvasContextMenu?: OnCanvasClick | null | undefined;
1253
- onEdgeClick?: OnEdgeClick | null | undefined;
1254
- onEdgeContextMenu?: OnEdgeClick | null | undefined;
1255
- onCanvasClick?: OnCanvasClick | null | undefined;
1256
- onCanvasDblClick?: OnCanvasClick | null | undefined;
1257
- onBurgerMenuClick?: null | undefined | (() => void);
1258
- onOpenSource?: null | undefined | ((params: OpenSourceParams) => void);
1259
- }
1260
- type LikeC4DiagramProps = LikeC4DiagramProperties & LikeC4DiagramEventHandlers;
1261
- export type ReactLikeC4Props<ViewId extends string, Tag extends string, Kind extends string> = Omit<LikeC4DiagramProps, "view" | "where" | "onNavigateTo"> & {
1262
- view: ViewData<ViewId>;
1263
- /**
1264
- * Keep aspect ratio of the diagram
1265
- * Disable if you need to manage the viewport (use className)
1266
- *
1267
- * @default true
1268
- */
1269
- keepAspectRatio?: boolean | undefined;
1270
- /**
1271
- * By default determined by the user's system preferences.
1272
- */
1273
- colorScheme?: "light" | "dark" | undefined;
1274
- /**
1275
- * LikeC4 views are using 'IBM Plex Sans' font.
1276
- * By default, component injects the CSS to document head.
1277
- * Set to false if you want to handle the font yourself.
1278
- *
1279
- * @default true
1280
- */
1281
- injectFontCss?: boolean | undefined;
1282
- style?: CSSProperties | undefined;
1283
- where?: WhereOperator<Tag, Kind> | undefined;
1284
- onNavigateTo?: OnNavigateTo<ViewId> | undefined;
1285
- mantineTheme?: MantineThemeOverride | undefined;
1286
- /** Function to generate nonce attribute added to all generated `<style />` tags */
1287
- styleNonce?: string | (() => string) | undefined;
1288
- };
1289
- export declare function ReactLikeC4<ViewId extends string = string, Tag extends string = string, Kind extends string = string>({ className, view, colorScheme: explicitColorScheme, injectFontCss, keepAspectRatio, showNotations, onNavigateTo, background, style, mantineTheme, styleNonce, ...props }: ReactLikeC4Props<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
1290
- export declare namespace ReactLikeC4 {
1291
- var displayName: string;
1292
- }
1293
- type AllKeys<T> = T extends any ? keyof T : never;
1294
- type Primitive = boolean | number | string;
1295
- type ReadonlyIfObject<Value> = Value extends undefined ? Value : Value extends (...args: any) => any ? Value : Value extends Primitive ? Value : Value extends object ? Readonly<Value> : Value;
1296
- interface ReadableAtom<Value = any> {
1297
- /**
1298
- * Get store value.
1299
- *
1300
- * In contrast with {@link ReadableAtom#value} this value will be always
1301
- * initialized even if store had no listeners.
1302
- *
1303
- * ```js
1304
- * $store.get()
1305
- * ```
1306
- *
1307
- * @returns Store value.
1308
- */
1309
- get(): Value;
1310
- /**
1311
- * Listeners count.
1312
- */
1313
- readonly lc: number;
1314
- /**
1315
- * Subscribe to store changes.
1316
- *
1317
- * In contrast with {@link Store#subscribe} it do not call listener
1318
- * immediately.
1319
- *
1320
- * @param listener Callback with store value and old value.
1321
- * @returns Function to remove listener.
1322
- */
1323
- listen(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value>) => void): () => void;
1324
- /**
1325
- * Low-level method to notify listeners about changes in the store.
1326
- *
1327
- * Can cause unexpected behaviour when combined with frontend frameworks
1328
- * that perform equality checks for values, such as React.
1329
- */
1330
- notify(oldValue?: ReadonlyIfObject<Value>): void;
1331
- /**
1332
- * Unbind all listeners.
1333
- */
1334
- off(): void;
1335
- /**
1336
- * Subscribe to store changes and call listener immediately.
1337
- *
1338
- * ```
1339
- * import { $router } from '../store'
1340
- *
1341
- * $router.subscribe(page => {
1342
- * console.log(page)
1343
- * })
1344
- * ```
1345
- *
1346
- * @param listener Callback with store value and old value.
1347
- * @returns Function to remove listener.
1348
- */
1349
- subscribe(listener: (value: ReadonlyIfObject<Value>, oldValue?: ReadonlyIfObject<Value>) => void): () => void;
1350
- /**
1351
- * Low-level method to read store’s value without calling `onStart`.
1352
- *
1353
- * Try to use only {@link ReadableAtom#get}.
1354
- * Without subscribers, value can be undefined.
1355
- */
1356
- readonly value: undefined | Value;
1357
- }
1358
- interface WritableAtom<Value = any> extends ReadableAtom<Value> {
1359
- /**
1360
- * Change store value.
1361
- *
1362
- * ```js
1363
- * $router.set({ path: location.pathname, page: parse(location.pathname) })
1364
- * ```
1365
- *
1366
- * @param newValue New store value.
1367
- */
1368
- set(newValue: Value): void;
1369
- }
1370
- interface PreinitializedWritableAtom<Value extends any> extends WritableAtom<Value> {
1371
- readonly value: Value;
1372
- }
1373
- declare function atom<Value, StoreExt = {}>(...args: undefined extends Value ? [
1374
- ] | [
1375
- Value
1376
- ] : [
1377
- Value
1378
- ]): PreinitializedWritableAtom<Value> & StoreExt;
1379
- type KeyofBase = keyof any;
1380
- type Get<T, K extends KeyofBase> = Extract<T, {
1381
- [K1 in K]: any;
1382
- }>[K];
1383
- type WritableStore<Value = any> = (Value extends object ? MapStore<Value> : never) | WritableAtom<Value>;
1384
- type Store<Value = any> = ReadableAtom<Value> | WritableStore<Value>;
1385
- type AnyStore<Value = any> = {
1386
- get(): Value;
1387
- readonly value: undefined | Value;
1388
- };
1389
- type StoreValue<SomeStore> = SomeStore extends {
1390
- get(): infer Value;
1391
- } ? Value : any;
1392
- interface MapStore<Value extends object = any> extends WritableAtom<Value> {
1393
- /**
1394
- * Subscribe to store changes.
1395
- *
1396
- * In contrast with {@link Store#subscribe} it do not call listener
1397
- * immediately.
1398
- *
1399
- * @param listener Callback with store value and old value.
1400
- * @param changedKey Key that was changed. Will present only if `setKey`
1401
- * has been used to change a store.
1402
- * @returns Function to remove listener.
1403
- */
1404
- listen(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value>, changedKey: AllKeys<Value>) => void): () => void;
1405
- /**
1406
- * Low-level method to notify listeners about changes in the store.
1407
- *
1408
- * Can cause unexpected behaviour when combined with frontend frameworks
1409
- * that perform equality checks for values, such as React.
1410
- */
1411
- notify(oldValue?: ReadonlyIfObject<Value>, changedKey?: AllKeys<Value>): void;
1412
- /**
1413
- * Change store value.
1414
- *
1415
- * ```js
1416
- * $settings.set({ theme: 'dark' })
1417
- * ```
1418
- *
1419
- * Operation is atomic, subscribers will be notified once with the new value.
1420
- * `changedKey` will be undefined
1421
- *
1422
- * @param newValue New store value.
1423
- */
1424
- set(newValue: Value): void;
1425
- /**
1426
- * Change key in store value.
1427
- *
1428
- * ```js
1429
- * $settings.setKey('theme', 'dark')
1430
- * ```
1431
- *
1432
- * To delete key set `undefined`.
1433
- *
1434
- * ```js
1435
- * $settings.setKey('theme', undefined)
1436
- * ```
1437
- *
1438
- * @param key The key name.
1439
- * @param value New value.
1440
- */
1441
- setKey<Key extends AllKeys<Value>>(key: Key, value: Get<Value, Key> | Value[Key]): void;
1442
- /**
1443
- * Subscribe to store changes and call listener immediately.
1444
- *
1445
- * ```
1446
- * import { $router } from '../store'
1447
- *
1448
- * $router.subscribe(page => {
1449
- * console.log(page)
1450
- * })
1451
- * ```
1452
- *
1453
- * @param listener Callback with store value and old value.
1454
- * @param changedKey Key that was changed. Will present only
1455
- * if `setKey` has been used to change a store.
1456
- * @returns Function to remove listener.
1457
- */
1458
- subscribe(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value> | undefined, changedKey: AllKeys<Value> | undefined) => void): () => void;
1459
- }
1460
- interface PreinitializedMapStore<Value extends object = any> extends MapStore<Value> {
1461
- readonly value: Value;
1462
- }
1463
- declare function map<Value extends object, StoreExt extends object = {}>(value?: Value): PreinitializedMapStore<Value> & StoreExt;
1464
- interface Task<Value> extends Promise<Value> {
1465
- t: true;
1466
- }
1467
- type StoreValues<Stores extends AnyStore[]> = {
1468
- [Index in keyof Stores]: StoreValue<Stores[Index]>;
1469
- };
1470
- interface Computed {
1471
- <Value extends any, OriginStore extends Store>(stores: OriginStore, cb: (value: StoreValue<OriginStore>) => Task<Value>): ReadableAtom<undefined | Value>;
1472
- <Value extends any, OriginStores extends AnyStore[]>(stores: [
1473
- ...OriginStores
1474
- ], cb: (...values: StoreValues<OriginStores>) => Task<Value>): ReadableAtom<undefined | Value>;
1475
- <Value extends any, OriginStore extends Store>(stores: OriginStore, cb: (value: StoreValue<OriginStore>) => Value): ReadableAtom<Value>;
1476
- /**
1477
- * Create derived store, which use generates value from another stores.
1478
- *
1479
- * ```js
1480
- * import { computed } from 'nanostores'
1481
- *
1482
- * import { $users } from './users.js'
1483
- *
1484
- * export const $admins = computed($users, users => {
1485
- * return users.filter(user => user.isAdmin)
1486
- * })
1487
- * ```
1488
- *
1489
- * An async function can be evaluated by using {@link task}.
1490
- *
1491
- * ```js
1492
- * import { computed, task } from 'nanostores'
1493
- *
1494
- * import { $userId } from './users.js'
1495
- *
1496
- * export const $user = computed($userId, userId => task(async () => {
1497
- * const response = await fetch(`https://my-api/users/${userId}`)
1498
- * return response.json()
1499
- * }))
1500
- * ```
1501
- */
1502
- <Value extends any, OriginStores extends AnyStore[]>(stores: [
1503
- ...OriginStores
1504
- ], cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value): ReadableAtom<Value>;
1505
- }
1506
- declare const computed: Computed;
1507
- type StoreKeys<T> = T extends {
1508
- setKey: (k: infer K, v: any) => unknown;
1509
- } ? K : never;
1510
- interface UseStoreOptions<SomeStore> {
1511
- /**
1512
- * @default
1513
- * ```ts
1514
- * [store, options.keys]
1515
- * ```
1516
- */
1517
- deps?: DependencyList;
1518
- /**
1519
- * Will re-render components only on specific key changes.
1520
- */
1521
- keys?: StoreKeys<SomeStore>[];
1522
- }
1523
- declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
1524
- export declare const FontCss: string;
1525
- export declare const DefaultTheme: MantineThemeOverride;
1526
- export declare const BundledStyles: () => any;
1527
- export declare function useBundledStyleSheet(injectFontCss: boolean, styleNonce?: string | (() => string) | undefined): CSSStyleSheet[];
1528
- type ColorScheme = "light" | "dark";
1529
- export declare function useColorScheme(explicit?: ColorScheme): ColorScheme;
1530
- export declare const ViewNotFound: ({ viewId }: {
1531
- viewId: string;
1532
- }) => import("react/jsx-runtime").JSX.Element;
1533
- type LikeC4ModelProviderProps = PropsWithChildren<{
1534
- likec4model: any;
1535
- }>;
1536
- export declare const LikeC4ModelProvider: (props: LikeC4ModelProviderProps) => JSX.Element;
1537
-
1538
- declare namespace nano {
1539
- export { atom, computed, map, useStore };
1540
- }
1541
-
1542
- export {
1543
- nano,
1544
- };
1545
-
1546
- export {};
1
+ import { CSSProperties } from 'react';
2
+ import type { DependencyList } from 'react';
3
+ import { DiagramEdge } from '@likec4/core';
4
+ import { DiagramNode } from '@likec4/core';
5
+ import { DiagramView } from '@likec4/core';
6
+ import { Fqn } from '@likec4/core';
7
+ import { JSX } from 'react/jsx-runtime';
8
+ import { JSX as JSX_2 } from 'react';
9
+ import { MouseEvent as MouseEvent_2 } from 'react';
10
+ import { PropsWithChildren } from 'react';
11
+ import { ReactNode } from 'react';
12
+ import { RelationId } from '@likec4/core';
13
+ import { ViewChange } from '@likec4/core';
14
+ import { ViewId } from '@likec4/core';
15
+ import { WhereOperator } from '@likec4/core';
16
+
17
+ declare type AllKeys<T> = T extends any ? keyof T : never
18
+
19
+ declare type AnyStore<Value = any> = {
20
+ get(): Value
21
+ readonly value: undefined | Value
22
+ }
23
+
24
+ /**
25
+ * Create store with atomic value. It could be a string or an object, which you
26
+ * will replace completely.
27
+ *
28
+ * If you want to change keys in the object inside store, use {@link map}.
29
+ *
30
+ * ```js
31
+ * import { atom, onMount } from 'nanostores'
32
+ *
33
+ * // Initial value
34
+ * export const $router = atom({ path: '', page: 'home' })
35
+ *
36
+ * function parse () {
37
+ * $router.set({ path: location.pathname, page: parse(location.pathname) })
38
+ * }
39
+ *
40
+ * // Listen for URL changes on first store’s listener.
41
+ * onMount($router, () => {
42
+ * parse()
43
+ * window.addEventListener('popstate', parse)
44
+ * return () => {
45
+ * window.removeEventListener('popstate', parse)
46
+ * }
47
+ * })
48
+ * ```
49
+ *
50
+ * @param initialValue Initial value of the store.
51
+ * @returns The store object with methods to subscribe.
52
+ */
53
+ declare function atom<Value, StoreExt = {}>(
54
+ ...args: undefined extends Value ? [] | [Value] : [Value]
55
+ ): PreinitializedWritableAtom<Value> & StoreExt
56
+
57
+ export declare const BundledStyles: () => any;
58
+
59
+ declare type ChangeEvent = {
60
+ change: ViewChange;
61
+ };
62
+
63
+ declare type ColorScheme = 'light' | 'dark';
64
+
65
+ declare interface Computed {
66
+ <Value extends any, OriginStore extends Store>(
67
+ stores: OriginStore,
68
+ cb: (value: StoreValue<OriginStore>) => Task<Value>
69
+ ): ReadableAtom<undefined | Value>
70
+ <Value extends any, OriginStores extends AnyStore[]>(
71
+ stores: [...OriginStores],
72
+ cb: (...values: StoreValues<OriginStores>) => Task<Value>
73
+ ): ReadableAtom<undefined | Value>
74
+ <Value extends any, OriginStore extends Store>(
75
+ stores: OriginStore,
76
+ cb: (value: StoreValue<OriginStore>) => Value
77
+ ): ReadableAtom<Value>
78
+ /**
79
+ * Create derived store, which use generates value from another stores.
80
+ *
81
+ * ```js
82
+ * import { computed } from 'nanostores'
83
+ *
84
+ * import { $users } from './users.js'
85
+ *
86
+ * export const $admins = computed($users, users => {
87
+ * return users.filter(user => user.isAdmin)
88
+ * })
89
+ * ```
90
+ *
91
+ * An async function can be evaluated by using {@link task}.
92
+ *
93
+ * ```js
94
+ * import { computed, task } from 'nanostores'
95
+ *
96
+ * import { $userId } from './users.js'
97
+ *
98
+ * export const $user = computed($userId, userId => task(async () => {
99
+ * const response = await fetch(`https://my-api/users/${userId}`)
100
+ * return response.json()
101
+ * }))
102
+ * ```
103
+ */
104
+ <Value extends any, OriginStores extends AnyStore[]>(
105
+ stores: [...OriginStores],
106
+ cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value
107
+ ): ReadableAtom<Value>
108
+ }
109
+
110
+ declare const computed: Computed;
111
+
112
+ declare type DiagramNodeWithNavigate<ID = ViewId> = Omit<DiagramNode, 'navigateTo'> & {
113
+ navigateTo: ID;
114
+ };
115
+
116
+ declare type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode;
117
+
118
+ declare type ElementIconRendererProps = {
119
+ node: {
120
+ id: string;
121
+ title: string;
122
+ icon?: string | null | undefined;
123
+ };
124
+ };
125
+
126
+ export declare const FontCss: string;
127
+
128
+ declare type Get<T, K extends KeyofBase> = Extract<T, { [K1 in K]: any }>[K]
129
+
130
+ declare type KeyofBase = keyof any
131
+
132
+ declare interface LikeC4BrowserProps {
133
+ /**
134
+ * Background pattern for the browser view.
135
+ * @default 'dots'
136
+ */
137
+ background?: 'dots' | 'lines' | 'cross' | 'transparent' | 'solid' | undefined;
138
+ /**
139
+ * If double click on a node should enable focus mode
140
+ *
141
+ * @default true
142
+ */
143
+ enableFocusMode?: boolean | undefined;
144
+ /**
145
+ * Enable popup with element details
146
+ * @default true
147
+ */
148
+ enableElementDetails?: boolean | undefined;
149
+ /**
150
+ * Experimental feature to browse relationships
151
+ *
152
+ * @default enableElementDetails
153
+ */
154
+ enableRelationshipBrowser?: boolean | undefined;
155
+ /**
156
+ * Display dropdown with details on relationship's label click
157
+ * @default enableRelationshipBrowser
158
+ */
159
+ enableRelationshipDetails?: boolean | undefined;
160
+ /**
161
+ * Display notations of the view
162
+ * @default true
163
+ */
164
+ showNotations?: boolean | undefined;
165
+ className?: string | undefined;
166
+ style?: CSSProperties | undefined;
167
+ }
168
+
169
+ declare interface LikeC4DiagramEventHandlers {
170
+ onChange?: OnChange | null | undefined;
171
+ onNavigateTo?: OnNavigateTo | null | undefined;
172
+ onNodeClick?: OnNodeClick | null | undefined;
173
+ onNodeContextMenu?: OnNodeClick | null | undefined;
174
+ onCanvasContextMenu?: OnCanvasClick | null | undefined;
175
+ onEdgeClick?: OnEdgeClick | null | undefined;
176
+ onEdgeContextMenu?: OnEdgeClick | null | undefined;
177
+ onCanvasClick?: OnCanvasClick | null | undefined;
178
+ onCanvasDblClick?: OnCanvasClick | null | undefined;
179
+ onBurgerMenuClick?: null | undefined | (() => void);
180
+ onOpenSource?: null | undefined | ((params: OpenSourceParams) => void);
181
+ }
182
+
183
+ declare interface LikeC4DiagramProperties {
184
+ view: DiagramView;
185
+ className?: string | undefined;
186
+ /**
187
+ * Enable/disable panning
188
+ * @default true
189
+ */
190
+ pannable?: boolean | undefined;
191
+ /**
192
+ * Enable/disable zooming
193
+ * @default true
194
+ */
195
+ zoomable?: boolean | undefined;
196
+ /**
197
+ * Disable any editing (dragging still can be enabled with `nodesDraggable`)
198
+ * @default true
199
+ */
200
+ readonly?: boolean | undefined;
201
+ /**
202
+ * Show/hide panel with top left controls,
203
+ *
204
+ * @default true if not readonly
205
+ */
206
+ controls?: boolean | undefined;
207
+ /**
208
+ * If set, initial viewport will show all nodes & edges
209
+ * @default true
210
+ */
211
+ fitView?: boolean | undefined;
212
+ /**
213
+ * Seems like this is percentage of the view size
214
+ * @default 0
215
+ */
216
+ fitViewPadding?: number | undefined;
217
+ /**
218
+ * @default false if readonly
219
+ */
220
+ nodesSelectable?: boolean | undefined;
221
+ /**
222
+ * @default false if readonly
223
+ */
224
+ nodesDraggable?: boolean | undefined;
225
+ initialWidth?: number | undefined;
226
+ initialHeight?: number | undefined;
227
+ /**
228
+ * Background pattern
229
+ * @default 'dots'
230
+ */
231
+ background?: 'transparent' | 'solid' | 'dots' | 'lines' | 'cross' | undefined;
232
+ /**
233
+ * Display webview with diagram title / description
234
+ * @default true
235
+ */
236
+ showDiagramTitle?: boolean | undefined;
237
+ /**
238
+ * Show back/forward history navigation buttons
239
+ * @default true if `onNavigateTo` is set
240
+ */
241
+ showNavigationButtons?: undefined | boolean;
242
+ /**
243
+ * Display notations of the view
244
+ * @default true
245
+ */
246
+ showNotations?: boolean | undefined;
247
+ /**
248
+ * Display dropdown with details on relationship's label click
249
+ * @default false
250
+ */
251
+ enableRelationshipDetails?: boolean | undefined;
252
+ /**
253
+ * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
254
+ * @default false
255
+ */
256
+ enableFocusMode?: boolean | undefined;
257
+ /**
258
+ * Enable search popup for elements and views
259
+ * @default true
260
+ */
261
+ enableSearch?: boolean | undefined;
262
+ /**
263
+ * Enable modal with element details
264
+ * @default false
265
+ */
266
+ enableElementDetails?: boolean | undefined;
267
+ /**
268
+ * Experimental feature to browse relationships
269
+ *
270
+ * @default false
271
+ */
272
+ enableRelationshipBrowser?: boolean | undefined;
273
+ /**
274
+ * If Walkthrough for dynamic views should be enabled
275
+ * @default false
276
+ */
277
+ enableDynamicViewWalkthrough?: boolean | undefined;
278
+ /**
279
+ * Experimental feature to enable edge editing
280
+ * @default false
281
+ */
282
+ experimentalEdgeEditing?: boolean | undefined;
283
+ /**
284
+ * Render icon for an element, bundled or remote
285
+ * By default, if icon is http:// or https://, it will be rendered as an image
286
+ */
287
+ renderIcon?: ElementIconRenderer | undefined;
288
+ /**
289
+ * Dynamic filter, applies both to nodes and edges
290
+ */
291
+ where?: WhereOperator<string, string> | undefined;
292
+ }
293
+
294
+ declare type LikeC4DiagramProps = LikeC4DiagramProperties & LikeC4DiagramEventHandlers;
295
+
296
+ export declare const LikeC4ModelProvider: (props: LikeC4ModelProviderProps) => JSX_2.Element;
297
+
298
+ declare type LikeC4ModelProviderProps = PropsWithChildren<{
299
+ likec4model: any;
300
+ }>;
301
+
302
+ export declare function LikeC4View<ViewId extends string = string, Tag = string, Kind = string>({ viewId, ...props }: LikeC4ViewProps<ViewId, Tag, Kind>): JSX.Element;
303
+
304
+ export declare interface LikeC4ViewProps<ViewId = string, Tag = string, Kind = string> {
305
+ /**
306
+ * View to display.
307
+ */
308
+ viewId: ViewId;
309
+ /**
310
+ * Enable/disable panning
311
+ * @default false
312
+ */
313
+ pannable?: boolean | undefined;
314
+ /**
315
+ * Enable/disable zooming
316
+ * @default false
317
+ */
318
+ zoomable?: boolean | undefined;
319
+ /**
320
+ * @default true
321
+ */
322
+ keepAspectRatio?: boolean | undefined;
323
+ /**
324
+ * Background pattern
325
+ * @default 'transparent'
326
+ */
327
+ background?: 'dots' | 'lines' | 'cross' | 'transparent' | 'solid' | undefined;
328
+ /**
329
+ * Click on the view opens a modal with browser.
330
+ * You can customize or disable the browser view.
331
+ */
332
+ browser?: boolean | LikeC4BrowserProps | undefined;
333
+ /**
334
+ * By default determined by the user's system preferences.
335
+ */
336
+ colorScheme?: 'light' | 'dark' | undefined;
337
+ /**
338
+ * LikeC4 views are using 'IBM Plex Sans' font.
339
+ * By default, component injects the CSS to document head.
340
+ * Set to false if you want to handle the font yourself.
341
+ *
342
+ * @default true
343
+ */
344
+ injectFontCss?: boolean | undefined;
345
+ /**
346
+ * Show/hide panel with top left controls,
347
+ * @default false
348
+ */
349
+ controls?: boolean | undefined;
350
+ /**
351
+ * If set, initial viewport will show all nodes & edges
352
+ * @default true
353
+ */
354
+ fitView?: boolean | undefined;
355
+ /**
356
+ * Seems like this is percentage of the view size
357
+ * @default 0.05
358
+ */
359
+ fitViewPadding?: number | undefined;
360
+ /**
361
+ * Display webview with diagram title / description
362
+ * @default false
363
+ */
364
+ showDiagramTitle?: boolean | undefined;
365
+ /**
366
+ * Show back/forward navigation buttons
367
+ * @default false
368
+ */
369
+ showNavigationButtons?: undefined | boolean;
370
+ /**
371
+ * Display notations of the view
372
+ * @default false
373
+ */
374
+ showNotations?: boolean | undefined;
375
+ /**
376
+ * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
377
+ * Conflicts with `interactive`
378
+ *
379
+ * @default false
380
+ */
381
+ enableFocusMode?: boolean | undefined;
382
+ /**
383
+ * Enable popup with element details
384
+ * @default false
385
+ */
386
+ enableElementDetails?: boolean | undefined;
387
+ /**
388
+ * Experimental feature to browse relationships
389
+ *
390
+ * @default enableElementDetails
391
+ */
392
+ enableRelationshipBrowser?: boolean | undefined;
393
+ /**
394
+ * Display dropdown with details on relationship's label click
395
+ * @default enableRelationshipBrowser
396
+ */
397
+ enableRelationshipDetails?: boolean | undefined;
398
+ where?: WhereOperator<Tag, Kind> | undefined;
399
+ className?: string | undefined;
400
+ style?: CSSProperties | undefined;
401
+ mantineTheme?: any;
402
+ /** Function to generate nonce attribute added to all generated `<style />` tags */
403
+ styleNonce?: string | (() => string) | undefined;
404
+ /**
405
+ * Render custom icon for a node
406
+ * By default, if icon is http:// or https://, it will be rendered as an image
407
+ */
408
+ renderIcon?: ElementIconRenderer | undefined;
409
+ }
410
+
411
+ /**
412
+ * Create map store. Map store is a store with key-value object
413
+ * as a store value.
414
+ *
415
+ * @param init Initialize store and return store destructor.
416
+ * @returns The store object with methods to subscribe.
417
+ */
418
+ declare function map<Value extends object, StoreExt extends object = {}>(
419
+ value?: Value
420
+ ): PreinitializedMapStore<Value> & StoreExt
421
+
422
+ declare interface MapStore<Value extends object = any>
423
+ extends WritableAtom<Value> {
424
+ /**
425
+ * Subscribe to store changes.
426
+ *
427
+ * In contrast with {@link Store#subscribe} it do not call listener
428
+ * immediately.
429
+ *
430
+ * @param listener Callback with store value and old value.
431
+ * @param changedKey Key that was changed. Will present only if `setKey`
432
+ * has been used to change a store.
433
+ * @returns Function to remove listener.
434
+ */
435
+ listen(
436
+ listener: (
437
+ value: ReadonlyIfObject<Value>,
438
+ oldValue: ReadonlyIfObject<Value>,
439
+ changedKey: AllKeys<Value>
440
+ ) => void
441
+ ): () => void
442
+
443
+ /**
444
+ * Low-level method to notify listeners about changes in the store.
445
+ *
446
+ * Can cause unexpected behaviour when combined with frontend frameworks
447
+ * that perform equality checks for values, such as React.
448
+ */
449
+ notify(oldValue?: ReadonlyIfObject<Value>, changedKey?: AllKeys<Value>): void
450
+
451
+ /**
452
+ * Change store value.
453
+ *
454
+ * ```js
455
+ * $settings.set({ theme: 'dark' })
456
+ * ```
457
+ *
458
+ * Operation is atomic, subscribers will be notified once with the new value.
459
+ * `changedKey` will be undefined
460
+ *
461
+ * @param newValue New store value.
462
+ */
463
+ set(newValue: Value): void
464
+
465
+ /**
466
+ * Change key in store value.
467
+ *
468
+ * ```js
469
+ * $settings.setKey('theme', 'dark')
470
+ * ```
471
+ *
472
+ * To delete key set `undefined`.
473
+ *
474
+ * ```js
475
+ * $settings.setKey('theme', undefined)
476
+ * ```
477
+ *
478
+ * @param key The key name.
479
+ * @param value New value.
480
+ */
481
+ setKey<Key extends AllKeys<Value>>(
482
+ key: Key,
483
+ value: Get<Value, Key> | Value[Key]
484
+ ): void
485
+
486
+ /**
487
+ * Subscribe to store changes and call listener immediately.
488
+ *
489
+ * ```
490
+ * import { $router } from '../store'
491
+ *
492
+ * $router.subscribe(page => {
493
+ * console.log(page)
494
+ * })
495
+ * ```
496
+ *
497
+ * @param listener Callback with store value and old value.
498
+ * @param changedKey Key that was changed. Will present only
499
+ * if `setKey` has been used to change a store.
500
+ * @returns Function to remove listener.
501
+ */
502
+ subscribe(
503
+ listener: (
504
+ value: ReadonlyIfObject<Value>,
505
+ oldValue: ReadonlyIfObject<Value> | undefined,
506
+ changedKey: AllKeys<Value> | undefined
507
+ ) => void
508
+ ): () => void
509
+ }
510
+
511
+ export declare namespace nano {
512
+ export {
513
+ atom,
514
+ computed,
515
+ map,
516
+ useStore
517
+ }
518
+ }
519
+
520
+ /**
521
+ * On pane/canvas click (not on any node or edge)
522
+ */
523
+ declare type OnCanvasClick = (event: MouseEvent_2) => void;
524
+
525
+ declare type OnChange = (event: ChangeEvent) => void;
526
+
527
+ declare type OnEdgeClick = (edge: DiagramEdge, event: MouseEvent_2) => void;
528
+
529
+ declare type OnNavigateTo<ID = ViewId> = (to: ID, event?: MouseEvent_2, element?: DiagramNodeWithNavigate<ID>) => void;
530
+
531
+ declare type OnNodeClick = (node: DiagramNode, event: MouseEvent_2) => void;
532
+
533
+ declare type OpenSourceParams = {
534
+ element: Fqn;
535
+ property?: string;
536
+ } | {
537
+ relation: RelationId;
538
+ } | {
539
+ deployment: Fqn;
540
+ property?: string;
541
+ } | {
542
+ view: ViewId;
543
+ };
544
+
545
+ declare interface PreinitializedMapStore<Value extends object = any>
546
+ extends MapStore<Value> {
547
+ readonly value: Value
548
+ }
549
+
550
+ declare interface PreinitializedWritableAtom<Value extends any>
551
+ extends WritableAtom<Value> {
552
+ readonly value: Value
553
+ }
554
+
555
+ declare type Primitive = boolean | number | string
556
+
557
+ export declare function ReactLikeC4<ViewId extends string = string, Tag = string, Kind = string>({ viewId, ...props }: ReactLikeC4Props<ViewId, Tag, Kind>): JSX.Element;
558
+
559
+ export declare namespace ReactLikeC4 {
560
+ var displayName: string;
561
+ }
562
+
563
+ export declare type ReactLikeC4Props<ViewId = string, Tag = string, Kind = string> = Omit<LikeC4DiagramProps, 'view' | 'where' | 'onNavigateTo'> & {
564
+ viewId: ViewId;
565
+ /**
566
+ * Keep aspect ratio of the diagram
567
+ * Disable if you need to manage the viewport (use className)
568
+ *
569
+ * @default true
570
+ */
571
+ keepAspectRatio?: boolean | undefined;
572
+ /**
573
+ * By default determined by the user's system preferences.
574
+ */
575
+ colorScheme?: 'light' | 'dark' | undefined;
576
+ /**
577
+ * LikeC4 views are using 'IBM Plex Sans' font.
578
+ * By default, component injects the CSS to document head.
579
+ * Set to false if you want to handle the font yourself.
580
+ *
581
+ * @default true
582
+ */
583
+ injectFontCss?: boolean | undefined;
584
+ style?: CSSProperties | undefined;
585
+ where?: WhereOperator<Tag, Kind> | undefined;
586
+ onNavigateTo?: OnNavigateTo<ViewId> | undefined;
587
+ mantineTheme?: any;
588
+ /** Function to generate nonce attribute added to all generated `<style />` tags */
589
+ styleNonce?: string | (() => string) | undefined;
590
+ };
591
+
592
+ /**
593
+ * Store object.
594
+ */
595
+ declare interface ReadableAtom<Value = any> {
596
+ /**
597
+ * Get store value.
598
+ *
599
+ * In contrast with {@link ReadableAtom#value} this value will be always
600
+ * initialized even if store had no listeners.
601
+ *
602
+ * ```js
603
+ * $store.get()
604
+ * ```
605
+ *
606
+ * @returns Store value.
607
+ */
608
+ get(): Value
609
+
610
+ /**
611
+ * Listeners count.
612
+ */
613
+ readonly lc: number
614
+
615
+ /**
616
+ * Subscribe to store changes.
617
+ *
618
+ * In contrast with {@link Store#subscribe} it do not call listener
619
+ * immediately.
620
+ *
621
+ * @param listener Callback with store value and old value.
622
+ * @returns Function to remove listener.
623
+ */
624
+ listen(
625
+ listener: (
626
+ value: ReadonlyIfObject<Value>,
627
+ oldValue: ReadonlyIfObject<Value>
628
+ ) => void
629
+ ): () => void
630
+
631
+ /**
632
+ * Low-level method to notify listeners about changes in the store.
633
+ *
634
+ * Can cause unexpected behaviour when combined with frontend frameworks
635
+ * that perform equality checks for values, such as React.
636
+ */
637
+ notify(oldValue?: ReadonlyIfObject<Value>): void
638
+
639
+ /**
640
+ * Unbind all listeners.
641
+ */
642
+ off(): void
643
+
644
+ /**
645
+ * Subscribe to store changes and call listener immediately.
646
+ *
647
+ * ```
648
+ * import { $router } from '../store'
649
+ *
650
+ * $router.subscribe(page => {
651
+ * console.log(page)
652
+ * })
653
+ * ```
654
+ *
655
+ * @param listener Callback with store value and old value.
656
+ * @returns Function to remove listener.
657
+ */
658
+ subscribe(
659
+ listener: (
660
+ value: ReadonlyIfObject<Value>,
661
+ oldValue?: ReadonlyIfObject<Value>
662
+ ) => void
663
+ ): () => void
664
+
665
+ /**
666
+ * Low-level method to read store’s value without calling `onStart`.
667
+ *
668
+ * Try to use only {@link ReadableAtom#get}.
669
+ * Without subscribers, value can be undefined.
670
+ */
671
+ readonly value: undefined | Value
672
+ }
673
+
674
+ declare type ReadonlyIfObject<Value> = Value extends undefined
675
+ ? Value
676
+ : Value extends (...args: any) => any
677
+ ? Value
678
+ : Value extends Primitive
679
+ ? Value
680
+ : Value extends object
681
+ ? Readonly<Value>
682
+ : Value
683
+
684
+ declare type Store<Value = any> = ReadableAtom<Value> | WritableStore<Value>
685
+
686
+ declare type StoreKeys<T> = T extends { setKey: (k: infer K, v: any) => unknown }
687
+ ? K
688
+ : never
689
+
690
+ declare type StoreValue<SomeStore> = SomeStore extends {
691
+ get(): infer Value
692
+ }
693
+ ? Value
694
+ : any
695
+
696
+ declare type StoreValues<Stores extends AnyStore[]> = {
697
+ [Index in keyof Stores]: StoreValue<Stores[Index]>
698
+ }
699
+
700
+ declare interface Task<Value> extends Promise<Value> {
701
+ t: true
702
+ }
703
+
704
+ export declare function useBundledStyleSheet(injectFontCss: boolean, styleNonce?: string | (() => string) | undefined): CSSStyleSheet[];
705
+
706
+ export declare function useColorScheme(explicit?: ColorScheme): ColorScheme;
707
+
708
+ /**
709
+ * Subscribe to store changes and get store’s value.
710
+ *
711
+ * Can be user with store builder too.
712
+ *
713
+ * ```js
714
+ * import { useStore } from 'nanostores/react'
715
+ *
716
+ * import { router } from '../store/router'
717
+ *
718
+ * export const Layout = () => {
719
+ * let page = useStore(router)
720
+ * if (page.route === 'home') {
721
+ * return <HomePage />
722
+ * } else {
723
+ * return <Error404 />
724
+ * }
725
+ * }
726
+ * ```
727
+ *
728
+ * @param store Store instance.
729
+ * @returns Store value.
730
+ */
731
+ declare function useStore<SomeStore extends Store>(
732
+ store: SomeStore,
733
+ options?: UseStoreOptions<SomeStore>
734
+ ): StoreValue<SomeStore>
735
+
736
+ declare interface UseStoreOptions<SomeStore> {
737
+ /**
738
+ * @default
739
+ * ```ts
740
+ * [store, options.keys]
741
+ * ```
742
+ */
743
+ deps?: DependencyList
744
+
745
+ /**
746
+ * Will re-render components only on specific key changes.
747
+ */
748
+ keys?: StoreKeys<SomeStore>[]
749
+ }
750
+
751
+ /**
752
+ * Store with a way to manually change the value.
753
+ */
754
+ declare interface WritableAtom<Value = any> extends ReadableAtom<Value> {
755
+ /**
756
+ * Change store value.
757
+ *
758
+ * ```js
759
+ * $router.set({ path: location.pathname, page: parse(location.pathname) })
760
+ * ```
761
+ *
762
+ * @param newValue New store value.
763
+ */
764
+ set(newValue: Value): void
765
+ }
766
+
767
+ declare type WritableStore<Value = any> =
768
+ | (Value extends object ? MapStore<Value> : never)
769
+ | WritableAtom<Value>
770
+
771
+ export { }