Watch
1
0
Fork
You've already forked packages
0

packages/ at markup-kit dd1e6eb5270e

A snapshot of packages/ in the Weft repository; the official packages are published from these commits.

Markup-Kit-Commit: dd1e6eb5270e62e0c8b6c202b3d01f0da6e00ddc
This commit is contained in:
Weft packages 2026-11-19 20:43:26 +00:00
commit 306b143104
72 changed files with 10915 additions and 0 deletions

8
email/components/A.weft Normal file
View file

@ -0,0 +1,8 @@
/// A link. An address that isn't `http`, `https`, `mailto`, `tel` or `cid` renders as its text.
import { isSafeUrl } from "../template"
prop href: string
prop children: Snippet
---
@if isSafeUrl(href) {<Link
to={Route.url(href)}
class="underline">@render children()</Link>} @else {@render children()}

View file

@ -0,0 +1,18 @@
/// A button. In the text version it is its label and its address.
import type { Color } from "std/color"
import { isSafeUrl } from "../template"
prop url: string
prop label: string
prop color: Color = "#111111"
prop textColor: Color = "#ffffff"
---
@if isSafeUrl(url) {
<Box class="my-5">
<Box class="inline-block rounded-md" style={{ background: color }}>
<Link to={Route.url(url)} class="inline-block px-5 py-3 no-underline font-semibold"><Text
style={{ color: textColor }}>{label}</Text></Link>
</Box>
</Box>
} @else {
<Box class="mb-4">{label}</Box>
}

4
email/components/Em.weft Normal file
View file

@ -0,0 +1,4 @@
/// Italic text.
prop children: Snippet
---
<Box class="inline italic">@render children()</Box>

View file

@ -0,0 +1,9 @@
/// Labels and values, as on a receipt.
prop rows: [string, string][]
---
<Box role="list" class="mb-4">
@for row of rows {
<Box class="flex gap-3 py-1"><Text
class="text-muted-foreground">{row[0]}:</Text> <Text>{row[1]}</Text></Box>
}
</Box>

4
email/components/H1.weft Normal file
View file

@ -0,0 +1,4 @@
/// The largest heading.
prop children: Snippet
---
<Box class="mb-4 text-2xl font-bold">@render children()</Box>

4
email/components/H2.weft Normal file
View file

@ -0,0 +1,4 @@
/// A heading.
prop children: Snippet
---
<Box class="mb-3 text-lg font-bold">@render children()</Box>

3
email/components/Hr.weft Normal file
View file

@ -0,0 +1,3 @@
/// A horizontal rule.
---
<Box role="separator" class="my-5 border-t border-border" />

13
email/components/Img.weft Normal file
View file

@ -0,0 +1,13 @@
/// An image. Use an absolute URL, or `cid:<contentId>` for an attachment sent inline.
import { isSafeUrl } from "../template"
prop src: string
prop alt: string
prop width?: float
---
@if !isSafeUrl(src) {
<Text>{alt}</Text>
} @else if width != null {
<Image src={src} label={alt} class="max-w-full h-auto" style={{ width }} />
} @else {
<Image src={src} label={alt} class="max-w-full h-auto" />
}

8
email/components/Ol.weft Normal file
View file

@ -0,0 +1,8 @@
/// A numbered list, one line for each item.
prop items: string[]
---
<Box role="list" class="mb-4">
@for [i, item] of items.entries() {
<Box class="mb-1">{i + 1}. {item}</Box>
}
</Box>

4
email/components/P.weft Normal file
View file

@ -0,0 +1,4 @@
/// A paragraph.
prop children: Snippet
---
<Box class="mb-4">@render children()</Box>

View file

@ -0,0 +1,4 @@
/// Bold text.
prop children: Snippet
---
<Box class="inline font-bold">@render children()</Box>

8
email/components/Ul.weft Normal file
View file

@ -0,0 +1,8 @@
/// A list, one line for each item.
prop items: string[]
---
<Box role="list" class="mb-4">
@for item of items {
<Box class="mb-1">- {item}</Box>
}
</Box>