likec4 1.19.2 → 1.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__app__/react/likec4.tsx +16 -114
- package/__app__/src/chunks/{-index-overview-COSF42be.js → -index-overview-B8Ngh4J7.js} +20 -19
- package/__app__/src/chunks/{likec4-CusAw_j6.js → likec4-CK8zVxjc.js} +1172 -1209
- package/__app__/src/chunks/main-DwHOiMDD.js +23884 -0
- package/__app__/src/chunks/{mantine-B_6mKFFA.js → mantine-B9NZkjVg.js} +993 -981
- package/__app__/src/chunks/tanstack-router-B9I-d36d.js +3032 -0
- package/__app__/src/main.js +1 -2
- package/__app__/src/style.css +1 -1
- package/__app__/webcomponent/webcomponent.js +31795 -32402
- package/dist/chunks/prompt.cjs +1 -1
- package/dist/chunks/prompt.mjs +1 -1
- package/dist/cli/index.cjs +47 -58
- package/dist/cli/index.mjs +29 -40
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +106 -81
- package/dist/index.d.mts +106 -81
- package/dist/index.d.ts +106 -81
- package/dist/index.mjs +1 -1
- package/dist/model/index.cjs +1 -1
- package/dist/model/index.d.cts +4 -257
- package/dist/model/index.d.mts +4 -257
- package/dist/model/index.d.ts +4 -257
- package/dist/model/index.mjs +1 -1
- package/dist/shared/likec4.Buej2FfJ.mjs +1857 -0
- package/dist/shared/likec4.pZxbrzrY.cjs +1857 -0
- package/package.json +39 -39
- package/react/index.d.ts +771 -1546
- package/react/index.js +36196 -36908
- package/react/style.css +1 -1
- package/__app__/src/chunks/main-CtzxB_vG.js +0 -24136
- package/__app__/src/chunks/tanstack-router-BBWuTKWO.js +0 -2373
- package/dist/shared/likec4.-U9_Dinu.cjs +0 -1856
- package/dist/shared/likec4.CVn8U3Og.cjs +0 -9
- package/dist/shared/likec4.Cgd5VecV.mjs +0 -9
- package/dist/shared/likec4.D7BM0ZAO.mjs +0 -1856
- package/dist/shared/likec4.DJeGiAvE.d.cts +0 -1639
- package/dist/shared/likec4.DJeGiAvE.d.mts +0 -1639
- package/dist/shared/likec4.DJeGiAvE.d.ts +0 -1639
package/react/index.d.ts
CHANGED
|
@@ -1,1546 +1,771 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
type
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
type
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
interface
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
type
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
interface
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
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 { }
|