proschi 0.9.0 → 0.11.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.
@@ -12,6 +12,9 @@
12
12
  {
13
13
  "include": "#section"
14
14
  },
15
+ {
16
+ "include": "#legend"
17
+ },
15
18
  {
16
19
  "include": "#decision-line"
17
20
  },
@@ -24,12 +27,18 @@
24
27
  {
25
28
  "include": "#import"
26
29
  },
30
+ {
31
+ "include": "#layout-hint"
32
+ },
27
33
  {
28
34
  "include": "#keyword"
29
35
  },
30
36
  {
31
37
  "include": "#node-id"
32
38
  },
39
+ {
40
+ "include": "#style"
41
+ },
33
42
  {
34
43
  "include": "#string"
35
44
  },
@@ -103,6 +112,24 @@
103
112
  }
104
113
  }
105
114
  },
115
+ "layout-hint": {
116
+ "comment": "`direction down|right|up|left` (top level or in a group) and `layout ordered`: layout hints, each a statement of its own. Otherwise the words are node ids.",
117
+ "match": "^\\s*(?:(direction)\\s+(down|right|up|left)|(layout)\\s+(ordered))(?=\\s*(?:#|$))",
118
+ "captures": {
119
+ "1": {
120
+ "name": "keyword.control.proschi"
121
+ },
122
+ "2": {
123
+ "name": "constant.language.direction.proschi"
124
+ },
125
+ "3": {
126
+ "name": "keyword.control.proschi"
127
+ },
128
+ "4": {
129
+ "name": "constant.language.layout.proschi"
130
+ }
131
+ }
132
+ },
106
133
  "keyword": {
107
134
  "comment": "Statement keywords start a line, or follow } as in `} alt \"Next\" {`.",
108
135
  "match": "^\\s*(?:(\\})\\s*)?(title|group|usecase|par|alt)\\b",
@@ -402,6 +429,92 @@
402
429
  "comment": "A number with an optional fraction, magnitude and unit, attached or one space away: 120, 2.5, 50ms, 100k rps, 99.9%, 4xx, 500 MB/s, 0.05 usd/GB.",
403
430
  "name": "constant.numeric.proschi",
404
431
  "match": "\\b\\d+(?:\\.\\d+)?(?:[A-Za-z]+(?:/[A-Za-z]+)?|%)?(?: (?:rps|rpm|rpd|ms|s|usd/month|usd/GB|MB/s|GB/s)\\b| %)?"
432
+ },
433
+ "style": {
434
+ "comment": "`color <name>|#hex`, `critical`, `rank N|first|last` and `.tag` on nodes, groups and connections. Right after `color` a # is a hex color, not a comment.",
435
+ "patterns": [
436
+ {
437
+ "include": "#color"
438
+ },
439
+ {
440
+ "name": "keyword.other.critical.proschi",
441
+ "match": "(?<=\\s)critical(?![A-Za-z0-9_])"
442
+ },
443
+ {
444
+ "match": "(?<=\\s)(rank)\\s+(\\d+|first|last)(?![A-Za-z0-9_])",
445
+ "captures": {
446
+ "1": {
447
+ "name": "keyword.other.rank.proschi"
448
+ },
449
+ "2": {
450
+ "name": "constant.numeric.rank.proschi"
451
+ }
452
+ }
453
+ },
454
+ {
455
+ "include": "#tag"
456
+ }
457
+ ]
458
+ },
459
+ "color": {
460
+ "match": "\\b(color)\\s+(#(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})(?![A-Za-z0-9_])|[A-Za-z_][A-Za-z0-9_]*)",
461
+ "captures": {
462
+ "1": {
463
+ "name": "keyword.other.color.proschi"
464
+ },
465
+ "2": {
466
+ "name": "constant.other.color.proschi"
467
+ }
468
+ }
469
+ },
470
+ "tag": {
471
+ "name": "entity.other.attribute-name.tag.proschi",
472
+ "match": "(?<![A-Za-z0-9_])\\.[A-Za-z_][A-Za-z0-9_]*"
473
+ },
474
+ "legend": {
475
+ "comment": "The legend block: one style per line, `id \"Label\" <color> [dashed|dotted]`.",
476
+ "name": "meta.block.legend.proschi",
477
+ "begin": "^\\s*(legend)(?=\\s*\\{\\s*(?:#.*)?$)",
478
+ "end": "^\\s*(\\})",
479
+ "beginCaptures": {
480
+ "1": {
481
+ "name": "keyword.control.proschi"
482
+ }
483
+ },
484
+ "endCaptures": {
485
+ "1": {
486
+ "name": "punctuation.section.block.end.proschi"
487
+ }
488
+ },
489
+ "patterns": [
490
+ {
491
+ "include": "#color"
492
+ },
493
+ {
494
+ "include": "#comment"
495
+ },
496
+ {
497
+ "include": "#string"
498
+ },
499
+ {
500
+ "include": "#node-id"
501
+ },
502
+ {
503
+ "name": "constant.other.color.proschi",
504
+ "match": "\\b(?:gray|blue|teal|green|yellow|orange|red|purple|pink)\\b"
505
+ },
506
+ {
507
+ "name": "keyword.other.proschi",
508
+ "match": "\\b(?:dashed|dotted)\\b"
509
+ },
510
+ {
511
+ "name": "punctuation.section.block.begin.proschi",
512
+ "match": "\\{"
513
+ },
514
+ {
515
+ "include": "#identifier"
516
+ }
517
+ ]
405
518
  }
406
519
  }
407
520
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proschi",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Command-line checker and language server for Proschi architecture diagrams",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,7 +45,8 @@
45
45
  "capacity",
46
46
  "entity",
47
47
  "decision",
48
- "test"
48
+ "test",
49
+ "legend"
49
50
  ]
50
51
  },
51
52
  "start": {
@@ -222,6 +223,34 @@
222
223
  "$ref": "#/$defs/test"
223
224
  },
224
225
  "description": "`test` blocks of flow assertions."
226
+ },
227
+ "legend": {
228
+ "type": "array",
229
+ "items": {
230
+ "$ref": "#/$defs/legendEntry"
231
+ },
232
+ "description": "Entries of the `legend` block, in order."
233
+ },
234
+ "layout": {
235
+ "type": "object",
236
+ "description": "Top-level layout hints; left out when the document uses none.",
237
+ "properties": {
238
+ "direction": {
239
+ "enum": [
240
+ "down",
241
+ "right",
242
+ "up",
243
+ "left"
244
+ ],
245
+ "description": "`direction right`: where edges flow in the whole diagram."
246
+ },
247
+ "ordered": {
248
+ "type": "boolean",
249
+ "description": "`layout ordered`: edges follow declaration order."
250
+ }
251
+ },
252
+ "required": [],
253
+ "additionalProperties": false
225
254
  }
226
255
  },
227
256
  "required": [
@@ -254,6 +283,7 @@
254
283
  "database",
255
284
  "cache",
256
285
  "queue",
286
+ "broker",
257
287
  "storage",
258
288
  "cdn",
259
289
  "serverless",
@@ -283,6 +313,7 @@
283
313
  "NoSQL Database",
284
314
  "Cache",
285
315
  "Message Queue",
316
+ "Message Broker",
286
317
  "Object Storage",
287
318
  "CDN",
288
319
  "Load Balancer",
@@ -497,6 +528,7 @@
497
528
  "search",
498
529
  "analytics",
499
530
  "queue",
531
+ "broker",
500
532
  "storage",
501
533
  "external",
502
534
  "other"
@@ -539,6 +571,45 @@
539
571
  "minimum": 1,
540
572
  "description": "`x3`: number of replicas; absent means 1."
541
573
  },
574
+ "color": {
575
+ "type": "string",
576
+ "description": "`color teal` or `color #3b82f6`, as written."
577
+ },
578
+ "tag": {
579
+ "type": "string",
580
+ "description": "`.owned`: the legend entry the node or group is styled by."
581
+ },
582
+ "critical": {
583
+ "type": "boolean",
584
+ "description": "`critical`: drawn with a warning badge."
585
+ },
586
+ "rank": {
587
+ "oneOf": [
588
+ {
589
+ "type": "integer",
590
+ "minimum": 0
591
+ },
592
+ {
593
+ "enum": [
594
+ "first",
595
+ "last"
596
+ ]
597
+ }
598
+ ],
599
+ "description": "`rank 2`, `rank first`, `rank last`: the layout layer among the nodes and groups that share its parent."
600
+ },
601
+ "direction": {
602
+ "enum": [
603
+ "down",
604
+ "right",
605
+ "up",
606
+ "left"
607
+ ],
608
+ "description": "`direction right` inside a group: where edges flow among its members."
609
+ },
610
+ "style": {
611
+ "$ref": "#/$defs/style"
612
+ },
542
613
  "loc": {
543
614
  "$ref": "#/$defs/loc"
544
615
  }
@@ -553,6 +624,58 @@
553
624
  ],
554
625
  "additionalProperties": false
555
626
  },
627
+ "style": {
628
+ "type": "object",
629
+ "description": "Resolved fill and border (or stroke) from `color` and the tag; an explicit color wins.",
630
+ "properties": {
631
+ "color": {
632
+ "type": "string",
633
+ "description": "Base color as #rrggbb."
634
+ },
635
+ "dash": {
636
+ "enum": [
637
+ "dashed",
638
+ "dotted"
639
+ ]
640
+ }
641
+ },
642
+ "required": [],
643
+ "additionalProperties": false
644
+ },
645
+ "legendEntry": {
646
+ "type": "object",
647
+ "properties": {
648
+ "id": {
649
+ "type": "string"
650
+ },
651
+ "label": {
652
+ "type": "string"
653
+ },
654
+ "colorName": {
655
+ "type": "string",
656
+ "description": "The color as written: a palette name or #hex."
657
+ },
658
+ "color": {
659
+ "type": "string",
660
+ "description": "Base color as #rrggbb."
661
+ },
662
+ "dash": {
663
+ "enum": [
664
+ "dashed",
665
+ "dotted"
666
+ ]
667
+ },
668
+ "loc": {
669
+ "$ref": "#/$defs/loc"
670
+ }
671
+ },
672
+ "required": [
673
+ "id",
674
+ "label",
675
+ "loc"
676
+ ],
677
+ "additionalProperties": false
678
+ },
556
679
  "edge": {
557
680
  "type": "object",
558
681
  "properties": {
@@ -568,6 +691,13 @@
568
691
  "label": {
569
692
  "type": "string"
570
693
  },
694
+ "tag": {
695
+ "type": "string",
696
+ "description": "`a -> b .planned`: the legend entry the edge is styled by."
697
+ },
698
+ "style": {
699
+ "$ref": "#/$defs/style"
700
+ },
571
701
  "loc": {
572
702
  "$ref": "#/$defs/loc"
573
703
  }
@@ -840,6 +970,7 @@
840
970
  "search",
841
971
  "analytics",
842
972
  "queue",
973
+ "broker",
843
974
  "storage",
844
975
  "external",
845
976
  "other"