From dbdd2cb6f95d32f65d63696ad7e1faf1d994224f Mon Sep 17 00:00:00 2001 From: jomaway Date: Sun, 7 Jan 2024 23:43:32 +0100 Subject: [PATCH] Added gentle-clues 0.5.0 --- packages/preview/gentle-clues/0.5.0/LICENSE | 21 + packages/preview/gentle-clues/0.5.0/README.md | 120 + .../gentle-clues/0.5.0/assets/abstract.svg | 1 + .../gentle-clues/0.5.0/assets/bell.svg | 1 + .../gentle-clues/0.5.0/assets/bookmark.svg | 1 + .../gentle-clues/0.5.0/assets/checkbox.svg | 1 + .../0.5.0/assets/cleanup-script.sh | 7 + .../gentle-clues/0.5.0/assets/crossmark.svg | 1 + .../gentle-clues/0.5.0/assets/danger.svg | 1 + .../gentle-clues/0.5.0/assets/example.svg | 1 + .../gentle-clues/0.5.0/assets/excl.svg | 1 + .../gentle-clues/0.5.0/assets/flag.svg | 1 + .../gentle-clues/0.5.0/assets/info.svg | 1 + .../gentle-clues/0.5.0/assets/lightbulb.svg | 1 + .../0.5.0/assets/questionmark.svg | 1 + .../gentle-clues/0.5.0/assets/quote.svg | 1 + .../gentle-clues/0.5.0/assets/task.svg | 1 + .../preview/gentle-clues/0.5.0/assets/tip.svg | 79 + .../gentle-clues/0.5.0/assets/warning.svg | 1 + packages/preview/gentle-clues/0.5.0/docs.typ | 110 + .../gentle-clues/0.5.0/gc_overview.svg | 8387 +++++++++++++++++ .../gentle-clues/0.5.0/gentle-clues.typ | 249 + .../preview/gentle-clues/0.5.0/typst.toml | 11 + 23 files changed, 8999 insertions(+) create mode 100644 packages/preview/gentle-clues/0.5.0/LICENSE create mode 100644 packages/preview/gentle-clues/0.5.0/README.md create mode 100644 packages/preview/gentle-clues/0.5.0/assets/abstract.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/bell.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/bookmark.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/checkbox.svg create mode 100755 packages/preview/gentle-clues/0.5.0/assets/cleanup-script.sh create mode 100644 packages/preview/gentle-clues/0.5.0/assets/crossmark.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/danger.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/example.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/excl.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/flag.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/info.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/lightbulb.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/questionmark.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/quote.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/task.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/tip.svg create mode 100644 packages/preview/gentle-clues/0.5.0/assets/warning.svg create mode 100644 packages/preview/gentle-clues/0.5.0/docs.typ create mode 100644 packages/preview/gentle-clues/0.5.0/gc_overview.svg create mode 100644 packages/preview/gentle-clues/0.5.0/gentle-clues.typ create mode 100644 packages/preview/gentle-clues/0.5.0/typst.toml diff --git a/packages/preview/gentle-clues/0.5.0/LICENSE b/packages/preview/gentle-clues/0.5.0/LICENSE new file mode 100644 index 000000000..17c40758e --- /dev/null +++ b/packages/preview/gentle-clues/0.5.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/0.5.0/README.md b/packages/preview/gentle-clues/0.5.0/README.md new file mode 100644 index 000000000..da30d197b --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/README.md @@ -0,0 +1,120 @@ +# gentle-clues + +Simple admonitions for typst. Add predefined or define your own. + +Inspired from [mdbook-admonish](https://tommilligan.github.io/mdbook-admonish/). + + +## Usage + +`#import "@preview/gentle-clues:0.5.0": *` + +Overview of the predefined clues: + +![Overview of the predefined clues](gc_overview.svg) + +To use the *info* one, it is as easy as writing +```typst + #info[ This is the info clue ... ] +``` + + +### Change header title language + +You can change the default language for the header titles by + +```typst + #gc_header-title-lang.update("de") +``` +At the moment valid options are: "en","de" and "fr" + +### Available Clues + +The follwing clues/admonitions (+ some aliases) are available at the moment. `abstract`, `info`, `question`, `memo`, `task`, `idea`, `tip`, `quote`, `success`, `warning`, `error`, `example`. + +[See here for more Information](https://github.com/jomaway/typst-admonish/blob/main/docs.pdf) + +### Define your own + +But it is very easy to define your own. + +```typst +//When you import the package, include clue +#import "@preview/gentle-clues:0.5.0": clue + +//Define it +#let ghost-admon(..args) = clue( + title: "Buuuuh", + _color: gray, + icon: emoji.ghost, + ..args +) +// Use it +#ghost-admon[Huuuuuh.] +``` + +The icon can be an `emoji`, `symbol` or `.svg`-file. + +### Reference + +Here the full reference to the admonish function. + +```typst +clue( + body, + title: none, // Default: none, or string + icon: "assets/flag.svg", // can be a file or an symbol|emoji + _color: "gray", // `_` due to naming conflicts with the type color. + width: auto, + radius: 2pt, // radius of the right side. For no radius set to 0pt. + inset: 1em, // inset of the content, header-inset not yet supported + header-inset: 0.5em, // define header inset. +) +``` + +## License + +MIT + +# Changelog + +## v0.5.0 (latest) + +- Added option `breakable: true` to make clues breakable . +- Added spanish header titles. Use with `#gc_header-title-lang.update("es")` +- Removed aliases (breaking) + +## v0.4.0 + +- Added french header titles. Use with `#gc_header-title-lang.update("fr")` +- Fixed minor border issues +- Added an task-counter (disable with `gc_enable-task-counter.update(false)`) + +*Colors:* + +- Changed default color to `navy` +- Changed border-color + - Fixed bug that it was sometimes no longer visible after `typst 0.9.0` update. + - Default is now the same as `bg-color` + - Set via color-dict `border` field. +- Added support for gradients: `#clue(_color: gradient.linear(..color.map.crest))` +- *Breaking:* Removed string color_profiles. +- Changed some predefined colors. + +## v0.3.0 + +- renamed entry files and base template +- default `header-inset` is `0.5em` now. +- added `gc_header-title-lang` state, which defines the language of the title. + - Update with `#gc_header-title-lang.update("en")` + - Accepts `"de"` or `"en"` at the moment. +- Using new `type` checks which requires typst version `0.8.0` +- renamed Parameter `color` to `_color` due to naming conflicts with the color type. + +## v0.2.0 + +- set header inset. `#admonish(header-inset: 0.5em)` +- custom color: `#admonish(color: (stroke: luma(150), bg: teal))` +- new example admonition: `#example[Testing]` + #example(header-inset: 0.8em)[Testing] + diff --git a/packages/preview/gentle-clues/0.5.0/assets/abstract.svg b/packages/preview/gentle-clues/0.5.0/assets/abstract.svg new file mode 100644 index 000000000..fafda4dce --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/abstract.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/bell.svg b/packages/preview/gentle-clues/0.5.0/assets/bell.svg new file mode 100644 index 000000000..3f11f25eb --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/bell.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/bookmark.svg b/packages/preview/gentle-clues/0.5.0/assets/bookmark.svg new file mode 100644 index 000000000..fac3c8cd5 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/bookmark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/checkbox.svg b/packages/preview/gentle-clues/0.5.0/assets/checkbox.svg new file mode 100644 index 000000000..7fe6e8726 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/checkbox.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/cleanup-script.sh b/packages/preview/gentle-clues/0.5.0/assets/cleanup-script.sh new file mode 100755 index 000000000..32350977b --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/cleanup-script.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +for f in ./*.svg; +do + echo "Processing $f file..." + svgcleaner $f $f +done diff --git a/packages/preview/gentle-clues/0.5.0/assets/crossmark.svg b/packages/preview/gentle-clues/0.5.0/assets/crossmark.svg new file mode 100644 index 000000000..688ea1834 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/crossmark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/danger.svg b/packages/preview/gentle-clues/0.5.0/assets/danger.svg new file mode 100644 index 000000000..14dc19132 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/danger.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/example.svg b/packages/preview/gentle-clues/0.5.0/assets/example.svg new file mode 100644 index 000000000..9d440a0c0 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/example.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/excl.svg b/packages/preview/gentle-clues/0.5.0/assets/excl.svg new file mode 100644 index 000000000..23aa167cc --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/excl.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/flag.svg b/packages/preview/gentle-clues/0.5.0/assets/flag.svg new file mode 100644 index 000000000..322df6cc4 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/flag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/info.svg b/packages/preview/gentle-clues/0.5.0/assets/info.svg new file mode 100644 index 000000000..85f3b55b8 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/info.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/lightbulb.svg b/packages/preview/gentle-clues/0.5.0/assets/lightbulb.svg new file mode 100644 index 000000000..b95ec62d8 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/lightbulb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/questionmark.svg b/packages/preview/gentle-clues/0.5.0/assets/questionmark.svg new file mode 100644 index 000000000..80aee9ce9 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/questionmark.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/quote.svg b/packages/preview/gentle-clues/0.5.0/assets/quote.svg new file mode 100644 index 000000000..1e215b4f2 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/quote.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/task.svg b/packages/preview/gentle-clues/0.5.0/assets/task.svg new file mode 100644 index 000000000..7ebfd0fcc --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/task.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/assets/tip.svg b/packages/preview/gentle-clues/0.5.0/assets/tip.svg new file mode 100644 index 000000000..e0e8c07a0 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/tip.svg @@ -0,0 +1,79 @@ + + + + diff --git a/packages/preview/gentle-clues/0.5.0/assets/warning.svg b/packages/preview/gentle-clues/0.5.0/assets/warning.svg new file mode 100644 index 000000000..a86313bd0 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/assets/warning.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/preview/gentle-clues/0.5.0/docs.typ b/packages/preview/gentle-clues/0.5.0/docs.typ new file mode 100644 index 000000000..e9eb70776 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/docs.typ @@ -0,0 +1,110 @@ +#import "@local/gentle-clues:0.4.1": * +#gc_header-title-lang.update("en") + +#set text(font: "Roboto") + += Gentle clues for typst + +Add some beautiful, predefined admonitions or define your own. + +#clue(title: "Example")[ +```typst +#clue(title: "Example")[Test content.] +``` +#sym.arrow The default is a navy colored clue. +] + +#info(title: "NEW v0.4.0",_color: gradient.linear(..color.map.crest))[ + * Translations:* + - French language titles: `gc_header-title-lang.update("fr")` + + *Colors:* + - Colored borders by default. + - Added support for gradients: `#clue(_color: gradient.linear(..color.map.crest))` + - *Breaking:* Removed string color_profiles. + + *Task Counter* + - Added a Task Counter. + - Disable with `#gc_enable-task-counter.update(false)` + #set text(9pt) + #grid( columns: 4, gutter: 1em, task[Do], task[Do], task[Do]) + + +] + +#info(title: "Options")[ + - Changing header title language with: `gc_header-title-lang.update("en")` + - Accepts `"en", "de"` or `"fr"` for the moment. + - define header inset: `#clue(header-inset: 0.5em)[]` + - define header title: `#clue(title: "MyTitle")[]` + - define custom color: + - `#clue(_color: red)[]` + - `#clue(_color: (stroke: teal, bg: teal.lighten(40%), border: red))[]` + - define the width: `#clue(width: 4cm)[]` + - define right border radius: `#clue(radius: 9tp)[]` #text(9pt, fill: gray)[(`0pt` to disable)] + - make clues break onto next page -> `breakable: true` +] + +#success(title: "Clues can now break onto the next page")[ + #lorem(80) +] + +== Predefined +`abstract`, `summary`, `tldr` +#abstract[Make it short. This is all you need.] + +`question`, `faq`, `help` +#faq[How do amonishments work?] + +`note`, `info` +#note[It's as easy as +```typst + #note[Whatever you want to say] + ``` +] + +`example`, +#example[Testing ...] + +`task`, `todo` +#task[#box(width: 0.8em, height: 0.8em, stroke: 0.5pt + black, radius: 2pt) Check out this wonderfull admonishments!] + +`error`, `failure`, `missing` +#error[Something did not work here.] + +`warning`, `attention`, `caution`, +#warning[Still a work in progress.] + +`success`, `check`, `done` +#success[All tests passed. It's worth a try.] + +`tip`, `hint`, `important` +#tip[Try it yourself] + + + +`conclusion`,`idea` +#conclusion[This package makes it easy to add some beatufillness to your documents] + +`reminder` +#memo[Leave a #emoji.star on github.] + +`quote` +#quote[Keep it simple. Admonish your life.] + +== Headless + +just add `title: none` to any example + +#info(title:none)[Just a short information.] + +== Define your own + +```typst +// Define it +#let ghost-admon(title: "Buuuuuuh", icon: emoji.ghost , ..args) = clue(color: purple, title: title, icon: icon, ..args) +// Use it +#ghost-admon[Huuuuuuh.] +``` +#let ghost-admon(title: "Buuuuuuh.", icon: emoji.ghost , ..args) = clue(_color: gray, title: title, icon: icon, ..args) +#ghost-admon[Huuuuuuh.] diff --git a/packages/preview/gentle-clues/0.5.0/gc_overview.svg b/packages/preview/gentle-clues/0.5.0/gc_overview.svg new file mode 100644 index 000000000..879af8194 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/gc_overview.svg @@ -0,0 +1,8387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/preview/gentle-clues/0.5.0/gentle-clues.typ b/packages/preview/gentle-clues/0.5.0/gentle-clues.typ new file mode 100644 index 000000000..437ed51d3 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/gentle-clues.typ @@ -0,0 +1,249 @@ +// gentle-clues + +#let gc_header-title-lang = state("lang", "en") +#let gc_task-counter = counter("gc-task-counter") +#let gc_enable-task-counter = state("gc-task-counter", true) + +#let title_dict = ( + abstract: (de: "Einführung", en: "Abstract", fr: "Résumé", es: "Resumen"), + info: (de: "Info", en: "Info", fr: "Info", es: "Info"), + question: (de: "Frage", en: "Question", fr: "Question", es: "Pregunta"), + memo: (de: "Merke", en: "Memorize", fr: "À retenir", es: "Recordatorio"), + task: (de: "Aufgabe", en: "Task", fr: "Tâche", es: "Tarea"), + conclusion: (de: "Zusammenfassung", en: "Conclusion", fr: "Conclusion", es: "Conclusión"), + tip: (de: "Tipp", en: "Tip", fr: "Conseil", es: "Consejo"), + success: (de: "Erledigt", en: "Success", fr: "Succès", es: "Éxito"), + warning: (de: "Achtung", en: "Warning", fr: "Avertissement", es: "Advertencia"), + error: (de: "Fehler", en: "Error", fr: "Erreur", es: "Error"), + example: (de: "Beispiel", en: "Example", fr: "Exemple", es: "Ejemplo"), + quote: (de: "Zitat", en: "Quote", fr: "Citation", es: "Cita"), +) + +/* + Basic gentle-clue (clue) template +*/ +#let clue( + content, + title: none, // string or none + icon: emoji.magnify.l, // file or symbol + _color: navy, // color profile name + width: auto, // length + radius: 2pt, // length + inset: 1em, // length + header-inset: 0.5em, // length + breakable: true, +) = { + // Set default color: + let stroke-color = luma(70); + let bg-color = stroke-color.lighten(85%); + let border-color = bg-color.darken(10%); // gray.lighten(20%); + let border-width = 0.5pt; + + // setting bg and stroke color from color argument + if (type(_color) == color) { + stroke-color = _color; + bg-color = _color.lighten(85%); + border-color = bg-color.darken(10%); + } else if (type(_color) == dictionary) { + if (_color.keys().contains("stroke")) { + assert(type(_color.stroke) == color, message: "stroke must be of type color"); + stroke-color = _color.stroke; + } + if (_color.keys().contains("bg")) { + assert(type(_color.bg) == color, message: "bg must be of type color"); + bg-color = _color.bg; + border-color = bg-color.darken(10%); + } + if (_color.keys().contains("border")) { + assert(type(_color.border) == color, message: "border must be of type color"); + border-color = _color.border; + } + } else if (type(_color) == gradient) { + stroke-color = _color; + bg-color = _color; + } else { + panic("No valid color type. Use a gradient, color, or specify a dict with (stroke, bg)"); + } + + + // Disable Heading numbering for those headings + set heading(numbering: none, outlined: false, supplement: "Box") + + let header = rect( + fill: bg-color, + width: 100%, + radius: (top-right: radius), + inset: header-inset, + stroke: (right: border-width + bg-color ) + )[ + #grid( + columns: (auto, auto), + gutter: 1em, + box(height: 1em)[ + #if type(icon) == "symbol" { + text(1em,icon) + } else { + image(icon, fit: "contain") + } + ], + align(left + horizon,strong(title)) + ) + ] + + let content-box(content) = block( + breakable: breakable, + width: 100%, + fill: white, + inset: inset, + radius: ( + top-left: 0pt, + bottom-left: 0pt, + top-right: if (title != none){0pt} else {radius}, + rest: radius + ), + )[#content] + + block( + breakable: breakable, + width: width, + inset: (left: 1pt), + radius: (right: radius, left: 0pt), + stroke: ( + left: (thickness: 2pt, paint: stroke-color, cap: "butt"), + top: if (title != none){border-width + bg-color} else {border-width + border-color}, + rest: border-width + border-color, + ), + )[ + #set align(start) + #stack(dir: ttb, + if title != none { header; }, + content-box(content) + ) + ] +} + + +// Predefined gentle clues +#let get_title_for(clue) = { + assert.eq(type(clue),str); + locate(loc => { + let lang = gc_header-title-lang.at(loc) + title_dict.at(clue).at(lang) + }) +} + +#let increment_task_counter() = { + locate(loc => { + if (gc_enable-task-counter.at(loc) == true){ + gc_task-counter.step() + } + }) +} + +#let get_task_number() = { + locate(loc => { + if (gc_enable-task-counter.at(loc) == true){ + " " + gc_task-counter.display() + } + }) +} + + +/* info */ +#let info(title: auto, icon: "assets/info.svg", ..args) = clue( + _color: rgb(29, 144, 208), // blue + title: if (title != auto) { title } else { get_title_for("info") }, + icon: icon, + ..args +) + +/* success */ +#let success(title: auto, icon: "assets/checkbox.svg", ..args) = clue( + _color: rgb(102, 174, 62), // green + title: if (title != auto) { title } else { get_title_for("success") }, + icon: icon, + ..args +) + +/* warning */ +#let warning(title: auto, icon: "assets/warning.svg", ..args) = clue( + _color: rgb(255, 145, 0), // orange + title: if (title != auto) { title } else { get_title_for("warning") }, + icon: icon, + ..args +) + +/* error */ +#let error(title: auto, icon: "assets/crossmark.svg", ..args) = clue( + _color: rgb(237, 32, 84), // red + title: if (title != auto) { title } else { get_title_for("error") }, + icon: icon, + ..args +) + +/* task */ +#let task(title: auto, icon: "assets/task.svg", ..args) = { + increment_task_counter() + clue( + _color: maroon, // purple rgb(158, 84, 159) + title: if (title != auto) { title } else { get_title_for("task") + get_task_number()}, + icon: icon, + ..args + ) +} + +/* tip */ +#let tip(title: auto, icon: "assets/tip.svg", ..args) = clue( + _color: rgb(0, 191, 165), // teal + title: if (title != auto) { title } else { get_title_for("tip") }, + icon: icon, + ..args +) + +/* abstract */ +#let abstract(title: auto, icon: "assets/abstract.svg", ..args) = clue( + _color: olive, // rgb(124, 77, 255), // kind of purple + title: if (title != auto) { title } else { get_title_for("abstract") }, + icon: icon, + ..args +) + +/* conclusion */ +#let conclusion(title: auto, icon: "assets/lightbulb.svg", ..args) = clue( + _color: rgb(255, 201, 23), // yellow + title: if (title != auto) { title } else { get_title_for("conclusion") }, + icon: icon, + ..args +) + +/* memorize */ +#let memo(title: auto, icon: "assets/excl.svg", ..args) = clue( + _color: rgb(255, 82, 82), // kind of red + title: if (title != auto) { title } else { get_title_for("memo") }, + icon: icon, + ..args +) + +/* question */ +#let question(title: auto, icon: "assets/questionmark.svg", ..args) = clue( + _color: rgb("#7ba10a"), // greenish + title: if (title != auto) { title } else { get_title_for("question") }, + icon: icon, + ..args +) + +/* quote */ +#let quote(title: auto, icon: "assets/quote.svg", ..args) = clue( + _color: eastern, + title: if (title != auto) { title } else { get_title_for("quote") }, + icon: icon, + ..args +) + +/* example */ +#let example(title: auto, icon: "assets/example.svg", ..args) = clue( + _color: orange, + title: if (title != auto) { title } else { get_title_for("example") }, + icon: icon, + ..args +) diff --git a/packages/preview/gentle-clues/0.5.0/typst.toml b/packages/preview/gentle-clues/0.5.0/typst.toml new file mode 100644 index 000000000..64ecab4a5 --- /dev/null +++ b/packages/preview/gentle-clues/0.5.0/typst.toml @@ -0,0 +1,11 @@ +[package] +name = "gentle-clues" +version = "0.5.0" +entrypoint = "gentle-clues.typ" +authors = ["Jomaway "] +license = "MIT" +description = "A package to simply create and add some admonitions to your documents." +repository = "https://github.com/jomaway/typst-admonish" +keywords = ["admonitions", "boxes", "gentle-clues"] +compiler = "0.9.0" +exclude = ["docs.typ", "screenshot_info-clue"]