likec4 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/react/index.d.ts CHANGED
@@ -1,9 +1,1064 @@
1
- import '@mantine/core/styles.css';
2
- import '@xyflow/react/dist/style.css';
3
- export { LikeC4Browser } from './LikeC4Browser';
4
- export { LikeC4ViewElement } from './LikeC4ViewElement';
5
- export { useColorScheme, useCreateStyleSheet } from './styles';
6
- export type * from './LikeC4Browser';
7
- export type * from './LikeC4ViewElement';
8
- export type * from './types';
9
- export type * from './types-filter';
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { CSSProperties, HTMLAttributes, MouseEvent as ReactMouseEvent, ReactNode } from 'react';
4
+
5
+ declare const BorderStyles: readonly [
6
+ "solid",
7
+ "dashed",
8
+ "dotted",
9
+ "none"
10
+ ];
11
+ declare const ElementShapes: readonly [
12
+ "rectangle",
13
+ "person",
14
+ "browser",
15
+ "mobile",
16
+ "cylinder",
17
+ "storage",
18
+ "queue"
19
+ ];
20
+ declare const ThemeColors: readonly [
21
+ "amber",
22
+ "blue",
23
+ "gray",
24
+ "slate",
25
+ "green",
26
+ "indigo",
27
+ "muted",
28
+ "primary",
29
+ "red",
30
+ "secondary",
31
+ "sky"
32
+ ];
33
+ declare const tag: unique symbol;
34
+ declare enum BackgroundVariant {
35
+ Lines = "lines",
36
+ Dots = "dots",
37
+ Cross = "cross"
38
+ }
39
+ declare namespace ViewChange {
40
+ interface ChangeElementStyle {
41
+ op: "change-element-style";
42
+ style: {
43
+ border?: BorderStyle;
44
+ opacity?: number;
45
+ shape?: ElementShape;
46
+ color?: ThemeColor;
47
+ };
48
+ targets: NonEmptyArray<Fqn>;
49
+ }
50
+ interface SaveManualLayout {
51
+ op: "save-manual-layout";
52
+ layout: ViewManualLayout;
53
+ }
54
+ interface ChangeAutoLayout {
55
+ op: "change-autolayout";
56
+ layout: AutoLayoutDirection;
57
+ }
58
+ }
59
+ export declare const BundledStyles: () => any;
60
+ export declare const DefaultTheme: MantineThemeOverride;
61
+ export declare function LikeC4Browser<ViewId extends string, Tag extends string, Kind extends string>({ className, colorScheme, view, injectFontCss, onNavigateTo, onClose, renderIcon, where, style, mantineTheme, background }: LikeC4BrowserProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
62
+ export declare function LikeC4ViewEmbedded<ViewId extends string, Tag extends string, Kind extends string>({ onNavigateTo: _onNavigateTo, className, view, injectFontCss, colorScheme, background, renderIcon, showDiagramTitle, showElementLinks, showNavigationButtons, enableFocusMode, showNotations, mantineTheme, where, style }: LikeC4ViewEmbeddedProps<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
63
+ export declare function ReactLikeC4<ViewId extends string = ViewID, Tag extends string = Tag$1, Kind extends string = ElementKind>({ className, view, colorScheme: explicitColorScheme, injectFontCss, keepAspectRatio, showNotations, onNavigateTo, background, style, mantineTheme, ...props }: ReactLikeC4Props<ViewId, Tag, Kind>): import("react/jsx-runtime").JSX.Element;
64
+ export declare function useBundledStyleSheet(injectFontCss?: boolean): CSSStyleSheet[];
65
+ export declare function useColorScheme(explicit?: ColorScheme): ColorScheme;
66
+ export declare namespace ReactLikeC4 {
67
+ var displayName: string;
68
+ }
69
+ export type LikeC4BrowserProps<ViewId extends string, Tag extends string, Kind extends string> = Pick<HTMLAttributes<HTMLDialogElement>, "style" | "className"> & {
70
+ view: ViewData<ViewId>;
71
+ /**
72
+ * By default determined by the user's system preferences.
73
+ */
74
+ colorScheme?: "light" | "dark";
75
+ /**
76
+ * LikeC4 views are using 'IBM Plex Sans' font.
77
+ * By default, component injects the CSS to document head.
78
+ * Set to false if you want to handle the font yourself.
79
+ *
80
+ * @default true
81
+ */
82
+ injectFontCss?: boolean | undefined;
83
+ /**
84
+ * Background pattern
85
+ * @default 'dots'
86
+ */
87
+ background?: "dots" | "lines" | "cross" | "transparent" | "solid" | undefined;
88
+ onNavigateTo: (to: ViewId) => void;
89
+ onClose: () => void;
90
+ /**
91
+ * Render custom icon for a node
92
+ * By default, if icon is http:// or https://, it will be rendered as an image
93
+ */
94
+ renderIcon?: ElementIconRenderer | undefined;
95
+ where?: WhereOperator<Tag, Kind> | undefined;
96
+ mantineTheme?: MantineThemeOverride | undefined;
97
+ };
98
+ export type LikeC4ViewEmbeddedProps<ViewId extends string, Tag extends string, Kind extends string> = Pick<HTMLAttributes<HTMLDivElement>, "style" | "className"> & {
99
+ view: ViewData<ViewId>;
100
+ /**
101
+ * By default determined by the user's system preferences.
102
+ */
103
+ colorScheme?: "light" | "dark";
104
+ /**
105
+ * LikeC4 views are using 'IBM Plex Sans' font.
106
+ * By default, component injects the CSS to document head.
107
+ * Set to false if you want to handle the font yourself.
108
+ *
109
+ * @default true
110
+ */
111
+ injectFontCss?: boolean | undefined;
112
+ /**
113
+ * Background pattern
114
+ * @default 'transparent'
115
+ */
116
+ background?: "dots" | "lines" | "cross" | "transparent" | "solid" | undefined;
117
+ onNavigateTo?: ((to: ViewId) => void) | undefined;
118
+ /**
119
+ * Render custom icon for a node
120
+ * By default, if icon is http:// or https://, it will be rendered as an image
121
+ */
122
+ renderIcon?: ElementIconRenderer | undefined;
123
+ /**
124
+ * Display hovercards with element links
125
+ * @default true
126
+ */
127
+ showElementLinks?: boolean | undefined;
128
+ /**
129
+ * Display panel with diagram title / description
130
+ * @default false
131
+ */
132
+ showDiagramTitle?: boolean | undefined;
133
+ /**
134
+ * Show back/forward navigation buttons
135
+ * @default false
136
+ */
137
+ showNavigationButtons?: undefined | boolean;
138
+ /**
139
+ * Display notations of the view
140
+ * @default false
141
+ */
142
+ showNotations?: boolean | undefined;
143
+ /**
144
+ * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
145
+ * @default false
146
+ */
147
+ enableFocusMode?: boolean | undefined;
148
+ where?: WhereOperator<Tag, Kind> | undefined;
149
+ mantineTheme?: MantineThemeOverride | undefined;
150
+ };
151
+ export type LikeC4ViewProps<ViewId extends string, Tag extends string, Kind extends string> = {
152
+ /**
153
+ * View to display.
154
+ */
155
+ viewId: ViewId;
156
+ /**
157
+ * Background pattern
158
+ * @default 'transparent'
159
+ */
160
+ background?: "dots" | "lines" | "cross" | "transparent" | "solid" | undefined;
161
+ /**
162
+ * Background pattern for the browser view.
163
+ * @default 'dots'
164
+ */
165
+ browserBackground?: "dots" | "lines" | "cross" | "transparent" | "solid" | undefined;
166
+ /**
167
+ * Click on the view opens a modal with browser.
168
+ *
169
+ * @default true
170
+ */
171
+ interactive?: boolean;
172
+ /**
173
+ * By default determined by the user's system preferences.
174
+ */
175
+ colorScheme?: "light" | "dark" | undefined;
176
+ /**
177
+ * LikeC4 views are using 'IBM Plex Sans' font.
178
+ * By default, component injects the CSS to document head.
179
+ * Set to false if you want to handle the font yourself.
180
+ *
181
+ * @default true
182
+ */
183
+ injectFontCss?: boolean | undefined;
184
+ /**
185
+ * Display hovercards with element links
186
+ * @default true
187
+ */
188
+ showElementLinks?: boolean | undefined;
189
+ /**
190
+ * Display panel with diagram title / description
191
+ * @default false
192
+ */
193
+ showDiagramTitle?: boolean | undefined;
194
+ /**
195
+ * Show back/forward navigation buttons
196
+ * @default false
197
+ */
198
+ showNavigationButtons?: undefined | boolean;
199
+ /**
200
+ * Display notations of the view
201
+ * @default false
202
+ */
203
+ showNotations?: boolean | undefined;
204
+ /**
205
+ * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
206
+ * Conflicts with `interactive`
207
+ *
208
+ * @default false
209
+ */
210
+ enableFocusMode?: boolean | undefined;
211
+ where?: WhereOperator<Tag, Kind> | undefined;
212
+ className?: string | undefined;
213
+ style?: CSSProperties | undefined;
214
+ browserClassName?: string | undefined;
215
+ browserStyle?: CSSProperties | undefined;
216
+ mantineTheme?: MantineThemeOverride | undefined;
217
+ };
218
+ export type ReactLikeC4Props<ViewId extends string = ViewID, Tag extends string = Tag$1, Kind extends string = ElementKind> = Omit<LikeC4DiagramProps, "view" | "where" | "onNavigateTo"> & {
219
+ view: ViewData<ViewId>;
220
+ /**
221
+ * Keep aspect ratio of the diagram
222
+ * Disable if you need to manage the viewport (use className)
223
+ *
224
+ * @default true
225
+ */
226
+ keepAspectRatio?: boolean | undefined;
227
+ /**
228
+ * By default determined by the user's system preferences.
229
+ */
230
+ colorScheme?: "light" | "dark" | undefined;
231
+ /**
232
+ * LikeC4 views are using 'IBM Plex Sans' font.
233
+ * By default, component injects the CSS to document head.
234
+ * Set to false if you want to handle the font yourself.
235
+ *
236
+ * @default true
237
+ */
238
+ injectFontCss?: boolean | undefined;
239
+ style?: CSSProperties | undefined;
240
+ where?: WhereOperator<Tag, Kind> | undefined;
241
+ onNavigateTo?: OnNavigateTo<ViewId> | undefined;
242
+ mantineTheme?: MantineThemeOverride | undefined;
243
+ };
244
+ export type ViewData<ViewId extends string> = Omit<DiagramView, "id"> & {
245
+ id: ViewId;
246
+ };
247
+ interface BaseExpr {
248
+ where?: never;
249
+ element?: never;
250
+ custom?: never;
251
+ expanded?: never;
252
+ elementKind?: never;
253
+ elementTag?: never;
254
+ isEqual?: never;
255
+ isDescedants?: never;
256
+ wildcard?: never;
257
+ source?: never;
258
+ target?: never;
259
+ inout?: never;
260
+ incoming?: never;
261
+ outgoing?: never;
262
+ customRelation?: never;
263
+ }
264
+ interface BasicElementView extends BasicView<"element"> {
265
+ readonly viewOf?: Fqn;
266
+ readonly rules: ViewRule[];
267
+ }
268
+ interface BasicView<ViewType extends "element" | "dynamic"> {
269
+ readonly __?: ViewType;
270
+ readonly id: ViewID;
271
+ readonly title: string | null;
272
+ readonly description: string | null;
273
+ readonly tags: NonEmptyArray<Tag$1> | null;
274
+ readonly links: NonEmptyArray<Link> | null;
275
+ /**
276
+ * URI to the source file of this view.
277
+ * Undefined if the view is auto-generated.
278
+ */
279
+ readonly docUri?: string;
280
+ /**
281
+ * For all views we find common ancestor path.
282
+ * This is used to generate relative paths, i.e.:
283
+ * - "/home/project/index.c4" becomes "index.c4"
284
+ * - "/home/project/subdir/views.c4" becomes "subdir/views.c4"
285
+ *
286
+ * Undefined if the view is auto-generated.
287
+ */
288
+ readonly relativePath?: string;
289
+ /**
290
+ * If the view is changed manually this field contains the layout data.
291
+ */
292
+ readonly manualLayout?: ViewManualLayout | undefined;
293
+ readonly customColorDefinitions: CustomColorDefinitions;
294
+ }
295
+ interface ComputedDynamicView extends Omit<DynamicView, "rules" | "steps" | "docUri">, ViewWithHash, ViewWithNotation {
296
+ readonly autoLayout: ViewRuleAutoLayout["autoLayout"];
297
+ readonly nodes: ComputedNode[];
298
+ readonly edges: ComputedEdge[];
299
+ steps?: never;
300
+ rules?: never;
301
+ docUri?: never;
302
+ }
303
+ interface ComputedEdge {
304
+ id: EdgeId;
305
+ parent: NodeId | null;
306
+ source: NodeId;
307
+ target: NodeId;
308
+ label: string | null;
309
+ description?: string;
310
+ technology?: string;
311
+ relations: RelationID[];
312
+ kind?: RelationshipKind;
313
+ notation?: string;
314
+ notes?: string;
315
+ color?: Color;
316
+ line?: RelationshipLineType;
317
+ head?: RelationshipArrowType;
318
+ tail?: RelationshipArrowType;
319
+ tags?: NonEmptyArray<Tag$1>;
320
+ navigateTo?: ViewID;
321
+ /**
322
+ * If this edge is derived from custom relationship predicate
323
+ */
324
+ isCustomized?: boolean;
325
+ /**
326
+ * For layouting purposes
327
+ * @default 'forward'
328
+ */
329
+ dir?: "forward" | "back";
330
+ }
331
+ interface ComputedElementView extends Omit<ElementView, "rules" | "docUri">, ViewWithHash, ViewWithNotation {
332
+ readonly extends?: ViewID;
333
+ readonly autoLayout: ViewRuleAutoLayout["autoLayout"];
334
+ readonly nodes: ComputedNode[];
335
+ readonly edges: ComputedEdge[];
336
+ rules?: never;
337
+ docUri?: never;
338
+ }
339
+ interface ComputedNode {
340
+ id: NodeId;
341
+ kind: ElementKind;
342
+ parent: NodeId | null;
343
+ title: string;
344
+ description: string | null;
345
+ technology: string | null;
346
+ notation?: string;
347
+ tags: NonEmptyArray<Tag$1> | null;
348
+ links: NonEmptyArray<Link> | null;
349
+ children: NodeId[];
350
+ inEdges: EdgeId[];
351
+ outEdges: EdgeId[];
352
+ shape: ElementShape;
353
+ /**
354
+ * @deprecated Use `style` instead
355
+ */
356
+ color: Color;
357
+ /**
358
+ * @deprecated Use `style` instead
359
+ */
360
+ icon?: IconUrl;
361
+ style: ElementStyle;
362
+ navigateTo?: ViewID;
363
+ level: number;
364
+ depth?: number;
365
+ /**
366
+ * If this node was customized in the view
367
+ */
368
+ isCustomized?: boolean;
369
+ }
370
+ interface CustomElementExpr extends Omit<BaseExpr, "custom"> {
371
+ custom: {
372
+ expr: ElementExpression | ElementWhereExpr;
373
+ title?: string;
374
+ description?: string;
375
+ technology?: string;
376
+ notation?: string;
377
+ shape?: ElementShape;
378
+ color?: Color;
379
+ icon?: IconUrl;
380
+ border?: BorderStyle;
381
+ opacity?: number;
382
+ navigateTo?: ViewID;
383
+ };
384
+ }
385
+ interface CustomRelationExpr extends Omit<BaseExpr, "customRelation"> {
386
+ customRelation: {
387
+ relation: RelationExpression | RelationWhereExpr;
388
+ title?: string;
389
+ description?: string;
390
+ technology?: string;
391
+ notation?: string;
392
+ navigateTo?: ViewID;
393
+ notes?: string;
394
+ color?: Color;
395
+ line?: RelationshipLineType;
396
+ head?: RelationshipArrowType;
397
+ tail?: RelationshipArrowType;
398
+ };
399
+ }
400
+ interface DiagramEdge extends ComputedEdge {
401
+ points: NonEmptyArray<Point>;
402
+ controlPoints?: NonEmptyArray<XYPoint>;
403
+ labelBBox?: BBox | null;
404
+ dotpos?: string;
405
+ }
406
+ interface DiagramNode extends ComputedNode {
407
+ width: number;
408
+ height: number;
409
+ position: Point;
410
+ labelBBox: BBox;
411
+ }
412
+ interface DiagramView extends Omit<ComputedView, "nodes" | "edges" | "manualLayout"> {
413
+ readonly nodes: DiagramNode[];
414
+ readonly edges: DiagramEdge[];
415
+ readonly bounds: BBox;
416
+ /**
417
+ * If diagram has manual layout
418
+ * But was changed and layout should be recalculated
419
+ */
420
+ hasLayoutDrift?: boolean;
421
+ manualLayout?: never;
422
+ }
423
+ interface DynamicView extends BasicView<"dynamic"> {
424
+ readonly __: "dynamic";
425
+ readonly steps: DynamicViewStepOrParallel[];
426
+ readonly rules: DynamicViewRule[];
427
+ }
428
+ interface DynamicViewParallelSteps {
429
+ readonly __parallel: DynamicViewStep[];
430
+ }
431
+ interface DynamicViewStep {
432
+ readonly source: Fqn;
433
+ readonly target: Fqn;
434
+ readonly title: string | null;
435
+ readonly description?: string;
436
+ readonly technology?: string;
437
+ readonly notation?: string;
438
+ readonly notes?: string;
439
+ readonly color?: Color;
440
+ readonly line?: RelationshipLineType;
441
+ readonly head?: RelationshipArrowType;
442
+ readonly tail?: RelationshipArrowType;
443
+ readonly isBackward?: boolean;
444
+ readonly navigateTo?: ViewID;
445
+ __parallel?: never;
446
+ }
447
+ interface ElementKindExpr extends Omit<BaseExpr, "elementKind" | "isEqual"> {
448
+ elementKind: ElementKind;
449
+ isEqual: boolean;
450
+ }
451
+ interface ElementRefExpr extends Omit<BaseExpr, "element" | "isDescedants"> {
452
+ element: Fqn;
453
+ isDescedants?: boolean;
454
+ }
455
+ interface ElementStyle {
456
+ border?: BorderStyle;
457
+ opacity?: number;
458
+ }
459
+ interface ElementTagExpr extends Omit<BaseExpr, "elementTag" | "isEqual"> {
460
+ elementTag: Tag$1;
461
+ isEqual: boolean;
462
+ }
463
+ interface ElementThemeColorValues {
464
+ fill: ColorLiteral;
465
+ stroke: ColorLiteral;
466
+ hiContrast: ColorLiteral;
467
+ loContrast: ColorLiteral;
468
+ }
469
+ interface ElementWhereExpr extends Omit<BaseExpr, "where"> {
470
+ where: {
471
+ expr: ElementExpression;
472
+ condition: WhereOperator<string, string>;
473
+ };
474
+ }
475
+ interface ExpandedElementExpr extends Omit<BaseExpr, "expanded"> {
476
+ expanded: Fqn;
477
+ }
478
+ interface ExtendsElementView extends BasicElementView {
479
+ readonly extends: ViewID;
480
+ }
481
+ interface HeadingStyle {
482
+ fontSize: string;
483
+ fontWeight?: string;
484
+ lineHeight: string;
485
+ }
486
+ interface InOutExpr extends Omit<BaseExpr, "inout"> {
487
+ inout: ElementExpression;
488
+ }
489
+ interface IncomingExpr extends Omit<BaseExpr, "incoming"> {
490
+ incoming: ElementExpression;
491
+ }
492
+ interface LikeC4DiagramEventHandlers {
493
+ onChange?: OnChange | null | undefined;
494
+ onNavigateTo?: OnNavigateTo | null | undefined;
495
+ onNodeClick?: OnNodeClick | null | undefined;
496
+ onNodeContextMenu?: OnNodeClick | null | undefined;
497
+ onCanvasContextMenu?: OnCanvasClick | null | undefined;
498
+ onEdgeClick?: OnEdgeClick | null | undefined;
499
+ onEdgeContextMenu?: OnEdgeClick | null | undefined;
500
+ onCanvasClick?: OnCanvasClick | null | undefined;
501
+ onCanvasDblClick?: OnCanvasClick | null | undefined;
502
+ onBurgerMenuClick?: null | undefined | (() => void);
503
+ onOpenSourceView?: null | undefined | (() => void);
504
+ onOpenSourceElement?: null | undefined | ((fqn: Fqn) => void);
505
+ onOpenSourceRelation?: null | undefined | ((id: RelationID) => void);
506
+ }
507
+ interface LikeC4DiagramProperties {
508
+ view: DiagramView;
509
+ className?: string | undefined;
510
+ /**
511
+ * Show/hide ReactFlow controls menu
512
+ * @default false
513
+ */
514
+ controls?: boolean | undefined;
515
+ /**
516
+ * Enable/disable panning
517
+ * @default true
518
+ */
519
+ pannable?: boolean | undefined;
520
+ /**
521
+ * Enable/disable zooming
522
+ * @default true
523
+ */
524
+ zoomable?: boolean | undefined;
525
+ /**
526
+ * Disable any editing (dragging still can be enabled with `nodesDraggable`)
527
+ * @default true
528
+ */
529
+ readonly?: boolean | undefined;
530
+ /**
531
+ * If set, initial viewport will show all nodes & edges
532
+ * @default true
533
+ */
534
+ fitView?: boolean | undefined;
535
+ /**
536
+ * Seems like this is percentage of the view size
537
+ * @default 0
538
+ */
539
+ fitViewPadding?: number | undefined;
540
+ /**
541
+ * @default false if readonly
542
+ */
543
+ nodesSelectable?: boolean | undefined;
544
+ /**
545
+ * @default false if readonly
546
+ */
547
+ nodesDraggable?: boolean | undefined;
548
+ initialWidth?: number | undefined;
549
+ initialHeight?: number | undefined;
550
+ /**
551
+ * Keep aspect ratio of the diagram
552
+ * @default false
553
+ */
554
+ keepAspectRatio?: boolean | undefined;
555
+ /**
556
+ * Background pattern
557
+ * @default 'dots'
558
+ */
559
+ background?: "transparent" | "solid" | XYBackground | undefined;
560
+ /**
561
+ * Display hovercards with element links
562
+ * @default true
563
+ */
564
+ showElementLinks?: boolean | undefined;
565
+ /**
566
+ * Display panel with diagram title / description
567
+ * @default true
568
+ */
569
+ showDiagramTitle?: boolean | undefined;
570
+ /**
571
+ * Show back/forward navigation buttons
572
+ * @default true if `onNavigateTo` is set
573
+ */
574
+ showNavigationButtons?: undefined | boolean;
575
+ /**
576
+ * Display notations of the view
577
+ * @default true
578
+ */
579
+ showNotations?: boolean | undefined;
580
+ /**
581
+ * If double click on a node should enable focus mode, i.e. highlight incoming/outgoing edges
582
+ * @default true
583
+ */
584
+ enableFocusMode?: boolean | undefined;
585
+ /**
586
+ * If Walkthrough for dynamic views should be enabled
587
+ * @default false
588
+ */
589
+ enableDynamicViewWalkthrough?: boolean | undefined;
590
+ /**
591
+ * Experimental feature to enable edge editing
592
+ * @default false
593
+ */
594
+ experimentalEdgeEditing?: boolean | undefined;
595
+ /**
596
+ * Render icon for an element, bundled or remote
597
+ * By default, if icon is http:// or https://, it will be rendered as an image
598
+ */
599
+ renderIcon?: ElementIconRenderer$1 | undefined;
600
+ /**
601
+ * Dynamic filter, applies both to nodes and edges
602
+ */
603
+ where?: WhereOperator<string, string> | undefined;
604
+ }
605
+ interface Link {
606
+ readonly title?: string;
607
+ readonly url: string;
608
+ readonly relative?: string;
609
+ }
610
+ interface MantineGradient {
611
+ from: string;
612
+ to: string;
613
+ deg?: number;
614
+ }
615
+ interface MantinePrimaryShade {
616
+ light: MantineColorShade;
617
+ dark: MantineColorShade;
618
+ }
619
+ interface MantineTheme {
620
+ /** Controls focus ring styles. Supports the following options:
621
+ * - `auto` – focus ring is displayed only when the user navigates with keyboard (default value)
622
+ * - `always` – focus ring is displayed when the user navigates with keyboard and mouse
623
+ * - `never` – focus ring is always hidden (not recommended)
624
+ */
625
+ focusRing: "auto" | "always" | "never";
626
+ /** rem units scale, change if you customize font-size of `<html />` element
627
+ * default value is `1` (for `100%`/`16px` font-size on `<html />`)
628
+ */
629
+ scale: number;
630
+ /** Determines whether `font-smoothing` property should be set on the body, `true` by default */
631
+ fontSmoothing: boolean;
632
+ /** White color */
633
+ white: string;
634
+ /** Black color */
635
+ black: string;
636
+ /** Object of colors, key is color name, value is an array of at least 10 strings (colors) */
637
+ colors: MantineThemeColors;
638
+ /** Index of theme.colors[color].
639
+ * Primary shade is used in all components to determine which color from theme.colors[color] should be used.
640
+ * Can be either a number (0–9) or an object to specify different color shades for light and dark color schemes.
641
+ * Default value `{ light: 6, dark: 8 }`
642
+ *
643
+ * For example,
644
+ * { primaryShade: 6 } // shade 6 is used both for dark and light color schemes
645
+ * { primaryShade: { light: 6, dark: 7 } } // different shades for dark and light color schemes
646
+ * */
647
+ primaryShade: MantineColorShade | MantinePrimaryShade;
648
+ /** Key of `theme.colors`, hex/rgb/hsl values are not supported.
649
+ * Determines which color will be used in all components by default.
650
+ * Default value – `blue`.
651
+ * */
652
+ primaryColor: string;
653
+ /** Function to resolve colors based on variant.
654
+ * Can be used to deeply customize how colors are applied to `Button`, `ActionIcon`, `ThemeIcon`
655
+ * and other components that use colors from theme.
656
+ * */
657
+ variantColorResolver: VariantColorsResolver;
658
+ /** Determines whether text color must be changed based on the given `color` prop in filled variant
659
+ * For example, if you pass `color="blue.1"` to Button component, text color will be changed to `var(--mantine-color-black)`
660
+ * Default value – `false`
661
+ * */
662
+ autoContrast: boolean;
663
+ /** Determines which luminance value is used to determine if text color should be light or dark.
664
+ * Used only if `theme.autoContrast` is set to `true`.
665
+ * Default value is `0.3`
666
+ * */
667
+ luminanceThreshold: number;
668
+ /** font-family used in all components, system fonts by default */
669
+ fontFamily: string;
670
+ /** Monospace font-family, used in code and other similar components, system fonts by default */
671
+ fontFamilyMonospace: string;
672
+ /** Controls various styles of h1-h6 elements, used in TypographyStylesProvider and Title components */
673
+ headings: {
674
+ fontFamily: string;
675
+ fontWeight: string;
676
+ textWrap: "wrap" | "nowrap" | "balance" | "pretty" | "stable";
677
+ sizes: {
678
+ h1: HeadingStyle;
679
+ h2: HeadingStyle;
680
+ h3: HeadingStyle;
681
+ h4: HeadingStyle;
682
+ h5: HeadingStyle;
683
+ h6: HeadingStyle;
684
+ };
685
+ };
686
+ /** Object of values that are used to set `border-radius` in all components that support it */
687
+ radius: MantineRadiusValues;
688
+ /** Key of `theme.radius` or any valid CSS value. Default `border-radius` used by most components */
689
+ defaultRadius: MantineRadius;
690
+ /** Object of values that are used to set various CSS properties that control spacing between elements */
691
+ spacing: MantineSpacingValues;
692
+ /** Object of values that are used to control `font-size` property in all components */
693
+ fontSizes: MantineFontSizesValues;
694
+ /** Object of values that are used to control `line-height` property in `Text` component */
695
+ lineHeights: MantineLineHeightValues;
696
+ /** Object of values that are used to control breakpoints in all components,
697
+ * values are expected to be defined in em
698
+ * */
699
+ breakpoints: MantineBreakpointsValues;
700
+ /** Object of values that are used to add `box-shadow` styles to components that support `shadow` prop */
701
+ shadows: MantineShadowsValues;
702
+ /** Determines whether user OS settings to reduce motion should be respected, `false` by default */
703
+ respectReducedMotion: boolean;
704
+ /** Determines which cursor type will be used for interactive elements
705
+ * - `default` – cursor that is used by native HTML elements, for example, `input[type="checkbox"]` has `cursor: default` styles
706
+ * - `pointer` – sets `cursor: pointer` on interactive elements that do not have these styles by default
707
+ */
708
+ cursorType: "default" | "pointer";
709
+ /** Default gradient configuration for components that support `variant="gradient"` */
710
+ defaultGradient: MantineGradient;
711
+ /** Class added to the elements that have active styles, for example, `Button` and `ActionIcon` */
712
+ activeClassName: string;
713
+ /** Class added to the elements that have focus styles, for example, `Button` or `ActionIcon`.
714
+ * Overrides `theme.focusRing` property.
715
+ */
716
+ focusClassName: string;
717
+ /** Allows adding `classNames`, `styles` and `defaultProps` to any component */
718
+ components: MantineThemeComponents;
719
+ /** Any other properties that you want to access with the theme objects */
720
+ other: MantineThemeOther;
721
+ }
722
+ interface MantineThemeColorsOverride {
723
+ }
724
+ interface MantineThemeComponent {
725
+ classNames?: any;
726
+ styles?: any;
727
+ vars?: any;
728
+ defaultProps?: any;
729
+ }
730
+ interface MantineThemeOther {
731
+ [key: string]: any;
732
+ }
733
+ interface OutgoingExpr extends Omit<BaseExpr, "outgoing"> {
734
+ outgoing: ElementExpression;
735
+ }
736
+ interface RelationExpr extends Omit<BaseExpr, "source" | "target"> {
737
+ source: ElementExpression;
738
+ target: ElementExpression;
739
+ isBidirectional?: boolean;
740
+ }
741
+ interface RelationWhereExpr extends Omit<BaseExpr, "where"> {
742
+ where: {
743
+ expr: RelationExpression;
744
+ condition: WhereOperator<string, string>;
745
+ };
746
+ }
747
+ interface RelationshipThemeColorValues {
748
+ lineColor: ColorLiteral;
749
+ labelBgColor: ColorLiteral;
750
+ labelColor: ColorLiteral;
751
+ }
752
+ interface ScopedElementView extends BasicElementView {
753
+ readonly viewOf: Fqn;
754
+ }
755
+ interface ThemeColorValues {
756
+ elements: ElementThemeColorValues;
757
+ relationships: RelationshipThemeColorValues;
758
+ }
759
+ interface VariantColorResolverResult {
760
+ background: string;
761
+ hover: string;
762
+ color: string;
763
+ border: string;
764
+ hoverColor?: string;
765
+ }
766
+ interface VariantColorsResolverInput {
767
+ color: MantineColor | undefined;
768
+ theme: MantineTheme;
769
+ variant: string;
770
+ gradient?: MantineGradient;
771
+ autoContrast?: boolean;
772
+ }
773
+ interface ViewRuleAutoLayout {
774
+ autoLayout: AutoLayoutDirection;
775
+ }
776
+ interface ViewRuleStyle {
777
+ targets: ElementExpression[];
778
+ notation?: string;
779
+ style: ElementStyle & {
780
+ color?: Color;
781
+ shape?: ElementShape;
782
+ icon?: IconUrl;
783
+ };
784
+ }
785
+ interface ViewWithHash {
786
+ /**
787
+ * Hash of the view object.
788
+ * This is used to detect changes in layout
789
+ */
790
+ hash: string;
791
+ }
792
+ interface ViewWithNotation {
793
+ notation?: {
794
+ elements: ElementNotation[];
795
+ };
796
+ }
797
+ interface WildcardExpr extends Omit<BaseExpr, "wildcard"> {
798
+ wildcard: true;
799
+ }
800
+ interface XYPoint {
801
+ x: number;
802
+ y: number;
803
+ }
804
+ type AllNever = {
805
+ not?: never;
806
+ and?: never;
807
+ or?: never;
808
+ tag?: never;
809
+ kind?: never;
810
+ };
811
+ type AndOperator<Tag, Kind> = Omit<AllNever, "and"> & {
812
+ and: NonEmptyArray<WhereOperator<Tag, Kind>>;
813
+ };
814
+ type AutoLayoutDirection = "TB" | "BT" | "LR" | "RL";
815
+ type BBox = {
816
+ x: number;
817
+ y: number;
818
+ width: number;
819
+ height: number;
820
+ };
821
+ type BackgroundProps = {
822
+ id?: string;
823
+ /** Color of the pattern */
824
+ color?: string;
825
+ /** Color of the background */
826
+ bgColor?: string;
827
+ /** Class applied to the container */
828
+ className?: string;
829
+ /** Class applied to the pattern */
830
+ patternClassName?: string;
831
+ /** Gap between repetitions of the pattern */
832
+ gap?: number | [
833
+ number,
834
+ number
835
+ ];
836
+ /** Size of a single pattern element */
837
+ size?: number;
838
+ /** Offset of the pattern */
839
+ offset?: number | [
840
+ number,
841
+ number
842
+ ];
843
+ /** Line width of the Line pattern */
844
+ lineWidth?: number;
845
+ /** Variant of the pattern
846
+ * @example BackgroundVariant.Lines, BackgroundVariant.Dots, BackgroundVariant.Cross
847
+ * 'lines', 'dots', 'cross'
848
+ */
849
+ variant?: BackgroundVariant;
850
+ /** Style applied to the container */
851
+ style?: CSSProperties;
852
+ };
853
+ type BorderStyle = typeof BorderStyles[number];
854
+ type BuiltIns = Primitive | void | Date | RegExp;
855
+ type ChangeEvent = {
856
+ change: ViewChange;
857
+ };
858
+ type Color = LiteralUnion<ThemeColor, string>;
859
+ type ColorLiteral = HexColorLiteral;
860
+ type ColorScheme = "light" | "dark";
861
+ type ComputedView = ComputedElementView | ComputedDynamicView;
862
+ type CustomColorDefinitions = {
863
+ [key: string]: ThemeColorValues;
864
+ };
865
+ type DefaultMantineColor = "dark" | "gray" | "red" | "pink" | "grape" | "violet" | "indigo" | "blue" | "cyan" | "green" | "lime" | "yellow" | "orange" | "teal" | (string & {});
866
+ type DiagramNodeWithNavigate<ID extends string = ViewID> = Omit<DiagramNode, "navigateTo"> & {
867
+ navigateTo: ID;
868
+ };
869
+ type DynamicViewIncludeRule = {
870
+ include: ElementPredicateExpression[];
871
+ };
872
+ type DynamicViewRule = DynamicViewIncludeRule | ViewRuleStyle | ViewRuleAutoLayout;
873
+ type DynamicViewStepOrParallel = DynamicViewStep | DynamicViewParallelSteps;
874
+ type EdgeId = Tagged<string, "EdgeId">;
875
+ type ElementExpression = ElementRefExpr | WildcardExpr | ElementKindExpr | ElementTagExpr | ExpandedElementExpr;
876
+ type ElementIconNodeProps = {
877
+ id: string;
878
+ title: string;
879
+ icon?: string | undefined;
880
+ };
881
+ type ElementIconRenderer = (props: ElementIconRendererProps) => ReactNode;
882
+ type ElementIconRenderer$1 = (props: {
883
+ node: ElementIconNodeProps;
884
+ }) => ReactNode;
885
+ type ElementIconRendererProps = {
886
+ node: {
887
+ id: string;
888
+ title: string;
889
+ icon?: string | undefined;
890
+ };
891
+ };
892
+ type ElementKind = Tagged<string, "ElementKind">;
893
+ type ElementNotation = {
894
+ kinds: ElementKind[];
895
+ shape: ElementShape;
896
+ color: Color;
897
+ title: string;
898
+ };
899
+ type ElementPredicateExpression = ElementExpression | ElementWhereExpr | CustomElementExpr;
900
+ type ElementShape = typeof ElementShapes[number];
901
+ type ElementView = ScopedElementView | ExtendsElementView | BasicElementView;
902
+ type EqualOperator<V> = {
903
+ eq: V;
904
+ neq?: never;
905
+ } | {
906
+ eq?: never;
907
+ neq: V;
908
+ };
909
+ type Expression = ElementPredicateExpression | RelationPredicateExpression;
910
+ type Fqn = Tagged<string, "Fqn">;
911
+ type HexColorLiteral = `#${string}`;
912
+ type IconUrl = Tagged<string, "IconUrl">;
913
+ type KindEqual<Kind> = Omit<AllNever, "kind"> & {
914
+ kind: EqualOperator<Kind>;
915
+ };
916
+ type LikeC4DiagramProps = LikeC4DiagramProperties & LikeC4DiagramEventHandlers;
917
+ type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
918
+ type MantineBreakpointsValues = Record<MantineSize | (string & {}), string>;
919
+ type MantineColor = keyof MantineThemeColors;
920
+ type MantineColorShade = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
921
+ type MantineColorsTuple = readonly [
922
+ string,
923
+ string,
924
+ string,
925
+ string,
926
+ string,
927
+ string,
928
+ string,
929
+ string,
930
+ string,
931
+ string,
932
+ ...string[]
933
+ ];
934
+ type MantineFontSizesValues = Record<MantineSize | (string & {}), string>;
935
+ type MantineLineHeightValues = Record<MantineSize | (string & {}), string>;
936
+ type MantineRadius = keyof MantineRadiusValues | (string & {}) | number;
937
+ type MantineRadiusValues = Record<MantineSize | (string & {}), string>;
938
+ type MantineShadowsValues = Record<MantineSize | (string & {}), string>;
939
+ type MantineSize = "xs" | "sm" | "md" | "lg" | "xl";
940
+ type MantineSpacingValues = Record<MantineSize | (string & {}), string>;
941
+ type MantineThemeColors = MantineThemeColorsOverride extends {
942
+ colors: Record<infer CustomColors, MantineColorsTuple>;
943
+ } ? Record<CustomColors, MantineColorsTuple> : Record<DefaultMantineColor, MantineColorsTuple>;
944
+ type MantineThemeComponents = Record<string, MantineThemeComponent>;
945
+ type MantineThemeOverride = PartialDeep<MantineTheme>;
946
+ type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
947
+ type NodeId = Tagged<string, "Fqn">;
948
+ type NonEmptyArray<T> = [
949
+ T,
950
+ ...T[]
951
+ ];
952
+ type NotOperator<Tag, Kind> = Omit<AllNever, "not"> & {
953
+ not: WhereOperator<Tag, Kind>;
954
+ };
955
+ type OmitIndexSignature<ObjectType> = {
956
+ [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType];
957
+ };
958
+ type OnCanvasClick = (event: ReactMouseEvent) => void;
959
+ type OnChange = (event: ChangeEvent) => void;
960
+ type OnEdgeClick = (edge: DiagramEdge, event: ReactMouseEvent) => void;
961
+ type OnNavigateTo<ID extends string = ViewID> = (to: ID, event?: ReactMouseEvent, element?: DiagramNodeWithNavigate<ID>) => void;
962
+ type OnNodeClick = (node: DiagramNode, event: ReactMouseEvent) => void;
963
+ type OrOperator<Tag, Kind> = Omit<AllNever, "or"> & {
964
+ or: NonEmptyArray<WhereOperator<Tag, Kind>>;
965
+ };
966
+ type OverrideProperties<TOriginal,
967
+ // This first bit where we use `Partial` is to enable autocomplete
968
+ // and the second bit with the mapped type is what enforces that we don't try
969
+ // to override properties that doesn't exist in the original type.
970
+ TOverride extends Partial<Record<keyof TOriginal, unknown>> & {
971
+ [Key in keyof TOverride]: Key extends keyof TOriginal ? TOverride[Key] : never;
972
+ }> = Merge<TOriginal, TOverride>;
973
+ type PartialDeep<T, Options extends PartialDeepOptions = {}> = T extends BuiltIns | (((...arguments_: any[]) => unknown)) | (new (...arguments_: any[]) => unknown) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
974
+ ? Options["recurseIntoArrays"] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
975
+ ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
976
+ ? ReadonlyArray<PartialDeep<ItemType | undefined, Options>> : Array<PartialDeep<ItemType | undefined, Options>> : PartialObjectDeep<T, Options> // Tuples behave properly
977
+ : T // If they don't opt into array testing, just use the original type
978
+ : PartialObjectDeep<T, Options> : unknown;
979
+ type PartialDeepOptions = {
980
+ /**
981
+ Whether to affect the individual elements of arrays and tuples.
982
+
983
+ @default false
984
+ */
985
+ readonly recurseIntoArrays?: boolean;
986
+ };
987
+ type PartialMapDeep<KeyType, ValueType, Options extends PartialDeepOptions> = {} & Map<PartialDeep<KeyType, Options>, PartialDeep<ValueType, Options>>;
988
+ type PartialObjectDeep<ObjectType extends object, Options extends PartialDeepOptions> = {
989
+ [KeyType in keyof ObjectType]?: PartialDeep<ObjectType[KeyType], Options>;
990
+ };
991
+ type PartialReadonlyMapDeep<KeyType, ValueType, Options extends PartialDeepOptions> = {} & ReadonlyMap<PartialDeep<KeyType, Options>, PartialDeep<ValueType, Options>>;
992
+ type PartialReadonlySetDeep<T, Options extends PartialDeepOptions> = {} & ReadonlySet<PartialDeep<T, Options>>;
993
+ type PartialSetDeep<T, Options extends PartialDeepOptions> = {} & Set<PartialDeep<T, Options>>;
994
+ type PickIndexSignature<ObjectType> = {
995
+ [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType];
996
+ };
997
+ type Point = readonly [
998
+ x: number,
999
+ y: number
1000
+ ];
1001
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
1002
+ type RelationExpression = RelationExpr | InOutExpr | IncomingExpr | OutgoingExpr;
1003
+ type RelationID = Tagged<string, "RelationID">;
1004
+ type RelationPredicateExpression = RelationExpression | RelationWhereExpr | CustomRelationExpr;
1005
+ type RelationshipArrowType = "none" | "normal" | "onormal" | "dot" | "odot" | "diamond" | "odiamond" | "crow" | "open" | "vee";
1006
+ type RelationshipKind = Tagged<string, "RelationshipKind">;
1007
+ type RelationshipLineType = "dashed" | "solid" | "dotted";
1008
+ type SimpleMerge<Destination, Source> = {
1009
+ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
1010
+ } & Source;
1011
+ type Simplify<T> = {
1012
+ [KeyType in keyof T]: T[KeyType];
1013
+ } & {};
1014
+ type Tag$1 = Tagged<string, "Tag">;
1015
+ type Tag<Token extends PropertyKey, TagMetadata> = TagContainer<{
1016
+ [K in Token]: TagMetadata;
1017
+ }>;
1018
+ type TagContainer<Token> = {
1019
+ readonly [tag]: Token;
1020
+ };
1021
+ type TagEqual<Tag> = Omit<AllNever, "tag"> & {
1022
+ tag: EqualOperator<Tag>;
1023
+ };
1024
+ type Tagged<Type, TagName extends PropertyKey, TagMetadata = never> = Type & Tag<TagName, TagMetadata>;
1025
+ type ThemeColor = typeof ThemeColors[number];
1026
+ type VariantColorsResolver = (input: VariantColorsResolverInput) => VariantColorResolverResult;
1027
+ type ViewChange = ViewChange.ChangeElementStyle | ViewChange.SaveManualLayout | ViewChange.ChangeAutoLayout;
1028
+ type ViewID = Tagged<string, "ViewID">;
1029
+ type ViewManualLayout = {
1030
+ readonly hash: string;
1031
+ readonly x: number;
1032
+ readonly y: number;
1033
+ readonly width: number;
1034
+ readonly height: number;
1035
+ readonly autoLayout: AutoLayoutDirection;
1036
+ readonly nodes: Record<string, {
1037
+ isCompound: boolean;
1038
+ x: number;
1039
+ y: number;
1040
+ width: number;
1041
+ height: number;
1042
+ }>;
1043
+ readonly edges: Record<string, {
1044
+ dotpos?: string;
1045
+ points: NonEmptyArray<Point>;
1046
+ controlPoints?: NonEmptyArray<XYPoint>;
1047
+ labelBBox?: BBox;
1048
+ }>;
1049
+ };
1050
+ type ViewRule = ViewRulePredicate | ViewRuleStyle | ViewRuleAutoLayout;
1051
+ type ViewRulePredicate = {
1052
+ include: Expression[];
1053
+ exclude?: never;
1054
+ } | {
1055
+ include?: never;
1056
+ exclude: Expression[];
1057
+ };
1058
+ type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
1059
+ type XYBackground = XYBackgroundVariant | OverrideProperties<BackgroundProps, {
1060
+ variant: XYBackgroundVariant;
1061
+ }>;
1062
+ type XYBackgroundVariant = "dots" | "lines" | "cross";
1063
+
1064
+ export {};