ravenous_typst/setup/theme/boxes.typ

138 lines
3.4 KiB
Plaintext

#import "../core/macros.typ": memo_box
#import "variables.typ": resolve-table-theme, theme
#let rav-help = memo_box
#let rav-example(..examples) = {
let examples = examples.pos()
assert(examples.len() > 0, message: "rav-example needs at least one example")
rav-help(title: "Par exemple")[
#for (index, example) in examples.enumerate() {
if index > 0 {
v(0.65em)
line(length: 100%, stroke: 0.55pt + theme.muted.lighten(45%))
v(0.65em)
}
example
}
]
}
#let rav-box(args) = rav-help(args, title: none)
// Quiet inline examples for dense rules sections where a full memo box would
// compete too strongly with the surrounding text.
#let rav-muted-example(
..examples,
title: [Exemple],
) = {
let examples = examples.pos()
assert(examples.len() > 0, message: "rav-muted-example needs at least one example")
pad(left: 1.05em, right: 0.2em)[
#block(
width: 100%,
breakable: false,
inset: (left: 1.15em, right: 0.25em, y: 0.28em),
stroke: (left: 0.7pt + theme.muted.lighten(42%).transparentize(25%)),
)[
#text(
size: 7pt,
weight: "semibold",
tracking: 0.035em,
fill: theme.muted.transparentize(18%),
upper(title),
)
#for (index, example) in examples.enumerate() {
if index > 0 {
v(0.5em)
line(
length: 100%,
stroke: 0.45pt + theme.muted.lighten(50%).transparentize(30%),
)
v(0.5em)
} else {
h(0.5em)
}
emph(text(size: 0.9em, fill: theme.ink.transparentize(20%))[#example])
}
]
]
}
// Optional rules that add tactical nuance but are not required on a first read.
// The fixed Steingrund palette keeps this signal consistent across book themes.
#let ravadvanced(
content,
title: [Notion avancée],
) = {
let t = resolve-table-theme("steingrund")
block(
width: 100%,
breakable: false,
inset: (left: 12pt, right: 9pt, y: 8pt),
radius: (right: 3pt),
fill: t.parchment-accent.transparentize(25%),
stroke: (
left: 2.6pt + t.attack-mixed,
top: 0.35pt + t.border,
right: 0.35pt + t.border,
bottom: 0.35pt + t.border,
),
)[
#text(
size: 7.2pt,
weight: "semibold",
tracking: 0.045em,
fill: t.attack-mixed,
)[NOTION AVANCÉE]
#v(0.35em)
#text(weight: "bold", fill: t.heading)[#title]
#v(0.45em)
#content
]
}
#let inline_help(content) = {
emph[( #content )]
}
// Marks deliberately incomplete content in player-facing documents.
// Keep the pill available for compact indexes and headings, even where the
// complete admonition is more appropriate.
#let temporary-section-pill(label: "Section provisoire") = box(
inset: (x: 0.55em, y: 0.18em),
radius: 999pt,
fill: theme.dark-gold.lighten(82%),
stroke: 0.45pt + theme.dark-gold.lighten(38%),
text(
size: 7pt,
weight: "semibold",
tracking: 0.03em,
fill: theme.dark-gold.darken(12%),
upper(label),
),
)
#let temporary-section(
content,
title: [Contenu temporaire],
) = block(
width: 100%,
breakable: false,
inset: 12pt,
radius: 4pt,
fill: theme.parchment,
stroke: (left: 2.4pt + theme.dark-gold, rest: 0.55pt + theme.gold),
)[
#text(
size: 7.5pt,
weight: "semibold",
tracking: 0.04em,
fill: theme.dark-gold.darken(12%),
)[SECTION PROVISOIRE]
#h(0.6em)
#strong[#title]
#v(0.55em)
#content
]