@mathwiz/ui-components 0.1.5 → 0.1.7
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/README.md +35 -1
- package/dist/App.css +570 -0
- package/dist/components/Button/Button.css +214 -0
- package/dist/components/ContentAccordion/ContentAccordion.css +268 -0
- package/dist/components/MathWizHeader/MathWizHeader.css +333 -0
- package/dist/components/MathWizHeader/MathWizHeader.d.ts.map +1 -1
- package/dist/components/MathWizHeader/MathWizHeader.types.d.ts +15 -0
- package/dist/components/MathWizHeader/MathWizHeader.types.d.ts.map +1 -1
- package/dist/components/Sidebar/Sidebar.css +207 -0
- package/dist/components/Submenu/Submenu.css +98 -0
- package/dist/components/UserProfile/UserProfile.css +141 -0
- package/dist/components/components.css +222 -0
- package/dist/components/radarAbility/AbilityAssessmentDashboard/AbilityAssessmentDashboard.module.css +60 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/types.d.ts +117 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/utils.d.ts +72 -0
- package/dist/config/utils.d.ts.map +1 -0
- package/dist/data-sources/api-data-source.d.ts +35 -0
- package/dist/data-sources/api-data-source.d.ts.map +1 -0
- package/dist/data-sources/custom-data-source.d.ts +59 -0
- package/dist/data-sources/custom-data-source.d.ts.map +1 -0
- package/dist/data-sources/factory.d.ts +61 -0
- package/dist/data-sources/factory.d.ts.map +1 -0
- package/dist/data-sources/index.d.ts +7 -0
- package/dist/data-sources/index.d.ts.map +1 -0
- package/dist/data-sources/mock-data-source.d.ts +44 -0
- package/dist/data-sources/mock-data-source.d.ts.map +1 -0
- package/dist/data-sources/types.d.ts +119 -0
- package/dist/data-sources/types.d.ts.map +1 -0
- package/dist/demo/configurable-demo.d.ts +4 -0
- package/dist/demo/configurable-demo.d.ts.map +1 -0
- package/dist/index.cjs +22 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +63 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2051 -1564
- package/dist/index.mjs.map +1 -1
- package/dist/mocks/handlers.d.ts.map +1 -1
- package/dist/pages/GradeUnitBrowserPage/GradeUnitBrowserContext.d.ts +2 -4
- package/dist/pages/GradeUnitBrowserPage/GradeUnitBrowserContext.d.ts.map +1 -1
- package/dist/pages/GradeUnitBrowserPage/GradeUnitBrowserPage.css +250 -0
- package/dist/pages/GradeUnitBrowserPage/GradeUnitBrowserPage.d.ts.map +1 -1
- package/dist/pages/GradeUnitBrowserPage/types.d.ts +10 -0
- package/dist/pages/GradeUnitBrowserPage/types.d.ts.map +1 -1
- package/dist/services/courseService.d.ts.map +1 -1
- package/dist/stories/button.css +30 -0
- package/dist/stories/header.css +32 -0
- package/dist/stories/page.css +68 -0
- package/dist/styles/index.css +154 -0
- package/package.json +4 -2
- package/dist/ui-components.css +0 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/* UserProfile 组件样式 */
|
|
2
|
+
.user-profile-container {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* 触发区域样式 */
|
|
10
|
+
.user-profile-trigger {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: var(--spacing-sm, 8px);
|
|
14
|
+
padding: var(--spacing-xs, 4px) var(--spacing-sm, 8px);
|
|
15
|
+
border-radius: var(--border-radius-md, 6px);
|
|
16
|
+
transition: background-color var(--transition-duration-fast, 0.2s) ease;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.user-profile-trigger:hover {
|
|
20
|
+
background-color: var(--color-background-hover, #f5f5f5);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* 用户名样式 */
|
|
24
|
+
.user-name {
|
|
25
|
+
font-weight: var(--font-weight-medium, 500);
|
|
26
|
+
color: var(--color-text-primary, #333);
|
|
27
|
+
font-size: var(--font-size-md, 14px);
|
|
28
|
+
line-height: 1.4;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* 状态样式 */
|
|
32
|
+
.user-profile-container.is-loading .user-profile-trigger {
|
|
33
|
+
opacity: 0.7;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.user-profile-container.has-error .user-profile-trigger {
|
|
38
|
+
border: 1px solid var(--color-error, #dc3545);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* 加载和错误状态文本 */
|
|
42
|
+
.user-profile-loading,
|
|
43
|
+
.user-profile-error {
|
|
44
|
+
padding: var(--spacing-sm, 8px) var(--spacing-md, 12px);
|
|
45
|
+
border-radius: var(--border-radius-md, 6px);
|
|
46
|
+
font-size: var(--font-size-sm, 12px);
|
|
47
|
+
line-height: 1.4;
|
|
48
|
+
text-align: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.user-profile-loading {
|
|
52
|
+
background-color: var(--color-background-muted, #f8f9fa);
|
|
53
|
+
color: var(--color-text-muted, #6c757d);
|
|
54
|
+
min-width: 80px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.user-profile-error {
|
|
58
|
+
background-color: var(--color-error-bg, #f8d7da);
|
|
59
|
+
color: var(--color-error, #721c24);
|
|
60
|
+
border: 1px solid var(--color-error-border, #f5c6cb);
|
|
61
|
+
min-width: 120px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* 响应式设计 */
|
|
65
|
+
@media (max-width: 768px) {
|
|
66
|
+
.user-profile-trigger {
|
|
67
|
+
padding: var(--spacing-xs, 4px);
|
|
68
|
+
gap: var(--spacing-xs, 4px);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.user-name {
|
|
72
|
+
font-size: var(--font-size-sm, 12px);
|
|
73
|
+
display: none;
|
|
74
|
+
/* 在小屏幕上隐藏用户名 */
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.user-profile-loading,
|
|
78
|
+
.user-profile-error {
|
|
79
|
+
font-size: var(--font-size-xs, 10px);
|
|
80
|
+
padding: var(--spacing-xs, 4px) var(--spacing-sm, 8px);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (min-width: 769px) {
|
|
85
|
+
.user-name {
|
|
86
|
+
display: inline;
|
|
87
|
+
/* 在较大屏幕上显示用户名 */
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* 暗色主题支持 */
|
|
92
|
+
[data-theme="dark"] .user-profile-trigger:hover {
|
|
93
|
+
background-color: var(--color-background-hover-dark, #2d2d2d);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[data-theme="dark"] .user-name {
|
|
97
|
+
color: var(--color-text-primary-dark, #ffffff);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[data-theme="dark"] .user-profile-loading {
|
|
101
|
+
background-color: var(--color-background-muted-dark, #2d2d2d);
|
|
102
|
+
color: var(--color-text-muted-dark, #a0a0a0);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* 高对比度模式支持 */
|
|
106
|
+
@media (prefers-contrast: high) {
|
|
107
|
+
.user-profile-trigger:hover {
|
|
108
|
+
background-color: var(--color-background-hover-high-contrast, #000000);
|
|
109
|
+
outline: 2px solid var(--color-border-high-contrast, #ffffff);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.user-name {
|
|
113
|
+
font-weight: var(--font-weight-bold, 700);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* 减少动画支持 */
|
|
118
|
+
@media (prefers-reduced-motion: reduce) {
|
|
119
|
+
.user-profile-trigger {
|
|
120
|
+
transition: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.submenu-panel {
|
|
124
|
+
transition: none;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* 焦点样式 - 无障碍访问支持 */
|
|
129
|
+
.user-profile-trigger:focus-visible {
|
|
130
|
+
outline: 2px solid var(--color-focus-ring, #007bff);
|
|
131
|
+
outline-offset: 2px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* 禁用状态样式 */
|
|
135
|
+
.user-profile-container:has(.submenu-item.is-disabled) {
|
|
136
|
+
cursor: not-allowed;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.user-profile-container:has(.submenu-item.is-disabled) .user-profile-trigger:hover {
|
|
140
|
+
background-color: transparent;
|
|
141
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/* Game Interactive Components */
|
|
2
|
+
/* @import './gameInteractive/gameInteractive.css'; */
|
|
3
|
+
|
|
4
|
+
/* Grade Navigation Styles */
|
|
5
|
+
.grade-navigation {
|
|
6
|
+
max-width: 800px;
|
|
7
|
+
margin: 0 auto;
|
|
8
|
+
padding: 20px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.grade-navigation__title {
|
|
12
|
+
font-size: 24px;
|
|
13
|
+
font-weight: bold;
|
|
14
|
+
color: #333;
|
|
15
|
+
margin-bottom: 20px;
|
|
16
|
+
text-align: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.grade-navigation__grid {
|
|
20
|
+
display: grid;
|
|
21
|
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
22
|
+
gap: 16px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.grade-card {
|
|
26
|
+
background: white;
|
|
27
|
+
border: 1px solid #e0e0e0;
|
|
28
|
+
border-left: 4px solid;
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
padding: 20px;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
transition: all 0.3s ease;
|
|
33
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.grade-card:hover {
|
|
37
|
+
transform: translateY(-2px);
|
|
38
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.grade-card--selected {
|
|
42
|
+
border-left-width: 6px;
|
|
43
|
+
background: #f8f9fa;
|
|
44
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.grade-card__level {
|
|
48
|
+
font-size: 12px;
|
|
49
|
+
color: #666;
|
|
50
|
+
text-transform: uppercase;
|
|
51
|
+
letter-spacing: 0.5px;
|
|
52
|
+
margin-bottom: 4px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.grade-card__name {
|
|
56
|
+
font-size: 20px;
|
|
57
|
+
font-weight: bold;
|
|
58
|
+
color: #333;
|
|
59
|
+
margin-bottom: 8px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.grade-card__description {
|
|
63
|
+
font-size: 14px;
|
|
64
|
+
color: #666;
|
|
65
|
+
line-height: 1.4;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Side Navigation Styles */
|
|
69
|
+
.side-navigation {
|
|
70
|
+
width: 300px;
|
|
71
|
+
background: white;
|
|
72
|
+
border-right: 1px solid #e0e0e0;
|
|
73
|
+
height: 100vh;
|
|
74
|
+
overflow-y: auto;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.side-navigation__header {
|
|
78
|
+
padding: 20px;
|
|
79
|
+
border-bottom: 1px solid #e0e0e0;
|
|
80
|
+
background: #f8f9fa;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.side-navigation__header h3 {
|
|
84
|
+
margin: 0;
|
|
85
|
+
font-size: 18px;
|
|
86
|
+
color: #333;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.side-navigation__content {
|
|
90
|
+
padding: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.unit-section {
|
|
94
|
+
border-bottom: 1px solid #e0e0e0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.unit-header {
|
|
98
|
+
padding: 16px 20px;
|
|
99
|
+
background: #f8f9fa;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
display: flex;
|
|
102
|
+
justify-content: space-between;
|
|
103
|
+
align-items: center;
|
|
104
|
+
transition: background-color 0.2s ease;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.unit-header:hover {
|
|
108
|
+
background: #e9ecef;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.unit-title {
|
|
112
|
+
font-weight: 600;
|
|
113
|
+
color: #333;
|
|
114
|
+
font-size: 16px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.unit-toggle {
|
|
118
|
+
transition: transform 0.3s ease;
|
|
119
|
+
color: #666;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.unit-toggle.expanded {
|
|
123
|
+
transform: rotate(180deg);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.lesson-list {
|
|
127
|
+
list-style: none;
|
|
128
|
+
margin: 0;
|
|
129
|
+
padding: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.lesson-item {
|
|
133
|
+
padding: 12px 20px 12px 40px;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: space-between;
|
|
137
|
+
align-items: center;
|
|
138
|
+
border-left: 3px solid transparent;
|
|
139
|
+
transition: all 0.2s ease;
|
|
140
|
+
font-size: 14px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.lesson-item:hover {
|
|
144
|
+
background: #f8f9fa;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.lesson-item--active {
|
|
148
|
+
background: #e3f2fd;
|
|
149
|
+
border-left-color: #2196f3;
|
|
150
|
+
font-weight: 500;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.lesson-item--completed {
|
|
154
|
+
color: #4caf50;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.lesson-item--completed .lesson-title::before {
|
|
158
|
+
content: '✓ ';
|
|
159
|
+
margin-right: 8px;
|
|
160
|
+
color: #4caf50;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.lesson-item--locked {
|
|
164
|
+
color: #999;
|
|
165
|
+
cursor: not-allowed;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.lesson-item--locked .lesson-title::before {
|
|
169
|
+
content: '🔒 ';
|
|
170
|
+
margin-right: 8px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.lesson-title {
|
|
174
|
+
flex: 1;
|
|
175
|
+
color: inherit;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.lesson-duration {
|
|
179
|
+
font-size: 12px;
|
|
180
|
+
color: #666;
|
|
181
|
+
margin-left: 8px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.lesson-status {
|
|
185
|
+
color: #4caf50;
|
|
186
|
+
font-weight: bold;
|
|
187
|
+
margin-left: 8px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* Grade Information Styles */
|
|
191
|
+
.grade-info {
|
|
192
|
+
padding: 12px 20px;
|
|
193
|
+
display: flex;
|
|
194
|
+
flex-direction: column;
|
|
195
|
+
gap: 4px;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.grade-level {
|
|
199
|
+
font-size: 14px;
|
|
200
|
+
color: #666;
|
|
201
|
+
font-weight: 500;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.course-title {
|
|
205
|
+
font-size: 16px;
|
|
206
|
+
color: #333;
|
|
207
|
+
font-weight: 600;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* Responsive Design */
|
|
211
|
+
@media (max-width: 768px) {
|
|
212
|
+
.grade-navigation__grid {
|
|
213
|
+
grid-template-columns: 1fr;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.side-navigation {
|
|
217
|
+
width: 100%;
|
|
218
|
+
height: auto;
|
|
219
|
+
border-right: none;
|
|
220
|
+
border-bottom: 1px solid #e0e0e0;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* 复合组件 AbilityAssessmentDashboard 的内部布局 */
|
|
2
|
+
/* 上下布局 3:2 */
|
|
3
|
+
.dashboardLayout {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 24px; /* gap-6 */
|
|
7
|
+
height: 100%; /* Or a defined height for visualization */
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.upperSection {
|
|
11
|
+
flex: 3; /* Represents 3/5 height */
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: 1fr 1fr; /* 左右两份 */
|
|
14
|
+
gap: 24px; /* gap-6 */
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.lowerSection {
|
|
18
|
+
flex: 2; /* Represents 2/5 height */
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: 16px; /* space-y-4 */
|
|
22
|
+
padding-top: 24px;
|
|
23
|
+
border-top: 1px solid #e2e8f0; /* border-gray-200 */
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.radarChartArea {
|
|
27
|
+
position: relative;
|
|
28
|
+
height: 320px; /* h-80 from original, but using aspect-square for SVG */
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* 响应式设计 */
|
|
35
|
+
@media (max-width: 768px) {
|
|
36
|
+
.upperSection {
|
|
37
|
+
grid-template-columns: 1fr;
|
|
38
|
+
gap: 16px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dashboardLayout {
|
|
42
|
+
gap: 16px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Animation for smooth appearance */
|
|
47
|
+
.animate-fade-in {
|
|
48
|
+
animation: fadeIn 0.6s ease-out;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@keyframes fadeIn {
|
|
52
|
+
from {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transform: translateY(20px);
|
|
55
|
+
}
|
|
56
|
+
to {
|
|
57
|
+
opacity: 1;
|
|
58
|
+
transform: translateY(0);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,4BAA4B,EAC5B,cAAc,EACd,YAAY,EACZ,eAAe,EACf,WAAW,EACX,aAAa,EACd,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { IDataSource } from '../data-sources/types';
|
|
2
|
+
/**
|
|
3
|
+
* 错误处理配置
|
|
4
|
+
*/
|
|
5
|
+
export interface ErrorHandlingConfig {
|
|
6
|
+
/** 是否显示用户友好的错误信息 */
|
|
7
|
+
showUserFriendlyErrors: boolean;
|
|
8
|
+
/** 是否记录错误日志 */
|
|
9
|
+
logErrors: boolean;
|
|
10
|
+
/** 是否自动重试 */
|
|
11
|
+
autoRetry: boolean;
|
|
12
|
+
/** 最大重试次数 */
|
|
13
|
+
maxRetries: number;
|
|
14
|
+
/** 重试延迟(毫秒) */
|
|
15
|
+
retryDelay: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 性能优化配置
|
|
19
|
+
*/
|
|
20
|
+
export interface PerformanceConfig {
|
|
21
|
+
/** 是否启用虚拟化 */
|
|
22
|
+
enableVirtualization: boolean;
|
|
23
|
+
/** 是否懒加载图片 */
|
|
24
|
+
lazyLoadImages: boolean;
|
|
25
|
+
/** 搜索防抖时间(毫秒) */
|
|
26
|
+
debounceSearch: number;
|
|
27
|
+
/** 是否启用数据缓存 */
|
|
28
|
+
enableCaching: boolean;
|
|
29
|
+
/** 缓存过期时间(毫秒) */
|
|
30
|
+
cacheTTL: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 主题配置
|
|
34
|
+
*/
|
|
35
|
+
export interface ThemeConfig {
|
|
36
|
+
/** 主色调 */
|
|
37
|
+
primaryColor: string;
|
|
38
|
+
/** 圆角大小 */
|
|
39
|
+
borderRadius: string;
|
|
40
|
+
/** 间距 */
|
|
41
|
+
spacing: string;
|
|
42
|
+
/** 字体大小 */
|
|
43
|
+
fontSize: string;
|
|
44
|
+
/** 是否启用深色模式 */
|
|
45
|
+
enableDarkMode: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Fallback策略
|
|
49
|
+
*/
|
|
50
|
+
export type FallbackStrategy = 'error' | 'mock' | 'cached' | 'none';
|
|
51
|
+
/**
|
|
52
|
+
* GradeUnitBrowser 完整配置
|
|
53
|
+
*/
|
|
54
|
+
export interface GradeUnitBrowserConfig {
|
|
55
|
+
/** 数据源配置 */
|
|
56
|
+
dataSource: IDataSource;
|
|
57
|
+
/** Fallback策略 */
|
|
58
|
+
fallbackStrategy: FallbackStrategy;
|
|
59
|
+
/** 错误处理配置 */
|
|
60
|
+
errorHandling: ErrorHandlingConfig;
|
|
61
|
+
/** 性能优化配置 */
|
|
62
|
+
performance: PerformanceConfig;
|
|
63
|
+
/** 主题和样式配置 */
|
|
64
|
+
theme: ThemeConfig;
|
|
65
|
+
/** 调试模式 */
|
|
66
|
+
debug: boolean;
|
|
67
|
+
/** 是否启用开发工具 */
|
|
68
|
+
enableDevTools: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 配置创建选项
|
|
72
|
+
*/
|
|
73
|
+
export interface CreateConfigOptions {
|
|
74
|
+
/** 数据源配置 */
|
|
75
|
+
dataSource?: IDataSource;
|
|
76
|
+
/** Fallback策略 */
|
|
77
|
+
fallbackStrategy?: FallbackStrategy;
|
|
78
|
+
/** 错误处理配置 */
|
|
79
|
+
errorHandling?: Partial<ErrorHandlingConfig>;
|
|
80
|
+
/** 性能优化配置 */
|
|
81
|
+
performance?: Partial<PerformanceConfig>;
|
|
82
|
+
/** 主题和样式配置 */
|
|
83
|
+
theme?: Partial<ThemeConfig>;
|
|
84
|
+
/** 调试模式 */
|
|
85
|
+
debug?: boolean;
|
|
86
|
+
/** 是否启用开发工具 */
|
|
87
|
+
enableDevTools?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 配置验证结果
|
|
91
|
+
*/
|
|
92
|
+
export interface ConfigValidationResult {
|
|
93
|
+
/** 是否有效 */
|
|
94
|
+
isValid: boolean;
|
|
95
|
+
/** 错误信息 */
|
|
96
|
+
errors: string[];
|
|
97
|
+
/** 警告信息 */
|
|
98
|
+
warnings: string[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 配置预设类型
|
|
102
|
+
*/
|
|
103
|
+
export type ConfigPreset = 'development' | 'production' | 'testing' | 'minimal';
|
|
104
|
+
/**
|
|
105
|
+
* 配置变更事件
|
|
106
|
+
*/
|
|
107
|
+
export interface ConfigChangeEvent {
|
|
108
|
+
/** 变更的配置键 */
|
|
109
|
+
key: string;
|
|
110
|
+
/** 旧值 */
|
|
111
|
+
oldValue: any;
|
|
112
|
+
/** 新值 */
|
|
113
|
+
newValue: any;
|
|
114
|
+
/** 变更时间戳 */
|
|
115
|
+
timestamp: number;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAoB,MAAM,uBAAuB,CAAC;AAI3E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,sBAAsB,EAAE,OAAO,CAAC;IAChC,eAAe;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,cAAc;IACd,oBAAoB,EAAE,OAAO,CAAC;IAC9B,cAAc;IACd,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe;IACf,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,YAAY;IACZ,UAAU,EAAE,WAAW,CAAC;IAExB,iBAAiB;IACjB,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,aAAa;IACb,aAAa,EAAE,mBAAmB,CAAC;IAEnC,aAAa;IACb,WAAW,EAAE,iBAAiB,CAAC;IAE/B,cAAc;IACd,KAAK,EAAE,WAAW,CAAC;IAEnB,WAAW;IACX,KAAK,EAAE,OAAO,CAAC;IAEf,eAAe;IACf,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,YAAY;IACZ,UAAU,CAAC,EAAE,WAAW,CAAC;IAEzB,iBAAiB;IACjB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC,aAAa;IACb,aAAa,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE7C,aAAa;IACb,WAAW,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEzC,cAAc;IACd,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAE7B,WAAW;IACX,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,eAAe;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW;IACX,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,aAAa;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS;IACT,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS;IACT,QAAQ,EAAE,GAAG,CAAC;IACd,YAAY;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { GradeUnitBrowserConfig, CreateConfigOptions, ConfigValidationResult, ConfigPreset, ConfigChangeEvent } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 创建 GradeUnitBrowser 配置
|
|
4
|
+
* @param options 配置选项
|
|
5
|
+
* @returns 完整的配置对象
|
|
6
|
+
*/
|
|
7
|
+
export declare function createGradeUnitBrowserConfig(options?: CreateConfigOptions): GradeUnitBrowserConfig;
|
|
8
|
+
/**
|
|
9
|
+
* 验证配置的有效性
|
|
10
|
+
* @param config 要验证的配置
|
|
11
|
+
* @returns 验证结果
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateConfig(config: GradeUnitBrowserConfig): ConfigValidationResult;
|
|
14
|
+
/**
|
|
15
|
+
* 合并配置
|
|
16
|
+
* @param baseConfig 基础配置
|
|
17
|
+
* @param overrideConfig 覆盖配置
|
|
18
|
+
* @returns 合并后的配置
|
|
19
|
+
*/
|
|
20
|
+
export declare function mergeConfigs(baseConfig: GradeUnitBrowserConfig, overrideConfig: Partial<GradeUnitBrowserConfig>): GradeUnitBrowserConfig;
|
|
21
|
+
/**
|
|
22
|
+
* 获取预设配置
|
|
23
|
+
* @param preset 预设类型
|
|
24
|
+
* @returns 预设配置
|
|
25
|
+
*/
|
|
26
|
+
export declare function getPresetConfig(preset: ConfigPreset): GradeUnitBrowserConfig;
|
|
27
|
+
/**
|
|
28
|
+
* 克隆配置
|
|
29
|
+
* @param config 要克隆的配置
|
|
30
|
+
* @returns 克隆的配置
|
|
31
|
+
*/
|
|
32
|
+
export declare function cloneConfig(config: GradeUnitBrowserConfig): GradeUnitBrowserConfig;
|
|
33
|
+
/**
|
|
34
|
+
* 配置变更监听器类型
|
|
35
|
+
*/
|
|
36
|
+
export type ConfigChangeListener = (event: ConfigChangeEvent) => void;
|
|
37
|
+
/**
|
|
38
|
+
* 配置管理器
|
|
39
|
+
*/
|
|
40
|
+
export declare class ConfigManager {
|
|
41
|
+
private config;
|
|
42
|
+
private listeners;
|
|
43
|
+
constructor(initialConfig: GradeUnitBrowserConfig);
|
|
44
|
+
/**
|
|
45
|
+
* 获取当前配置
|
|
46
|
+
*/
|
|
47
|
+
getConfig(): GradeUnitBrowserConfig;
|
|
48
|
+
/**
|
|
49
|
+
* 更新配置
|
|
50
|
+
* @param updates 配置更新
|
|
51
|
+
*/
|
|
52
|
+
updateConfig(updates: Partial<GradeUnitBrowserConfig>): void;
|
|
53
|
+
/**
|
|
54
|
+
* 添加配置变更监听器
|
|
55
|
+
* @param listener 监听器函数
|
|
56
|
+
*/
|
|
57
|
+
addChangeListener(listener: ConfigChangeListener): void;
|
|
58
|
+
/**
|
|
59
|
+
* 移除配置变更监听器
|
|
60
|
+
* @param listener 监听器函数
|
|
61
|
+
*/
|
|
62
|
+
removeChangeListener(listener: ConfigChangeListener): void;
|
|
63
|
+
/**
|
|
64
|
+
* 触发配置变更事件
|
|
65
|
+
*/
|
|
66
|
+
private triggerChangeEvents;
|
|
67
|
+
/**
|
|
68
|
+
* 获取变更的配置键
|
|
69
|
+
*/
|
|
70
|
+
private getChangedKeys;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/config/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAGjB;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE,mBAAwB,GAChC,sBAAsB,CA2CxB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,sBAAsB,GAAG,sBAAsB,CA+DrF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,sBAAsB,EAClC,cAAc,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAC9C,sBAAsB,CAiBxB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,sBAAsB,CAyE5E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,sBAAsB,GAAG,sBAAsB,CAElF;AAaD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAEtE;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,SAAS,CAA8B;gBAEnC,aAAa,EAAE,sBAAsB;IAIjD;;OAEG;IACH,SAAS,IAAI,sBAAsB;IAInC;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,IAAI;IAQ5D;;;OAGG;IACH,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;IAIvD;;;OAGG;IACH,oBAAoB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;IAO1D;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAe3B;;OAEG;IACH,OAAO,CAAC,cAAc;CAYvB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { IDataSource, ApiDataSourceConfig, UpdateProgressParams, BatchLessonProgressUpdate } from './types';
|
|
2
|
+
import type { UserData, UserGradeUnitsProgressData } from '../types';
|
|
3
|
+
import type { ExploreItem } from '../components/MathWizHeader/MathWizHeader.types';
|
|
4
|
+
/**
|
|
5
|
+
* API数据源 - 基于现有courseService的实现
|
|
6
|
+
*/
|
|
7
|
+
export declare class ApiDataSource implements IDataSource {
|
|
8
|
+
private config;
|
|
9
|
+
constructor(config: ApiDataSourceConfig);
|
|
10
|
+
getUserGradeUnitsNav(gradeId: string, userId: string): Promise<UserGradeUnitsProgressData>;
|
|
11
|
+
getUserProfile(userId: string): Promise<UserData>;
|
|
12
|
+
getExploreMenu(): Promise<ExploreItem[]>;
|
|
13
|
+
updateLessonProgress(params: UpdateProgressParams): Promise<void>;
|
|
14
|
+
batchUpdateLessonProgress(unitId: string, progressUpdates: BatchLessonProgressUpdate[]): Promise<{
|
|
15
|
+
success: boolean;
|
|
16
|
+
results: Array<{
|
|
17
|
+
lessonId: string;
|
|
18
|
+
success: boolean;
|
|
19
|
+
status: string;
|
|
20
|
+
}>;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* 带重试机制的请求执行
|
|
24
|
+
*/
|
|
25
|
+
private withRetry;
|
|
26
|
+
/**
|
|
27
|
+
* 延迟函数
|
|
28
|
+
*/
|
|
29
|
+
private delay;
|
|
30
|
+
/**
|
|
31
|
+
* 获取配置信息
|
|
32
|
+
*/
|
|
33
|
+
getConfig(): ApiDataSourceConfig;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=api-data-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-data-source.d.ts","sourceRoot":"","sources":["../../src/data-sources/api-data-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EAEnB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,QAAQ,EACR,0BAA0B,EAC3B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAEnF;;GAEG;AACH,qBAAa,aAAc,YAAW,WAAW;IAC/C,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAejC,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAmB1F,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAyBjD,cAAc,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAsBxC,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBjE,yBAAyB,CAC7B,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,yBAAyB,EAAE,GAC3C,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,KAAK,CAAC;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,OAAO,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;IAmBxG;;OAEG;YACW,SAAS;IAmBvB;;OAEG;IACH,OAAO,CAAC,KAAK;IAIb;;OAEG;IACH,SAAS,IAAI,mBAAmB;CAGjC"}
|