@coffic/cosy-ui 1.0.10 → 1.0.12

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 (35) hide show
  1. package/dist/app.css +1 -1
  2. package/dist/index-astro.ts +1 -0
  3. package/dist/index-vue.ts +1 -0
  4. package/dist/src/assets/iconData.js +3 -0
  5. package/dist/src/assets/icons-data/arrowDownS.d.ts +2 -0
  6. package/dist/src/assets/icons-data/arrowDownS.js +3 -0
  7. package/dist/src/assets/icons-data/arrowUpS.d.ts +2 -0
  8. package/dist/src/assets/icons-data/arrowUpS.js +3 -0
  9. package/dist/src/assets/icons-data/function.d.ts +2 -0
  10. package/dist/src/assets/icons-data/function.js +3 -0
  11. package/dist/src/assets/icons-data/index.d.ts +3 -0
  12. package/dist/src/assets/icons-data/index.js +3 -0
  13. package/dist/src-astro/card-course/CardCourse.astro +27 -12
  14. package/dist/src-astro/card-course/CardCourseContent.astro +3 -7
  15. package/dist/src-astro/icons/ArrowDownSIcon.astro +28 -0
  16. package/dist/src-astro/icons/ArrowUpSIcon.astro +28 -0
  17. package/dist/src-astro/icons/FunctionIcon.astro +28 -0
  18. package/dist/src-astro/icons/index.ts +3 -0
  19. package/dist/src-astro/mac-window/MacWindow.astro +7 -34
  20. package/dist/src-astro/math-formula/MathFormula.astro +463 -0
  21. package/dist/src-astro/math-formula/index.ts +3 -0
  22. package/dist/src-astro/math-formula/props.ts +11 -0
  23. package/dist/src-astro/math-formula/types.ts +46 -0
  24. package/dist/src-astro/products/ProductCard.astro +0 -4
  25. package/dist/src-astro/products/ProductHero.astro +0 -3
  26. package/dist/src-astro/products/ProductHeroContent.astro +0 -3
  27. package/dist/src-astro/products/ProductHeroImage.astro +0 -3
  28. package/dist/src-astro/products/Products.astro +0 -3
  29. package/dist/src-vue/card-course/CardCourse.vue +16 -5
  30. package/dist/src-vue/card-course/CardCourseContent.vue +2 -3
  31. package/dist/src-vue/math-formula/MathFormula.vue +198 -0
  32. package/dist/src-vue/math-formula/index.ts +2 -0
  33. package/dist/src-vue/math-formula/types.ts +18 -0
  34. package/package.json +1 -1
  35. /package/dist/{src-astro/products → src/styles}/product-card.css +0 -0
@@ -67,6 +67,7 @@ export * from "./src-astro/login";
67
67
  export * from "./src-astro/logout";
68
68
  export * from "./src-astro/mac-window";
69
69
  export * from "./src-astro/main";
70
+ export * from "./src-astro/math-formula";
70
71
  export * from "./src-astro/modal";
71
72
  export * from "./src-astro/module";
72
73
  export * from "./src-astro/nav-section";
package/dist/index-vue.ts CHANGED
@@ -25,6 +25,7 @@ export * from "./src-vue/link/index";
25
25
  export * from "./src-vue/list/index";
26
26
  export * from "./src-vue/login/index";
27
27
  export * from "./src-vue/mac-window/index";
28
+ export * from "./src-vue/math-formula";
28
29
  export * from "./src-vue/photo-wall/index";
29
30
  export * from "./src-vue/placeholder/index";
30
31
  export * from "./src-vue/products/index";
@@ -9,6 +9,8 @@ import * as icons from "./icons-data";
9
9
  export const iconData = {
10
10
  alertTriangle: icons.alertTriangle,
11
11
  appstore: icons.appstore,
12
+ arrowDownS: icons.arrowDownS,
13
+ arrowUpS: icons.arrowUpS,
12
14
  calendar: icons.calendar,
13
15
  chart: icons.chart,
14
16
  check: icons.check,
@@ -26,6 +28,7 @@ export const iconData = {
26
28
  edit: icons.edit,
27
29
  facebook: icons.facebook,
28
30
  folder: icons.folder,
31
+ function: icons.functionIcon,
29
32
  github: icons.github,
30
33
  globe: icons.globe,
31
34
  heart: icons.heart,
@@ -0,0 +1,2 @@
1
+ import type { IconData } from "../iconData";
2
+ export declare const arrowDownS: IconData;
@@ -0,0 +1,3 @@
1
+ export const arrowDownS = {
2
+ path: "M8 9l4 4 4-4",
3
+ };
@@ -0,0 +1,2 @@
1
+ import type { IconData } from "../iconData";
2
+ export declare const arrowUpS: IconData;
@@ -0,0 +1,3 @@
1
+ export const arrowUpS = {
2
+ path: "M16 15l-4-4-4 4",
3
+ };
@@ -0,0 +1,2 @@
1
+ import type { IconData } from "../iconData";
2
+ export declare const functionIcon: IconData;
@@ -0,0 +1,3 @@
1
+ export const functionIcon = {
2
+ path: "M4 4h6v6H4V4zm0 10h6v6H4v-6zm10 0h6v6h-6v-6zm0-10h6v6h-6V4z",
3
+ };
@@ -4,6 +4,8 @@
4
4
  */
5
5
  export { alertTriangle } from "./alertTriangle";
6
6
  export { appstore } from "./appstore";
7
+ export { arrowDownS } from "./arrowDownS";
8
+ export { arrowUpS } from "./arrowUpS";
7
9
  export { calendar } from "./calendar";
8
10
  export { chart } from "./chart";
9
11
  export { check } from "./check";
@@ -21,6 +23,7 @@ export { download } from "./download";
21
23
  export { edit } from "./edit";
22
24
  export { facebook } from "./facebook";
23
25
  export { folder } from "./folder";
26
+ export { functionIcon } from "./function";
24
27
  export { github } from "./github";
25
28
  export { globe } from "./globe";
26
29
  export { heart } from "./heart";
@@ -5,6 +5,8 @@
5
5
  // 导入所有图标数据
6
6
  export { alertTriangle } from "./alertTriangle";
7
7
  export { appstore } from "./appstore";
8
+ export { arrowDownS } from "./arrowDownS";
9
+ export { arrowUpS } from "./arrowUpS";
8
10
  export { calendar } from "./calendar";
9
11
  export { chart } from "./chart";
10
12
  export { check } from "./check";
@@ -22,6 +24,7 @@ export { download } from "./download";
22
24
  export { edit } from "./edit";
23
25
  export { facebook } from "./facebook";
24
26
  export { folder } from "./folder";
27
+ export { functionIcon } from "./function";
25
28
  export { github } from "./github";
26
29
  export { globe } from "./globe";
27
30
  export { heart } from "./heart";
@@ -31,7 +31,7 @@
31
31
  * - iconSize?: "sm" | "md" | "lg" | "xl" - 图标尺寸,默认为 "md"
32
32
  * - keywords?: string[] - 图标关键词数组,用于图标匹配
33
33
  * - lang: string - 语言("en" 或 "zh")
34
- * - scaleEffect?: boolean - 是否启用悬停缩放效果,默认为 true
34
+ * - scaleEffect?: 95 | 100 | 105 | 110 | 115 - 悬停缩放效果比例(100表示无缩放),默认为 105
35
35
  * - shadowEffect?: boolean | "none" | "sm" | "md" | "lg" | "xl" | "2xl" | "inner" - 阴影效果配置,默认为 "lg"
36
36
  *
37
37
  * @slots
@@ -69,8 +69,19 @@ function getShadowClasses(
69
69
  }
70
70
 
71
71
  // 获取缩放效果class
72
- function getScaleClasses(scaleEffect: boolean): string {
73
- return scaleEffect ? 'cosy:hover:scale-105' : '';
72
+ function getScaleClasses(scaleEffect: 95 | 100 | 105 | 110 | 115): string {
73
+ if (scaleEffect === 100) {
74
+ return '';
75
+ }
76
+
77
+ const scaleMap = {
78
+ 95: 'cosy:hover:scale-95',
79
+ 105: 'cosy:hover:scale-105',
80
+ 110: 'cosy:hover:scale-110',
81
+ 115: 'cosy:hover:scale-115',
82
+ };
83
+
84
+ return scaleMap[scaleEffect] || 'cosy:hover:scale-105';
74
85
  }
75
86
 
76
87
  import type { PaddingSize } from './types';
@@ -83,7 +94,7 @@ interface Props {
83
94
  iconSize?: 'sm' | 'md' | 'lg' | 'xl';
84
95
  keywords?: string[];
85
96
  lang: string;
86
- scaleEffect?: boolean;
97
+ scaleEffect?: 95 | 100 | 105 | 110 | 115;
87
98
  shadowEffect?:
88
99
  | boolean
89
100
  | 'none'
@@ -103,7 +114,7 @@ const {
103
114
  iconSize = 'md',
104
115
  keywords = [],
105
116
  lang,
106
- scaleEffect = true,
117
+ scaleEffect = 105,
107
118
  shadowEffect = 'lg',
108
119
  } = Astro.props;
109
120
 
@@ -146,13 +157,17 @@ const scaleClasses = getScaleClasses(scaleEffect);
146
157
  class={`cosy:card-body ${contentPaddingClasses} cosy:bg-base-100/30 cosy:relative cosy:z-10 cosy:h-full cosy:flex cosy:flex-row cosy:flex-nowrap cosy:items-center cosy:gap-6`}>
147
158
  <!-- 左侧:图标 -->
148
159
  <div class="cosy:shrink-0">
149
- <slot name="icon">
150
- <CardCourseIcon
151
- courseName={courseName}
152
- keywords={keywords}
153
- iconSizeClasses={iconSizeClasses}
154
- />
155
- </slot>
160
+ {
161
+ Astro.slots.has('icon') ? (
162
+ <slot name="icon" />
163
+ ) : (
164
+ <CardCourseIcon
165
+ courseName={courseName}
166
+ keywords={keywords}
167
+ iconSizeClasses={iconSizeClasses}
168
+ />
169
+ )
170
+ }
156
171
  </div>
157
172
 
158
173
  <!-- 右侧:内容和按钮 -->
@@ -22,11 +22,7 @@ const { displayName, description } = Astro.props;
22
22
  class="cosy:text-lg cosy:font-semibold cosy:truncate cosy:text-start cosy:transition-all cosy:duration-300 hover:cosy:scale-105 cosy:origin-left cosy:group-hover:cosy:animate-bounce">
23
23
  {displayName}
24
24
  </h3>
25
- {
26
- description && (
27
- <p class="cosy:text-sm cosy:mt-4 cosy:line-clamp-3 cosy:text-start cosy:transition-all cosy:duration-300 hover:cosy:opacity-80 cosy:transform hover:cosy:translate-x-1 cosy:group-hover:cosy:animate-pulse">
28
- {description}
29
- </p>
30
- )
31
- }
25
+ <p class="cosy:text-sm cosy:mt-4 cosy:line-clamp-2 cosy:text-start cosy:transition-all cosy:duration-300 hover:cosy:opacity-80 cosy:transform hover:cosy:translate-x-1 cosy:group-hover:cosy:animate-pulse cosy:min-h-10">
26
+ {description || ''}
27
+ </p>
32
28
  </div>
@@ -0,0 +1,28 @@
1
+ ---
2
+ import AstroIcon from './AstroIcon.astro';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const {
22
+ size = '24px',
23
+ color = 'currentColor',
24
+ class: className = '',
25
+ } = Astro.props;
26
+ ---
27
+
28
+ <AstroIcon name="arrowDownS" size={size} color={color} class={className} />
@@ -0,0 +1,28 @@
1
+ ---
2
+ import AstroIcon from './AstroIcon.astro';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const {
22
+ size = '24px',
23
+ color = 'currentColor',
24
+ class: className = '',
25
+ } = Astro.props;
26
+ ---
27
+
28
+ <AstroIcon name="arrowUpS" size={size} color={color} class={className} />
@@ -0,0 +1,28 @@
1
+ ---
2
+ import AstroIcon from './AstroIcon.astro';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const {
22
+ size = '24px',
23
+ color = 'currentColor',
24
+ class: className = '',
25
+ } = Astro.props;
26
+ ---
27
+
28
+ <AstroIcon name="function" size={size} color={color} class={className} />
@@ -3,6 +3,8 @@
3
3
  export { default as SmartIcon } from "../smart-icon/SmartIcon.astro";
4
4
  export { default as AlertTriangle } from "./AlertTriangle.astro";
5
5
  export { default as AppStoreIcon } from "./AppStoreIcon.astro";
6
+ export { default as ArrowDownSIcon } from "./ArrowDownSIcon.astro";
7
+ export { default as ArrowUpSIcon } from "./ArrowUpSIcon.astro";
6
8
  export { default as CalendarIcon } from "./CalendarIcon.astro";
7
9
  export { default as ChartIcon } from "./ChartIcon.astro";
8
10
  export { default as CheckCircle } from "./CheckCircle.astro";
@@ -21,6 +23,7 @@ export { default as EditIcon } from "./EditIcon.astro";
21
23
  export { default as ErrorIcon } from "./ErrorIcon.astro";
22
24
  export { default as FacebookIcon } from "./FacebookIcon.astro";
23
25
  export { default as FolderIcon } from "./FolderIcon.astro";
26
+ export { default as FunctionIcon } from "./FunctionIcon.astro";
24
27
  export { default as GithubIcon } from "./GithubIcon.astro";
25
28
  export { default as GlobeIcon } from "./GlobeIcon.astro";
26
29
  export { default as HeartIcon } from "./HeartIcon.astro";
@@ -1,7 +1,4 @@
1
1
  ---
2
-
3
-
4
-
5
2
  /**
6
3
  * @component MacWindow
7
4
  *
@@ -127,11 +124,10 @@ const headerClass = cn()
127
124
  .left(0)
128
125
  .right(0)
129
126
  .flex()
127
+ .roundedTop('2xl')
130
128
  .items('center')
131
129
  .h(12)
132
130
  .px(4)
133
- .border()
134
- .borderColor('base-300')
135
131
  .add(headerBgClass) // 保留:动态类名
136
132
  .build();
137
133
 
@@ -144,18 +140,9 @@ const buttonClass = cn()
144
140
  .transition('opacity')
145
141
  .build();
146
142
 
147
- const titleClass = cn()
148
- .ml(6)
149
- .text('sm')
150
- .medium()
151
- .color('base-content')
152
- .build();
143
+ const titleClass = cn().ml(6).text('sm').medium().color('base-content').build();
153
144
 
154
- const tabsContainerClass = cn()
155
- .flex1()
156
- .flex()
157
- .justify('center')
158
- .build();
145
+ const tabsContainerClass = cn().flex1().flex().justify('center').build();
159
146
 
160
147
  const tabsWrapperClass = cn()
161
148
  .add('cosy:inline-flex') // 保留:inline-flex 暂不支持
@@ -183,19 +170,9 @@ const getTabButtonClass = (isActive: boolean) =>
183
170
  )
184
171
  .build();
185
172
 
186
- const toolbarClass = cn()
187
- .ml('auto')
188
- .flex()
189
- .items('center')
190
- .spaceX(2)
191
- .build();
173
+ const toolbarClass = cn().ml('auto').flex().items('center').spaceX(2).build();
192
174
 
193
- const mainContentClass = cn()
194
- .flex1()
195
- .flex('col')
196
- .pt(12)
197
- .h('full')
198
- .build();
175
+ const mainContentClass = cn().flex1().flex('col').pt(12).h('full').build();
199
176
 
200
177
  const contentWrapperClass = cn()
201
178
  .flex()
@@ -216,11 +193,7 @@ const statusBarClass = cn()
216
193
  .add(statusBgClass) // 保留:动态类名
217
194
  .build();
218
195
 
219
- const statusContentClass = cn()
220
- .flex()
221
- .items('center')
222
- .spaceX(2)
223
- .build();
196
+ const statusContentClass = cn().flex().items('center').spaceX(2).build();
224
197
  ---
225
198
 
226
199
  <Container
@@ -232,7 +205,7 @@ const statusContentClass = cn()
232
205
  class={containerClass}
233
206
  data-window-id={windowId}>
234
207
  <!-- 窗口控制按钮 -->
235
- <div class={headerClass}>
208
+ <div class={headerClass} aria-label="MacWindow-Header">
236
209
  <div class="cosy:flex cosy:items-center cosy:space-x-2">
237
210
  <div
238
211
  class={cn().add(buttonClass).bg('error').build()}