astro-pure 1.2.3 → 1.2.5
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/bun.lockb +0 -0
- package/components/advanced/Comment.astro +8 -8
- package/components/advanced/GithubCard.astro +2 -2
- package/components/advanced/Quote.astro +1 -3
- package/components/basic/Footer.astro +2 -2
- package/components/basic/Header.astro +2 -2
- package/components/basic/ThemeProvider.astro +1 -1
- package/components/pages/ArticleBottom.astro +1 -1
- package/components/pages/Copyright.astro +14 -12
- package/components/pages/Hero.astro +4 -4
- package/components/pages/PFSearch.astro +5 -5
- package/components/pages/PostPreview.astro +5 -5
- package/components/pages/TOC.astro +7 -8
- package/components/user/Aside.astro +1 -1
- package/components/user/Button.astro +1 -1
- package/components/user/Card.astro +1 -1
- package/components/user/CardList.astro +21 -15
- package/components/user/CardListChildren.astro +11 -4
- package/components/user/Collapse.astro +1 -4
- package/components/user/Steps.astro +5 -5
- package/components/user/Tabs.astro +5 -5
- package/index.ts +2 -5
- package/package.json +2 -4
- package/schemas/links.ts +12 -12
- package/scripts/check.mjs +39 -0
- package/scripts/index.js +5 -0
- package/types/index.ts +1 -1
- package/utils/class-merge.ts +17 -0
- package/utils/index.ts +1 -1
- package/utils/server.ts +15 -7
- package/utils/tailwind.ts +0 -7
package/bun.lockb
CHANGED
|
Binary file
|
|
@@ -61,18 +61,18 @@ const { class: className } = Astro.props
|
|
|
61
61
|
/* Font size */
|
|
62
62
|
--waline-font-size: 16px;
|
|
63
63
|
/* Basic color */
|
|
64
|
-
--waline-white: hsl(var(--background) / var(--
|
|
64
|
+
--waline-white: hsl(var(--background) / var(--un-bg-opacity, 1));
|
|
65
65
|
--waline-light-grey: #999;
|
|
66
66
|
--waline-dark-grey: #666;
|
|
67
67
|
/* Theme color */
|
|
68
|
-
--waline-theme-color: hsl(var(--foreground) / var(--
|
|
69
|
-
--waline-active-color: hsl(var(--primary) / var(--
|
|
68
|
+
--waline-theme-color: hsl(var(--foreground) / var(--un-text-opacity, 1));
|
|
69
|
+
--waline-active-color: hsl(var(--primary) / var(--un-text-opacity, 1));
|
|
70
70
|
/* Layout */
|
|
71
|
-
--waline-color: hsl(var(--muted-foreground) / var(--
|
|
72
|
-
--waline-bg-color: hsl(var(--muted) / var(--
|
|
73
|
-
--waline-bg-color-light: hsl(var(--input) / var(--
|
|
71
|
+
--waline-color: hsl(var(--muted-foreground) / var(--un-text-opacity, 1));
|
|
72
|
+
--waline-bg-color: hsl(var(--muted) / var(--un-bg-opacity, 1));
|
|
73
|
+
--waline-bg-color-light: hsl(var(--input) / var(--un-text-opacity, 1));
|
|
74
74
|
--waline-bg-color-hover: #f0f0f0;
|
|
75
|
-
--waline-border-color: hsl(var(--border) / var(--
|
|
75
|
+
--waline-border-color: hsl(var(--border) / var(--un-border-opacity, 1));
|
|
76
76
|
--waline-disable-bg-color: #f8f8f8;
|
|
77
77
|
--waline-disable-color: #bbb;
|
|
78
78
|
--waline-code-bg-color: #282c34;
|
|
@@ -82,7 +82,7 @@ const { class: className } = Astro.props
|
|
|
82
82
|
--waline-avatar-size: 3.25rem;
|
|
83
83
|
--waline-m-avatar-size: calc(var(--waline-avatar-size) * 9 / 13);
|
|
84
84
|
/* Badge */
|
|
85
|
-
--waline-badge-color: hsl(var(--border) / var(--
|
|
85
|
+
--waline-badge-color: hsl(var(--border) / var(--un-border-opacity, 1));
|
|
86
86
|
--waline-badge-font-size: 0.775em;
|
|
87
87
|
/* Info */
|
|
88
88
|
--waline-info-bg-color: var(--waline-bg-color-light);
|
|
@@ -13,7 +13,7 @@ const [owner, repoName] = repo.split('/')
|
|
|
13
13
|
<a
|
|
14
14
|
href={`https://github.com/${repo}`}
|
|
15
15
|
target='_blank'
|
|
16
|
-
class='group block flex flex-col gap-y-2 rounded-xl border
|
|
16
|
+
class='group block flex flex-col gap-y-2 rounded-xl border px-5 py-4 transition-colors hover:bg-muted hover:text-muted-foreground'
|
|
17
17
|
>
|
|
18
18
|
<div class='flex items-center justify-between'>
|
|
19
19
|
<div class='flex items-center gap-x-2 text-foreground group-hover:text-primary'>
|
|
@@ -70,7 +70,7 @@ const [owner, repoName] = repo.split('/')
|
|
|
70
70
|
.loading .gh-text {
|
|
71
71
|
color: transparent;
|
|
72
72
|
border-radius: calc(var(--radius) - 3px);
|
|
73
|
-
background-color: hsl(var(--primary-foreground) / var(--
|
|
73
|
+
background-color: hsl(var(--primary-foreground) / var(--un-text-opacity));
|
|
74
74
|
animation: pulsate 2s infinite linear;
|
|
75
75
|
user-select: none;
|
|
76
76
|
}
|
|
@@ -5,9 +5,7 @@ const { class: className } = Astro.props
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<quote-component class={cn('not-prose inline-block', className)}>
|
|
8
|
-
<div
|
|
9
|
-
class='flex flex-row items-center gap-x-3 rounded-full border border-border px-4 py-2 text-sm shadow-sm'
|
|
10
|
-
>
|
|
8
|
+
<div class='flex flex-row items-center gap-x-3 rounded-full border px-4 py-2 text-sm shadow-sm'>
|
|
11
9
|
<span class='relative flex items-center justify-center'>
|
|
12
10
|
<span
|
|
13
11
|
class='absolute size-2 animate-ping rounded-full border border-green-400 bg-green-400 opacity-75'
|
|
@@ -15,7 +15,7 @@ social.rss = {
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
17
|
<footer class='mx-auto mb-5 mt-16'>
|
|
18
|
-
<div class='border-t
|
|
18
|
+
<div class='border-t pt-5'>
|
|
19
19
|
<div class='flex items-center gap-y-3 max-sm:flex-col sm:justify-between sm:gap-y-0'>
|
|
20
20
|
<div
|
|
21
21
|
class='flex items-center gap-x-4 gap-y-2 text-muted-foreground max-sm:flex-col [&_a:hover]:text-primary [&_a]:text-foreground'
|
|
@@ -24,7 +24,7 @@ social.rss = {
|
|
|
24
24
|
footerConf.registration && (
|
|
25
25
|
<a
|
|
26
26
|
class='text-xs'
|
|
27
|
-
style='color:hsl(var(--muted-foreground)/var(--
|
|
27
|
+
style='color:hsl(var(--muted-foreground)/var(--un-text-opacity,1))'
|
|
28
28
|
href={footerConf.registration.url}
|
|
29
29
|
target='_blank'
|
|
30
30
|
>
|
|
@@ -180,8 +180,8 @@ import { Icon } from '../user'
|
|
|
180
180
|
visibility: visible;
|
|
181
181
|
bottom: -1rem;
|
|
182
182
|
opacity: 1;
|
|
183
|
-
background-color: hsl(var(--muted) / var(--
|
|
184
|
-
border-bottom-color: hsl(var(--border) / var(--
|
|
183
|
+
background-color: hsl(var(--muted) / var(--un-bg-opacity, 1));
|
|
184
|
+
border-bottom-color: hsl(var(--border) / var(--un-border-opacity, 1));
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
const { message } = (e as CustomEvent).detail
|
|
31
31
|
const toast = document.createElement('div')
|
|
32
32
|
toast.className =
|
|
33
|
-
'animate fixed bottom-8 z-20 px-4 py-2 bg-muted text-foreground rounded-lg border
|
|
33
|
+
'animate fixed bottom-8 z-20 px-4 py-2 bg-muted text-foreground rounded-lg border shadow-lg flex items-center gap-2'
|
|
34
34
|
toast.innerHTML = `<svg width='22' height='22' viewBox='0 0 24 24' fill='currentColor'>${Icons.info}</svg> <span>${message}</span>`
|
|
35
35
|
document.body.appendChild(toast)
|
|
36
36
|
setTimeout(() => {
|
|
@@ -61,7 +61,7 @@ const next = collections[index + 1]
|
|
|
61
61
|
next && (
|
|
62
62
|
<a
|
|
63
63
|
href={`${path}/${next.id}`}
|
|
64
|
-
class='group inline-flex items-center gap-x-2 rounded-xl px-4 py-2 text-right no-underline transition-colors duration-300 hover:bg-muted max-sm:max-w-[80%] sm:flex'
|
|
64
|
+
class='group inline-flex items-center gap-x-2 rounded-xl px-4 py-2 text-right no-underline transition-colors duration-300 hover:bg-muted max-sm:float-end max-sm:max-w-[80%] sm:flex'
|
|
65
65
|
>
|
|
66
66
|
<p class='truncate font-medium transition-colors'>{next.data.title}</p>
|
|
67
67
|
<svg
|
|
@@ -6,8 +6,8 @@ import { cn, getFormattedDate } from '../../utils'
|
|
|
6
6
|
import { QRCode } from '../advanced'
|
|
7
7
|
import { Icon } from '../user'
|
|
8
8
|
|
|
9
|
-
interface Props {
|
|
10
|
-
data: InferEntrySchema<
|
|
9
|
+
interface Props<T extends CollectionKey> {
|
|
10
|
+
data: InferEntrySchema<T>
|
|
11
11
|
class?: string
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -51,16 +51,18 @@ const shares = {
|
|
|
51
51
|
<span>Author</span>
|
|
52
52
|
<span class='text-sm text-foreground max-sm:place-self-center'>{config.author}</span>
|
|
53
53
|
</div>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
{
|
|
55
|
+
publishDate && (
|
|
56
|
+
<div class='flex gap-x-2 sm:min-w-16 sm:flex-col'>
|
|
57
|
+
<span>Published at</span>
|
|
58
|
+
<span class='text-sm text-foreground max-sm:place-self-center'>
|
|
59
|
+
{getFormattedDate(publishDate, {
|
|
60
|
+
month: 'long'
|
|
61
|
+
})}
|
|
62
|
+
</span>
|
|
63
|
+
</div>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
64
66
|
<div class='flex gap-x-2 sm:flex-col'>
|
|
65
67
|
<span>Copyright</span>
|
|
66
68
|
<a
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { Image } from 'astro:assets'
|
|
3
|
-
import
|
|
3
|
+
import type { InferEntrySchema } from 'astro:content'
|
|
4
4
|
|
|
5
5
|
import { PageInfo } from '.'
|
|
6
6
|
import { FormattedDate, Icon } from '../user'
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
|
-
data: InferEntrySchema<
|
|
9
|
+
data: InferEntrySchema<'blog'>
|
|
10
10
|
remarkPluginFrontmatter: Record<string, unknown>
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -38,15 +38,15 @@ const dateTimeOptions: Intl.DateTimeFormatOptions = {
|
|
|
38
38
|
class='cover-image relative z-10 h-auto w-full max-w-[65ch] rounded-2xl object-contain'
|
|
39
39
|
fetchpriority='high'
|
|
40
40
|
loading='eager'
|
|
41
|
-
|
|
41
|
+
{...heroImage}
|
|
42
42
|
/>
|
|
43
43
|
<Image
|
|
44
44
|
alt='Blur image'
|
|
45
45
|
fetchpriority='high'
|
|
46
46
|
loading='eager'
|
|
47
|
-
src={heroImage.src}
|
|
48
47
|
id='blurImage'
|
|
49
48
|
class='absolute end-0 top-4 z-0 mt-0 h-full max-w-[65ch] rounded-3xl opacity-60 blur-xl transition-opacity duration-300'
|
|
49
|
+
{...heroImage}
|
|
50
50
|
/>
|
|
51
51
|
</div>
|
|
52
52
|
)
|
|
@@ -56,11 +56,11 @@ import '@pagefind/default-ui/css/ui.css'
|
|
|
56
56
|
<style>
|
|
57
57
|
#site-search {
|
|
58
58
|
--pagefind-ui-scale: 0.8;
|
|
59
|
-
--pagefind-ui-primary: hsl(var(--primary) / var(--
|
|
60
|
-
--pagefind-ui-text: hsl(var(--foreground) / var(--
|
|
61
|
-
--pagefind-ui-background: hsl(var(--muted) / var(--
|
|
62
|
-
--pagefind-ui-border: hsl(var(--border) / var(--
|
|
63
|
-
--pagefind-ui-tag: hsl(var(--muted-foreground) / var(--
|
|
59
|
+
--pagefind-ui-primary: hsl(var(--primary) / var(--un-bg-opacity, 1));
|
|
60
|
+
--pagefind-ui-text: hsl(var(--foreground) / var(--un-text-opacity, 1));
|
|
61
|
+
--pagefind-ui-background: hsl(var(--muted) / var(--un-bg-opacity, 1));
|
|
62
|
+
--pagefind-ui-border: hsl(var(--border) / var(--un-border-opacity, 1));
|
|
63
|
+
--pagefind-ui-tag: hsl(var(--muted-foreground) / var(--un-text-opacity, 1));
|
|
64
64
|
--pagefind-ui-border-width: 2px;
|
|
65
65
|
--pagefind-ui-border-radius: calc(var(--radius) + 2px);
|
|
66
66
|
--pagefind-ui-image-border-radius: calc(var(--radius) + 2px);
|
|
@@ -22,13 +22,13 @@ const postDate = data.updatedDate ?? data.publishDate
|
|
|
22
22
|
|
|
23
23
|
<li
|
|
24
24
|
class={cn(
|
|
25
|
-
'post-preview group/card flex flex-col relative rounded-2xl border
|
|
25
|
+
'post-preview group/card flex flex-col relative rounded-2xl border bg-background transition-colors ease-in-out px-5 py-2.5 hover:bg-muted',
|
|
26
26
|
detailed && 'max-sm:px-4 sm:py-5',
|
|
27
27
|
className
|
|
28
28
|
)}
|
|
29
29
|
style={detailed &&
|
|
30
30
|
data.heroImage?.color &&
|
|
31
|
-
`--preview-highlight:color-mix(in srgb,${data.heroImage.color} 40%,hsl(var(--foreground)/var(--
|
|
31
|
+
`--preview-highlight:color-mix(in srgb,${data.heroImage.color} 40%,hsl(var(--foreground)/var(--un-text-opacity,1)));
|
|
32
32
|
--preview-highlight-bg:hsl(from ${data.heroImage.color} h s l/20%)`}
|
|
33
33
|
>
|
|
34
34
|
<a
|
|
@@ -43,10 +43,10 @@ const postDate = data.updatedDate ?? data.publishDate
|
|
|
43
43
|
{
|
|
44
44
|
detailed && data.heroImage && (
|
|
45
45
|
<Image
|
|
46
|
-
src={data.heroImage.src}
|
|
47
46
|
alt={data.heroImage.alt || data.title}
|
|
48
47
|
class='cover-image absolute end-0 top-0 z-0 h-2/3 w-full rounded-2xl object-cover opacity-50 transition-opacity duration-300 group-hover/card:opacity-70 md:h-full md:w-3/5'
|
|
49
48
|
loading='eager'
|
|
49
|
+
{...data.heroImage}
|
|
50
50
|
/>
|
|
51
51
|
)
|
|
52
52
|
}
|
|
@@ -131,7 +131,7 @@ const postDate = data.updatedDate ?? data.publishDate
|
|
|
131
131
|
.post-preview {
|
|
132
132
|
--preview-highlight-final: var(
|
|
133
133
|
--preview-highlight,
|
|
134
|
-
hsl(var(--primary) / var(--
|
|
134
|
+
hsl(var(--primary) / var(--un-text-opacity, 1))
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
137
|
.post-preview:hover {
|
|
@@ -139,7 +139,7 @@ const postDate = data.updatedDate ?? data.publishDate
|
|
|
139
139
|
& .tag-list a {
|
|
140
140
|
background-color: var(
|
|
141
141
|
--preview-highlight-bg,
|
|
142
|
-
hsl(var(--muted) / var(--
|
|
142
|
+
hsl(var(--muted) / var(--un-bg-opacity, 1))
|
|
143
143
|
) !important;
|
|
144
144
|
}
|
|
145
145
|
& > a,
|
|
@@ -7,6 +7,7 @@ import TOCHeading from './TOCHeading.astro'
|
|
|
7
7
|
interface Props {
|
|
8
8
|
headings: MarkdownHeading[]
|
|
9
9
|
class?: string
|
|
10
|
+
id?: string
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const { headings, class: className, ...props } = Astro.props
|
|
@@ -14,14 +15,12 @@ const { headings, class: className, ...props } = Astro.props
|
|
|
14
15
|
const toc = generateToc(headings)
|
|
15
16
|
---
|
|
16
17
|
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</toc-heading>
|
|
24
|
-
</aside>
|
|
18
|
+
<toc-heading class={className} {...props}>
|
|
19
|
+
<h2 class='font-semibold'>TABLE OF CONTENTS</h2>
|
|
20
|
+
<ul class='mt-4 text-card-foreground'>
|
|
21
|
+
{toc.map((heading) => <TOCHeading heading={heading} />)}
|
|
22
|
+
</ul>
|
|
23
|
+
</toc-heading>
|
|
25
24
|
|
|
26
25
|
<script>
|
|
27
26
|
// This script tag is useful only if you want to display the TOC alongside the blog post...
|
|
@@ -6,7 +6,7 @@ const { as: Tag = 'a', class: className, title, href, style = 'button', ...props
|
|
|
6
6
|
|
|
7
7
|
<Tag
|
|
8
8
|
class={cn(
|
|
9
|
-
'group inline-flex items-center gap-x-1 rounded-lg bg-muted border
|
|
9
|
+
'group inline-flex items-center gap-x-1 rounded-lg bg-muted border px-2 py-1 text-sm text-muted-foreground transition-all hover:bg-primary-foreground no-underline',
|
|
10
10
|
!href && 'cursor-default',
|
|
11
11
|
style === 'pill' && 'rounded-xl',
|
|
12
12
|
className
|
|
@@ -6,7 +6,7 @@ const { as: Tag = 'div', class: className, href, heading, subheading, date } = A
|
|
|
6
6
|
|
|
7
7
|
<Tag
|
|
8
8
|
class={cn(
|
|
9
|
-
'not-prose block relative rounded-2xl border
|
|
9
|
+
'not-prose block relative rounded-2xl border bg-muted px-5 py-3',
|
|
10
10
|
href && 'transition-all hover:border-foreground/25 hover:shadow-sm',
|
|
11
11
|
className
|
|
12
12
|
)}
|
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { CardListData } from '../../types'
|
|
3
|
+
import { cn } from '../../utils'
|
|
3
4
|
import Collapse from '../user/Collapse.astro'
|
|
4
5
|
import CardListChildren from './CardListChildren.astro'
|
|
5
6
|
|
|
6
7
|
type Props = CardListData & {
|
|
7
8
|
collapse?: boolean
|
|
8
9
|
class?: string
|
|
10
|
+
style?: string | Record<string, string>
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
const { title, list, collapse, class: className } = Astro.props
|
|
13
|
+
const { title, list, collapse, class: className, ...props } = Astro.props
|
|
12
14
|
---
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</
|
|
16
|
+
{
|
|
17
|
+
collapse ? (
|
|
18
|
+
<Collapse title={title} class={cn('not-prose', className)} {...props}>
|
|
19
|
+
<CardListChildren children={list} main />
|
|
20
|
+
</Collapse>
|
|
21
|
+
) : (
|
|
22
|
+
<div
|
|
23
|
+
class={cn(
|
|
24
|
+
'not-prose my-3 flex flex-col gap-y-2 rounded-xl border px-4 py-3 sm:py-4',
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
<p class='text-lg font-medium text-foreground'>{title}</p>
|
|
30
|
+
<CardListChildren children={list} main />
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
import type { CardList } from '../../types'
|
|
3
3
|
import { cn } from '../../utils'
|
|
4
4
|
|
|
5
|
-
type Props = { children: CardList }
|
|
6
|
-
const { children } = Astro.props
|
|
5
|
+
type Props = { main?: boolean; children: CardList }
|
|
6
|
+
const { main = false, children } = Astro.props
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
<ul class='
|
|
9
|
+
<ul class={cn('flex flex-col gap-y-1', !main && 'subitem list-disc ms-5')}>
|
|
10
10
|
{
|
|
11
11
|
children.map((child) => {
|
|
12
12
|
const Tag = child.link ? 'a' : 'p'
|
|
13
13
|
return (
|
|
14
14
|
<li>
|
|
15
|
-
<Tag
|
|
15
|
+
<Tag
|
|
16
|
+
href={child.link}
|
|
17
|
+
class={cn(
|
|
18
|
+
'block',
|
|
19
|
+
main ? 'text-foreground' : 'text-muted-foreground',
|
|
20
|
+
Tag == 'p' && 'mb-2 mt-1'
|
|
21
|
+
)}
|
|
22
|
+
>
|
|
16
23
|
{child.title}
|
|
17
24
|
</Tag>
|
|
18
25
|
{child.children && child.children.length > 0 && <Astro.self children={child.children} />}
|
|
@@ -10,10 +10,7 @@ const { class: className, title, ...props } = Astro.props
|
|
|
10
10
|
|
|
11
11
|
<collapse-component class='group/expand'>
|
|
12
12
|
<div
|
|
13
|
-
class={cn(
|
|
14
|
-
'rounded-xl border border-border px-3 my-4 sm:px-4 group-[.expanded]/expand:bg-muted',
|
|
15
|
-
className
|
|
16
|
-
)}
|
|
13
|
+
class={cn('rounded-xl border px-3 my-4 sm:px-4 group-[.expanded]/expand:bg-muted', className)}
|
|
17
14
|
{...props}
|
|
18
15
|
>
|
|
19
16
|
<slot name='before' />
|
|
@@ -45,10 +45,10 @@ const { html } = processSteps(content)
|
|
|
45
45
|
font-size: 0.8125rem;
|
|
46
46
|
font-weight: 600;
|
|
47
47
|
text-align: center;
|
|
48
|
-
color: hsl(var(--foreground) / var(--
|
|
49
|
-
background-color: hsl(var(--primary-foreground) / var(--
|
|
48
|
+
color: hsl(var(--foreground) / var(--un-text-opacity, 1));
|
|
49
|
+
background-color: hsl(var(--primary-foreground) / var(--un-bg-opacity, 1));
|
|
50
50
|
border-radius: 99rem;
|
|
51
|
-
box-shadow: inset 0 0 0 1px hsl(var(--border) / var(--
|
|
51
|
+
box-shadow: inset 0 0 0 1px hsl(var(--border) / var(--un-border-opacity, 1));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/* Vertical guideline linking list numbers. */
|
|
@@ -60,7 +60,7 @@ const { html } = processSteps(content)
|
|
|
60
60
|
bottom: var(--bullet-margin);
|
|
61
61
|
inset-inline-start: calc((var(--bullet-size) - var(--guide-width)) / 2);
|
|
62
62
|
width: var(--guide-width);
|
|
63
|
-
background-color: hsl(var(--border) / var(--
|
|
63
|
+
background-color: hsl(var(--border) / var(--un-border-opacity, 1));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/* Adjust first item inside a step so that it aligns vertically with the number
|
|
@@ -76,7 +76,7 @@ const { html } = processSteps(content)
|
|
|
76
76
|
margin-top: 0;
|
|
77
77
|
transform: translateY(var(--shift-y));
|
|
78
78
|
margin-bottom: var(--shift-y);
|
|
79
|
-
color: hsl(var(--foreground) / var(--
|
|
79
|
+
color: hsl(var(--foreground) / var(--un-text-opacity, 1));
|
|
80
80
|
}
|
|
81
81
|
.sl-steps > li > :first-child:where(h1, h2, h3, h4, h5, h6) {
|
|
82
82
|
--lh: calc(1.2em);
|
|
@@ -110,7 +110,7 @@ if (isSynced) {
|
|
|
110
110
|
[role='tablist'] {
|
|
111
111
|
display: flex;
|
|
112
112
|
list-style: none;
|
|
113
|
-
border-bottom: 2px solid hsl(var(--border) / var(--
|
|
113
|
+
border-bottom: 2px solid hsl(var(--border) / var(--un-border-opacity, 1));
|
|
114
114
|
padding: 0;
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -123,14 +123,14 @@ if (isSynced) {
|
|
|
123
123
|
gap: 0.5rem;
|
|
124
124
|
padding: 0.2rem 1.25rem;
|
|
125
125
|
text-decoration: none;
|
|
126
|
-
border-bottom: 2px solid hsl(var(--border) / var(--
|
|
127
|
-
color: hsl(var(--foreground) / var(--
|
|
126
|
+
border-bottom: 2px solid hsl(var(--border) / var(--un-border-opacity, 1));
|
|
127
|
+
color: hsl(var(--foreground) / var(--un-text-opacity, 1));
|
|
128
128
|
outline-offset: -0.1875rem;
|
|
129
129
|
overflow-wrap: initial;
|
|
130
130
|
}
|
|
131
131
|
.tab [role='tab'][aria-selected='true'] {
|
|
132
|
-
color: hsl(var(--primary) / var(--
|
|
133
|
-
border-color: hsl(var(--primary) / var(--
|
|
132
|
+
color: hsl(var(--primary) / var(--un-text-opacity, 1));
|
|
133
|
+
border-color: hsl(var(--primary) / var(--un-text-opacity, 1));
|
|
134
134
|
font-weight: 600;
|
|
135
135
|
}
|
|
136
136
|
|
package/index.ts
CHANGED
|
@@ -6,7 +6,6 @@ import type { AstroIntegration, RehypePlugins, RemarkPlugins } from 'astro'
|
|
|
6
6
|
// Integrations
|
|
7
7
|
import mdx from '@astrojs/mdx'
|
|
8
8
|
import sitemap from '@astrojs/sitemap'
|
|
9
|
-
import tailwind from '@astrojs/tailwind'
|
|
10
9
|
import rehypeExternalLinks from 'rehype-external-links'
|
|
11
10
|
|
|
12
11
|
import { remarkAddZoomable, remarkReadingTime } from './plugins/remark-plugins'
|
|
@@ -23,9 +22,10 @@ export default function AstroPureIntegration(opts: UserInputConfig): AstroIntegr
|
|
|
23
22
|
hooks: {
|
|
24
23
|
'astro:config:setup': async ({ config, updateConfig }) => {
|
|
25
24
|
let userConfig = parseWithFriendlyErrors(
|
|
25
|
+
// @ts-ignore
|
|
26
26
|
UserConfigSchema,
|
|
27
27
|
opts,
|
|
28
|
-
'Invalid config passed to
|
|
28
|
+
'Invalid config passed to astro-pure integration'
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
// Add built-in integrations only if they are not already added by the user through the
|
|
@@ -37,9 +37,6 @@ export default function AstroPureIntegration(opts: UserInputConfig): AstroIntegr
|
|
|
37
37
|
if (!allIntegrations.find(({ name }) => name === '@astrojs/mdx')) {
|
|
38
38
|
integrations.push(mdx({ optimize: true }))
|
|
39
39
|
}
|
|
40
|
-
if (!allIntegrations.find(({ name }) => name === '@astrojs/tailwind')) {
|
|
41
|
-
integrations.push(tailwind({ applyBaseStyles: false }))
|
|
42
|
-
}
|
|
43
40
|
|
|
44
41
|
// Add supported remark plugins based on user config.
|
|
45
42
|
if (userConfig.integ.mediumZoom.enable)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-pure",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "A simple, clean but powerful blog theme build by astro.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "CWorld",
|
|
@@ -37,13 +37,11 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@astrojs/mdx": "^4.0.3",
|
|
39
39
|
"@astrojs/sitemap": "^3.2.1",
|
|
40
|
-
"@astrojs/tailwind": "^5.1.3",
|
|
41
40
|
"@pagefind/default-ui": "^1.3.0",
|
|
42
41
|
"astro": "^5.0.3",
|
|
43
42
|
"hast-util-select": "^6.0.3",
|
|
44
43
|
"node-html-parser": "^7.0.1",
|
|
45
44
|
"pagefind": "^1.2.0",
|
|
46
|
-
"rehype-external-links": "^3.0.0"
|
|
47
|
-
"tailwind-merge": "^2.5.5"
|
|
45
|
+
"rehype-external-links": "^3.0.0"
|
|
48
46
|
}
|
|
49
47
|
}
|
package/schemas/links.ts
CHANGED
|
@@ -9,20 +9,20 @@ export const FriendLinksSchema = () =>
|
|
|
9
9
|
content: z.string()
|
|
10
10
|
})
|
|
11
11
|
),
|
|
12
|
-
applyTip: z.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
applyTip: z.array(
|
|
13
|
+
z.object({
|
|
14
|
+
name: z.string(),
|
|
15
|
+
val: z.string()
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
18
|
})
|
|
19
19
|
.default({
|
|
20
20
|
logbook: [],
|
|
21
|
-
applyTip:
|
|
22
|
-
name: 'Astro Pure',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
applyTip: [
|
|
22
|
+
{ name: 'Name', val: 'Astro Pure' },
|
|
23
|
+
{ name: 'Desc', val: 'Null' },
|
|
24
|
+
{ name: 'Link', val: 'https://astro-pure.js.org/' },
|
|
25
|
+
{ name: 'Avatar', val: 'https://astro-pure.js.org/favicon/favicon.ico' }
|
|
26
|
+
]
|
|
27
27
|
})
|
|
28
28
|
.describe('Friend links for your website.')
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { exec } from 'child_process'
|
|
2
|
+
|
|
3
|
+
const runCommand = (command, cwd, timeout = 5000) => {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
const child = exec(command, { cwd, timeout }, (error, stdout, stderr) => {
|
|
6
|
+
if (error) {
|
|
7
|
+
reject(`Error: ${stderr}`)
|
|
8
|
+
} else {
|
|
9
|
+
resolve(stdout)
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
child.on('error', (error) => {
|
|
14
|
+
reject(`Execution error: ${error.message}`)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
child.on('exit', (code) => {
|
|
18
|
+
if (code !== 0) {
|
|
19
|
+
reject(`Command exited with code ${code}`)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default async function main() {
|
|
26
|
+
if (process.env.BUN_LINK_PKG === 'true') {
|
|
27
|
+
try {
|
|
28
|
+
console.log('Running "bun link" at "./packages/pure"')
|
|
29
|
+
console.log(await runCommand('bun link', './packages/pure'))
|
|
30
|
+
console.log('Running "bun link astro-pure" at "."')
|
|
31
|
+
console.log(await runCommand('bun link astro-pure', '.'))
|
|
32
|
+
console.log('Commands executed successfully.')
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error(error)
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
console.log('BUN_LINK_PKG is not set to true. Skipping commands.')
|
|
38
|
+
}
|
|
39
|
+
}
|
package/scripts/index.js
CHANGED
|
@@ -5,12 +5,16 @@ import { readFileSync } from 'fs'
|
|
|
5
5
|
import { dirname, join } from 'path'
|
|
6
6
|
import { fileURLToPath } from 'url'
|
|
7
7
|
|
|
8
|
+
import checkFunc from './check.mjs'
|
|
8
9
|
import minimist from './libs/minimist.cjs'
|
|
9
10
|
import newFunc from './new.mjs'
|
|
10
11
|
|
|
11
12
|
const args = minimist(process.argv.slice(2))
|
|
12
13
|
|
|
13
14
|
switch (args._[0]) {
|
|
15
|
+
case 'check':
|
|
16
|
+
await checkFunc()
|
|
17
|
+
break
|
|
14
18
|
case 'new':
|
|
15
19
|
const newArgs = process.argv.slice(3)
|
|
16
20
|
newFunc(newArgs)
|
|
@@ -27,6 +31,7 @@ switch (args._[0]) {
|
|
|
27
31
|
break
|
|
28
32
|
case 'help':
|
|
29
33
|
console.log('Usage:')
|
|
34
|
+
console.log(' check - Check envirionment and run corresponding adaption code')
|
|
30
35
|
console.log(' new [args] - Create new post on blog collection')
|
|
31
36
|
console.log(' info - Show this info message')
|
|
32
37
|
console.log(' help - Show this help message')
|
package/types/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Icons } from '../libs/icons'
|
|
|
2
2
|
|
|
3
3
|
export type { IntegrationUserConfig } from './integrations-config'
|
|
4
4
|
export type { ThemeUserConfig } from './theme-config'
|
|
5
|
-
export type { UserInputConfig as Config } from './user-config'
|
|
5
|
+
export type { UserInputConfig as Config, UserConfig as ConfigOutput } from './user-config'
|
|
6
6
|
|
|
7
7
|
export interface SiteMeta {
|
|
8
8
|
title: string
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { clsx, type ClassValue } from './clsx'
|
|
2
|
+
|
|
3
|
+
export function simpleMerge(...classes: string[]): string {
|
|
4
|
+
const uniqueClasses = new Set<string>()
|
|
5
|
+
|
|
6
|
+
classes.forEach((cls) => {
|
|
7
|
+
if (cls) {
|
|
8
|
+
cls.split(' ').forEach((c) => uniqueClasses.add(c))
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
return Array.from(uniqueClasses).join(' ')
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function cn(...inputs: ClassValue[]) {
|
|
16
|
+
return simpleMerge(clsx(inputs))
|
|
17
|
+
}
|
package/utils/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { default as mdastToString } from './mdast-util-to-string'
|
|
|
4
4
|
export { default as getReadingTime } from './reading-time'
|
|
5
5
|
|
|
6
6
|
// Tailwind cn
|
|
7
|
-
export { cn } from './
|
|
7
|
+
export { cn } from './class-merge'
|
|
8
8
|
|
|
9
9
|
// Date
|
|
10
10
|
export { getFormattedDate } from './date'
|
package/utils/server.ts
CHANGED
|
@@ -12,15 +12,23 @@ export async function getBlogCollection(contentType: CollectionKey = 'blog') {
|
|
|
12
12
|
})
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
function getYearFromCollection<T extends CollectionKey>(
|
|
16
|
+
collection: CollectionEntry<T>
|
|
17
|
+
): number | undefined {
|
|
18
|
+
const dateStr = collection.data.updatedDate ?? collection.data.publishDate
|
|
19
|
+
return dateStr ? new Date(dateStr).getFullYear() : undefined
|
|
20
|
+
}
|
|
15
21
|
export function groupCollectionsByYear<T extends CollectionKey>(
|
|
16
22
|
collections: Collections
|
|
17
23
|
): [number, CollectionEntry<T>[]][] {
|
|
18
24
|
const collectionsByYear = collections.reduce((acc, collection) => {
|
|
19
|
-
const year =
|
|
20
|
-
if (
|
|
21
|
-
acc.
|
|
25
|
+
const year = getYearFromCollection(collection)
|
|
26
|
+
if (year !== undefined) {
|
|
27
|
+
if (!acc.has(year)) {
|
|
28
|
+
acc.set(year, [])
|
|
29
|
+
}
|
|
30
|
+
acc.get(year)!.push(collection)
|
|
22
31
|
}
|
|
23
|
-
acc.get(year)!.push(collection)
|
|
24
32
|
return acc
|
|
25
33
|
}, new Map<number, Collections>())
|
|
26
34
|
|
|
@@ -29,10 +37,10 @@ export function groupCollectionsByYear<T extends CollectionKey>(
|
|
|
29
37
|
).sort((a, b) => b[0] - a[0])
|
|
30
38
|
}
|
|
31
39
|
|
|
32
|
-
export function sortMDByDate(collections: Collections) {
|
|
40
|
+
export function sortMDByDate(collections: Collections): Collections {
|
|
33
41
|
return collections.sort((a, b) => {
|
|
34
|
-
const aDate = new Date(a.data.updatedDate ?? a.data.publishDate).valueOf()
|
|
35
|
-
const bDate = new Date(b.data.updatedDate ?? b.data.publishDate).valueOf()
|
|
42
|
+
const aDate = new Date(a.data.updatedDate ?? a.data.publishDate ?? 0).valueOf()
|
|
43
|
+
const bDate = new Date(b.data.updatedDate ?? b.data.publishDate ?? 0).valueOf()
|
|
36
44
|
return bDate - aDate
|
|
37
45
|
})
|
|
38
46
|
}
|