@coffic/cosy-ui 0.8.22 → 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-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/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/layout-app/AppLayout.astro +1 -10
- package/dist/src-astro/layout-basic/BaseLayout.astro +20 -4
- package/dist/src-astro/types/meta.ts +65 -53
- package/package.json +3 -2
package/dist/index-astro.ts
CHANGED
@@ -7,6 +7,8 @@ export * from './src-astro/card';
|
|
7
7
|
export * from './src-astro/code-block';
|
8
8
|
export * from './src-astro/code-container';
|
9
9
|
export * from './src-astro/code-example';
|
10
|
+
export * from './src-astro/code-panel';
|
11
|
+
export * from './src-astro/install-tabs';
|
10
12
|
export * from './src-astro/contact';
|
11
13
|
export * from './src-astro/container';
|
12
14
|
export * from './src-astro/errors';
|
@@ -0,0 +1,109 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component CodePanel
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 代码展示面板组件,支持语法高亮、多主题切换和行号显示。
|
7
|
+
* 基于 Shiki 提供高质量的代码高亮效果,与 VS Code 保持一致的渲染效果。
|
8
|
+
* 支持服务端渲染,无需客户端 JavaScript 即可展示代码高亮。
|
9
|
+
*
|
10
|
+
* @features
|
11
|
+
* - 🎨 语法高亮:基于 Shiki,支持 180+ 编程语言
|
12
|
+
* - 🎭 多主题:支持 VS Code 主题(dark-plus、light-plus、github-dark 等)
|
13
|
+
* - 📏 行号显示:可选的行号显示功能
|
14
|
+
* - 🚀 性能优化:服务端渲染,避免客户端重复计算
|
15
|
+
* - 📱 响应式:自适应不同屏幕尺寸
|
16
|
+
* - 🎯 可访问性:语义化 HTML 结构,支持键盘导航
|
17
|
+
*
|
18
|
+
* @usage
|
19
|
+
* 基本用法:
|
20
|
+
* ```astro
|
21
|
+
* <CodePanel code="console.log('Hello, world!');" />
|
22
|
+
* ```
|
23
|
+
*
|
24
|
+
* 指定语言和主题:
|
25
|
+
* ```astro
|
26
|
+
* <CodePanel
|
27
|
+
* code="const name = 'TypeScript';"
|
28
|
+
* language="typescript"
|
29
|
+
* theme="github-dark"
|
30
|
+
* showLineNumbers={true}
|
31
|
+
* />
|
32
|
+
* ```
|
33
|
+
*
|
34
|
+
* 在切换面板中使用:
|
35
|
+
* ```astro
|
36
|
+
* <CodePanel
|
37
|
+
* code={sourceCode}
|
38
|
+
* language="astro"
|
39
|
+
* visible={false}
|
40
|
+
* />
|
41
|
+
* ```
|
42
|
+
*
|
43
|
+
* @props
|
44
|
+
* @param {string} code - 要显示的代码字符串
|
45
|
+
* @param {string} [language="typescript"] - 代码语言,用于语法高亮
|
46
|
+
* @param {string} [theme="dark-plus"] - 主题名称
|
47
|
+
* @param {boolean} [showLineNumbers=false] - 是否显示行号
|
48
|
+
* @param {boolean} [visible=true] - 是否显示在面板中
|
49
|
+
* @param {string} [class] - 自定义类名
|
50
|
+
*
|
51
|
+
* @slots
|
52
|
+
* 此组件不包含插槽,通过 props 传入代码内容
|
53
|
+
*
|
54
|
+
* @accessibility
|
55
|
+
* - 使用语义化的 HTML 结构
|
56
|
+
* - 代码区域具有适当的 aria 标签
|
57
|
+
* - 支持键盘导航和屏幕阅读器
|
58
|
+
* - 高对比度主题支持
|
59
|
+
*/
|
60
|
+
import type { CodePanelProps } from './types';
|
61
|
+
import '../../style.ts';
|
62
|
+
|
63
|
+
interface Props extends CodePanelProps {}
|
64
|
+
|
65
|
+
const {
|
66
|
+
code = '',
|
67
|
+
language = 'typescript',
|
68
|
+
theme = 'dark-plus',
|
69
|
+
showLineNumbers = false,
|
70
|
+
visible = true,
|
71
|
+
class: className = '',
|
72
|
+
} = Astro.props;
|
73
|
+
|
74
|
+
// 优化 Shiki 加载 - 使用动态导入避免构建时创建多个实例
|
75
|
+
let highlightedCode = code;
|
76
|
+
try {
|
77
|
+
// 使用动态导入避免构建时的性能问题
|
78
|
+
const { createHighlighter } = await import('shiki');
|
79
|
+
|
80
|
+
const highlighter = await createHighlighter({
|
81
|
+
themes: [theme],
|
82
|
+
langs: [language],
|
83
|
+
});
|
84
|
+
|
85
|
+
highlightedCode = highlighter.codeToHtml(code, {
|
86
|
+
lang: language,
|
87
|
+
theme: theme,
|
88
|
+
transformers: [],
|
89
|
+
});
|
90
|
+
|
91
|
+
// 释放资源
|
92
|
+
highlighter.dispose?.();
|
93
|
+
} catch (error) {
|
94
|
+
console.warn(
|
95
|
+
'CodePanel: Shiki highlighting failed, falling back to plain text:',
|
96
|
+
error
|
97
|
+
);
|
98
|
+
// 降级到普通代码块
|
99
|
+
highlightedCode = `<pre><code>${code}</code></pre>`;
|
100
|
+
}
|
101
|
+
---
|
102
|
+
|
103
|
+
<div data-panel="code" role="region" aria-label="代码展示面板">
|
104
|
+
<!-- Shiki 渲染的代码 -->
|
105
|
+
<div
|
106
|
+
class="cosy:w-full not-prose cosy-shiki-container"
|
107
|
+
set:html={highlightedCode}
|
108
|
+
/>
|
109
|
+
</div>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* CodePanel 组件的属性接口
|
3
|
+
*/
|
4
|
+
export interface CodePanelProps {
|
5
|
+
/** 要显示的代码字符串 */
|
6
|
+
code: string;
|
7
|
+
/** 代码语言,用于语法高亮,默认 'typescript' */
|
8
|
+
language?: string;
|
9
|
+
/** 主题名称,默认 'dark-plus' */
|
10
|
+
theme?: 'dark-plus' | 'light-plus' | 'github-dark' | 'github-light' | 'nord' | 'dracula';
|
11
|
+
/** 是否显示行号,默认 false */
|
12
|
+
showLineNumbers?: boolean;
|
13
|
+
/** 是否显示在面板中(用于切换),默认 true */
|
14
|
+
visible?: boolean;
|
15
|
+
/** 自定义类名 */
|
16
|
+
class?: string;
|
17
|
+
}
|
@@ -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>
|
@@ -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>
|
@@ -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",
|