@coffic/cosy-ui 0.5.2 → 0.5.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.
@@ -1,143 +1,138 @@
1
1
  export interface Logo {
2
- src: string;
3
- alt: string;
2
+ src: string;
3
+ alt: string;
4
4
  }
5
5
 
6
6
  export interface Product {
7
- name: string;
8
- href: string;
9
- external?: boolean;
7
+ name: string;
8
+ href: string;
9
+ external?: boolean;
10
10
  }
11
11
 
12
12
  export interface FooterProps {
13
- /**
14
- * 关于链接
15
- */
16
- aboutLink?: string;
17
-
18
- /**
19
- * 博客链接
20
- */
21
- blogLink?: string;
22
-
23
- /**
24
- * 职业链接
25
- */
26
- careersLink?: string;
27
-
28
- /**
29
- * 公司名称
30
- */
31
- company: string;
32
-
33
- /**
34
- * 联系链接
35
- */
36
- contactLink?: string;
37
-
38
- /**
39
- * 版权信息
40
- */
41
- copyright: string;
42
-
43
- /**
44
- * 调试模式
45
- */
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
- */
72
- icp?: string;
73
-
74
- /**
75
- * 激励标语
76
- */
77
- inspirationalSlogan: string;
78
-
79
- /**
80
- * 语言代码,默认自动检测
81
- */
82
- lang?: string;
83
-
84
- /**
85
- * 徽标
86
- */
87
- logo?: Logo;
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
- */
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
- */
127
- socialLinks?: string[];
128
-
129
- /**
130
- * 团队链接
131
- */
132
- teamLink?: string;
133
-
134
- /**
135
- * 技术栈链接
136
- */
137
- techStackLink?: string;
138
-
139
- /**
140
- * 条款链接
141
- */
142
- termsLink?: 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
+ */
31
+ company: string;
32
+
33
+ /**
34
+ * 联系链接
35
+ */
36
+ contactLink?: string;
37
+
38
+ /**
39
+ * 版权信息
40
+ */
41
+ copyright: string;
42
+
43
+ /**
44
+ * 调试模式
45
+ */
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
+ */
72
+ icp?: string;
73
+
74
+ /**
75
+ * 激励标语
76
+ */
77
+ inspirationalSlogan: string;
78
+
79
+ /**
80
+ * 徽标
81
+ */
82
+ logo?: Logo;
83
+
84
+ /**
85
+ * 媒体链接
86
+ */
87
+ mediaLink?: string;
88
+
89
+ /**
90
+ * 新闻链接
91
+ */
92
+ newsLink?: string;
93
+
94
+ /**
95
+ * 合作伙伴链接
96
+ */
97
+ partnersLink?: string;
98
+
99
+ /**
100
+ * 隐私链接
101
+ */
102
+ privacyLink?: string;
103
+
104
+ /**
105
+ * 产品
106
+ */
107
+ products?: Product[];
108
+
109
+ /**
110
+ * 站点名称
111
+ */
112
+ siteName: string;
113
+
114
+ /**
115
+ * 标语
116
+ */
117
+ slogan: string;
118
+
119
+ /**
120
+ * 社交链接
121
+ */
122
+ socialLinks?: string[];
123
+
124
+ /**
125
+ * 团队链接
126
+ */
127
+ teamLink?: string;
128
+
129
+ /**
130
+ * 技术栈链接
131
+ */
132
+ techStackLink?: string;
133
+
134
+ /**
135
+ * 条款链接
136
+ */
137
+ termsLink?: string;
143
138
  }
@@ -1,68 +1,64 @@
1
1
  export interface HeaderProps {
2
- /**
3
- * 基础路径,用于处理网站部署在二级目录的情况
4
- * @default ""
5
- */
6
- basePath?: string;
2
+ /**
3
+ * 侧边栏是否默认展开
4
+ * @default false
5
+ */
6
+ defaultSidebarOpen?: boolean;
7
7
 
8
- /**
9
- * 当前语言代码
10
- */
11
- currentLocale?: string;
8
+ /**
9
+ * 导航栏高度
10
+ * @default "md"
11
+ */
12
+ height?: '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
13
 
13
- /**
14
- * 侧边栏是否默认展开
15
- * @default false
16
- */
17
- defaultSidebarOpen?: boolean;
14
+ /**
15
+ * 语言选项列表
16
+ */
17
+ languages?: string[];
18
18
 
19
- /**
20
- * 导航栏高度
21
- * @default "md"
22
- */
23
- height?: '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
19
+ /**
20
+ * Logo图片元数据
21
+ */
22
+ logo?: ImageMetadata;
24
23
 
25
- /**
26
- * 语言选项列表
27
- */
28
- languages?: string[];
24
+ /**
25
+ * Logo 链接地址
26
+ * @default "/"
27
+ */
28
+ logoHref?: string;
29
29
 
30
- /**
31
- * Logo图片元数据
32
- */
33
- logo?: ImageMetadata;
30
+ /**
31
+ * 导航菜单项
32
+ */
33
+ navItems?: NavItem[];
34
34
 
35
- /**
36
- * Logo 链接地址
37
- * @default "/"
38
- */
39
- logoHref?: string;
35
+ /**
36
+ * 是否显示侧边栏切换按钮
37
+ * @default false
38
+ */
39
+ showSidebarToggle?: boolean;
40
40
 
41
- /**
42
- * 导航菜单项
43
- */
44
- navItems?: NavItem[];
41
+ /**
42
+ * 社交链接
43
+ */
44
+ socialLinks?: Array<{
45
+ name: string;
46
+ url: string;
47
+ icon: any;
48
+ }>;
45
49
 
46
- /**
47
- * 是否显示侧边栏切换按钮
48
- * @default false
49
- */
50
- showSidebarToggle?: boolean;
50
+ /**
51
+ * 是否固定在顶部
52
+ * @default true
53
+ */
54
+ sticky?: boolean;
51
55
 
52
- /**
53
- * 社交链接
54
- */
55
- socialLinks?: Array<{
56
- name: string;
57
- url: string;
58
- icon: any;
59
- }>;
56
+ rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
60
57
 
61
- /**
62
- * 是否固定在顶部
63
- * @default true
64
- */
65
- sticky?: boolean;
58
+ paddingHorizontal?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
59
+ paddingVertical?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
60
+
61
+ navPosition?: 'start' | 'center' | 'end';
66
62
  }
67
63
 
68
- export type NavItem = { href: string; label: string; };
64
+ export type NavItem = { href: string; label: string };
@@ -1,66 +1,64 @@
1
1
  /**
2
2
  * 国际化文本配置
3
- *
3
+ *
4
4
  * 提供组件的多语言文本内容
5
5
  */
6
6
 
7
- import type { SupportedLanguage, LanguageInfo } from './language';
8
-
9
7
  // 定义文本内容的类型
10
8
  type TextContent = Record<string, Record<string, string>>;
11
9
 
12
10
  // 多语言文本内容
13
- export const texts: Record<SupportedLanguage, TextContent> = {
14
- 'en': {
15
- tableOfContents: {
16
- title: 'Table of Contents',
17
- loading: 'Loading...'
18
- },
19
- footer: {
20
- products: 'Products',
21
- about: 'About',
22
- aboutUs: 'About Us',
23
- team: 'Our Team',
24
- careers: 'Careers',
25
- contactUs: 'Contact Us',
26
- resources: 'Resources',
27
- news: 'News',
28
- blog: 'Blog',
29
- faq: 'FAQ',
30
- history: 'History',
31
- techStack: 'Tech Stack',
32
- legal: 'Legal',
33
- terms: 'Terms of Service',
34
- privacy: 'Privacy Policy',
35
- slogan: 'Build a beautiful digital experience',
36
- allRightsReserved: 'All Rights Reserved'
37
- }
38
- },
39
- 'zh-cn': {
40
- tableOfContents: {
41
- title: '目录',
42
- loading: '加载中...'
43
- },
44
- footer: {
45
- products: '产品',
46
- about: '关于',
47
- aboutUs: '关于我们',
48
- team: '团队介绍',
49
- careers: '加入我们',
50
- contactUs: '联系我们',
51
- defaultSlogan: '优雅、高效的组件库',
52
- resources: '资源',
53
- news: '新闻动态',
54
- blog: '技术博客',
55
- faq: '常见问题',
56
- history: '发展历程',
57
- techStack: '技术栈',
58
- legal: '法律',
59
- terms: '服务条款',
60
- privacy: '隐私政策',
61
- allRightsReserved: '保留所有权利'
62
- }
63
- }
11
+ export const texts: Record<string, TextContent> = {
12
+ en: {
13
+ tableOfContents: {
14
+ title: 'Table of Contents',
15
+ loading: 'Loading...',
16
+ },
17
+ footer: {
18
+ products: 'Products',
19
+ about: 'About',
20
+ aboutUs: 'About Us',
21
+ team: 'Our Team',
22
+ careers: 'Careers',
23
+ contactUs: 'Contact Us',
24
+ resources: 'Resources',
25
+ news: 'News',
26
+ blog: 'Blog',
27
+ faq: 'FAQ',
28
+ history: 'History',
29
+ techStack: 'Tech Stack',
30
+ legal: 'Legal',
31
+ terms: 'Terms of Service',
32
+ privacy: 'Privacy Policy',
33
+ slogan: 'Build a beautiful digital experience',
34
+ allRightsReserved: 'All Rights Reserved',
35
+ },
36
+ },
37
+ 'zh-cn': {
38
+ tableOfContents: {
39
+ title: '目录',
40
+ loading: '加载中...',
41
+ },
42
+ footer: {
43
+ products: '产品',
44
+ about: '关于',
45
+ aboutUs: '关于我们',
46
+ team: '团队介绍',
47
+ careers: '加入我们',
48
+ contactUs: '联系我们',
49
+ defaultSlogan: '优雅、高效的组件库',
50
+ resources: '资源',
51
+ news: '新闻动态',
52
+ blog: '技术博客',
53
+ faq: '常见问题',
54
+ history: '发展历程',
55
+ techStack: '技术栈',
56
+ legal: '法律',
57
+ terms: '服务条款',
58
+ privacy: '隐私政策',
59
+ allRightsReserved: '保留所有权利',
60
+ },
61
+ },
64
62
  };
65
63
 
66
64
  /**
@@ -70,8 +68,8 @@ export const texts: Record<SupportedLanguage, TextContent> = {
70
68
  * @param key 文本键名
71
69
  * @returns 对应的文本内容
72
70
  */
73
- export function getText(lang: SupportedLanguage, component: string, key: string): string {
74
- return texts[lang]?.[component]?.[key] || texts['en'][component]?.[key] || '';
71
+ export function getText(lang: string, component: string, key: string): string {
72
+ return texts[lang]?.[component]?.[key] || texts['en'][component]?.[key] || '';
75
73
  }
76
74
 
77
75
  /**
@@ -80,6 +78,6 @@ export function getText(lang: SupportedLanguage, component: string, key: string)
80
78
  * @param component 组件名称
81
79
  * @returns 文本获取函数
82
80
  */
83
- export function createTextGetter(langInfo: LanguageInfo, component: string) {
84
- return (key: string): string => getText(langInfo.code, component, key);
85
- }
81
+ export function createTextGetter(langInfo: string, component: string) {
82
+ return (key: string): string => getText(langInfo, component, key);
83
+ }