@coffic/cosy-ui 0.9.18 → 0.9.20

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 (28) hide show
  1. package/dist/app.css +1 -1
  2. package/dist/src-astro/code-container/ButtonCodeToggle.astro +0 -1
  3. package/dist/src-astro/code-container/ButtonCopyCode.astro +0 -2
  4. package/dist/src-astro/code-container/CodeContainer.astro +0 -3
  5. package/dist/src-astro/code-container/CodeToolbar.astro +0 -2
  6. package/dist/src-astro/footer/Footer.astro +1 -0
  7. package/dist/src-astro/header/Header.astro +3 -44
  8. package/dist/src-astro/header/LogoLink.astro +87 -0
  9. package/dist/src-astro/language-switcher/LanguageSwitcher.astro +3 -1
  10. package/dist/src-astro/layout-app/AppLayout.astro +12 -12
  11. package/dist/src-astro/layout-app/SkeletonLoader.astro +191 -0
  12. package/dist/src-astro/layout-app/loading-classes.ts +55 -0
  13. package/dist/src-astro/layout-basic/BaseLayout.astro +6 -6
  14. package/dist/src-astro/layout-basic/index.ts +1 -9
  15. package/dist/src-astro/loading-overlay/LoadingOverlay.astro +147 -75
  16. package/dist/src-astro/loading-overlay/index.ts +1 -1
  17. package/dist/src-astro/sidebar/MobileNav.astro +55 -0
  18. package/dist/src-astro/sidebar/NavItem.astro +100 -0
  19. package/dist/src-astro/sidebar/Sidebar.astro +37 -98
  20. package/dist/src-astro/sidebar/SidebarNav.astro +10 -87
  21. package/dist/src-astro/sidebar/index.ts +3 -1
  22. package/dist/src-astro/sidebar/utils.ts +64 -0
  23. package/dist/src-astro/theme-switcher/ThemeSwitcher.astro +3 -1
  24. package/dist/src-astro/types/layout.ts +5 -0
  25. package/dist/src-astro/types/meta.ts +0 -6
  26. package/package.json +1 -1
  27. package/dist/src-astro/layout-basic/BaseLayoutBasic.astro +0 -17
  28. package/dist/src-astro/loading-overlay/types.ts +0 -12
@@ -14,7 +14,6 @@ const { isCodeView = false } = Astro.props;
14
14
 
15
15
  <script>
16
16
  function initializeCodeToggle() {
17
- console.log('CodeContainer: 初始化代码/预览切换按钮');
18
17
  const codeToggles = document.querySelectorAll('[data-toggle="code"]');
19
18
  codeToggles.forEach((toggle) => {
20
19
  toggle.addEventListener('click', () => {
@@ -34,8 +34,6 @@ import { ClipboardIcon } from '../icons/index';
34
34
 
35
35
  <script>
36
36
  function initializeCopyCode() {
37
- console.log('CodeContainer: 初始化复制代码按钮');
38
-
39
37
  const copyButtons = document.querySelectorAll('[aria-label="复制代码"]');
40
38
  copyButtons.forEach((button) => {
41
39
  button.addEventListener('click', () => {
@@ -103,8 +103,6 @@ const {
103
103
 
104
104
  <script>
105
105
  function initializeCodeContainer() {
106
- console.log('CodeContainer: 初始化代码容器');
107
-
108
106
  // 初始化时隐藏除第一个以外的所有内容
109
107
  document
110
108
  .querySelectorAll('[data-role="code-container"]')
@@ -119,7 +117,6 @@ const {
119
117
  }
120
118
 
121
119
  document.addEventListener('astro:page-load', () => {
122
- console.log('CodeContainer: 页面加载完成,初始化代码容器');
123
120
  initializeCodeContainer();
124
121
  });
125
122
  </script>
@@ -43,8 +43,6 @@ const {
43
43
 
44
44
  <script>
45
45
  function initializeTab() {
46
- console.log('CodeContainer: 初始化标签切换按钮');
47
-
48
46
  const exampleTabs = document.querySelectorAll(
49
47
  '[role="tab"][data-tab^="tab-"]'
50
48
  );
@@ -233,6 +233,7 @@ const debugClasses = debug
233
233
  ---
234
234
 
235
235
  <footer
236
+ transition:persist
236
237
  class:list={[
237
238
  'cosy:footer cosy:z-50 cosy:sm:footer-horizontal cosy:bg-base-200 cosy:text-base-content cosy:p-10',
238
239
  debugClasses.footer,
@@ -31,9 +31,7 @@
31
31
  * - astroI18n - 完整的 astro:i18n 模块(启用语言切换时需要)
32
32
  */
33
33
  import {
34
- Image,
35
34
  LanguageSwitcher,
36
- Link,
37
35
  LinkUtil,
38
36
  type IHeaderProps,
39
37
  type INavItem,
@@ -41,6 +39,7 @@ import {
41
39
  ThemeSwitcher,
42
40
  } from '../../index-astro';
43
41
  import Logo from '../../src/assets/logo-rounded.png';
42
+ import LogoLink from './LogoLink.astro';
44
43
 
45
44
  export interface Props extends IHeaderProps {
46
45
  debug?: boolean;
@@ -83,18 +82,6 @@ const linkHeightClasses = {
83
82
  xl: 'cosy:py-3',
84
83
  };
85
84
 
86
- // 设置logo大小
87
- const logoSizeClasses = {
88
- '3xs': 'cosy:w-3 cosy:h-3',
89
- '2xs': 'cosy:w-4 cosy:h-4',
90
- xs: 'cosy:w-5 cosy:h-5',
91
- sm: 'cosy:w-6 cosy:h-6',
92
- md: 'cosy:w-8 cosy:h-8',
93
- lg: 'cosy:w-10 cosy:h-10',
94
- xl: 'cosy:w-12 cosy:h-12',
95
- };
96
-
97
- const logoSizeClass = logoSizeClasses[height];
98
85
  const linkHeightClass = linkHeightClasses[height];
99
86
 
100
87
  // 检查 i18n 是否启用,通过 Astro.currentLocale 来判断
@@ -150,21 +137,7 @@ const activeLink = LinkUtil.getActiveLink(
150
137
  {
151
138
  navPosition === 'start' ? (
152
139
  <div class="cosy:flex cosy:items-center cosy:gap-4">
153
- <Link
154
- animation="none"
155
- debug={debug}
156
- href={logoHref}
157
- class:list={['cosy:btn cosy:btn-ghost', linkHeightClass]}>
158
- <Image
159
- rounded="full"
160
- showPlaceholder={false}
161
- transition="none"
162
- lazy={false}
163
- src={logo}
164
- alt="logo"
165
- class={logoSizeClass}
166
- />
167
- </Link>
140
+ <LogoLink src={logo} href={logoHref} size={height} debug={debug} />
168
141
  <div class="cosy:hidden cosy:lg:flex">
169
142
  <NavItems
170
143
  navItems={navItems}
@@ -174,21 +147,7 @@ const activeLink = LinkUtil.getActiveLink(
174
147
  </div>
175
148
  </div>
176
149
  ) : (
177
- <Link
178
- animation="none"
179
- debug={debug}
180
- href={logoHref}
181
- class:list={['cosy:btn cosy:btn-ghost', linkHeightClass]}>
182
- <Image
183
- rounded="full"
184
- showPlaceholder={false}
185
- transition="none"
186
- lazy={false}
187
- src={logo}
188
- alt="logo"
189
- class={logoSizeClass}
190
- />
191
- </Link>
150
+ <LogoLink src={logo} href={logoHref} size={height} debug={debug} />
192
151
  )
193
152
  }
194
153
  <slot name="navbar-start" />
@@ -0,0 +1,87 @@
1
+ ---
2
+ /**
3
+ * @component LogoLink
4
+ *
5
+ * @description
6
+ * LogoLink 组件是一个用于显示网站 logo 的链接组件,通常用于 Header 组件中。
7
+ * 组件支持自定义 logo 图片、链接地址、大小等属性,并提供统一的样式和交互效果。
8
+ *
9
+ * @usage
10
+ * 基本用法:
11
+ * ```astro
12
+ * <LogoLink src="/logo.png" href="/" />
13
+ * ```
14
+ *
15
+ * 自定义大小:
16
+ * ```astro
17
+ * <LogoLink src="/logo.png" href="/" size="lg" />
18
+ * ```
19
+ *
20
+ * @props
21
+ * - src - logo 图片的路径
22
+ * - href - 点击 logo 时跳转的链接地址
23
+ * - alt - logo 的 alt 文本
24
+ * - size - logo 的大小,可选值:'3xs', '2xs', 'xs', 'sm', 'md', 'lg', 'xl'
25
+ * - debug - 是否启用调试模式
26
+ */
27
+ import { Image, Link } from '../../index-astro';
28
+
29
+ export interface Props {
30
+ src: string | ImageMetadata;
31
+ href?: string;
32
+ alt?: string;
33
+ size?: '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
34
+ debug?: boolean;
35
+ }
36
+
37
+ const {
38
+ src,
39
+ href = '/',
40
+ alt = 'logo',
41
+ size = 'md',
42
+ debug = false,
43
+ } = Astro.props;
44
+
45
+ // 设置logo大小
46
+ const logoSizeClasses = {
47
+ '3xs': 'cosy:w-3 cosy:h-3',
48
+ '2xs': 'cosy:w-4 cosy:h-4',
49
+ xs: 'cosy:w-5 cosy:h-5',
50
+ sm: 'cosy:w-6 cosy:h-6',
51
+ md: 'cosy:w-8 cosy:h-8',
52
+ lg: 'cosy:w-10 cosy:h-10',
53
+ xl: 'cosy:w-12 cosy:h-12',
54
+ };
55
+
56
+ const logoSizeClass = logoSizeClasses[size];
57
+
58
+ // 设置链接高度
59
+ const linkHeightClasses = {
60
+ '3xs': 'cosy:py-0',
61
+ '2xs': 'cosy:py-0',
62
+ xs: 'cosy:py-0',
63
+ sm: 'cosy:py-1',
64
+ md: 'cosy:py-1',
65
+ lg: 'cosy:py-2',
66
+ xl: 'cosy:py-3',
67
+ };
68
+
69
+ const linkHeightClass = linkHeightClasses[size];
70
+ ---
71
+
72
+ <Link
73
+ transition:persist
74
+ animation="none"
75
+ debug={debug}
76
+ href={href}
77
+ class:list={['cosy:btn cosy:btn-ghost', linkHeightClass]}>
78
+ <Image
79
+ rounded="full"
80
+ showPlaceholder={false}
81
+ transition="none"
82
+ lazy={false}
83
+ src={src}
84
+ alt={alt}
85
+ class={logoSizeClass}
86
+ />
87
+ </Link>
@@ -76,7 +76,9 @@ if (renderState.shouldRender && Astro.currentLocale) {
76
76
 
77
77
  {
78
78
  renderState.shouldRender && (
79
- <div class={`cosy:dropdown cosy:dropdown-end ${className}`}>
79
+ <div
80
+ transition:persist
81
+ class={`cosy:dropdown cosy:dropdown-end ${className}`}>
80
82
  <div tabindex="0" role="button" class:list={['cosy:btn cosy:btn-ghost']}>
81
83
  <span class="cosy:mr-1">{renderState.currentLanguageName}</span>
82
84
  <ChevronDownIcon size="16px" class="cosy:w-4 cosy:h-4" />
@@ -175,6 +175,7 @@ import {
175
175
  Main,
176
176
  Sidebar,
177
177
  } from '../../index-astro';
178
+ import SkeletonLoader from './SkeletonLoader.astro';
178
179
 
179
180
  interface Props extends IAppLayoutProps {}
180
181
 
@@ -190,6 +191,7 @@ const {
190
191
  footerConfig,
191
192
  headerConfig,
192
193
  metaConfig,
194
+ loadingDelay = 100,
193
195
  ...rest
194
196
  }: Props = Astro.props;
195
197
  ---
@@ -197,7 +199,7 @@ const {
197
199
  <BaseLayout {...metaConfig} debug={debug}>
198
200
  {
199
201
  showHeader && (
200
- <Header {...headerConfig} debug={debug} transition:persist>
202
+ <Header {...headerConfig} debug={debug}>
201
203
  <div slot="navbar-start">
202
204
  <slot name="navbar-start" />
203
205
  </div>
@@ -213,26 +215,24 @@ const {
213
215
 
214
216
  <Container flex="row" gap="md" size="full" padding="none">
215
217
  <!-- 侧边栏容器 -->
216
- {
217
- showSidebar && (
218
- <Sidebar
219
- {...sidebarConfig}
220
- transition:name="sidebar"
221
- transition:persist
222
- />
223
- )
224
- }
218
+ {showSidebar && <Sidebar {...sidebarConfig} />}
225
219
 
226
220
  <!-- 主内容区域 -->
227
221
  <Main {...mainContentConfig}>
228
- <slot />
222
+ <SkeletonLoader
223
+ showLoading={true}
224
+ loadingSize="xl"
225
+ loadingDelay={loadingDelay}
226
+ skeletonClass="cosy:w-full cosy:h-screen cosy:flex cosy:items-center cosy:justify-center">
227
+ <slot />
228
+ </SkeletonLoader>
229
229
  </Main>
230
230
  </Container>
231
231
 
232
232
  <!-- Footer -->
233
233
  {
234
234
  showFooter && (
235
- <Container size="full" padding="none" transition:persist>
235
+ <Container size="full" padding="none">
236
236
  <Footer {...footerConfig} />
237
237
  </Container>
238
238
  )
@@ -0,0 +1,191 @@
1
+ ---
2
+ /**
3
+ * @component SkeletonLoader
4
+ *
5
+ * @description
6
+ * SkeletonLoader 组件是一个智能的骨架屏加载器,用于在页面加载或路由切换时显示骨架屏。
7
+ * 它会监听 Astro 的页面过渡事件,在加载期间隐藏实际内容并显示骨架屏。
8
+ * 支持在骨架屏背景上显示 loading 动画元素。
9
+ *
10
+ * @design
11
+ * 设计理念:
12
+ * 1. 用户体验优先 - 通过骨架屏提供视觉反馈,避免空白页面
13
+ * 2. 智能切换 - 自动在加载状态和内容状态之间切换
14
+ * 3. 可定制性 - 支持自定义骨架屏样式和布局
15
+ * 4. 性能优化 - 使用 CSS 动画,避免阻塞主线程
16
+ * 5. 视觉层次 - 骨架屏提供内容结构,loading 动画提供动态反馈
17
+ *
18
+ * @usage
19
+ * 基本用法:
20
+ * ```astro
21
+ * <SkeletonLoader>
22
+ * <div>实际内容</div>
23
+ * </SkeletonLoader>
24
+ * ```
25
+ *
26
+ * 显示 loading 元素:
27
+ * ```astro
28
+ * <SkeletonLoader
29
+ * showLoading={true}
30
+ * loadingSize="lg"
31
+ * loadingType="ring"
32
+ * >
33
+ * <div>实际内容</div>
34
+ * </SkeletonLoader>
35
+ * ```
36
+ *
37
+ * 自定义骨架屏:
38
+ * ```astro
39
+ * <SkeletonLoader
40
+ * skeletonClass="cosy:bg-gray-200 cosy:animate-pulse"
41
+ * loadingDelay={500}
42
+ * showLoading={false}
43
+ * >
44
+ * <div>实际内容</div>
45
+ * </SkeletonLoader>
46
+ * ```
47
+ *
48
+ * @props
49
+ * - loadingDelay?: number - 延迟显示时间(毫秒),默认为 1000ms
50
+ * - skeletonClass?: string - 骨架屏的自定义 CSS 类名
51
+ * - showLoading?: boolean - 是否显示 loading 元素,默认为 false
52
+ * - loadingSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' - loading 元素尺寸,默认为 'md'
53
+ * - loadingType?: 'ring' | 'dots' | 'spinner' | 'bars' | 'infinity' - loading 类型,默认为 'ring'
54
+ *
55
+ * @slots
56
+ * - default - 实际内容,在加载完成后显示
57
+ *
58
+ * @events
59
+ * 组件会自动监听以下 Astro 事件:
60
+ * - astro:page-load - 页面加载完成时显示内容
61
+ * - astro:before-preparation - 页面准备前显示骨架屏
62
+ * - astro:before-swap - 路由切换前显示骨架屏
63
+ * - astro:after-swap - 路由切换后显示内容
64
+ */
65
+
66
+ import '../../style.ts';
67
+ import {
68
+ getLoadingClass,
69
+ type LoadingType,
70
+ type LoadingSize,
71
+ } from './loading-classes';
72
+
73
+ export interface Props {
74
+ /** 延迟显示时间(毫秒),默认1000ms */
75
+ loadingDelay?: number;
76
+ /** 骨架屏的自定义 CSS 类名 */
77
+ skeletonClass?: string;
78
+ /** 是否显示 loading 元素,默认 false */
79
+ showLoading?: boolean;
80
+ /** loading 元素尺寸,默认 'md' */
81
+ loadingSize?: LoadingSize;
82
+ /** loading 类型,默认 'ring' */
83
+ loadingType?: LoadingType;
84
+ }
85
+
86
+ const {
87
+ loadingDelay = 1000,
88
+ skeletonClass = '',
89
+ showLoading = false,
90
+ loadingSize = 'md',
91
+ loadingType = 'ring',
92
+ } = Astro.props;
93
+
94
+ // 生成唯一的 ID
95
+ const loaderId = `skeleton-loader-${Math.random().toString(36).substr(2, 9)}`;
96
+ ---
97
+
98
+ <div id={loaderId} class="cosy:relative">
99
+ <!-- 骨架屏 -->
100
+ <div
101
+ id={`${loaderId}-skeleton`}
102
+ style="display: none;"
103
+ class={`cosy:relative cosy:flex cosy:items-center cosy:justify-center cosy:min-h-[200px] ${skeletonClass}`}>
104
+ <!-- 骨架屏背景 -->
105
+ <div class="cosy:skeleton cosy:h-24 cosy:w-24 cosy:rounded-md"></div>
106
+
107
+ <!-- Loading 前景元素 -->
108
+ {
109
+ showLoading && (
110
+ <div class="cosy:absolute cosy:inset-0 cosy:flex cosy:items-center cosy:justify-center">
111
+ <span class={getLoadingClass(loadingType, loadingSize)} />
112
+ </div>
113
+ )
114
+ }
115
+ </div>
116
+
117
+ <!-- 实际内容 -->
118
+ <div
119
+ id={`${loaderId}-content`}
120
+ class="cosy:relative cosy:z-20"
121
+ style="opacity: 1; transition: opacity 0.3s ease-in-out;">
122
+ <slot />
123
+ </div>
124
+ </div>
125
+
126
+ <script is:inline define:vars={{ loaderId, loadingDelay }}>
127
+ let showTimeout = null;
128
+ let hideTimeout = null;
129
+ let loaded = false;
130
+
131
+ const getSkeletonElement = () => {
132
+ return document.getElementById(`${loaderId}-skeleton`);
133
+ };
134
+
135
+ const getContentElement = () => {
136
+ return document.getElementById(`${loaderId}-content`);
137
+ };
138
+
139
+ const showSkeleton = () => {
140
+ const skeleton = getSkeletonElement();
141
+ const content = getContentElement();
142
+
143
+ if (!skeleton || !content || loaded) return;
144
+
145
+ // 隐藏内容
146
+ content.style.opacity = '0';
147
+ // 显示骨架屏
148
+ skeleton.style.display = 'flex';
149
+ };
150
+
151
+ // 显示骨架屏的函数
152
+ const showLoader = () => {
153
+ if (loaded) return;
154
+
155
+ // 设置延迟显示
156
+ showTimeout = setTimeout(() => {
157
+ if (loaded) return;
158
+ showSkeleton();
159
+ }, loadingDelay);
160
+ };
161
+
162
+ // 监听 Astro 页面过渡事件
163
+ document.addEventListener('astro:page-load', () => {
164
+ loaded = true;
165
+ });
166
+
167
+ document.addEventListener('astro:before-preparation', () => {
168
+ loaded = false;
169
+ showLoader('astro:before-preparation');
170
+ });
171
+
172
+ // 监听路由变化
173
+ document.addEventListener('astro:before-swap', () => {
174
+ loaded = false;
175
+ showLoader('astro:before-swap');
176
+ });
177
+
178
+ document.addEventListener('astro:after-swap', () => {
179
+ loaded = true;
180
+ });
181
+
182
+ // 页面卸载时清理定时器
183
+ window.addEventListener('beforeunload', () => {
184
+ if (showTimeout) {
185
+ clearTimeout(showTimeout);
186
+ }
187
+ if (hideTimeout) {
188
+ clearTimeout(hideTimeout);
189
+ }
190
+ });
191
+ </script>
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Loading 类名工具函数
3
+ * 用于根据 loading 类型和尺寸生成对应的 CSS 类名
4
+ */
5
+
6
+ export type LoadingType = 'ring' | 'dots' | 'spinner' | 'bars' | 'infinity';
7
+ export type LoadingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
8
+
9
+ /**
10
+ * 根据 loading 类型和尺寸获取对应的 CSS 类名
11
+ * @param type loading 类型
12
+ * @param size loading 尺寸
13
+ * @returns CSS 类名字符串
14
+ */
15
+ export function getLoadingClass(type: LoadingType, size: LoadingSize): string {
16
+ const classMap: Record<LoadingType, Record<LoadingSize, string>> = {
17
+ ring: {
18
+ xs: 'cosy:loading cosy:loading-ring cosy:loading-xs',
19
+ sm: 'cosy:loading cosy:loading-ring cosy:loading-sm',
20
+ md: 'cosy:loading cosy:loading-ring cosy:loading-md',
21
+ lg: 'cosy:loading cosy:loading-ring cosy:loading-lg',
22
+ xl: 'cosy:loading cosy:loading-ring cosy:loading-xl',
23
+ },
24
+ dots: {
25
+ xs: 'cosy:loading cosy:loading-dots cosy:loading-xs',
26
+ sm: 'cosy:loading cosy:loading-dots cosy:loading-sm',
27
+ md: 'cosy:loading cosy:loading-dots cosy:loading-md',
28
+ lg: 'cosy:loading cosy:loading-dots cosy:loading-lg',
29
+ xl: 'cosy:loading cosy:loading-dots cosy:loading-xl',
30
+ },
31
+ spinner: {
32
+ xs: 'cosy:loading cosy:loading-spinner cosy:loading-xs',
33
+ sm: 'cosy:loading cosy:loading-spinner cosy:loading-sm',
34
+ md: 'cosy:loading cosy:loading-spinner cosy:loading-md',
35
+ lg: 'cosy:loading cosy:loading-spinner cosy:loading-lg',
36
+ xl: 'cosy:loading cosy:loading-spinner cosy:loading-xl',
37
+ },
38
+ bars: {
39
+ xs: 'cosy:loading cosy:loading-bars cosy:loading-xs',
40
+ sm: 'cosy:loading cosy:loading-bars cosy:loading-sm',
41
+ md: 'cosy:loading cosy:loading-bars cosy:loading-md',
42
+ lg: 'cosy:loading cosy:loading-bars cosy:loading-lg',
43
+ xl: 'cosy:loading cosy:loading-bars cosy:loading-xl',
44
+ },
45
+ infinity: {
46
+ xs: 'cosy:loading cosy:loading-infinity cosy:loading-xs',
47
+ sm: 'cosy:loading cosy:loading-infinity cosy:loading-sm',
48
+ md: 'cosy:loading cosy:loading-infinity cosy:loading-md',
49
+ lg: 'cosy:loading cosy:loading-infinity cosy:loading-lg',
50
+ xl: 'cosy:loading cosy:loading-infinity cosy:loading-xl',
51
+ },
52
+ };
53
+
54
+ return classMap[type][size];
55
+ }
@@ -52,9 +52,11 @@
52
52
  import '../../style.ts';
53
53
  import { type IMetaProps } from '../../index-astro';
54
54
  import { ClientRouter } from 'astro:transitions';
55
- import { LoadingOverlay } from '../loading-overlay';
56
55
 
57
- export interface Props extends IMetaProps {}
56
+ export interface Props extends IMetaProps {
57
+ /** 最小显示时间(毫秒),默认300ms,确保用户能看到加载状态 */
58
+ loadingMinDisplayTime?: number;
59
+ }
58
60
 
59
61
  const {
60
62
  title,
@@ -69,7 +71,6 @@ const {
69
71
  favicon,
70
72
  'class:list': classList,
71
73
  background = 'default',
72
- loadingDelay = 1000,
73
74
  } = Astro.props;
74
75
 
75
76
  // 处理背景色 class
@@ -108,18 +109,17 @@ let bodyClasses = [
108
109
  <meta name="generator" content={Astro.generator} />
109
110
  {favicon && <link rel="icon" type={favicon.format} href={favicon.src} />}
110
111
 
112
+ <ClientRouter />
113
+
111
114
  <!-- 自定义样式 -->
112
115
  {customStyles && <style set:html={customStyles} />}
113
116
 
114
117
  <!-- 自定义头部内容 -->
115
118
  {head && <div set:html={head} />}
116
119
 
117
- <ClientRouter />
118
-
119
120
  <slot name="head" />
120
121
  </head>
121
122
  <body class:list={[bodyClasses, classList, 'min-h-screen']}>
122
123
  <slot />
123
- <LoadingOverlay loadingDelay={loadingDelay} />
124
124
  </body>
125
125
  </html>
@@ -1,11 +1,3 @@
1
1
  import BaseLayout from './BaseLayout.astro';
2
- import BaseLayoutBasic from './BaseLayoutBasic.astro';
3
- import BasicSourceCode from './BaseLayoutBasic.astro?raw';
4
- import { extractSimpleExample } from '../../src/utils/component';
5
2
 
6
- export { BaseLayout, BaseLayoutBasic };
7
-
8
- // 导出示例源代码
9
- export const BaseLayoutExampleCodes = {
10
- Basic: extractSimpleExample(BasicSourceCode, 'BaseLayout'),
11
- };
3
+ export { BaseLayout };