@coffic/cosy-ui 0.9.49 → 0.9.51

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 (52) hide show
  1. package/dist/app.css +1 -1
  2. package/dist/index-astro.ts +2 -2
  3. package/dist/src/astro/header/Header.astro +0 -0
  4. package/dist/src/common/border.ts +16 -0
  5. package/dist/src/common/height.ts +2 -0
  6. package/dist/src/common/index.ts +16 -0
  7. package/dist/src/common/layout-utils.ts +67 -0
  8. package/dist/{src-astro/layout-app/loading-classes.ts → src/common/loading.ts} +6 -3
  9. package/dist/src/common/mask.ts +43 -0
  10. package/dist/{src-astro/layout-basic → src/common}/meta.ts +2 -9
  11. package/dist/src/common/padding-axis.ts +29 -0
  12. package/dist/src/common/shadow.ts +10 -0
  13. package/dist/src/common/size.ts +15 -17
  14. package/dist/src/common/width.ts +26 -0
  15. package/dist/src-astro/banner/Banner.astro +6 -63
  16. package/dist/src-astro/contact/Contact.astro +102 -57
  17. package/dist/src-astro/footer/Footer.astro +1 -0
  18. package/dist/src-astro/header/Header.astro +56 -62
  19. package/dist/src-astro/header/HeaderEnd.astro +2 -6
  20. package/dist/src-astro/header/HeaderStart.astro +20 -35
  21. package/dist/src-astro/header/LogoLink.astro +4 -40
  22. package/dist/src-astro/image/Image.astro +26 -50
  23. package/dist/src-astro/image/ImageError.astro +3 -7
  24. package/dist/src-astro/image/ImagePlaceholder.astro +3 -7
  25. package/dist/src-astro/image/LocalImage.astro +9 -7
  26. package/dist/src-astro/image/RemoteImage.astro +47 -48
  27. package/dist/src-astro/image/image.ts +1 -10
  28. package/dist/src-astro/image/utils.ts +9 -51
  29. package/dist/src-astro/layout-app/AppLayout.astro +29 -64
  30. package/dist/src-astro/layout-app/index.ts +2 -1
  31. package/dist/src-astro/layout-basic/BaseLayout.astro +48 -43
  32. package/dist/src-astro/layout-basic/BaseLayoutHtml.astro +91 -0
  33. package/dist/src-astro/layout-basic/Body.astro +33 -0
  34. package/dist/src-astro/layout-basic/BodyDiv.astro +24 -0
  35. package/dist/src-astro/layout-basic/BodyElement.astro +24 -0
  36. package/dist/src-astro/layout-basic/Head.astro +73 -0
  37. package/dist/src-astro/layout-basic/index.ts +1 -1
  38. package/dist/src-astro/layout-basic/layout.ts +11 -4
  39. package/dist/src-astro/sidebar/NavItem.astro +1 -1
  40. package/dist/src-astro/sidebar/SidebarNav.astro +1 -1
  41. package/dist/src-astro/{layout-app/SkeletonLoader.astro → skeleton/Skeleton.astro} +9 -9
  42. package/dist/src-astro/skeleton/index.ts +2 -0
  43. package/dist/src-astro/team-member/TeamMember.astro +17 -22
  44. package/dist/src-astro/text/Text.astro +4 -1
  45. package/dist/src-astro/types/header.ts +10 -4
  46. package/package.json +1 -1
  47. package/dist/src-astro/image/ImageContainer.astro +0 -27
  48. package/dist/src-astro/image/ImagePromptPanel.astro +0 -49
  49. package/dist/src-astro/theme-switcher/index.ts +0 -3
  50. /package/dist/{src-astro/types → src/common}/sidebar.ts +0 -0
  51. /package/dist/src-astro/{theme-switcher → header}/ThemeItem.astro +0 -0
  52. /package/dist/src-astro/{theme-switcher → header}/ThemeSwitcher.astro +0 -0
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @props
18
18
  * - alt: string - 图片的替代文本,用于无障碍访问和图片加载失败时的显示
19
- * - border?: 'none' | 'sm' | 'md' | 'lg' | 'xl' - 图片的边框样式,支持多种边框粗细
19
+ * - border?: BorderSize - 图片的边框样式,支持多种边框粗细
20
20
  * - class?: string - 自定义 CSS 类名,用于覆盖默认样式
21
21
  * - height?: number - 图片的高度,单位为像素
22
22
  * - hover?: 'none' | 'scale' | 'brightness' | 'blur' - 图片的悬停效果,支持缩放、亮度调整和模糊效果
@@ -25,9 +25,9 @@
25
25
  * - loadingIndicator?: 'pulse' | 'spinner' | 'progress' | 'skeleton' - 加载指示器类型,支持脉冲、旋转器、进度条和骨架屏(仅对远程图片有效)
26
26
  * - objectFit?: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down' - 图片的填充方式,控制图片如何适应容器
27
27
  * - objectPosition?: string - 图片的位置,控制图片在容器中的对齐方式
28
- * - rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' - 图片的圆角大小,提供多种圆角选项
29
- * - mask?: 'circle' | 'decagon' | 'diamond' | 'heart' | 'hexagon' | 'hexagon-2' | 'none' | 'pentagon' | 'square' | 'squircle' | 'star' | 'star-2' | 'triangle' | 'triangle-2' | 'triangle-3' | 'triangle-4' - 图片的遮罩形状,支持多种几何形状
30
- * - shadow?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' - 图片的阴影效果,增强视觉层次感
28
+ * - rounded?: RoundedSize - 图片的圆角大小,提供多种圆角选项
29
+ * - mask?: MaskType - 图片的遮罩形状,支持多种几何形状
30
+ * - shadow?: ShadowSize - 图片的阴影效果,增强视觉层次感
31
31
  * - showError?: boolean - 是否显示加载失败的错误图,默认为 true(仅对远程图片有效)
32
32
  * - showPlaceholder?: boolean - 是否显示加载中的占位图,默认为 true(仅对远程图片有效)
33
33
  * - src: ImageSource - 图片源,可以是本地图片或远程URL
@@ -68,11 +68,15 @@
68
68
 
69
69
  import type { ImageMetadata } from 'astro';
70
70
  import '../../style.ts';
71
+ import type {
72
+ RoundedSize,
73
+ MaskType,
74
+ ShadowSize,
75
+ BorderSize,
76
+ } from '../../src/common';
71
77
  import type { ImageSource } from './image.ts';
72
78
  import LocalImage from './LocalImage.astro';
73
79
  import RemoteImage from './RemoteImage.astro';
74
- import type { BorderType } from './utils';
75
- import ImagePromptPanel from './ImagePromptPanel.astro';
76
80
 
77
81
  export interface Props {
78
82
  /**
@@ -83,7 +87,7 @@ export interface Props {
83
87
  * 图片的边框样式
84
88
  * @default "none"
85
89
  */
86
- border?: BorderType;
90
+ border?: BorderSize;
87
91
  /**
88
92
  * 自定义类名
89
93
  */
@@ -126,33 +130,17 @@ export interface Props {
126
130
  * 图片的圆角大小
127
131
  * @default "none"
128
132
  */
129
- rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';
133
+ rounded?: RoundedSize;
130
134
  /**
131
135
  * 图片的遮罩形状
132
136
  * @default "none"
133
137
  */
134
- mask?:
135
- | 'circle'
136
- | 'decagon'
137
- | 'diamond'
138
- | 'heart'
139
- | 'hexagon'
140
- | 'hexagon-2'
141
- | 'none'
142
- | 'pentagon'
143
- | 'square'
144
- | 'squircle'
145
- | 'star'
146
- | 'star-2'
147
- | 'triangle'
148
- | 'triangle-2'
149
- | 'triangle-3'
150
- | 'triangle-4';
138
+ mask?: MaskType;
151
139
  /**
152
140
  * 图片的阴影效果
153
141
  * @default "none"
154
142
  */
155
- shadow?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
143
+ shadow?: ShadowSize;
156
144
  /**
157
145
  * 是否显示加载失败的错误图
158
146
  * @default true
@@ -208,19 +196,6 @@ export interface Props {
208
196
  * @default "constrained"
209
197
  */
210
198
  layout?: string;
211
- /**
212
- * 生成提示词
213
- */
214
- prompt?: string;
215
- /**
216
- * 使用模型
217
- */
218
- model?: string;
219
- /**
220
- * 是否展示生成信息面板(prompt/model)
221
- * @default true
222
- */
223
- showPromptPanel?: boolean;
224
199
  }
225
200
 
226
201
  const {
@@ -246,9 +221,6 @@ const {
246
221
  tooltipPlacement = 'top',
247
222
  tooltipColor = 'neutral',
248
223
  tooltipOpen = false,
249
- prompt = '',
250
- model = '',
251
- showPromptPanel = true,
252
224
  } = Astro.props;
253
225
 
254
226
  // 判断是否为本地图片(ImageMetadata)
@@ -292,7 +264,18 @@ const localProps = {
292
264
  };
293
265
  ---
294
266
 
295
- <div class={`cosy:relative not-prose cosy:w-full cosy:h-full cosy:block`}>
267
+ <div
268
+ class="not-prose
269
+ cosy:relative
270
+ cosy:w-full
271
+ cosy:h-full
272
+ cosy:align-middle
273
+ cosy:mx-auto
274
+ cosy:my-auto
275
+ cosy:justify-center
276
+ cosy:flex
277
+ cosy:items-center"
278
+ data-image-container>
296
279
  {
297
280
  isLocalImage ? (
298
281
  <LocalImage {...localProps} />
@@ -300,11 +283,4 @@ const localProps = {
300
283
  <RemoteImage {...remoteProps} />
301
284
  )
302
285
  }
303
-
304
- {/* 生成信息面板 */}
305
- {
306
- showPromptPanel !== false && (prompt || model) && (
307
- <ImagePromptPanel prompt={prompt} model={model} />
308
- )
309
- }
310
286
  </div>
@@ -5,12 +5,8 @@
5
5
  */
6
6
 
7
7
  import { AlertTriangle } from '../../index-astro';
8
- import {
9
- roundedClasses,
10
- maskClasses,
11
- type RoundedType,
12
- type MaskType,
13
- } from './utils';
8
+ import { roundedClasses, maskClasses } from './utils';
9
+ import type { MaskType, RoundedSize } from '../../src/common';
14
10
 
15
11
  interface Props {
16
12
  /**
@@ -20,7 +16,7 @@ interface Props {
20
16
  /**
21
17
  * 圆角大小
22
18
  */
23
- rounded?: RoundedType;
19
+ rounded?: RoundedSize;
24
20
  /**
25
21
  * 遮罩形状
26
22
  */
@@ -4,12 +4,8 @@
4
4
  * @description 图片加载占位图组件
5
5
  */
6
6
 
7
- import {
8
- roundedClasses,
9
- maskClasses,
10
- type RoundedType,
11
- type MaskType,
12
- } from './utils';
7
+ import { roundedClasses, maskClasses } from './utils';
8
+ import type { MaskType, RoundedSize } from '../../src/common';
13
9
 
14
10
  interface Props {
15
11
  /**
@@ -27,7 +23,7 @@ interface Props {
27
23
  /**
28
24
  * 圆角大小
29
25
  */
30
- rounded?: RoundedType;
26
+ rounded?: RoundedSize;
31
27
  /**
32
28
  * 遮罩形状
33
29
  */
@@ -39,13 +39,15 @@ import {
39
39
  hoverClasses,
40
40
  transitionClasses,
41
41
  type ObjectFitType,
42
- type RoundedType,
43
- type MaskType,
44
- type ShadowType,
45
- type BorderType,
46
42
  type HoverType,
47
43
  type TransitionType,
48
44
  } from './utils';
45
+ import type {
46
+ MaskType,
47
+ ShadowSize,
48
+ BorderSize,
49
+ RoundedSize,
50
+ } from '../../src/common';
49
51
 
50
52
  interface Props {
51
53
  /**
@@ -56,7 +58,7 @@ interface Props {
56
58
  * 图片的边框样式
57
59
  * @default "none"
58
60
  */
59
- border?: BorderType;
61
+ border?: BorderSize;
60
62
  /**
61
63
  * 自定义类名
62
64
  */
@@ -84,7 +86,7 @@ interface Props {
84
86
  * 图片的圆角大小
85
87
  * @default "none"
86
88
  */
87
- rounded?: RoundedType;
89
+ rounded?: RoundedSize;
88
90
  /**
89
91
  * 图片的遮罩形状
90
92
  * @default "none"
@@ -94,7 +96,7 @@ interface Props {
94
96
  * 图片的阴影效果
95
97
  * @default "none"
96
98
  */
97
- shadow?: ShadowType;
99
+ shadow?: ShadowSize;
98
100
  /**
99
101
  * 本地图片元数据
100
102
  */
@@ -33,7 +33,6 @@
33
33
 
34
34
  import '../../style.ts';
35
35
  import ImageTooltipWrapper from './TooltipWrapper.astro';
36
- import ImageContainer from './ImageContainer.astro';
37
36
  import ImagePlaceholder from './ImagePlaceholder.astro';
38
37
  import ImageError from './ImageError.astro';
39
38
  import {
@@ -45,13 +44,15 @@ import {
45
44
  hoverClasses,
46
45
  transitionClasses,
47
46
  type ObjectFitType,
48
- type RoundedType,
49
- type MaskType,
50
- type ShadowType,
51
- type BorderType,
52
47
  type HoverType,
53
48
  type TransitionType,
54
49
  } from './utils';
50
+ import type {
51
+ MaskType,
52
+ ShadowSize,
53
+ BorderSize,
54
+ RoundedSize,
55
+ } from '../../src/common';
55
56
 
56
57
  interface Props {
57
58
  /**
@@ -62,7 +63,7 @@ interface Props {
62
63
  * 图片的边框样式
63
64
  * @default "none"
64
65
  */
65
- border?: BorderType;
66
+ border?: BorderSize;
66
67
  /**
67
68
  * 自定义类名
68
69
  */
@@ -105,7 +106,7 @@ interface Props {
105
106
  * 图片的圆角大小
106
107
  * @default "none"
107
108
  */
108
- rounded?: RoundedType;
109
+ rounded?: RoundedSize;
109
110
  /**
110
111
  * 图片的遮罩形状
111
112
  * @default "none"
@@ -115,7 +116,7 @@ interface Props {
115
116
  * 图片的阴影效果
116
117
  * @default "none"
117
118
  */
118
- shadow?: ShadowType;
119
+ shadow?: ShadowSize;
119
120
  /**
120
121
  * 是否显示加载失败的错误图
121
122
  * @default true
@@ -283,31 +284,14 @@ const imgClasses = [
283
284
  initializeImageHandlers();
284
285
  </script>
285
286
 
286
- <ImageContainer>
287
- {
288
- tooltip ? (
289
- <ImageTooltipWrapper
290
- tooltip={tooltip}
291
- tooltipPlacement={tooltipPlacement}
292
- tooltipColor={tooltipColor}
293
- tooltipOpen={tooltipOpen}>
294
- <img
295
- src={imageUrl}
296
- alt={alt}
297
- width={width}
298
- height={height}
299
- loading={loading}
300
- class={imgClasses}
301
- style={{ objectPosition }}
302
- data-remote="true"
303
- decoding="async"
304
- data-loading="true"
305
- data-src={imageUrl}
306
- />
307
- </ImageTooltipWrapper>
308
- ) : (
287
+ {
288
+ tooltip ? (
289
+ <ImageTooltipWrapper
290
+ tooltip={tooltip}
291
+ tooltipPlacement={tooltipPlacement}
292
+ tooltipColor={tooltipColor}
293
+ tooltipOpen={tooltipOpen}>
309
294
  <img
310
- remote-image
311
295
  src={imageUrl}
312
296
  alt={alt}
313
297
  width={width}
@@ -320,21 +304,36 @@ const imgClasses = [
320
304
  data-loading="true"
321
305
  data-src={imageUrl}
322
306
  />
323
- )
324
- }
307
+ </ImageTooltipWrapper>
308
+ ) : (
309
+ <img
310
+ remote-image
311
+ src={imageUrl}
312
+ alt={alt}
313
+ width={width}
314
+ height={height}
315
+ loading={loading}
316
+ class={imgClasses}
317
+ style={{ objectPosition }}
318
+ data-remote="true"
319
+ decoding="async"
320
+ data-loading="true"
321
+ data-src={imageUrl}
322
+ />
323
+ )
324
+ }
325
325
 
326
- {/* 加载占位图 */}
327
- {
328
- showPlaceholder && (
329
- <ImagePlaceholder
330
- isRemote={true}
331
- loadingIndicator={loadingIndicator}
332
- rounded={rounded}
333
- mask={mask}
334
- />
335
- )
336
- }
326
+ {/* 加载占位图 */}
327
+ {
328
+ showPlaceholder && (
329
+ <ImagePlaceholder
330
+ isRemote={true}
331
+ loadingIndicator={loadingIndicator}
332
+ rounded={rounded}
333
+ mask={mask}
334
+ />
335
+ )
336
+ }
337
337
 
338
- {/* 错误占位图 */}
339
- {showError && <ImageError rounded={rounded} mask={mask} />}
340
- </ImageContainer>
338
+ {/* 错误占位图 */}
339
+ {showError && <ImageError rounded={rounded} mask={mask} />}
@@ -1,16 +1,7 @@
1
1
  import type { ImageMetadata } from 'astro';
2
2
 
3
- /**
4
- * 图片元数据接口
5
- * 用于统一管理项目中的图片元数据类型
6
- * 继承自 Astro 的 ImageMetadata 类型
7
- */
8
- export interface IImageMetadata extends ImageMetadata {
9
- // 可以在这里添加额外的属性
10
- }
11
-
12
3
  /**
13
4
  * 图片源类型
14
- * 可以是 IImageMetadata 对象、字符串 URL 或 Astro 的 ImageMetadata
5
+ * 可以是 ImageMetadata 对象、字符串 URL 或 Astro 的 ImageMetadata
15
6
  */
16
7
  export type ImageSource = string | ImageMetadata;
@@ -2,46 +2,17 @@
2
2
  * 图片组件公共工具函数
3
3
  */
4
4
 
5
- // 圆角类名映射
6
- export const roundedClasses = {
7
- none: '',
8
- sm: 'cosy:rounded-sm',
9
- md: 'cosy:rounded-md',
10
- lg: 'cosy:rounded-lg',
11
- xl: 'cosy:rounded-xl',
12
- '2xl': 'cosy:rounded-2xl',
13
- '3xl': 'cosy:rounded-3xl',
14
- full: 'cosy:rounded-full',
15
- } as const;
5
+ // 圆角类名映射(从 common 导入)
6
+ export { roundedClasses, type RoundedSize } from '../../src/common/rounded';
16
7
 
17
- // 边框类名映射
18
- export const borderClasses = {
19
- none: '',
20
- sm: 'cosy:border cosy:border-base-300',
21
- md: 'cosy:border-2 cosy:border-base-300',
22
- lg: 'cosy:border-4 cosy:border-base-300',
23
- xl: 'cosy:border-8 cosy:border-base-300',
24
- } as const;
8
+ // 边框类名映射(从 common 导入)
9
+ export { borderClasses, type BorderSize } from '../../src/common/border';
25
10
 
26
- // 遮罩类名映射
27
- export const maskClasses = {
28
- circle: 'cosy:mask cosy:mask-circle',
29
- decagon: 'cosy:mask cosy:mask-decagon',
30
- diamond: 'cosy:mask cosy:mask-diamond',
31
- heart: 'cosy:mask cosy:mask-heart',
32
- hexagon: 'cosy:mask cosy:mask-hexagon',
33
- 'hexagon-2': 'cosy:mask cosy:mask-hexagon-2',
34
- none: '',
35
- pentagon: 'cosy:mask cosy:mask-pentagon',
36
- square: 'cosy:mask cosy:mask-square',
37
- squircle: 'cosy:mask cosy:mask-squircle',
38
- star: 'cosy:mask cosy:mask-star',
39
- 'star-2': 'cosy:mask cosy:mask-star-2',
40
- triangle: 'cosy:mask cosy:mask-triangle',
41
- 'triangle-2': 'cosy:mask cosy:mask-triangle-2',
42
- 'triangle-3': 'cosy:mask cosy:mask-triangle-3',
43
- 'triangle-4': 'cosy:mask cosy:mask-triangle-4',
44
- } as const;
11
+ // 遮罩类名映射(从 common 导入)
12
+ export { maskClasses, type MaskType } from '../../src/common/mask';
13
+
14
+ // 阴影类名映射(从 common 导入)
15
+ export { shadowClasses, type ShadowSize } from '../../src/common/shadow';
45
16
 
46
17
  // 对象填充方式类名映射
47
18
  export const objectFitClasses = {
@@ -52,15 +23,6 @@ export const objectFitClasses = {
52
23
  'scale-down': 'cosy:object-scale-down',
53
24
  } as const;
54
25
 
55
- // 阴影类名映射
56
- export const shadowClasses = {
57
- none: '',
58
- sm: 'cosy:shadow-sm',
59
- md: 'cosy:shadow-md',
60
- lg: 'cosy:shadow-lg',
61
- xl: 'cosy:shadow-xl',
62
- '2xl': 'cosy:shadow-2xl',
63
- } as const;
64
26
 
65
27
  // 悬停效果类名映射
66
28
  export const hoverClasses = {
@@ -79,10 +41,6 @@ export const transitionClasses = {
79
41
  } as const;
80
42
 
81
43
  // 类型定义
82
- export type RoundedType = keyof typeof roundedClasses;
83
- export type BorderType = keyof typeof borderClasses;
84
- export type MaskType = keyof typeof maskClasses;
85
44
  export type ObjectFitType = keyof typeof objectFitClasses;
86
- export type ShadowType = keyof typeof shadowClasses;
87
45
  export type HoverType = keyof typeof hoverClasses;
88
46
  export type TransitionType = keyof typeof transitionClasses;
@@ -4,9 +4,7 @@
4
4
  * @description 应用布局组件,适用于页面布局,包含头部导航、侧边栏导航和目录
5
5
  * @usage 用于创建包含头部、侧边栏、主内容区和页脚的完整页面布局
6
6
  * @props
7
- * @prop {any} [class:list] - 类名列表
8
- * @prop {string} [class] - 自定义CSS类名
9
- * @prop {boolean} [debug=false] - 是否启用调试模式,显示各个部分的边框
7
+ *
10
8
  * @prop {Object} [footerConfig] - 页脚配置,包含站点信息、社交媒体链接等
11
9
  * @prop {Object} [headerConfig] - 头部配置,传递给AppHeader组件
12
10
  * @prop {number} [loadingDelay=100] - 加载中界面延迟显示的时间(毫秒)
@@ -164,7 +162,6 @@
164
162
  * sidebarConfig={{
165
163
  * sidebarItems: sidebarItems
166
164
  * }}
167
- * debug={true}
168
165
  * >
169
166
  * <h1>文档内容</h1>
170
167
  * <p>这是文档的主要内容</p>
@@ -247,89 +244,57 @@ import {
247
244
  Main,
248
245
  Sidebar,
249
246
  Modal,
247
+ Skeleton,
250
248
  } from '../../index-astro';
249
+ import {
250
+ getContainerMinHeightClass,
251
+ getSidebarTopClass,
252
+ getSidebarHeightClass,
253
+ type HeaderHeight,
254
+ } from '../../src/common/index';
251
255
  import AppHeader from './AppHeader.astro';
252
- import SkeletonLoader from './SkeletonLoader.astro';
253
256
 
254
- interface Props extends IAppLayoutProps {}
257
+ interface Props extends IAppLayoutProps {
258
+ /** 是否启用 Astro ClientRouter */
259
+ enableClientRouter?: boolean;
260
+ }
255
261
 
256
262
  const {
257
263
  sidebarConfig,
258
264
  showHeader = true,
259
265
  showFooter = true,
260
266
  showSidebar = true,
261
- class: className,
262
- 'class:list': classList,
263
- debug = false,
264
267
  mainContentConfig,
265
268
  footerConfig,
266
269
  headerConfig,
267
270
  metaConfig,
268
271
  loadingDelay = 100,
269
- ...rest
272
+ bodyOnly = false,
273
+ theme,
274
+ enableClientRouter = true,
270
275
  }: Props = Astro.props;
271
276
 
272
- // 动态计算Container最小高度
273
- function getContainerMinHeightClass(headerHeight: string = 'md') {
274
- const heightValueMap = {
275
- '3xs': 'cosy:min-h-[calc(100vh-1rem)]',
276
- '2xs': 'cosy:min-h-[calc(100vh-1.5rem)]',
277
- xs: 'cosy:min-h-[calc(100vh-2rem)]',
278
- sm: 'cosy:min-h-[calc(100vh-2.5rem)]',
279
- md: 'cosy:min-h-[calc(100vh-3rem)]',
280
- lg: 'cosy:min-h-[calc(100vh-4rem)]',
281
- xl: 'cosy:min-h-[calc(100vh-5rem)]',
282
- };
283
- return (
284
- heightValueMap[headerHeight as keyof typeof heightValueMap] ||
285
- 'cosy:min-h-[calc(100vh-3rem)]'
286
- );
287
- }
288
-
289
277
  const containerMinHeightClass = getContainerMinHeightClass(
290
- headerConfig?.height
278
+ headerConfig?.height as HeaderHeight
291
279
  );
292
280
 
293
- // 计算Sidebar的top值和高度值
294
- function getSidebarTopClass(headerHeight: string = 'md') {
295
- const topMap = {
296
- '3xs': 'cosy:top-4',
297
- '2xs': 'cosy:top-6',
298
- xs: 'cosy:top-8',
299
- sm: 'cosy:top-10',
300
- md: 'cosy:top-12',
301
- lg: 'cosy:top-16',
302
- xl: 'cosy:top-20',
303
- };
304
- return topMap[headerHeight as keyof typeof topMap] || 'cosy:top-12';
305
- }
306
-
307
- function getSidebarHeightClass(headerHeight: string = 'md') {
308
- const heightValueMap = {
309
- '3xs': 'cosy:h-[calc(100vh-1rem)]',
310
- '2xs': 'cosy:h-[calc(100vh-1.5rem)]',
311
- xs: 'cosy:h-[calc(100vh-2rem)]',
312
- sm: 'cosy:h-[calc(100vh-2.5rem)]',
313
- md: 'cosy:h-[calc(100vh-3rem)]',
314
- lg: 'cosy:h-[calc(100vh-4rem)]',
315
- xl: 'cosy:h-[calc(100vh-5rem)]',
316
- };
317
- return (
318
- heightValueMap[headerHeight as keyof typeof heightValueMap] ||
319
- 'cosy:h-[calc(100vh-3rem)]'
320
- );
321
- }
322
-
323
- const sidebarTopClass = getSidebarTopClass(headerConfig?.height);
324
- const sidebarHeightClass = getSidebarHeightClass(headerConfig?.height);
281
+ const sidebarTopClass = getSidebarTopClass(
282
+ headerConfig?.height as HeaderHeight
283
+ );
284
+ const sidebarHeightClass = getSidebarHeightClass(
285
+ headerConfig?.height as HeaderHeight
286
+ );
325
287
  ---
326
288
 
327
- <BaseLayout {...metaConfig} debug={debug}>
289
+ <BaseLayout
290
+ {...metaConfig}
291
+ bodyOnly={bodyOnly}
292
+ theme={theme}
293
+ enableClientRouter={enableClientRouter}>
328
294
  {
329
295
  showHeader && (
330
296
  <AppHeader
331
297
  headerConfig={headerConfig}
332
- debug={debug}
333
298
  showSidebar={showSidebar}
334
299
  showSearch={Astro.slots.has('modal-search')}>
335
300
  <slot name="navbar-start" slot="navbar-start" />
@@ -360,13 +325,13 @@ const sidebarHeightClass = getSidebarHeightClass(headerConfig?.height);
360
325
 
361
326
  <!-- 主内容区域 -->
362
327
  <Main {...mainContentConfig} class="cosy:flex-1 cosy:min-w-xs">
363
- <SkeletonLoader
328
+ <Skeleton
364
329
  showLoading={true}
365
330
  loadingSize="xl"
366
331
  loadingDelay={loadingDelay}
367
332
  skeletonClass="cosy:w-full cosy:h-screen cosy:flex cosy:items-center cosy:justify-center">
368
333
  <slot />
369
- </SkeletonLoader>
334
+ </Skeleton>
370
335
  </Main>
371
336
  </Container>
372
337
 
@@ -3,5 +3,6 @@
3
3
  */
4
4
 
5
5
  import AppLayout from './AppLayout.astro';
6
+ import AppHeader from './AppHeader.astro';
6
7
 
7
- export { AppLayout };
8
+ export { AppLayout, AppHeader };