astro-pure 1.2.4 → 1.2.6

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/README.md CHANGED
@@ -32,6 +32,8 @@ const config = {
32
32
  export default config
33
33
  ```
34
34
 
35
+ UnoCSS is more recommended, and TailwindCSS method will be removed soon.
36
+
35
37
  See [User Components](https://astro-pure.js.org/docs/integrations/components) & [Advanced Components](https://astro-pure.js.org/docs/integrations/advanced) to learn how to use.
36
38
 
37
39
  > Some part of Advanced Components may require Astro Integration config.
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(--tw-bg-opacity, 1));
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(--tw-text-opacity, 1));
69
- --waline-active-color: hsl(var(--primary) / var(--tw-text-opacity, 1));
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(--tw-text-opacity, 1));
72
- --waline-bg-color: hsl(var(--muted) / var(--tw-bg-opacity, 1));
73
- --waline-bg-color-light: hsl(var(--input) / var(--tw-text-opacity, 1));
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(--tw-border-opacity, 1));
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(--tw-border-opacity, 1));
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 border-border px-5 py-4 transition-colors hover:bg-muted hover:text-muted-foreground'
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(--tw-text-opacity));
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 border-border pt-5'>
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(--tw-text-opacity,1))'
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(--tw-bg-opacity, 1));
184
- border-bottom-color: hsl(var(--border) / var(--tw-border-opacity, 1));
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 border-border shadow-lg flex items-center gap-2'
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(() => {
@@ -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(--tw-bg-opacity, 1));
60
- --pagefind-ui-text: hsl(var(--foreground) / var(--tw-text-opacity, 1));
61
- --pagefind-ui-background: hsl(var(--muted) / var(--tw-bg-opacity, 1));
62
- --pagefind-ui-border: hsl(var(--border) / var(--tw-border-opacity, 1));
63
- --pagefind-ui-tag: hsl(var(--muted-foreground) / var(--tw-text-opacity, 1));
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 border-border bg-background transition-colors ease-in-out px-5 py-2.5 hover:bg-muted',
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(--tw-text-opacity,1)));
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
@@ -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(--tw-text-opacity, 1))
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(--tw-bg-opacity, 1))
142
+ hsl(var(--muted) / var(--un-bg-opacity, 1))
143
143
  ) !important;
144
144
  }
145
145
  & > a,
@@ -7,8 +7,10 @@ interface Props {
7
7
  }
8
8
 
9
9
  const {
10
- heading: { depth, slug, subheadings, text }
10
+ heading: { depth, slug, subheadings, text: rawText }
11
11
  } = Astro.props
12
+ // TODO: Temporary fix for the issue with the headings that end with link reference text
13
+ const text = rawText.endsWith('#') ? rawText.slice(0, -1) : rawText
12
14
  ---
13
15
 
14
16
  <li>
@@ -49,7 +49,7 @@ if (!title) {
49
49
 
50
50
  <style>
51
51
  .aside > .aside-container {
52
- --tw-bg-opacity: 0.07;
52
+ --un-bg-opacity: 0.07;
53
53
 
54
54
  &.aside-tip {
55
55
  --primary: 234 60% 60%;
@@ -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 border-border px-2 py-1 text-sm text-muted-foreground transition-all hover:bg-primary-foreground no-underline',
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 border-border bg-muted px-5 py-3',
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
  )}
@@ -6,7 +6,7 @@ type Props = { main?: boolean; children: CardList }
6
6
  const { main = false, children } = Astro.props
7
7
  ---
8
8
 
9
- <ul class={cn('flex flex-col gap-y-1', !main && 'list-disc ms-5')}>
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'
@@ -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(--tw-text-opacity, 1));
49
- background-color: hsl(var(--primary-foreground) / var(--tw-bg-opacity, 1));
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(--tw-border-opacity, 1));
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(--tw-border-opacity, 1));
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(--tw-text-opacity, 1));
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(--tw-border-opacity, 1));
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(--tw-border-opacity, 1));
127
- color: hsl(var(--foreground) / var(--tw-text-opacity, 1));
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(--tw-text-opacity, 1));
133
- border-color: hsl(var(--primary) / var(--tw-text-opacity, 1));
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
@@ -1,13 +1,13 @@
1
1
  import { spawn } from 'node:child_process'
2
- import path, { dirname, relative } from 'node:path'
2
+ import { dirname, relative } from 'node:path'
3
3
  import { fileURLToPath } from 'node:url'
4
4
  // Astro
5
5
  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'
10
+ import UnoCSS from 'unocss/astro'
11
11
 
12
12
  import { remarkAddZoomable, remarkReadingTime } from './plugins/remark-plugins'
13
13
  import { vitePluginUserConfig } from './plugins/virtual-user-config'
@@ -23,6 +23,7 @@ export default function AstroPureIntegration(opts: UserInputConfig): AstroIntegr
23
23
  hooks: {
24
24
  'astro:config:setup': async ({ config, updateConfig }) => {
25
25
  let userConfig = parseWithFriendlyErrors(
26
+ // @ts-ignore
26
27
  UserConfigSchema,
27
28
  opts,
28
29
  'Invalid config passed to astro-pure integration'
@@ -37,8 +38,8 @@ export default function AstroPureIntegration(opts: UserInputConfig): AstroIntegr
37
38
  if (!allIntegrations.find(({ name }) => name === '@astrojs/mdx')) {
38
39
  integrations.push(mdx({ optimize: true }))
39
40
  }
40
- if (!allIntegrations.find(({ name }) => name === '@astrojs/tailwind')) {
41
- integrations.push(tailwind({ applyBaseStyles: false }))
41
+ if (!allIntegrations.find(({ name }) => name === 'unocss')) {
42
+ integrations.push(UnoCSS({ injectReset: true }))
42
43
  }
43
44
 
44
45
  // Add supported remark plugins based on user config.
@@ -61,8 +62,6 @@ export default function AstroPureIntegration(opts: UserInputConfig): AstroIntegr
61
62
  // integrations.push(starlightDirectivesRestorationIntegration())
62
63
 
63
64
  // Add integrations immediately after Starlight in the config array.
64
- // e.g. if a user has `integrations: [starlight(), tailwind()]`, then the order will be
65
- // `[starlight(), expressiveCode(), sitemap(), mdx(), tailwind()]`.
66
65
  // This ensures users can add integrations before/after Starlight and we respect that order.
67
66
  const selfIndex = config.integrations.findIndex((i) => i.name === 'astro-pure')
68
67
  config.integrations.splice(selfIndex + 1, 0, ...integrations)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-pure",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "A simple, clean but powerful blog theme build by astro.",
5
5
  "type": "module",
6
6
  "author": "CWorld",
@@ -37,13 +37,12 @@
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
45
  "rehype-external-links": "^3.0.0",
47
- "tailwind-merge": "^2.5.5"
46
+ "unocss": "^65.4.3"
48
47
  }
49
48
  }
package/scripts/index.js CHANGED
@@ -31,6 +31,7 @@ switch (args._[0]) {
31
31
  break
32
32
  case 'help':
33
33
  console.log('Usage:')
34
+ console.log(' check - Check envirionment and run corresponding adaption code')
34
35
  console.log(' new [args] - Create new post on blog collection')
35
36
  console.log(' info - Show this info message')
36
37
  console.log(' help - Show this help message')
@@ -24,7 +24,7 @@ export const IntegrationConfigSchema = () =>
24
24
  target: z.string()
25
25
  }),
26
26
 
27
- /** Tailwindcss typography */
27
+ /** UnoCSS typography */
28
28
  typography: z.object({
29
29
  /** The class to apply to the typography. */
30
30
  class: z
@@ -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
@@ -3,8 +3,8 @@ export { default as clsx } from './clsx'
3
3
  export { default as mdastToString } from './mdast-util-to-string'
4
4
  export { default as getReadingTime } from './reading-time'
5
5
 
6
- // Tailwind cn
7
- export { cn } from './tailwind'
6
+ // Class merge
7
+ export { cn } from './class-merge'
8
8
 
9
9
  // Date
10
10
  export { getFormattedDate } from './date'
package/utils/tailwind.ts DELETED
@@ -1,7 +0,0 @@
1
- import { twMerge } from 'tailwind-merge'
2
-
3
- import { clsx, type ClassValue } from './clsx'
4
-
5
- export function cn(...inputs: ClassValue[]) {
6
- return twMerge(clsx(inputs))
7
- }