@coffic/cosy-ui 0.1.28 → 0.2.0
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 +67 -23
- package/dist/app.css +1 -0
- package/dist/assets/logo-rounded.png +0 -0
- package/dist/assets/logo.png +0 -0
- package/dist/components/base/Alert.astro +186 -0
- package/dist/components/base/Button.astro +103 -0
- package/dist/components/base/Image.astro +291 -0
- package/dist/components/base/Link.astro +131 -0
- package/dist/components/base/README.md +53 -0
- package/dist/components/base/index.ts +6 -0
- package/dist/components/containers/Container.astro +103 -0
- package/dist/components/containers/Main.astro +167 -0
- package/dist/components/containers/Section.astro +145 -0
- package/dist/components/containers/index.ts +3 -0
- package/dist/components/data-display/Blog.astro +195 -0
- package/dist/components/data-display/README.md +37 -0
- package/dist/components/data-display/TeamMember.astro +135 -0
- package/dist/components/data-display/TeamMembers.astro +101 -0
- package/dist/components/data-display/index.ts +3 -0
- package/dist/components/display/Banner.astro +57 -0
- package/dist/components/display/Card.astro +135 -0
- package/dist/components/display/CodeBlock.astro +147 -0
- package/dist/components/display/CodeExample.astro +330 -0
- package/dist/components/display/Hero.astro +119 -0
- package/dist/components/display/Modal.astro +115 -0
- package/dist/components/display/README.md +32 -0
- package/dist/components/display/index.ts +6 -0
- package/dist/components/icons/AlertTriangle.astro +35 -0
- package/dist/components/icons/CalendarIcon.astro +38 -0
- package/dist/components/icons/CheckCircle.astro +36 -0
- package/dist/components/icons/CheckIcon.astro +38 -0
- package/dist/components/icons/ClipboardIcon.astro +39 -0
- package/dist/components/icons/CloseIcon.astro +38 -0
- package/dist/components/icons/ErrorIcon.astro +35 -0
- package/dist/components/icons/GithubIcon.astro +31 -0
- package/dist/components/icons/InfoCircle.astro +37 -0
- package/dist/components/icons/InfoIcon.astro +38 -0
- package/dist/components/icons/LinkIcon.astro +39 -0
- package/dist/components/icons/LinkedinIcon.astro +31 -0
- package/dist/components/icons/MenuIcon.astro +41 -0
- package/dist/components/icons/SearchIcon.astro +40 -0
- package/dist/components/icons/SocialIcon.astro +100 -0
- package/dist/components/icons/SuccessIcon.astro +35 -0
- package/dist/components/icons/SunCloudyIcon.astro +45 -0
- package/dist/components/icons/TwitterIcon.astro +31 -0
- package/dist/components/icons/UserIcon.astro +35 -0
- package/dist/components/icons/WarningIcon.astro +38 -0
- package/dist/components/icons/XCircle.astro +37 -0
- package/dist/components/icons/index.ts +23 -0
- package/dist/components/layouts/BaseLayout.astro +144 -0
- package/dist/components/layouts/DashboardLayout.astro +660 -0
- package/dist/components/layouts/DefaultLayout.astro +170 -0
- package/dist/components/layouts/DocumentationLayout.astro +469 -0
- package/dist/components/layouts/Flex.astro +138 -0
- package/dist/components/layouts/Footer.astro +284 -0
- package/dist/components/layouts/Grid.astro +182 -0
- package/dist/components/layouts/Header.astro +114 -0
- package/dist/components/layouts/LandingLayout.astro +388 -0
- package/dist/components/layouts/README.md +37 -0
- package/dist/components/layouts/Stack.astro +149 -0
- package/dist/components/layouts/index.ts +6 -0
- package/dist/components/navigation/LanguageSwitcher.astro +81 -0
- package/dist/components/navigation/README.md +24 -0
- package/dist/components/navigation/TableOfContents.astro +352 -0
- package/dist/components/navigation/ThemeSwitcher.astro +89 -0
- package/dist/components/navigation/index.ts +3 -0
- package/dist/components/typography/Article.astro +144 -0
- package/dist/components/typography/Heading.astro +205 -0
- package/dist/components/typography/README.md +29 -0
- package/dist/components/typography/Text.astro +187 -0
- package/dist/components/typography/index.ts +3 -0
- package/dist/index.ts +9 -0
- package/dist/integration.ts +14 -0
- package/dist/style.ts +1 -0
- package/{src → dist}/types/footer.ts +11 -7
- package/{src → dist}/utils/social.ts +5 -12
- package/dist/utils/theme.ts +55 -0
- package/package.json +65 -59
- package/index.ts +0 -18
- package/src/components/Alert.astro +0 -78
- package/src/components/Article.astro +0 -11
- package/src/components/Banner.astro +0 -49
- package/src/components/Blog.astro +0 -115
- package/src/components/Button.astro +0 -49
- package/src/components/Card.astro +0 -113
- package/src/components/CodeBlock.astro +0 -186
- package/src/components/Footer.astro +0 -130
- package/src/components/Header.astro +0 -305
- package/src/components/Hero.astro +0 -69
- package/src/components/Image.astro +0 -251
- package/src/components/Link.astro +0 -82
- package/src/components/Modal.astro +0 -67
- package/src/components/SocialIcon.astro +0 -36
- package/src/components/TeamMember.astro +0 -68
- package/src/components/TeamMembers.astro +0 -43
- package/src/env.d.ts +0 -0
- /package/{src/components → dist/components/base}/ThemeItem.astro +0 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<svg
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
width={size}
|
25
|
+
height={size}
|
26
|
+
viewBox="0 0 24 24"
|
27
|
+
fill="none"
|
28
|
+
stroke={color}
|
29
|
+
stroke-width="2"
|
30
|
+
stroke-linecap="round"
|
31
|
+
stroke-linejoin="round"
|
32
|
+
class={className}
|
33
|
+
>
|
34
|
+
<path d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
|
35
|
+
</svg>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* 警告图标组件
|
4
|
+
*/
|
5
|
+
interface Props {
|
6
|
+
/**
|
7
|
+
* 图标的大小
|
8
|
+
* @default "24px"
|
9
|
+
*/
|
10
|
+
size?: string;
|
11
|
+
/**
|
12
|
+
* 图标的颜色
|
13
|
+
* @default "currentColor"
|
14
|
+
*/
|
15
|
+
color?: string;
|
16
|
+
/**
|
17
|
+
* 自定义类名
|
18
|
+
*/
|
19
|
+
class?: string;
|
20
|
+
}
|
21
|
+
|
22
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
23
|
+
---
|
24
|
+
|
25
|
+
<svg
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
27
|
+
width={size}
|
28
|
+
height={size}
|
29
|
+
viewBox="0 0 24 24"
|
30
|
+
fill="none"
|
31
|
+
stroke={color}
|
32
|
+
stroke-width="2"
|
33
|
+
stroke-linecap="round"
|
34
|
+
stroke-linejoin="round"
|
35
|
+
class={className}
|
36
|
+
>
|
37
|
+
<path d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
38
|
+
</svg>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<svg
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
width={size}
|
25
|
+
height={size}
|
26
|
+
viewBox="0 0 24 24"
|
27
|
+
fill="none"
|
28
|
+
stroke={color}
|
29
|
+
stroke-width="2"
|
30
|
+
stroke-linecap="round"
|
31
|
+
stroke-linejoin="round"
|
32
|
+
class={className}
|
33
|
+
>
|
34
|
+
<circle cx="12" cy="12" r="10"></circle>
|
35
|
+
<line x1="15" y1="9" x2="9" y2="15"></line>
|
36
|
+
<line x1="9" y1="9" x2="15" y2="15"></line>
|
37
|
+
</svg>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// 导出所有图标组件
|
2
|
+
export { default as AlertTriangle } from './AlertTriangle.astro';
|
3
|
+
export { default as CheckCircle } from './CheckCircle.astro';
|
4
|
+
export { default as XCircle } from './XCircle.astro';
|
5
|
+
export { default as InfoCircle } from './InfoCircle.astro';
|
6
|
+
export { default as InfoIcon } from './InfoIcon.astro';
|
7
|
+
export { default as SuccessIcon } from './SuccessIcon.astro';
|
8
|
+
export { default as WarningIcon } from './WarningIcon.astro';
|
9
|
+
export { default as ErrorIcon } from './ErrorIcon.astro';
|
10
|
+
export { default as CloseIcon } from './CloseIcon.astro';
|
11
|
+
export { default as ClipboardIcon } from './ClipboardIcon.astro';
|
12
|
+
export { default as CheckIcon } from './CheckIcon.astro';
|
13
|
+
export { default as LinkIcon } from './LinkIcon.astro';
|
14
|
+
export { default as UserIcon } from './UserIcon.astro';
|
15
|
+
export { default as CalendarIcon } from './CalendarIcon.astro';
|
16
|
+
|
17
|
+
// 社交媒体图标
|
18
|
+
export { default as SocialIcon } from './SocialIcon.astro';
|
19
|
+
export { default as GithubIcon } from './GithubIcon.astro';
|
20
|
+
export { default as TwitterIcon } from './TwitterIcon.astro';
|
21
|
+
export { default as LinkedinIcon } from './LinkedinIcon.astro';
|
22
|
+
|
23
|
+
// 随着图标增加,可以在这里继续添加导出
|
@@ -0,0 +1,144 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component BaseLayout
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* BaseLayout 组件是最基础的 HTML 结构布局,提供完整的 HTML 骨架和元数据设置。
|
7
|
+
* 它是所有页面布局的基础,处理了基本的 HTML 结构、元数据和全局样式。
|
8
|
+
*
|
9
|
+
* @design
|
10
|
+
* 设计理念:
|
11
|
+
* 1. 基础结构 - 提供标准的 HTML5 文档结构
|
12
|
+
* 2. 元数据管理 - 集中管理页面的标题、描述和关键词等元数据
|
13
|
+
* 3. 全局样式 - 应用基础的重置样式和全局变量
|
14
|
+
* 4. 灵活扩展 - 支持自定义头部内容和样式
|
15
|
+
*
|
16
|
+
* @usage
|
17
|
+
* 基本用法:
|
18
|
+
* ```astro
|
19
|
+
* ---
|
20
|
+
* import { BaseLayout } from '@coffic/cosy-ui';
|
21
|
+
* ---
|
22
|
+
*
|
23
|
+
* <BaseLayout title="页面标题" description="页面描述">
|
24
|
+
* <main>
|
25
|
+
* <h1>页面内容</h1>
|
26
|
+
* <p>这是页面的主要内容</p>
|
27
|
+
* </main>
|
28
|
+
* </BaseLayout>
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* 添加自定义头部内容:
|
32
|
+
* ```astro
|
33
|
+
* <BaseLayout
|
34
|
+
* title="页面标题"
|
35
|
+
* head={`<link rel="canonical" href="https://example.com" />`}
|
36
|
+
* >
|
37
|
+
* <p>页面内容</p>
|
38
|
+
* </BaseLayout>
|
39
|
+
* ```
|
40
|
+
*
|
41
|
+
* 自定义样式:
|
42
|
+
* ```astro
|
43
|
+
* <BaseLayout
|
44
|
+
* title="页面标题"
|
45
|
+
* customStyles={`body { background-color: #f5f5f5; }`}
|
46
|
+
* >
|
47
|
+
* <p>页面内容</p>
|
48
|
+
* </BaseLayout>
|
49
|
+
* ```
|
50
|
+
*/
|
51
|
+
|
52
|
+
// 导入样式
|
53
|
+
import '../../app.css';
|
54
|
+
|
55
|
+
export interface Props {
|
56
|
+
/**
|
57
|
+
* 页面标题
|
58
|
+
*/
|
59
|
+
title: string;
|
60
|
+
|
61
|
+
/**
|
62
|
+
* 页面描述
|
63
|
+
* @default ""
|
64
|
+
*/
|
65
|
+
description?: string;
|
66
|
+
|
67
|
+
/**
|
68
|
+
* 页面关键词
|
69
|
+
* @default ""
|
70
|
+
*/
|
71
|
+
keywords?: string;
|
72
|
+
|
73
|
+
/**
|
74
|
+
* 页面语言
|
75
|
+
* @default "zh-CN"
|
76
|
+
*/
|
77
|
+
lang?: string;
|
78
|
+
|
79
|
+
/**
|
80
|
+
* 是否包含视口元标签
|
81
|
+
* @default true
|
82
|
+
*/
|
83
|
+
viewport?: boolean;
|
84
|
+
|
85
|
+
/**
|
86
|
+
* 自定义CSS
|
87
|
+
*/
|
88
|
+
customStyles?: string;
|
89
|
+
|
90
|
+
/**
|
91
|
+
* 自定义头部内容
|
92
|
+
*/
|
93
|
+
head?: astroHTML.JSX.Element;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* 页面类名
|
97
|
+
*/
|
98
|
+
class?: string;
|
99
|
+
|
100
|
+
/**
|
101
|
+
* 类名列表
|
102
|
+
*/
|
103
|
+
'class:list'?: any;
|
104
|
+
}
|
105
|
+
|
106
|
+
const {
|
107
|
+
title,
|
108
|
+
description = "",
|
109
|
+
keywords = "",
|
110
|
+
lang = "zh-CN",
|
111
|
+
viewport = true,
|
112
|
+
customStyles = "",
|
113
|
+
head,
|
114
|
+
class: className,
|
115
|
+
'class:list': classList,
|
116
|
+
} = Astro.props;
|
117
|
+
|
118
|
+
// 处理类名
|
119
|
+
let bodyClasses = className || "";
|
120
|
+
---
|
121
|
+
|
122
|
+
<!DOCTYPE html>
|
123
|
+
<html lang={lang}>
|
124
|
+
<head>
|
125
|
+
<meta charset="UTF-8" />
|
126
|
+
{viewport && <meta name="viewport" content="width=device-width, initial-scale=1.0" />}
|
127
|
+
<title>{title}</title>
|
128
|
+
{description && <meta name="description" content={description} />}
|
129
|
+
{keywords && <meta name="keywords" content={keywords} />}
|
130
|
+
<meta name="generator" content={Astro.generator} />
|
131
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
132
|
+
|
133
|
+
<!-- 自定义样式 -->
|
134
|
+
{customStyles && <style set:html={customStyles}></style>}
|
135
|
+
|
136
|
+
<!-- 自定义头部内容 -->
|
137
|
+
{head && <div set:html={head} />}
|
138
|
+
|
139
|
+
<slot name="head" />
|
140
|
+
</head>
|
141
|
+
<body class:list={[bodyClasses, classList]}>
|
142
|
+
<slot />
|
143
|
+
</body>
|
144
|
+
</html>
|