@coffic/cosy-ui 0.8.21 → 0.8.23
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/index-astro.ts +2 -0
- package/dist/src/assets/iconData.ts +5 -1
- 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 +40 -1
- 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/code-panel/CodePanel.astro +109 -0
- package/dist/src-astro/code-panel/index.ts +2 -0
- package/dist/src-astro/code-panel/types.ts +17 -0
- package/dist/src-astro/footer/Footer.astro +23 -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 +72 -8
- package/dist/src-astro/icons/CodeIcon.astro +22 -0
- package/dist/src-astro/icons/index.ts +2 -1
- package/dist/src-astro/install-tabs/ButtonCopyInstall.astro +102 -0
- package/dist/src-astro/install-tabs/InstallTabs.astro +174 -0
- package/dist/src-astro/install-tabs/index.ts +2 -0
- package/dist/src-astro/install-tabs/types.ts +8 -0
- package/dist/src-astro/language-switcher/LanguageSwitcher.astro +6 -2
- package/dist/src-astro/layout-app/AppLayout.astro +1 -10
- package/dist/src-astro/layout-basic/BaseLayout.astro +20 -4
- package/dist/src-astro/link/Link.astro +50 -3
- package/dist/src-astro/types/meta.ts +65 -53
- package/package.json +3 -2
- 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
@@ -17,6 +17,8 @@ export { default as CheckCircle } from './CheckCircle.astro';
|
|
17
17
|
export { default as CheckIcon } from './CheckIcon.astro';
|
18
18
|
export { default as ClipboardIcon } from './ClipboardIcon.astro';
|
19
19
|
export { default as CloseIcon } from './CloseIcon.astro';
|
20
|
+
export { default as CodeIcon } from './CodeIcon.astro';
|
21
|
+
export { default as DeleteIcon } from './DeleteIcon.astro';
|
20
22
|
export { default as ErrorIcon } from './ErrorIcon.astro';
|
21
23
|
export { default as GithubIcon } from './GithubIcon.astro';
|
22
24
|
export { default as InfoCircle } from './InfoCircle.astro';
|
@@ -36,7 +38,6 @@ export { default as StarIcon } from './StarIcon.astro';
|
|
36
38
|
export { default as HeartIcon } from './HeartIcon.astro';
|
37
39
|
export { default as SaveIcon } from './SaveIcon.astro';
|
38
40
|
export { default as EditIcon } from './EditIcon.astro';
|
39
|
-
export { default as DeleteIcon } from './DeleteIcon.astro';
|
40
41
|
export { default as ToolsIcon } from './ToolsIcon.astro';
|
41
42
|
export { default as WalletIcon } from './WalletIcon.astro';
|
42
43
|
export { default as ReportIcon } from './ReportIcon.astro';
|
@@ -0,0 +1,102 @@
|
|
1
|
+
---
|
2
|
+
import { ClipboardIcon } from '../icons';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* 安装命令复制按钮,带气泡toast反馈
|
6
|
+
* @param code 要复制的命令字符串
|
7
|
+
*/
|
8
|
+
interface Props {
|
9
|
+
code: string;
|
10
|
+
}
|
11
|
+
|
12
|
+
const { code } = Astro.props;
|
13
|
+
const uniqueId = `copy-install-${Math.random().toString(36).substr(2, 9)}`;
|
14
|
+
const toastId = `toast-${uniqueId}`;
|
15
|
+
---
|
16
|
+
|
17
|
+
<button
|
18
|
+
class="cosy:gap-2 cosy:btn cosy:btn-ghost cosy:btn-sm"
|
19
|
+
aria-label="复制安装命令"
|
20
|
+
type="button"
|
21
|
+
style="position: relative;"
|
22
|
+
id={uniqueId}
|
23
|
+
data-code={code}>
|
24
|
+
<span class="cosy:copy-icon"><ClipboardIcon /></span>
|
25
|
+
<span
|
26
|
+
id={toastId}
|
27
|
+
style="
|
28
|
+
display: none;
|
29
|
+
position: fixed;
|
30
|
+
top: 50%;
|
31
|
+
left: 50%;
|
32
|
+
transform: translate(-50%, -50%);
|
33
|
+
background: #22c55e;
|
34
|
+
color: #fff;
|
35
|
+
padding: 0.75rem 1.25rem;
|
36
|
+
border-radius: 0.5rem;
|
37
|
+
font-size: 0.875rem;
|
38
|
+
font-weight: 500;
|
39
|
+
white-space: nowrap;
|
40
|
+
z-index: 99999;
|
41
|
+
box-shadow: 0 10px 25px rgba(0,0,0,0.15);
|
42
|
+
pointer-events: none;
|
43
|
+
transition: all 0.2s ease;
|
44
|
+
">
|
45
|
+
复制成功 ✓
|
46
|
+
</span>
|
47
|
+
</button>
|
48
|
+
|
49
|
+
<script>
|
50
|
+
function initializeCopyInstall() {
|
51
|
+
console.log('InstallTabs: 初始化复制按钮');
|
52
|
+
|
53
|
+
document.querySelectorAll('[id^="copy-install-"]').forEach((btn) => {
|
54
|
+
// 防止重复绑定事件
|
55
|
+
if (btn.hasAttribute('data-initialized')) return;
|
56
|
+
btn.setAttribute('data-initialized', 'true');
|
57
|
+
|
58
|
+
btn.addEventListener('click', () => {
|
59
|
+
const code = btn.getAttribute('data-code') || '';
|
60
|
+
const toastId = `toast-${btn.id}`;
|
61
|
+
const toast = document.getElementById(toastId);
|
62
|
+
|
63
|
+
console.log('InstallTabs: 点击复制按钮', { code, toastId, toast });
|
64
|
+
|
65
|
+
navigator.clipboard
|
66
|
+
.writeText(code)
|
67
|
+
.then(() => {
|
68
|
+
console.log('InstallTabs: 复制成功', code);
|
69
|
+
if (toast && toast instanceof HTMLElement) {
|
70
|
+
console.log('InstallTabs: 显示toast');
|
71
|
+
// 确保toast在最前面
|
72
|
+
document.body.appendChild(toast);
|
73
|
+
|
74
|
+
toast.style.display = 'block';
|
75
|
+
toast.style.opacity = '1';
|
76
|
+
toast.style.visibility = 'visible';
|
77
|
+
|
78
|
+
setTimeout(() => {
|
79
|
+
toast.style.opacity = '0';
|
80
|
+
setTimeout(() => {
|
81
|
+
toast.style.display = 'none';
|
82
|
+
toast.style.visibility = 'hidden';
|
83
|
+
// 移回原位
|
84
|
+
btn.appendChild(toast);
|
85
|
+
}, 200);
|
86
|
+
}, 2000);
|
87
|
+
} else {
|
88
|
+
console.error('InstallTabs: 无法找到toast元素', toastId);
|
89
|
+
}
|
90
|
+
})
|
91
|
+
.catch((err) => {
|
92
|
+
console.error('InstallTabs: 复制失败', err);
|
93
|
+
});
|
94
|
+
});
|
95
|
+
});
|
96
|
+
}
|
97
|
+
|
98
|
+
document.addEventListener('astro:page-load', () => {
|
99
|
+
console.log('InstallTabs: 页面加载完成,初始化复制按钮');
|
100
|
+
initializeCopyInstall();
|
101
|
+
});
|
102
|
+
</script>
|
@@ -0,0 +1,174 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component InstallTabs
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 展示多个包管理器(npm、pnpm、yarn等)的安装命令,支持标签切换和一键复制。
|
7
|
+
* 只需传入包名即可自动生成各包管理器的安装命令。
|
8
|
+
*
|
9
|
+
* @props
|
10
|
+
* @param packageName 要安装的包名
|
11
|
+
* @param managers 支持的包管理器,默认['npm','pnpm','yarn']
|
12
|
+
* @param dev 是否为开发依赖,影响命令参数(如-D/--save-dev)
|
13
|
+
*
|
14
|
+
* @usage
|
15
|
+
* ```astro
|
16
|
+
* <InstallTabs packageName="react" />
|
17
|
+
* <InstallTabs packageName="vite" dev />
|
18
|
+
* <InstallTabs packageName="eslint" managers={["npm","yarn"]} />
|
19
|
+
* ```
|
20
|
+
*/
|
21
|
+
import '../../style.ts';
|
22
|
+
import ButtonCopyInstall from './ButtonCopyInstall.astro';
|
23
|
+
import { CodePanel } from '../code-panel';
|
24
|
+
|
25
|
+
interface Props {
|
26
|
+
/** 要安装的包名 */
|
27
|
+
packageName: string;
|
28
|
+
/** 支持的包管理器,默认['npm','pnpm','yarn'] */
|
29
|
+
managers?: string[];
|
30
|
+
/** 是否为开发依赖 */
|
31
|
+
dev?: boolean;
|
32
|
+
}
|
33
|
+
|
34
|
+
const {
|
35
|
+
packageName,
|
36
|
+
managers = ['npm', 'pnpm', 'yarn'],
|
37
|
+
dev = false,
|
38
|
+
} = Astro.props;
|
39
|
+
|
40
|
+
const managerLabels: Record<string, string> = {
|
41
|
+
npm: 'npm',
|
42
|
+
pnpm: 'pnpm',
|
43
|
+
yarn: 'yarn',
|
44
|
+
};
|
45
|
+
|
46
|
+
function getCommand(manager: string, pkg: string, dev: boolean) {
|
47
|
+
switch (manager) {
|
48
|
+
case 'npm':
|
49
|
+
return `npm install${dev ? ' -D' : ''} ${pkg}`;
|
50
|
+
case 'pnpm':
|
51
|
+
return `pnpm add${dev ? ' -D' : ''} ${pkg}`;
|
52
|
+
case 'yarn':
|
53
|
+
return `yarn add${dev ? ' -D' : ''} ${pkg}`;
|
54
|
+
default:
|
55
|
+
return '';
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
const commands = managers.map((m) => getCommand(m, packageName, dev));
|
60
|
+
---
|
61
|
+
|
62
|
+
<div
|
63
|
+
class="cosy:mb-8 cosy:card cosy:p-0 cosy:overflow-hidden"
|
64
|
+
data-role="install-tabs">
|
65
|
+
<div
|
66
|
+
class="cosy:flex cosy:justify-between cosy:items-center cosy:bg-base-200 cosy:px-4 cosy:rounded-t">
|
67
|
+
<div class="cosy:flex cosy:items-center cosy:gap-4">
|
68
|
+
<div role="tablist" class="cosy:tabs cosy:tabs-box">
|
69
|
+
{
|
70
|
+
managers.map((manager, idx) => (
|
71
|
+
<button
|
72
|
+
role="tab"
|
73
|
+
class={`cosy:tab${idx === 0 ? ' cosy:tab-active' : ''}`}
|
74
|
+
data-tab={`tab-${idx + 1}`}
|
75
|
+
aria-selected={idx === 0 ? 'true' : 'false'}>
|
76
|
+
{managerLabels[manager] ?? manager}
|
77
|
+
</button>
|
78
|
+
))
|
79
|
+
}
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
<div class="cosy:flex cosy:items-center cosy:gap-2">
|
83
|
+
{
|
84
|
+
commands.map((cmd, idx) => (
|
85
|
+
<div
|
86
|
+
class={`cosy:install-copy-container ${idx === 0 ? 'cosy:block' : 'cosy:hidden'}`}
|
87
|
+
data-copy-container={`tab-${idx + 1}`}>
|
88
|
+
<ButtonCopyInstall code={cmd} />
|
89
|
+
</div>
|
90
|
+
))
|
91
|
+
}
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
{
|
95
|
+
commands.map((cmd, idx) => (
|
96
|
+
<div
|
97
|
+
class={`cosy:install-panel ${idx === 0 ? 'cosy:block' : 'cosy:hidden'}`}
|
98
|
+
data-panel={`tab-${idx + 1}`}>
|
99
|
+
<CodePanel code={cmd} language="bash" theme="dark-plus" />
|
100
|
+
</div>
|
101
|
+
))
|
102
|
+
}
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<script>
|
106
|
+
function initializeInstallTabs() {
|
107
|
+
console.log('InstallTabs: 初始化安装标签组件');
|
108
|
+
|
109
|
+
// 为所有InstallTabs容器添加事件委托
|
110
|
+
document
|
111
|
+
.querySelectorAll('[data-role="install-tabs"]')
|
112
|
+
.forEach((container) => {
|
113
|
+
// 防止重复绑定
|
114
|
+
if (container.hasAttribute('data-initialized')) return;
|
115
|
+
container.setAttribute('data-initialized', 'true');
|
116
|
+
|
117
|
+
// 使用事件委托处理标签点击
|
118
|
+
container.addEventListener('click', (event) => {
|
119
|
+
const target = event.target as HTMLElement;
|
120
|
+
const tab = target.closest('[role="tab"][data-tab^="tab-"]');
|
121
|
+
|
122
|
+
if (!tab) return;
|
123
|
+
|
124
|
+
console.log('InstallTabs: 切换标签', tab.getAttribute('data-tab'));
|
125
|
+
|
126
|
+
const targetTab = tab.getAttribute('data-tab');
|
127
|
+
if (!targetTab) return;
|
128
|
+
|
129
|
+
// 更新标签状态
|
130
|
+
container
|
131
|
+
.querySelectorAll('[role="tab"][data-tab^="tab-"]')
|
132
|
+
.forEach((t) => {
|
133
|
+
t.classList.remove('cosy:tab-active');
|
134
|
+
t.setAttribute('aria-selected', 'false');
|
135
|
+
});
|
136
|
+
tab.classList.add('cosy:tab-active');
|
137
|
+
tab.setAttribute('aria-selected', 'true');
|
138
|
+
|
139
|
+
// 切换面板显示
|
140
|
+
container
|
141
|
+
.querySelectorAll('.cosy\\:install-panel')
|
142
|
+
.forEach((panel) => {
|
143
|
+
if (panel.getAttribute('data-panel') === targetTab) {
|
144
|
+
panel.classList.remove('cosy:hidden');
|
145
|
+
panel.classList.add('cosy:block');
|
146
|
+
} else {
|
147
|
+
panel.classList.add('cosy:hidden');
|
148
|
+
panel.classList.remove('cosy:block');
|
149
|
+
}
|
150
|
+
});
|
151
|
+
|
152
|
+
// 切换复制按钮显示
|
153
|
+
container
|
154
|
+
.querySelectorAll('.cosy\\:install-copy-container')
|
155
|
+
.forEach((copyContainer) => {
|
156
|
+
if (
|
157
|
+
copyContainer.getAttribute('data-copy-container') === targetTab
|
158
|
+
) {
|
159
|
+
copyContainer.classList.remove('cosy:hidden');
|
160
|
+
copyContainer.classList.add('cosy:block');
|
161
|
+
} else {
|
162
|
+
copyContainer.classList.add('cosy:hidden');
|
163
|
+
copyContainer.classList.remove('cosy:block');
|
164
|
+
}
|
165
|
+
});
|
166
|
+
});
|
167
|
+
});
|
168
|
+
}
|
169
|
+
|
170
|
+
document.addEventListener('astro:page-load', () => {
|
171
|
+
console.log('InstallTabs: 页面加载完成,初始化安装标签组件');
|
172
|
+
initializeInstallTabs();
|
173
|
+
});
|
174
|
+
</script>
|
@@ -32,16 +32,20 @@ import '../../style.ts';
|
|
32
32
|
|
33
33
|
interface Props {
|
34
34
|
languages: string[];
|
35
|
+
/**
|
36
|
+
* 自定义类名
|
37
|
+
*/
|
38
|
+
class?: string;
|
35
39
|
}
|
36
40
|
|
37
|
-
const { languages = ['zh-cn', 'en'] } = Astro.props;
|
41
|
+
const { languages = ['zh-cn', 'en'], class: className = '' } = Astro.props;
|
38
42
|
|
39
43
|
const currentLocale = Astro.currentLocale;
|
40
44
|
const currentLanguageName = LanguageUtil.getLanguageName(currentLocale);
|
41
45
|
---
|
42
46
|
|
43
47
|
<!-- 语言切换按钮 -->
|
44
|
-
<div class=
|
48
|
+
<div class={`cosy:dropdown cosy:dropdown-end ${className}`}>
|
45
49
|
<div tabindex="0" role="button" class:list={['cosy:btn cosy:btn-ghost']}>
|
46
50
|
<span class="cosy:mr-1">{currentLanguageName}</span>
|
47
51
|
<ChevronDownIcon size="16px" class="cosy:w-4 cosy:h-4" />
|
@@ -195,16 +195,7 @@ const {
|
|
195
195
|
}: Props = Astro.props;
|
196
196
|
---
|
197
197
|
|
198
|
-
<BaseLayout
|
199
|
-
title={metaConfig.title}
|
200
|
-
description={metaConfig.description}
|
201
|
-
keywords={metaConfig.keywords}
|
202
|
-
author={metaConfig.author}
|
203
|
-
robots={metaConfig.robots}
|
204
|
-
head={metaConfig.head}
|
205
|
-
favicon={metaConfig.favicon}
|
206
|
-
debug={debug}
|
207
|
-
{...rest}>
|
198
|
+
<BaseLayout {...metaConfig} debug={debug}>
|
208
199
|
<ClientRouter />
|
209
200
|
{
|
210
201
|
showHeader && (
|
@@ -52,9 +52,7 @@
|
|
52
52
|
import '../../style.ts';
|
53
53
|
import { type IMetaProps } from '../../index-astro';
|
54
54
|
|
55
|
-
export interface Props extends IMetaProps {
|
56
|
-
debug?: boolean;
|
57
|
-
}
|
55
|
+
export interface Props extends IMetaProps {}
|
58
56
|
|
59
57
|
const {
|
60
58
|
title,
|
@@ -68,10 +66,28 @@ const {
|
|
68
66
|
class: className,
|
69
67
|
favicon,
|
70
68
|
'class:list': classList,
|
69
|
+
background = 'default',
|
71
70
|
} = Astro.props;
|
72
71
|
|
72
|
+
// 处理背景色 class
|
73
|
+
const bgClassMap: Record<string, string> = {
|
74
|
+
default: 'cosy:bg-base-100',
|
75
|
+
white: 'cosy:bg-white',
|
76
|
+
gray: 'cosy:bg-gray-100',
|
77
|
+
dark: 'cosy:bg-gray-900',
|
78
|
+
'gradient-blue': 'cosy:bg-gradient-to-br cosy:from-blue-400 cosy:to-blue-600',
|
79
|
+
'gradient-pink': 'cosy:bg-gradient-to-br cosy:from-pink-400 cosy:to-pink-600',
|
80
|
+
'gradient-green':
|
81
|
+
'cosy:bg-gradient-to-br cosy:from-green-400 cosy:to-green-600',
|
82
|
+
};
|
83
|
+
|
73
84
|
// 处理类名
|
74
|
-
let bodyClasses =
|
85
|
+
let bodyClasses = [
|
86
|
+
debug ? 'cosy:border cosy:border-red-500' : className || '',
|
87
|
+
bgClassMap[background] || '',
|
88
|
+
]
|
89
|
+
.filter(Boolean)
|
90
|
+
.join(' ');
|
75
91
|
---
|
76
92
|
|
77
93
|
<!doctype html>
|
@@ -85,6 +85,21 @@ interface Props extends HTMLAttributes<'a'> {
|
|
85
85
|
size?: LinkSize;
|
86
86
|
debug?: boolean;
|
87
87
|
centerText?: boolean;
|
88
|
+
btn?: boolean;
|
89
|
+
circle?: boolean;
|
90
|
+
ghost?: boolean;
|
91
|
+
noUnderline?: boolean;
|
92
|
+
rounded?: boolean;
|
93
|
+
fullWidth?: boolean;
|
94
|
+
color?:
|
95
|
+
| 'primary'
|
96
|
+
| 'secondary'
|
97
|
+
| 'accent'
|
98
|
+
| 'info'
|
99
|
+
| 'success'
|
100
|
+
| 'warning'
|
101
|
+
| 'error';
|
102
|
+
align?: 'left' | 'center' | 'right';
|
88
103
|
}
|
89
104
|
|
90
105
|
const {
|
@@ -98,13 +113,21 @@ const {
|
|
98
113
|
'class:list': classList,
|
99
114
|
debug = false,
|
100
115
|
centerText = false,
|
116
|
+
btn = false,
|
117
|
+
circle = false,
|
118
|
+
ghost = false,
|
119
|
+
noUnderline = true,
|
120
|
+
rounded = false,
|
121
|
+
fullWidth = false,
|
122
|
+
color,
|
123
|
+
align,
|
101
124
|
...rest
|
102
125
|
} = Astro.props;
|
103
126
|
|
104
127
|
// 构建类名
|
105
128
|
const classes = [
|
106
129
|
// 基础链接样式
|
107
|
-
'cosy:items-center cosy:cursor-pointer cosy:
|
130
|
+
'cosy:items-center cosy:cursor-pointer cosy:transition-all cosy:duration-200',
|
108
131
|
|
109
132
|
// 显示方式
|
110
133
|
block ? 'cosy:flex cosy:w-full' : 'cosy:inline-flex',
|
@@ -113,7 +136,7 @@ const classes = [
|
|
113
136
|
variant === 'primary' && 'cosy:text-primary cosy:hover:text-primary-focus',
|
114
137
|
variant === 'secondary' &&
|
115
138
|
'cosy:text-secondary cosy:hover:text-secondary-focus',
|
116
|
-
variant === 'text'
|
139
|
+
variant === 'text',
|
117
140
|
variant === 'cta' &&
|
118
141
|
'cosy:text-accent cosy:hover:text-accent-focus cosy:font-medium',
|
119
142
|
variant === 'ghost' &&
|
@@ -136,11 +159,35 @@ const classes = [
|
|
136
159
|
animation === 'hover-scale' &&
|
137
160
|
'cosy:hover:scale-105 cosy:transition-transform',
|
138
161
|
|
162
|
+
// 新增:按钮风格
|
163
|
+
btn && 'cosy:btn',
|
164
|
+
btn && size === 'sm' && 'cosy:btn-sm',
|
165
|
+
btn && size === 'lg' && 'cosy:btn-lg',
|
166
|
+
btn && ghost && 'cosy:btn-ghost',
|
167
|
+
btn && color && `cosy:btn-${color}`,
|
168
|
+
btn && fullWidth && 'cosy:btn-block',
|
169
|
+
btn && circle && 'cosy:btn-circle',
|
170
|
+
btn && rounded && 'cosy:rounded-full',
|
171
|
+
|
172
|
+
// 非按钮风格下的圆角
|
173
|
+
!btn && rounded && 'cosy:rounded',
|
174
|
+
|
175
|
+
// 非按钮风格下的无下划线
|
176
|
+
!btn && noUnderline && 'cosy:no-underline cosy:hover:no-underline',
|
177
|
+
|
178
|
+
// 宽度100%
|
179
|
+
fullWidth && !btn && 'cosy:w-full',
|
180
|
+
|
181
|
+
// 对齐
|
182
|
+
align === 'center' && 'cosy:justify-center cosy:text-center',
|
183
|
+
align === 'right' && 'cosy:justify-end cosy:text-right',
|
184
|
+
align === 'left' && 'cosy:justify-start cosy:text-left',
|
185
|
+
|
139
186
|
// 自定义类名
|
140
187
|
className,
|
141
188
|
];
|
142
189
|
|
143
|
-
//
|
190
|
+
// 文本居中样式(兼容旧用法)
|
144
191
|
if (centerText) {
|
145
192
|
classes.push('cosy:justify-center cosy:text-center');
|
146
193
|
}
|
@@ -1,55 +1,67 @@
|
|
1
1
|
export interface IMetaProps {
|
2
|
-
|
3
|
-
|
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
|
-
|
2
|
+
title: string;
|
3
|
+
description: string;
|
4
|
+
keywords: string;
|
5
|
+
author: string;
|
6
|
+
robots: string;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* 图标
|
10
|
+
*/
|
11
|
+
favicon?: ImageMetadata;
|
12
|
+
|
13
|
+
/**
|
14
|
+
* 基础路径,用于处理网站部署在二级目录的情况
|
15
|
+
* @default ""
|
16
|
+
*/
|
17
|
+
basePath?: string;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* 站点名称
|
21
|
+
*/
|
22
|
+
siteName?: string;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* 页面语言
|
26
|
+
* @default "zh-CN"
|
27
|
+
*/
|
28
|
+
lang?: string;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* 是否包含视口元标签
|
32
|
+
* @default true
|
33
|
+
*/
|
34
|
+
viewport?: boolean;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* 自定义CSS
|
38
|
+
*/
|
39
|
+
customStyles?: string;
|
40
|
+
|
41
|
+
/**
|
42
|
+
* 自定义头部内容
|
43
|
+
*/
|
44
|
+
head?: astroHTML.JSX.Element;
|
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
|
+
* 预设背景色,可选值:'default' | 'white' | 'gray' | 'dark' | 'gradient-blue' | 'gradient-pink' | 'gradient-green'
|
64
|
+
* @default 'default'
|
65
|
+
*/
|
66
|
+
background?: 'default' | 'white' | 'gray' | 'dark' | 'gradient-blue' | 'gradient-pink' | 'gradient-green';
|
55
67
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coffic/cosy-ui",
|
3
|
-
"version": "0.8.
|
3
|
+
"version": "0.8.23",
|
4
4
|
"description": "An astro component library",
|
5
5
|
"author": {
|
6
6
|
"name": "nookery",
|
@@ -63,7 +63,8 @@
|
|
63
63
|
"@remixicon/vue": "^4.6.0",
|
64
64
|
"astro-integration-kit": "^0.18.0",
|
65
65
|
"fs-extra": "^11.3.0",
|
66
|
-
"html-to-image": "^1.11.13"
|
66
|
+
"html-to-image": "^1.11.13",
|
67
|
+
"shiki": "^3.7.0"
|
67
68
|
},
|
68
69
|
"devDependencies": {
|
69
70
|
"@astrojs/check": "^0.9.4",
|
@@ -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>
|