diff --git a/README.md b/README.md index 15f6b1f..922d5ee 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,150 @@ # chronos -A Typst package to draw sequence diagrams with CeTZ \ No newline at end of file +A Typst package to draw sequence diagrams with CeTZ + +--- + +This package lets you render sequence diagrams directly in Typst. The following boilerplate code creates an empty sequence diagram with two participants: + +
Typst | +Result | +
+ +```typst +#import "@preview/chronos:0.1.0" +#chronos.diagram({ + import chronos: * + _par("Alice") + _par("Bob") +}) +``` + + | ++ |
Typst | +Result | +
+ +```typst +#chronos.diagram({ + import chronos: * + _par("Alice") + _par("Bob") + + _seq("Alice", "Bob", comment: "Hello") + _seq("Bob", "Bob", comment: "Think") + _seq("Bob", "Alice", comment: "Hi") +}) +``` + + | ++ |
Typst | +Result | +
+ +```typst +#chronos.diagram({ + import chronos: * + _par("A", display-name: "Alice") + _par("B", display-name: "Bob") + _par("C", display-name: "Charlie") + _par("D", display-name: "Derek") + + _seq("A", "B", comment: "hello", enable-dst: true) + _seq("B", "B", comment: "self call", enable-dst: true) + _seq("C", "B", comment: "hello from thread 2", enable-dst: true, lifeline-style: (fill: rgb("#005500"))) + _seq("B", "D", comment: "create", create-dst: true) + _seq("B", "C", comment: "done in thread 2", disable-src: true, dashed: true) + _seq("B", "B", comment: "rc", disable-src: true, dashed: true) + _seq("B", "D", comment: "delete", destroy-dst: true) + _seq("B", "A", comment: "success", disable-src: true, dashed: true) +}) +``` + + | ++ |
Example | +Features | +
+
+`example1` ([PDF](./gallery/example1.pdf)|[Typst](./gallery/example1.typ)) + + |
+Simple cases, color sequences, groups, separators, gaps, self-sequences | +
+
+`example2` ([PDF](./gallery/example2.pdf)|[Typst](./gallery/example2.typ)) + + |
+Lifelines, found/lost messages, synchronized sequences, slanted sequences | +
+
+`example3` ([PDF](./gallery/example3.pdf)|[Typst](./gallery/example3.typ)) + + |
+Participant shapes, sequence tips, hidden partipicant ends | +
+
+`notes` ([PDF](./gallery/notes.pdf)|[Typst](./gallery/notes.typ)) + + |
+Notes (duh), deferred participant creation | +