@coffic/cosy-ui 0.8.10 → 0.8.11
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/src-astro/alert/index.ts +7 -15
- package/dist/src-astro/assets/iconData.ts +100 -0
- package/dist/src-astro/button/index_astro.ts +2 -56
- package/dist/src-astro/card/CardCourse.astro +31 -11
- package/dist/src-astro/card/index.ts +15 -25
- package/dist/src-astro/code-container/CodeContainer.astro +205 -5
- package/dist/src-astro/code-container/index.ts +9 -13
- package/dist/src-astro/contact/index.ts +16 -20
- package/dist/src-astro/errors/index.ts +0 -62
- package/dist/src-astro/footer/index.ts +1 -30
- package/dist/src-astro/header/Header.astro +1 -2
- package/dist/src-astro/header/index.ts +1 -40
- package/dist/src-astro/hero/index.ts +1 -39
- package/dist/src-astro/icons/ChartIcon.astro +28 -0
- package/dist/src-astro/icons/DashboardIcon.astro +28 -0
- package/dist/src-astro/icons/DeleteIcon.astro +28 -0
- package/dist/src-astro/icons/DocumentIcon.astro +28 -0
- package/dist/src-astro/icons/DownloadIcon.astro +28 -0
- package/dist/src-astro/icons/EditIcon.astro +28 -0
- package/dist/src-astro/icons/FolderIcon.astro +28 -0
- package/dist/src-astro/icons/HeartIcon.astro +28 -0
- package/dist/src-astro/icons/HomeIcon.astro +28 -0
- package/dist/src-astro/icons/MailIcon.astro +28 -0
- package/dist/src-astro/icons/MessageIcon.astro +28 -0
- package/dist/src-astro/icons/NotificationIcon.astro +28 -0
- package/dist/src-astro/icons/ReportIcon.astro +28 -0
- package/dist/src-astro/icons/SaveIcon.astro +28 -0
- package/dist/src-astro/icons/SecurityIcon.astro +28 -0
- package/dist/src-astro/icons/StarIcon.astro +28 -0
- package/dist/src-astro/icons/ToolsIcon.astro +28 -0
- package/dist/src-astro/icons/UploadIcon.astro +28 -0
- package/dist/src-astro/icons/UsersIcon.astro +28 -0
- package/dist/src-astro/icons/WalletIcon.astro +28 -0
- package/dist/src-astro/icons/index.ts +20 -0
- package/dist/src-astro/layout-app/index.ts +5 -9
- package/dist/src-astro/layout-dashboard/DashboardLayout.astro +101 -555
- package/dist/src-astro/layout-dashboard/DashboardSidebar.astro +206 -0
- package/dist/src-astro/layout-dashboard/DashboardTopNavbar.astro +132 -0
- package/dist/src-astro/layout-dashboard/index.ts +14 -8
- package/dist/src-astro/layout-dashboard/tools.ts +0 -0
- package/dist/src-astro/layout-dashboard/types.ts +313 -0
- package/package.json +1 -1
- package/dist/src-astro/alert/EAlertBasic.astro +0 -11
- package/dist/src-astro/alert/EAlertBasicContainer.astro +0 -11
- package/dist/src-astro/alert/EAlertCustomStyle.astro +0 -16
- package/dist/src-astro/alert/EAlertCustomStyleContainer.astro +0 -11
- package/dist/src-astro/alert/EAlertError.astro +0 -6
- package/dist/src-astro/alert/EAlertInfo.astro +0 -6
- package/dist/src-astro/alert/EAlertSuccess.astro +0 -6
- package/dist/src-astro/alert/EAlertTypesContainer.astro +0 -43
- package/dist/src-astro/alert/EAlertWarning.astro +0 -6
- package/dist/src-astro/alert/EAlertWithTitle.astro +0 -12
- package/dist/src-astro/alert/EAlertWithTitleContainer.astro +0 -11
- package/dist/src-astro/button/ButtonBasic.astro +0 -18
- package/dist/src-astro/button/ButtonBasicContainer.astro +0 -11
- package/dist/src-astro/button/ButtonBlock.astro +0 -5
- package/dist/src-astro/button/ButtonError.astro +0 -5
- package/dist/src-astro/button/ButtonGhost.astro +0 -5
- package/dist/src-astro/button/ButtonIconBoth.astro +0 -9
- package/dist/src-astro/button/ButtonIconLeft.astro +0 -8
- package/dist/src-astro/button/ButtonIconRight.astro +0 -8
- package/dist/src-astro/button/ButtonInfo.astro +0 -5
- package/dist/src-astro/button/ButtonLinkContainer.astro +0 -19
- package/dist/src-astro/button/ButtonNeutral.astro +0 -5
- package/dist/src-astro/button/ButtonOutline.astro +0 -5
- package/dist/src-astro/button/ButtonShapeCircle.astro +0 -5
- package/dist/src-astro/button/ButtonShapeDefault.astro +0 -5
- package/dist/src-astro/button/ButtonShapeSquare.astro +0 -5
- package/dist/src-astro/button/ButtonShapes.astro +0 -23
- package/dist/src-astro/button/ButtonShapesContainer.astro +0 -29
- package/dist/src-astro/button/ButtonSizes.astro +0 -15
- package/dist/src-astro/button/ButtonSizesContainer.astro +0 -11
- package/dist/src-astro/button/ButtonStates.astro +0 -12
- package/dist/src-astro/button/ButtonStatesContainer.astro +0 -11
- package/dist/src-astro/button/ButtonSuccess.astro +0 -5
- package/dist/src-astro/button/ButtonVariantsContainer.astro +0 -73
- package/dist/src-astro/button/ButtonWarning.astro +0 -5
- package/dist/src-astro/button/ButtonWide.astro +0 -5
- package/dist/src-astro/button/ButtonWidth.astro +0 -8
- package/dist/src-astro/button/ButtonWidthContainer.astro +0 -19
- package/dist/src-astro/button/ButtonWithIcons.astro +0 -25
- package/dist/src-astro/button/ButtonWithIconsContainer.astro +0 -29
- package/dist/src-astro/card/CardBasic.astro +0 -5
- package/dist/src-astro/card/ECardBasic.astro +0 -13
- package/dist/src-astro/card/ECardBasicContainer.astro +0 -11
- package/dist/src-astro/card/ECardClickable.astro +0 -16
- package/dist/src-astro/card/ECardClickableContainer.astro +0 -11
- package/dist/src-astro/card/ECardCompact.astro +0 -13
- package/dist/src-astro/card/ECardCompactContainer.astro +0 -11
- package/dist/src-astro/card/ECardCustomStyle.astro +0 -17
- package/dist/src-astro/card/ECardCustomStyleContainer.astro +0 -11
- package/dist/src-astro/card/ECardWithImage.astro +0 -16
- package/dist/src-astro/card/ECardWithImageContainer.astro +0 -11
- package/dist/src-astro/card/ECardWithSubtitle.astro +0 -13
- package/dist/src-astro/card/ECardWithSubtitleContainer.astro +0 -11
- package/dist/src-astro/code-container/ECodeContainerBasic.astro +0 -19
- package/dist/src-astro/code-container/ECodeContainerMultiple.astro +0 -49
- package/dist/src-astro/contact/EContactBasic.astro +0 -15
- package/dist/src-astro/contact/EContactBasicContainer.astro +0 -11
- package/dist/src-astro/contact/EContactCompact.astro +0 -11
- package/dist/src-astro/contact/EContactCompactContainer.astro +0 -11
- package/dist/src-astro/contact/EContactCustomStyle.astro +0 -21
- package/dist/src-astro/contact/EContactCustomStyleContainer.astro +0 -11
- package/dist/src-astro/contact/EContactSocial.astro +0 -20
- package/dist/src-astro/contact/EContactSocialContainer.astro +0 -11
- package/dist/src-astro/contact/EContactWithTitle.astro +0 -17
- package/dist/src-astro/contact/EContactWithTitleContainer.astro +0 -11
- package/dist/src-astro/errors/E403Basic.astro +0 -11
- package/dist/src-astro/errors/E403BasicContainer.astro +0 -20
- package/dist/src-astro/errors/E404Basic.astro +0 -11
- package/dist/src-astro/errors/E404BasicContainer.astro +0 -20
- package/dist/src-astro/errors/E404WithDebug.astro +0 -18
- package/dist/src-astro/errors/E500Basic.astro +0 -11
- package/dist/src-astro/errors/E500BasicContainer.astro +0 -20
- package/dist/src-astro/errors/E503Maintenance.astro +0 -20
- package/dist/src-astro/errors/E503MaintenanceContainer.astro +0 -21
- package/dist/src-astro/errors/EErrorPageCustomStyle.astro +0 -21
- package/dist/src-astro/errors/EErrorPageCustomStyleContainer.astro +0 -21
- package/dist/src-astro/errors/EErrorPageShowcase.astro +0 -68
- package/dist/src-astro/errors/EErrorPageShowcaseContainer.astro +0 -21
- package/dist/src-astro/footer/EFooterBasic.astro +0 -18
- package/dist/src-astro/footer/EFooterBasicContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterComplete.astro +0 -50
- package/dist/src-astro/footer/EFooterCompleteContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterFeaturesContainer.astro +0 -40
- package/dist/src-astro/footer/EFooterWithLogo.astro +0 -28
- package/dist/src-astro/footer/EFooterWithLogoContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterWithNavigation.astro +0 -24
- package/dist/src-astro/footer/EFooterWithNavigationContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterWithProducts.astro +0 -24
- package/dist/src-astro/footer/EFooterWithProductsContainer.astro +0 -11
- package/dist/src-astro/footer/EFooterWithSocial.astro +0 -24
- package/dist/src-astro/footer/EFooterWithSocialContainer.astro +0 -11
- package/dist/src-astro/header/HeaderBasic.astro +0 -19
- package/dist/src-astro/header/HeaderCustomNavbarCenter.astro +0 -28
- package/dist/src-astro/header/HeaderCustomNavbarEnd.astro +0 -25
- package/dist/src-astro/header/HeaderCustomNavbarStart.astro +0 -27
- package/dist/src-astro/header/HeaderCustomPosition.astro +0 -34
- package/dist/src-astro/header/HeaderWithNavigation.astro +0 -27
- package/dist/src-astro/hero/EHeroAlignCenter.astro +0 -13
- package/dist/src-astro/hero/EHeroAlignContainer.astro +0 -27
- package/dist/src-astro/hero/EHeroAlignLeft.astro +0 -13
- package/dist/src-astro/hero/EHeroAlignRight.astro +0 -13
- package/dist/src-astro/hero/EHeroBackgroundContainer.astro +0 -18
- package/dist/src-astro/hero/EHeroBackgroundImage.astro +0 -16
- package/dist/src-astro/hero/EHeroBackgroundImageContainer.astro +0 -11
- package/dist/src-astro/hero/EHeroBasic.astro +0 -12
- package/dist/src-astro/hero/EHeroBasicContainer.astro +0 -11
- package/dist/src-astro/hero/EHeroGradientBackground.astro +0 -10
- package/dist/src-astro/hero/EHeroPlainBackground.astro +0 -10
- package/dist/src-astro/hero/EHeroWithButton.astro +0 -14
- package/dist/src-astro/hero/EHeroWithButtonContainer.astro +0 -11
- package/dist/src-astro/hero/EHeroWithImage.astro +0 -16
- package/dist/src-astro/hero/EHeroWithImageContainer.astro +0 -11
- package/dist/src-astro/layout-app/AppLayoutBasic.astro +0 -54
- package/dist/src-astro/layout-dashboard/DashboardLayoutBasic.astro +0 -51
@@ -1,16 +1,8 @@
|
|
1
|
-
|
2
|
-
import AlertBasicContainer from './EAlertBasicContainer.astro';
|
3
|
-
import AlertWithTitleContainer from './EAlertWithTitleContainer.astro';
|
4
|
-
import AlertTypesContainer from './EAlertTypesContainer.astro';
|
5
|
-
import AlertCustomStyleContainer from './EAlertCustomStyleContainer.astro';
|
1
|
+
export { default as Alert } from './Alert.astro';
|
6
2
|
|
7
|
-
|
8
|
-
export
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Types: AlertTypesContainer,
|
14
|
-
CustomStyle: AlertCustomStyleContainer,
|
15
|
-
},
|
16
|
-
};
|
3
|
+
// Export types
|
4
|
+
export interface AlertProps {
|
5
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
6
|
+
title?: string;
|
7
|
+
class?: string;
|
8
|
+
}
|
@@ -119,4 +119,104 @@ export const iconData: Record<string, IconData> = {
|
|
119
119
|
refresh: {
|
120
120
|
path: 'M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15',
|
121
121
|
},
|
122
|
+
|
123
|
+
// 主页图标
|
124
|
+
home: {
|
125
|
+
path: 'M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6',
|
126
|
+
},
|
127
|
+
|
128
|
+
// 仪表盘图标
|
129
|
+
dashboard: {
|
130
|
+
path: 'M3 13a8 8 0 018-8 8 8 0 018 8m0 0a8 8 0 11-16 0m8-2.5a2.5 2.5 0 100 5 2.5 2.5 0 000-5z',
|
131
|
+
},
|
132
|
+
|
133
|
+
// 图表图标
|
134
|
+
chart: {
|
135
|
+
path: 'M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z',
|
136
|
+
},
|
137
|
+
|
138
|
+
// 文档图标
|
139
|
+
document: {
|
140
|
+
path: 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z',
|
141
|
+
},
|
142
|
+
|
143
|
+
// 通知图标
|
144
|
+
notification: {
|
145
|
+
path: 'M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9',
|
146
|
+
},
|
147
|
+
|
148
|
+
// 用户组图标
|
149
|
+
users: {
|
150
|
+
path: 'M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m0 0a4 4 0 017 0M13 7a4 4 0 11-8 0 4 4 0 018 0z',
|
151
|
+
},
|
152
|
+
|
153
|
+
// 消息图标
|
154
|
+
message: {
|
155
|
+
path: 'M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z',
|
156
|
+
},
|
157
|
+
|
158
|
+
// 邮件图标
|
159
|
+
mail: {
|
160
|
+
path: 'M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z',
|
161
|
+
},
|
162
|
+
|
163
|
+
// 文件夹图标
|
164
|
+
folder: {
|
165
|
+
path: 'M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z',
|
166
|
+
},
|
167
|
+
|
168
|
+
// 星形图标
|
169
|
+
star: {
|
170
|
+
path: 'M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z',
|
171
|
+
},
|
172
|
+
|
173
|
+
// 心形图标
|
174
|
+
heart: {
|
175
|
+
path: 'M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z',
|
176
|
+
},
|
177
|
+
|
178
|
+
// 保存图标
|
179
|
+
save: {
|
180
|
+
path: 'M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4',
|
181
|
+
},
|
182
|
+
|
183
|
+
// 编辑图标
|
184
|
+
edit: {
|
185
|
+
path: 'M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7m-1.5-9.5a2.121 2.121 0 113 3L12 15l-4 1 1-4 9.5-9.5z',
|
186
|
+
},
|
187
|
+
|
188
|
+
// 删除图标
|
189
|
+
delete: {
|
190
|
+
path: 'M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16',
|
191
|
+
},
|
192
|
+
|
193
|
+
// 工具图标
|
194
|
+
tools: {
|
195
|
+
path: 'M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z M15 12a3 3 0 11-6 0 3 3 0 016 0z',
|
196
|
+
},
|
197
|
+
|
198
|
+
// 钱包图标
|
199
|
+
wallet: {
|
200
|
+
path: 'M17 9V7a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2m2 4h10a2 2 0 002-2v-6a2 2 0 00-2-2H9a2 2 0 00-2 2v6a2 2 0 002 2zm7-5a2 2 0 11-4 0 2 2 0 014 0z',
|
201
|
+
},
|
202
|
+
|
203
|
+
// 报告图标
|
204
|
+
report: {
|
205
|
+
path: 'M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z',
|
206
|
+
},
|
207
|
+
|
208
|
+
// 安全图标
|
209
|
+
security: {
|
210
|
+
path: 'M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z',
|
211
|
+
},
|
212
|
+
|
213
|
+
// 上传图标
|
214
|
+
upload: {
|
215
|
+
path: 'M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12',
|
216
|
+
},
|
217
|
+
|
218
|
+
// 下载图标
|
219
|
+
download: {
|
220
|
+
path: 'M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M9 11l3 3m0 0l3-3m-3 3V4',
|
221
|
+
},
|
122
222
|
};
|
@@ -1,60 +1,6 @@
|
|
1
1
|
import Button from './Button.astro';
|
2
|
-
import
|
3
|
-
import ButtonShapesContainer from './ButtonShapesContainer.astro';
|
4
|
-
import ButtonSizesContainer from './ButtonSizesContainer.astro';
|
5
|
-
import ButtonStatesContainer from './ButtonStatesContainer.astro';
|
6
|
-
import ButtonWithIconsContainer from './ButtonWithIconsContainer.astro';
|
7
|
-
import ButtonWidthContainer from './ButtonWidthContainer.astro';
|
8
|
-
import ButtonVariantsContainer from './ButtonVariantsContainer.astro';
|
9
|
-
import ButtonLinkContainer from './ButtonLinkContainer.astro';
|
10
|
-
import ButtonWide from './ButtonWide.astro';
|
11
|
-
import ButtonBlock from './ButtonBlock.astro';
|
12
|
-
import ButtonIconLeft from './ButtonIconLeft.astro';
|
13
|
-
import ButtonIconRight from './ButtonIconRight.astro';
|
14
|
-
import ButtonIconBoth from './ButtonIconBoth.astro';
|
15
|
-
import ButtonShapeCircle from './ButtonShapeCircle.astro';
|
16
|
-
import ButtonShapeSquare from './ButtonShapeSquare.astro';
|
17
|
-
import ButtonShapeDefault from './ButtonShapeDefault.astro';
|
18
|
-
import ButtonInfo from './ButtonInfo.astro';
|
19
|
-
import ButtonSuccess from './ButtonSuccess.astro';
|
20
|
-
import ButtonWarning from './ButtonWarning.astro';
|
21
|
-
import ButtonError from './ButtonError.astro';
|
22
|
-
import ButtonGhost from './ButtonGhost.astro';
|
2
|
+
import ButtonVariants from './ButtonVariants.astro';
|
23
3
|
import ButtonLink from './ButtonLink.astro';
|
24
4
|
import ButtonLinkExternal from './ButtonLinkExternal.astro';
|
25
|
-
import ButtonOutline from './ButtonOutline.astro';
|
26
|
-
import ButtonNeutral from './ButtonNeutral.astro';
|
27
5
|
|
28
|
-
export { Button };
|
29
|
-
|
30
|
-
export const ButtonPackage = {
|
31
|
-
Button,
|
32
|
-
ButtonWide,
|
33
|
-
ButtonBlock,
|
34
|
-
ButtonIconLeft,
|
35
|
-
ButtonIconRight,
|
36
|
-
ButtonIconBoth,
|
37
|
-
ButtonShapeCircle,
|
38
|
-
ButtonShapeSquare,
|
39
|
-
ButtonShapeDefault,
|
40
|
-
ButtonInfo,
|
41
|
-
ButtonSuccess,
|
42
|
-
ButtonWarning,
|
43
|
-
ButtonError,
|
44
|
-
ButtonGhost,
|
45
|
-
ButtonLink,
|
46
|
-
ButtonLinkExternal,
|
47
|
-
ButtonOutline,
|
48
|
-
ButtonNeutral,
|
49
|
-
|
50
|
-
ButtonContainers: {
|
51
|
-
Basic: ButtonBasicContainer,
|
52
|
-
Shapes: ButtonShapesContainer,
|
53
|
-
Sizes: ButtonSizesContainer,
|
54
|
-
States: ButtonStatesContainer,
|
55
|
-
WithIcons: ButtonWithIconsContainer,
|
56
|
-
Width: ButtonWidthContainer,
|
57
|
-
Variants: ButtonVariantsContainer,
|
58
|
-
Link: ButtonLinkContainer,
|
59
|
-
},
|
60
|
-
};
|
6
|
+
export { Button, ButtonVariants, ButtonLink, ButtonLinkExternal };
|
@@ -1,6 +1,22 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
|
2
|
+
/**
|
3
|
+
* @component CardCourse
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 课程卡片组件,用于展示课程信息,具有统一的设计风格。
|
7
|
+
*
|
8
|
+
* @usage
|
9
|
+
* ```astro
|
10
|
+
* <CardCourse title="React 基础教程" link="/courses/react-basics" />
|
11
|
+
* ```
|
12
|
+
*
|
13
|
+
* @props
|
14
|
+
* - title: string - 课程标题
|
15
|
+
* - link: string - 课程链接
|
16
|
+
*/
|
17
|
+
|
18
|
+
// 导入样式
|
19
|
+
import '../../style.ts';
|
4
20
|
|
5
21
|
interface Props {
|
6
22
|
title: string;
|
@@ -11,18 +27,22 @@ const { title, link } = Astro.props;
|
|
11
27
|
---
|
12
28
|
|
13
29
|
<div>
|
14
|
-
<a
|
15
|
-
|
30
|
+
<a
|
31
|
+
href={link}
|
32
|
+
class="cosy:justify-center cosy:flex cosy:no-underline cosy:text-base-content">
|
33
|
+
<div class="cosy:w-56 cosy:h-80">
|
16
34
|
<div
|
17
|
-
class="bg-gradient-to-br w-full h-full from-accent/50 to-primary/30 rounded-3xl shadow-lg backdrop-blur-sm"
|
18
|
-
>
|
35
|
+
class="cosy:bg-gradient-to-br cosy:w-full cosy:h-full cosy:from-accent/50 cosy:to-primary/30 cosy:rounded-3xl cosy:shadow-lg cosy:backdrop-blur-sm">
|
19
36
|
<div
|
20
|
-
class="bg-base-100/60 w-full h-full rounded-3xl border border-base-content/30 hover:scale-105 hover:shadow-2xl transform duration-200 backdrop-filter backdrop-blur-sm"
|
21
|
-
|
22
|
-
|
23
|
-
<
|
37
|
+
class="cosy:bg-base-100/60 cosy:w-full cosy:h-full cosy:rounded-3xl cosy:border cosy:border-base-content/30 hover:cosy:scale-105 hover:cosy:shadow-2xl cosy:transform cosy:duration-200 cosy:backdrop-filter cosy:backdrop-blur-sm">
|
38
|
+
<div class="card-body cosy:p-1 cosy:h-full">
|
39
|
+
<!-- 使用书本图标代替图片 -->
|
40
|
+
<div
|
41
|
+
class="cosy:h-3/5 cosy:w-full cosy:flex cosy:items-center cosy:justify-center cosy:text-6xl cosy:text-primary">
|
42
|
+
📚
|
43
|
+
</div>
|
24
44
|
<div>
|
25
|
-
<h2 class="text-lg text-center font-medium">
|
45
|
+
<h2 class="cosy:text-lg cosy:text-center cosy:font-medium">
|
26
46
|
{title}
|
27
47
|
</h2>
|
28
48
|
</div>
|
@@ -1,27 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
import CardBasic from './CardBasic.astro';
|
1
|
+
export { default as Card } from './Card.astro';
|
2
|
+
export { default as CardCourse } from './CardCourse.astro';
|
4
3
|
|
5
|
-
//
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
// Export types
|
5
|
+
export interface CardProps {
|
6
|
+
title: string;
|
7
|
+
subtitle?: string;
|
8
|
+
imageUrl?: string;
|
9
|
+
href?: string;
|
10
|
+
compact?: boolean;
|
11
|
+
class?: string;
|
12
|
+
}
|
12
13
|
|
13
|
-
export
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
export const CardPackage = {
|
18
|
-
Card,
|
19
|
-
CardContainers: {
|
20
|
-
Basic: CardBasicContainer,
|
21
|
-
WithSubtitle: CardWithSubtitleContainer,
|
22
|
-
WithImage: CardWithImageContainer,
|
23
|
-
Clickable: CardClickableContainer,
|
24
|
-
Compact: CardCompactContainer,
|
25
|
-
CustomStyle: CardCustomStyleContainer,
|
26
|
-
},
|
27
|
-
};
|
14
|
+
export interface CardCourseProps {
|
15
|
+
title: string;
|
16
|
+
link: string;
|
17
|
+
}
|
@@ -3,12 +3,21 @@
|
|
3
3
|
* @component CodeContainer
|
4
4
|
*
|
5
5
|
* @description
|
6
|
-
*
|
7
|
-
*
|
6
|
+
* 用于展示代码示例的容器组件,提供样式隔离功能防止内外样式相互影响。
|
7
|
+
* 支持两种隔离模式:样式重置模式和iframe完全隔离模式。
|
8
|
+
* 使用时只需在默认slot中传入内容,并为每个示例设置对应的id (tab-1, tab-2等)
|
9
|
+
*
|
10
|
+
* @features
|
11
|
+
* - 样式隔离:防止外部样式影响内部组件展示
|
12
|
+
* - 样式重置:重置内部样式,避免样式冲突
|
13
|
+
* - iframe模式:完全隔离的预览环境
|
14
|
+
* - 代码预览切换:支持预览和代码视图切换
|
15
|
+
* - 多标签页:支持多个示例的标签页展示
|
8
16
|
*
|
9
17
|
* @example
|
10
18
|
* ```astro
|
11
|
-
*
|
19
|
+
* <!-- 基础用法 -->
|
20
|
+
* <CodeContainer codes={[code1, code2]}>
|
12
21
|
* <div id="tab-1">
|
13
22
|
* <Alert type="info">这是第一个示例</Alert>
|
14
23
|
* </div>
|
@@ -16,6 +25,20 @@
|
|
16
25
|
* <Alert type="success">这是第二个示例</Alert>
|
17
26
|
* </div>
|
18
27
|
* </CodeContainer>
|
28
|
+
*
|
29
|
+
* <!-- 使用iframe完全隔离 -->
|
30
|
+
* <CodeContainer codes={[code]} useIframe={true}>
|
31
|
+
* <div id="tab-1">
|
32
|
+
* <SomeComponent />
|
33
|
+
* </div>
|
34
|
+
* </CodeContainer>
|
35
|
+
*
|
36
|
+
* <!-- 禁用样式重置 -->
|
37
|
+
* <CodeContainer codes={[code]} resetStyles={false}>
|
38
|
+
* <div id="tab-1">
|
39
|
+
* <CustomComponent />
|
40
|
+
* </div>
|
41
|
+
* </CodeContainer>
|
19
42
|
* ```
|
20
43
|
*/
|
21
44
|
|
@@ -35,9 +58,25 @@ interface Props {
|
|
35
58
|
* 每个示例对应的源代码
|
36
59
|
*/
|
37
60
|
codes: string[];
|
61
|
+
/**
|
62
|
+
* 是否使用iframe隔离内容
|
63
|
+
* @default false
|
64
|
+
*/
|
65
|
+
useIframe?: boolean;
|
66
|
+
/**
|
67
|
+
* 是否重置内部样式
|
68
|
+
* @default true
|
69
|
+
*/
|
70
|
+
resetStyles?: boolean;
|
38
71
|
}
|
39
72
|
|
40
|
-
const {
|
73
|
+
const {
|
74
|
+
titles = [],
|
75
|
+
descriptions = [],
|
76
|
+
codes,
|
77
|
+
useIframe = false,
|
78
|
+
resetStyles = true,
|
79
|
+
} = Astro.props;
|
41
80
|
---
|
42
81
|
|
43
82
|
<div data-role="code-container" class="cosy:mb-8 cosy:card" ignore-heading>
|
@@ -93,7 +132,22 @@ const { titles = [], descriptions = [], codes } = Astro.props;
|
|
93
132
|
|
94
133
|
<div class="cosy:relative cosy:p-4 cosy:bg-gradient-to-br cosy:from-red-100 cosy:to-green-300 cosy:rounded-b">
|
95
134
|
<div class="cosy:block cosy:code-example-panel" data-panel="preview">
|
96
|
-
|
135
|
+
{useIframe ? (
|
136
|
+
<div class="cosy:w-full cosy:min-h-64 cosy:bg-white cosy:rounded cosy:border">
|
137
|
+
<iframe
|
138
|
+
class="cosy:w-full cosy:min-h-64 cosy:border-none cosy:rounded"
|
139
|
+
data-preview-frame={`tab-${index + 1}`}
|
140
|
+
sandbox="allow-scripts allow-same-origin"
|
141
|
+
title={`示例预览 ${index + 1}`}
|
142
|
+
/>
|
143
|
+
</div>
|
144
|
+
) : (
|
145
|
+
<div
|
146
|
+
class={`cosy:code-preview-area ${resetStyles ? 'cosy:reset-styles' : ''}`}
|
147
|
+
data-preview-area={`tab-${index + 1}`}>
|
148
|
+
<slot />
|
149
|
+
</div>
|
150
|
+
)}
|
97
151
|
</div>
|
98
152
|
|
99
153
|
<div class="cosy:hidden cosy:code-example-panel" data-panel="code">
|
@@ -107,10 +161,156 @@ const { titles = [], descriptions = [], codes } = Astro.props;
|
|
107
161
|
}
|
108
162
|
</div>
|
109
163
|
|
164
|
+
<!-- 样式隔离和重置 -->
|
165
|
+
<style>
|
166
|
+
/* 预览区域样式重置,防止外部样式影响内部组件 */
|
167
|
+
[data-role='code-container'] .cosy\:reset-styles {
|
168
|
+
/* 重置所有可能影响布局的样式 */
|
169
|
+
all: initial;
|
170
|
+
font-family: inherit;
|
171
|
+
color: inherit;
|
172
|
+
line-height: 1.5;
|
173
|
+
|
174
|
+
/* 恢复必要的基础样式 */
|
175
|
+
display: block;
|
176
|
+
box-sizing: border-box;
|
177
|
+
|
178
|
+
/* 隔离样式作用域 */
|
179
|
+
isolation: isolate;
|
180
|
+
contain: layout style;
|
181
|
+
}
|
182
|
+
|
183
|
+
/* 重置内部所有元素的样式 */
|
184
|
+
[data-role='code-container'] .cosy\:reset-styles * {
|
185
|
+
all: unset;
|
186
|
+
display: revert;
|
187
|
+
box-sizing: border-box;
|
188
|
+
}
|
189
|
+
|
190
|
+
/* 恢复必要的文本样式 */
|
191
|
+
[data-role='code-container'] .cosy\:reset-styles {
|
192
|
+
font-family:
|
193
|
+
system-ui,
|
194
|
+
-apple-system,
|
195
|
+
BlinkMacSystemFont,
|
196
|
+
'Segoe UI',
|
197
|
+
Roboto,
|
198
|
+
'Helvetica Neue',
|
199
|
+
Arial,
|
200
|
+
sans-serif;
|
201
|
+
font-size: 14px;
|
202
|
+
line-height: 1.5;
|
203
|
+
color: #374151;
|
204
|
+
}
|
205
|
+
|
206
|
+
/* 恢复基本的HTML元素样式 */
|
207
|
+
[data-role='code-container'] .cosy\:reset-styles h1,
|
208
|
+
[data-role='code-container'] .cosy\:reset-styles h2,
|
209
|
+
[data-role='code-container'] .cosy\:reset-styles h3,
|
210
|
+
[data-role='code-container'] .cosy\:reset-styles h4,
|
211
|
+
[data-role='code-container'] .cosy\:reset-styles h5,
|
212
|
+
[data-role='code-container'] .cosy\:reset-styles h6 {
|
213
|
+
font-weight: bold;
|
214
|
+
margin-bottom: 0.5em;
|
215
|
+
}
|
216
|
+
|
217
|
+
[data-role='code-container'] .cosy\:reset-styles p {
|
218
|
+
margin-bottom: 1em;
|
219
|
+
}
|
220
|
+
|
221
|
+
[data-role='code-container'] .cosy\:reset-styles ul,
|
222
|
+
[data-role='code-container'] .cosy\:reset-styles ol {
|
223
|
+
padding-left: 1.5em;
|
224
|
+
margin-bottom: 1em;
|
225
|
+
}
|
226
|
+
|
227
|
+
[data-role='code-container'] .cosy\:reset-styles li {
|
228
|
+
margin-bottom: 0.25em;
|
229
|
+
}
|
230
|
+
|
231
|
+
/* iframe 隔离样式 */
|
232
|
+
[data-role='code-container'] iframe[data-preview-frame] {
|
233
|
+
background: white;
|
234
|
+
border: 1px solid #e5e7eb;
|
235
|
+
border-radius: 0.375rem;
|
236
|
+
}
|
237
|
+
|
238
|
+
/* 防止内部组件的样式泄漏到外部 */
|
239
|
+
[data-role='code-container'] .cosy\:code-preview-area {
|
240
|
+
position: relative;
|
241
|
+
z-index: 0;
|
242
|
+
}
|
243
|
+
|
244
|
+
/* 确保预览区域的样式隔离 */
|
245
|
+
[data-role='code-container'] .cosy\:code-preview-area::before {
|
246
|
+
content: '';
|
247
|
+
position: absolute;
|
248
|
+
top: -1px;
|
249
|
+
left: -1px;
|
250
|
+
right: -1px;
|
251
|
+
bottom: -1px;
|
252
|
+
pointer-events: none;
|
253
|
+
z-index: -1;
|
254
|
+
}
|
255
|
+
</style>
|
256
|
+
|
110
257
|
<script>
|
258
|
+
function initializeIframePreviews() {
|
259
|
+
const iframes = document.querySelectorAll('[data-preview-frame]');
|
260
|
+
|
261
|
+
iframes.forEach((iframe) => {
|
262
|
+
const container = iframe.closest('[data-role="code-container"]');
|
263
|
+
if (!container) return;
|
264
|
+
|
265
|
+
const frameId = iframe.getAttribute('data-preview-frame');
|
266
|
+
const contentElement = container.querySelector(`#${frameId}`);
|
267
|
+
|
268
|
+
if (contentElement) {
|
269
|
+
// 创建独立的HTML文档内容
|
270
|
+
const iframeElement = iframe as HTMLIFrameElement;
|
271
|
+
const iframeDoc =
|
272
|
+
iframeElement.contentDocument ||
|
273
|
+
iframeElement.contentWindow?.document;
|
274
|
+
if (iframeDoc) {
|
275
|
+
const htmlContent = `
|
276
|
+
<!DOCTYPE html>
|
277
|
+
<html>
|
278
|
+
<head>
|
279
|
+
<meta charset="UTF-8">
|
280
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
281
|
+
<title>示例预览</title>
|
282
|
+
<style>
|
283
|
+
/* 基础样式重置 */
|
284
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
285
|
+
body {
|
286
|
+
font-family: system-ui, -apple-system, sans-serif;
|
287
|
+
padding: 1rem;
|
288
|
+
background: white;
|
289
|
+
color: #374151;
|
290
|
+
line-height: 1.5;
|
291
|
+
}
|
292
|
+
</style>
|
293
|
+
</head>
|
294
|
+
<body>
|
295
|
+
${contentElement.innerHTML}
|
296
|
+
</body>
|
297
|
+
</html>
|
298
|
+
`;
|
299
|
+
|
300
|
+
iframeDoc.open();
|
301
|
+
iframeDoc.write(htmlContent);
|
302
|
+
iframeDoc.close();
|
303
|
+
}
|
304
|
+
}
|
305
|
+
});
|
306
|
+
}
|
307
|
+
|
111
308
|
function initializeCodeContainer() {
|
112
309
|
console.log('CodeContainer: 初始化代码容器');
|
113
310
|
|
311
|
+
// 初始化 iframe 预览
|
312
|
+
initializeIframePreviews();
|
313
|
+
|
114
314
|
// 示例切换功能
|
115
315
|
const exampleTabs = document.querySelectorAll(
|
116
316
|
'[role="tab"][data-tab^="tab-"]'
|
@@ -1,14 +1,10 @@
|
|
1
|
-
|
2
|
-
import { default as CodeContainerBasic } from './ECodeContainerBasic.astro';
|
3
|
-
import { default as CodeContainerMultiple } from './ECodeContainerMultiple.astro';
|
4
|
-
import BasicSourceCode from './ECodeContainerBasic.astro?raw';
|
5
|
-
import MultipleSourceCode from './ECodeContainerMultiple.astro?raw';
|
6
|
-
import { extractSimpleExample } from '../utils/component';
|
1
|
+
export { default as CodeContainer } from './CodeContainer.astro';
|
7
2
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
// Export types
|
4
|
+
export interface CodeContainerProps {
|
5
|
+
titles?: string[];
|
6
|
+
descriptions?: string[];
|
7
|
+
codes: string[];
|
8
|
+
useIframe?: boolean;
|
9
|
+
resetStyles?: boolean;
|
10
|
+
}
|
@@ -1,21 +1,17 @@
|
|
1
|
-
|
1
|
+
export { default as Contact } from './Contact.astro';
|
2
2
|
|
3
|
-
//
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
Compact: ContactCompactContainer,
|
19
|
-
CustomStyle: ContactCustomStyleContainer,
|
20
|
-
},
|
21
|
-
};
|
3
|
+
// Export types
|
4
|
+
export interface ContactProps {
|
5
|
+
title?: string;
|
6
|
+
description?: string;
|
7
|
+
email?: string;
|
8
|
+
phone?: string;
|
9
|
+
address?: string;
|
10
|
+
website?: string;
|
11
|
+
github?: string;
|
12
|
+
twitter?: string;
|
13
|
+
facebook?: string;
|
14
|
+
linkedin?: string;
|
15
|
+
compact?: boolean;
|
16
|
+
class?: string;
|
17
|
+
}
|
@@ -3,30 +3,7 @@ import Error403 from './403.astro';
|
|
3
3
|
import Error500 from './500.astro';
|
4
4
|
import Error503 from './503.astro';
|
5
5
|
import ErrorPage from './ErrorPage.astro';
|
6
|
-
|
7
6
|
import Error404Basic from './404Basic.astro';
|
8
|
-
import E404Basic from './E404Basic.astro';
|
9
|
-
import E404WithDebug from './E404WithDebug.astro';
|
10
|
-
import E403Basic from './E403Basic.astro';
|
11
|
-
import E500Basic from './E500Basic.astro';
|
12
|
-
import E503Maintenance from './E503Maintenance.astro';
|
13
|
-
|
14
|
-
import E404BasicContainer from './E404BasicContainer.astro';
|
15
|
-
import E403BasicContainer from './E403BasicContainer.astro';
|
16
|
-
import E500BasicContainer from './E500BasicContainer.astro';
|
17
|
-
import E503MaintenanceContainer from './E503MaintenanceContainer.astro';
|
18
|
-
import EErrorPageShowcase from './EErrorPageShowcase.astro';
|
19
|
-
import EErrorPageShowcaseContainer from './EErrorPageShowcaseContainer.astro';
|
20
|
-
import EErrorPageCustomStyle from './EErrorPageCustomStyle.astro';
|
21
|
-
import EErrorPageCustomStyleContainer from './EErrorPageCustomStyleContainer.astro';
|
22
|
-
|
23
|
-
import BasicSourceCode from './E404Basic.astro?raw';
|
24
|
-
import WithDebugSourceCode from './E404WithDebug.astro?raw';
|
25
|
-
import Error403SourceCode from './E403Basic.astro?raw';
|
26
|
-
import Error500SourceCode from './E500Basic.astro?raw';
|
27
|
-
import Error503SourceCode from './E503Maintenance.astro?raw';
|
28
|
-
|
29
|
-
import { extractSimpleExample } from '../utils/component';
|
30
7
|
|
31
8
|
export {
|
32
9
|
Error404,
|
@@ -35,43 +12,4 @@ export {
|
|
35
12
|
Error503,
|
36
13
|
ErrorPage,
|
37
14
|
Error404Basic,
|
38
|
-
E404Basic,
|
39
|
-
E404WithDebug,
|
40
|
-
E403Basic,
|
41
|
-
E500Basic,
|
42
|
-
E503Maintenance,
|
43
|
-
E404BasicContainer,
|
44
|
-
E403BasicContainer,
|
45
|
-
E500BasicContainer,
|
46
|
-
E503MaintenanceContainer,
|
47
|
-
EErrorPageShowcase,
|
48
|
-
EErrorPageShowcaseContainer,
|
49
|
-
EErrorPageCustomStyle,
|
50
|
-
EErrorPageCustomStyleContainer,
|
51
|
-
};
|
52
|
-
|
53
|
-
// 错误页面组件包
|
54
|
-
export const ErrorPackage = {
|
55
|
-
ErrorPage,
|
56
|
-
Error404,
|
57
|
-
Error403,
|
58
|
-
Error500,
|
59
|
-
Error503,
|
60
|
-
ErrorContainers: {
|
61
|
-
Basic404: E404BasicContainer,
|
62
|
-
Basic403: E403BasicContainer,
|
63
|
-
Basic500: E500BasicContainer,
|
64
|
-
Maintenance503: E503MaintenanceContainer,
|
65
|
-
Showcase: EErrorPageShowcaseContainer,
|
66
|
-
CustomStyle: EErrorPageCustomStyleContainer,
|
67
|
-
},
|
68
|
-
};
|
69
|
-
|
70
|
-
// 导出示例源代码
|
71
|
-
export const ErrorExampleCodes = {
|
72
|
-
Basic404: extractSimpleExample(BasicSourceCode, 'Error404'),
|
73
|
-
WithDebug404: extractSimpleExample(WithDebugSourceCode, 'Error404'),
|
74
|
-
Basic403: extractSimpleExample(Error403SourceCode, 'Error403'),
|
75
|
-
Basic500: extractSimpleExample(Error500SourceCode, 'Error500'),
|
76
|
-
Maintenance503: extractSimpleExample(Error503SourceCode, 'Error503'),
|
77
15
|
};
|