@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.
- package/dist/app.css +1 -1
- package/dist/components/base/Image.astro +2 -1
- package/dist/components/layouts/AppLayout.astro +4 -20
- package/dist/components/layouts/BaseLayout.astro +1 -1
- package/dist/components/layouts/Footer.astro +14 -9
- package/dist/components/layouts/Grid.astro +106 -98
- package/dist/components/layouts/Header.astro +153 -39
- package/dist/components/layouts/Sidebar.astro +59 -3
- package/dist/components/navigation/TableOfContents.astro +3 -3
- package/dist/integration.ts +4 -4
- package/dist/style.ts +2 -1
- package/dist/types/footer.ts +130 -135
- package/dist/types/header.ts +51 -55
- package/dist/utils/i18n.ts +57 -59
- package/dist/utils/language.ts +102 -162
- package/package.json +2 -2
package/dist/types/footer.ts
CHANGED
@@ -1,143 +1,138 @@
|
|
1
1
|
export interface Logo {
|
2
|
-
|
3
|
-
|
2
|
+
src: string;
|
3
|
+
alt: string;
|
4
4
|
}
|
5
5
|
|
6
6
|
export interface Product {
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
name: string;
|
8
|
+
href: string;
|
9
|
+
external?: boolean;
|
10
10
|
}
|
11
11
|
|
12
12
|
export interface FooterProps {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
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
|
}
|
package/dist/types/header.ts
CHANGED
@@ -1,68 +1,64 @@
|
|
1
1
|
export interface HeaderProps {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
/**
|
3
|
+
* 侧边栏是否默认展开
|
4
|
+
* @default false
|
5
|
+
*/
|
6
|
+
defaultSidebarOpen?: boolean;
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
/**
|
9
|
+
* 导航栏高度
|
10
|
+
* @default "md"
|
11
|
+
*/
|
12
|
+
height?: '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
defaultSidebarOpen?: boolean;
|
14
|
+
/**
|
15
|
+
* 语言选项列表
|
16
|
+
*/
|
17
|
+
languages?: string[];
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
height?: '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
19
|
+
/**
|
20
|
+
* Logo图片元数据
|
21
|
+
*/
|
22
|
+
logo?: ImageMetadata;
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
/**
|
25
|
+
* Logo 链接地址
|
26
|
+
* @default "/"
|
27
|
+
*/
|
28
|
+
logoHref?: string;
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
/**
|
31
|
+
* 导航菜单项
|
32
|
+
*/
|
33
|
+
navItems?: NavItem[];
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
/**
|
36
|
+
* 是否显示侧边栏切换按钮
|
37
|
+
* @default false
|
38
|
+
*/
|
39
|
+
showSidebarToggle?: boolean;
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
/**
|
42
|
+
* 社交链接
|
43
|
+
*/
|
44
|
+
socialLinks?: Array<{
|
45
|
+
name: string;
|
46
|
+
url: string;
|
47
|
+
icon: any;
|
48
|
+
}>;
|
45
49
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
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 };
|
package/dist/utils/i18n.ts
CHANGED
@@ -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<
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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:
|
74
|
-
|
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:
|
84
|
-
|
85
|
-
}
|
81
|
+
export function createTextGetter(langInfo: string, component: string) {
|
82
|
+
return (key: string): string => getText(langInfo, component, key);
|
83
|
+
}
|