@coffic/cosy-ui 0.8.20 → 0.8.22
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/src/assets/iconData.ts +10 -0
- package/dist/src/utils/i18n.ts +52 -50
- package/dist/src-astro/banner/Banner.astro +55 -3
- package/dist/src-astro/banner/index.ts +1 -52
- package/dist/src-astro/button/Button.astro +41 -2
- package/dist/src-astro/code-container/ButtonCodeToggle.astro +55 -0
- package/dist/src-astro/code-container/ButtonCopyCode.astro +74 -0
- package/dist/src-astro/code-container/CodeContainer.astro +14 -289
- package/dist/src-astro/code-container/CodePanel.astro +14 -0
- package/dist/src-astro/code-container/CodeToolbar.astro +100 -0
- package/dist/src-astro/code-container/Description.astro +17 -0
- package/dist/src-astro/code-container/Preview.astro +93 -0
- package/dist/src-astro/footer/Footer.astro +52 -20
- package/dist/src-astro/footer/FooterSection.astro +7 -9
- package/dist/src-astro/grid/index.ts +1 -9
- package/dist/src-astro/heading/index.ts +1 -9
- package/dist/src-astro/hero/Hero.astro +78 -9
- package/dist/src-astro/icons/AppStoreIcon.astro +37 -0
- package/dist/src-astro/icons/AstroIcon.astro +8 -1
- package/dist/src-astro/icons/CodeIcon.astro +22 -0
- package/dist/src-astro/icons/WebsiteIcon.astro +31 -0
- package/dist/src-astro/icons/index.ts +4 -2
- package/dist/src-astro/language-switcher/LanguageSwitcher.astro +6 -2
- package/dist/src-astro/link/Link.astro +50 -3
- package/dist/src-astro/nav-item/index.ts +1 -9
- package/dist/src-astro/products/ProductCard.astro +68 -32
- package/dist/src-astro/types/footer.ts +130 -125
- package/dist/src-vue/iPhone/iPhoneWindow.vue +2 -6
- package/dist/src-vue/utils/i18n.ts +52 -50
- package/package.json +1 -1
- package/dist/src-astro/banner/BannerAllAnimations.astro +0 -10
- package/dist/src-astro/banner/BannerBasic.astro +0 -5
- package/dist/src-astro/banner/BannerCustomStyle.astro +0 -8
- package/dist/src-astro/banner/BannerDanger.astro +0 -5
- package/dist/src-astro/banner/BannerFadeIn.astro +0 -5
- package/dist/src-astro/banner/BannerInfo.astro +0 -5
- package/dist/src-astro/banner/BannerPrimary.astro +0 -5
- package/dist/src-astro/banner/BannerSecondary.astro +0 -5
- package/dist/src-astro/banner/BannerSlideUp.astro +0 -5
- package/dist/src-astro/banner/BannerSuccess.astro +0 -5
- package/dist/src-astro/banner/BannerWarning.astro +0 -5
- package/dist/src-astro/grid/GridBasic.astro +0 -21
- package/dist/src-astro/heading/HeadingBasic.astro +0 -10
- package/dist/src-astro/nav-item/NavItemsBasic.astro +0 -30
@@ -64,9 +64,32 @@
|
|
64
64
|
* />
|
65
65
|
* </div>
|
66
66
|
* ```
|
67
|
+
*
|
68
|
+
* 自定义阴影样式:
|
69
|
+
* ```astro
|
70
|
+
* <ProductCard
|
71
|
+
* shadow="lg"
|
72
|
+
* name="突出显示的产品"
|
73
|
+
* image="/images/products/product1.jpg"
|
74
|
+
* description="使用大阴影突出显示的产品"
|
75
|
+
* />
|
76
|
+
*
|
77
|
+
* <ProductCard
|
78
|
+
* shadow="none"
|
79
|
+
* name="简洁风格产品"
|
80
|
+
* image="/images/products/product2.jpg"
|
81
|
+
* description="无阴影的简洁风格"
|
82
|
+
* />
|
83
|
+
* ```
|
67
84
|
*/
|
68
85
|
|
69
|
-
import {
|
86
|
+
import {
|
87
|
+
SocialIcon,
|
88
|
+
Image,
|
89
|
+
Button,
|
90
|
+
LinkIcon,
|
91
|
+
AppStoreIcon,
|
92
|
+
} from '../../index-astro';
|
70
93
|
import '../../style.ts';
|
71
94
|
import type { ImageSource } from '../types/image.ts';
|
72
95
|
|
@@ -138,6 +161,15 @@ export interface Props {
|
|
138
161
|
* 自定义类名
|
139
162
|
*/
|
140
163
|
class?: string;
|
164
|
+
/**
|
165
|
+
* 卡片阴影样式
|
166
|
+
* - none: 无阴影
|
167
|
+
* - sm: 小阴影
|
168
|
+
* - md: 中等阴影(默认)
|
169
|
+
* - lg: 大阴影
|
170
|
+
* - xl: 超大阴影
|
171
|
+
*/
|
172
|
+
shadow?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
141
173
|
}
|
142
174
|
|
143
175
|
const {
|
@@ -155,6 +187,7 @@ const {
|
|
155
187
|
equalHeight = false,
|
156
188
|
descriptionLines,
|
157
189
|
class: className = '',
|
190
|
+
shadow = 'md',
|
158
191
|
} = Astro.props;
|
159
192
|
|
160
193
|
// 尺寸样式映射
|
@@ -238,6 +271,15 @@ const sizeStyles = {
|
|
238
271
|
|
239
272
|
const currentSize = sizeStyles[size];
|
240
273
|
|
274
|
+
// 阴影样式映射
|
275
|
+
const shadowStyles = {
|
276
|
+
none: 'cosy:shadow-none',
|
277
|
+
sm: 'cosy:shadow-sm cosy:hover:shadow-md',
|
278
|
+
md: 'cosy:shadow-md cosy:hover:shadow-lg',
|
279
|
+
lg: 'cosy:shadow-lg cosy:hover:shadow-xl',
|
280
|
+
xl: 'cosy:shadow-xl cosy:hover:shadow-2xl',
|
281
|
+
};
|
282
|
+
|
241
283
|
// 描述文本的行数限制
|
242
284
|
const descriptionClass = descriptionLines
|
243
285
|
? `cosy:line-clamp-${descriptionLines}`
|
@@ -279,7 +321,8 @@ const buttonsContainerClass =
|
|
279
321
|
|
280
322
|
<div
|
281
323
|
class:list={[
|
282
|
-
'cosy:card cosy:bg-base-100 cosy:
|
324
|
+
'cosy:card cosy:bg-base-100 cosy:transition-shadow cosy:duration-300',
|
325
|
+
shadowStyles[shadow],
|
283
326
|
currentSize.card,
|
284
327
|
equalHeight && currentSize.cardHeight,
|
285
328
|
'cosy:flex cosy:flex-col',
|
@@ -319,54 +362,47 @@ const buttonsContainerClass =
|
|
319
362
|
<div class={buttonsContainerClass}>
|
320
363
|
{
|
321
364
|
productUrl && (
|
322
|
-
<
|
365
|
+
<Button
|
323
366
|
href={productUrl}
|
324
|
-
|
367
|
+
target="_blank"
|
325
368
|
variant="primary"
|
326
|
-
class:list={[
|
327
|
-
'cosy:btn cosy:bg-[#4468e3] cosy:hover:bg-[#3857cc] cosy:border-0',
|
328
|
-
'cosy:text-white cosy:font-bold cosy:shadow-sm',
|
329
|
-
buttonLayoutClass,
|
330
|
-
currentSize.buttons,
|
331
|
-
]}
|
369
|
+
class:list={[buttonLayoutClass, currentSize.buttons]}
|
332
370
|
aria-label={`Visit ${name}'s website`}>
|
371
|
+
<span slot="icon-left">
|
372
|
+
<LinkIcon size="22px" />
|
373
|
+
</span>
|
333
374
|
{primaryButtonText}
|
334
|
-
</
|
375
|
+
</Button>
|
335
376
|
)
|
336
377
|
}
|
337
378
|
{
|
338
379
|
appStoreUrl && (
|
339
|
-
<
|
380
|
+
<Button
|
340
381
|
href={appStoreUrl}
|
341
|
-
|
382
|
+
target="_blank"
|
342
383
|
variant="secondary"
|
343
|
-
class:list={[
|
344
|
-
'cosy:btn cosy:bg-[#161616] cosy:hover:bg-black cosy:border-0',
|
345
|
-
'cosy:text-white cosy:font-bold cosy:shadow-sm',
|
346
|
-
buttonLayoutClass,
|
347
|
-
currentSize.buttons,
|
348
|
-
]}
|
384
|
+
class:list={[buttonLayoutClass, currentSize.buttons]}
|
349
385
|
aria-label={`Download ${name} on App Store`}>
|
386
|
+
<span slot="icon-left">
|
387
|
+
<AppStoreIcon size="22px" />
|
388
|
+
</span>
|
350
389
|
{secondaryButtonText}
|
351
|
-
</
|
390
|
+
</Button>
|
352
391
|
)
|
353
392
|
}
|
354
393
|
{
|
355
394
|
githubUrl && (
|
356
|
-
<
|
395
|
+
<Button
|
357
396
|
href={githubUrl}
|
358
|
-
|
359
|
-
variant="
|
360
|
-
class:list={[
|
361
|
-
'cosy:btn cosy:bg-[#f0f0f0] cosy:hover:bg-[#e0e0e0] cosy:border-0',
|
362
|
-
'cosy:text-[#24292f] cosy:font-bold cosy:shadow-sm',
|
363
|
-
buttonLayoutClass,
|
364
|
-
currentSize.buttons,
|
365
|
-
]}
|
397
|
+
target="_blank"
|
398
|
+
variant="info"
|
399
|
+
class:list={[buttonLayoutClass, currentSize.buttons]}
|
366
400
|
aria-label={`View ${name}'s GitHub repository`}>
|
367
|
-
<
|
368
|
-
|
369
|
-
|
401
|
+
<span slot="icon-left">
|
402
|
+
<SocialIcon platform="github" size="22px" />
|
403
|
+
</span>
|
404
|
+
{githubButtonText}
|
405
|
+
</Button>
|
370
406
|
)
|
371
407
|
}
|
372
408
|
</div>
|
@@ -1,129 +1,134 @@
|
|
1
1
|
import type { ILogo, IProduct } from './product';
|
2
2
|
|
3
3
|
export interface IFooterProps {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
4
|
+
/**
|
5
|
+
* 关于链接
|
6
|
+
*/
|
7
|
+
aboutLink?: string;
|
8
|
+
|
9
|
+
/**
|
10
|
+
* 博客链接
|
11
|
+
*/
|
12
|
+
blogLink?: string;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* 职业链接
|
16
|
+
*/
|
17
|
+
careersLink?: string;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* 公司名称
|
21
|
+
*/
|
22
|
+
company: string;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* 联系链接
|
26
|
+
*/
|
27
|
+
contactLink?: string;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* 版权信息
|
31
|
+
*/
|
32
|
+
copyright: string;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* 调试模式
|
36
|
+
*/
|
37
|
+
debug?: boolean;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* 是否启用日志输出
|
41
|
+
* @default false
|
42
|
+
*/
|
43
|
+
enableLogging?: boolean;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* 常见问题链接
|
47
|
+
*/
|
48
|
+
faqLink?: string;
|
49
|
+
|
50
|
+
/**
|
51
|
+
* 友情链接
|
52
|
+
*/
|
53
|
+
friendlyLinks?: IProduct[];
|
54
|
+
|
55
|
+
/**
|
56
|
+
* 历史链接
|
57
|
+
*/
|
58
|
+
historyLink?: string;
|
59
|
+
|
60
|
+
/**
|
61
|
+
* 首页链接
|
62
|
+
*/
|
63
|
+
homeLink: string;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* ICP备案号
|
67
|
+
*/
|
68
|
+
icp?: string;
|
69
|
+
|
70
|
+
/**
|
71
|
+
* 激励标语
|
72
|
+
*/
|
73
|
+
inspirationalSlogan: string;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* 徽标
|
77
|
+
*/
|
78
|
+
logo?: ILogo;
|
79
|
+
|
80
|
+
/**
|
81
|
+
* 媒体链接
|
82
|
+
*/
|
83
|
+
mediaLink?: string;
|
84
|
+
|
85
|
+
/**
|
86
|
+
* 新闻链接
|
87
|
+
*/
|
88
|
+
newsLink?: string;
|
89
|
+
|
90
|
+
/**
|
91
|
+
* 合作伙伴链接
|
92
|
+
*/
|
93
|
+
partnersLink?: string;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* 隐私链接
|
97
|
+
*/
|
98
|
+
privacyLink?: string;
|
99
|
+
|
100
|
+
/**
|
101
|
+
* 产品
|
102
|
+
*/
|
103
|
+
products?: IProduct[];
|
104
|
+
|
105
|
+
/**
|
106
|
+
* 站点名称
|
107
|
+
*/
|
108
|
+
siteName: string;
|
109
|
+
|
110
|
+
/**
|
111
|
+
* 标语
|
112
|
+
*/
|
113
|
+
slogan: string;
|
114
|
+
|
115
|
+
/**
|
116
|
+
* 社交链接
|
117
|
+
*/
|
118
|
+
socialLinks?: string[];
|
119
|
+
|
120
|
+
/**
|
121
|
+
* 团队链接
|
122
|
+
*/
|
123
|
+
teamLink?: string;
|
124
|
+
|
125
|
+
/**
|
126
|
+
* 技术栈链接
|
127
|
+
*/
|
128
|
+
techStackLink?: string;
|
129
|
+
|
130
|
+
/**
|
131
|
+
* 条款链接
|
132
|
+
*/
|
133
|
+
termsLink?: string;
|
129
134
|
}
|
@@ -144,10 +144,6 @@ export default defineComponent({
|
|
144
144
|
const showAlertDialog = ref(false);
|
145
145
|
const alertMessage = ref('');
|
146
146
|
|
147
|
-
// 获取图片URL
|
148
|
-
const frameSrc =
|
149
|
-
typeof iphoneFrame === 'string' ? iphoneFrame : iphoneFrame.src;
|
150
|
-
|
151
147
|
// 计算当前高度的缩放比例
|
152
148
|
const getScaleRatio = () => {
|
153
149
|
const heightValues = {
|
@@ -168,7 +164,7 @@ export default defineComponent({
|
|
168
164
|
return {
|
169
165
|
showAlertDialog,
|
170
166
|
alertMessage,
|
171
|
-
|
167
|
+
iphoneFrame: (iphoneFrame as any).src || iphoneFrame,
|
172
168
|
heightClasses,
|
173
169
|
mainContentWidthAspectRatio,
|
174
170
|
mainContentHeightAspectRatio,
|
@@ -191,7 +187,7 @@ export default defineComponent({
|
|
191
187
|
backgroundColor: debug ? 'rgba(255, 255, 0, 0.3)' : 'transparent',
|
192
188
|
}">
|
193
189
|
<!-- iPhone 边框 -->
|
194
|
-
<img v-if="showFrame" style="max-width: 100%; max-height: 100%;" :src="
|
190
|
+
<img v-if="showFrame" style="max-width: 100%; max-height: 100%;" :src="iphoneFrame" alt="iPhone frame" />
|
195
191
|
|
196
192
|
<!-- 顶部状态栏 -->
|
197
193
|
<div :style="{
|
@@ -9,56 +9,58 @@ type TextContent = Record<string, Record<string, string>>;
|
|
9
9
|
|
10
10
|
// 多语言文本内容
|
11
11
|
export const texts: Record<string, TextContent> = {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
+
friendlyLinks: 'Friendly Links',
|
36
|
+
},
|
16
37
|
},
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
'zh-cn': {
|
39
|
+
tableOfContents: {
|
40
|
+
title: '目录',
|
41
|
+
loading: '加载中...',
|
42
|
+
},
|
43
|
+
footer: {
|
44
|
+
products: '产品',
|
45
|
+
about: '关于',
|
46
|
+
aboutUs: '关于我们',
|
47
|
+
team: '团队介绍',
|
48
|
+
careers: '加入我们',
|
49
|
+
contactUs: '联系我们',
|
50
|
+
defaultSlogan: '优雅、高效的组件库',
|
51
|
+
resources: '资源',
|
52
|
+
news: '新闻动态',
|
53
|
+
blog: '技术博客',
|
54
|
+
faq: '常见问题',
|
55
|
+
history: '发展历程',
|
56
|
+
techStack: '技术栈',
|
57
|
+
legal: '法律',
|
58
|
+
terms: '服务条款',
|
59
|
+
privacy: '隐私政策',
|
60
|
+
allRightsReserved: '保留所有权利',
|
61
|
+
friendlyLinks: '友情链接',
|
62
|
+
},
|
35
63
|
},
|
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
|
-
},
|
62
64
|
};
|
63
65
|
|
64
66
|
/**
|
@@ -69,7 +71,7 @@ export const texts: Record<string, TextContent> = {
|
|
69
71
|
* @returns 对应的文本内容
|
70
72
|
*/
|
71
73
|
export function getText(lang: string, component: string, key: string): string {
|
72
|
-
|
74
|
+
return texts[lang]?.[component]?.[key] || texts['en'][component]?.[key] || '';
|
73
75
|
}
|
74
76
|
|
75
77
|
/**
|
@@ -79,5 +81,5 @@ export function getText(lang: string, component: string, key: string): string {
|
|
79
81
|
* @returns 文本获取函数
|
80
82
|
*/
|
81
83
|
export function createTextGetter(langInfo: string, component: string) {
|
82
|
-
|
84
|
+
return (key: string): string => getText(langInfo, component, key);
|
83
85
|
}
|
package/package.json
CHANGED
@@ -1,10 +0,0 @@
|
|
1
|
-
---
|
2
|
-
import { Banner } from '../../index-astro';
|
3
|
-
---
|
4
|
-
|
5
|
-
<div class="flex flex-col gap-4">
|
6
|
-
<Banner animation="none">这是一个没有动画的横幅</Banner>
|
7
|
-
<Banner animation="fade">这是一个只有淡入动画的横幅</Banner>
|
8
|
-
<Banner animation="slide">这是一个只有上滑动画的横幅</Banner>
|
9
|
-
<Banner animation="both">这是一个同时有淡入和上滑动画的横幅</Banner>
|
10
|
-
</div>
|