astro-pure 1.3.3 → 1.3.4

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.
@@ -83,7 +83,7 @@ const [owner, repoName] = repo.split('/')
83
83
  .loading .load-block {
84
84
  color: transparent;
85
85
  border-radius: calc(var(--radius) - 3px);
86
- background-color: hsl(var(--primary-foreground) / var(--un-text-opacity));
86
+ background-color: hsl(var(--primary-foreground) / var(--un-bg-opacity, 1));
87
87
  animation: pulsate 2s infinite linear;
88
88
  user-select: none;
89
89
  }
@@ -93,6 +93,9 @@ const [owner, repoName] = repo.split('/')
93
93
  .no-license {
94
94
  opacity: 0.5;
95
95
  }
96
+ :not(.loading) #gh-avatar {
97
+ background-color: hsl(var(--primary-foreground) / var(--un-bg-opacity));
98
+ }
96
99
  </style>
97
100
 
98
101
  <script>
@@ -152,7 +155,6 @@ const [owner, repoName] = repo.split('/')
152
155
  const avatarEl = this.querySelector('#gh-avatar') as HTMLElement
153
156
  if (avatarEl) {
154
157
  avatarEl.style.backgroundImage = `url(${data.owner.avatar_url})`
155
- avatarEl.style.backgroundColor = 'transparent'
156
158
  }
157
159
 
158
160
  this.classList.remove('loading')
@@ -1,11 +1,14 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types'
3
+
2
4
  import { cn } from '../../utils'
3
5
 
4
- interface Props {
6
+ type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & {
5
7
  as?: string
6
8
  title?: string
7
9
  href?: string
8
10
  variant?: 'button' | 'pill' | 'back' | 'ahead'
11
+ target?: string
9
12
  class?: string
10
13
  }
11
14
 
@@ -1,6 +1,15 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types'
3
+
2
4
  import { cn } from '../../utils'
3
5
 
6
+ type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & {
7
+ heading?: string
8
+ subheading?: string
9
+ date?: string
10
+ class?: string
11
+ }
12
+
4
13
  const { as: Tag = 'div', class: className, href, heading, subheading, date } = Astro.props
5
14
  ---
6
15
 
@@ -1,14 +1,19 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types'
3
+
2
4
  import type { CardList } from '../../types'
3
5
  import { cn } from '../../utils'
4
6
 
5
- type Props = { main?: boolean; children: CardList }
7
+ type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & {
8
+ main?: boolean
9
+ children: CardList
10
+ }
6
11
  const { main = false, children } = Astro.props
7
12
  ---
8
13
 
9
14
  <ul class={cn('flex flex-col gap-y-1', !main && 'subitem list-disc ms-5')}>
10
15
  {
11
- children.map((child) => {
16
+ children.map((child: CardList[number]) => {
12
17
  const Tag = child.link ? 'a' : 'p'
13
18
  return (
14
19
  <li>
@@ -1,6 +1,13 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types'
3
+
2
4
  import { cn } from '../../utils'
3
5
 
6
+ type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & {
7
+ title: string
8
+ href?: string
9
+ class?: string
10
+ }
4
11
  const { class: className, as: Tag = 'div', title, href, ...props } = Astro.props
5
12
  ---
6
13
 
@@ -1,6 +1,12 @@
1
1
  ---
2
+ import type { HTMLTag, Polymorphic } from 'astro/types'
3
+
2
4
  import { cn } from '../../utils'
3
5
 
6
+ type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & {
7
+ class?: string
8
+ }
9
+
4
10
  const { as: Tag = 'span', class: className } = Astro.props
5
11
  ---
6
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-pure",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "A simple, clean but powerful blog theme build by astro.",
5
5
  "type": "module",
6
6
  "author": "CWorld",
package/scripts/new.mjs CHANGED
@@ -7,6 +7,7 @@
7
7
  * -l, --lang <en|zh> Set the language (default: en)
8
8
  * -d, --draft Create a draft post (default: false)
9
9
  * -m, --mdx Use MDX format (default: false)
10
+ * -f, --folder Create the post in a folder (default: false)
10
11
  * -h, --help Show this help message
11
12
  *
12
13
  * Example:
@@ -32,6 +33,7 @@ function getDate() {
32
33
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
33
34
  }
34
35
 
36
+ /** get blog title slug */
35
37
  function getPostSlug(postTitle) {
36
38
  let slug = slugify(postTitle).toLocaleLowerCase()
37
39
  if (slug === '') {
@@ -46,6 +48,7 @@ Options:
46
48
  -l, --lang Set the language (default: null)
47
49
  -d, --draft Create a draft post (default: false)
48
50
  -m, --mdx Use MDX format (default: false)
51
+ -f, --folder Create the post in a folder (default: false)
49
52
  -h, --help Show this help message
50
53
 
51
54
  Example:
@@ -57,17 +60,19 @@ const TARGET_DIR = 'src/content/blog/'
57
60
  export default function main(args) {
58
61
  const parsedArgs = minimist(args, {
59
62
  string: ['lang'],
60
- boolean: ['draft', 'mdx', 'help'],
63
+ boolean: ['draft', 'mdx', 'help', 'folder'],
61
64
  default: {
62
65
  lang: null,
63
66
  draft: false,
64
- mdx: false
67
+ mdx: false,
68
+ folder: false
65
69
  },
66
70
  alias: {
67
71
  l: 'lang',
68
72
  d: 'draft',
69
73
  m: 'mdx',
70
- h: 'help'
74
+ h: 'help',
75
+ f: 'folder'
71
76
  }
72
77
  })
73
78
 
@@ -84,7 +89,20 @@ export default function main(args) {
84
89
 
85
90
  const fileExtension = parsedArgs.mdx ? '.mdx' : '.md'
86
91
  const fileName = getPostSlug(postTitle) + fileExtension
87
- const fullPath = path.join(TARGET_DIR, fileName)
92
+
93
+ let fullPath
94
+ if (parsedArgs.folder) {
95
+ const folderName = getPostSlug(postTitle);
96
+ const folderPath = path.join(TARGET_DIR, folderName);
97
+ if (!fs.existsSync(folderPath)) {
98
+ fs.mkdirSync(folderPath, { recursive: true });
99
+ }
100
+ const fileName = 'index' + fileExtension;
101
+ fullPath = path.join(folderPath, fileName);
102
+ } else {
103
+ fullPath = path.join(TARGET_DIR, fileName);
104
+ }
105
+
88
106
 
89
107
  console.log('Full path:', fullPath)
90
108
 
@@ -100,7 +118,9 @@ publishDate: ${getDate()}
100
118
  `
101
119
  content += parsedArgs.draft ? 'draft: true\n' : ''
102
120
  content += parsedArgs.lang ? `lang: ${parsedArgs.lang}\n` : ''
103
- content += `tags: ['tag1', 'tag2']
121
+ content += `tags:
122
+ - Example
123
+ - Technology
104
124
  ---
105
125
 
106
126
  Write your content here.