forked from HEL/chronos
78 lines
1.4 KiB
Typst
78 lines
1.4 KiB
Typst
#import "cetz.typ": styles
|
|
|
|
#import "core/draw/delay.typ"
|
|
#import "core/draw/event.typ": render as evt-render
|
|
#import "core/draw/separator.typ"
|
|
#import "core/draw/sync.typ"
|
|
#import "core/utils.typ": get-ctx, normalize-units, set-y
|
|
|
|
#let _sep(name, ..style) = {
|
|
return ((
|
|
type: "sep",
|
|
draw: separator.render,
|
|
name: name,
|
|
style: style.named()
|
|
),)
|
|
}
|
|
|
|
#let _delay(name: none, ..style) = {
|
|
return ((
|
|
type: "delay",
|
|
draw: delay.render,
|
|
name: name,
|
|
style: style.named()
|
|
),)
|
|
}
|
|
|
|
#let _sync(elmts) = {
|
|
return ((
|
|
type: "sync",
|
|
draw: sync.render,
|
|
elmts: elmts
|
|
),)
|
|
}
|
|
|
|
#let gap-default-style = (
|
|
size: 20pt
|
|
)
|
|
|
|
#let gap-render(gap) = get-ctx(ctx => {
|
|
let style = styles.resolve(
|
|
ctx.style,
|
|
merge: gap.style,
|
|
root: "gap",
|
|
base: gap-default-style
|
|
)
|
|
let size = normalize-units(style.size)
|
|
set-y(ctx.y - size)
|
|
})
|
|
|
|
#let _gap(..style) = {
|
|
return ((
|
|
type: "gap",
|
|
draw: gap-render,
|
|
style: style.named()
|
|
),)
|
|
}
|
|
|
|
#let _evt(participant, event, ..style) = {
|
|
return ((
|
|
type: "evt",
|
|
draw: evt-render,
|
|
participant: participant,
|
|
event: event,
|
|
style: style.named()
|
|
),)
|
|
}
|
|
|
|
#let _col(p1, p2, width: auto, margin: 0, min-width: 0, max-width: none) = {
|
|
return ((
|
|
type: "col",
|
|
p1: p1,
|
|
p2: p2,
|
|
width: width,
|
|
margin: margin,
|
|
min-width: min-width,
|
|
max-width: max-width
|
|
),)
|
|
} |