@coffic/cosy-ui 0.6.30 → 0.6.34
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/alert/AlertBasicContainer.astro +11 -0
- package/dist/alert/AlertCustomStyleContainer.astro +11 -0
- package/dist/alert/AlertError.astro +6 -0
- package/dist/alert/AlertInfo.astro +6 -0
- package/dist/alert/AlertSuccess.astro +6 -0
- package/dist/alert/AlertTypesContainer.astro +43 -0
- package/dist/alert/AlertWarning.astro +6 -0
- package/dist/alert/AlertWithTitleContainer.astro +11 -0
- package/dist/alert/index.ts +14 -18
- package/dist/app.css +1 -1
- package/dist/assets/iconData.ts +4 -1
- package/dist/{components/display → banner}/Banner.astro +32 -11
- package/dist/banner/BannerAllAnimations.astro +10 -0
- package/dist/banner/BannerBasic.astro +5 -0
- package/dist/banner/BannerCustomStyle.astro +7 -0
- package/dist/banner/BannerDanger.astro +5 -0
- package/dist/banner/BannerFadeIn.astro +5 -0
- package/dist/banner/BannerInfo.astro +5 -0
- package/dist/banner/BannerPrimary.astro +5 -0
- package/dist/banner/BannerSecondary.astro +5 -0
- package/dist/banner/BannerSlideUp.astro +5 -0
- package/dist/banner/BannerSuccess.astro +5 -0
- package/dist/banner/BannerWarning.astro +5 -0
- package/dist/banner/index.ts +41 -0
- package/dist/{components/data-display → blog}/Blog.astro +2 -2
- package/dist/blog/index.ts +1 -0
- package/dist/button/Button.astro +44 -13
- package/dist/button/Button.vue +105 -0
- package/dist/button/ButtonBasic.vue +11 -0
- package/dist/button/ButtonBasicContainer.astro +17 -0
- package/dist/button/ButtonBlock.astro +5 -0
- package/dist/button/ButtonError.astro +5 -0
- package/dist/{vue/Buttons/FeatureButton.vue → button/ButtonFeature.vue} +23 -23
- package/dist/{vue/Buttons/FeatureBasic.vue → button/ButtonFeatureBasic.vue} +2 -2
- package/dist/button/ButtonFeatureContainer.astro +18 -0
- package/dist/{vue/Buttons/FeatureWithTips.vue → button/ButtonFeatureWithTips.vue} +1 -2
- package/dist/button/ButtonGhost.astro +5 -0
- package/dist/button/ButtonIconBoth.astro +9 -0
- package/dist/button/ButtonIconLeft.astro +8 -0
- package/dist/button/ButtonIconRight.astro +8 -0
- package/dist/button/ButtonInfo.astro +5 -0
- package/dist/button/ButtonLink.astro +5 -0
- package/dist/button/ButtonLink.vue +13 -0
- package/dist/button/ButtonLinkContainer.astro +25 -0
- package/dist/button/ButtonLinkExternal.astro +8 -0
- package/dist/button/ButtonNeutral.astro +5 -0
- package/dist/button/ButtonOutline.astro +5 -0
- package/dist/button/ButtonShapeCircle.astro +5 -0
- package/dist/button/ButtonShapeDefault.astro +5 -0
- package/dist/button/ButtonShapeSquare.astro +5 -0
- package/dist/button/ButtonShapesContainer.astro +25 -0
- package/dist/button/ButtonSizes.astro +1 -1
- package/dist/button/ButtonSizes.vue +12 -0
- package/dist/button/ButtonSizesContainer.astro +17 -0
- package/dist/button/ButtonStatesContainer.astro +11 -0
- package/dist/button/ButtonSuccess.astro +5 -0
- package/dist/button/ButtonVariants.astro +14 -0
- package/dist/button/ButtonVariants.vue +16 -0
- package/dist/button/ButtonVariantsContainer.astro +71 -0
- package/dist/button/ButtonWarning.astro +5 -0
- package/dist/button/ButtonWide.astro +5 -0
- package/dist/button/ButtonWidth.astro +8 -0
- package/dist/button/ButtonWidthContainer.astro +19 -0
- package/dist/button/ButtonWithIcons.vue +21 -0
- package/dist/button/ButtonWithIconsContainer.astro +36 -0
- package/dist/button/index_astro.ts +64 -0
- package/dist/button/index_vue.ts +4 -0
- package/dist/card/Card.astro +91 -0
- package/dist/card/CardBasic.astro +5 -0
- package/dist/card/CardCompact.astro +77 -0
- package/dist/card/CardLink.astro +75 -0
- package/dist/card/CardWithImage.astro +39 -0
- package/dist/card/index.ts +7 -0
- package/dist/{components/display → code-block}/CodeBlock.astro +1 -1
- package/dist/code-block/index.ts +1 -0
- package/dist/code-container/CodeContainer.astro +254 -0
- package/dist/code-container/CodeContainerBasic.astro +19 -0
- package/dist/code-container/CodeContainerMultiple.astro +49 -0
- package/dist/code-container/index.ts +14 -0
- package/dist/{components/display → code-example}/CodeExample.astro +10 -11
- package/dist/code-example/index.ts +1 -0
- package/dist/{components/containers → container}/Container.astro +1 -1
- package/dist/container/index.ts +1 -0
- package/dist/env.d.ts +0 -6
- package/dist/footer/Footer.astro +2 -6
- package/dist/header/Header.astro +6 -1
- package/dist/{components/display → hero}/Hero.astro +2 -2
- package/dist/hero/HeroAlignCenter.astro +13 -0
- package/dist/hero/HeroAlignContainer.astro +23 -0
- package/dist/hero/HeroAlignLeft.astro +13 -0
- package/dist/hero/HeroAlignRight.astro +13 -0
- package/dist/hero/HeroBackgroundContainer.astro +18 -0
- package/dist/hero/HeroBackgroundImage.astro +12 -0
- package/dist/hero/HeroBackgroundImageContainer.astro +11 -0
- package/dist/hero/HeroBasic.astro +12 -0
- package/dist/hero/HeroBasicContainer.astro +11 -0
- package/dist/hero/HeroGradientBackground.astro +10 -0
- package/dist/hero/HeroPlainBackground.astro +10 -0
- package/dist/hero/HeroWithButton.astro +11 -0
- package/dist/hero/HeroWithButtonContainer.astro +11 -0
- package/dist/hero/HeroWithImage.astro +16 -0
- package/dist/hero/HeroWithImageContainer.astro +11 -0
- package/dist/hero/index.ts +39 -0
- package/dist/index.ts +1 -1
- package/dist/index_astro.ts +16 -27
- package/dist/index_vue.ts +1 -4
- package/dist/language-switcher/LanguageSwitcher.astro +1 -2
- package/dist/{components/containers → main}/Main.astro +2 -3
- package/dist/main/index.ts +1 -0
- package/dist/{components/display → modal}/Modal.astro +2 -2
- package/dist/modal/index.ts +1 -0
- package/dist/{components/data-display → products}/ProductCard.astro +3 -3
- package/dist/{components/data-display → products}/Products.astro +2 -2
- package/dist/products/index.ts +2 -0
- package/dist/{components/containers → section}/Section.astro +2 -2
- package/dist/section/index.ts +1 -0
- package/dist/sidebar/Sidebar.astro +1 -2
- package/dist/{components/data-display → team-member}/TeamMember.astro +4 -4
- package/dist/team-member/TeamMemberBasic.astro +25 -0
- package/dist/team-member/TeamMemberCustomStyle.astro +26 -0
- package/dist/team-member/TeamMemberGroup.astro +60 -0
- package/dist/team-member/TeamMemberWithSocial.astro +30 -0
- package/dist/{components/data-display → team-member}/TeamMembers.astro +2 -2
- package/dist/team-member/index.ts +23 -0
- package/dist/{theme-item → theme-switcher}/ThemeItem.astro +2 -2
- package/dist/theme-switcher/ThemeSwitcher.astro +10 -20
- package/dist/types/header.ts +32 -9
- package/package.json +5 -1
- package/dist/alert/AlertTypes.astro +0 -17
- package/dist/button/index.ts +0 -23
- package/dist/components/display/Card.astro +0 -162
- package/dist/theme-item/ThemeItemBasic.astro +0 -10
- package/dist/theme-item/index.ts +0 -11
- package/dist/vue/Buttons/LinkBasic.vue +0 -8
- package/dist/vue/Buttons/LinkButton.vue +0 -65
- package/dist/vue/Buttons/Multiple.vue +0 -11
- package/dist/vue/Buttons/index.ts +0 -37
- package/dist/vue/SmartHero/Basic.vue +0 -14
- package/dist/vue/SmartHero/SmartHero.vue +0 -132
- package/dist/vue/SmartHero/WithCustomContent.vue +0 -36
- package/dist/vue/SmartHero/WithImage.vue +0 -19
- package/dist/vue/SmartHero/index.ts +0 -24
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coffic/cosy-ui",
|
3
|
-
"version": "0.6.
|
3
|
+
"version": "0.6.34",
|
4
4
|
"description": "An astro component library",
|
5
5
|
"author": {
|
6
6
|
"name": "nookery",
|
@@ -61,6 +61,7 @@
|
|
61
61
|
"@eslint/js": "^9.27.0",
|
62
62
|
"@tailwindcss/typography": "^0.5.16",
|
63
63
|
"@tailwindcss/vite": "^4.1.7",
|
64
|
+
"@tsconfig/node22": "^22.0.2",
|
64
65
|
"@types/chai": "^5.2.2",
|
65
66
|
"@types/eslint": "^9.6.1",
|
66
67
|
"@types/fs-extra": "^11.0.4",
|
@@ -68,6 +69,8 @@
|
|
68
69
|
"@types/node": "^22.15.19",
|
69
70
|
"@types/react": "^19.1.4",
|
70
71
|
"@typescript-eslint/parser": "^8.32.1",
|
72
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
73
|
+
"@vue/tsconfig": "^0.7.0",
|
71
74
|
"astro": "^5.7.13",
|
72
75
|
"chai": "^4.5.0",
|
73
76
|
"daisyui": "^5.0.35",
|
@@ -84,6 +87,7 @@
|
|
84
87
|
"typescript": "^5.8.3",
|
85
88
|
"typescript-eslint": "^8.32.1",
|
86
89
|
"vite": "^6.3.5",
|
90
|
+
"vite-plugin-vue-devtools": "^7.7.6",
|
87
91
|
"vue": "^3.5.14",
|
88
92
|
"vue-eslint-parser": "^10.1.3"
|
89
93
|
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
---
|
2
|
-
/**
|
3
|
-
* @component Alert.Types
|
4
|
-
*
|
5
|
-
* @description
|
6
|
-
* 展示Alert组件的所有类型:info、success、warning、error。
|
7
|
-
*/
|
8
|
-
import '../style.ts';
|
9
|
-
import { Alert } from '../index';
|
10
|
-
---
|
11
|
-
|
12
|
-
<div class="cosy:flex cosy:flex-col cosy:gap-4">
|
13
|
-
<Alert type="info">这是一条信息提示</Alert>
|
14
|
-
<Alert type="success">这是一条成功提示</Alert>
|
15
|
-
<Alert type="warning">这是一条警告提示</Alert>
|
16
|
-
<Alert type="error">这是一条错误提示</Alert>
|
17
|
-
</div>
|
package/dist/button/index.ts
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
import Button from './Button.astro';
|
2
|
-
import ButtonBasic from './ButtonBasic.astro';
|
3
|
-
import ButtonSizes from './ButtonSizes.astro';
|
4
|
-
import ButtonStates from './ButtonStates.astro';
|
5
|
-
import ButtonWithIcons from './ButtonWithIcons.astro';
|
6
|
-
import ButtonShapes from './ButtonShapes.astro';
|
7
|
-
import BasicSourceCode from './ButtonBasic.astro?raw';
|
8
|
-
import SizesSourceCode from './ButtonSizes.astro?raw';
|
9
|
-
import StatesSourceCode from './ButtonStates.astro?raw';
|
10
|
-
import WithIconsSourceCode from './ButtonWithIcons.astro?raw';
|
11
|
-
import ShapesSourceCode from './ButtonShapes.astro?raw';
|
12
|
-
import { extractSimpleExample } from '../utils/component';
|
13
|
-
|
14
|
-
export { Button, ButtonBasic, ButtonSizes, ButtonStates, ButtonWithIcons, ButtonShapes };
|
15
|
-
|
16
|
-
// 导出示例源代码
|
17
|
-
export const ButtonExampleCodes = {
|
18
|
-
Basic: extractSimpleExample(BasicSourceCode, 'Button'),
|
19
|
-
Sizes: extractSimpleExample(SizesSourceCode, 'Button'),
|
20
|
-
States: extractSimpleExample(StatesSourceCode, 'Button'),
|
21
|
-
WithIcons: extractSimpleExample(WithIconsSourceCode, 'Button'),
|
22
|
-
Shapes: extractSimpleExample(ShapesSourceCode, 'Button'),
|
23
|
-
};
|
@@ -1,162 +0,0 @@
|
|
1
|
-
---
|
2
|
-
/**
|
3
|
-
* @component Card
|
4
|
-
*
|
5
|
-
* @description
|
6
|
-
* Card 组件用于在页面中展示相关内容的容器,通常包含标题、描述和可选的图片。
|
7
|
-
* 组件设计简洁大方,具有平滑的动画效果和交互反馈,适合展示产品、文章或功能介绍等内容。
|
8
|
-
*
|
9
|
-
* @design
|
10
|
-
* 设计理念:
|
11
|
-
* 1. 视觉层次感 - 通过阴影、悬停效果和微妙的动画创造深度感
|
12
|
-
* 2. 内容聚焦 - 简洁的布局让用户关注卡片内容
|
13
|
-
* 3. 交互反馈 - 悬停和点击时提供明确的视觉反馈
|
14
|
-
* 4. 适应性强 - 响应式设计,适应不同屏幕尺寸
|
15
|
-
*
|
16
|
-
* 视觉特点:
|
17
|
-
* - 半透明背景:现代感强,适合叠加在各种背景上
|
18
|
-
* - 模糊效果:背景模糊增强内容可读性
|
19
|
-
* - 光效设计:顶部有微妙的光晕效果,增强立体感
|
20
|
-
* - 悬停动画:轻微放大和阴影增强,提供交互反馈
|
21
|
-
* - 图片缩放:图片在悬停时轻微放大,增强视觉吸引力
|
22
|
-
*
|
23
|
-
* @usage
|
24
|
-
* 基本用法:
|
25
|
-
* ```astro
|
26
|
-
* <Card
|
27
|
-
* title="卡片标题"
|
28
|
-
* subtitle="卡片描述文本"
|
29
|
-
* >
|
30
|
-
* 卡片内容
|
31
|
-
* </Card>
|
32
|
-
* ```
|
33
|
-
*
|
34
|
-
* 带图片的卡片:
|
35
|
-
* ```astro
|
36
|
-
* <Card
|
37
|
-
* title="产品名称"
|
38
|
-
* subtitle="产品描述"
|
39
|
-
* imageUrl="/path/to/image.jpg"
|
40
|
-
* >
|
41
|
-
* 其他产品信息
|
42
|
-
* </Card>
|
43
|
-
* ```
|
44
|
-
*
|
45
|
-
* 可点击的卡片(链接):
|
46
|
-
* ```astro
|
47
|
-
* <Card
|
48
|
-
* title="文章标题"
|
49
|
-
* subtitle="文章摘要"
|
50
|
-
* imageUrl="/path/to/image.jpg"
|
51
|
-
* href="/articles/article-slug"
|
52
|
-
* />
|
53
|
-
* ```
|
54
|
-
*
|
55
|
-
* @props
|
56
|
-
* @prop {string} [title] - 卡片标题
|
57
|
-
* @prop {string} [subtitle] - 卡片副标题或描述
|
58
|
-
* @prop {string} [imageUrl] - 卡片顶部图片的URL
|
59
|
-
* @prop {string} [href] - 如果提供,卡片将变成可点击的链接
|
60
|
-
* @prop {string} [class] - 自定义CSS类,可用于覆盖默认样式
|
61
|
-
*
|
62
|
-
* @slots
|
63
|
-
* @slot default - 卡片的主要内容区域
|
64
|
-
*
|
65
|
-
* @accessibility
|
66
|
-
* - 使用语义化HTML结构
|
67
|
-
* - 当作为链接使用时,确保提供有意义的文本内容
|
68
|
-
* - 动画遵循 prefers-reduced-motion 媒体查询,尊重用户的动画偏好设置
|
69
|
-
*/
|
70
|
-
|
71
|
-
import '../../style.ts';
|
72
|
-
|
73
|
-
interface Props {
|
74
|
-
title?: string;
|
75
|
-
subtitle?: string;
|
76
|
-
imageUrl?: string;
|
77
|
-
href?: string;
|
78
|
-
class?: string;
|
79
|
-
}
|
80
|
-
|
81
|
-
const { title, subtitle, imageUrl, href, class: className = '' } = Astro.props;
|
82
|
-
|
83
|
-
// 定义卡片的CSS类
|
84
|
-
const cardClasses = [
|
85
|
-
'cosy:bg-base-100',
|
86
|
-
'cosy:bg-opacity-70',
|
87
|
-
'cosy:backdrop-blur-sm',
|
88
|
-
'cosy:rounded-xl',
|
89
|
-
'cosy:shadow-md',
|
90
|
-
'cosy:overflow-hidden',
|
91
|
-
'cosy:transition-all',
|
92
|
-
'cosy:duration-300',
|
93
|
-
'cosy:ease-in-out',
|
94
|
-
'cosy:hover:shadow-lg',
|
95
|
-
'cosy:hover:scale-[1.02]',
|
96
|
-
className,
|
97
|
-
].join(' ');
|
98
|
-
|
99
|
-
// 定义卡片内容的CSS类
|
100
|
-
const cardBodyClasses = [
|
101
|
-
'cosy:p-6',
|
102
|
-
'cosy:flex',
|
103
|
-
'cosy:flex-col',
|
104
|
-
'cosy:gap-4',
|
105
|
-
href && 'cosy:cursor-pointer',
|
106
|
-
]
|
107
|
-
.filter(Boolean)
|
108
|
-
.join(' ');
|
109
|
-
|
110
|
-
// 定义图片容器的CSS类
|
111
|
-
const figureClasses = 'cosy:overflow-hidden cosy:mb-4 cosy:-mx-6 cosy:-mt-6';
|
112
|
-
|
113
|
-
// 定义图片的CSS类
|
114
|
-
const imageClasses =
|
115
|
-
'cosy:w-full cosy:h-auto cosy:object-cover cosy:transition-transform cosy:duration-300 cosy:group-hover:scale-105';
|
116
|
-
|
117
|
-
// 定义标题的CSS类
|
118
|
-
const titleClasses = 'cosy:text-xl cosy:font-bold cosy:mb-2';
|
119
|
-
|
120
|
-
// 定义描述的CSS类
|
121
|
-
const subtitleClasses = 'cosy:text-base cosy:text-gray-600 cosy:dark:text-gray-300';
|
122
|
-
---
|
123
|
-
|
124
|
-
<div class="cosy:group cosy:perspective-1000">
|
125
|
-
<div class={cardClasses}>
|
126
|
-
{
|
127
|
-
href ? (
|
128
|
-
<a href={href} class={cardBodyClasses}>
|
129
|
-
{imageUrl && (
|
130
|
-
<figure class={figureClasses}>
|
131
|
-
<img src={imageUrl} alt={title} class={imageClasses} />
|
132
|
-
</figure>
|
133
|
-
)}
|
134
|
-
{title && <h2 class={titleClasses}>{title}</h2>}
|
135
|
-
{subtitle && <p class={subtitleClasses}>{subtitle}</p>}
|
136
|
-
<slot />
|
137
|
-
</a>
|
138
|
-
) : (
|
139
|
-
<div class={cardBodyClasses}>
|
140
|
-
{imageUrl && (
|
141
|
-
<figure class={figureClasses}>
|
142
|
-
<img src={imageUrl} alt={title} class={imageClasses} />
|
143
|
-
</figure>
|
144
|
-
)}
|
145
|
-
{title && <h2 class={titleClasses}>{title}</h2>}
|
146
|
-
{subtitle && <p class={subtitleClasses}>{subtitle}</p>}
|
147
|
-
<slot />
|
148
|
-
</div>
|
149
|
-
)
|
150
|
-
}
|
151
|
-
</div>
|
152
|
-
</div>
|
153
|
-
|
154
|
-
<style>
|
155
|
-
/* 为了确保prefers-reduced-motion生效 */
|
156
|
-
@media (prefers-reduced-motion: reduce) {
|
157
|
-
.cosy\:hover\:scale-\[1\.02\]:hover,
|
158
|
-
.cosy\:group-hover\:scale-105 {
|
159
|
-
transform: none !important;
|
160
|
-
}
|
161
|
-
}
|
162
|
-
</style>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
---
|
2
|
-
import ThemeItem from './ThemeItem.astro';
|
3
|
-
---
|
4
|
-
|
5
|
-
<div class="cosy:w-48 cosy:space-y-2">
|
6
|
-
<ThemeItem theme="light" label="浅色主题" />
|
7
|
-
<ThemeItem theme="dark" label="深色主题" />
|
8
|
-
<ThemeItem theme="cupcake" label="糖果主题" />
|
9
|
-
<ThemeItem theme="dracula" label="德古拉主题" />
|
10
|
-
</div>
|
package/dist/theme-item/index.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import ThemeItem from './ThemeItem.astro';
|
2
|
-
import ThemeItemBasic from './ThemeItemBasic.astro';
|
3
|
-
import BasicSourceCode from './ThemeItemBasic.astro?raw';
|
4
|
-
import { extractSimpleExample } from '../utils/component';
|
5
|
-
|
6
|
-
export { ThemeItem, ThemeItemBasic };
|
7
|
-
|
8
|
-
// 导出示例源代码
|
9
|
-
export const ThemeItemExampleCodes = {
|
10
|
-
Basic: extractSimpleExample(BasicSourceCode, 'ThemeItem'),
|
11
|
-
};
|
@@ -1,65 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
@component LinkButton
|
3
|
-
|
4
|
-
@description
|
5
|
-
LinkButton 组件是一个现代化的链接按钮,支持外部链接和路由跳转,带有动画效果。
|
6
|
-
|
7
|
-
@usage
|
8
|
-
基本用法:
|
9
|
-
```vue
|
10
|
-
<LinkButton text="了解更多" href="#" />
|
11
|
-
```
|
12
|
-
|
13
|
-
多个按钮:
|
14
|
-
```vue
|
15
|
-
<div class="cosy:flex cosy:gap-4">
|
16
|
-
<LinkButton text="了解更多" href="#" />
|
17
|
-
<LinkButton text="立即开始" href="#get-started" />
|
18
|
-
</div>
|
19
|
-
```
|
20
|
-
|
21
|
-
@props
|
22
|
-
@prop {string} text - 按钮文本
|
23
|
-
@prop {string} href - 链接地址
|
24
|
-
@prop {boolean} [openInNewTab=true] - 是否在新标签页打开链接
|
25
|
-
-->
|
26
|
-
|
27
|
-
<script setup lang="ts">
|
28
|
-
import '../../style';
|
29
|
-
|
30
|
-
defineProps({
|
31
|
-
/**
|
32
|
-
* 按钮文本
|
33
|
-
*/
|
34
|
-
text: {
|
35
|
-
type: String,
|
36
|
-
required: true
|
37
|
-
},
|
38
|
-
/**
|
39
|
-
* 链接地址
|
40
|
-
*/
|
41
|
-
href: {
|
42
|
-
type: String,
|
43
|
-
required: true
|
44
|
-
},
|
45
|
-
/**
|
46
|
-
* 是否在新标签页打开链接
|
47
|
-
* @default true
|
48
|
-
*/
|
49
|
-
openInNewTab: {
|
50
|
-
type: Boolean,
|
51
|
-
default: true
|
52
|
-
}
|
53
|
-
});
|
54
|
-
</script>
|
55
|
-
|
56
|
-
<template>
|
57
|
-
<a :href="href" :target="openInNewTab ? '_blank' : ''" class="cosy:px-6 cosy:py-3 cosy:rounded-lg cosy:bg-blue-600 cosy:text-white cosy:font-medium
|
58
|
-
cosy:transition-all cosy:duration-300 cosy:ease-in-out
|
59
|
-
cosy:no-underline
|
60
|
-
cosy:hover:bg-blue-700 cosy:hover:shadow-lg cosy:hover:-translate-y-0.5
|
61
|
-
cosy:focus:outline-none cosy:focus:ring-2 cosy:focus:ring-blue-500 cosy:focus:ring-offset-2
|
62
|
-
cosy:active:bg-blue-800 cosy:active:translate-y-0">
|
63
|
-
{{ text }}
|
64
|
-
</a>
|
65
|
-
</template>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="cosy:flex cosy:gap-4">
|
3
|
-
<LinkButton text="了解更多" href="#" />
|
4
|
-
<LinkButton text="立即开始" href="#get-started" />
|
5
|
-
</div>
|
6
|
-
</template>
|
7
|
-
|
8
|
-
<script setup lang="ts">
|
9
|
-
import '../../style';
|
10
|
-
import LinkButton from './LinkButton.vue';
|
11
|
-
</script>
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import FeatureBasic from './FeatureBasic.vue';
|
2
|
-
import FeatureWithTips from './FeatureWithTips.vue';
|
3
|
-
import Multiple from './Multiple.vue';
|
4
|
-
import LinkBasic from './LinkBasic.vue';
|
5
|
-
import FeatureBasicSource from './FeatureBasic.vue?raw';
|
6
|
-
import FeatureWithTipsSource from './FeatureWithTips.vue?raw';
|
7
|
-
import MultipleSource from './Multiple.vue?raw';
|
8
|
-
import LinkBasicSource from './LinkBasic.vue?raw';
|
9
|
-
import { extractSimpleExample } from '../../utils/component';
|
10
|
-
|
11
|
-
// 导出组件
|
12
|
-
export { default as FeatureButton } from './FeatureButton.vue';
|
13
|
-
export { default as LinkButton } from './LinkButton.vue';
|
14
|
-
|
15
|
-
// 将示例组件整合为一个对象导出
|
16
|
-
export const ButtonsExamples = {
|
17
|
-
FeatureButton: {
|
18
|
-
Basic: FeatureBasic,
|
19
|
-
WithTips: FeatureWithTips,
|
20
|
-
},
|
21
|
-
LinkButton: {
|
22
|
-
Basic: LinkBasic,
|
23
|
-
Multiple: Multiple,
|
24
|
-
},
|
25
|
-
};
|
26
|
-
|
27
|
-
// 导出示例组件的源代码(简化版本)
|
28
|
-
export const ButtonsExampleCodes = {
|
29
|
-
FeatureButton: {
|
30
|
-
Basic: extractSimpleExample(FeatureBasicSource, 'Button'),
|
31
|
-
WithTips: extractSimpleExample(FeatureWithTipsSource, 'Button'),
|
32
|
-
},
|
33
|
-
LinkButton: {
|
34
|
-
Basic: extractSimpleExample(LinkBasicSource, 'Button'),
|
35
|
-
Multiple: extractSimpleExample(MultipleSource, 'Button'),
|
36
|
-
},
|
37
|
-
};
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<SmartHero title="智能英雄组件" description="一个现代化的页面英雄区域组件,适合用作页面顶部的展示区域" :links="links" />
|
3
|
-
</template>
|
4
|
-
|
5
|
-
<script setup lang="ts">
|
6
|
-
import '../../style';
|
7
|
-
import { ref } from 'vue';
|
8
|
-
import SmartHero from './SmartHero.vue';
|
9
|
-
|
10
|
-
const links = ref([
|
11
|
-
{ text: '了解更多', href: '#' },
|
12
|
-
{ text: '查看文档', href: '#docs' }
|
13
|
-
]);
|
14
|
-
</script>
|
@@ -1,132 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
@component SmartHero
|
3
|
-
|
4
|
-
@description
|
5
|
-
SmartHero 组件是一个响应式的英雄区域组件,用于展示标题、描述、图片和操作链接。
|
6
|
-
支持自定义内容插槽,适合用作页面顶部的展示区域。
|
7
|
-
|
8
|
-
@usage
|
9
|
-
基本用法:
|
10
|
-
```vue
|
11
|
-
<SmartHero
|
12
|
-
title="智能英雄组件"
|
13
|
-
description="一个现代化的页面英雄区域组件"
|
14
|
-
:links="[{text: '了解更多', href: '#'}]"
|
15
|
-
/>
|
16
|
-
```
|
17
|
-
|
18
|
-
带图片:
|
19
|
-
```vue
|
20
|
-
<SmartHero
|
21
|
-
title="智能英雄组件"
|
22
|
-
description="一个现代化的页面英雄区域组件"
|
23
|
-
:image="{src: '/images/hero.png', alt: '英雄图片'}"
|
24
|
-
:links="[{text: '了解更多', href: '#'}, {text: '查看文档', href: '#docs'}]"
|
25
|
-
/>
|
26
|
-
```
|
27
|
-
|
28
|
-
使用插槽:
|
29
|
-
```vue
|
30
|
-
<SmartHero
|
31
|
-
title="智能英雄组件"
|
32
|
-
description="一个现代化的页面英雄区域组件"
|
33
|
-
:links="[{text: '了解更多', href: '#'}]"
|
34
|
-
>
|
35
|
-
<template #app>
|
36
|
-
<div class="demo-app">自定义内容</div>
|
37
|
-
</template>
|
38
|
-
</SmartHero>
|
39
|
-
```
|
40
|
-
|
41
|
-
@props
|
42
|
-
@prop {string} title - 标题文本
|
43
|
-
@prop {string} description - 描述文本
|
44
|
-
@prop {object} [image] - 图片配置对象,包含src和alt属性
|
45
|
-
@prop {array} links - 链接数组,每个链接包含text和href属性
|
46
|
-
|
47
|
-
@slots
|
48
|
-
@slot app - 用于插入自定义应用或组件展示
|
49
|
-
-->
|
50
|
-
|
51
|
-
<script setup lang="ts">
|
52
|
-
import '../../style';
|
53
|
-
import type { PropType } from 'vue';
|
54
|
-
import LinkButton from '../Buttons/LinkButton.vue';
|
55
|
-
|
56
|
-
interface Link {
|
57
|
-
text: string;
|
58
|
-
href: string;
|
59
|
-
}
|
60
|
-
|
61
|
-
interface ImageProps {
|
62
|
-
src: string;
|
63
|
-
alt: string;
|
64
|
-
}
|
65
|
-
|
66
|
-
defineProps({
|
67
|
-
title: {
|
68
|
-
type: String,
|
69
|
-
required: true
|
70
|
-
},
|
71
|
-
description: {
|
72
|
-
type: String,
|
73
|
-
required: true
|
74
|
-
},
|
75
|
-
image: {
|
76
|
-
type: Object as PropType<ImageProps>,
|
77
|
-
required: false,
|
78
|
-
default: () => ({
|
79
|
-
src: '',
|
80
|
-
alt: ''
|
81
|
-
})
|
82
|
-
},
|
83
|
-
links: {
|
84
|
-
type: Array as PropType<Link[]>,
|
85
|
-
required: true,
|
86
|
-
default: () => []
|
87
|
-
}
|
88
|
-
});
|
89
|
-
</script>
|
90
|
-
|
91
|
-
<template>
|
92
|
-
<div class="cosy:py-16 cosy:px-8 cosy:text-center cosy:w-full cosy:min-h-screen cosy:relative cosy:overflow-hidden">
|
93
|
-
<div class="cosy:relative cosy:z-10 cosy:rounded-lg cosy:w-full cosy:h-full">
|
94
|
-
<template v-if="image.src">
|
95
|
-
<img :src="image.src" :alt="image.alt" class="cosy:h-1/2 cosy:mx-auto cosy:mb-8 cosy:drop-shadow-xl">
|
96
|
-
</template>
|
97
|
-
|
98
|
-
<h2 class="cosy:text-4xl cosy:mb-4 cosy:animate-fade-up">
|
99
|
-
{{ title }}
|
100
|
-
</h2>
|
101
|
-
<p class="cosy:text-lg cosy:mb-12 cosy:text-center cosy:max-w-2xl cosy:mx-auto">
|
102
|
-
{{ description }}
|
103
|
-
</p>
|
104
|
-
|
105
|
-
<div class="cosy:my-12 cosy:w-full">
|
106
|
-
<slot name="app" />
|
107
|
-
</div>
|
108
|
-
|
109
|
-
<div class="cosy:flex cosy:flex-row cosy:justify-center cosy:gap-8 cosy:mx-auto cosy:w-full">
|
110
|
-
<LinkButton v-for="link in links" :key="link.text" :text="link.text" :href="link.href" />
|
111
|
-
</div>
|
112
|
-
</div>
|
113
|
-
</div>
|
114
|
-
</template>
|
115
|
-
|
116
|
-
<style scoped>
|
117
|
-
@keyframes fade-up {
|
118
|
-
from {
|
119
|
-
opacity: 0;
|
120
|
-
transform: translateY(-20px);
|
121
|
-
}
|
122
|
-
|
123
|
-
to {
|
124
|
-
opacity: 1;
|
125
|
-
transform: translateY(0);
|
126
|
-
}
|
127
|
-
}
|
128
|
-
|
129
|
-
.cosy\:animate-fade-up {
|
130
|
-
animation: fade-up 0.8s ease-out forwards;
|
131
|
-
}
|
132
|
-
</style>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<SmartHero title="支持自定义内容" description="这个示例展示了如何使用插槽添加自定义内容" :links="links">
|
3
|
-
<template #app>
|
4
|
-
<div class="cosy:p-6 cosy:bg-base-200 cosy:rounded-xl cosy:max-w-lg cosy:mx-auto cosy:shadow-lg">
|
5
|
-
<div class="cosy:bg-base-100 cosy:p-4 cosy:rounded-lg cosy:text-left">
|
6
|
-
<div class="cosy:font-mono cosy:text-sm cosy:mb-2 cosy:text-success">// 示例代码</div>
|
7
|
-
<div class="cosy:font-mono cosy:text-sm">
|
8
|
-
<div><span class="cosy:text-primary"><SmartHero</span></div>
|
9
|
-
<div class="cosy:pl-4"><span class="cosy:text-info">title</span>=<span
|
10
|
-
class="cosy:text-warning">"支持自定义内容"</span></div>
|
11
|
-
<div class="cosy:pl-4"><span class="cosy:text-info">description</span>=<span
|
12
|
-
class="cosy:text-warning">"自定义内容示例"</span></div>
|
13
|
-
<div class="cosy:pl-4">...</div>
|
14
|
-
<div><span class="cosy:text-primary">></span></div>
|
15
|
-
<div class="cosy:pl-2"><span class="cosy:text-primary"><template</span> <span
|
16
|
-
class="cosy:text-info">#app</span><span class="cosy:text-primary">></span></div>
|
17
|
-
<div class="cosy:pl-4">// 您的自定义内容</div>
|
18
|
-
<div class="cosy:pl-2"><span class="cosy:text-primary"></template></span></div>
|
19
|
-
<div><span class="cosy:text-primary"></SmartHero></span></div>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
</div>
|
23
|
-
</template>
|
24
|
-
</SmartHero>
|
25
|
-
</template>
|
26
|
-
|
27
|
-
<script setup lang="ts">
|
28
|
-
import '../../style';
|
29
|
-
import { ref } from 'vue';
|
30
|
-
import SmartHero from './SmartHero.vue';
|
31
|
-
|
32
|
-
const links = ref([
|
33
|
-
{ text: '了解插槽', href: '#slots' },
|
34
|
-
{ text: '查看文档', href: '#docs' }
|
35
|
-
]);
|
36
|
-
</script>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<SmartHero title="带图片的英雄组件" description="这是一个包含图片的英雄组件示例,展示了如何在顶部添加图片" :image="image" :links="links" />
|
3
|
-
</template>
|
4
|
-
|
5
|
-
<script setup lang="ts">
|
6
|
-
import '../../style';
|
7
|
-
import { ref } from 'vue';
|
8
|
-
import SmartHero from './SmartHero.vue';
|
9
|
-
|
10
|
-
const image = ref({
|
11
|
-
src: 'https://via.placeholder.com/600x300/4F46E5/FFFFFF?text=Smart+Hero',
|
12
|
-
alt: '英雄图片示例'
|
13
|
-
});
|
14
|
-
|
15
|
-
const links = ref([
|
16
|
-
{ text: '了解更多', href: '#' },
|
17
|
-
{ text: '立即开始', href: '#get-started' }
|
18
|
-
]);
|
19
|
-
</script>
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import Basic from './Basic.vue';
|
2
|
-
import WithImage from './WithImage.vue';
|
3
|
-
import WithCustomContent from './WithCustomContent.vue';
|
4
|
-
import BasicSource from './Basic.vue?raw';
|
5
|
-
import WithImageSource from './WithImage.vue?raw';
|
6
|
-
import WithCustomContentSource from './WithCustomContent.vue?raw';
|
7
|
-
import { extractSimpleExample } from '../../utils/component';
|
8
|
-
|
9
|
-
// 导出主组件
|
10
|
-
export { default as SmartHero } from './SmartHero.vue';
|
11
|
-
|
12
|
-
// 将示例组件整合为一个对象导出
|
13
|
-
export const SmartHeroExamples = {
|
14
|
-
Basic,
|
15
|
-
WithImage,
|
16
|
-
WithCustomContent,
|
17
|
-
};
|
18
|
-
|
19
|
-
// 导出示例组件的源代码(简化版本)
|
20
|
-
export const SmartHeroExampleCodes = {
|
21
|
-
Basic: extractSimpleExample(BasicSource, 'SmartHero'),
|
22
|
-
WithImage: extractSimpleExample(WithImageSource, 'SmartHero'),
|
23
|
-
WithCustomContent: extractSimpleExample(WithCustomContentSource, 'SmartHero'),
|
24
|
-
};
|