6 Commits

Author SHA1 Message Date
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
21 changed files with 107 additions and 32 deletions

View File

@ -1,5 +1,18 @@
#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")
@ -121,15 +134,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) = {}
/// 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

@ -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")`
@ -52,9 +63,3 @@
#let tips = (
"", ">", ">>", "\\", "\\\\", "/", "//", "x", "o",
)
/// Accepted values for `comment-align` argument of @@_seq()
/// #examples.seq-comm-align
#let comment-align = (
"start", "end", "left", "center", "right"
)

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

Binary file not shown.

View File

@ -197,7 +197,7 @@ chronos.diagram({
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)

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 "@preview/cetz:0.3.3": draw
#import "consts.typ": *
#let _grp(name, desc: none, type: "default", elmts) = {

View File

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

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw
#import "@preview/cetz:0.3.3": draw
#import "consts.typ": *
#let PAR-SPECIALS = "?[]"

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": canvas, draw
#import "@preview/cetz:0.3.3": canvas, draw
#import "utils.typ": get-participants-i, get-style, normalize-units
#import "group.typ"
#import "participant.typ"

View File

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

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw, vector
#import "@preview/cetz:0.3.3": 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)
}

View File

@ -1,7 +1,7 @@
[package]
name = "chronos"
version = "0.2.0"
compiler = "0.12.0"
version = "0.2.1"
compiler = "0.13.0"
repository = "https://git.kb28.ch/HEL/chronos"
entrypoint = "src/lib.typ"
authors = [