@radicaltools/mcp 0.1.1 → 0.2.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.
@@ -1,3 +1,32 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // ../../packages/layout/src/elkLayout.ts
28
+ import ELK from "elkjs/lib/elk.bundled.js";
29
+
1
30
  // ../../packages/common/src/metamodel/lookup.ts
2
31
  function isRelationAllowed(metamodel, fromType, toType) {
3
32
  if (!metamodel) return true;
@@ -24,12 +53,53 @@ function isParentAllowed(metamodel, childType, parentType) {
24
53
  }
25
54
  return !!allowed && allowed.includes(parentType);
26
55
  }
56
+ var GROUP_TYPE = "group";
57
+ function placeOf(node, nodes) {
58
+ const seen = /* @__PURE__ */ new Set();
59
+ let cur = node;
60
+ while (cur && cur.type === GROUP_TYPE && !seen.has(cur)) {
61
+ seen.add(cur);
62
+ cur = cur.parentId ? nodes[cur.parentId] : void 0;
63
+ }
64
+ return cur && cur.type !== GROUP_TYPE ? cur : void 0;
65
+ }
66
+ function hasPlaceUnder(metamodel, childType, placeType) {
67
+ if (!metamodel || !metamodel.nodeTypes[childType]) return true;
68
+ if (placeType == null) return isParentAllowed(metamodel, childType, void 0);
69
+ const seen = /* @__PURE__ */ new Set();
70
+ const queue = [childType];
71
+ while (queue.length > 0) {
72
+ for (const parent of metamodel.nodeTypes[queue.pop()]?.allowedParents ?? []) {
73
+ if (parent === placeType) return true;
74
+ if (parent === GROUP_TYPE || seen.has(parent)) continue;
75
+ seen.add(parent);
76
+ queue.push(parent);
77
+ }
78
+ }
79
+ return false;
80
+ }
81
+ function isPlacementAllowed(metamodel, childType, parent, nodes) {
82
+ if (!isParentAllowed(metamodel, childType, parent?.type)) return false;
83
+ if (!parent || parent.type !== GROUP_TYPE) return true;
84
+ return hasPlaceUnder(metamodel, childType, placeOf(parent, nodes)?.type);
85
+ }
27
86
  function canAddMoreOfType(metamodel, typeId, currentCount) {
28
87
  if (!metamodel) return true;
29
88
  const def = metamodel.nodeTypes[typeId];
30
89
  if (!def?.cardinality?.max) return true;
31
90
  return currentCount < def.cardinality.max;
32
91
  }
92
+ var RESERVED_PROPERTY_KEYS = {
93
+ node: /* @__PURE__ */ new Set(["id", "type", "parentId", "x", "y", "width", "height", "collapsed"]),
94
+ relation: /* @__PURE__ */ new Set(["id", "sourceId", "targetId", "relationType"])
95
+ };
96
+ function isReservedPropertyKey(key, of) {
97
+ return RESERVED_PROPERTY_KEYS[of].has(key);
98
+ }
99
+ function propertyKeyProblem(key, of) {
100
+ if (!isReservedPropertyKey(key, of)) return null;
101
+ return `"${key}" is a field every ${of === "node" ? "element" : "relation"} has (${[...RESERVED_PROPERTY_KEYS[of]].join(", ")}): give the property another key.`;
102
+ }
33
103
 
34
104
  // ../../packages/common/src/metamodel/refs.ts
35
105
  function refIds(value) {
@@ -303,6 +373,15 @@ function validateModel(nodes, relations, metamodel) {
303
373
  message: `${def.label} "${n.label}" cannot be inside ${parentLabel}. Allowed parents: ${allowed.length ? allowed.join(", ") : "(none \u2014 must be root)"}.`,
304
374
  nodeId: n.id
305
375
  });
376
+ } else if (parent.type === GROUP_TYPE && !hasPlaceUnder(metamodel, n.type, placeOf(parent, nodes)?.type)) {
377
+ const place = placeOf(parent, nodes);
378
+ const where = place ? `inside ${metamodel.nodeTypes[place.type]?.label ?? place.type} "${place.label}"` : "at the top of the model";
379
+ issues.push({
380
+ id: `bad-place:${n.id}`,
381
+ severity: "warning",
382
+ message: `${def.label} "${n.label}" is in group "${parent.label}", which is ${where}, where a ${def.label} has no place.`,
383
+ nodeId: n.id
384
+ });
306
385
  }
307
386
  } else if (def.allowedAtRoot === false || def.allowedAtRoot === void 0 && allowed && allowed.length > 0) {
308
387
  issues.push({
@@ -346,6 +425,32 @@ function validateModel(nodes, relations, metamodel) {
346
425
  });
347
426
  }
348
427
  }
428
+ for (const def of [...Object.values(metamodel.nodeTypes), ...Object.values(metamodel.relationTypes)]) {
429
+ const seen = /* @__PURE__ */ new Set();
430
+ for (const p of def.properties ?? []) {
431
+ if (seen.has(p.key)) {
432
+ const isNode = !!metamodel.nodeTypes[def.id] && metamodel.nodeTypes[def.id] === def;
433
+ issues.push({ id: `dup-prop:${def.id}:${p.key}`, severity: "error", message: `${isNode ? def.label : `Relation type "${def.label}"`}: two properties have the key "${p.key}"; give one another key.`, ...isNode ? { nodeTypeId: def.id } : {} });
434
+ }
435
+ seen.add(p.key);
436
+ }
437
+ }
438
+ for (const def of Object.values(metamodel.nodeTypes)) {
439
+ for (const p of def.properties ?? []) {
440
+ const problem = propertyKeyProblem(p.key, "node");
441
+ if (problem) {
442
+ issues.push({ id: `reserved-prop:${def.id}:${p.key}`, severity: "error", message: `${def.label}: property key ${problem}`, nodeTypeId: def.id });
443
+ }
444
+ }
445
+ }
446
+ for (const def of Object.values(metamodel.relationTypes)) {
447
+ for (const p of def.properties ?? []) {
448
+ const problem = propertyKeyProblem(p.key, "relation");
449
+ if (problem) {
450
+ issues.push({ id: `reserved-rel-prop:${def.id}:${p.key}`, severity: "error", message: `Relation type "${def.label}": property key ${problem}` });
451
+ }
452
+ }
453
+ }
349
454
  const restrictiveTypes = Object.values(metamodel.relationTypes).filter((rt) => rt.allowedPairs.length > 0);
350
455
  const anyAllows = Object.values(metamodel.relationTypes).some((rt) => rt.allowedPairs.length === 0);
351
456
  if (restrictiveTypes.length > 0 && !anyAllows) {
@@ -366,6 +471,55 @@ function validateModel(nodes, relations, metamodel) {
366
471
  }
367
472
  }
368
473
  }
474
+ for (const r of Object.values(relations)) {
475
+ const missing = [r.sourceId, r.targetId].filter((id) => !nodes[id]);
476
+ if (missing.length) {
477
+ issues.push({
478
+ id: `rel-end-missing:${r.id}`,
479
+ severity: "error",
480
+ message: `Relation "${r.label ?? r.id}" ${missing.length === 2 ? "has no element at either end" : `points at "${missing[0]}", which is no element of the model`}.`,
481
+ relationId: r.id
482
+ });
483
+ }
484
+ if (r.relationType && !metamodel.relationTypes[r.relationType]) {
485
+ issues.push({
486
+ id: `unknown-rel-type:${r.id}`,
487
+ severity: "error",
488
+ message: `Relation "${r.label ?? r.id}" has unknown type "${r.relationType}".`,
489
+ relationId: r.id
490
+ });
491
+ }
492
+ }
493
+ for (const r of Object.values(relations)) {
494
+ const def = r.relationType ? metamodel.relationTypes[r.relationType] : void 0;
495
+ for (const p of def?.properties ?? []) {
496
+ if (!p.required) continue;
497
+ const v = r[p.key];
498
+ if (v == null || v === "" || Array.isArray(v) && v.length === 0) {
499
+ const src = nodes[r.sourceId]?.label ?? r.sourceId;
500
+ const dst = nodes[r.targetId]?.label ?? r.targetId;
501
+ issues.push({
502
+ id: `missing-prop:${r.id}:${p.key}`,
503
+ severity: "warning",
504
+ message: `Relation "${src}" \u2192 "${dst}" (${def.label}) is missing required property "${p.label}".`,
505
+ relationId: r.id
506
+ });
507
+ }
508
+ }
509
+ }
510
+ for (const r of Object.values(relations)) {
511
+ const def = r.relationType ? metamodel.relationTypes[r.relationType] : void 0;
512
+ const src = nodes[r.sourceId];
513
+ const dst = nodes[r.targetId];
514
+ if (!def || !src || !dst || def.allowedPairs.length === 0) continue;
515
+ if (def.allowedPairs.some((p) => p.from === src.type && p.to === dst.type)) continue;
516
+ issues.push({
517
+ id: `bad-rel-type:${r.id}`,
518
+ severity: "warning",
519
+ message: `Relation "${src.label}" \u2192 "${dst.label}" is "${def.label}", which does not connect ${src.type}\u2192${dst.type}.`,
520
+ relationId: r.id
521
+ });
522
+ }
369
523
  const checkRefs = (item, props, at, what) => {
370
524
  for (const p of props ?? []) {
371
525
  if (p.type !== "ref") continue;
@@ -406,16 +560,20 @@ function validateModel(nodes, relations, metamodel) {
406
560
  function capitalize(s) {
407
561
  return s.charAt(0).toUpperCase() + s.slice(1);
408
562
  }
563
+ function earsActionIsClause(action) {
564
+ return /\S\s+shall\s+\S/i.test(action);
565
+ }
409
566
  function composeEarsSentence(node, subject, statePrecondition) {
410
567
  const earsType = String(node.ears_type ?? "ubiquitous");
411
568
  const subj = (subject || "the system").trim();
412
569
  const action = String(node.action ?? "").trim();
413
570
  const trigger = String(node.trigger ?? "").trim();
414
- const precondition = String(node.precondition ?? "").trim() || (statePrecondition ?? "").trim();
571
+ const precondition = (statePrecondition ?? "").trim() || String(node.precondition ?? "").trim();
415
572
  const unwanted = String(node.unwanted_condition ?? "").trim();
416
573
  const feature = String(node.feature ?? "").trim();
417
- const actionPart = action || "\u2039action\u203A";
418
- const shallClause = `${subj} shall ${actionPart}`;
574
+ const actionPart = action.replace(/\.+$/, "") || "\u2039action\u203A";
575
+ const ownClause = earsActionIsClause(actionPart);
576
+ const shallClause = ownClause ? actionPart.replace(/^(The|A|An)\b/, (w) => w.toLowerCase()) : `${subj} shall ${actionPart}`;
419
577
  let sentence;
420
578
  let complete = !!action;
421
579
  switch (earsType) {
@@ -449,18 +607,244 @@ function composeEarsSentence(node, subject, statePrecondition) {
449
607
  break;
450
608
  }
451
609
  default:
452
- sentence = `${capitalize(subj)} shall ${actionPart}.`;
610
+ sentence = ownClause ? `${capitalize(actionPart)}.` : `${capitalize(subj)} shall ${actionPart}.`;
453
611
  break;
454
612
  }
455
613
  return { sentence, complete };
456
614
  }
457
615
 
616
+ // ../../packages/common/src/metamodel/presets/viewpoints.ts
617
+ var DEPLOYABLE = ["container", "webapp", "database", "queue"];
618
+ var BUILDING_BLOCKS = ["system", "container", "webapp", "component", "database", "queue"];
619
+ function among(types) {
620
+ return { levels: [{ ways: [{ types }] }], edges: "all" };
621
+ }
622
+ function c4Viewpoints() {
623
+ return [
624
+ {
625
+ id: "system-context",
626
+ label: "System context",
627
+ group: "C4",
628
+ description: "The people and software systems, and how they use each other (C4 level 1).",
629
+ kind: "static",
630
+ pipeline: among(["person", "system"])
631
+ },
632
+ {
633
+ id: "containers",
634
+ label: "Containers",
635
+ group: "C4",
636
+ description: "The software systems with the containers, web apps, databases and queues inside them, the people who use them, and every relation between them (C4 level 2).",
637
+ kind: "static",
638
+ pipeline: among(["person", "system", ...DEPLOYABLE])
639
+ },
640
+ {
641
+ id: "components",
642
+ label: "Components",
643
+ group: "C4",
644
+ description: "The containers and web apps with the components inside them, the databases and queues they use, and every relation between them (C4 level 3).",
645
+ kind: "static",
646
+ pipeline: among(["container", "webapp", "component", "database", "queue"])
647
+ },
648
+ {
649
+ id: "container-dependencies",
650
+ label: "Container dependencies",
651
+ group: "C4",
652
+ description: "A matrix of the containers, web apps, databases and queues: who uses whom, and where the cycles are.",
653
+ kind: "matrix",
654
+ pipeline: among(DEPLOYABLE)
655
+ }
656
+ ];
657
+ }
658
+ function radicalViewpoints() {
659
+ return [
660
+ ...c4Viewpoints(),
661
+ {
662
+ id: "domain-map",
663
+ label: "Domain map",
664
+ group: "Domain",
665
+ description: "The domains and subdomains, and how they depend on and partner with each other.",
666
+ kind: "static",
667
+ pipeline: among(["domain"])
668
+ },
669
+ {
670
+ id: "domain-model",
671
+ label: "Domain model",
672
+ group: "Domain",
673
+ description: "The entities and aggregates, what they are part of and what they reference.",
674
+ kind: "static",
675
+ pipeline: among(["entity"])
676
+ },
677
+ {
678
+ id: "domain-realisation",
679
+ label: "Domain realisation",
680
+ group: "Domain",
681
+ description: "A table of domains, their entities, and the systems, containers and components that realise each.",
682
+ kind: "table",
683
+ pipeline: { levels: [
684
+ { ways: [{ types: ["domain"] }] },
685
+ { ways: [{ via: { contains: true }, types: ["entity"] }, { via: { relationType: "realises", direction: "in" } }] },
686
+ { ways: [{ via: { relationType: "realises", direction: "in" } }] }
687
+ ] }
688
+ },
689
+ {
690
+ id: "traceability",
691
+ label: "Traceability",
692
+ group: "Requirements",
693
+ description: "A table of needs, the requirements refined from each, and the scenarios that verify those.",
694
+ kind: "table",
695
+ pipeline: { levels: [
696
+ { ways: [{ types: ["need"] }] },
697
+ { ways: [{ via: { relationType: "derives", direction: "in" }, types: ["requirement"] }] },
698
+ { ways: [{ via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }] }
699
+ ] }
700
+ },
701
+ {
702
+ id: "requirement-coverage",
703
+ label: "Requirement coverage",
704
+ group: "Requirements",
705
+ description: "A table of requirements, the elements that satisfy each and the scenarios that verify it.",
706
+ kind: "table",
707
+ pipeline: { levels: [
708
+ { ways: [{ types: ["requirement"] }] },
709
+ { ways: [{ via: { relationType: "satisfies", direction: "in" } }, { via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }] }
710
+ ] }
711
+ },
712
+ {
713
+ id: "requirement-gaps",
714
+ label: "Requirement gaps",
715
+ group: "Requirements",
716
+ description: "The requirements no scenario verifies or nothing satisfies yet.",
717
+ kind: "table",
718
+ pipeline: { levels: [
719
+ { ways: [{ types: ["requirement"] }], filters: [
720
+ { kind: "relation", relationType: "verifies", direction: "in", has: false },
721
+ { kind: "relation", relationType: "satisfies", direction: "in", has: false, join: "or" }
722
+ ] }
723
+ ] }
724
+ },
725
+ {
726
+ id: "responsibilities",
727
+ label: "Responsibilities",
728
+ group: "Requirements",
729
+ description: "A table of the systems, containers and components that satisfy requirements, each with its requirements and the scenarios that verify them.",
730
+ kind: "table",
731
+ pipeline: { levels: [
732
+ { ways: [{ types: BUILDING_BLOCKS }], filters: [{ kind: "relation", relationType: "satisfies", direction: "out", has: true }] },
733
+ { ways: [{ via: { relationType: "satisfies", direction: "out" }, types: ["requirement"] }] },
734
+ { ways: [{ via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }] }
735
+ ] }
736
+ },
737
+ {
738
+ id: "specification",
739
+ label: "Specification",
740
+ group: "Requirements",
741
+ description: "A document of the needs, the requirements refined from each, and the scenarios and screens for each requirement.",
742
+ kind: "wiki",
743
+ pipeline: { levels: [
744
+ { ways: [{ types: ["need"] }] },
745
+ { ways: [{ via: { relationType: "derives", direction: "in" }, types: ["requirement"] }] },
746
+ { ways: [{ via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }, { via: { relationType: "illustrates", direction: "in" }, types: ["mockup"] }] }
747
+ ] }
748
+ },
749
+ {
750
+ id: "decisions",
751
+ label: "Decisions",
752
+ group: "Decisions",
753
+ description: "A table of ADRs, the fitness functions that check each and the elements it constrains.",
754
+ kind: "table",
755
+ pipeline: { levels: [
756
+ { ways: [{ types: ["adr"] }] },
757
+ { ways: [{ via: { relationType: "implements", direction: "in" }, types: ["fitness-fn"] }, { via: { relationType: "constrains", direction: "out" } }] }
758
+ ] }
759
+ },
760
+ {
761
+ id: "decision-log",
762
+ label: "Decision log",
763
+ group: "Decisions",
764
+ description: "A document of the ADRs, the newest first, each with the decisions it supersedes.",
765
+ kind: "wiki",
766
+ pipeline: {
767
+ levels: [
768
+ { ways: [{ types: ["adr"] }] },
769
+ { ways: [{ via: { relationType: "supersedes", direction: "out" }, types: ["adr"] }] }
770
+ ],
771
+ sort: { by: "property", key: "date", desc: true }
772
+ }
773
+ },
774
+ {
775
+ id: "fitness-functions",
776
+ label: "Fitness functions",
777
+ group: "Decisions",
778
+ description: "A table of the fitness functions by category, each with the decisions it checks and the elements it constrains.",
779
+ kind: "table",
780
+ pipeline: {
781
+ levels: [
782
+ { ways: [{ types: ["fitness-fn"] }] },
783
+ { ways: [{ via: { relationType: "implements", direction: "out" }, types: ["adr"] }, { via: { relationType: "constrains", direction: "out" } }] }
784
+ ],
785
+ sort: { by: "property", key: "category" }
786
+ }
787
+ },
788
+ {
789
+ id: "screen-flow",
790
+ label: "Screen flow",
791
+ group: "UX",
792
+ description: "The screens and how users navigate from one to the next.",
793
+ kind: "static",
794
+ pipeline: among(["mockup"])
795
+ },
796
+ {
797
+ id: "screens",
798
+ label: "Screens",
799
+ group: "UX",
800
+ description: "A table of the screens, each with the requirements and scenarios it illustrates and the elements that present it.",
801
+ kind: "table",
802
+ pipeline: { levels: [
803
+ { ways: [{ types: ["mockup"] }] },
804
+ { ways: [{ via: { relationType: "illustrates", direction: "out" } }, { via: { relationType: "presented-by", direction: "out" } }] }
805
+ ] }
806
+ },
807
+ {
808
+ id: "entity-lifecycles",
809
+ label: "Entity lifecycles",
810
+ group: "States",
811
+ description: "A table of the entities with a lifecycle, the state machine of each, and what implements and verifies it.",
812
+ kind: "table",
813
+ pipeline: { levels: [
814
+ { ways: [{ types: ["entity"] }], filters: [{ kind: "relation", relationType: "lifecycle-of", direction: "in", has: true }] },
815
+ { ways: [{ via: { relationType: "lifecycle-of", direction: "in" }, types: ["state-machine"] }] },
816
+ { ways: [{ via: { relationType: "implements", direction: "in" } }, { via: { relationType: "verifies", direction: "in" }, types: ["scenario"] }] }
817
+ ] }
818
+ },
819
+ {
820
+ id: "event-catalogue",
821
+ label: "Event catalogue",
822
+ group: "States",
823
+ description: "A table of the events, each with what emits it.",
824
+ kind: "table",
825
+ pipeline: { levels: [
826
+ { ways: [{ types: ["event"] }] },
827
+ { ways: [{ via: { relationType: "emits", direction: "in" } }] }
828
+ ] }
829
+ },
830
+ {
831
+ id: "process-warnier",
832
+ label: "Process (Warnier)",
833
+ group: "Process",
834
+ description: "The processes and their steps as Warnier\u2013Orr diagrams: what each is made of, what repeats, what is an alternative and what runs at once.",
835
+ kind: "warnier",
836
+ pipeline: { levels: [{ ways: [{ types: ["process", "step"] }] }] }
837
+ }
838
+ ];
839
+ }
840
+
458
841
  // ../../packages/common/src/metamodel/presets/c4.ts
459
842
  var VISUALS = {
460
843
  person: {
461
844
  label: "Person",
462
845
  color: "#08427b",
463
846
  fg: "#fff",
847
+ description: "Someone who uses or runs the system: a customer, an operator, another team.",
464
848
  iconPath: "M8 2a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5ZM3 12.5C3 10.01 5.24 8 8 8s5 2.01 5 4.5V14H3v-1.5Z",
465
849
  width: 150,
466
850
  height: 170,
@@ -471,6 +855,7 @@ var VISUALS = {
471
855
  label: "Software System",
472
856
  color: "#1168bd",
473
857
  fg: "#fff",
858
+ description: "Something that delivers value to its users and is owned by one team: yours, or one you depend on.",
474
859
  iconPath: "M2 3.5A1.5 1.5 0 0 1 3.5 2h9A1.5 1.5 0 0 1 14 3.5v9a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5v-9ZM4 5h8v1H4V5Zm0 2.5h8v1H4v-1Zm0 2.5h5v1H4V10Z",
475
860
  width: 360,
476
861
  height: 260,
@@ -481,6 +866,7 @@ var VISUALS = {
481
866
  label: "Container",
482
867
  color: "#438dd5",
483
868
  fg: "#fff",
869
+ description: "Something that runs or stores data and is deployed on its own: a service, a worker, a mobile app, a serverless function.",
484
870
  iconPath: "M1 4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v1H1V4Zm0 2.5h14V12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V6.5ZM3 3a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Zm2 0a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Z",
485
871
  width: 300,
486
872
  height: 200,
@@ -491,6 +877,7 @@ var VISUALS = {
491
877
  label: "Component",
492
878
  color: "#85bbf0",
493
879
  fg: "#000",
880
+ description: "A part of a container behind a clear interface: a controller, a domain service, an adapter.",
494
881
  iconPath: "M5 1v2H3a1 1 0 0 0-1 1v2h2v2H2v2h2v2H2v2a1 1 0 0 0 1 1h2v2h2v-2h2v2h2v-2h2a1 1 0 0 0 1-1v-2h-2v-2h2V8h-2V6h2V4a1 1 0 0 0-1-1h-2V1H9v2H7V1H5Z",
495
882
  width: 200,
496
883
  height: 120,
@@ -501,6 +888,7 @@ var VISUALS = {
501
888
  label: "Database",
502
889
  color: "#438dd5",
503
890
  fg: "#fff",
891
+ description: "A container that stores data. It never starts an interaction.",
504
892
  iconPath: "M8 1C4.7 1 2 2.3 2 4v8c0 1.7 2.7 3 6 3s6-1.3 6-3V4c0-1.7-2.7-3-6-3ZM2 4c0 1.7 2.7 3 6 3s6-1.3 6-3",
505
893
  width: 190,
506
894
  height: 130,
@@ -511,6 +899,7 @@ var VISUALS = {
511
899
  label: "Web App",
512
900
  color: "#438dd5",
513
901
  fg: "#fff",
902
+ description: "A container that is a browser front end.",
514
903
  iconPath: "M2 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3Zm1 2.5V13h10V5.5H3ZM4 3.5a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Zm1.5 0a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Zm1.5 0a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Z",
515
904
  width: 210,
516
905
  height: 140,
@@ -521,6 +910,7 @@ var VISUALS = {
521
910
  label: "Queue",
522
911
  color: "#438dd5",
523
912
  fg: "#fff",
913
+ description: "A container that carries messages between other containers.",
524
914
  iconPath: "M4 3a3 2 0 1 0 0 4h8a3 2 0 1 0 0-4H4Zm-2 5.5a3 2 0 0 0 4 0v-1a3 2 0 0 1-4 0v1Zm10 0a3 2 0 0 0 4 0v-1a3 2 0 0 1-4 0v1Z",
525
915
  width: 220,
526
916
  height: 95,
@@ -531,6 +921,7 @@ var VISUALS = {
531
921
  label: "Group",
532
922
  color: "#64748b",
533
923
  fg: "#fff",
924
+ description: "A labelled boundary with no meaning of its own: a team, a layer, a deployment zone.",
534
925
  // Folder icon.
535
926
  iconPath: "M2 3.5C2 2.67 2.67 2 3.5 2H7l1.5 2h4c.83 0 1.5.67 1.5 1.5v7c0 .83-.67 1.5-1.5 1.5h-9C2.67 14 2 13.33 2 12.5v-9Z",
536
927
  width: 520,
@@ -572,6 +963,7 @@ function builtInC4Metamodel() {
572
963
  nodeTypes[t] = {
573
964
  id: t,
574
965
  label: v.label,
966
+ description: v.description,
575
967
  color: v.color,
576
968
  fg: v.fg,
577
969
  iconPath: v.iconPath,
@@ -630,6 +1022,9 @@ function builtInC4Metamodel() {
630
1022
  interacts: {
631
1023
  id: "interacts",
632
1024
  label: "Interacts",
1025
+ description: "Any meaningful interaction: the source calls, uses, sends to or delivers to the target. The label says what happens, the technology how.",
1026
+ forwardLabel: "Uses",
1027
+ inverseLabel: "Used by",
633
1028
  allowedPairs: interactsPairs,
634
1029
  properties: [
635
1030
  { key: "technology", label: "Technology", type: "text" }
@@ -637,7 +1032,7 @@ function builtInC4Metamodel() {
637
1032
  builtin: true
638
1033
  }
639
1034
  };
640
- return { id: "c4-builtin", name: "C4 (built-in)", nodeTypes, relationTypes };
1035
+ return { id: "c4-builtin", name: "C4 (built-in)", nodeTypes, relationTypes, viewpoints: c4Viewpoints() };
641
1036
  }
642
1037
 
643
1038
  // ../../packages/common/src/metamodel/presets/ddd.ts
@@ -662,6 +1057,7 @@ function builtInDddC4Metamodel() {
662
1057
  const domain = {
663
1058
  id: "domain",
664
1059
  label: "Domain",
1060
+ description: "A part of the problem space, in the language of the business rather than of the software.",
665
1061
  color: "#4c1d95",
666
1062
  fg: "#fff",
667
1063
  iconPath: "M2 3.5A1.5 1.5 0 0 1 3.5 2h9A1.5 1.5 0 0 1 14 3.5v9a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5v-9Zm1.5 1A.5.5 0 0 0 3 5v6a.5.5 0 0 0 .5.5h9A.5.5 0 0 0 13 11V5a.5.5 0 0 0-.5-.5h-9ZM5 7h2v2H5V7Zm4 0h2v2H9V7Z",
@@ -678,6 +1074,7 @@ function builtInDddC4Metamodel() {
678
1074
  const entity = {
679
1075
  id: "entity",
680
1076
  label: "Entity",
1077
+ description: "A thing the domain keeps track of and that has an identity over time: a reservation, an order, a payment.",
681
1078
  color: "#7e22ce",
682
1079
  fg: "#fff",
683
1080
  // A record card with a key
@@ -687,7 +1084,6 @@ function builtInDddC4Metamodel() {
687
1084
  allowedParents: ["domain", "group"],
688
1085
  allowedAtRoot: true,
689
1086
  builtin: true,
690
- tableTab: true,
691
1087
  // The parts of an aggregate list under its root in Table and Wiki views.
692
1088
  hierarchyRelation: "part-of",
693
1089
  properties: [
@@ -704,6 +1100,8 @@ function builtInDddC4Metamodel() {
704
1100
  const realises = {
705
1101
  id: "realises",
706
1102
  label: "Realises",
1103
+ description: "The software behind a domain or an entity: the bounded context that implements the domain, or the element that owns the entity's data.",
1104
+ inverseLabel: "Realised by",
707
1105
  allowedPairs: [
708
1106
  { from: "system", to: "domain" },
709
1107
  { from: "container", to: "domain" },
@@ -715,6 +1113,8 @@ function builtInDddC4Metamodel() {
715
1113
  const partOf = {
716
1114
  id: "part-of",
717
1115
  label: "Part of",
1116
+ description: "A part of an aggregate points to its root.",
1117
+ inverseLabel: "Made up of",
718
1118
  allowedPairs: [{ from: "entity", to: "entity" }],
719
1119
  properties: [],
720
1120
  color: "#7e22ce",
@@ -723,6 +1123,8 @@ function builtInDddC4Metamodel() {
723
1123
  const references = {
724
1124
  id: "references",
725
1125
  label: "References",
1126
+ description: "One aggregate refers to another by id.",
1127
+ inverseLabel: "Referenced by",
726
1128
  allowedPairs: [{ from: "entity", to: "entity" }],
727
1129
  properties: [
728
1130
  {
@@ -743,6 +1145,8 @@ function builtInDddC4Metamodel() {
743
1145
  const dependsOn = {
744
1146
  id: "depends-on",
745
1147
  label: "Depends on",
1148
+ description: "The source domain needs the target to do its work.",
1149
+ inverseLabel: "Depended on by",
746
1150
  allowedPairs: ddPairs,
747
1151
  properties: [
748
1152
  { key: "description", label: "Description", type: "text" }
@@ -752,6 +1156,9 @@ function builtInDddC4Metamodel() {
752
1156
  const partnership = {
753
1157
  id: "partnership",
754
1158
  label: "Partnership",
1159
+ description: "How the models of two domains meet, with a context-mapping pattern.",
1160
+ forwardLabel: "Partners with",
1161
+ inverseLabel: "Partners with",
755
1162
  allowedPairs: ddPairs,
756
1163
  properties: [
757
1164
  {
@@ -796,6 +1203,11 @@ function builtInDddC4Metamodel() {
796
1203
 
797
1204
  // ../../packages/common/src/metamodel/presets/governance.ts
798
1205
  var RADICAL_METAMODEL_NAME = "Radical";
1206
+ var TESTS_PROPERTY = {
1207
+ key: "tests",
1208
+ label: "Tests (one per line: file \u203A title)",
1209
+ type: "textarea"
1210
+ };
799
1211
  function builtInGovernanceMetamodel() {
800
1212
  const base = builtInDddC4Metamodel();
801
1213
  const adrProps = [
@@ -815,6 +1227,7 @@ function builtInGovernanceMetamodel() {
815
1227
  const adr = {
816
1228
  id: "adr",
817
1229
  label: "ADR",
1230
+ description: "An architecture decision record: the context of a decision, the decision itself, its consequences and the alternatives that were considered.",
818
1231
  color: "#92400e",
819
1232
  fg: "#fff",
820
1233
  // ADR: document with text lines
@@ -826,7 +1239,6 @@ function builtInGovernanceMetamodel() {
826
1239
  allowedParents: ["system", "domain", "group"],
827
1240
  allowedAtRoot: true,
828
1241
  builtin: true,
829
- tableTab: true,
830
1242
  properties: adrProps,
831
1243
  wizard: {
832
1244
  trigger: "create",
@@ -888,11 +1300,13 @@ function builtInGovernanceMetamodel() {
888
1300
  options: ["structural", "operational", "process", "holistic"],
889
1301
  default: "structural"
890
1302
  },
891
- { key: "threshold", label: "Threshold / Success criteria", type: "text" }
1303
+ { key: "threshold", label: "Threshold / Success criteria", type: "text" },
1304
+ TESTS_PROPERTY
892
1305
  ];
893
1306
  const fitnessFn = {
894
1307
  id: "fitness-fn",
895
1308
  label: "Fitness Function",
1309
+ description: "An objective, preferably automated check that the architecture still has a property it was designed for.",
896
1310
  color: "#5b21b6",
897
1311
  fg: "#fff",
898
1312
  // Concentric circles (target / gauge)
@@ -904,7 +1318,6 @@ function builtInGovernanceMetamodel() {
904
1318
  allowedParents: ["system", "domain", "group"],
905
1319
  allowedAtRoot: true,
906
1320
  builtin: true,
907
- tableTab: true,
908
1321
  properties: fitnessFnProps,
909
1322
  wizard: {
910
1323
  trigger: "create",
@@ -958,6 +1371,7 @@ function builtInGovernanceMetamodel() {
958
1371
  const need = {
959
1372
  id: "need",
960
1373
  label: "Need",
1374
+ description: "Raw input in the stakeholder's own words, kept verbatim: a brief, a user story, a note, a regulation.",
961
1375
  color: "#475569",
962
1376
  fg: "#fff",
963
1377
  // Speech bubble with text lines
@@ -969,7 +1383,6 @@ function builtInGovernanceMetamodel() {
969
1383
  allowedParents: ["system", "domain", "group"],
970
1384
  allowedAtRoot: true,
971
1385
  builtin: true,
972
- tableTab: true,
973
1386
  // A need's wiki page and table tab list what derives from it — sub-needs
974
1387
  // and requirements — as its children; "add child" creates either.
975
1388
  hierarchyRelation: "derives",
@@ -1026,6 +1439,7 @@ function builtInGovernanceMetamodel() {
1026
1439
  const requirement = {
1027
1440
  id: "requirement",
1028
1441
  label: "Requirement",
1442
+ description: "One thing the system shall do, written as an EARS sentence.",
1029
1443
  color: "#0e7490",
1030
1444
  fg: "#fff",
1031
1445
  // Checklist / clipboard with checkmark
@@ -1037,7 +1451,6 @@ function builtInGovernanceMetamodel() {
1037
1451
  allowedParents: ["system", "domain", "group"],
1038
1452
  allowedAtRoot: true,
1039
1453
  builtin: true,
1040
- tableTab: true,
1041
1454
  hierarchyRelation: "derives",
1042
1455
  properties: requirementProps,
1043
1456
  wizard: {
@@ -1099,6 +1512,8 @@ function builtInGovernanceMetamodel() {
1099
1512
  const constrains = {
1100
1513
  id: "constrains",
1101
1514
  label: "Constrains",
1515
+ description: "The decision, check or requirement applies to the target element.",
1516
+ inverseLabel: "Constrained by",
1102
1517
  allowedPairs: constrainsPairs,
1103
1518
  properties: [
1104
1519
  { key: "description", label: "Note", type: "text" }
@@ -1109,6 +1524,8 @@ function builtInGovernanceMetamodel() {
1109
1524
  const supersedes = {
1110
1525
  id: "supersedes",
1111
1526
  label: "Supersedes",
1527
+ description: "The newer decision replaces the older one.",
1528
+ inverseLabel: "Superseded by",
1112
1529
  allowedPairs: [{ from: "adr", to: "adr" }],
1113
1530
  properties: [],
1114
1531
  color: "#f59e0b",
@@ -1117,6 +1534,8 @@ function builtInGovernanceMetamodel() {
1117
1534
  const implements_ = {
1118
1535
  id: "implements",
1119
1536
  label: "Implements",
1537
+ description: "A fitness function checks that a decision still holds; a C4 element runs a state machine.",
1538
+ inverseLabel: "Implemented by",
1120
1539
  allowedPairs: [{ from: "fitness-fn", to: "adr" }],
1121
1540
  properties: [],
1122
1541
  color: "#7c3aed",
@@ -1126,6 +1545,8 @@ function builtInGovernanceMetamodel() {
1126
1545
  const satisfies = {
1127
1546
  id: "satisfies",
1128
1547
  label: "Satisfies",
1548
+ description: "The element is what makes the requirement true.",
1549
+ inverseLabel: "Satisfied by",
1129
1550
  allowedPairs: satisfiesTargets.map((to) => ({ from: to, to: "requirement" })),
1130
1551
  properties: [
1131
1552
  { key: "description", label: "Note", type: "text" }
@@ -1136,6 +1557,8 @@ function builtInGovernanceMetamodel() {
1136
1557
  const derives = {
1137
1558
  id: "derives",
1138
1559
  label: "Derives from",
1560
+ description: "A requirement turns stakeholder input into a shall-statement or refines a broader requirement; a need sits inside a broader need.",
1561
+ inverseLabel: "Refined into",
1139
1562
  allowedPairs: [
1140
1563
  { from: "requirement", to: "requirement" },
1141
1564
  { from: "requirement", to: "need" },
@@ -1148,6 +1571,8 @@ function builtInGovernanceMetamodel() {
1148
1571
  const tracesTo = {
1149
1572
  id: "traces-to",
1150
1573
  label: "Traces to",
1574
+ description: "The decision the requirement led to, or the check that keeps it.",
1575
+ inverseLabel: "Traced from",
1151
1576
  allowedPairs: [
1152
1577
  { from: "requirement", to: "adr" },
1153
1578
  { from: "requirement", to: "fitness-fn" }
@@ -1160,11 +1585,13 @@ function builtInGovernanceMetamodel() {
1160
1585
  { key: "given", label: "Given", type: "textarea" },
1161
1586
  { key: "when", label: "When", type: "textarea" },
1162
1587
  { key: "then", label: "Then", type: "textarea" },
1163
- { key: "gherkin", label: "Extra steps (And/But, raw Gherkin)", type: "textarea" }
1588
+ { key: "gherkin", label: "Extra steps (And/But, raw Gherkin)", type: "textarea" },
1589
+ TESTS_PROPERTY
1164
1590
  ];
1165
1591
  const scenario = {
1166
1592
  id: "scenario",
1167
1593
  label: "Scenario",
1594
+ description: "An acceptance example in Gherkin: given a starting situation, when something happens, then the outcome.",
1168
1595
  color: "#166534",
1169
1596
  fg: "#fff",
1170
1597
  // Play/run triangle in a rounded frame
@@ -1176,7 +1603,6 @@ function builtInGovernanceMetamodel() {
1176
1603
  allowedParents: ["system", "domain", "group"],
1177
1604
  allowedAtRoot: true,
1178
1605
  builtin: true,
1179
- tableTab: true,
1180
1606
  properties: scenarioProps,
1181
1607
  wizard: {
1182
1608
  trigger: "create",
@@ -1219,6 +1645,8 @@ function builtInGovernanceMetamodel() {
1219
1645
  const verifies = {
1220
1646
  id: "verifies",
1221
1647
  label: "Verifies",
1648
+ description: "The scenario is the acceptance test of the requirement or state machine.",
1649
+ inverseLabel: "Verified by",
1222
1650
  allowedPairs: verifiesTargets.map((to) => ({ from: "scenario", to })),
1223
1651
  properties: [],
1224
1652
  color: "#16a34a",
@@ -1239,6 +1667,7 @@ function builtInGovernanceMetamodel() {
1239
1667
  const blueprint = {
1240
1668
  id: "blueprint",
1241
1669
  label: "Blueprint",
1670
+ description: "A curated reference architecture imported from the Concept Hub.",
1242
1671
  color: "#1e3a5f",
1243
1672
  fg: "#fff",
1244
1673
  // Blueprint grid / technical drawing
@@ -1251,7 +1680,6 @@ function builtInGovernanceMetamodel() {
1251
1680
  allowedAtRoot: true,
1252
1681
  builtin: true,
1253
1682
  hubOnly: true,
1254
- tableTab: true,
1255
1683
  properties: blueprintProps
1256
1684
  };
1257
1685
  const mockupProps = [
@@ -1262,6 +1690,7 @@ function builtInGovernanceMetamodel() {
1262
1690
  const mockup = {
1263
1691
  id: "mockup",
1264
1692
  label: "Mockup",
1693
+ description: "One screen of the product, optionally with a low-fi wireframe.",
1265
1694
  color: "#be185d",
1266
1695
  fg: "#fff",
1267
1696
  // Browser window with a header bar and content blocks
@@ -1273,7 +1702,6 @@ function builtInGovernanceMetamodel() {
1273
1702
  allowedParents: ["system", "domain", "group"],
1274
1703
  allowedAtRoot: true,
1275
1704
  builtin: true,
1276
- tableTab: true,
1277
1705
  properties: mockupProps,
1278
1706
  wizard: {
1279
1707
  trigger: "create",
@@ -1310,6 +1738,8 @@ function builtInGovernanceMetamodel() {
1310
1738
  const illustrates = {
1311
1739
  id: "illustrates",
1312
1740
  label: "Illustrates",
1741
+ description: "The screen shows the requirement being met, the step of the scenario, or what the user sees in the state.",
1742
+ inverseLabel: "Illustrated by",
1313
1743
  allowedPairs: [
1314
1744
  { from: "mockup", to: "requirement" },
1315
1745
  { from: "mockup", to: "scenario" }
@@ -1321,6 +1751,8 @@ function builtInGovernanceMetamodel() {
1321
1751
  const presentedBy = {
1322
1752
  id: "presented-by",
1323
1753
  label: "Presented by",
1754
+ description: "The part of the architecture that renders the screen.",
1755
+ inverseLabel: "Presents",
1324
1756
  allowedPairs: ["webapp", "container", "component", "system"].map((to) => ({ from: "mockup", to })),
1325
1757
  properties: [],
1326
1758
  color: "#be185d",
@@ -1329,6 +1761,8 @@ function builtInGovernanceMetamodel() {
1329
1761
  const navigatesTo = {
1330
1762
  id: "navigates-to",
1331
1763
  label: "Navigates to",
1764
+ description: "One step of a screen flow, with what triggers it.",
1765
+ inverseLabel: "Reached from",
1332
1766
  allowedPairs: [{ from: "mockup", to: "mockup" }],
1333
1767
  properties: [
1334
1768
  { key: "description", label: "Trigger", type: "text" }
@@ -1339,6 +1773,7 @@ function builtInGovernanceMetamodel() {
1339
1773
  const stateMachine = {
1340
1774
  id: "state-machine",
1341
1775
  label: "State Machine",
1776
+ description: "The lifecycle of one entity: the states it can be in and the transitions between them.",
1342
1777
  color: "#3730a3",
1343
1778
  fg: "#fff",
1344
1779
  // Two states joined by a transition
@@ -1350,7 +1785,6 @@ function builtInGovernanceMetamodel() {
1350
1785
  allowedParents: ["system", "domain", "group"],
1351
1786
  allowedAtRoot: true,
1352
1787
  builtin: true,
1353
- tableTab: true,
1354
1788
  properties: [
1355
1789
  { key: "description", label: "Description", type: "textarea" }
1356
1790
  ]
@@ -1358,6 +1792,7 @@ function builtInGovernanceMetamodel() {
1358
1792
  const state = {
1359
1793
  id: "state",
1360
1794
  label: "State",
1795
+ description: "A situation the entity can be in.",
1361
1796
  color: "#4f46e5",
1362
1797
  fg: "#fff",
1363
1798
  // Rounded rectangle
@@ -1369,7 +1804,6 @@ function builtInGovernanceMetamodel() {
1369
1804
  allowedParents: ["state-machine", "state"],
1370
1805
  allowedAtRoot: false,
1371
1806
  builtin: true,
1372
- tableTab: true,
1373
1807
  properties: [
1374
1808
  {
1375
1809
  key: "kind",
@@ -1387,6 +1821,7 @@ function builtInGovernanceMetamodel() {
1387
1821
  const pseudostate = {
1388
1822
  id: "pseudostate",
1389
1823
  label: "Pseudostate",
1824
+ description: "A point a state machine passes through but never rests in: where it starts, a choice, a history.",
1390
1825
  color: "#1e1b4b",
1391
1826
  fg: "#fff",
1392
1827
  // Filled dot (initial)
@@ -1409,6 +1844,7 @@ function builtInGovernanceMetamodel() {
1409
1844
  const event = {
1410
1845
  id: "event",
1411
1846
  label: "Event",
1847
+ description: "Something that happens and can trigger a transition.",
1412
1848
  color: "#c2410c",
1413
1849
  fg: "#fff",
1414
1850
  // Lightning bolt
@@ -1418,7 +1854,6 @@ function builtInGovernanceMetamodel() {
1418
1854
  allowedParents: ["state-machine", "system", "domain", "group"],
1419
1855
  allowedAtRoot: true,
1420
1856
  builtin: true,
1421
- tableTab: true,
1422
1857
  properties: [
1423
1858
  {
1424
1859
  key: "source",
@@ -1435,6 +1870,9 @@ function builtInGovernanceMetamodel() {
1435
1870
  const transition = {
1436
1871
  id: "transition",
1437
1872
  label: "Transition",
1873
+ description: "The machine moves from one state to another: on an event, under a guard, running actions.",
1874
+ forwardLabel: "Transitions to",
1875
+ inverseLabel: "Entered from",
1438
1876
  allowedPairs: stateNodeTypes.flatMap((from) => stateNodeTypes.map((to) => ({ from, to }))),
1439
1877
  properties: [
1440
1878
  { key: "event", label: "Event (trigger; none = completion)", type: "ref", refType: "event" },
@@ -1455,6 +1893,8 @@ function builtInGovernanceMetamodel() {
1455
1893
  const lifecycleOf = {
1456
1894
  id: "lifecycle-of",
1457
1895
  label: "Lifecycle of",
1896
+ description: "The machine is the lifecycle of that entity.",
1897
+ inverseLabel: "Lifecycle modelled by",
1458
1898
  allowedPairs: [{ from: "state-machine", to: "entity" }],
1459
1899
  properties: [],
1460
1900
  color: "#3730a3",
@@ -1463,6 +1903,8 @@ function builtInGovernanceMetamodel() {
1463
1903
  const emits = {
1464
1904
  id: "emits",
1465
1905
  label: "Emits",
1906
+ description: "The element raises the event.",
1907
+ inverseLabel: "Emitted by",
1466
1908
  allowedPairs: ["person", "system", "container", "component", "webapp", "queue", "state-machine", "state"].map((from) => ({ from, to: "event" })),
1467
1909
  properties: [
1468
1910
  {
@@ -1476,9 +1918,78 @@ function builtInGovernanceMetamodel() {
1476
1918
  color: "#ea580c",
1477
1919
  builtin: true
1478
1920
  };
1921
+ const childrenProperty = {
1922
+ key: "children",
1923
+ label: "Children run",
1924
+ type: "enum",
1925
+ options: ["sequence", "choice", "concurrent"],
1926
+ default: "sequence"
1927
+ };
1928
+ const process_ = {
1929
+ id: "process",
1930
+ label: "Process",
1931
+ description: "A procedure: the steps it is made of, what repeats and what is an alternative.",
1932
+ color: "#0f766e",
1933
+ fg: "#fff",
1934
+ // A brace with three lines
1935
+ iconPath: "M5 2c-1.1 0-2 .9-2 2v2.2c0 .5-.3.8-.8.8H1.5v2h.7c.5 0 .8.3.8.8V12c0 1.1.9 2 2 2h.5v-1.5H5c-.3 0-.5-.2-.5-.5V9.5c0-.9-.4-1.6-1-2 .6-.4 1-1.1 1-2V4c0-.3.2-.5.5-.5h.5V2H5Zm3 1.5h7V5H8V3.5Zm0 3.75h7v1.5H8v-1.5ZM8 11h7v1.5H8V11Z",
1936
+ width: 260,
1937
+ height: 160,
1938
+ collapsedWidth: 200,
1939
+ collapsedHeight: 64,
1940
+ allowedParents: ["system", "domain", "group"],
1941
+ allowedAtRoot: true,
1942
+ builtin: true,
1943
+ properties: [
1944
+ // Its place among the processes beside it, as a step's among steps.
1945
+ { key: "order", label: "Order", type: "number" },
1946
+ childrenProperty,
1947
+ { key: "description", label: "Description", type: "textarea" }
1948
+ ]
1949
+ };
1950
+ const step = {
1951
+ id: "step",
1952
+ label: "Step",
1953
+ description: "One part of a process, itself made of steps or not.",
1954
+ color: "#14b8a6",
1955
+ fg: "#042f2e",
1956
+ // An arrow into a box
1957
+ iconPath: "M2 4.5A1.5 1.5 0 0 1 3.5 3h9A1.5 1.5 0 0 1 14 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 11.5v-7Zm1.5 0v7h9v-7h-9Zm1 2.75h3.8V5.5L11 8l-2.7 2.5V8.75H4.5v-1.5Z",
1958
+ width: 220,
1959
+ height: 80,
1960
+ collapsedWidth: 180,
1961
+ collapsedHeight: 64,
1962
+ allowedParents: ["process", "step"],
1963
+ allowedAtRoot: false,
1964
+ builtin: true,
1965
+ properties: [
1966
+ { key: "order", label: "Order", type: "number" },
1967
+ {
1968
+ key: "repeat",
1969
+ label: "Repeat",
1970
+ type: "enum",
1971
+ options: ["1", "0..1", "1..n", "0..n"],
1972
+ default: "1"
1973
+ },
1974
+ { key: "condition", label: "Condition (for each\u2026, while\u2026, if\u2026)", type: "text" },
1975
+ childrenProperty,
1976
+ { key: "description", label: "Description", type: "textarea" }
1977
+ ]
1978
+ };
1979
+ const performedBy = {
1980
+ id: "performed-by",
1981
+ label: "Performed by",
1982
+ description: "The person or part of the architecture that does the step.",
1983
+ inverseLabel: "Performs",
1984
+ allowedPairs: ["person", "system", "container", "component", "webapp"].map((to) => ({ from: "step", to })),
1985
+ properties: [],
1986
+ color: "#0d9488",
1987
+ builtin: true
1988
+ };
1479
1989
  implements_.allowedPairs.push(...["system", "container", "component", "webapp"].map((from) => ({ from, to: "state-machine" })));
1480
1990
  satisfies.allowedPairs.push({ from: "state-machine", to: "requirement" }, { from: "entity", to: "requirement" });
1481
- verifies.allowedPairs.push({ from: "scenario", to: "state-machine" });
1991
+ verifies.allowedPairs.push({ from: "scenario", to: "state-machine" }, { from: "scenario", to: "process" });
1992
+ satisfies.allowedPairs.push({ from: "process", to: "requirement" });
1482
1993
  illustrates.allowedPairs.push({ from: "mockup", to: "state" });
1483
1994
  return {
1484
1995
  id: "c4-ddd-governance-builtin",
@@ -1495,7 +2006,9 @@ function builtInGovernanceMetamodel() {
1495
2006
  "state-machine": stateMachine,
1496
2007
  state,
1497
2008
  pseudostate,
1498
- event
2009
+ event,
2010
+ process: process_,
2011
+ step
1499
2012
  },
1500
2013
  relationTypes: {
1501
2014
  ...base.relationTypes,
@@ -1511,8 +2024,10 @@ function builtInGovernanceMetamodel() {
1511
2024
  "navigates-to": navigatesTo,
1512
2025
  transition,
1513
2026
  "lifecycle-of": lifecycleOf,
1514
- emits
1515
- }
2027
+ emits,
2028
+ "performed-by": performedBy
2029
+ },
2030
+ viewpoints: radicalViewpoints()
1516
2031
  };
1517
2032
  }
1518
2033
 
@@ -1525,7 +2040,9 @@ var CONTAINER_TYPES = /* @__PURE__ */ new Set([
1525
2040
  "group",
1526
2041
  "blueprint",
1527
2042
  "state-machine",
1528
- "state"
2043
+ "state",
2044
+ "process",
2045
+ "step"
1529
2046
  ]);
1530
2047
  function isContainerType(type) {
1531
2048
  return !!type && CONTAINER_TYPES.has(type);
@@ -1593,6 +2110,64 @@ var NODE_COLORS = pluckPerType((def) => def.color);
1593
2110
  var NODE_FG = pluckPerType((def) => def.fg);
1594
2111
  var TYPE_LABELS = pluckPerType((def) => def.label);
1595
2112
  var TYPE_ICON_PATHS = pluckPerType((def) => def.iconPath);
2113
+ function normalizeViewFolder(folder) {
2114
+ return (folder ?? "").split("/").map((part) => part.trim()).filter(Boolean).join("/");
2115
+ }
2116
+ var WIKI_DEPTH_MIN = 1;
2117
+ var WIKI_DEPTH_MAX = 5;
2118
+ function wikiDepthOf(view) {
2119
+ const d = view?.wikiDepth;
2120
+ if (typeof d !== "number" || !Number.isFinite(d)) return WIKI_DEPTH_MIN;
2121
+ return Math.min(WIKI_DEPTH_MAX, Math.max(WIKI_DEPTH_MIN, Math.floor(d)));
2122
+ }
2123
+ function viewShowsEveryNode(view) {
2124
+ return view.nodeIds.length === 0 && !view.empty;
2125
+ }
2126
+ function viewCanvasPositions(view, nodes, positions) {
2127
+ if (view.kind && view.kind !== "static") return {};
2128
+ if (viewShowsEveryNode(view)) return positions;
2129
+ const kept = {};
2130
+ const seen = /* @__PURE__ */ new Set();
2131
+ for (const id of view.nodeIds) {
2132
+ for (let cur = id; cur && nodes[cur] && !seen.has(cur); cur = nodes[cur].parentId) {
2133
+ seen.add(cur);
2134
+ if (cur in positions) kept[cur] = positions[cur];
2135
+ }
2136
+ }
2137
+ return kept;
2138
+ }
2139
+ function withCanvasPositions(views, nodes) {
2140
+ return views.map((view) => {
2141
+ const kept = viewCanvasPositions(view, nodes, view.positions ?? {});
2142
+ return Object.keys(kept).length === Object.keys(view.positions ?? {}).length ? view : { ...view, positions: kept };
2143
+ });
2144
+ }
2145
+ function removeFromViewList(view, removed) {
2146
+ if (view.nodeIds.length === 0) return;
2147
+ view.nodeIds = view.nodeIds.filter((nid) => !removed.has(nid));
2148
+ if (view.nodeIds.length === 0) view.empty = true;
2149
+ }
2150
+ function addToViewList(view, ids) {
2151
+ if (viewShowsEveryNode(view)) return;
2152
+ for (const id of ids) if (!view.nodeIds.includes(id)) view.nodeIds.push(id);
2153
+ if (view.nodeIds.length > 0) delete view.empty;
2154
+ }
2155
+
2156
+ // ../../packages/layout/src/elkSpacingBase.ts
2157
+ var ELK_ROOT_SPACING = {
2158
+ "elk.spacing.nodeNode": "60",
2159
+ "elk.layered.spacing.nodeNodeBetweenLayers": "80",
2160
+ "elk.spacing.edgeNode": "20",
2161
+ "elk.spacing.edgeEdge": "10",
2162
+ "elk.spacing.componentComponent": "80"
2163
+ };
2164
+ var ELK_CHILD_SPACING = {
2165
+ "elk.spacing.nodeNode": "30",
2166
+ "elk.layered.spacing.nodeNodeBetweenLayers": "50",
2167
+ "elk.spacing.edgeNode": "12",
2168
+ "elk.spacing.edgeEdge": "8",
2169
+ "elk.spacing.componentComponent": "40"
2170
+ };
1596
2171
 
1597
2172
  // ../../packages/layout/src/geometry.ts
1598
2173
  function effectiveWidth(n) {
@@ -1680,7 +2255,8 @@ function createBatchPlacer(getNodes, visible = () => void 0) {
1680
2255
  }
1681
2256
  function projectToVisibleGraph(nodes, relations) {
1682
2257
  const visible = {};
1683
- for (const n of Object.values(nodes)) {
2258
+ for (const id of Object.keys(nodes).sort()) {
2259
+ const n = nodes[id];
1684
2260
  if (!isVisible(n, nodes)) continue;
1685
2261
  if (isContainerType(n.type) && n.collapsed) {
1686
2262
  const w = COLLAPSED_WIDTH[n.type];
@@ -1695,42 +2271,288 @@ function projectToVisibleGraph(nodes, relations) {
1695
2271
  while (cur && !visible[cur.id]) cur = cur.parentId ? nodes[cur.parentId] : void 0;
1696
2272
  return cur?.id;
1697
2273
  };
2274
+ const isAncestor = (a, b) => {
2275
+ for (let cur = nodes[b]?.parentId; cur; cur = nodes[cur]?.parentId) if (cur === a) return true;
2276
+ return false;
2277
+ };
1698
2278
  const projected = {};
1699
- const seen = /* @__PURE__ */ new Set();
2279
+ const rolledUpLine = /* @__PURE__ */ new Map();
1700
2280
  for (const id of Object.keys(relations).sort()) {
1701
2281
  const r = relations[id];
1702
2282
  const s = visibleAncestor(r.sourceId);
1703
2283
  const t = visibleAncestor(r.targetId);
1704
2284
  if (!s || !t || s === t) continue;
2285
+ if (s === r.sourceId && t === r.targetId) {
2286
+ projected[id] = r;
2287
+ continue;
2288
+ }
2289
+ if (isAncestor(s, t) || isAncestor(t, s)) continue;
1705
2290
  const key = `${s}\0${t}`;
1706
- if (seen.has(key)) continue;
1707
- seen.add(key);
1708
- projected[id] = s === r.sourceId && t === r.targetId ? r : { ...r, sourceId: s, targetId: t };
2291
+ const kept = rolledUpLine.get(key);
2292
+ if (kept) {
2293
+ if (r.label) projected[kept] = { ...projected[kept], label: projected[kept].label ? `${projected[kept].label}
2294
+ ${r.label}` : r.label };
2295
+ continue;
2296
+ }
2297
+ rolledUpLine.set(key, id);
2298
+ projected[id] = { ...r, sourceId: s, targetId: t };
1709
2299
  }
1710
2300
  return { nodes: visible, relations: projected };
1711
2301
  }
1712
2302
 
1713
- // ../../packages/layout/src/elkSpacingBase.ts
1714
- var ELK_ROOT_SPACING = {
1715
- "elk.spacing.nodeNode": "60",
1716
- "elk.layered.spacing.nodeNodeBetweenLayers": "80",
2303
+ // ../../packages/layout/src/elkLayout.ts
2304
+ var elk = new ELK();
2305
+ var LAYERED_OPTIONS = {
2306
+ "elk.algorithm": "layered",
2307
+ "elk.direction": "DOWN",
2308
+ // SEPARATE_CHILDREN (default): each compound node is laid out independently.
2309
+ // Cross-boundary crossing minimisation is handled by our geometric post-process
2310
+ // (minimizeCrossings in crossingOpt.ts) — safer than INCLUDE_CHILDREN which
2311
+ // crashes ELK's internal scanline constraint calculator with compound graphs.
2312
+ // ── Connected-component placement ────────────────────────────────────────
2313
+ "elk.separateConnectedComponents": "true",
2314
+ // ── Crossing minimisation ─────────────────────────────────────────────────
2315
+ "elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
2316
+ "elk.layered.crossingMinimization.greedySwitch.type": "TWO_SIDED",
2317
+ "elk.layered.thoroughness": "50",
2318
+ "elk.layered.considerModelOrder.strategy": "NONE",
2319
+ // ── Node placement ────────────────────────────────────────────────────────
2320
+ "elk.layered.nodePlacement.strategy": "NETWORK_SIMPLEX",
2321
+ // ── Spacing ───────────────────────────────────────────────────────────────
2322
+ ...ELK_ROOT_SPACING,
2323
+ // ── Post-layout ──────────────────────────────────────────────────────────
2324
+ "elk.layered.unnecessaryBendpoints": "true",
2325
+ "elk.layered.compaction.postCompaction.strategy": "EDGE_LENGTH",
2326
+ "elk.padding": "[top=120, right=30, bottom=30, left=30]"
2327
+ };
2328
+ var CHILD_OPTIONS = {
2329
+ "elk.algorithm": "layered",
2330
+ "elk.direction": "RIGHT",
2331
+ "elk.separateConnectedComponents": "true",
2332
+ "elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
2333
+ "elk.layered.crossingMinimization.greedySwitch.type": "TWO_SIDED",
2334
+ "elk.layered.thoroughness": "50",
2335
+ "elk.layered.considerModelOrder.strategy": "NONE",
2336
+ "elk.layered.nodePlacement.strategy": "NETWORK_SIMPLEX",
2337
+ ...ELK_CHILD_SPACING,
2338
+ "elk.layered.unnecessaryBendpoints": "true",
2339
+ "elk.layered.compaction.postCompaction.strategy": "EDGE_LENGTH",
2340
+ "elk.padding": "[top=110, right=20, bottom=20, left=20]"
2341
+ };
2342
+ function ancestorChain(nodeId, nodes) {
2343
+ const chain = [nodeId];
2344
+ let cur = nodes[nodeId];
2345
+ while (cur?.parentId) {
2346
+ chain.push(cur.parentId);
2347
+ cur = nodes[cur.parentId];
2348
+ }
2349
+ return chain;
2350
+ }
2351
+ function lcaContainerId(srcId, tgtId, nodes) {
2352
+ if (srcId === tgtId) return nodes[srcId]?.parentId;
2353
+ const srcSet = new Set(ancestorChain(srcId, nodes));
2354
+ for (const id of ancestorChain(tgtId, nodes)) {
2355
+ if (srcSet.has(id) && id !== srcId && id !== tgtId) return id;
2356
+ }
2357
+ return void 0;
2358
+ }
2359
+ function buildElkNode(n, allNodes, elkNodeMap) {
2360
+ const isCollapsed = n.collapsed && isContainerType(n.type);
2361
+ const width = isCollapsed ? COLLAPSED_WIDTH[n.type] : n.width;
2362
+ const height = isCollapsed ? COLLAPSED_HEIGHT[n.type] : n.height;
2363
+ const childC4 = isCollapsed ? [] : Object.values(allNodes).filter((c) => c.parentId === n.id);
2364
+ const children = childC4.map((c) => buildElkNode(c, allNodes, elkNodeMap));
2365
+ const elkNode = {
2366
+ id: n.id,
2367
+ width,
2368
+ height,
2369
+ layoutOptions: children.length > 0 ? CHILD_OPTIONS : void 0,
2370
+ children,
2371
+ edges: []
2372
+ };
2373
+ elkNodeMap[n.id] = elkNode;
2374
+ return elkNode;
2375
+ }
2376
+ function parseElkResult(node, result) {
2377
+ if (node.id !== "root" && node.x != null && node.y != null) {
2378
+ result[node.id] = { x: node.x, y: node.y, width: node.width, height: node.height };
2379
+ }
2380
+ for (const child of node.children ?? []) {
2381
+ parseElkResult(child, result);
2382
+ }
2383
+ }
2384
+ var PACKED_ASPECT = 1.6;
2385
+ var PACK_MIN_CHILDREN = 8;
2386
+ var PACK_MAX_LINKS_PER_CHILD = 1;
2387
+ var PACKED_OPTIONS = {
2388
+ // Box layout, rows filled in the given order (rectpacking moved elements
2389
+ // between rows to fill them, which split the linked ones apart).
2390
+ "elk.algorithm": "box",
2391
+ "elk.box.packingMode": "SIMPLE",
2392
+ // One block in this order: split into connected components, ELK placed
2393
+ // the components and the lone elements apart, each sorted its own way.
2394
+ "elk.separateConnectedComponents": "false",
2395
+ "elk.spacing.nodeNode": "40",
2396
+ "elk.padding": "[top=110, right=20, bottom=20, left=20]"
2397
+ };
2398
+ function childLinks(group, nodes, relations) {
2399
+ const childIds = new Set((group.children ?? []).map((c) => c.id));
2400
+ const childOf = (id) => {
2401
+ for (let cur = id; cur && nodes[cur]; cur = nodes[cur].parentId) if (childIds.has(cur)) return cur;
2402
+ return void 0;
2403
+ };
2404
+ const links = /* @__PURE__ */ new Map();
2405
+ for (const r of Object.values(relations)) {
2406
+ const a = childOf(r.sourceId);
2407
+ const b = childOf(r.targetId);
2408
+ if (!a || !b || a === b) continue;
2409
+ links.set(a, [...links.get(a) ?? [], b]);
2410
+ links.set(b, [...links.get(b) ?? [], a]);
2411
+ }
2412
+ return links;
2413
+ }
2414
+ function linkedOrder(children, links, nodes) {
2415
+ const name = (id) => (nodes[id]?.label ?? "").toLowerCase();
2416
+ const byName = (a, b) => name(a).localeCompare(name(b)) || (a < b ? -1 : a > b ? 1 : 0);
2417
+ children = [...children].sort((a, b) => byName(a.id, b.id));
2418
+ for (const list of links.values()) list.sort(byName);
2419
+ const byId = new Map(children.map((c) => [c.id, c]));
2420
+ const seen = /* @__PURE__ */ new Set();
2421
+ const order = [];
2422
+ for (const start of children) {
2423
+ if (seen.has(start.id)) continue;
2424
+ const queue = [start.id];
2425
+ seen.add(start.id);
2426
+ while (queue.length) {
2427
+ const id = queue.shift();
2428
+ order.push(byId.get(id));
2429
+ for (const next of links.get(id) ?? []) if (!seen.has(next)) {
2430
+ seen.add(next);
2431
+ queue.push(next);
2432
+ }
2433
+ }
2434
+ }
2435
+ return order;
2436
+ }
2437
+ async function applyElkLayout(inputNodes, inputRelations, opts) {
2438
+ const { nodes: c4Nodes, relations: c4Relations } = projectToVisibleGraph(inputNodes, inputRelations);
2439
+ const elkNodeMap = {};
2440
+ const childOpts = opts?.childOptions ?? CHILD_OPTIONS;
2441
+ const buildWith = (n) => {
2442
+ const built = buildElkNode(n, c4Nodes, elkNodeMap);
2443
+ const apply = (node) => {
2444
+ if (node.children && node.children.length > 0) {
2445
+ node.layoutOptions = childOpts;
2446
+ if (opts?.packSparseGroups && node.children.length >= PACK_MIN_CHILDREN) {
2447
+ const links = childLinks(node, c4Nodes, c4Relations);
2448
+ let count = 0;
2449
+ for (const list of links.values()) count += list.length;
2450
+ if (count / 2 <= node.children.length * PACK_MAX_LINKS_PER_CHILD) {
2451
+ const w = node.children.reduce((sum, c) => sum + (c.width ?? 0), 0);
2452
+ const h = node.children.reduce((sum, c) => sum + (c.height ?? 0), 0);
2453
+ node.layoutOptions = { ...PACKED_OPTIONS, "elk.aspectRatio": String(PACKED_ASPECT * (h > 0 ? w / h : 1)) };
2454
+ node.children = linkedOrder(node.children, links, c4Nodes);
2455
+ const count2 = node.children.length;
2456
+ node.children.forEach((c, i) => {
2457
+ c.layoutOptions = { ...c.layoutOptions, "elk.priority": String(count2 - i) };
2458
+ });
2459
+ }
2460
+ }
2461
+ for (const c of node.children) apply(c);
2462
+ }
2463
+ };
2464
+ apply(built);
2465
+ return built;
2466
+ };
2467
+ const rootChildren = Object.values(c4Nodes).filter((n) => !n.parentId).map(buildWith);
2468
+ const root = {
2469
+ id: "root",
2470
+ layoutOptions: opts?.rootOptions ?? LAYERED_OPTIONS,
2471
+ children: rootChildren,
2472
+ edges: []
2473
+ };
2474
+ elkNodeMap["root"] = root;
2475
+ for (const rel of Object.values(c4Relations)) {
2476
+ if (!c4Nodes[rel.sourceId] || !c4Nodes[rel.targetId]) continue;
2477
+ const lca = lcaContainerId(rel.sourceId, rel.targetId, c4Nodes);
2478
+ const container = (lca ? elkNodeMap[lca] : root) ?? root;
2479
+ const edge = { id: rel.id, sources: [rel.sourceId], targets: [rel.targetId] };
2480
+ if (!container.edges) container.edges = [];
2481
+ container.edges.push(edge);
2482
+ }
2483
+ try {
2484
+ const result = await elk.layout(root);
2485
+ const positions = {};
2486
+ parseElkResult(result, positions);
2487
+ return positions;
2488
+ } catch (err) {
2489
+ console.error("[ELK] Layout error:", err);
2490
+ return {};
2491
+ }
2492
+ }
2493
+ var TREE_ROOT_OPTIONS = {
2494
+ "elk.algorithm": "layered",
2495
+ "elk.direction": "DOWN",
2496
+ "elk.separateConnectedComponents": "true",
2497
+ "elk.spacing.componentComponent": "60",
2498
+ "elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
2499
+ "elk.layered.crossingMinimization.greedySwitch.type": "TWO_SIDED",
2500
+ "elk.layered.thoroughness": "50",
2501
+ // Honour input order so siblings stay close to their declared grouping —
2502
+ // the dominant cue users associate with "tree" layouts.
2503
+ "elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
2504
+ "elk.layered.nodePlacement.strategy": "BRANDES_KOEPF",
2505
+ "elk.layered.nodePlacement.bk.fixedAlignment": "BALANCED",
2506
+ "elk.spacing.nodeNode": "50",
2507
+ "elk.layered.spacing.nodeNodeBetweenLayers": "70",
1717
2508
  "elk.spacing.edgeNode": "20",
1718
2509
  "elk.spacing.edgeEdge": "10",
1719
- "elk.spacing.componentComponent": "80"
2510
+ "elk.layered.compaction.postCompaction.strategy": "LEFT",
2511
+ "elk.layered.unnecessaryBendpoints": "true",
2512
+ "elk.padding": "[top=120, right=30, bottom=30, left=30]"
1720
2513
  };
1721
- var ELK_CHILD_SPACING = {
1722
- "elk.spacing.nodeNode": "30",
1723
- "elk.layered.spacing.nodeNodeBetweenLayers": "50",
2514
+ var TREE_CHILD_OPTIONS = {
2515
+ // Children of every compound container also flow top-down — this is what
2516
+ // produces the visible "nested tree" look (vs. the default ELK config
2517
+ // where compound children flow left-to-right).
2518
+ "elk.algorithm": "layered",
2519
+ "elk.direction": "DOWN",
2520
+ "elk.separateConnectedComponents": "true",
2521
+ "elk.spacing.componentComponent": "30",
2522
+ "elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
2523
+ "elk.layered.crossingMinimization.greedySwitch.type": "TWO_SIDED",
2524
+ "elk.layered.thoroughness": "50",
2525
+ "elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
2526
+ "elk.layered.nodePlacement.strategy": "BRANDES_KOEPF",
2527
+ "elk.layered.nodePlacement.bk.fixedAlignment": "BALANCED",
2528
+ "elk.spacing.nodeNode": "28",
2529
+ "elk.layered.spacing.nodeNodeBetweenLayers": "40",
1724
2530
  "elk.spacing.edgeNode": "12",
1725
2531
  "elk.spacing.edgeEdge": "8",
1726
- "elk.spacing.componentComponent": "40"
2532
+ "elk.layered.compaction.postCompaction.strategy": "LEFT",
2533
+ "elk.layered.unnecessaryBendpoints": "true",
2534
+ "elk.padding": "[top=110, right=20, bottom=20, left=20]"
1727
2535
  };
2536
+ async function applyTreeLayout(c4Nodes, c4Relations) {
2537
+ return applyElkLayout(c4Nodes, c4Relations, {
2538
+ rootOptions: TREE_ROOT_OPTIONS,
2539
+ childOptions: TREE_CHILD_OPTIONS
2540
+ });
2541
+ }
1728
2542
 
1729
2543
  export {
2544
+ __commonJS,
2545
+ __toESM,
1730
2546
  isRelationAllowed,
1731
2547
  inferRelationType,
1732
2548
  isParentAllowed,
2549
+ GROUP_TYPE,
2550
+ placeOf,
2551
+ hasPlaceUnder,
2552
+ isPlacementAllowed,
1733
2553
  canAddMoreOfType,
2554
+ isReservedPropertyKey,
2555
+ propertyKeyProblem,
1734
2556
  refValue,
1735
2557
  refProblem,
1736
2558
  transitionLabel,
@@ -1748,6 +2570,13 @@ export {
1748
2570
  NODE_SIZES,
1749
2571
  COLLAPSED_HEIGHT,
1750
2572
  COLLAPSED_WIDTH,
2573
+ normalizeViewFolder,
2574
+ wikiDepthOf,
2575
+ viewShowsEveryNode,
2576
+ viewCanvasPositions,
2577
+ withCanvasPositions,
2578
+ removeFromViewList,
2579
+ addToViewList,
1751
2580
  effectiveWidth,
1752
2581
  effectiveHeight,
1753
2582
  drawnSize,
@@ -1759,5 +2588,7 @@ export {
1759
2588
  createBatchPlacer,
1760
2589
  projectToVisibleGraph,
1761
2590
  ELK_ROOT_SPACING,
1762
- ELK_CHILD_SPACING
2591
+ ELK_CHILD_SPACING,
2592
+ applyElkLayout,
2593
+ applyTreeLayout
1763
2594
  };