Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/preview/gibz-script/0.1.0/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MIT No Attribution (MIT-0)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
112 changes: 112 additions & 0 deletions packages/preview/gibz-script/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
## GIBZ Template Package

A template package providing reusable components for teaching and learning material at [GIBZ](https://www.gibz.ch).
It comes with a configurable document setup (`gibz-conf`) and a collection of styled components such as tasks, hints, supplementary material, and more.

---

## Features

- 📄 **Configurable document layout** with title page, table of contents, and headers/footers.
- 🎨 **Consistent styling** through a `base_box` and `icon_box` system.
- ✏️ **Task component** with badges for time, social form, results recording, and evaluation.
- 💡 **Hint**, ❓ **Question**, 🎬 **Video**, 📖 **Supplementary Material** boxes.
- 🔳 **Black code box** for highlighting code snippets.
- 🌍 **Built-in i18n** (currently German and English).
- 🧩 Exposed via a **flat prefixed API** (`gibz-task`, `gibz-hint`, …) and an optional `GIBZ` namespace.

---

## Quick Start

Create a new project from this template in the Typst CLI:

```sh
typst init @preview/gibz-script:0.1.0
```

Or in the [Typst web app](https://typst.app):
**New → From Template → GIBZ**.

---

## Usage

### Import the flat API (recommended)

```typst
#import "@preview/gibz-script:0.1.0": gibz-conf, gibz-task, gibz-supplementary

#show: gibz-script(
moduleNumber: 114,
moduleTitle: "Codierungs-, Kompressions- und Verschlüsselungsverfahren einsetzen",
documentTitle: "Skript",
language: "de",
doc: {
#gibz-hint("Dieses Skript wurde mit Typst geschrieben :-)")
#gibz-supplementary([Cheat Sheet])
}
)
```

### Or use the namespaced API

```typst
#import "@preview/gibz-script:0.1.0": GIBZ

#show: GIBZ.script(
moduleNumber: 114,
moduleTitle: "Codierungs-, Kompressions- und Verschlüsselungsverfahren einsetzen",
documentTitle: "Skript",
language: "de",
doc: {
#GIBZ.hint("Dieses Skript wurde mit Typst geschrieben :-)")
#GIBZ.supplementary([Cheat Sheet])
}
)
```

---

## API Reference

### Configuration

- `gibz-conf(moduleNumber, moduleTitle, documentTitle, language, doc)`
Wraps your document with title page, table of contents, headers/footers, and base styles.

### Components

- `gibz-task(...)` – exercise/task box with time, social form, recording, evaluation.
- `gibz-hint(content)` – hint box with 💡 icon.
- `gibz-question(question, task: none)` – question box with ❓ icon, optional task description.
- `gibz-video(url, title, description: none)` – video reference with 🎬 icon.
- `gibz-supplementary(body, title: none)` – supplementary material box with 📖 icon.
- `gibz-black_code_box(body, codly-opts: (:), box-opts: (:))` – code box with dark background.

### Utilities

- `gibz-base_box(body, style: (:))` – low-level styled container.
- `gibz-icon_box(icon, content, style: (:))` – container with icon + content layout.
- `gibz-colors.blue` – standard accent color.
- `gibz-t(key, lang: none)` – translation lookup (DE/EN).

---

## Localization

The package supports German (`de`) and English (`en`) for static labels (e.g., _Exercise_, _Supplementary Material_, _Table of Contents_).
The language is set via `gibz-conf(language: "de" | "en")`.

---

## License

This package is licensed under the [MIT-0 License](LICENSE), allowing reuse with minimal restrictions.

---

## Contributing

Issues and pull requests are welcome!
The source is maintained on [GitLab](https://gitlab.com/GIBZ/public/typst-template), with mirrored contributions published to [Typst Universe](https://github.com/typst/packages).
46 changes: 46 additions & 0 deletions packages/preview/gibz-script/0.1.0/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// lib.typ — public entrypoint with flat gibz_ API + optional GIBZ namespace.

// Import only what we want to expose
#import "src/colors.typ": gibz-blue
#import "src/state.typ": gibz-lang // kept internal; not re-exported
#import "src/layout.typ": _conf
#import "src/components/base_box.typ": base-box
#import "src/components/icon_box.typ": icon-box
#import "src/components/boxes.typ": hint, question, supplementary, video
#import "src/components/codebox.typ": black-code-box
#import "src/components/task.typ": task
#import "src/i18n.typ": t

#import "src/code.typ": code as gibz-code, code_wrap as _gibz-codly, set_code_style as gibz-set-code-style


// ── Flat API (prefixed) ──────────────────────────────────────────────────────
#let gibz-script = _conf
#let gibz-task = task
#let gibz-hint = hint
#let gibz-question = question
#let gibz-video = video
#let gibz-supplementary = supplementary
#let gibz-black-code-box = black-code-box
#let gibz-icon-box = icon-box
#let gibz-base-box = base-box
#let gibz-t = t

// Colors (both single and grouped)
#let gibz-blue = gibz-blue
#let gibz-colors = (blue: gibz-blue)

// ── Optional convenience namespace (no duplication; just references) ────────
#let GIBZ = (
script: gibz-script,
task: gibz-task,
hint: gibz-hint,
question: gibz-question,
video: gibz-video,
supplementary: gibz-supplementary,
black_code_box: gibz-black-code-box,
icon_box: gibz-icon-box,
base_box: gibz-base-box,
colors: gibz-colors,
t: gibz-t,
)
29 changes: 29 additions & 0 deletions packages/preview/gibz-script/0.1.0/src/code.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#import "@preview/codly:1.3.0": *

#let _code_overrides = state("gibz-code-overrides", (:))

#let set_code_style(opts: (:)) = {
if type(opts) == dictionary {
_code_overrides.update(_code_overrides.get() + opts)
}
}

// Lokaler Wrapper für Blöcke
#let code(block, opts: (:)) = {
context {
let ov = _code_overrides.get()
let local_opts = if type(opts) == dictionary { ov + opts } else { ov }
codly(..local_opts)
block
}
}

// Alternative Syntax: #GIBZ.codly(...)[ body ]
#let code_wrap(opts: (:), body) = {
context {
let ov = _code_overrides.get()
let local_opts = if type(opts) == dictionary { ov + opts } else { ov }
codly(..local_opts)
body
}
}
2 changes: 2 additions & 0 deletions packages/preview/gibz-script/0.1.0/src/colors.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Central color definitions
#let gibz-blue = rgb(0, 119, 192, 255)
23 changes: 23 additions & 0 deletions packages/preview/gibz-script/0.1.0/src/components/base_box.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// A reusable visual container with sensible defaults.
// Override any style via the `style` dict.
#let base-box(body, style: (:)) = {
let defaults = (
width: 100%,
fill: luma(98%),
stroke: (paint: gray, thickness: 0.5pt),
radius: 6pt,
inset: 12pt,
)

// Merge defaults with caller-provided styles (caller wins).
let s = defaults + style

box(
width: s.width,
fill: s.fill,
stroke: s.stroke,
radius: s.radius,
inset: s.inset,
[ #body ],
)
}
75 changes: 75 additions & 0 deletions packages/preview/gibz-script/0.1.0/src/components/boxes.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#import "../colors.typ": gibz-blue
#import "../state.typ": gibz-lang
#import "../i18n.typ": t
#import "./base_box.typ": base-box

// Icon/text two-column box using base_box
#let gibz-box(icon, content) = {
set text(size: 10pt)
base-box(
[
#grid(
columns: (50pt, 1fr),
align: (center + horizon, left + horizon),
[
#set text(size: 20pt)
#pad(right: 15pt, bottom: 5pt, icon)
],
[#content],
)
],
)
}

#let hint(hint) = gibz-box(emoji.lightbulb, hint)

#let question(question, task: none) = gibz-box(
emoji.quest,
{
[
#set text(weight: "bold")
#question
]
if task != none {
linebreak()
[#task]
}
},
)

#let video(url, title, description: none) = {
show link: set text(font: "DejaVu Sans Mono", size: 7pt)
gibz-box(
[#emoji.clapperboard],
[
#[
#set text(weight: "bold")
#title #linebreak()
]
#if description != none { [#description #linebreak()] }
#link(url)
],
)
}

#let supplementary(body, title: none, lang: none) = {
context {
let L = if lang != none { lang } else { gibz-lang.get() }

base-box(
[
#block(below: 6pt, [
#text(size: 0.75em, weight: 600, fill: gibz-blue)[📖 #t("supplementary-material", lang: L)]
])
#v(6pt)

#if title != none {
block(below: 6pt, [ #text(size: 1.15em, weight: 700)[#title] ])
v(3pt)
}

#body
],
)
}
}
36 changes: 36 additions & 0 deletions packages/preview/gibz-script/0.1.0/src/components/codebox.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#import "@preview/codly:1.3.0": *

#let _gibz_black_code_box(
body, // Inhalt: i. d. R. ein fenced code block
codly-opts: (:), // optionale Codly-Overrides lokal für diesen Block
box-opts: (:), // optionale Box-Optionen (inset, radius, ...)
) = {
// Codly-Defaults innerhalb der schwarzen Box
let codly-defaults = (
zebra-fill: none,
number-format: none,
display-name: false,
stroke: none,
fill: black,
)
let codly-final = codly-defaults + codly-opts

box(
width: 100%,
fill: black,
inset: 5pt,
radius: 5pt,
stroke: none,
..box-opts,
[
#set text(fill: white)
#context {
codly(..codly-final)
body
}
],
)
}

// Öffentlicher Alias wie bisher
#let black-code-box = _gibz_black_code_box
24 changes: 24 additions & 0 deletions packages/preview/gibz-script/0.1.0/src/components/icon_box.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#import "./base_box.typ": base-box

// A reusable "icon + content" box built on base_box
#let icon-box(icon, content, style: (:)) = {
base-box(
[
#grid(
columns: (50pt, 1fr),
align: (center + horizon, left + horizon),
[
#set text(size: 20pt)
#pad(right: 15pt, bottom: 5pt, icon)
],
[#content],
)
],
style: (
fill: gray.lighten(85%),
radius: 10pt,
inset: 15pt,
)
+ style,
)
}
Loading