@coffic/cosy-ui 0.3.69 → 0.4.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.
Files changed (34) hide show
  1. package/dist/app.css +1 -1
  2. package/dist/components/base/Alert.astro +3 -3
  3. package/dist/components/containers/Container.astro +80 -4
  4. package/dist/components/containers/Main.astro +41 -54
  5. package/dist/components/data-display/Blog.astro +1 -0
  6. package/dist/components/data-display/ProductCard.astro +0 -2
  7. package/dist/components/data-display/Products.astro +0 -2
  8. package/dist/components/data-display/TeamMember.astro +0 -2
  9. package/dist/components/data-display/TeamMembers.astro +0 -2
  10. package/dist/components/display/Banner.astro +0 -1
  11. package/dist/components/display/Card.astro +0 -1
  12. package/dist/components/display/CodeBlock.astro +0 -1
  13. package/dist/components/display/CodeExample.astro +0 -1
  14. package/dist/components/display/Modal.astro +65 -67
  15. package/dist/components/layouts/AppLayout.astro +258 -0
  16. package/dist/components/layouts/BaseLayout.astro +46 -92
  17. package/dist/components/layouts/DashboardLayout.astro +615 -604
  18. package/dist/components/layouts/Footer.astro +141 -113
  19. package/dist/components/layouts/Header.astro +11 -292
  20. package/dist/components/layouts/Sidebar.astro +54 -31
  21. package/dist/components/layouts/SidebarNav.astro +1 -11
  22. package/dist/components/typography/Article.astro +8 -30
  23. package/dist/index.ts +7 -4
  24. package/dist/types/article.ts +22 -0
  25. package/dist/types/footer.ts +119 -22
  26. package/dist/types/header.ts +70 -0
  27. package/dist/types/layout.ts +71 -10
  28. package/dist/types/main.ts +69 -0
  29. package/dist/types/meta.ts +50 -0
  30. package/dist/types/sidebar.ts +38 -0
  31. package/package.json +2 -2
  32. package/dist/components/layouts/DefaultLayout.astro +0 -170
  33. package/dist/components/layouts/DocumentationLayout.astro +0 -624
  34. package/dist/components/layouts/LandingLayout.astro +0 -388
@@ -10,37 +10,134 @@ export interface Product {
10
10
  }
11
11
 
12
12
  export interface FooterProps {
13
- siteName: string;
14
- homeLink: string;
15
- slogan: string;
13
+ /**
14
+ * 关于链接
15
+ */
16
+ aboutLink?: string;
17
+
18
+ /**
19
+ * 博客链接
20
+ */
21
+ blogLink?: string;
22
+
23
+ /**
24
+ * 职业链接
25
+ */
26
+ careersLink?: string;
27
+
28
+ /**
29
+ * 公司名称
30
+ */
16
31
  company: string;
32
+
33
+ /**
34
+ * 联系链接
35
+ */
36
+ contactLink?: string;
37
+
38
+ /**
39
+ * 版权信息
40
+ */
17
41
  copyright: string;
18
- inspirationalSlogan: string;
42
+
43
+ /**
44
+ * 调试模式
45
+ */
19
46
  debug?: boolean;
47
+
48
+ /**
49
+ * 是否启用日志输出
50
+ * @default false
51
+ */
52
+ enableLogging?: boolean;
53
+
54
+ /**
55
+ * 常见问题链接
56
+ */
57
+ faqLink?: string;
58
+
59
+ /**
60
+ * 历史链接
61
+ */
62
+ historyLink?: string;
63
+
64
+ /**
65
+ * 首页链接
66
+ */
67
+ homeLink: string;
68
+
69
+ /**
70
+ * ICP备案号
71
+ */
20
72
  icp?: string;
73
+
74
+ /**
75
+ * 激励标语
76
+ */
77
+ inspirationalSlogan: string;
78
+
79
+ /**
80
+ * 语言代码,默认自动检测
81
+ */
82
+ lang?: string;
83
+
84
+ /**
85
+ * 徽标
86
+ */
21
87
  logo?: Logo;
22
- products?: Product[];
23
- aboutLink?: string;
24
- contactLink?: string;
25
- termsLink?: string;
88
+
89
+ /**
90
+ * 媒体链接
91
+ */
92
+ mediaLink?: string;
93
+
94
+ /**
95
+ * 新闻链接
96
+ */
97
+ newsLink?: string;
98
+
99
+ /**
100
+ * 合作伙伴链接
101
+ */
102
+ partnersLink?: string;
103
+
104
+ /**
105
+ * 隐私链接
106
+ */
26
107
  privacyLink?: string;
108
+
109
+ /**
110
+ * 产品
111
+ */
112
+ products?: Product[];
113
+
114
+ /**
115
+ * 站点名称
116
+ */
117
+ siteName: string;
118
+
119
+ /**
120
+ * 标语
121
+ */
122
+ slogan: string;
123
+
124
+ /**
125
+ * 社交链接
126
+ */
27
127
  socialLinks?: string[];
128
+
129
+ /**
130
+ * 团队链接
131
+ */
28
132
  teamLink?: string;
29
- careersLink?: string;
30
- newsLink?: string;
31
- historyLink?: string;
32
- partnersLink?: string;
33
- blogLink?: string;
34
- faqLink?: string;
35
- mediaLink?: string;
36
- techStackLink?: string;
133
+
37
134
  /**
38
- * 语言代码,默认自动检测
135
+ * 技术栈链接
39
136
  */
40
- lang?: string;
137
+ techStackLink?: string;
138
+
41
139
  /**
42
- * 是否启用日志输出
43
- * @default false
140
+ * 条款链接
44
141
  */
45
- enableLogging?: boolean;
46
- }
142
+ termsLink?: string;
143
+ }
@@ -0,0 +1,70 @@
1
+ export interface HeaderProps {
2
+ /**
3
+ * 基础路径,用于处理网站部署在二级目录的情况
4
+ * @default ""
5
+ */
6
+ basePath?: string;
7
+
8
+ /**
9
+ * 当前语言代码
10
+ */
11
+ currentLocale?: string;
12
+
13
+ /**
14
+ * 侧边栏是否默认展开
15
+ * @default false
16
+ */
17
+ defaultSidebarOpen?: boolean;
18
+
19
+ /**
20
+ * 导航栏高度
21
+ * @default "md"
22
+ */
23
+ height?: '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
24
+
25
+ /**
26
+ * 语言选项列表
27
+ */
28
+ languages?: Array<{ code: string; name: string }>;
29
+
30
+ /**
31
+ * Logo图片元数据
32
+ */
33
+ logo?: ImageMetadata;
34
+
35
+ /**
36
+ * Logo 链接地址
37
+ * @default "/"
38
+ */
39
+ logoHref?: string;
40
+
41
+ /**
42
+ * 导航菜单项
43
+ */
44
+ navItems?: Array<{
45
+ href: string;
46
+ label: string;
47
+ match: (path: string) => boolean;
48
+ }>;
49
+
50
+ /**
51
+ * 是否显示侧边栏切换按钮
52
+ * @default false
53
+ */
54
+ showSidebarToggle?: boolean;
55
+
56
+ /**
57
+ * 社交链接
58
+ */
59
+ socialLinks?: Array<{
60
+ name: string;
61
+ url: string;
62
+ icon: any;
63
+ }>;
64
+
65
+ /**
66
+ * 是否固定在顶部
67
+ * @default true
68
+ */
69
+ sticky?: boolean;
70
+ }
@@ -1,10 +1,71 @@
1
- export interface SidebarItem {
2
- href: string;
3
- text: string;
4
- items?: SidebarItem[];
5
- }
6
-
7
- export interface SidebarSection {
8
- title: string;
9
- items: SidebarItem[];
10
- }
1
+ import type { FooterProps } from "./footer";
2
+ import type { HeaderProps } from "./header";
3
+ import type { MainContentProps } from "./main";
4
+ import type { MetaProps } from "./meta";
5
+ import type { SidebarProps } from "./sidebar";
6
+
7
+ export interface AppLayoutProps {
8
+ /**
9
+ * 是否显示侧边栏
10
+ * @default true
11
+ */
12
+ showSidebar?: boolean;
13
+
14
+ /**
15
+ * 是否显示页眉
16
+ * @default true
17
+ */
18
+ showHeader?: boolean;
19
+
20
+ /**
21
+ * 是否显示页脚
22
+ * @default true
23
+ */
24
+ showFooter?: boolean;
25
+
26
+ /**
27
+ * 自定义头部内容
28
+ */
29
+ head?: astroHTML.JSX.Element;
30
+
31
+ /**
32
+ * 自定义头部内容
33
+ */
34
+ headerConfig: HeaderProps;
35
+
36
+ /**
37
+ * 侧边栏配置
38
+ */
39
+ sidebarConfig: SidebarProps;
40
+
41
+ /**
42
+ * 主内容配置
43
+ */
44
+ mainContentConfig: MainContentProps;
45
+
46
+ /**
47
+ * 页面类名
48
+ */
49
+ class?: string;
50
+
51
+ /**
52
+ * 类名列表
53
+ */
54
+ 'class:list'?: any;
55
+
56
+ /**
57
+ * 调试模式,显示各个部分的边框
58
+ * @default false
59
+ */
60
+ debug?: boolean;
61
+
62
+ /**
63
+ * 元数据配置
64
+ */
65
+ metaConfig: MetaProps;
66
+
67
+ /**
68
+ * 页脚相关配置
69
+ */
70
+ footerConfig: FooterProps;
71
+ }
@@ -0,0 +1,69 @@
1
+ export interface MainContentProps {
2
+ /**
3
+ * 容器大小
4
+ * @default "md"
5
+ */
6
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
7
+
8
+ /**
9
+ * 水平内边距(通过 Container 组件的 padding 属性设置)
10
+ * @default "md"
11
+ */
12
+ padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
13
+
14
+ /**
15
+ * 布局方式
16
+ * @default 'column'
17
+ */
18
+ layout?: 'row' | 'column';
19
+
20
+ /**
21
+ * 当前语言
22
+ */
23
+ currentLocale?: string;
24
+
25
+ /**
26
+ * 垂直内边距
27
+ * @default "md"
28
+ */
29
+ verticalPadding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | string;
30
+
31
+ /**
32
+ * 是否居中显示内容
33
+ * @default true
34
+ */
35
+ centered?: boolean;
36
+
37
+ /**
38
+ * 是否为文章布局
39
+ * @default false
40
+ */
41
+ isArticle?: boolean;
42
+
43
+ /**
44
+ * 是否显示目录
45
+ * @default false
46
+ */
47
+ showTableOfContents?: boolean;
48
+
49
+ /**
50
+ * 背景颜色
51
+ * @default undefined
52
+ */
53
+ backgroundColor?: 'primary' | 'secondary' | 'tertiary' | 'light' | 'dark' | string;
54
+
55
+ /**
56
+ * HTML id 属性
57
+ */
58
+ id?: string;
59
+
60
+ /**
61
+ * 类名
62
+ */
63
+ class?: string;
64
+
65
+ /**
66
+ * 类名列表
67
+ */
68
+ 'class:list'?: any;
69
+ }
@@ -0,0 +1,50 @@
1
+ export interface MetaProps {
2
+ title: string;
3
+ description: string;
4
+ keywords: string;
5
+ author: string;
6
+ robots: string;
7
+
8
+ /**
9
+ * 基础路径,用于处理网站部署在二级目录的情况
10
+ * @default ""
11
+ */
12
+ basePath?: string;
13
+
14
+ /**
15
+ * 站点名称
16
+ */
17
+ siteName?: string;
18
+
19
+ /**
20
+ * 页面语言
21
+ * @default "zh-CN"
22
+ */
23
+ lang?: string;
24
+
25
+ /**
26
+ * 是否包含视口元标签
27
+ * @default true
28
+ */
29
+ viewport?: boolean;
30
+
31
+ /**
32
+ * 自定义CSS
33
+ */
34
+ customStyles?: string;
35
+
36
+ /**
37
+ * 自定义头部内容
38
+ */
39
+ head?: astroHTML.JSX.Element;
40
+
41
+ /**
42
+ * 页面类名
43
+ */
44
+ class?: string;
45
+
46
+ /**
47
+ * 类名列表
48
+ */
49
+ 'class:list'?: any;
50
+ }
@@ -0,0 +1,38 @@
1
+ export interface SidebarItem {
2
+ href: string;
3
+ text: string;
4
+ items?: SidebarItem[];
5
+ }
6
+
7
+ export interface SidebarSection {
8
+ title: string;
9
+ items: SidebarItem[];
10
+ }
11
+
12
+ export interface SidebarProps {
13
+ /**
14
+ * 侧边栏项目
15
+ */
16
+ sidebarItems: SidebarSection[];
17
+
18
+ /**
19
+ * 桌面端类名
20
+ */
21
+ class?: string;
22
+
23
+ /**
24
+ * 是否开启调试模式,显示边框
25
+ * @default false
26
+ */
27
+ debug?: boolean;
28
+
29
+ /**
30
+ * 侧边栏顶部外边距
31
+ */
32
+ marginTop?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | string;
33
+
34
+ /**
35
+ * 侧边栏底部外边距
36
+ */
37
+ marginBottom?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | string;
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffic/cosy-ui",
3
- "version": "0.3.69",
3
+ "version": "0.4.5",
4
4
  "description": "An astro component library",
5
5
  "author": {
6
6
  "name": "nookery",
@@ -17,7 +17,7 @@
17
17
  "astro",
18
18
  "cosy-ui"
19
19
  ],
20
- "homepage": "https://github.com/CofficLab/cosy-ui",
20
+ "homepage": "https://cofficlab.github.io/cosy-ui/en/",
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },
@@ -1,170 +0,0 @@
1
- ---
2
- /**
3
- * DefaultLayout组件
4
- *
5
- * 包含常用页面结构的默认布局,包括简单的页眉和页脚
6
- *
7
- * @example
8
- * ```astro
9
- * ---
10
- * import DefaultLayout from '../layouts/DefaultLayout.astro';
11
- * ---
12
- *
13
- * <DefaultLayout title="页面标题" description="页面描述">
14
- * <h1>页面内容</h1>
15
- * <p>这是页面的主要内容</p>
16
- * </DefaultLayout>
17
- * ```
18
- */
19
-
20
- import BaseLayout from './BaseLayout.astro';
21
- import Link from '../base/Link.astro';
22
-
23
- // 导入样式
24
- import '../../app.css';
25
-
26
- export interface NavLink {
27
- href: string;
28
- label: string;
29
- }
30
-
31
- export interface Props {
32
- /**
33
- * 页面标题
34
- */
35
- title: string;
36
-
37
- /**
38
- * 页面描述
39
- */
40
- description?: string;
41
-
42
- /**
43
- * 页面关键词
44
- */
45
- keywords?: string;
46
-
47
- /**
48
- * 是否显示页眉
49
- * @default true
50
- */
51
- showHeader?: boolean;
52
-
53
- /**
54
- * 是否显示页脚
55
- * @default true
56
- */
57
- showFooter?: boolean;
58
-
59
- /**
60
- * 网站名称
61
- * @default "网站名称"
62
- */
63
- siteName?: string;
64
-
65
- /**
66
- * 导航链接
67
- */
68
- navLinks?: NavLink[];
69
-
70
- /**
71
- * 页面容器类名
72
- */
73
- containerClass?: string;
74
-
75
- /**
76
- * 自定义头部内容
77
- */
78
- head?: astroHTML.JSX.Element;
79
-
80
- /**
81
- * 页面类名
82
- */
83
- class?: string;
84
-
85
- /**
86
- * 类名列表
87
- */
88
- 'class:list'?: any;
89
- }
90
-
91
- const {
92
- title,
93
- description,
94
- keywords,
95
- showHeader = true,
96
- showFooter = true,
97
- siteName = "网站名称",
98
- navLinks = [
99
- { href: "/", label: "首页" },
100
- { href: "/about", label: "关于" },
101
- { href: "/contact", label: "联系我们" }
102
- ],
103
- containerClass = "container mx-auto px-4 py-8",
104
- head,
105
- class: className,
106
- 'class:list': classList,
107
- ...rest
108
- } = Astro.props;
109
-
110
- const year = new Date().getFullYear();
111
- ---
112
-
113
- <BaseLayout
114
- title={title}
115
- description={description}
116
- keywords={keywords}
117
- head={head}
118
- class={className}
119
- {...rest}
120
- >
121
- {showHeader && (
122
- <header class="site-header">
123
- <div class="container px-4 py-4">
124
- <div class="header-content">
125
- <div class="logo">
126
- <a href="/" class="site-name">{siteName}</a>
127
- </div>
128
-
129
- <nav class="main-nav">
130
- <ul class="nav-list">
131
- {navLinks.map((link: NavLink) => (
132
- <li class="nav-item">
133
- <Link href={link.href} variant="text">{link.label}</Link>
134
- </li>
135
- ))}
136
- </ul>
137
- </nav>
138
- </div>
139
- </div>
140
- </header>
141
- )}
142
-
143
- <main class={containerClass}>
144
- <slot />
145
- </main>
146
-
147
- {showFooter && (
148
- <footer class="site-footer">
149
- <div class="container px-4 py-8">
150
- <div class="footer-content">
151
- <div class="footer-info">
152
- <p class="copyright">&copy; {year} {siteName}. 保留所有权利。</p>
153
- </div>
154
-
155
- <nav class="footer-nav">
156
- <ul class="nav-list">
157
- {navLinks.map((link: NavLink) => (
158
- <li class="nav-item">
159
- <Link href={link.href} variant="text" size="sm">{link.label}</Link>
160
- </li>
161
- ))}
162
- </ul>
163
- </nav>
164
- </div>
165
- </div>
166
- </footer>
167
- )}
168
-
169
- <slot name="after-footer" />
170
- </BaseLayout>