@coffic/cosy-ui 0.9.23 → 0.9.25

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.
Files changed (42) hide show
  1. package/dist/app.css +1 -1
  2. package/dist/index-astro.ts +0 -2
  3. package/dist/src/assets/iconData.ts +5 -0
  4. package/dist/src/utils/link.ts +1 -1
  5. package/dist/src/utils/theme.ts +99 -96
  6. package/dist/src-astro/article/Article.astro +1 -0
  7. package/dist/src-astro/container/Container.astro +9 -0
  8. package/dist/src-astro/footer/Footer.astro +16 -20
  9. package/dist/src-astro/footer/FooterCopyright.astro +8 -17
  10. package/dist/src-astro/footer/FooterICP.astro +18 -0
  11. package/dist/src-astro/footer/index.ts +1 -0
  12. package/dist/src-astro/footer/types.ts +27 -0
  13. package/dist/src-astro/header/Header.astro +53 -54
  14. package/dist/src-astro/header/HeaderCenter.astro +59 -0
  15. package/dist/src-astro/header/HeaderEnd.astro +90 -0
  16. package/dist/src-astro/header/HeaderStart.astro +78 -0
  17. package/dist/src-astro/header/MobileNav.astro +44 -0
  18. package/dist/src-astro/header/NavItems.astro +82 -0
  19. package/dist/src-astro/header/index.ts +6 -0
  20. package/dist/src-astro/icons/GlobeIcon.astro +28 -0
  21. package/dist/src-astro/icons/index.ts +1 -0
  22. package/dist/src-astro/language-switcher/LanguageSwitcher.astro +5 -2
  23. package/dist/src-astro/layout-app/AppHeader.astro +95 -0
  24. package/dist/src-astro/layout-app/AppLayout.astro +18 -26
  25. package/dist/src-astro/layout-basic/index.ts +1 -0
  26. package/dist/src-astro/{types → layout-basic}/layout.ts +5 -5
  27. package/dist/src-astro/modal/Modal.astro +39 -4
  28. package/dist/src-astro/sidebar/DesktopSidebar.astro +123 -0
  29. package/dist/src-astro/sidebar/MobileSidebar.astro +91 -0
  30. package/dist/src-astro/sidebar/Sidebar.astro +45 -86
  31. package/dist/src-astro/sidebar/SidebarNav.astro +12 -3
  32. package/dist/src-astro/sidebar/index.ts +1 -2
  33. package/dist/src-astro/theme-switcher/ThemeItem.astro +43 -3
  34. package/dist/src-astro/theme-switcher/ThemeSwitcher.astro +6 -67
  35. package/dist/src-astro/theme-switcher/index.ts +1 -9
  36. package/dist/src-astro/types/footer.ts +5 -0
  37. package/dist/src-astro/types/header.ts +6 -0
  38. package/package.json +1 -1
  39. package/dist/src-astro/nav-item/NavItems.astro +0 -44
  40. package/dist/src-astro/nav-item/index.ts +0 -3
  41. package/dist/src-astro/sidebar/MobileNav.astro +0 -55
  42. package/dist/src-astro/theme-switcher/ThemeSwitcherBasic.astro +0 -7
@@ -0,0 +1,123 @@
1
+ ---
2
+ /**
3
+ * DesktopSidebar组件
4
+ *
5
+ * 桌面端固定侧边栏组件
6
+ *
7
+ * @example
8
+ * ```astro
9
+ * ---
10
+ * import DesktopSidebar from './DesktopSidebar.astro';
11
+ *
12
+ * const sidebarItems = [
13
+ * { title: "入门", items: [
14
+ * { href: "/docs/getting-started", text: "快速开始" },
15
+ * { href: "/docs/installation", text: "安装" }
16
+ * ]}
17
+ * ];
18
+ * ---
19
+ *
20
+ * <DesktopSidebar sidebarItems={sidebarItems} />
21
+ * ```
22
+ */
23
+
24
+ import '../../style.ts';
25
+ import { SidebarNav } from '../../index-astro';
26
+ import { getMarginTopClass, getMarginBottomClass } from './utils.ts';
27
+ import type { ISidebarProps } from '../../index-astro';
28
+
29
+ export interface Props extends ISidebarProps {
30
+ /**
31
+ * 自定义类名
32
+ */
33
+ class?: string;
34
+
35
+ /**
36
+ * 是否开启调试模式,显示边框
37
+ * @default false
38
+ */
39
+ debug?: boolean;
40
+
41
+ /**
42
+ * 顶部外边距
43
+ * @default 'none'
44
+ */
45
+ marginTop?: string;
46
+
47
+ /**
48
+ * 底部外边距
49
+ * @default 'none'
50
+ */
51
+ marginBottom?: string;
52
+
53
+ /**
54
+ * 顶部定位类名
55
+ * @default 'cosy:top-12'
56
+ */
57
+ topClass?: string;
58
+
59
+ /**
60
+ * 高度类名
61
+ * @default 'cosy:h-[calc(100vh-3rem)]'
62
+ */
63
+ heightClass?: string;
64
+ }
65
+
66
+ const {
67
+ sidebarItems,
68
+ class: className,
69
+ debug = false,
70
+ marginTop = 'none',
71
+ marginBottom = 'none',
72
+ topClass = 'cosy:top-12',
73
+ heightClass = 'cosy:h-[calc(100vh-3rem)]',
74
+ } = Astro.props;
75
+
76
+ // 自动获取当前路径
77
+ const currentPath = Astro.url.pathname;
78
+
79
+ const debugClass = debug ? 'cosy:border cosy:border-red-500' : '';
80
+ ---
81
+
82
+ {/* 桌面端侧边栏 */}
83
+ <aside
84
+ data-desktop-sidebar
85
+ data-current-path={currentPath}
86
+ data-margin-top={marginTop}
87
+ data-margin-bottom={marginBottom}
88
+ class:list={[
89
+ className,
90
+ debugClass,
91
+ 'cosy:hidden cosy:w-60 cosy:lg:block cosy:bg-base-200 cosy:px-4 cosy:overflow-y-auto cosy:sticky',
92
+ topClass,
93
+ heightClass,
94
+ getMarginTopClass(marginTop),
95
+ getMarginBottomClass(marginBottom),
96
+ ]}>
97
+ <SidebarNav
98
+ sidebarItems={sidebarItems}
99
+ currentPath={currentPath}
100
+ debug={debug}
101
+ />
102
+ </aside>
103
+
104
+ <script>
105
+ import { saveScrollPosition, restoreScrollPosition } from './utils.ts';
106
+
107
+ // 处理桌面端侧边栏滚动位置保存和恢复
108
+ document.addEventListener('astro:before-preparation', () => {
109
+ // 保存桌面端滚动位置
110
+ const desktopContent = document.querySelector('[data-desktop-sidebar]');
111
+ if (desktopContent) {
112
+ saveScrollPosition(desktopContent, 'sidebarScrollPosition');
113
+ }
114
+ });
115
+
116
+ document.addEventListener('astro:page-load', () => {
117
+ // 恢复桌面端滚动位置
118
+ const desktopContent = document.querySelector('[data-desktop-sidebar]');
119
+ if (desktopContent) {
120
+ restoreScrollPosition(desktopContent, 'sidebarScrollPosition');
121
+ }
122
+ });
123
+ </script>
@@ -0,0 +1,91 @@
1
+ ---
2
+ /**
3
+ * MobileSidebar组件
4
+ *
5
+ * 移动端侧边栏弹出层组件
6
+ *
7
+ * @example
8
+ * ```astro
9
+ * ---
10
+ * import MobileSidebar from './MobileSidebar.astro';
11
+ *
12
+ * const sidebarItems = [
13
+ * { title: "入门", items: [
14
+ * { href: "/docs/getting-started", text: "快速开始" },
15
+ * { href: "/docs/installation", text: "安装" }
16
+ * ]}
17
+ * ];
18
+ * ---
19
+ *
20
+ * <MobileSidebar sidebarItems={sidebarItems} />
21
+ * ```
22
+ */
23
+
24
+ import '../../style.ts';
25
+ import { SidebarNav, Modal } from '../../index-astro';
26
+ import type { ISidebarProps } from '../../index-astro';
27
+
28
+ export interface Props extends ISidebarProps {
29
+ /**
30
+ * 是否开启调试模式,显示边框
31
+ * @default false
32
+ */
33
+ debug?: boolean;
34
+ }
35
+
36
+ const { sidebarItems, debug = false } = Astro.props;
37
+
38
+ // 自动获取当前路径
39
+ const currentPath = Astro.url.pathname;
40
+
41
+ let title = '';
42
+ let titleHref = '';
43
+ if (sidebarItems.length > 0) {
44
+ const sidebarMainItem = sidebarItems[0];
45
+ title = sidebarMainItem.text;
46
+ titleHref = sidebarMainItem.href;
47
+ }
48
+ ---
49
+
50
+ {/* 移动端侧边栏弹出层 */}
51
+ <Modal
52
+ id="mobile-sidebar"
53
+ title={title}
54
+ titleHref={titleHref}
55
+ class="cosy:mx-4 cosy:lg:w-80 cosy:w-[calc(100vw-2rem)] cosy:max-w-full">
56
+ <div
57
+ class="cosy:h-[calc(100vh-8rem)] cosy:overflow-y-auto"
58
+ data-mobile-sidebar-content>
59
+ <SidebarNav
60
+ sidebarItems={sidebarItems}
61
+ currentPath={currentPath}
62
+ debug={debug}
63
+ showHeading={false}
64
+ />
65
+ </div>
66
+ </Modal>
67
+
68
+ <script>
69
+ import { saveScrollPosition, restoreScrollPosition } from './utils.ts';
70
+
71
+ // 处理移动端侧边栏滚动位置保存和恢复
72
+ document.addEventListener('astro:before-preparation', () => {
73
+ // 保存移动端滚动位置
74
+ const mobileContent = document.querySelector(
75
+ '[data-mobile-sidebar-content]'
76
+ );
77
+ if (mobileContent) {
78
+ saveScrollPosition(mobileContent, 'mobileSidebarScrollPosition');
79
+ }
80
+ });
81
+
82
+ document.addEventListener('astro:page-load', () => {
83
+ // 恢复移动端滚动位置
84
+ const mobileContent = document.querySelector(
85
+ '[data-mobile-sidebar-content]'
86
+ );
87
+ if (mobileContent) {
88
+ restoreScrollPosition(mobileContent, 'mobileSidebarScrollPosition');
89
+ }
90
+ });
91
+ </script>
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Sidebar组件
4
4
  *
5
- * 用于文档页面的侧边栏导航
5
+ * 用于文档页面的侧边栏导航,自动适配移动端和桌面端
6
6
  *
7
7
  * @example
8
8
  * ```astro
@@ -22,13 +22,44 @@
22
22
  */
23
23
 
24
24
  import '../../style.ts';
25
- import { SidebarNav, Modal } from '../../index-astro';
26
- import { getMarginTopClass, getMarginBottomClass } from './utils.ts';
27
- import MobileNav from './MobileNav.astro';
25
+ import MobileSidebar from './MobileSidebar.astro';
26
+ import DesktopSidebar from './DesktopSidebar.astro';
28
27
  import type { ISidebarProps } from '../../index-astro';
29
28
 
30
29
  export interface Props extends ISidebarProps {
30
+ /**
31
+ * 自定义类名
32
+ */
33
+ class?: string;
34
+
35
+ /**
36
+ * 是否开启调试模式,显示边框
37
+ * @default false
38
+ */
39
+ debug?: boolean;
40
+
41
+ /**
42
+ * 顶部外边距
43
+ * @default 'none'
44
+ */
45
+ marginTop?: string;
46
+
47
+ /**
48
+ * 底部外边距
49
+ * @default 'none'
50
+ */
51
+ marginBottom?: string;
52
+
53
+ /**
54
+ * 顶部定位类名
55
+ * @default 'cosy:top-12'
56
+ */
31
57
  topClass?: string;
58
+
59
+ /**
60
+ * 高度类名
61
+ * @default 'cosy:h-[calc(100vh-3rem)]'
62
+ */
32
63
  heightClass?: string;
33
64
  }
34
65
 
@@ -41,90 +72,18 @@ const {
41
72
  topClass = 'cosy:top-12',
42
73
  heightClass = 'cosy:h-[calc(100vh-3rem)]',
43
74
  } = Astro.props;
44
-
45
- // 自动获取当前路径
46
- const currentPath = Astro.url.pathname;
47
-
48
- const debugClass = debug ? 'cosy:border cosy:border-red-500' : '';
49
75
  ---
50
76
 
51
- {/* 移动端导航栏 */}
52
- <MobileNav
77
+ {/* 移动端侧边栏 */}
78
+ <MobileSidebar sidebarItems={sidebarItems} debug={debug} />
79
+
80
+ {/* 桌面端侧边栏 */}
81
+ <DesktopSidebar
53
82
  sidebarItems={sidebarItems}
54
- currentPath={currentPath}
83
+ class={className}
55
84
  debug={debug}
85
+ marginTop={marginTop}
86
+ marginBottom={marginBottom}
87
+ topClass={topClass}
88
+ heightClass={heightClass}
56
89
  />
57
-
58
- {/* 移动端侧边栏弹出层 */}
59
- <Modal
60
- id="mobile-sidebar"
61
- class="cosy:mx-4 cosy:lg:w-80 cosy:w-[calc(100vw-2rem)] cosy:max-w-full">
62
- <div
63
- class="cosy:h-[calc(100vh-8rem)] cosy:overflow-y-auto"
64
- data-mobile-sidebar-content>
65
- <SidebarNav
66
- sidebarItems={sidebarItems}
67
- currentPath={currentPath}
68
- debug={debug}
69
- />
70
- </div>
71
- </Modal>
72
-
73
- {/* 桌面端侧边栏 */}
74
- <aside
75
- data-desktop-sidebar
76
- data-current-path={currentPath}
77
- data-margin-top={marginTop}
78
- data-margin-bottom={marginBottom}
79
- class:list={[
80
- className,
81
- debugClass,
82
- 'cosy:hidden cosy:w-60 cosy:lg:block cosy:bg-base-200 cosy:px-4 cosy:overflow-y-auto cosy:sticky',
83
- topClass,
84
- heightClass,
85
- getMarginTopClass(marginTop),
86
- getMarginBottomClass(marginBottom),
87
- ]}>
88
- <SidebarNav
89
- sidebarItems={sidebarItems}
90
- currentPath={currentPath}
91
- debug={debug}
92
- />
93
- </aside>
94
-
95
- <script>
96
- import { saveScrollPosition, restoreScrollPosition } from './utils.ts';
97
-
98
- // 处理侧边栏滚动位置保存和恢复
99
- document.addEventListener('astro:before-preparation', () => {
100
- // 保存桌面端滚动位置
101
- const desktopContent = document.querySelector('[data-desktop-sidebar]');
102
- if (desktopContent) {
103
- saveScrollPosition(desktopContent, 'sidebarScrollPosition');
104
- }
105
-
106
- // 保存移动端滚动位置
107
- const mobileContent = document.querySelector(
108
- '[data-mobile-sidebar-content]'
109
- );
110
- if (mobileContent) {
111
- saveScrollPosition(mobileContent, 'mobileSidebarScrollPosition');
112
- }
113
- });
114
-
115
- document.addEventListener('astro:page-load', () => {
116
- // 恢复桌面端滚动位置
117
- const desktopContent = document.querySelector('[data-desktop-sidebar]');
118
- if (desktopContent) {
119
- restoreScrollPosition(desktopContent, 'sidebarScrollPosition');
120
- }
121
-
122
- // 恢复移动端滚动位置
123
- const mobileContent = document.querySelector(
124
- '[data-mobile-sidebar-content]'
125
- );
126
- if (mobileContent) {
127
- restoreScrollPosition(mobileContent, 'mobileSidebarScrollPosition');
128
- }
129
- });
130
- </script>
@@ -27,6 +27,12 @@ interface Props {
27
27
  */
28
28
  debug?: boolean;
29
29
 
30
+ /**
31
+ * 是否显示标题
32
+ * @default true
33
+ */
34
+ showHeading?: boolean;
35
+
30
36
  /**
31
37
  * 自定义类名
32
38
  */
@@ -37,6 +43,7 @@ const {
37
43
  sidebarItems,
38
44
  currentPath,
39
45
  debug = false,
46
+ showHeading = true,
40
47
  class: className,
41
48
  } = Astro.props;
42
49
 
@@ -50,9 +57,11 @@ const debugClass = debug ? 'cosy:border cosy:border-red-500' : '';
50
57
  {
51
58
  sidebarItems.map((section: ISidebarItem) => (
52
59
  <div class:list={[debugClass]}>
53
- <Heading level={5} align="center" href={section.href}>
54
- {section.text}
55
- </Heading>
60
+ {showHeading && (
61
+ <Heading level={5} align="center" href={section.href}>
62
+ {section.text}
63
+ </Heading>
64
+ )}
56
65
  <ul
57
66
  class:list={[
58
67
  'cosy:menu cosy:rounded-box cosy:w-full cosy:no-underline',
@@ -1,6 +1,5 @@
1
1
  import Sidebar from './Sidebar.astro';
2
2
  import SidebarNav from './SidebarNav.astro';
3
- import MobileNav from './MobileNav.astro';
4
3
  import NavItem from './NavItem.astro';
5
4
 
6
- export { Sidebar, SidebarNav, MobileNav, NavItem };
5
+ export { Sidebar, SidebarNav, NavItem };
@@ -14,7 +14,7 @@
14
14
  * ```
15
15
  */
16
16
 
17
- import { Button } from '../../index-astro';
17
+ import { Button, CheckIcon } from '../../index-astro';
18
18
  import '../../style.ts';
19
19
 
20
20
  interface Props {
@@ -40,6 +40,46 @@ const { theme, label, class: className = '' } = Astro.props;
40
40
  size="sm"
41
41
  block
42
42
  class={`cosy:text-left cosy:justify-start ${className} cosy:theme-item`}
43
- data-theme={theme}>
44
- {label}
43
+ data-theme-id={theme}>
44
+ <div
45
+ class="cosy:flex cosy:items-center cosy:flex-row cosy:justify-between cosy:w-full">
46
+ <span>{label}</span>
47
+ <CheckIcon
48
+ size="16px"
49
+ class="cosy:theme-check cosy:hidden cosy:text-primary cosy:ml-2"
50
+ />
51
+ </div>
45
52
  </Button>
53
+
54
+ <script>
55
+ import { createThemeManager } from '../../src/utils/theme';
56
+
57
+ const themeManager = createThemeManager();
58
+
59
+ // 初始化主题切换按钮
60
+ function initThemeSwitcher() {
61
+ document.querySelectorAll('.cosy\\:theme-item').forEach((item) => {
62
+ item.addEventListener('click', () => {
63
+ const theme = item.getAttribute('data-theme-id');
64
+ if (theme) {
65
+ themeManager.setTheme(theme);
66
+ }
67
+ });
68
+ });
69
+ }
70
+
71
+ // 初始加载时初始化
72
+ function initialize() {
73
+ themeManager.initialize();
74
+ initThemeSwitcher();
75
+ }
76
+
77
+ // 初始化
78
+ document.addEventListener('DOMContentLoaded', initialize);
79
+
80
+ // Astro view transitions 后重新初始化
81
+ document.addEventListener('astro:after-swap', initialize);
82
+
83
+ // 确保脚本加载后立即初始化
84
+ initialize();
85
+ </script>
@@ -25,7 +25,7 @@
25
25
  * ```
26
26
  */
27
27
 
28
- import { SunCloudyIcon } from '../../index-astro';
28
+ import { Button, SunCloudyIcon } from '../../index-astro';
29
29
  import ThemeItem from './ThemeItem.astro';
30
30
  import '../../style.ts';
31
31
 
@@ -42,9 +42,7 @@ const themes = [
42
42
  { id: 'default', name: 'Default' },
43
43
  { id: 'light', name: 'Light' },
44
44
  { id: 'dark', name: 'Dark' },
45
- { id: 'pastel', name: 'Pastel' },
46
45
  { id: 'lemonade', name: 'Lemonade' },
47
- { id: 'cupcake', name: 'Cupcake' },
48
46
  { id: 'nord', name: 'Nord' },
49
47
  { id: 'business', name: 'Business' },
50
48
  { id: 'luxury', name: 'Luxury' },
@@ -52,72 +50,13 @@ const themes = [
52
50
  ---
53
51
 
54
52
  <!-- 主题切换按钮 -->
55
- <div
56
- transition:persist
57
- class:list={['cosy:dropdown-end cosy:dropdown', className]}>
58
- <div tabindex="0" role="button" class:list={['cosy:btn cosy:btn-ghost']}>
59
- <SunCloudyIcon size="16px" class="cosy:w-4 cosy:h-4" />
60
- </div>
53
+ <div class:list={['cosy:dropdown-end cosy:dropdown', className]}>
54
+ <Button tabindex="0" variant="ghost">
55
+ <SunCloudyIcon size="16px" />
56
+ </Button>
61
57
  <ul
62
58
  tabindex={0}
63
- class="cosy:dropdown-content cosy:menu cosy:bg-base-100 cosy:dark:bg-neutral-800 cosy:rounded-box cosy:z-[1] cosy:w-56 cosy:p-2 cosy:shadow-lg">
59
+ class="cosy:dropdown-content cosy:ring-1 cosy:ring-base-300 cosy:bg-base-200 cosy:menu cosy:rounded-box cosy:z-[1] cosy:w-56 cosy:p-2 cosy:shadow-lg">
64
60
  {themes.map((theme) => <ThemeItem theme={theme.id} label={theme.name} />)}
65
61
  </ul>
66
62
  </div>
67
-
68
- <script>
69
- import { createThemeManager } from '../../src/utils/theme';
70
-
71
- const themeManager = createThemeManager();
72
-
73
- function updateActiveTheme() {
74
- const currentTheme =
75
- document.documentElement.getAttribute('data-theme') || 'default';
76
- document.querySelectorAll('.cosy\\:theme-item').forEach((item) => {
77
- const isActive = item.getAttribute('data-theme') === currentTheme;
78
- item.setAttribute('data-active', String(isActive));
79
-
80
- // 更新视觉状态
81
- const checkmark = item.querySelector('.cosy\\:theme-check');
82
- if (checkmark) {
83
- if (isActive) {
84
- checkmark.classList.remove('cosy:hidden');
85
- item.classList.add('cosy:bg-base-200', 'cosy:font-medium');
86
- } else {
87
- checkmark.classList.add('cosy:hidden');
88
- item.classList.remove('cosy:bg-base-200', 'cosy:font-medium');
89
- }
90
- }
91
- });
92
- }
93
-
94
- // 初始化主题切换按钮
95
- function initThemeSwitcher() {
96
- document.querySelectorAll('.cosy\\:theme-item').forEach((item) => {
97
- item.addEventListener('click', () => {
98
- console.log('Theme item clicked:', item);
99
- const theme = item.getAttribute('data-theme');
100
- if (theme) {
101
- themeManager.setTheme(theme);
102
- updateActiveTheme();
103
- }
104
- });
105
- });
106
- }
107
-
108
- // 初始加载时初始化
109
- function initialize() {
110
- themeManager.initialize();
111
- initThemeSwitcher();
112
- updateActiveTheme();
113
- }
114
-
115
- // 初始化
116
- document.addEventListener('DOMContentLoaded', initialize);
117
-
118
- // Astro view transitions 后重新初始化
119
- document.addEventListener('astro:after-swap', initialize);
120
-
121
- // 确保脚本加载后立即初始化
122
- initialize();
123
- </script>
@@ -1,11 +1,3 @@
1
1
  import ThemeSwitcher from './ThemeSwitcher.astro';
2
- import ThemeSwitcherBasic from './ThemeSwitcherBasic.astro';
3
- import BasicSourceCode from './ThemeSwitcherBasic.astro?raw';
4
- import { extractSimpleExample } from '../../src/utils/component';
5
2
 
6
- export { ThemeSwitcher, ThemeSwitcherBasic };
7
-
8
- // 导出示例源代码
9
- export const ThemeSwitcherExampleCodes = {
10
- Basic: extractSimpleExample(BasicSourceCode, 'ThemeSwitcher'),
11
- };
3
+ export { ThemeSwitcher };
@@ -67,6 +67,11 @@ export interface IFooterProps {
67
67
  */
68
68
  icp?: string;
69
69
 
70
+ /**
71
+ * ICP备案链接
72
+ */
73
+ icpLink?: string;
74
+
70
75
  /**
71
76
  * 激励标语
72
77
  */
@@ -85,4 +85,10 @@ export interface IHeaderProps {
85
85
  * @default true
86
86
  */
87
87
  sticky?: boolean;
88
+
89
+ /**
90
+ * 导航项之间的间距
91
+ * @default 2
92
+ */
93
+ gap?: number;
88
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffic/cosy-ui",
3
- "version": "0.9.23",
3
+ "version": "0.9.25",
4
4
  "description": "An astro component library",
5
5
  "author": {
6
6
  "name": "nookery",
@@ -1,44 +0,0 @@
1
- ---
2
- /**
3
- * @component NavItems
4
- *
5
- * @description
6
- * NavItems 组件用于渲染导航栏中的导航项目列表。
7
- *
8
- * @usage
9
- * ```astro
10
- * <NavItems
11
- * navItems={navItems}
12
- * activeLink={activeLink}
13
- * linkHeightClass={linkHeightClass}
14
- * />
15
- * ```
16
- */
17
- import '../../style.ts';
18
- import { type INavItem, Link } from '../../index-astro';
19
-
20
- interface Props {
21
- navItems: INavItem[];
22
- activeLink: string;
23
- linkHeightClass: string;
24
- }
25
-
26
- const { navItems, activeLink, linkHeightClass } = Astro.props;
27
- ---
28
-
29
- <ul
30
- data-active-link={activeLink}
31
- class:list={['cosy:px-1 cosy:menu cosy:menu-horizontal', linkHeightClass]}>
32
- {
33
- navItems.map((item) => (
34
- <li>
35
- <Link
36
- variant={activeLink === item.href ? 'primary' : 'default'}
37
- href={item.href}
38
- class:list={[linkHeightClass]}>
39
- {item.title}
40
- </Link>
41
- </li>
42
- ))
43
- }
44
- </ul>
@@ -1,3 +0,0 @@
1
- import NavItems from './NavItems.astro';
2
-
3
- export { NavItems };