@agions/taroviz 1.1.0 → 1.2.0

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 (73) hide show
  1. package/README.md +318 -53
  2. package/dist/index.esm.js +67955 -3318
  3. package/package.json +102 -20
  4. package/src/__tests__/integration.test.tsx +168 -0
  5. package/src/adapters/__tests__/index.test.ts +91 -0
  6. package/src/adapters/h5/__tests__/index.test.ts +156 -0
  7. package/src/adapters/h5/index.ts +301 -0
  8. package/src/adapters/harmony/index.ts +274 -0
  9. package/src/adapters/index.ts +234 -0
  10. package/src/adapters/swan/index.ts +274 -0
  11. package/src/adapters/tt/index.ts +274 -0
  12. package/src/adapters/types.ts +162 -0
  13. package/src/adapters/weapp/index.ts +237 -0
  14. package/src/charts/bar/__tests__/index.test.tsx +113 -0
  15. package/src/charts/bar/index.tsx +27 -0
  16. package/src/charts/common/BaseChartWrapper.tsx +136 -0
  17. package/src/charts/funnel/index.tsx +33 -0
  18. package/src/charts/gauge/index.tsx +33 -0
  19. package/src/charts/heatmap/index.tsx +33 -0
  20. package/src/charts/index.ts +21 -0
  21. package/src/charts/line/__tests__/index.test.tsx +107 -0
  22. package/src/charts/line/index.tsx +27 -0
  23. package/src/charts/pie/__tests__/index.test.tsx +112 -0
  24. package/src/charts/pie/index.tsx +22 -0
  25. package/src/charts/radar/index.tsx +33 -0
  26. package/src/charts/scatter/index.tsx +33 -0
  27. package/src/charts/types.ts +146 -0
  28. package/src/charts/utils.ts +56 -0
  29. package/src/core/__tests__/platform.test.ts +48 -0
  30. package/src/core/animation/AnimationManager.ts +391 -0
  31. package/src/core/animation/index.ts +20 -0
  32. package/src/core/animation/types.ts +248 -0
  33. package/src/core/components/BaseChart.tsx +1319 -0
  34. package/src/core/index.ts +19 -0
  35. package/src/core/types/chart.ts +66 -0
  36. package/src/core/types/common.ts +224 -0
  37. package/src/core/types/index.ts +281 -0
  38. package/src/core/types/platform.ts +325 -0
  39. package/src/core/utils/__tests__/common.test.ts +52 -0
  40. package/src/core/utils/__tests__/environment.test.ts +94 -0
  41. package/src/core/utils/__tests__/i18n.test.ts +247 -0
  42. package/src/core/utils/__tests__/index.test.ts +219 -0
  43. package/src/core/utils/__tests__/uuid.test.ts +78 -0
  44. package/src/core/utils/chartInstances.ts +69 -0
  45. package/src/core/utils/codeGenerator/CodeGenerator.ts +655 -0
  46. package/src/core/utils/codeGenerator/index.ts +13 -0
  47. package/src/core/utils/codeGenerator/types.ts +200 -0
  48. package/src/core/utils/common.ts +58 -0
  49. package/src/core/utils/configGenerator/ConfigGenerator.ts +583 -0
  50. package/src/core/utils/configGenerator/index.ts +13 -0
  51. package/src/core/utils/configGenerator/types.ts +445 -0
  52. package/src/core/utils/debug/DebugPanel.tsx +637 -0
  53. package/src/core/utils/debug/debugger.ts +322 -0
  54. package/src/core/utils/debug/index.ts +21 -0
  55. package/src/core/utils/debug/types.ts +142 -0
  56. package/src/core/utils/i18n.ts +452 -0
  57. package/src/core/utils/index.ts +162 -0
  58. package/src/core/utils/performance/PerformanceAnalyzer.ts +586 -0
  59. package/src/core/utils/performance/index.ts +13 -0
  60. package/src/core/utils/performance/types.ts +180 -0
  61. package/src/core/utils/uuid.ts +30 -0
  62. package/src/editor/ThemeEditor.tsx +449 -0
  63. package/src/editor/index.ts +10 -0
  64. package/src/hooks/__tests__/index.test.tsx +333 -0
  65. package/src/hooks/index.ts +214 -0
  66. package/src/index.ts +75 -0
  67. package/src/main.tsx +247 -0
  68. package/src/react-dom.d.ts +7 -0
  69. package/src/themes/__tests__/index.test.ts +91 -0
  70. package/src/themes/index.ts +465 -0
  71. package/dist/index.esm.js.map +0 -1
  72. package/dist/index.js +0 -4012
  73. package/dist/index.js.map +0 -1
@@ -0,0 +1,20 @@
1
+ /**
2
+ * TaroViz 动画系统入口文件
3
+ */
4
+
5
+ // 导出类型定义
6
+ export * from './types';
7
+
8
+ // 导出动画管理器
9
+ export { AnimationManager } from './AnimationManager';
10
+
11
+ // 导出工具函数
12
+ export {
13
+ createAnimationConfig,
14
+ getAnimationPreset,
15
+ generateEChartsAnimationConfig,
16
+ } from './AnimationManager';
17
+
18
+ // 导出默认动画管理器实例
19
+ import { AnimationManager } from './AnimationManager';
20
+ export const animationManager = AnimationManager.getInstance();
@@ -0,0 +1,248 @@
1
+ /**
2
+ * TaroViz 动画系统核心类型定义
3
+ */
4
+
5
+ /**
6
+ * 动画缓动函数类型
7
+ */
8
+ export type AnimationEasing =
9
+ | 'linear'
10
+ | 'quadraticIn'
11
+ | 'quadraticOut'
12
+ | 'quadraticInOut'
13
+ | 'cubicIn'
14
+ | 'cubicOut'
15
+ | 'cubicInOut'
16
+ | 'quarticIn'
17
+ | 'quarticOut'
18
+ | 'quarticInOut'
19
+ | 'quinticIn'
20
+ | 'quinticOut'
21
+ | 'quinticInOut'
22
+ | 'sinusoidalIn'
23
+ | 'sinusoidalOut'
24
+ | 'sinusoidalInOut'
25
+ | 'exponentialIn'
26
+ | 'exponentialOut'
27
+ | 'exponentialInOut'
28
+ | 'circularIn'
29
+ | 'circularOut'
30
+ | 'circularInOut'
31
+ | 'elasticIn'
32
+ | 'elasticOut'
33
+ | 'elasticInOut'
34
+ | 'backIn'
35
+ | 'backOut'
36
+ | 'backInOut'
37
+ | 'bounceIn'
38
+ | 'bounceOut'
39
+ | 'bounceInOut';
40
+
41
+ /**
42
+ * 动画类型
43
+ */
44
+ export type AnimationType = 'appear' | 'update' | 'disappear' | 'emphasis' | 'all';
45
+
46
+ /**
47
+ * 动画配置接口
48
+ */
49
+ export interface AnimationConfig {
50
+ /**
51
+ * 是否启用动画
52
+ */
53
+ enabled?: boolean;
54
+
55
+ /**
56
+ * 动画时长(毫秒)
57
+ */
58
+ duration?: number;
59
+
60
+ /**
61
+ * 动画缓动函数
62
+ */
63
+ easing?: AnimationEasing;
64
+
65
+ /**
66
+ * 初始动画时长(毫秒)
67
+ */
68
+ appearDuration?: number;
69
+
70
+ /**
71
+ * 初始动画缓动函数
72
+ */
73
+ appearEasing?: AnimationEasing;
74
+
75
+ /**
76
+ * 更新动画时长(毫秒)
77
+ */
78
+ updateDuration?: number;
79
+
80
+ /**
81
+ * 更新动画缓动函数
82
+ */
83
+ updateEasing?: AnimationEasing;
84
+
85
+ /**
86
+ * 消失动画时长(毫秒)
87
+ */
88
+ disappearDuration?: number;
89
+
90
+ /**
91
+ * 消失动画缓动函数
92
+ */
93
+ disappearEasing?: AnimationEasing;
94
+
95
+ /**
96
+ * 动画延迟(毫秒)
97
+ */
98
+ delay?: number;
99
+
100
+ /**
101
+ * 动画重复次数
102
+ */
103
+ repeat?: number;
104
+
105
+ /**
106
+ * 是否反向播放动画
107
+ */
108
+ reverse?: boolean;
109
+
110
+ /**
111
+ * 动画阈值
112
+ * 当数据项数量超过此值时,自动关闭动画以提升性能
113
+ */
114
+ threshold?: number;
115
+
116
+ /**
117
+ * 是否启用渐进式动画
118
+ */
119
+ progressive?: boolean;
120
+
121
+ /**
122
+ * 渐进式动画的步长
123
+ */
124
+ progressiveStep?: number;
125
+ }
126
+
127
+ /**
128
+ * 动画预设配置
129
+ */
130
+ export interface AnimationPreset {
131
+ /**
132
+ * 预设名称
133
+ */
134
+ name: string;
135
+
136
+ /**
137
+ * 预设描述
138
+ */
139
+ description?: string;
140
+
141
+ /**
142
+ * 预设动画配置
143
+ */
144
+ config: AnimationConfig;
145
+
146
+ /**
147
+ * 适用的图表类型
148
+ */
149
+ chartTypes?: string[];
150
+ }
151
+
152
+ /**
153
+ * 动画模板配置
154
+ */
155
+ export interface AnimationTemplate {
156
+ /**
157
+ * 模板名称
158
+ */
159
+ name: string;
160
+
161
+ /**
162
+ * 模板描述
163
+ */
164
+ description?: string;
165
+
166
+ /**
167
+ * 模板动画配置
168
+ */
169
+ config: AnimationConfig;
170
+
171
+ /**
172
+ * 模板适用的场景
173
+ */
174
+ scenarios?: string[];
175
+ }
176
+
177
+ /**
178
+ * 动画管理器配置
179
+ */
180
+ export interface AnimationManagerConfig {
181
+ /**
182
+ * 默认动画配置
183
+ */
184
+ defaultConfig?: AnimationConfig;
185
+
186
+ /**
187
+ * 性能优化配置
188
+ */
189
+ performance?: {
190
+ /**
191
+ * 是否启用性能监控
192
+ */
193
+ monitor?: boolean;
194
+
195
+ /**
196
+ * 帧率限制
197
+ */
198
+ frameRate?: number;
199
+
200
+ /**
201
+ * 是否启用硬件加速
202
+ */
203
+ hardwareAcceleration?: boolean;
204
+ };
205
+ }
206
+
207
+ /**
208
+ * 动画事件类型
209
+ */
210
+ export enum AnimationEventType {
211
+ /**
212
+ * 动画开始事件
213
+ */
214
+ ANIMATION_START = 'animationStart',
215
+
216
+ /**
217
+ * 动画更新事件
218
+ */
219
+ ANIMATION_UPDATE = 'animationUpdate',
220
+
221
+ /**
222
+ * 动画结束事件
223
+ */
224
+ ANIMATION_END = 'animationEnd',
225
+
226
+ /**
227
+ * 动画取消事件
228
+ */
229
+ ANIMATION_CANCEL = 'animationCancel',
230
+
231
+ /**
232
+ * 动画重复事件
233
+ */
234
+ ANIMATION_REPEAT = 'animationRepeat',
235
+ }
236
+
237
+ /**
238
+ * 动画事件回调类型
239
+ */
240
+ export type AnimationEventHandler = (event: {
241
+ type: AnimationEventType;
242
+ animationType: AnimationType;
243
+ chartId?: string;
244
+ seriesIndex?: number;
245
+ dataIndex?: number;
246
+ timestamp: number;
247
+ duration: number;
248
+ }) => void;