27 Commits

Author SHA1 Message Date
534caf24a7 removed CI cargo cache
All checks were successful
CI / tests (push) Successful in 17s
2025-07-15 11:54:41 +02:00
2e29a79f4c renamed CI cache step
Some checks failed
CI / tests (push) Has been cancelled
2025-07-15 00:22:17 +02:00
4ae06a5f03 changed CI cache action
All checks were successful
CI / tests (push) Successful in 24s
2025-07-15 00:20:20 +02:00
91ff0efb06 changed CI upload artifact action
All checks were successful
CI / tests (push) Successful in 3m5s
2025-07-14 22:53:03 +02:00
bdeabb39f9 changed CI container for rust
Some checks failed
CI / tests (push) Failing after 4m10s
2025-07-14 22:43:18 +02:00
7ad39decb6 Merge pull request 'Add tests' (#12) from feat/tests-1 into dev
Some checks failed
CI / tests (push) Failing after 39s
Reviewed-on: #12
2025-07-14 20:13:21 +00:00
b8b775c3ce added CI workflow 2025-07-14 22:11:11 +02:00
2a35b86f6e added group tests 2025-07-14 19:11:19 +02:00
2a46612bfb added note tests 2025-07-14 19:06:30 +02:00
964d708280 added sequence tests 2025-07-14 18:48:48 +02:00
e1a5b0b431 added participant shape test 2025-07-14 18:33:08 +02:00
cdfdd96966 set up tytanic with basic test 2025-07-14 18:04:26 +02:00
5e70e5179f Merge pull request 'Add parameter to style participant line' (#11) from feat/10-participant-line-styling into dev
Reviewed-on: #11
2025-07-09 20:47:50 +00:00
000813ff3b bumped version to 0.2.2 2025-07-09 22:41:30 +02:00
f94c6f25a2 added documentation for line-stroke 2025-07-09 22:39:50 +02:00
d1a44d0b0f added line-stroke participant param 2025-07-09 22:35:37 +02:00
1b8c40d70d added uncommitted file
Forgot to add cetz.typ in 788c8999 (oops)
2025-07-09 22:23:54 +02:00
b9c19ac730 fixed link in manual 2025-07-09 21:55:32 +02:00
c46b345771 updated version in README 2025-03-12 14:17:32 +01:00
060e37e38e switched to justfile 2025-03-12 14:14:27 +01:00
788c8999b1 bumped to Typst 0.13.1 + cetz 0.3.4 2025-03-12 14:14:10 +01:00
3eadf63db3 Merge pull request 'Fix _ret in group' (#8) from fix/issue-6-alt-groups into dev
Reviewed-on: #8
2025-03-10 17:58:06 +00:00
e57e617bb9 fixed groups with _ret 2025-03-10 17:54:01 +00:00
dfb980e366 Merge pull request 'Adapt to typst v0.13.0' (#7) from johannesacco/chronos:main into dev
Reviewed-on: #7
2025-03-10 16:41:51 +00:00
3beaad03d4 Bump version to 0.2.1 2025-03-10 17:22:49 +01:00
5cb8f50f2a Update to cetz:0.3.3
This fixes a number of warnings introduced in typst v0.13.0.

Also increase typst version to v0.13.0 as that is what cetz:0.3.3
requires.
2025-03-10 17:22:42 +01:00
e8d737ff00 updated manual 2024-11-09 17:57:53 +01:00
66 changed files with 617 additions and 113 deletions

31
.gitea/workflows/ci.yaml Normal file
View File

@ -0,0 +1,31 @@
name: CI
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
jobs:
tests:
runs-on: ubuntu-latest
container: catthehacker/ubuntu:rust-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tytanic
run: cargo binstall tytanic@0.2.2
- name: Run test suite
run: tt run
- name: Archive artifacts
uses: https://gitea.com/actions/gitea-upload-artifact@v4
if: always()
with:
name: artifacts
path: |
tests/**/diff/*.png
tests/**/out/*.png
tests/**/ref/*.png
retention-days: 5

View File

@ -15,7 +15,7 @@ This package lets you render sequence diagrams directly in Typst. The following
<td>
```typst
#import "@preview/chronos:0.2.0"
#import "@preview/chronos:0.2.2"
#chronos.diagram({
import chronos: *
_par("Alice")

View File

@ -5,7 +5,7 @@
chronos: chronos
)
#let example(src, show-src: true, vertical: false, fill: true, wrap: true) = {
#let example(src, show-src: true, vertical: false, fill: false, wrap: true) = {
src = src.text
let full-src = example-preamble + src
let body = eval(full-src, scope: example-scope)
@ -16,15 +16,15 @@
box(
stroke: black + 1pt,
radius: .5em,
fill: if fill {color.white.darken(5%)} else {none},
fill: if fill {color.white.darken(2%)} else {none},
if show-src {
let src-block = align(left, raw(src, lang: "typc"))
let src-block = raw(src, block: true, lang: "typc")
table(
columns: if vertical {1} else {2},
inset: 1em,
inset: 5pt,
align: horizon + center,
stroke: none,
img,
table.cell(inset: 1em, img),
if vertical {table.hline()} else {table.vline()}, src-block
)
} else {

View File

@ -1,8 +1,23 @@
#import "example.typ": example
#let seq-return = example(```
_seq(
"Bob", "Alice",
comment: [hello],
enable-dst: true
)
_seq(
"Alice", "Alice",
comment: [some action]
)
_ret(comment: [bye])
```)
#let seq-comm-align = example(```
_par("p1", display-name: "Start participant")
_par("p2", display-name: "End participant")
_par("p1",
display-name: "Start participant")
_par("p2",
display-name: "End participant")
let alignments = (
"start", "end",
"left", "right",
@ -90,15 +105,15 @@ _par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_loop("default loop", {
_seq("a", "b", comment: "Are you here ?")
_seq("a", "b", comment: "Are you here?")
})
_gap()
_loop("min loop", min: 1, {
_seq("a", "b", comment: "Are you here ?")
_seq("a", "b", comment: "Are you here?")
})
_gap()
_loop("min-max loop", min: 1, max: 5, {
_seq("a", "b", comment: "Are you still here ?")
_seq("a", "b", comment: "Are you still here?")
})
```)
@ -121,15 +136,58 @@ _sync({
})
```)
#let gaps-seps = example(```
_par("alice", display-name: "Alice")
_par("bob", display-name: "Bob")
#let gaps = example(```
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_seq("alice", "bob", comment: "Hello")
_gap(size: 10)
_seq("bob", "alice", comment: "Hi")
_sep("Another day")
_seq("alice", "bob", comment: "Hello again")
_seq("a", "b", comment: [message 1])
_seq("b", "a", comment: [ok], dashed: true)
_gap()
_seq("a", "b", comment: [message 2])
_seq("b", "a", comment: [ok], dashed: true)
_gap(size: 40)
_seq("a", "b", comment: [message 3])
_seq("b", "a", comment: [ok], dashed: true)
```)
#let seps = example(```
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_sep[Initialization]
_seq("a", "b", comment: [Request 1])
_seq(
"b", "a",
comment: [Response 1],
dashed: true
)
_sep[Repetition]
_seq("a", "b", comment: [Request 2])
_seq(
"b", "a",
comment: [Response 2],
dashed: true
)
```)
#let delays = example(```
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_seq("a", "b", comment: [Auth Request])
_delay()
_seq(
"b", "a",
comment: [Auth Response],
dashed: true
)
_delay(name: [5 minutes later])
_seq(
"b", "a",
comment: [Good Bye !],
dashed: true
)
```)
#let notes-shapes = example(```

View File

@ -1,8 +1,15 @@
/// Creates a gap before the next element
/// - size (int): Size of the gap
#let _gap(size: 20) = {}
/// Creates a separator before the next element
/// #examples.gaps-seps
/// #examples.seps
/// - name (content): Name to display in the middle of the separator
#let _sep(name) = {}
#let _sep(name) = {}
/// Creates a delay before the next element
/// #examples.delays
/// - name (content, none): Name to display in the middle of the delay area
/// - size (int): Size of the delay
#let _delay(name: none, size: 30) = {}
/// Creates a gap before the next element
/// #examples.gaps
/// - size (int): Size of the gap
#let _gap(size: 20) = {}

View File

@ -34,6 +34,7 @@
/// - invisible (bool): If set to true, the participant will not be shown
/// - shape (str): The shape of the participant. Possible values in @@SHAPES
/// - color (color): The participant's color
/// - line-stroke (stroke): The participant's line style (defaults to a light gray dashed line)
/// - custom-image (none, image): If shape is 'custom', sets the custom image to display
/// - show-bottom (bool): Whether to display the bottom shape
/// - show-top (bool): Whether to display the top shape
@ -45,6 +46,11 @@
invisible: false,
shape: "participant",
color: rgb("#E2E2F0"),
line-stroke: (
dash: "dashed",
paint: gray.darken(40%),
thickness: .5pt
),
custom-image: none,
show-bottom: true,
show-top: true,

View File

@ -42,6 +42,17 @@
slant: none
) = {}
/// Creates a return sequence
/// #examples.seq-return
/// - comment (none, content): Optional comment to display along the arrow
#let _ret(comment: none) = {}
/// Accepted values for `comment-align` argument of @@_seq()
/// #examples.seq-comm-align
#let comment-align = (
"start", "end", "left", "center", "right"
)
/// Accepted values for `event` argument of @@_evt()
///
/// `EVENTS = ("create", "destroy", "enable", "disable")`
@ -51,10 +62,4 @@
/// #examples.seq-tips
#let tips = (
"", ">", ">>", "\\", "\\\\", "/", "//", "x", "o",
)
/// Accepted values for `comment-align` argument of @@_seq()
/// #examples.seq-comm-align
#let comment-align = (
"start", "end", "left", "center", "right"
)

View File

@ -1,27 +0,0 @@
#!/bin/bash
echo
echo "Generating gallery PDFs"
set -- ./gallery/*.typ
cnt="$#"
i=1
for f
do
f2="${f/typ/pdf}"
echo "($i/$cnt) $f -> $f2"
typst c --root ./ "$f" "$f2"
i=$((i+1))
done
set -- ./gallery/readme/*.typ
cnt="$#"
i=1
for f
do
f2="${f/typ/png}"
echo "($i/$cnt) $f -> $f2"
typst c --root ./ "$f" "$f2"
i=$((i+1))
done

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

18
justfile Normal file
View File

@ -0,0 +1,18 @@
# Local Variables:
# mode: makefile
# End:
gallery_dir := "./gallery"
set shell := ["bash", "-uc"]
manual:
typst c manual.typ manual.pdf
gallery:
for f in "{{gallery_dir}}"/*.typ; do typst c --root . "$f" "${f%typ}pdf"; done
for f in "{{gallery_dir}}"/readme/*.typ; do typst c --root . "$f" "${f%typ}png"; done
test *filter:
tt run {{filter}}
update-test *filter:
tt update {{filter}}

Binary file not shown.

View File

@ -1,4 +1,6 @@
#import "@preview/tidy:0.3.0"
#import "@preview/tidy:0.4.2"
#import "@preview/codly:1.2.0": codly-init, codly
#import "@preview/codly-languages:0.1.8": codly-languages
#import "src/lib.typ" as chronos
#import "src/participant.typ" as mod-par
#import "docs/examples.typ"
@ -6,25 +8,41 @@
#let TYPST = image("gallery/typst.png", width: 1.5cm, height: 1.5cm, fit: "contain")
#let doc-ref(target, full: false, var: false) = {
let (module, func) = target.split(".")
let label-name = module + func
let display-name = func
if full {
display-name = target
}
if not var {
label-name += "()"
display-name += "()"
}
link(label(label-name))[#display-name]
}
#show: codly-init
#codly(
languages: codly-languages
)
#set text(font: "Source Sans 3")
#set heading(numbering: (..num) => if num.pos().len() < 4 {
numbering("1.1", ..num)
})
#align(center)[
#v(2cm)
#text(size: 2em)[*Chronos*]
_v#chronos.version;_
#v(1cm)
#chronos.diagram({
import chronos: *
_par("u", display-name: [User], shape: "actor")
_par("wa", display-name: [Web App])
_par("tu", display-name: [Typst Universe], shape: "database")
_seq("u", "wa", comment: [Compile document], enable-dst: true)
_seq("wa", "tu", comment: [Fetch Chronos])
_seq("tu", "wa", dashed: true, slant: 10)
_seq("wa", "wa", comment: [Render])
_ret(comment: [Nice sequence diagram])
})
]
#pagebreak()
#{
outline(indent: true, depth: 3)
outline(indent: auto, depth: 3)
}
#show link: set text(fill: blue)
@ -40,18 +58,20 @@ This package lets you create nice sequence diagrams using the CeTZ package.
= Usage
#let import-stmt = "#import \"@preview/chronos:" + str(chronos.version) + "\""
Simply import #link("https://typst.app/universe/package/chronos/")[chronos] and call the `diagram` function:
#pad(left: 1em)[```typ
#import "@preview/chronos:0.1.0"
#raw(block:true, lang: "typ", ```typ
$import
#chronos.diagram({
import chronos: *
...
})
```]
```.text.replace("$import", import-stmt))
= Examples
You can find the following examples and more in the #link("https://git.kb28.ch/HEL/circuiteria/src/branch/main/gallery")[gallery] directory
You can find the following examples and more in the #link("https://git.kb28.ch/HEL/chronos/src/branch/main/gallery")[gallery] directory
== Some groups and sequences
@ -121,7 +141,11 @@ chronos.diagram({
== Custom images
#example(```
let load-img(path) = image(path, width: 1.5cm, height: 1.5cm, fit:"contain")
let load-img(path) = image(
path,
width: 1.5cm, height: 1.5cm,
fit:"contain"
)
let TYPST = load-img("../gallery/typst.png")
let FERRIS = load-img("../gallery/ferris.png")
let ME = load-img("../gallery/me.jpg")
@ -148,11 +172,11 @@ chronos.diagram({
read("docs/participants.typ"),
name: "Participants",
require-all-parameters: true,
old-syntax: true,
scope: (
chronos: chronos,
mod-par: mod-par,
TYPST: TYPST,
doc-ref: doc-ref
TYPST: TYPST
)
)
#tidy.show-module(par-docs, show-outline: false, sort-functions: none)
@ -163,9 +187,9 @@ chronos.diagram({
read("docs/sequences.typ"),
name: "Sequences",
require-all-parameters: true,
old-syntax: true,
scope: (
chronos: chronos,
doc-ref: doc-ref,
examples: examples
)
)
@ -177,9 +201,9 @@ chronos.diagram({
read("docs/groups.typ"),
name: "Groups",
require-all-parameters: true,
old-syntax: true,
scope: (
chronos: chronos,
doc-ref: doc-ref,
examples: examples
)
)
@ -191,13 +215,13 @@ chronos.diagram({
read("docs/gaps_seps.typ"),
name: "Gaps and separators",
require-all-parameters: true,
old-syntax: true,
scope: (
chronos: chronos,
doc-ref: doc-ref,
examples: examples
)
)
#tidy.show-module(gap-sep-docs, show-outline: false)
#tidy.show-module(gap-sep-docs, show-outline: false, sort-functions: none)
#pagebreak(weak: true)
@ -205,9 +229,9 @@ chronos.diagram({
read("docs/notes.typ"),
name: "Notes",
require-all-parameters: true,
old-syntax: true,
scope: (
chronos: chronos,
doc-ref: doc-ref,
examples: examples
)
)

1
src/cetz.typ Normal file
View File

@ -0,0 +1 @@
#import "@preview/cetz:0.3.4": *

View File

@ -46,7 +46,6 @@
while i < elmts.len() {
let elmt = elmts.at(i)
if elmt.type == "grp" {
let grp-elmts = elmt.elmts
elmt.elmts = elmt.elmts.map(e => {
if e.type == "seq" {
if e.p1 == "?" {
@ -60,12 +59,17 @@
elmts.at(i) = elmt
elmts = (
elmts.slice(0, i + 1) +
grp-elmts +
elmt.elmts +
((
type: "grp-end"
type: "grp-end",
start-i: i
),) +
elmts.slice(i+1)
)
} else if elmt.type == "grp-end" {
// Put back elements in group because they might have changed
elmts.at(elmt.start-i).elmts = elmts.slice(elmt.start-i + 1, i)
} else if elmt.type == "seq" {
if elmt.enable-dst {
activation-history.push(elmt)

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw
#import "/src/cetz.typ": draw
#import "consts.typ": *
#let _grp(name, desc: none, type: "default", elmts) = {

View File

@ -1,4 +1,4 @@
#let version = version(0, 2, 0)
#let version = version(0, 2, 2)
#import "diagram.typ": diagram, from-plantuml, _gap, _evt, _col
#import "sequence.typ": _seq, _ret

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw
#import "/src/cetz.typ": draw
#import "consts.typ": *
#let SIDES = (

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw
#import "/src/cetz.typ": draw
#import "consts.typ": *
#let PAR-SPECIALS = "?[]"
@ -22,6 +22,11 @@
invisible: false,
shape: "participant",
color: DEFAULT-COLOR,
line-stroke: (
dash: "dashed",
paint: gray.darken(40%),
thickness: .5pt
),
custom-image: none,
show-bottom: true,
show-top: true,
@ -37,6 +42,7 @@
invisible: invisible,
shape: shape,
color: color,
line-stroke: line-stroke,
custom-image: custom-image,
show-bottom: show-bottom,
show-top: show-top

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": canvas, draw
#import "/src/cetz.typ": canvas, draw
#import "utils.typ": get-participants-i, get-style, normalize-units
#import "group.typ"
#import "participant.typ"
@ -432,11 +432,7 @@
draw.line(
(x, last-y),
(x, line.at(1)),
stroke: (
dash: "dashed",
paint: gray.darken(40%),
thickness: .5pt
)
stroke: p.line-stroke
)
}
lines.push(line)
@ -462,11 +458,7 @@
draw.line(
(x, last-y),
(x, line.at(1)),
stroke: (
dash: "dashed",
paint: gray.darken(40%),
thickness: .5pt
)
stroke: p.line-stroke
)
last-y = line.at(1)
} else if event == "delay-end" {
@ -486,11 +478,7 @@
draw.line(
(x, last-y),
(x, y),
stroke: (
dash: "dashed",
paint: gray.darken(40%),
thickness: .5pt
)
stroke: p.line-stroke
)
// Draw lifeline rectangles (reverse for bottom to top)

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw
#import "/src/cetz.typ": draw
#import "consts.typ": *
#let _sep(name) = {

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw, vector
#import "/src/cetz.typ": draw, vector
#import "consts.typ": *
#import "participant.typ"
#import "note.typ"

View File

@ -36,6 +36,9 @@
max-i = calc.max(max-i, i1)
}
}
if max-i < min-i {
(min-i, max-i) = (max-i, min-i)
}
return (min-i, max-i)
}

4
tests/empty/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

BIN
tests/empty/ref/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

6
tests/empty/test.typ Normal file
View File

@ -0,0 +1,6 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#diagram({})
#diagram(())

4
tests/group/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

BIN
tests/group/ref/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
tests/group/ref/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
tests/group/ref/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

51
tests/group/test.typ Normal file
View File

@ -0,0 +1,51 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#diagram({
_seq("Alice", "Bob", comment: "Authentication Request")
_alt(
"successful case", {
_seq("Bob", "Alice", comment: "Authentication Accepted")
},
"some kind of failure", {
_seq("Bob", "Alice", comment: "Authentication Failure")
_grp("My own label", desc: "My own label2", {
_seq("Alice", "Log", comment: "Log attack start")
_loop("1000 times", {
_seq("Alice", "Bob", comment: "DNS Attack")
})
_seq("Alice", "Log", comment: "Log attack end")
})
},
"Another type of failure", {
_seq("Bob", "Alice", comment: "Please repeat")
}
)
})
#pagebreak()
#diagram({
_par("a", display-name: box(width: 1.5em, height: .5em), show-bottom: false)
_par("b", display-name: box(width: 1.5em, height: .5em), show-bottom: false)
_col("a", "b", width: 2cm)
_loop("a<1", min: 1, {
_seq("a", "b", end-tip: ">>")
_seq("b", "a", end-tip: ">>")
})
_seq("a", "b", end-tip: ">>")
})
#pagebreak()
#diagram({
_par("A")
_par("B")
_col("A", "B", width: 3cm)
_seq("A", "B", enable-dst: true)
_alt([desc], {
_ret()
})
})

4
tests/note/color/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

BIN
tests/note/color/ref/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

13
tests/note/color/test.typ Normal file
View File

@ -0,0 +1,13 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#diagram({
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_note("left", [This is displayed\ left of Alice.], pos: "a", color: rgb("#00FFFF"))
_note("right", [This is displayed right of Alice.], pos: "a")
_note("over", [This is displayed over Alice.], pos: "a")
_note("over", [This is displayed\ over Bob and Alice.], pos: ("a", "b"), color: rgb("#FFAAAA"))
_note("over", [This is yet another\ example of\ a long note.], pos: ("a", "b"))
})

4
tests/note/position/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -0,0 +1,49 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#diagram({
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_seq("a", "b", comment: [hello])
_note("left", [this is a first note])
_seq("b", "a", comment: [ok])
_note("right", [this is another note])
_seq("b", "b", comment: [I am thinking])
_note("left", [a note\ can also be defined\ on several lines])
})
#pagebreak()
#diagram({
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_note("over", [initial state of Alice], pos: "a")
_note("over", [initial state of Bob], pos: "b")
_seq("b", "a", comment: [hello])
})
#pagebreak()
#diagram({
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_par("c", display-name: "Charlie")
_par("d", display-name: "Donald")
_par("e", display-name: "Eddie")
_note("across", [This note float above all participants])
_note("over", [initial state of Alice], pos: "a")
_note("over", [initial state of Bob the builder], pos: "b", aligned: true)
_note("over", [Note 1], pos: "a")
_note("over", [Note 2], pos: "b", aligned: true)
_note("over", [Note 3], pos: "c", aligned: true)
_seq("a", "d")
_note("over", [this is an extremely long note], pos: ("d", "e"))
})

4
tests/note/shape/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

BIN
tests/note/shape/ref/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

14
tests/note/shape/test.typ Normal file
View File

@ -0,0 +1,14 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#diagram({
_par("caller")
_par("server")
_seq("caller", "server", comment: [conReq])
_note("over", [idle], pos: "caller", shape: "hex")
_seq("server", "caller", comment: [conConf])
_note("over", ["r" as rectangle\ "h" as hexagon], pos: "server", shape: "rect")
_note("over", [this is\ on several\ lines], pos: "server", shape: "rect")
_note("over", [this is\ on several\ lines], pos: "caller", shape: "hex")
})

4
tests/note/styled-body/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -0,0 +1,33 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#diagram({
_par("a", display-name: [Alice])
_par("b", display-name: [The *Famous* Bob])
_seq("a", "b", comment: [hello #strike([there])])
_gap()
_seq("b", "a", comment: [ok])
_note("left", [
This is *bold*\
This is _italics_\
This is `monospaced`\
This is #strike([stroked])\
This is #underline([underlined])\
This is #underline([waved])\
])
_seq("a", "b", comment: [A _well formatted_ message])
_note("right", [
This is #box(text([displayed], size: 18pt), fill: rgb("#5F9EA0"))\
#underline([left of]) Alice.
], pos: "a")
_note("left", [
#underline([This], stroke: red) is #text([displayed], fill: rgb("#118888"))\
*#text([left of], fill: rgb("#800080")) #strike([Alice], stroke: red) Bob.*
], pos: "b")
_note("over", [
#underline([This is hosted], stroke: rgb("#FF33FF")) by #box(baseline: 50%, image("/gallery/gitea.png", width: 1cm, height: 1cm, fit: "contain"))
], pos: ("a", "b"))
})

4
tests/participant/shapes/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

View File

@ -0,0 +1,21 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#let TYPST = image("/gallery/typst.png", width: 1.5cm, height: 1.5cm, fit: "contain")
#let FERRIS = image("/gallery/ferris.png", width: 1.5cm, height: 1.5cm, fit: "contain")
#let ME = image("/gallery/me.jpg", width: 1.5cm, height: 1.5cm, fit: "contain")
#diagram({
_par("Foo", display-name: "Participant", shape: "participant")
_par("Foo1", display-name: "Actor", shape: "actor")
_par("Foo2", display-name: "Boundary", shape: "boundary")
_par("Foo3", display-name: "Control", shape: "control")
_par("Foo4", display-name: "Entity", shape: "entity")
_par("Foo5", display-name: "Database", shape: "database")
_par("Foo6", display-name: "Collections", shape: "collections")
_par("Foo7", display-name: "Queue", shape: "queue")
_par("Foo8", display-name: "Typst", shape: "custom", custom-image: TYPST)
_par("Foo9", display-name: "Ferris", shape: "custom", custom-image: FERRIS)
_par("Foo10", display-name: "Baryhobal", shape: "custom", custom-image: ME)
})

View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,57 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#diagram({
_par("alice", display-name: "Alice")
_par("bob", display-name: "Bob")
_seq("alice", "bob", comment: "This is a very long comment")
// Left to right
_seq("alice", "bob", comment: "Start aligned", comment-align: "start")
_seq("alice", "bob", comment: "End aligned", comment-align: "end")
_seq("alice", "bob", comment: "Left aligned", comment-align: "left")
_seq("alice", "bob", comment: "Right aligned", comment-align: "right")
_seq("alice", "bob", comment: "Centered", comment-align: "center")
_gap()
// Right to left
_seq("bob", "alice", comment: "Start aligned", comment-align: "start")
_seq("bob", "alice", comment: "End aligned", comment-align: "end")
_seq("bob", "alice", comment: "Left aligned", comment-align: "left")
_seq("bob", "alice", comment: "Right aligned", comment-align: "right")
_seq("bob", "alice", comment: "Centered", comment-align: "center")
_gap()
// Slant left to right
_seq("alice", "bob", comment: "Start aligned", comment-align: "start", slant: 10)
_seq("alice", "bob", comment: "End aligned", comment-align: "end", slant: 10)
_seq("alice", "bob", comment: "Left aligned", comment-align: "left", slant: 10)
_seq("alice", "bob", comment: "Right aligned", comment-align: "right", slant: 10)
_seq("alice", "bob", comment: "Centered", comment-align: "center", slant: 10)
_gap()
// Slant right to left
_seq("bob", "alice", comment: "Start aligned", comment-align: "start", slant: 10)
_seq("bob", "alice", comment: "End aligned", comment-align: "end", slant: 10)
_seq("bob", "alice", comment: "Left aligned", comment-align: "left", slant: 10)
_seq("bob", "alice", comment: "Right aligned", comment-align: "right", slant: 10)
_seq("bob", "alice", comment: "Centered", comment-align: "center", slant: 10)
})
#pagebreak()
#diagram({
_par("alice", display-name: "Alice")
_seq("alice", "alice", comment: "Start aligned", comment-align: "start")
_seq("alice", "alice", comment: "End aligned", comment-align: "end")
_seq("alice", "alice", comment: "Left aligned", comment-align: "left")
_seq("alice", "alice", comment: "Right aligned", comment-align: "right")
_seq("alice", "alice", comment: "Centered", comment-align: "center")
_seq("alice", "alice", comment: "Start aligned", comment-align: "start", flip: true)
_seq("alice", "alice", comment: "End aligned", comment-align: "end", flip: true)
_seq("alice", "alice", comment: "Left aligned", comment-align: "left", flip: true)
_seq("alice", "alice", comment: "Right aligned", comment-align: "right", flip: true)
_seq("alice", "alice", comment: "Centered", comment-align: "center", flip: true)
})

4
tests/sequence/special-par/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,12 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#diagram({
_seq("?", "Alice", comment: [?->\ *short* to actor1])
_seq("[", "Alice", comment: [\[->\ *from start* to actor1])
_seq("[", "Bob", comment: [\[->\ *from start* to actor2])
_seq("?", "Bob", comment: [?->\ *short* to actor2])
_seq("Alice", "]", comment: [->\]\ from actor1 *to end*])
_seq("Alice", "?", comment: [->?\ *short* from actor1])
_seq("Alice", "Bob", comment: [->\ from actor1 to actor2])
})

4
tests/sequence/tips/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
# generated by tytanic, do not edit
diff/**
out/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,84 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#diagram({
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_seq("a", "b", end-tip: ">", comment: `->`)
_seq("a", "b", end-tip: ">>", comment: `->>`)
_seq("a", "b", end-tip: "\\", comment: `-\`)
_seq("a", "b", end-tip: "\\\\", comment: `-\\`)
_seq("a", "b", end-tip: "/", comment: `-/`)
_seq("a", "b", end-tip: "//", comment: `-//`)
_seq("a", "b", end-tip: "x", comment: `->x`)
_seq("a", "b", start-tip: "x", comment: `x->`)
_seq("a", "b", start-tip: "o", comment: `o->`)
_seq("a", "b", end-tip: ("o", ">"), comment: `->o`)
_seq("a", "b", start-tip: "o", end-tip: ("o", ">"), comment: `o->o`)
_seq("a", "b", start-tip: ">", end-tip: ">", comment: `<->`)
_seq("a", "b", start-tip: ("o", ">"), end-tip: ("o", ">"), comment: `o<->o`)
_seq("a", "b", start-tip: "x", end-tip: "x", comment: `x<->x`)
_seq("a", "b", end-tip: ("o", ">>"), comment: `->>o`)
_seq("a", "b", end-tip: ("o", "\\"), comment: `-\o`)
_seq("a", "b", end-tip: ("o", "\\\\"), comment: `-\\o`)
_seq("a", "b", end-tip: ("o", "/"), comment: `-/o`)
_seq("a", "b", end-tip: ("o", "//"), comment: `-//o`)
_seq("a", "b", start-tip: "x", end-tip: ("o", ">"), comment: `x->o`)
})
#pagebreak()
#diagram({
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_seq("b", "a", end-tip: ">", comment: `->`)
_seq("b", "a", end-tip: ">>", comment: `->>`)
_seq("b", "a", end-tip: "\\", comment: `-\`)
_seq("b", "a", end-tip: "\\\\", comment: `-\\`)
_seq("b", "a", end-tip: "/", comment: `-/`)
_seq("b", "a", end-tip: "//", comment: `-//`)
_seq("b", "a", end-tip: "x", comment: `->x`)
_seq("b", "a", start-tip: "x", comment: `x->`)
_seq("b", "a", start-tip: "o", comment: `o->`)
_seq("b", "a", end-tip: ("o", ">"), comment: `->o`)
_seq("b", "a", start-tip: "o", end-tip: ("o", ">"), comment: `o->o`)
_seq("b", "a", start-tip: ">", end-tip: ">", comment: `<->`)
_seq("b", "a", start-tip: ("o", ">"), end-tip: ("o", ">"), comment: `o<->o`)
_seq("b", "a", start-tip: "x", end-tip: "x", comment: `x<->x`)
_seq("b", "a", end-tip: ("o", ">>"), comment: `->>o`)
_seq("b", "a", end-tip: ("o", "\\"), comment: `-\o`)
_seq("b", "a", end-tip: ("o", "\\\\"), comment: `-\\o`)
_seq("b", "a", end-tip: ("o", "/"), comment: `-/o`)
_seq("b", "a", end-tip: ("o", "//"), comment: `-//o`)
_seq("b", "a", start-tip: "x", end-tip: ("o", ">"), comment: `x->o`)
})
#pagebreak()
#diagram({
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_seq("a", "a", end-tip: ">", comment: `->`)
_seq("a", "a", end-tip: ">>", comment: `->>`)
_seq("a", "a", end-tip: "\\", comment: `-\`)
_seq("a", "a", end-tip: "\\\\", comment: `-\\`)
_seq("a", "a", end-tip: "/", comment: `-/`)
_seq("a", "a", end-tip: "//", comment: `-//`)
_seq("a", "a", end-tip: "x", comment: `->x`)
_seq("a", "a", start-tip: "x", comment: `x->`)
_seq("a", "a", start-tip: "o", comment: `o->`)
_seq("a", "a", end-tip: ("o", ">"), comment: `->o`)
_seq("a", "a", start-tip: "o", end-tip: ("o", ">"), comment: `o->o`)
_seq("a", "a", start-tip: ">", end-tip: ">", comment: `<->`)
_seq("a", "a", start-tip: ("o", ">"), end-tip: ("o", ">"), comment: `o<->o`)
_seq("a", "a", start-tip: "x", end-tip: "x", comment: `x<->x`)
_seq("a", "a", end-tip: ("o", ">>"), comment: `->>o`)
_seq("a", "a", end-tip: ("o", "\\"), comment: `-\o`)
_seq("a", "a", end-tip: ("o", "\\\\"), comment: `-\\o`)
_seq("a", "a", end-tip: ("o", "/"), comment: `-/o`)
_seq("a", "a", end-tip: ("o", "//"), comment: `-//o`)
_seq("a", "a", start-tip: "x", end-tip: ("o", ">"), comment: `x->o`)
})

View File

@ -1,7 +1,7 @@
[package]
name = "chronos"
version = "0.2.0"
compiler = "0.12.0"
version = "0.2.2"
compiler = "0.13.1"
repository = "https://git.kb28.ch/HEL/chronos"
entrypoint = "src/lib.typ"
authors = [
@ -11,4 +11,4 @@ categories = ["visualization"]
license = "Apache-2.0"
description = "A package to draw sequence diagrams with CeTZ"
keywords = ["sequence", "diagram", "plantuml"]
exclude = [ "gallery", "gallery.bash", "docs" ]
exclude = [ "gallery", "justfile", "docs" ]