Skip to content

Build your personal knowledge base with Trilium Notes

feat(mermaid): add sample diagrams for event modeling, use case & agentflow

Elian Doran44c6e8518afd
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 10c3d5542a..cd3aec1927 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -4145,7 +4145,10 @@
"sample_wardley": "Wardley Map",
"sample_cynefin": "Cynefin",
"sample_swimlane": "Swimlane",
- "sample_railroad": "Railroad"
+ "sample_railroad": "Railroad",
+ "sample_event_modeling": "Event Modeling",
+ "sample_use_case": "Use Case",
+ "sample_agentflow": "Agentflow"
},
"mind-map": {
"addChild": "Add child",
diff --git a/apps/client/src/widgets/type_widgets/mermaid/sample_diagrams.ts b/apps/client/src/widgets/type_widgets/mermaid/sample_diagrams.ts
index f85e01900c..d6f3b7f368 100644
--- a/apps/client/src/widgets/type_widgets/mermaid/sample_diagrams.ts
+++ b/apps/client/src/widgets/type_widgets/mermaid/sample_diagrams.ts
@@ -625,6 +625,51 @@ factor = choice(
) ;
number = oneOrMore(nonterminal("digit")) ;
digit = choice(terminal("0"), terminal("1"), terminal("2"), terminal("3"), terminal("4"), terminal("5"), terminal("6"), terminal("7"), terminal("8"), terminal("9")) ;
+`
+ },
+ {
+ name: t("mermaid.sample_event_modeling"),
+ content: `\
+eventmodeling
+
+tf 01 ui ShopUI
+tf 02 cmd AddItemToCart
+tf 03 evt ItemAdded
+tf 04 rmo CartView ->> 03
+tf 05 ui CheckoutUI
+tf 06 cmd PlaceOrder
+tf 07 evt OrderPlaced
+tf 08 rmo OrderStatus ->> 07
+`
+ },
+ {
+ name: t("mermaid.sample_use_case"),
+ content: `\
+usecase-beta
+actor User("User")
+actor Admin("Administrator")
+Login("Log in")
+ViewProfile("View profile")
+ManageUsers("Manage users")
+ViewReports("View reports")
+User --> Login
+User --> ViewProfile
+Admin --> ManageUsers
+Admin --> ViewReports
+`
+ },
+ {
+ name: t("mermaid.sample_agentflow"),
+ content: `\
+agentflow-beta TB
+ flow reviewer["Review Agent"]
+ changes["Gather changes"]@{ shape: input }
+ analyse["Analyse diff"]@{ shape: task }
+ lint["run_linter"]@{ shape: tool }
+ ok["Clean?"]@{ shape: decision }
+
+ changes --> analyse --> lint --> ok
+ end
`
}
];