astro-awesomeness 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/astro/code-block.astro +2 -2
- package/src/astro/footer.astro +3 -2
- package/src/astro/formatted-date.astro +2 -2
- package/src/astro/header.astro +6 -6
- package/src/astro/pagination.astro +9 -8
- package/src/astro/post-card.astro +4 -4
- package/src/astro/prose.astro +1 -0
- package/src/astro/reading-time.astro +3 -3
- package/src/astro/seo.astro +12 -12
- package/src/astro/table-of-contents.astro +12 -10
- package/src/astro/tag-list.astro +2 -2
- package/src/layouts/base-layout.astro +22 -21
- package/src/layouts/list-layout.astro +19 -9
- package/src/layouts/post-layout.astro +14 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-awesomeness",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Astro 6/7 blog theme with shadcn primitives and a Tailwind v4 preset.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -55,13 +55,13 @@
|
|
|
55
55
|
"@base-ui/react": "^1.6.0",
|
|
56
56
|
"class-variance-authority": "^0.7.1",
|
|
57
57
|
"cn": "^0.2.4",
|
|
58
|
-
"lucide-react": "^1.
|
|
58
|
+
"lucide-react": "^1.40.0",
|
|
59
59
|
"tw-animate-css": "^1.4.0",
|
|
60
|
-
"zod": "^4.4
|
|
60
|
+
"zod": "^4.5.4"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@tailwindcss/postcss": "^4.3.2",
|
|
64
|
-
"@types/node": "^26.4.
|
|
64
|
+
"@types/node": "^26.4.1",
|
|
65
65
|
"@types/react": "^19.2.17",
|
|
66
66
|
"@types/react-dom": "^19.2.5",
|
|
67
67
|
"@vitest/coverage-v8": "^4.1.11",
|
|
@@ -3,12 +3,12 @@ import { Code } from "astro:components";
|
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
6
|
+
class?: string;
|
|
6
7
|
code: string;
|
|
7
8
|
lang?: string;
|
|
8
|
-
class?: string;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const {
|
|
11
|
+
const { class: className = "", code, lang = "ts" } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
<div class={cn("bg-muted border-border overflow-hidden rounded-md border", className)}>
|
|
14
14
|
<Code code={code} lang={lang} theme="github-dark" />
|
package/src/astro/footer.astro
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { cn } from "../lib/cn";
|
|
3
|
+
|
|
3
4
|
type Props = {
|
|
4
|
-
siteTitle: string;
|
|
5
5
|
class?: string;
|
|
6
|
+
siteTitle: string;
|
|
6
7
|
};
|
|
7
8
|
|
|
8
|
-
const {
|
|
9
|
+
const { class: className = "", siteTitle } = Astro.props;
|
|
9
10
|
const year = new Date().getFullYear();
|
|
10
11
|
---
|
|
11
12
|
<footer class={cn("border-border text-muted-foreground mt-16 border-t py-6 text-sm", className)}>
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { formatDate } from "../lib/format-date";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
+
class?: string;
|
|
5
6
|
date: Date;
|
|
6
7
|
locale?: string;
|
|
7
|
-
class?: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const {
|
|
10
|
+
const { class: className = "", date, locale = "en-US" } = Astro.props;
|
|
11
11
|
const iso = date.toISOString();
|
|
12
12
|
const formatted = formatDate(date, locale);
|
|
13
13
|
---
|
package/src/astro/header.astro
CHANGED
|
@@ -3,19 +3,19 @@ import { ThemeToggle } from "../components/theme-toggle";
|
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
6
|
-
siteTitle: string;
|
|
7
|
-
homeHref?: string;
|
|
8
6
|
class?: string;
|
|
9
|
-
|
|
7
|
+
homeHref?: string;
|
|
10
8
|
showThemeToggle?: boolean;
|
|
9
|
+
siteTitle: string;
|
|
10
|
+
themeToggleLabel?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const {
|
|
14
|
-
siteTitle,
|
|
15
|
-
homeHref = "/",
|
|
16
14
|
class: className = "",
|
|
17
|
-
|
|
15
|
+
homeHref = "/",
|
|
18
16
|
showThemeToggle = true,
|
|
17
|
+
siteTitle,
|
|
18
|
+
themeToggleLabel = "Toggle theme",
|
|
19
19
|
} = Astro.props;
|
|
20
20
|
---
|
|
21
21
|
<header class={cn("border-border bg-background/80 sticky top-0 z-40 border-b backdrop-blur", className)}>
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { cn } from "../lib/cn";
|
|
3
|
+
|
|
3
4
|
type Props = {
|
|
5
|
+
class?: string;
|
|
4
6
|
currentPage: number;
|
|
5
7
|
lastPage: number;
|
|
6
|
-
urlForPage: (page: number) => string;
|
|
7
|
-
class?: string;
|
|
8
|
-
prevLabel?: string;
|
|
9
8
|
nextLabel?: string;
|
|
10
|
-
pageLabel?: string;
|
|
11
9
|
ofLabel?: string;
|
|
10
|
+
pageLabel?: string;
|
|
11
|
+
prevLabel?: string;
|
|
12
|
+
urlForPage: (page: number) => string;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
const {
|
|
16
|
+
class: className = "",
|
|
15
17
|
currentPage,
|
|
16
18
|
lastPage,
|
|
17
|
-
urlForPage,
|
|
18
|
-
class: className = "",
|
|
19
|
-
prevLabel = "← Previous",
|
|
20
19
|
nextLabel = "Next →",
|
|
21
|
-
pageLabel = "Page",
|
|
22
20
|
ofLabel = "of",
|
|
21
|
+
pageLabel = "Page",
|
|
22
|
+
prevLabel = "← Previous",
|
|
23
|
+
urlForPage,
|
|
23
24
|
} = Astro.props;
|
|
24
25
|
const hasPrev = currentPage > 1;
|
|
25
26
|
const hasNext = currentPage < lastPage;
|
|
@@ -4,15 +4,15 @@ import type { Post } from "../content/index";
|
|
|
4
4
|
import FormattedDate from "./formatted-date.astro";
|
|
5
5
|
import TagList from "./tag-list.astro";
|
|
6
6
|
|
|
7
|
-
type PostEntry = {
|
|
7
|
+
type PostEntry = { data: Post; id: string };
|
|
8
8
|
type Props = {
|
|
9
|
-
post: PostEntry;
|
|
10
9
|
locale?: string;
|
|
10
|
+
post: PostEntry;
|
|
11
11
|
postHref?: (post: PostEntry) => string;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const {
|
|
15
|
-
const {
|
|
14
|
+
const { locale, post, postHref } = Astro.props;
|
|
15
|
+
const { description, pubDate, tags, title } = post.data;
|
|
16
16
|
const href = postHref ? postHref(post) : `/blog/${post.id}`;
|
|
17
17
|
---
|
|
18
18
|
<article class="post-card border-border group border-b py-6 last:border-0">
|
package/src/astro/prose.astro
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { readingTime } from "../lib/reading-time";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
-
text: string;
|
|
6
|
-
label?: string;
|
|
7
5
|
class?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
text: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const {
|
|
10
|
+
const { class: className = "", label = "min read", text } = Astro.props;
|
|
11
11
|
const { minutes } = readingTime(text);
|
|
12
12
|
---
|
|
13
13
|
<span class={className}>{minutes} {label}</span>
|
package/src/astro/seo.astro
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
type Props = {
|
|
3
|
-
|
|
4
|
-
description: string;
|
|
3
|
+
authorName?: string;
|
|
5
4
|
canonical?: string;
|
|
5
|
+
description: string;
|
|
6
6
|
image?: string;
|
|
7
|
-
type?: "website" | "article";
|
|
8
|
-
siteName?: string;
|
|
9
7
|
locale?: string;
|
|
10
|
-
publishedTime?: Date;
|
|
11
8
|
modifiedTime?: Date;
|
|
12
|
-
|
|
9
|
+
publishedTime?: Date;
|
|
10
|
+
siteName?: string;
|
|
11
|
+
title: string;
|
|
12
|
+
type?: "website" | "article";
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
|
-
|
|
17
|
-
description,
|
|
16
|
+
authorName,
|
|
18
17
|
canonical,
|
|
18
|
+
description,
|
|
19
19
|
image,
|
|
20
|
-
type = "website",
|
|
21
|
-
siteName,
|
|
22
20
|
locale = "en_US",
|
|
23
|
-
publishedTime,
|
|
24
21
|
modifiedTime,
|
|
25
|
-
|
|
22
|
+
publishedTime,
|
|
23
|
+
siteName,
|
|
24
|
+
title,
|
|
25
|
+
type = "website",
|
|
26
26
|
} = Astro.props;
|
|
27
27
|
const url = canonical ?? new URL(Astro.url.pathname, Astro.site ?? Astro.url.origin).toString();
|
|
28
28
|
---
|
|
@@ -2,27 +2,29 @@
|
|
|
2
2
|
import { slugify } from "../lib/slugify";
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
|
|
5
|
-
type Heading = { depth: number;
|
|
5
|
+
type Heading = { depth: number; slug: string; text: string };
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
|
-
headings: Array<{ depth: number; text: string; slug?: string }>;
|
|
9
|
-
minDepth?: number;
|
|
10
|
-
maxDepth?: number;
|
|
11
8
|
class?: string;
|
|
12
9
|
heading?: string;
|
|
10
|
+
headings: Array<{ depth: number; slug?: string; text: string }>;
|
|
11
|
+
maxDepth?: number;
|
|
12
|
+
minDepth?: number;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
|
-
headings,
|
|
17
|
-
minDepth = 2,
|
|
18
|
-
maxDepth = 3,
|
|
19
16
|
class: className = "",
|
|
20
17
|
heading = "On this page",
|
|
18
|
+
headings,
|
|
19
|
+
maxDepth = 3,
|
|
20
|
+
minDepth = 2,
|
|
21
21
|
} = Astro.props;
|
|
22
22
|
|
|
23
|
-
const visible: Array<Heading> = headings
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const visible: Array<Heading> = headings.flatMap((h) =>
|
|
24
|
+
h.depth >= minDepth && h.depth <= maxDepth
|
|
25
|
+
? [{ depth: h.depth, slug: h.slug ?? slugify(h.text), text: h.text }]
|
|
26
|
+
: [],
|
|
27
|
+
);
|
|
26
28
|
---
|
|
27
29
|
{visible.length > 0 && (
|
|
28
30
|
<nav class={cn("text-sm", className)} aria-label="Table of contents">
|
package/src/astro/tag-list.astro
CHANGED
|
@@ -3,12 +3,12 @@ import { DEFAULT_TAG_BASE, tagUrl } from "../lib/tag-url";
|
|
|
3
3
|
import { cn } from "../lib/cn";
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
6
|
-
tags: Array<string>;
|
|
7
6
|
base?: string;
|
|
8
7
|
class?: string;
|
|
8
|
+
tags: Array<string>;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const {
|
|
11
|
+
const { base = DEFAULT_TAG_BASE, class: className = "", tags } = Astro.props;
|
|
12
12
|
---
|
|
13
13
|
<ul class={cn("flex flex-wrap gap-2", className)}>
|
|
14
14
|
{tags.map((tag) => (
|
|
@@ -2,47 +2,48 @@
|
|
|
2
2
|
import Seo from "../astro/seo.astro";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
-
|
|
6
|
-
description: string;
|
|
5
|
+
authorName?: string;
|
|
7
6
|
canonical?: string;
|
|
7
|
+
colorScheme?: "auto" | "light" | "dark";
|
|
8
|
+
description: string;
|
|
8
9
|
image?: string;
|
|
9
|
-
type?: "website" | "article";
|
|
10
10
|
lang?: string;
|
|
11
|
-
siteTitle?: string;
|
|
12
|
-
rssHref?: string;
|
|
13
|
-
siteName?: string;
|
|
14
11
|
locale?: string;
|
|
15
|
-
publishedTime?: Date;
|
|
16
12
|
modifiedTime?: Date;
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
publishedTime?: Date;
|
|
14
|
+
rssHref?: string;
|
|
15
|
+
siteName?: string;
|
|
16
|
+
siteTitle?: string;
|
|
17
|
+
title: string;
|
|
18
|
+
type?: "website" | "article";
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const {
|
|
22
|
-
|
|
23
|
-
description,
|
|
22
|
+
authorName,
|
|
24
23
|
canonical,
|
|
24
|
+
colorScheme = "auto",
|
|
25
|
+
description,
|
|
25
26
|
image,
|
|
26
|
-
type = "website",
|
|
27
27
|
lang = "en",
|
|
28
|
-
siteTitle,
|
|
29
|
-
rssHref,
|
|
30
|
-
siteName,
|
|
31
28
|
locale,
|
|
32
|
-
publishedTime,
|
|
33
29
|
modifiedTime,
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
publishedTime,
|
|
31
|
+
rssHref,
|
|
32
|
+
siteName,
|
|
33
|
+
siteTitle,
|
|
34
|
+
title,
|
|
35
|
+
type = "website",
|
|
36
36
|
} = Astro.props;
|
|
37
37
|
|
|
38
|
-
const colorSchemeScript =
|
|
39
|
-
|
|
38
|
+
const colorSchemeScript =
|
|
39
|
+
colorScheme === "auto"
|
|
40
|
+
? `(() => {
|
|
40
41
|
const stored = localStorage.getItem("theme");
|
|
41
42
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
42
43
|
const theme = stored === "dark" || stored === "light" ? stored : prefersDark ? "dark" : "light";
|
|
43
44
|
document.documentElement.classList.toggle("dark", theme === "dark");
|
|
44
45
|
})();`
|
|
45
|
-
|
|
46
|
+
: `document.documentElement.classList.toggle("dark", ${colorScheme === "dark"});`;
|
|
46
47
|
---
|
|
47
48
|
<!doctype html>
|
|
48
49
|
<html lang={lang}>
|
|
@@ -7,22 +7,32 @@ import Header from "../astro/header.astro";
|
|
|
7
7
|
import PostCard from "../astro/post-card.astro";
|
|
8
8
|
import Pagination from "../astro/pagination.astro";
|
|
9
9
|
|
|
10
|
-
type PostEntry = {
|
|
10
|
+
type PostEntry = { data: Post; id: string };
|
|
11
11
|
type Props = {
|
|
12
|
-
title: string;
|
|
13
12
|
description: string;
|
|
14
13
|
eyebrow?: string;
|
|
15
|
-
posts: Array<PostEntry>;
|
|
16
|
-
page?: { currentPage: number; lastPage: number; url: { prev?: string; next?: string } };
|
|
17
|
-
urlForPage?: (page: number) => string;
|
|
18
14
|
locale?: string;
|
|
19
|
-
|
|
20
|
-
rssHref?: string;
|
|
15
|
+
page?: { currentPage: number; lastPage: number; url: { next?: string; prev?: string } };
|
|
21
16
|
postHref?: (post: PostEntry) => string;
|
|
17
|
+
posts: Array<PostEntry>;
|
|
18
|
+
rssHref?: string;
|
|
19
|
+
siteTitle?: string;
|
|
20
|
+
title: string;
|
|
21
|
+
urlForPage?: (page: number) => string;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const {
|
|
25
|
-
|
|
24
|
+
const {
|
|
25
|
+
description,
|
|
26
|
+
eyebrow,
|
|
27
|
+
locale,
|
|
28
|
+
page,
|
|
29
|
+
postHref,
|
|
30
|
+
posts,
|
|
31
|
+
rssHref,
|
|
32
|
+
siteTitle,
|
|
33
|
+
title,
|
|
34
|
+
urlForPage,
|
|
35
|
+
} = Astro.props;
|
|
26
36
|
---
|
|
27
37
|
<BaseLayout title={title} description={description} siteTitle={siteTitle} rssHref={rssHref}>
|
|
28
38
|
<Fragment slot="header">{siteTitle && <Header siteTitle={siteTitle} />}</Fragment>
|
|
@@ -11,31 +11,31 @@ import Prose from "../astro/prose.astro";
|
|
|
11
11
|
import TableOfContents from "../astro/table-of-contents.astro";
|
|
12
12
|
import PostCard from "../astro/post-card.astro";
|
|
13
13
|
|
|
14
|
-
type PostEntry = {
|
|
14
|
+
type PostEntry = { data: Post; id: string };
|
|
15
15
|
type Props = {
|
|
16
|
-
|
|
16
|
+
headings?: Array<{ depth: number; slug?: string; text: string }>;
|
|
17
17
|
locale?: string;
|
|
18
|
+
post: { body?: string; data: Post; id: string };
|
|
19
|
+
postHref?: (post: PostEntry) => string;
|
|
20
|
+
relatedHeading?: string;
|
|
21
|
+
relatedPosts?: Array<PostEntry>;
|
|
22
|
+
rssHref?: string;
|
|
18
23
|
siteTitle?: string;
|
|
19
24
|
updatedLabel?: string;
|
|
20
|
-
rssHref?: string;
|
|
21
|
-
headings?: Array<{ depth: number; text: string; slug?: string }>;
|
|
22
|
-
relatedPosts?: Array<PostEntry>;
|
|
23
|
-
relatedHeading?: string;
|
|
24
|
-
postHref?: (post: PostEntry) => string;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const {
|
|
28
|
-
|
|
28
|
+
headings,
|
|
29
29
|
locale,
|
|
30
|
+
post,
|
|
31
|
+
postHref,
|
|
32
|
+
relatedHeading = "Related posts",
|
|
33
|
+
relatedPosts,
|
|
34
|
+
rssHref,
|
|
30
35
|
siteTitle,
|
|
31
36
|
updatedLabel = "Updated",
|
|
32
|
-
rssHref,
|
|
33
|
-
headings,
|
|
34
|
-
relatedPosts,
|
|
35
|
-
relatedHeading = "Related posts",
|
|
36
|
-
postHref,
|
|
37
37
|
} = Astro.props;
|
|
38
|
-
const {
|
|
38
|
+
const { description, pubDate, tags, title, updatedDate } = post.data;
|
|
39
39
|
---
|
|
40
40
|
<BaseLayout
|
|
41
41
|
title={title}
|