From a36de27961dd9600f385aa64e38ee6d6f438d685 Mon Sep 17 00:00:00 2001 From: jomaway Date: Thu, 20 Feb 2025 21:48:28 +0100 Subject: [PATCH] gentle-clues:1.2.0 (#1782) Co-authored-by: Ana Gelez --- packages/preview/gentle-clues/1.2.0/LICENSE | 21 ++ packages/preview/gentle-clues/1.2.0/README.md | 56 +++ .../1.2.0/lib/assets/abstract.svg | 1 + .../gentle-clues/1.2.0/lib/assets/bell.svg | 1 + .../1.2.0/lib/assets/checkbox.svg | 1 + .../gentle-clues/1.2.0/lib/assets/code.svg | 1 + .../1.2.0/lib/assets/conclusion.svg | 1 + .../1.2.0/lib/assets/crossmark.svg | 1 + .../gentle-clues/1.2.0/lib/assets/danger.svg | 1 + .../gentle-clues/1.2.0/lib/assets/excl.svg | 1 + .../1.2.0/lib/assets/experiment.svg | 1 + .../gentle-clues/1.2.0/lib/assets/flag.svg | 1 + .../gentle-clues/1.2.0/lib/assets/info.svg | 1 + .../1.2.0/lib/assets/lightbulb.svg | 1 + .../1.2.0/lib/assets/questionmark.svg | 1 + .../gentle-clues/1.2.0/lib/assets/quote.svg | 1 + .../1.2.0/lib/assets/simple-graph.svg | 1 + .../gentle-clues/1.2.0/lib/assets/task.svg | 1 + .../gentle-clues/1.2.0/lib/assets/tip.svg | 79 +++++ .../gentle-clues/1.2.0/lib/assets/warning.svg | 1 + .../preview/gentle-clues/1.2.0/lib/clues.typ | 329 ++++++++++++++++++ .../preview/gentle-clues/1.2.0/lib/lang.toml | 162 +++++++++ .../preview/gentle-clues/1.2.0/lib/lib.typ | 4 + .../gentle-clues/1.2.0/lib/predefined.typ | 218 ++++++++++++ .../preview/gentle-clues/1.2.0/lib/theme.typ | 80 +++++ .../preview/gentle-clues/1.2.0/typst.toml | 12 + 26 files changed, 978 insertions(+) create mode 100644 packages/preview/gentle-clues/1.2.0/LICENSE create mode 100644 packages/preview/gentle-clues/1.2.0/README.md create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/abstract.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/bell.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/checkbox.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/code.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/conclusion.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/crossmark.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/danger.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/excl.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/experiment.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/flag.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/info.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/lightbulb.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/questionmark.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/quote.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/simple-graph.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/task.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/tip.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/assets/warning.svg create mode 100644 packages/preview/gentle-clues/1.2.0/lib/clues.typ create mode 100644 packages/preview/gentle-clues/1.2.0/lib/lang.toml create mode 100644 packages/preview/gentle-clues/1.2.0/lib/lib.typ create mode 100644 packages/preview/gentle-clues/1.2.0/lib/predefined.typ create mode 100644 packages/preview/gentle-clues/1.2.0/lib/theme.typ create mode 100644 packages/preview/gentle-clues/1.2.0/typst.toml diff --git a/packages/preview/gentle-clues/1.2.0/LICENSE b/packages/preview/gentle-clues/1.2.0/LICENSE new file mode 100644 index 000000000..17c40758e --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 jomaway + +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, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +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. diff --git a/packages/preview/gentle-clues/1.2.0/README.md b/packages/preview/gentle-clues/1.2.0/README.md new file mode 100644 index 000000000..cc3fdd0f5 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/README.md @@ -0,0 +1,56 @@ +# gentle-clues + +Simple admonitions for typst. Add predefined or define your own. + +Inspired from [mdbook-admonish](https://tommilligan.github.io/mdbook-admonish/). + +## Overview of all predefined clues: +![Overview of the predefined clues](./gc-overview.svg) + +## Usage + +For full information, see the [docs.pdf](https://github.com/jomaway/typst-gentle-clues/blob/main/docs.pdf) + +To use this package, simply add the following code to your document: +```typst +#import "@preview/gentle-clues:1.2.0": * + +// add an info clue +#info[ This is the info clue ... ] + +// or a tip with custom title +#tip(title: "Best tip ever")[Check out this cool package] +``` + +_This will create an info clue and tip clue inside your document. See the overview for all available clues. + +### Features + +This package provides some features which helps to customize the clues to your liking. + +- Set global default for all clues +- Overwrite each parameter on a single clue for changing title, color, etc. +- Show or hide a counter value on tasks. +- Define your own clues very easily. +- ... + +For a full list see the [documentation](https://github.com/jomaway/typst-gentle-clues/blob/main/docs.pdf). + +## Language support + +This package does use [linguify](https://github.com/jomaway/typst-linguify) to support multiple languages. + +**Header titles:** +The language of the header titles is detected automatically from the `context text.lang`. +See the file [lang.toml](https://github.com/jomaway/typst-gentle-clues/blob/main/lib/lang.toml) for currently supported languages. + +If an unsupported language is set it will fallback to english as default. +Feel free to open a PR with your language added to the `lang.toml` file. + +## License + +[MIT License](LICENSE) + +## Changelog + +[See CHANGELOG.md](CHANGELOG.md) diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/abstract.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/abstract.svg new file mode 100644 index 000000000..fafda4dce --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/abstract.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/bell.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/bell.svg new file mode 100644 index 000000000..3f11f25eb --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/bell.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/checkbox.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/checkbox.svg new file mode 100644 index 000000000..7fe6e8726 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/checkbox.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/code.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/code.svg new file mode 100644 index 000000000..894d8dd92 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/code.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/conclusion.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/conclusion.svg new file mode 100644 index 000000000..c72a44019 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/conclusion.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/crossmark.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/crossmark.svg new file mode 100644 index 000000000..688ea1834 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/crossmark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/danger.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/danger.svg new file mode 100644 index 000000000..14dc19132 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/danger.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/excl.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/excl.svg new file mode 100644 index 000000000..23aa167cc --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/excl.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/experiment.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/experiment.svg new file mode 100644 index 000000000..9d440a0c0 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/experiment.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/flag.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/flag.svg new file mode 100644 index 000000000..322df6cc4 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/flag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/info.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/info.svg new file mode 100644 index 000000000..85f3b55b8 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/info.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/lightbulb.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/lightbulb.svg new file mode 100644 index 000000000..b95ec62d8 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/lightbulb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/questionmark.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/questionmark.svg new file mode 100644 index 000000000..80aee9ce9 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/questionmark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/quote.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/quote.svg new file mode 100644 index 000000000..1e215b4f2 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/quote.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/simple-graph.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/simple-graph.svg new file mode 100644 index 000000000..913a1be30 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/simple-graph.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/task.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/task.svg new file mode 100644 index 000000000..7ebfd0fcc --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/task.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/tip.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/tip.svg new file mode 100644 index 000000000..e0e8c07a0 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/tip.svg @@ -0,0 +1,79 @@ + + + + diff --git a/packages/preview/gentle-clues/1.2.0/lib/assets/warning.svg b/packages/preview/gentle-clues/1.2.0/lib/assets/warning.svg new file mode 100644 index 000000000..a86313bd0 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/assets/warning.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/1.2.0/lib/clues.typ b/packages/preview/gentle-clues/1.2.0/lib/clues.typ new file mode 100644 index 000000000..b79758b9a --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/clues.typ @@ -0,0 +1,329 @@ +// gentle-clues + +// Helper +#let if-auto-then(val,ret) = { + if (val == auto){ + ret + } else { + val + } +} + +// Global states +#let __gc_clues_breakable = state("breakable", false) +#let __gc_clues_headless = state("headless", false) +#let __gc_clue_width = state("clue-width", auto) +#let __gc_header_inset = state("header-inset", 0.5em) +#let __gc_content_inset = state("content-inset", 1em) +#let __gc_border_radius = state("border-radius", 2pt) +#let __gc_border_width = state("border-width", 0.5pt) +#let __gc_stroke_width = state("stroke-width", 2pt) +#let __gc_title_font = state("title-font", auto) +#let __gc_title_weight_delta = state("title-weight-delta", 200) + + +/// Config the default settings for all clues globally. +/// +/// *Example:* +/// Change the default settings for all clues. +/// #figure( +/// ```example +/// #show: gentle-clues.with( +/// headless: true, +/// stroke-width: 6pt, +/// width: 5.5cm, +/// ) +/// #clue[With changed default settings.] +/// ```, +/// supplement: "Example" +/// ) +/// +/// -> content +#let gentle-clues( + /// defines if clues break across pages by default. + /// -> boolean + breakable: false, + /// defines if clues should be shown without a header by default. + /// -> boolean + headless: false, + /// defines the default header-inset for all clues. + /// -> length + header-inset: 0.5em, + /// defines the default width for all clues. + /// -> auto | length + width: auto, + /// defines the default stroke width of the left colored stroke for all clues. + /// -> length + stroke-width: 2pt, + /// defines the default border radius for all clues. + /// -> length + border-radius: 2pt, + /// defines the default border width for all clues. + /// -> length + border-width: 0.5pt, + /// defines the default content inset of the body for all clues. + /// -> length + content-inset: 1em, + /// defines the default font for the title + /// -> auto | string + title-font: auto, + /// defines the default weight offset for the title + /// -> int + title-weight-delta: 200, + body +) = { + + // Update breakability + __gc_clues_breakable.update(breakable); + + // Update clues width + __gc_clue_width.update(width); + + // Update headless state + __gc_clues_headless.update(headless); + + // Update header inset + __gc_header_inset.update(header-inset); + + // Update border radius + __gc_border_radius.update(border-radius); + + // Update border width + __gc_border_width.update(border-width); + + // Update stroke width + __gc_stroke_width.update(stroke-width); + + // Update content inset + __gc_content_inset.update(content-inset); + + // Update title font + __gc_title_font.update(title-font); + + // Update title weight delta + __gc_title_weight_delta.update(title-weight-delta); + + body + + } + +/// Basic gentle-clue (clue) template function. +/// +/// This function can be used to create custom clues. You can pass all of this parameters to the predefined clues (@predefined) as well to overwrite the default settings. +/// If an argument is `auto` it will fallback to the value which is specified in @gentle-clues +/// +/// *Example:* +/// ```example +/// #clue(title:"Test")[Some important content.] +/// ``` +/// #figure(``, supplement: "Section") +/// +/// +/// -> content +#let clue( + /// Content inside the body. + /// -> content + content, + /// The title of the clue. If `none` the header is ommited. + /// ```example + /// #clue(title:"My title")[Some important content.] + /// ``` + /// + /// -> string | none + title: none, + /// The icon to show in front of the title. + /// ```example + /// #clue(title:"with icon", icon: emoji.ticket)[Some important content.] + /// ``` + /// + /// -> none | image | symbol + icon: none, + + /// The accent color defines the color of the stroke on the left side. + /// If border-color and header-color are set to auto those get derived from the accent color. + /// ```example + /// #clue(title:"red accent", accent-color: red)[Some important content.] + /// ``` + /// + /// -> color | gradient | tiling + accent-color: navy, + /// The background color of the header. + /// ```example + /// #clue(title:"green header", header-color: green.lighten(50%))[Some important content.] + /// ``` + /// + /// -> auto | color | gradient | tiling + header-color: auto, + /// The color of the small border on the bottom and right side. + /// if in headless mode also for the top border. + /// ```example + /// #clue(title: "blue borders", border-color: blue)[Some important content.] + /// ``` + /// + /// -> auto | color | gradient | tiling + border-color: auto, + /// The background color of the body + /// ```example + /// #clue(title:"pink body", body-color: fuchsia.lighten(50%))[Some important content.] + /// ``` + /// + /// -> none | color | gradient | tiling + body-color: none, + + /// The total width of the clue. + /// ```example + /// #clue(title:"4 cm wide", width: 4cm)[Some small content.] + /// ``` + /// + /// -> auto | length + width: auto, + /// The border radius on the right side. + /// ```example + /// #clue(title:"rounded", radius: 10pt)[Some important content.] + /// ``` + /// + /// -> auto | length + radius: auto, + /// Defines the width of the border. + /// ```example + /// #clue(title:"thick", border-width: 5pt, border-color: orange)[Some important content.] + /// ``` + /// + /// -> auto | length + border-width: auto, + /// Defines the width of the stroke on the left side. + /// ```example + /// #clue(title:"big", stroke-width: 5pt,)[Some important content.] + /// ``` + /// + /// -> auto | length + stroke-width: auto, + + /// The inset for the content body. + /// ```example + /// #clue(title:"squeeze", content-inset: 1pt)[Some important content.] + /// ``` + /// + /// -> auto | length + content-inset: auto, + /// Defines the inset for the header + /// ```example + /// #clue(title:"tight", header-inset: 1pt)[Some important content.] + /// ``` + /// + /// -> auto | length + header-inset: auto, + /// The font which is used for the title. + /// ```example + /// #clue(title:"styled", title-font:"New Computer Modern" )[Some important content.] + /// ``` + /// + /// -> auto | string + title-font: auto, + /// The weight delta which is used for the title. Output depends on the used font. + /// ```example + /// #clue(title:"fat", title-weight-delta: 500)[Some important content.] + /// ``` + /// + /// -> auto | int + title-weight-delta: auto, + + /// Defines if the clue is breakable. If `auto` it falls back to the default settings. See @gentle-clues + /// -> auto | boolean + breakable: auto, + /// Defines if clues should be shown without a header. If `auto` it falls back to the default settings. See @gentle-clues + /// ```example + /// #clue(title:"fat", headless: true)[Some important content.] + /// ``` + /// + /// -> boolean + headless: auto, +) = { + // check color types + assert(type(accent-color) in (color, gradient, tiling), message: "expected color, gradient or tiling found " + str(type(accent-color))); + + if (header-color != auto) { + assert(type(header-color) in (color, gradient, tiling), message: "expected color, gradient or tiling found " + str(type(header-color))); + } + if (border-color != auto) { + assert(type(border-color) in (color, gradient, tiling), message: "expected color, gradient or tiling, found " + str(type(border-color))); + } + if (body-color != none) { + assert(type(body-color) in (color, gradient, tiling), message: "expected color, gradient or tiling, found " + str(type(body-color))); + } + + context { + // Set default color: + let _stroke-color = accent-color; + let _header-color = if-auto-then(header-color, accent-color) + let _border-color = if-auto-then(border-color, accent-color) + + // setting bg and stroke color from color argument + if (type(accent-color) == color) { + _header-color = if-auto-then(header-color, accent-color.lighten(85%)); + _border-color = if-auto-then(border-color, accent-color.lighten(70%)); + } + + let _border-width = if-auto-then(border-width, __gc_border_width.get()); + let _border-radius = if-auto-then(radius, __gc_border_radius.get()) + let _stroke-width = if-auto-then(stroke-width, __gc_stroke_width.get()) + let _title-weight-delta = if-auto-then(title-weight-delta, __gc_title_weight_delta.get()) + let _title-font = if-auto-then(title-font, if-auto-then(__gc_title_font.get(), text.font)) + let _clip-content = true + let _title-content = strong(delta: _title-weight-delta, text(font: _title-font, title)) + + // Header Part + let header-block = block( + sticky: true, + below: 0pt, + fill: _header-color, + width: 100%, + radius: (top-right: _border-radius), + inset: if-auto-then(header-inset, __gc_header_inset.get()), + stroke: (right: _border-width + _header-color ) + )[ + #if icon == none { _title-content } else { + grid( + columns: (auto, auto), + align: (horizon, left + horizon), + gutter: 1em, + box(height: 1em)[ #icon ], + _title-content + ) + } + ] + + // Content-Box + let content-block(content) = block( + breakable: if-auto-then(breakable, __gc_clues_breakable.get()), + width: 100%, + fill: body-color, + inset: if-auto-then(content-inset, __gc_content_inset.get()), + radius: ( + top-left: 0pt, + bottom-left: 0pt, + top-right: if (title != none){0pt} else {_border-radius}, + rest: _border-radius + ), + above: 0pt, + )[#content] + + // Wrapper-Block + return block( + breakable: if-auto-then(breakable, __gc_clues_breakable.get()), + width: if-auto-then(width, __gc_clue_width.get()), + inset: (left: 1pt), + radius: (right: _border-radius, left: 0pt), + stroke: ( + left: (thickness: _stroke-width, paint: _stroke-color, cap: "butt"), + top: if (title != none){_border-width + _header-color} else {_border-width + _border-color}, + rest: _border-width + _border-color, + ), + clip: _clip-content, + )[ + #set align(start) + #if if-auto-then(headless, __gc_clues_headless.get()) == false and title != none { header-block } + #content-block(content) + ] // wrapper block end + } +} diff --git a/packages/preview/gentle-clues/1.2.0/lib/lang.toml b/packages/preview/gentle-clues/1.2.0/lib/lang.toml new file mode 100644 index 000000000..dbec2b507 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/lang.toml @@ -0,0 +1,162 @@ +[conf] +default-lang = "en" + +[lang.en] +abstract = "Abstract" +info = "Info" +question = "Question" +memo = "Memorize" +task = "Task" +conclusion = "Conclusion" +tip = "Tip" +success = "Success" +warning = "Warning" +error = "Error" +example = "Example" +quote = "Quote" +goal = "Goal" +idea = "Idea" +experiment = "Experiment" +notify = "Notification" +code = "Code" +danger = "Danger" + +[lang.de] +abstract = "Einführung" +info = "Info" +question = "Frage" +memo = "Merke" +task = "Aufgabe" +conclusion = "Zusammenfassung" +tip = "Tipp" +success = "Erledigt" +warning = "Achtung" +error = "Fehler" +example = "Beispiel" +quote = "Zitat" +goal = "Ziel" +idea = "Idee" +experiment = "Experiment" +notify = "Mitteilung" +code = "Code" +danger = "Gefahr" + +[lang.es] +abstract = "Resumen" +info = "Info" +question = "Pregunta" +memo = "Recordatorio" +task = "Tarea" +conclusion = "Conclusión" +tip = "Consejo" +success = "Éxito" +warning = "Advertencia" +error = "Error" +example = "Ejemplo" +quote = "Cita" +goal = "Objectivo" +idea = "Idea" +experiment = "Experimento" +notify = "Notificación" +code = "Código" +danger = "Peligro" + +[lang.fr] +abstract = "Résumé" +info = "Info" +question = "Question" +memo = "À retenir" +task = "Tâche" +conclusion = "Conclusion" +tip = "Conseil" +success = "Succès" +warning = "Avertissement" +error = "Erreur" +example = "Exemple" +quote = "Citation" +goal = "Objectif" +idea = "Idée" +experiment = "Expérience" +notify = "Notification" +code = "Code" +danger = "Danger" + +[lang.hu] +abstract = "Kivonat" +info = "Információ" +question = "Kérdés" +memo = "Emlékeztető" +task = "Feladat" +conclusion = "Következtetés" +tip = "Tipp" +success = "Siker" +warning = "Figyelmeztetés" +error = "Hiba" +example = "Példa" +quote = "Idézet" +goal = "Cél" +idea = "Ötlet" +experiment = "Kísérlet" +notify = "Értesítés" +code = "Kód" +danger = "Veszély" + +[lang.zh] +abstract = "摘要" +info = "信息" +question = "问题" +memo = "备忘" +task = "任务" +conclusion = "结论" +tip = "提示" +success = "成功" +warning = "警告" +error = "错误" +example = "例子" +quote = "引述" +goal = "目标" +idea = "想法" +experiment = "实验" +notify = "通知" +code = "代码" +danger = "危险" + +[lang.it] +abstract = "Abstract" +info = "Informazione" +question = "Domanda" +memo = "Memorizza" +task = "Compito" +conclusion = "Conclusione" +tip = "Suggerimento" +success = "Successo" +warning = "Avvertimento" +error = "Errore" +example = "Esempio" +quote = "Citazione" +goal = "Obiettivo" +idea = "Idea" +experiment = "Esperimento" +notify = "Notifica" +code = "Codice" +danger = "Pericolo" + +[lang.cs] +abstract = "Abstrakt" +info = "Info" +question = "Otázka" +memo = "Memorizuj" +task = "Úkol" +conclusion = "Závěr" +tip = "Tip" +success = "Úspěch" +warning = "Varování" +error = "Chyba" +example = "Příklad" +quote = "Citace" +goal = "Cíl" +idea = "Nápad" +experiment = "Pokus" +notify = "Upozornění" +code = "Kód" +danger = "Nebezpečí" diff --git a/packages/preview/gentle-clues/1.2.0/lib/lib.typ b/packages/preview/gentle-clues/1.2.0/lib/lib.typ new file mode 100644 index 000000000..9ab708923 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/lib.typ @@ -0,0 +1,4 @@ +#import "clues.typ" +#import "clues.typ": gentle-clues, clue +#import "predefined.typ" +#import "predefined.typ": * diff --git a/packages/preview/gentle-clues/1.2.0/lib/predefined.typ b/packages/preview/gentle-clues/1.2.0/lib/predefined.typ new file mode 100644 index 000000000..a194f5892 --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/predefined.typ @@ -0,0 +1,218 @@ +#import "@preview/linguify:0.4.2": * +#import "clues.typ": clue, if-auto-then +#import "theme.typ": catppuccin as theme + +// load linguify language database +#let lang-database = toml("lang.toml") + +/// Helper for fetching the translated title +#let _get-title-for(id) = { + assert.eq(type(id),str); + return linguify(id, from: lang-database, default: linguify(id, lang: "en", default: id)); +} + +/// Helper to get the accent-color from the theme +/// -> color +#let _get-accent-color-for( + /// The id for the predefined clue. + /// -> string + id +) = { + return theme.at(id).accent-color +} + +/// Helper to get the icon from the theme +/// -> content +#let _get-icon-for( + /// The id for the predefined clue. + /// -> string + id +) = { + let icon = theme.at(id).icon + if type(icon) == str { + return image("assets/" + theme.at(id).icon, fit: "contain") + } else { + return icon + } +} + +/// Wrapper function for all predefined clues. +/// -> clue +#let _predefined-clue( + /// The id of the clue from which color, icon and default title will be calculated. + /// -> string + id, + /// for overwriting the default parameter of a clue. + /// -> parameter + ..args +) = clue( + accent-color: _get-accent-color-for(id), + title: _get-title-for(id), + icon: _get-icon-for(id), + ..args +) + + +/// #docs-info("abstract") +/// ```example +/// #abstract[Make it short. This is all you need.] +/// ``` +/// -> content +#let abstract( + /// Supports all parameters of @clue. + /// -> arguments + ..args +) = _predefined-clue("abstract",..args) + +/// #docs-info("info") +/// ```example +/// #info[Whatever you want to say] +/// ``` +/// -> content +#let info(..args) = _predefined-clue("info",..args) + +/// #docs-info("notify") +/// Notificaton +/// ```example +/// #notify[New features in future versions.] +/// ``` +/// -> content +#let notify(..args) = _predefined-clue("notify",..args) + +/// #docs-info("success") +/// ```example +/// #success[All tests passed. It's worth a try.] +/// ``` +/// -> content +#let success(..args) = _predefined-clue("success",..args) + +/// #docs-info("warning") +/// ```example +/// #warning[Still a work in progress.] +/// ``` +/// -> content +#let warning(..args) = _predefined-clue("warning",..args) + +/// #docs-info("danger") +/// ```example +/// #danger[Be carefull.] +/// ``` +/// -> content +#let danger(..args) = _predefined-clue("danger",..args) + +/// #docs-info("error") +/// ```example +/// #error[Something did not work here.] +/// ``` +/// -> content +#let error(..args) = _predefined-clue("error",..args) + +/// #docs-info("tip") +/// ```example +/// #tip[Check out this cool package] +/// ``` +/// -> content +#let tip(..args) = _predefined-clue("tip",..args) + +/// #docs-info("goal") +/// ```example +/// #goal[Beatuify your document!] +/// ``` +/// -> content +#let goal(..args) = _predefined-clue("goal",..args) + +/// #docs-info("question") +/// ```example +/// #question[How do amonishments work?] +/// ``` +/// -> content +#let question(..args) = _predefined-clue("question",..args) + +/// #docs-info("idea") +/// ```example +/// #idea[Some content] +/// ``` +/// -> content +#let idea(..args) = _predefined-clue("idea",..args) + +/// #docs-info("example") +/// ```example +/// #example[Lets make something beautifull.] +/// ``` +/// -> content +#let example(..args) = _predefined-clue("example",..args) + +/// #docs-info("experiment") +/// ```example +/// #experiment[Try this ...] +/// ``` +/// -> content +#let experiment(..args) = _predefined-clue("experiment",..args) + +/// #docs-info("conclusion") +/// ```example +/// #conclusion[This package makes it easy to add some beatufillness to your documents.] +/// ``` +/// -> content +#let conclusion(..args) = _predefined-clue("conclusion",..args) + +/// #docs-info("memo") +/// ```example +/// #memo[Leave a #emoji.star on github.] +/// ``` +/// -> content +#let memo(..args) = _predefined-clue("memo",..args) + +/// #docs-info("code") +/// ```example +/// #code[`#let x = "secret"`] +/// ``` +/// -> content +#let code(..args) = _predefined-clue("code",..args) + +/// #docs-info("quote") +/// ```example +/// #quotation(attribution: "The maintainer")[Keep it simple. Admonish your life.] +/// ``` +/// -> content +#let quotation( + /// The author of the quote + /// -> string | none + attribution: none, + /// the quote itself + /// -> content + content, + /// Supports all parameter from @clue. + /// -> arguments + ..args) = _predefined-clue("quote",..args)[ + #quote(block: true, attribution: attribution)[#content] +] + +#let gc-task-counter = counter("gc-task-counter") +#let gc-task-counter-enabled = state("gc-task-counter", true) + +#let increment-task-counter() = { + context { + if (gc-task-counter-enabled.get() == true){ + gc-task-counter.step() + } + } +} + +#let get-task-number() = { + context { + if (gc-task-counter-enabled.get() == true){ + " " + gc-task-counter.display() + } + } +} + +/// #docs-info("task") +/// ```example +/// #task[Check out this wonderful typst package!] +/// ``` +/// -> content +#let task(..args) = { + increment-task-counter() + _predefined-clue("task", title: _get-title-for("task") + get-task-number(), ..args) +} diff --git a/packages/preview/gentle-clues/1.2.0/lib/theme.typ b/packages/preview/gentle-clues/1.2.0/lib/theme.typ new file mode 100644 index 000000000..69a5d328e --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/lib/theme.typ @@ -0,0 +1,80 @@ +// theme file for gentle clues + +// catppuccin based theme (default) +// https://catppuccin.com/palette +#let catppuccin = ( + info: ( + accent-color: rgb(4, 165, 229), // sky #04a5e5 + icon: "info.svg" + ), + notify: ( + accent-color: rgb(30, 102, 245), //blue #1e66f5 + icon:"bell.svg" + ), + success: ( + accent-color: rgb(64, 160, 43), // green #40a02b + icon:"checkbox.svg" + ), + warning: ( + accent-color: rgb(223, 142, 29), // yellow #df8e1d + icon:"warning.svg" + ), + danger: ( + accent-color: rgb(254, 100, 11), // peach #fe640b + icon:"danger.svg" + ), + error: ( + accent-color: rgb(210, 15, 57), // red #d20f39 + icon:"crossmark.svg" + ), + task: ( + accent-color: rgb(136, 57, 239), // mauve #8839ef + icon:"task.svg" + ), + tip: ( + accent-color: rgb(23, 146, 153), // teal #179299 + icon:"tip.svg" + ), + abstract: ( + accent-color: rgb(32, 159, 181), // saphire #209fb5 + icon:"abstract.svg" + ), + conclusion: ( + accent-color: rgb(221, 120, 120), // flamingo #dd7878 + icon:"conclusion.svg" + ), + memo: ( + accent-color: rgb(230, 69, 83), // maroon #e64553 + icon:"excl.svg" + ), + question: ( + accent-color: rgb(23, 146, 153), // teal #179299 + icon:"questionmark.svg" + ), + quote: ( + accent-color: rgb(114, 135, 253), // lavender #7287fd + icon:"quote.svg" + ), + example: ( + accent-color: rgb(220, 138, 120), // rosewater #dc8a78 + icon:"simple-graph.svg" + ), + experiment: ( + accent-color: rgb(220, 138, 120), // rosewater #dc8a78 + icon:"experiment.svg" + ), + goal: ( + accent-color: rgb(230, 69, 83), // maroon #e64553 + icon:"flag.svg" + ), + + code: ( + accent-color: rgb(114, 135, 253), // lavender #7287fd + icon:"code.svg" + ), + idea: ( + accent-color: rgb(223, 142, 29), // yellow #df8e1d + icon:"lightbulb.svg" + ), + +) diff --git a/packages/preview/gentle-clues/1.2.0/typst.toml b/packages/preview/gentle-clues/1.2.0/typst.toml new file mode 100644 index 000000000..2251c457b --- /dev/null +++ b/packages/preview/gentle-clues/1.2.0/typst.toml @@ -0,0 +1,12 @@ +[package] +name = "gentle-clues" +version = "1.2.0" +entrypoint = "lib/lib.typ" +authors = ["Jomaway "] +license = "MIT" +description = "A package to simply create and add some admonitions to your documents." +repository = "https://github.com/jomaway/typst-gentle-clues" +keywords = ["admonitions", "boxes", "gentle-clues"] +categories = ["components", "visualization"] +compiler = "0.13.0" +exclude = ["docs.typ","docs.pdf","gc-overview.typ","justfile", "minify-icons.sh", "CHANGELOG.md",]