diff --git a/internals.typ b/internals.typ index e503096..ed5d3b2 100644 --- a/internals.typ +++ b/internals.typ @@ -24,13 +24,13 @@ /// /// - theme (theme): /// -> content -#let print-entries(theme: (:)) = { +#let print-entries(theme: (:), cover-ctx: (:)) = { let print-helper(section, state) = { locate(loc => { for entry in state.final(loc) [ #let entry-func = fallback-to-default(section + "-entry", theme) #let body = [] + entry.body - #entry-func(body, ctx: entry.ctx) + #entry-func(body, ctx: entry.ctx + cover-ctx) ] }) } diff --git a/lib.typ b/lib.typ index 47fd524..8dd6d5e 100644 --- a/lib.typ +++ b/lib.typ @@ -33,6 +33,7 @@ let rules = theme.rules show: doc => rules(doc) + let cover-ctx = (team-name: team-name, season: season, year: year) let cover-content = if cover == none { let ctx = (team-name: team-name, season: season, year: year) print-cover(ctx: ctx, theme: theme) @@ -43,6 +44,6 @@ page[] // Filler page - print-entries(theme: theme) + print-entries(theme: theme, cover-ctx: cover-ctx) body // FIXME: this should be ignored, but the document doesn't properly render without it. } diff --git a/themes/pyro/colors.typ b/themes/pyro/colors.typ new file mode 100644 index 0000000..37fc846 --- /dev/null +++ b/themes/pyro/colors.typ @@ -0,0 +1,13 @@ +#let gray = rgb("#BBBBBB") +#let blue = rgb("#0077bb") +#let light-blue = rgb("#33bbee") +#let green = rgb("#009988") +#let orange = rgb("#ee7733") +#let red = rgb("#cc3311") +#let pink = rgb("#ee3377") + +#let surface-0 = rgb("#f1f3f5") +#let surface-1 = rgb("#e9ecef") +#let surface-2 = rgb("#dee2e6") +#let surface-3 = rgb("#ced4da") +#let surface-4 = rgb("#adb5bd") diff --git a/themes/pyro/components/components.typ b/themes/pyro/components/components.typ new file mode 100644 index 0000000..0eddc98 --- /dev/null +++ b/themes/pyro/components/components.typ @@ -0,0 +1,4 @@ +#import "./toc.typ": * +#import "./pro-con.typ": * +#import "./decision-matrix.typ": * +#import "./glossary.typ": * diff --git a/themes/pyro/components/decision-matrix.typ b/themes/pyro/components/decision-matrix.typ new file mode 100644 index 0000000..80afc0b --- /dev/null +++ b/themes/pyro/components/decision-matrix.typ @@ -0,0 +1,33 @@ +#import "/utils.typ" +#import "../colors.typ": * + +#let decision-matrix(properties: none, ..choices) = { + let data = utils.calc-decision-matrix(properties: properties, ..choices) + let body-cell = box.with(width: 100%, inset: 5pt) + let top-left-corner-cell = body-cell.with(radius: 5pt) + let top-right-corner-cell = body-cell.with(radius: 50pt, fill: red) + grid( + inset: -0.1pt, + columns: for _ in range(properties.len() + 2) { + (1fr,) + }, // + fill: (col, row) => { + if col == 0 and row == 0 { white } + else if calc.odd(row) { surface-3 } + else if calc.even(row) { surface-1 } + }, + body-cell[], + //body-cell[*Weight*], + ..for property in properties { + (body-cell[ *#property.name* ],) + }, + top-right-corner-cell[*Total*], + ..for choice in data { + //Override the fill if the choice has the highest score + //let cell = if choice.values.total.highest { cellx.with(fill: green) } else { cellx } + (body-cell[*#choice.name*], ..for value in choice.values { + (body-cell[#value.at(1).value],) + }) + }, + ) +} diff --git a/themes/pyro/components/glossary.typ b/themes/pyro/components/glossary.typ new file mode 100644 index 0000000..e69de29 diff --git a/themes/pyro/components/pro-con.typ b/themes/pyro/components/pro-con.typ new file mode 100644 index 0000000..e69de29 diff --git a/themes/pyro/components/toc.typ b/themes/pyro/components/toc.typ new file mode 100644 index 0000000..2c4b3c7 --- /dev/null +++ b/themes/pyro/components/toc.typ @@ -0,0 +1,32 @@ +#import "/utils.typ" +#import "/packages.typ": tablex +#import tablex: * +#import "../colors.typ": * +#import "../metadata.typ": * +#import "../format.typ": * + +#let toc() = utils.print-toc( + (frontmatter, body, appendix) => { + heading[Contents] + + stack( + spacing: 1em, + ..for entry in body { + ( + [ + #let entry-data = entry-types.at(entry.type) + #box(baseline: 25%)[#title(entry-data.color, entry.title)] + #h(1em) + #box( + width: 1fr, + line(length: 100%, start: (0pt, -.35em), stroke: (dash: "loosely-dotted")), + ) + #h(1em) + #entry.page-number + + ], + ) + }, + ) + }, +) diff --git a/themes/pyro/entries.typ b/themes/pyro/entries.typ new file mode 100644 index 0000000..94e4f7f --- /dev/null +++ b/themes/pyro/entries.typ @@ -0,0 +1,79 @@ +#import "./metadata.typ": entry-types +#import "./colors.typ":* +#import "./format.typ": * + +#let frontmatter-entry(ctx: (:), body) = { + show: page.with( + footer: align(center, context counter(page).display()), + background: place(rect(fill: gray, height: 100%, width: 15pt)), + ) + + body +} + +#let body-entry(ctx: (:), body) = { + let entry-data = entry-types.at(ctx.type) + + show: page.with( + header: [ + #grid( + columns: (1fr, 2fr, 1fr), + [ + #set text(font: "Tele-Marines", weight: "bold") + #ctx.team-name + ], // TODO: get team name from from ctx + [ + #set align(center) + #ctx.season + Engineering Notebook + ], + [ + #set align(right) + #ctx.date.display("[month repr:long] [day padding:none], [year]") + ], + ) + #line(length: 100%, stroke: 0.5pt) + ], + footer: [ + #line(length: 100%, stroke: 0.5pt) + #grid( + columns: (1fr, 0.3fr, 1fr), + [ + #set text(11pt) + _All information in this document is property of team #ctx.team-name, unless + otherwise stated_ + ], + [ + #set align(center) + #context counter(page).display() + ], + [ + #set align(right) + *Signature:* #ctx.author + #linebreak() + *Witness:* #ctx.witness + ], + ) + ], + background: place[#rect(fill: entry-data.color, height: 100%, width: 15pt)], + ) + + block[ + #title(entry-data.color)[#ctx.title] + #h(1fr) + #title(entry-data.color)[#entry-data.title] + ] + + show image: it => { + box(stroke: 5pt + entry-data.color, radius: 1em, clip: true, it) + } + + body +} + +// TODO: make an actual appendix entry +#let appendix-entry(ctx: (:), body) = { + show: page.with(header: [ = Appendix header ], footer: [Appendix footer]) + + body +} diff --git a/themes/pyro/format.typ b/themes/pyro/format.typ new file mode 100644 index 0000000..bc4a990 --- /dev/null +++ b/themes/pyro/format.typ @@ -0,0 +1,33 @@ +#import "./colors.typ": * + +#let title(color, body) = box(fill: color, inset: 9pt, radius: 5em)[ + #set text(fill: white, font: "Calibri", 12pt, weight: "bold") + #body +] + +#let rules(doc) = { + doc +} + +#let cover(ctx: (:)) = { + grid( + columns: (10em, 1fr), + gutter: 20pt, + rect(width: 100%, height: 100%, fill: red), + grid( + rows: (1fr, 1fr), + [ + #set align(horizon) + #set text(50pt, font: "Tele-Marines", fill: gradient.linear(red, yellow)) + #ctx.team-name + ], + [ + #set text(30pt, fill: red) + Digital Engineering Notebook + + #set text(20pt, fill: black) + #ctx.season + ], + ), + ) +} diff --git a/themes/pyro/metadata.typ b/themes/pyro/metadata.typ new file mode 100644 index 0000000..2c4fc36 --- /dev/null +++ b/themes/pyro/metadata.typ @@ -0,0 +1,16 @@ +#import "./colors.typ": * + +#let entry-types = ( + "understand": (color: blue, title: "Understand"), + "explore": (color: blue, title: "Explore"), + "define": (color: light-blue, title: "Define"), + "ideate": (color: light-blue, title: "Ideate"), + "prototype": (color: light-blue, title: "Prototype"), + "choose": (color: green, title: "Choose"), + "refine": (color: orange, title: "Refine"), + "present": (color: orange, title: "Present"), + "implement": (color: orange, title: "Implement"), + "test": (color: red, title: "Test"), + "iterate": (color: pink, title: "Iterate"), + "information": (color: gray, title: "Information"), +) diff --git a/themes/pyro/pyro.typ b/themes/pyro/pyro.typ new file mode 100644 index 0000000..8046470 --- /dev/null +++ b/themes/pyro/pyro.typ @@ -0,0 +1,13 @@ +#import "./format.typ": * +#import "./entries.typ": * +#import "./components/components.typ" + +#let pyro-theme = ( + // Global show rules + rules: rules, + cover: cover, + // Entry pages + frontmatter-entry: frontmatter-entry, + body-entry: body-entry, + appendix-entry: appendix-entry, +) diff --git a/themes/themes.typ b/themes/themes.typ index 6fce657..57e8346 100644 --- a/themes/themes.typ +++ b/themes/themes.typ @@ -1,3 +1,4 @@ #import "./default/default.typ" #import "./radial/radial.typ" -#import "./linear/linear.typ" \ No newline at end of file +#import "./linear/linear.typ" +#import "./pyro/pyro.typ"