@mathwiz/ui-components 0.1.22 → 0.1.23

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.
@@ -0,0 +1,1012 @@
1
+ /**
2
+ * 数学几何问题V4数据格式类型定义 - 完整版
3
+ *
4
+ * 基于实际JSON数据结构、组件类型和适配器实现整合的完整类型定义。
5
+ * 提供完整的V4数据格式类型安全支持,支持设计令牌、几何引用、样式引用等。
6
+ * 整合来源:
7
+ * 1. GeometryTransform组件类型定义
8
+ * 2. MathPracticeSessionTypes类型定义
9
+ * 3. GeometryProblemAdapterV4适配器类型
10
+ * 4. 实际V4 JSON数据结构(triangle-v4-final.json)
11
+ *
12
+ * @generatedBy math-geometry-problem-generator
13
+ * @version 2.0.0
14
+ * @schemaVersion 4.0.0
15
+ */
16
+ /**
17
+ * V4数据格式版本
18
+ */
19
+ export type V4SchemaVersion = '4.0.0';
20
+ /**
21
+ * 数学问题唯一标识符格式
22
+ * 格式:mp-{年级}-{单元}-{课程}-{类型}-{序号}
23
+ * 示例:mp-10506-0002-0002-G01-0001
24
+ */
25
+ export type MathProblemId = `mp-${string}-${string}-${string}-${string}-${string}`;
26
+ /**
27
+ * 几何形状类型 - 基于实际JSON和组件定义
28
+ */
29
+ export type GeometryShapeType = 'acute_triangle' | 'right_triangle' | 'obtuse_triangle' | 'parallelogram' | 'rectangle' | 'square' | 'trapezoid' | 'circle' | 'polygon' | 'segment' | 'point' | 'text';
30
+ /**
31
+ * 单位类型
32
+ */
33
+ export type LengthUnit = 'cm' | 'm' | 'mm' | 'in' | 'ft';
34
+ export type AreaUnit = 'cm²' | 'm²' | 'mm²' | 'in²' | 'ft²';
35
+ /**
36
+ * 难度等级(1-5)
37
+ */
38
+ export type DifficultyLevel = 1 | 2 | 3 | 4 | 5;
39
+ /**
40
+ * 场景类型 - 基于实际JSON和MathPracticeSessionTypes
41
+ */
42
+ export type SceneType = 'question' | 'solve' | 'review' | 'remember' | 'explanation' | 'success';
43
+ /**
44
+ * 内容块类型 - 基于实际JSON scenes.items
45
+ */
46
+ export type ContentType = 'text' | 'formula' | 'graph' | 'geometryTransform' | 'interactive';
47
+ /**
48
+ * 布局类型
49
+ */
50
+ export type LayoutType = 'vertical' | 'horizontal' | 'centered' | 'grid' | 'flow' | 'card';
51
+ /**
52
+ * 方向类型 - 基于GeometryTransform组件
53
+ */
54
+ export type DirectionType = 'clockwise' | 'counterclockwise' | 'horizontal' | 'vertical';
55
+ /**
56
+ * 缓动函数类型
57
+ */
58
+ export type EasingType = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'step';
59
+ /**
60
+ * 变换类型 - 基于GeometryTransform组件和JSON
61
+ */
62
+ export type TransformType = 'rotation' | 'translation' | 'scale' | 'composite' | 'matrix' | 'fillcolor_set';
63
+ /**
64
+ * 变换策略类型
65
+ */
66
+ export type TransformStrategy = 'double_rotation' | 'single_rotation' | 'translation' | 'composite';
67
+ /**
68
+ * 引用类型常量对象(替代枚举,兼容 erasableSyntaxOnly)
69
+ */
70
+ export declare const ReferenceType: {
71
+ readonly DESIGN_TOKEN: "design_token";
72
+ readonly STYLE_REF: "style_ref";
73
+ readonly GEOMETRY_REF: "geometry_ref";
74
+ readonly TRANSFORM_REF: "transform_ref";
75
+ readonly LAYOUT_REF: "layout_ref";
76
+ readonly ANIMATION_REF: "animation_ref";
77
+ readonly BOARD_REF: "board_ref";
78
+ readonly GEOMETRY_TRANSFORM_REF: "geometry_transform_ref";
79
+ readonly SLIDER_REF: "slider_ref";
80
+ readonly APPEARANCE_REF: "appearance_ref";
81
+ };
82
+ export type ReferenceType = typeof ReferenceType[keyof typeof ReferenceType];
83
+ /**
84
+ * 设计令牌引用
85
+ * 格式:$category.property
86
+ * 示例:$colors.primary, $fonts.heading_large
87
+ */
88
+ export type DesignTokenRef = `$${string}.${string}`;
89
+ /**
90
+ * 几何引用
91
+ * 格式:geometryRef:shape_id
92
+ * 示例:geometryRef:acute_triangle
93
+ */
94
+ export type GeometryRef = `geometryRef:${string}`;
95
+ /**
96
+ * 样式引用
97
+ * 格式:styleRef:style_id
98
+ * 示例:styleRef:primary
99
+ */
100
+ export type StyleRef = `styleRef:${string}`;
101
+ /**
102
+ * 变换引用
103
+ * 格式:transformRef:transform_id
104
+ * 示例:transformRef:left_rotation
105
+ */
106
+ export type TransformRef = `transformRef:${string}`;
107
+ /**
108
+ * 几何变换引用
109
+ * 格式:geometryTransformRef:config_id
110
+ * 示例:geometryTransformRef:double_rotation_proof
111
+ */
112
+ export type GeometryTransformRef = `geometryTransformRef:${string}`;
113
+ /**
114
+ * 滑块引用
115
+ * 格式:sliderRef:slider_id
116
+ * 示例:sliderRef:slider_horizontal
117
+ */
118
+ export type SliderRef = `sliderRef:${string}`;
119
+ /**
120
+ * 画板引用
121
+ * 格式:boardRef:board_id
122
+ * 示例:boardRef:default
123
+ */
124
+ export type BoardRef = `boardRef:${string}`;
125
+ /**
126
+ * 外观引用
127
+ * 格式:appearanceRef:appearance_id
128
+ * 示例:appearanceRef:always_visible
129
+ */
130
+ export type AppearanceRef = `appearanceRef:${string}`;
131
+ /**
132
+ * 顶点引用格式 - 基于实际JSON中的$ref引用
133
+ */
134
+ export interface VertexRef {
135
+ $ref: string;
136
+ }
137
+ /**
138
+ * 引用值类型 - 所有可能的引用格式
139
+ */
140
+ export type ReferenceValue = DesignTokenRef | GeometryRef | StyleRef | TransformRef | GeometryTransformRef | SliderRef | BoardRef | AppearanceRef | VertexRef | string;
141
+ /**
142
+ * 引用对象
143
+ */
144
+ export interface ReferenceObject {
145
+ type: ReferenceType;
146
+ value: string;
147
+ combined?: string;
148
+ }
149
+ /**
150
+ * 顶点格式 - 支持数组或对象格式
151
+ */
152
+ export type VertexFormat = [number, number] | readonly [number, number] | {
153
+ x: number;
154
+ y: number;
155
+ };
156
+ /**
157
+ * 标签配置
158
+ */
159
+ export interface LabelConfig {
160
+ /** 偏移量 */
161
+ offset?: [number, number];
162
+ /** 字体大小 */
163
+ fontSize?: number;
164
+ /** 颜色 */
165
+ color?: string;
166
+ /** 水平锚点 */
167
+ anchorX?: 'left' | 'middle' | 'right';
168
+ /** 垂直锚点 */
169
+ anchorY?: 'top' | 'middle' | 'bottom';
170
+ /** 标签内容(对于text类型) */
171
+ content?: string;
172
+ }
173
+ /**
174
+ * 几何形状定义 - 基于实际JSON结构和组件类型
175
+ * 用于geometry_shapes字段中的形状定义
176
+ */
177
+ export interface GeometryShapeDefinition {
178
+ /** 形状ID(必需) */
179
+ id: string;
180
+ /** 形状类型(必需) */
181
+ type: 'point' | 'segment' | 'line' | 'polygon' | 'circle' | 'text';
182
+ /** 名称(可选,用于标签) */
183
+ name?: string;
184
+ /** 顶点数组(多边形必需,支持顶点引用) */
185
+ vertices?: Array<VertexRef | VertexFormat> | ReadonlyArray<VertexRef | VertexFormat> | ReadonlyArray<readonly [number, number]> | any[];
186
+ /** 端点数组(线段必需,支持顶点引用) */
187
+ endpoints?: Array<VertexRef | VertexFormat> | ReadonlyArray<VertexRef | VertexFormat> | ReadonlyArray<readonly [number, number]> | any[];
188
+ /** 位置(点必需) */
189
+ position?: VertexFormat;
190
+ /** 半径(圆必需) */
191
+ radius?: number;
192
+ /** 是否显示标签 */
193
+ withLabel?: boolean;
194
+ /** 标签配置 */
195
+ label?: LabelConfig;
196
+ /** 描述信息 */
197
+ description?: string;
198
+ /** 样式引用(可以是完整引用或普通字符串) */
199
+ styleRef?: string;
200
+ /** 外观引用(可以是完整引用或普通字符串) */
201
+ appearanceRef?: string;
202
+ /** 扩展字段 */
203
+ [key: string]: any;
204
+ }
205
+ /**
206
+ * 图形样式配置
207
+ */
208
+ export interface ShapeStyle {
209
+ /** 填充颜色 */
210
+ fillColor?: string;
211
+ /** 填充透明度(0.0-1.0) */
212
+ fillOpacity?: number;
213
+ /** 描边颜色 */
214
+ strokeColor?: string;
215
+ /** 描边宽度 */
216
+ strokeWidth?: number;
217
+ /** 虚线样式 */
218
+ dashStyle?: number[];
219
+ /** 是否显示标签 */
220
+ labelVisible?: boolean;
221
+ /** 是否可见 */
222
+ visible?: boolean;
223
+ /** 大小(点类型) */
224
+ size?: number;
225
+ }
226
+ /**
227
+ * 动态外观配置 - 基于GeometryTransform组件
228
+ */
229
+ export interface DynamicAppearanceConfig {
230
+ /** 可见性控制 */
231
+ visibility?: {
232
+ type?: 'step' | 'fade';
233
+ threshold?: number;
234
+ startValue?: number;
235
+ endValue?: number;
236
+ easing?: EasingType;
237
+ };
238
+ /** 透明度控制 */
239
+ opacity?: {
240
+ type?: 'linear' | 'custom';
241
+ startAt?: number;
242
+ endAt?: number;
243
+ from?: number;
244
+ to?: number;
245
+ easing?: EasingType;
246
+ };
247
+ /** 颜色控制 */
248
+ color?: {
249
+ type?: 'gradient' | 'step';
250
+ startAt?: number;
251
+ endAt?: number;
252
+ from?: string;
253
+ to?: string;
254
+ easing?: EasingType;
255
+ };
256
+ /** 标签可见性控制 */
257
+ labelVisibility?: {
258
+ type?: 'step' | 'fade';
259
+ threshold?: number;
260
+ startValue?: number;
261
+ endValue?: number;
262
+ easing?: EasingType;
263
+ };
264
+ }
265
+ /**
266
+ * 图形元数据 - 基于GeometryTransform组件
267
+ */
268
+ export interface ShapeMetadata {
269
+ /** 图形ID(必需) */
270
+ id: string;
271
+ /** 标签 */
272
+ label?: string;
273
+ /** 是否可移动 */
274
+ isMovable?: boolean;
275
+ /** 是否静态 */
276
+ isStatic?: boolean;
277
+ /** 旋转组标识 */
278
+ rotationGroup?: string;
279
+ /** 变换配置来源 */
280
+ transformSource?: 'shape' | 'global';
281
+ /** 动态外观配置 */
282
+ dynamicAppearance?: DynamicAppearanceConfig;
283
+ }
284
+ /**
285
+ * 几何图形(用于变换配置) - 基于GeometryTransform组件
286
+ */
287
+ export interface GeometryShape {
288
+ /** 图形类型 */
289
+ type: GeometryShapeType;
290
+ /** 顶点数组 */
291
+ vertices: Array<[number, number]>;
292
+ /** 形状专属变换配置(优先于全局transform) */
293
+ transform?: TransformConfig;
294
+ /** 样式配置 */
295
+ style?: ShapeStyle;
296
+ /** 元数据 */
297
+ metadata?: ShapeMetadata;
298
+ /** 几何引用(可选,用于解析实际形状) */
299
+ geometryRef?: GeometryRef;
300
+ /** 样式引用(可选,覆盖style) */
301
+ styleRef?: StyleRef;
302
+ /** 外观引用(可选,用于动态外观) */
303
+ appearanceRef?: AppearanceRef;
304
+ }
305
+ /**
306
+ * 旋转变换配置 - 基于GeometryTransform组件和JSON
307
+ */
308
+ export interface RotationConfig {
309
+ center: [number, number] | 'auto';
310
+ startAngle: number;
311
+ endAngle: number;
312
+ direction: DirectionType;
313
+ }
314
+ /**
315
+ * 平移变换配置
316
+ */
317
+ export interface TranslationConfig {
318
+ direction: [number, number] | 'horizontal' | 'vertical';
319
+ distance: number;
320
+ startOffset?: number;
321
+ }
322
+ /**
323
+ * 缩放变换配置
324
+ */
325
+ export interface ScaleConfig {
326
+ center: [number, number] | 'centroid';
327
+ startScale: number;
328
+ endScale: number;
329
+ uniform: boolean;
330
+ }
331
+ /**
332
+ * 填充颜色设置配置
333
+ */
334
+ export interface FillColorSetConfig {
335
+ color: string;
336
+ opacity?: number;
337
+ }
338
+ /**
339
+ * 变换配置 - 基于GeometryTransform组件
340
+ */
341
+ export interface TransformConfig {
342
+ type: TransformType;
343
+ rotation?: RotationConfig;
344
+ translation?: TranslationConfig;
345
+ scale?: ScaleConfig;
346
+ composite?: TransformConfig[];
347
+ fillColorSet?: FillColorSetConfig;
348
+ targetGroup?: string;
349
+ }
350
+ /**
351
+ * 变换定义 - 基于JSON中的transform_definitions
352
+ */
353
+ export interface TransformDefinition {
354
+ id: string;
355
+ type: TransformType;
356
+ config: {
357
+ center?: {
358
+ x: number;
359
+ y: number;
360
+ } | [number, number] | 'auto' | 'centroid';
361
+ startAngle?: number;
362
+ endAngle?: number;
363
+ direction?: DirectionType;
364
+ distance?: number;
365
+ startScale?: number;
366
+ endScale?: number;
367
+ uniform?: boolean;
368
+ color?: string;
369
+ opacity?: number;
370
+ };
371
+ targetGroup?: string;
372
+ description?: string;
373
+ }
374
+ /**
375
+ * 变换配置或引用(支持transformRef引用或完整配置)
376
+ */
377
+ export type TransformConfigOrRef = {
378
+ transformRef: string;
379
+ } | TransformConfig;
380
+ /**
381
+ * 动画配置 - 基于GeometryTransform组件
382
+ */
383
+ export interface AnimationConfig {
384
+ /** 动画配置ID */
385
+ id: string;
386
+ /** 滑块配置 */
387
+ slider?: {
388
+ position: [number, number];
389
+ length: number;
390
+ orientation?: 'horizontal' | 'vertical';
391
+ min?: number;
392
+ max?: number;
393
+ step?: number;
394
+ };
395
+ /** 进度指示器配置 */
396
+ progressIndicator?: {
397
+ enabled: boolean;
398
+ stages?: number;
399
+ labels?: string[];
400
+ showPercentage?: boolean;
401
+ };
402
+ /** 动画持续时间(毫秒) */
403
+ duration?: number;
404
+ /** 缓动函数类型 */
405
+ easing?: EasingType;
406
+ /** 描述信息 */
407
+ description?: string;
408
+ }
409
+ /**
410
+ * 动画配置集合类型
411
+ * 用于animation_configs字段
412
+ */
413
+ export type AnimationConfigs = Record<string, AnimationConfig>;
414
+ /**
415
+ * 画板配置 - 基于GeometryTransform组件和JSON
416
+ */
417
+ export interface BoardConfig {
418
+ originX?: number;
419
+ originY?: number;
420
+ boundingBox?: [number, number, number, number];
421
+ keepAspectRatio?: boolean;
422
+ showGrid?: boolean;
423
+ showAxis?: boolean;
424
+ gridSize?: number;
425
+ axisColor?: string;
426
+ gridColor?: string;
427
+ }
428
+ /**
429
+ * 几何变换配置 - 基于JSON中的geometry_transform_configs
430
+ */
431
+ export interface GeometryTransformConfig {
432
+ /** 配置ID(必需) */
433
+ id: string;
434
+ /** 描述 */
435
+ description?: string;
436
+ /** 底边长度(必需) */
437
+ base: number;
438
+ /** 高度(必需) */
439
+ height: number;
440
+ /** 单位(必需) */
441
+ unit: LengthUnit;
442
+ /** 变换策略 */
443
+ strategy: TransformStrategy;
444
+ /** 图形定义(必需) */
445
+ shapes: {
446
+ /** 静态图形(保持不变) */
447
+ static: Array<{
448
+ id: string;
449
+ type: GeometryShapeType;
450
+ geometryRef: GeometryRef;
451
+ styleRef?: StyleRef;
452
+ appearanceRef?: AppearanceRef;
453
+ }>;
454
+ /** 动画图形(应用变换) */
455
+ animated: Array<{
456
+ id: string;
457
+ type: GeometryShapeType;
458
+ geometryRef: GeometryRef;
459
+ styleRef?: StyleRef;
460
+ appearanceRef?: AppearanceRef;
461
+ }>;
462
+ };
463
+ /** 变换配置(必需,支持transformRef引用或完整配置) */
464
+ transform: {
465
+ type: string;
466
+ transforms: any[];
467
+ executionMode?: string;
468
+ };
469
+ /** 滑块引用(必需) */
470
+ sliderRef: SliderRef;
471
+ /** 画板引用(必需) */
472
+ boardRef: BoardRef;
473
+ }
474
+ /**
475
+ * 场景定义 - 基于实际JSON scenes字段
476
+ */
477
+ export interface SceneDefinition {
478
+ /** 内容项数组 */
479
+ items?: ContentBlock[];
480
+ /** 向后兼容字段 */
481
+ content?: ContentBlock[];
482
+ /** 布局类型 */
483
+ layout?: {
484
+ type?: LayoutType;
485
+ spacing?: string;
486
+ alignment?: string;
487
+ cardStyle?: {
488
+ backgroundColor?: string;
489
+ borderColor?: string;
490
+ borderWidth?: string;
491
+ borderRadius?: string;
492
+ padding?: string;
493
+ margin?: string;
494
+ };
495
+ layoutRef?: string;
496
+ };
497
+ }
498
+ /**
499
+ * 内容块类型 - 基于实际JSON scenes.items
500
+ */
501
+ export type ContentBlock = TextContent | FormulaContent | GraphContent | GeometryTransformContent | InteractiveContent;
502
+ /**
503
+ * 文本内容
504
+ */
505
+ export interface TextContent {
506
+ type: 'text';
507
+ content: string;
508
+ styleRef?: StyleRef;
509
+ style?: Record<string, any>;
510
+ }
511
+ /**
512
+ * 公式内容
513
+ */
514
+ export interface FormulaContent {
515
+ type: 'formula';
516
+ content: string;
517
+ parts?: string[];
518
+ displayMode?: boolean;
519
+ styleRef?: StyleRef;
520
+ style?: Record<string, any>;
521
+ }
522
+ /**
523
+ * 图形形状(用于GraphContent)
524
+ */
525
+ export interface GraphShape {
526
+ id: string;
527
+ type: 'point' | 'segment' | 'polygon' | 'circle' | 'text';
528
+ geometryRef?: GeometryRef;
529
+ styleRef?: StyleRef;
530
+ position?: VertexFormat;
531
+ content?: string;
532
+ /** 点的大小(仅适用于type: 'point') */
533
+ size?: number;
534
+ style?: Record<string, any>;
535
+ }
536
+ /**
537
+ * 图形内容
538
+ */
539
+ export interface GraphContent {
540
+ type: 'graph';
541
+ shapes: GraphShape[];
542
+ boardRef?: BoardRef;
543
+ boundingBox?: [number, number, number, number];
544
+ showGrid?: boolean;
545
+ showAxis?: boolean;
546
+ autoBoundingBox?: boolean;
547
+ keepAspectRatio?: boolean;
548
+ }
549
+ /**
550
+ * 几何变换内容
551
+ */
552
+ export interface GeometryTransformContent {
553
+ type: 'geometryTransform';
554
+ geometryTransformRef: GeometryTransformRef;
555
+ metadata?: {
556
+ componentType: 'geometry-transform';
557
+ config?: Partial<GeometryTransformConfig>;
558
+ };
559
+ }
560
+ /**
561
+ * 交互内容
562
+ */
563
+ export interface InteractiveContent {
564
+ type: 'interactive';
565
+ component: string;
566
+ config: Record<string, any>;
567
+ }
568
+ /**
569
+ * 解释步骤 - 基于MathPracticeSessionTypes和实际JSON
570
+ */
571
+ export interface ExplanationStep {
572
+ id: string;
573
+ type: string;
574
+ title: string;
575
+ description: string;
576
+ chartConfig?: {
577
+ type: 'graph' | 'geometryTransform';
578
+ boardRef?: string;
579
+ shapes?: GraphShape[];
580
+ geometryTransformRef?: GeometryTransformRef;
581
+ config?: any;
582
+ boundingBox?: [number, number, number, number];
583
+ showGrid?: boolean;
584
+ showAxis?: boolean;
585
+ };
586
+ videoUrl?: string;
587
+ commonErrors?: string[];
588
+ difficulty?: number;
589
+ }
590
+ /**
591
+ * 解释数据 - 基于MathPracticeSessionTypes
592
+ */
593
+ export interface ExplanationData {
594
+ steps?: ExplanationStep[];
595
+ strategy?: string;
596
+ total_steps?: number;
597
+ estimated_time?: number;
598
+ hints?: Array<{
599
+ step: number;
600
+ text: string;
601
+ condition?: string;
602
+ }>;
603
+ videos?: Array<{
604
+ url: string;
605
+ title: string;
606
+ duration: number;
607
+ }>;
608
+ common_errors?: Array<{
609
+ description: string;
610
+ frequency: number;
611
+ prevention: string;
612
+ }>;
613
+ prerequisites?: string[];
614
+ learning_objectives?: string[];
615
+ }
616
+ /**
617
+ * 答案信息 - 基于实际JSON answer_info
618
+ */
619
+ export interface AnswerInfo {
620
+ value: number;
621
+ unit: string;
622
+ type?: string;
623
+ tolerance?: number;
624
+ validation?: {
625
+ type: string;
626
+ allowPartial?: boolean;
627
+ };
628
+ explanation_text: string;
629
+ solution_steps?: string[];
630
+ format?: {
631
+ decimal_places?: number;
632
+ allow_fraction?: boolean;
633
+ allow_negative?: boolean;
634
+ };
635
+ validation_rules?: {
636
+ required?: boolean;
637
+ min_value?: number;
638
+ max_value?: number;
639
+ exact_match?: boolean;
640
+ };
641
+ }
642
+ /**
643
+ * 问题元数据
644
+ */
645
+ export interface ProblemMetadata {
646
+ topic: string;
647
+ skill: string;
648
+ tags: string[];
649
+ version?: string;
650
+ author?: string;
651
+ strategy?: string;
652
+ estimatedTime?: number;
653
+ prerequisites?: string[];
654
+ learningObjectives?: string[];
655
+ [key: string]: any;
656
+ }
657
+ /**
658
+ * 基础信息 - 基于适配器类型和实际JSON
659
+ */
660
+ export interface BasicInfo {
661
+ question: string;
662
+ answerUnit?: string;
663
+ areaUnit?: string;
664
+ shape?: GeometryShapeType | string;
665
+ base?: number;
666
+ height?: number;
667
+ baseUnit?: string;
668
+ heightUnit?: string;
669
+ topBase?: number;
670
+ topBaseUnit?: string;
671
+ length?: number;
672
+ width?: number;
673
+ lengthUnit?: string;
674
+ widthUnit?: string;
675
+ side?: number;
676
+ sideUnit?: string;
677
+ diagonal1?: number;
678
+ diagonal2?: number;
679
+ diagonalUnit?: string;
680
+ score?: number;
681
+ variables?: Record<string, any>;
682
+ context?: {
683
+ learning_objective?: string;
684
+ prerequisite_skills?: string[];
685
+ time_estimate?: number;
686
+ };
687
+ originX?: number;
688
+ originY?: number;
689
+ unit?: string;
690
+ }
691
+ /**
692
+ * 布局配置
693
+ */
694
+ export interface LayoutConfig {
695
+ type?: string;
696
+ padding?: string;
697
+ theme?: string;
698
+ renderer?: {
699
+ showFormulaSteps?: boolean;
700
+ interactiveAnimations?: boolean;
701
+ validateAnswers?: boolean;
702
+ keepAspectRatio?: boolean;
703
+ };
704
+ }
705
+ /**
706
+ * V4数学几何问题数据接口 - 完整类型定义
707
+ */
708
+ export interface V4MathGeometryProblemData {
709
+ /** 数据格式版本,必须为"4.0.0" */
710
+ schema_version: V4SchemaVersion;
711
+ /** 配置版本 */
712
+ config_version?: string;
713
+ /** 数学问题唯一标识符 */
714
+ math_prob_id: MathProblemId;
715
+ /** 问题标题 */
716
+ title: string;
717
+ /** 问题描述 */
718
+ description?: string;
719
+ /** 学习目标 */
720
+ objective: string;
721
+ /** 难度等级(1-5) */
722
+ difficulty: DifficultyLevel;
723
+ /** 年级标识,如"g5"表示五年级 */
724
+ grade_id: string;
725
+ /** 单元名称 */
726
+ unit_name: string;
727
+ /** 课程名称 */
728
+ lesson_name: string;
729
+ /** 技能描述 */
730
+ skill_description: string;
731
+ /** 知识点列表 */
732
+ knowledge_points: string[];
733
+ /** 分数 */
734
+ score?: number;
735
+ /** 元数据 */
736
+ metadata?: ProblemMetadata;
737
+ /** 基础信息 */
738
+ basic_info: BasicInfo;
739
+ /** 几何形状定义 */
740
+ geometry_shapes: Record<string, GeometryShapeDefinition>;
741
+ /** 几何变换配置 */
742
+ geometry_transform_configs?: Record<string, GeometryTransformConfig>;
743
+ /** 变换定义 */
744
+ transform_definitions?: Record<string, TransformDefinition>;
745
+ /** 动画配置 */
746
+ animation_configs?: AnimationConfigs;
747
+ /** 场景定义 */
748
+ scenes: Record<SceneType, SceneDefinition>;
749
+ /** 解释说明 */
750
+ explanation: ExplanationData | ExplanationStep[];
751
+ /** 答案信息 */
752
+ answer_info: AnswerInfo;
753
+ /** 布局配置 */
754
+ layout?: LayoutConfig;
755
+ /** 可选字段 */
756
+ unit_id?: number;
757
+ lesson_id?: number;
758
+ module_id?: number;
759
+ skill_item_id?: string;
760
+ skill_id?: number;
761
+ created_at?: string;
762
+ updated_at?: string;
763
+ }
764
+ /**
765
+ * 适配器错误代码
766
+ */
767
+ export declare const AdapterErrorCode: {
768
+ readonly INVALID_INPUT: "INVALID_INPUT";
769
+ readonly MISSING_REQUIRED_FIELD: "MISSING_REQUIRED_FIELD";
770
+ readonly DESIGN_TOKEN_NOT_FOUND: "DESIGN_TOKEN_NOT_FOUND";
771
+ readonly GEOMETRY_REF_NOT_FOUND: "GEOMETRY_REF_NOT_FOUND";
772
+ readonly TRANSFORM_REF_NOT_FOUND: "TRANSFORM_REF_NOT_FOUND";
773
+ readonly GEOMETRY_TRANSFORM_REF_NOT_FOUND: "GEOMETRY_TRANSFORM_REF_NOT_FOUND";
774
+ readonly STYLE_REF_NOT_FOUND: "STYLE_REF_NOT_FOUND";
775
+ readonly ANIMATION_REF_NOT_FOUND: "ANIMATION_REF_NOT_FOUND";
776
+ readonly BOARD_REF_NOT_FOUND: "BOARD_REF_NOT_FOUND";
777
+ readonly SLIDER_REF_NOT_FOUND: "SLIDER_REF_NOT_FOUND";
778
+ readonly TRANSFORMATION_FAILED: "TRANSFORMATION_FAILED";
779
+ readonly OUTPUT_VALIDATION_FAILED: "OUTPUT_VALIDATION_FAILED";
780
+ };
781
+ export type AdapterErrorCode = typeof AdapterErrorCode[keyof typeof AdapterErrorCode];
782
+ /**
783
+ * 适配器错误
784
+ */
785
+ export declare class AdapterError extends Error {
786
+ code: AdapterErrorCode;
787
+ details?: Record<string, any>;
788
+ constructor(code: AdapterErrorCode, message: string, details?: Record<string, any>);
789
+ }
790
+ /**
791
+ * 适配器警告
792
+ */
793
+ export interface AdapterWarning {
794
+ code: AdapterErrorCode;
795
+ message: string;
796
+ path?: string;
797
+ suggestion?: string;
798
+ }
799
+ /**
800
+ * 性能统计
801
+ */
802
+ export interface PerformanceStats {
803
+ totalTime: number;
804
+ referenceResolutionTime: number;
805
+ transformationTime: number;
806
+ validationTime: number;
807
+ memoryUsage: number;
808
+ referenceCount: number;
809
+ }
810
+ /**
811
+ * 适配器结果
812
+ */
813
+ export interface AdapterResult {
814
+ /** 解析后的标准数据 */
815
+ data: any;
816
+ /** 警告信息列表 */
817
+ warnings: AdapterWarning[];
818
+ /** 性能统计 */
819
+ performance?: PerformanceStats;
820
+ /** 引用解析统计 */
821
+ referenceStats: {
822
+ total: number;
823
+ resolved: number;
824
+ failed: number;
825
+ byType: {
826
+ [key: string]: {
827
+ total: number;
828
+ resolved: number;
829
+ failed: number;
830
+ };
831
+ };
832
+ };
833
+ }
834
+ /**
835
+ * 同步适配器配置
836
+ */
837
+ export interface SyncAdapterConfig {
838
+ /** 是否启用严格模式(错误时抛出异常) */
839
+ strictMode?: boolean;
840
+ /** 是否启用详细日志 */
841
+ enableLogging?: boolean;
842
+ /** 验证级别 */
843
+ validationLevel?: 'none' | 'basic' | 'strict';
844
+ /** 错误时是否回退到默认数据 */
845
+ fallbackOnError?: boolean;
846
+ /** 是否启用引用解析 */
847
+ enableReferenceResolution?: boolean;
848
+ /** 是否启用组件契约验证 */
849
+ enableComponentContractValidation?: boolean;
850
+ /** 最大引用解析深度 */
851
+ maxReferenceDepth?: number;
852
+ /** 是否启用性能监控 */
853
+ enablePerformanceMonitoring?: boolean;
854
+ }
855
+ /**
856
+ * MathCardV2 数学练习问题数据 - 基于MathPracticeSessionTypes
857
+ */
858
+ export interface MathPracticeProblemData {
859
+ id: string;
860
+ title: string;
861
+ grade: number;
862
+ unit: string;
863
+ lesson: string;
864
+ skill: string;
865
+ objective: string;
866
+ knowledgePoints: string[];
867
+ difficulty: number;
868
+ metadata: ProblemMetadata;
869
+ description?: string;
870
+ basicInfo: {
871
+ question: string;
872
+ answerUnit?: string;
873
+ areaUnit?: string;
874
+ shape?: string;
875
+ base?: number;
876
+ height?: number;
877
+ baseUnit?: string;
878
+ heightUnit?: string;
879
+ score?: number;
880
+ variables?: Record<string, any>;
881
+ context?: {
882
+ learning_objective?: string;
883
+ prerequisite_skills?: string[];
884
+ time_estimate?: number;
885
+ };
886
+ length?: number;
887
+ width?: number;
888
+ lengthUnit?: string;
889
+ widthUnit?: string;
890
+ };
891
+ scenes: {
892
+ question: {
893
+ items: ContentBlock[];
894
+ layout?: {
895
+ type?: string;
896
+ spacing?: string;
897
+ alignment?: string;
898
+ };
899
+ };
900
+ solve: {
901
+ items: ContentBlock[];
902
+ layout?: {
903
+ type?: string;
904
+ spacing?: string;
905
+ alignment?: string;
906
+ cardStyle?: {
907
+ backgroundColor?: string;
908
+ borderColor?: string;
909
+ borderWidth?: string;
910
+ };
911
+ };
912
+ };
913
+ review: {
914
+ items: ContentBlock[];
915
+ layout?: {
916
+ type?: string;
917
+ spacing?: string;
918
+ alignment?: string;
919
+ };
920
+ };
921
+ remember?: {
922
+ items: ContentBlock[];
923
+ layout?: {
924
+ type?: string;
925
+ spacing?: string;
926
+ alignment?: string;
927
+ cardStyle?: {
928
+ backgroundColor?: string;
929
+ borderColor?: string;
930
+ borderWidth?: string;
931
+ };
932
+ };
933
+ };
934
+ };
935
+ explanation: ExplanationData | ExplanationStep[];
936
+ answer: {
937
+ value: number;
938
+ unit: string;
939
+ explanation: string;
940
+ };
941
+ answer_info?: AnswerInfo;
942
+ math_prob_id?: string;
943
+ grade_id?: string;
944
+ unit_id?: number;
945
+ lesson_id?: number;
946
+ module_id?: number;
947
+ skill_item_id?: string;
948
+ skill_id?: number;
949
+ created_at?: string;
950
+ updated_at?: string;
951
+ layout?: {
952
+ type?: string;
953
+ padding?: string;
954
+ theme?: string;
955
+ renderer?: Record<string, any>;
956
+ };
957
+ }
958
+ /**
959
+ * 类型守卫:检查是否为V4数据
960
+ */
961
+ export declare function isV4Data(data: any): data is V4MathGeometryProblemData;
962
+ /**
963
+ * 类型守卫:检查是否为几何变换内容
964
+ */
965
+ export declare function isGeometryTransformContent(content: ContentBlock): content is GeometryTransformContent;
966
+ /**
967
+ * 类型守卫:检查是否为设计令牌引用
968
+ */
969
+ export declare function isDesignTokenRef(ref: string): ref is DesignTokenRef;
970
+ /**
971
+ * 类型守卫:检查是否为几何引用
972
+ */
973
+ export declare function isGeometryRef(ref: string): ref is GeometryRef;
974
+ /**
975
+ * 类型守卫:检查是否为变换引用
976
+ */
977
+ export declare function isTransformRef(ref: string): ref is TransformRef;
978
+ /**
979
+ * 类型守卫:检查是否为几何变换引用
980
+ */
981
+ export declare function isGeometryTransformRef(ref: string): ref is GeometryTransformRef;
982
+ /**
983
+ * 提取引用类型
984
+ */
985
+ export declare function extractReferenceType(ref: string): ReferenceType | null;
986
+ /**
987
+ * 创建引用对象
988
+ */
989
+ export declare function createReferenceObject(ref: string): ReferenceObject | null;
990
+ /**
991
+ * 标准化解释数据:将任何格式转换为标准ExplanationData对象
992
+ */
993
+ export declare function normalizeExplanation(explanation: ExplanationData | ExplanationStep[] | any[]): ExplanationData;
994
+ /**
995
+ * 原始几何问题数据接口 (V4 格式) - 适配器使用的原始类型
996
+ * @deprecated 使用V4MathGeometryProblemData替代
997
+ */
998
+ export interface LegacyGeometryProblemDataV4 extends Omit<V4MathGeometryProblemData, 'geometry_shapes' | 'transform_definitions' | 'scenes' | 'explanation'> {
999
+ /** 几何形状定义 */
1000
+ geometry_shapes: Record<string, any>;
1001
+ /** 变换定义 */
1002
+ transform_definitions: Record<string, any>;
1003
+ /** 场景内容 */
1004
+ scenes: Record<string, {
1005
+ content?: any[];
1006
+ items?: any[];
1007
+ layout?: any;
1008
+ }>;
1009
+ /** 解释内容 */
1010
+ explanation: any;
1011
+ }
1012
+ //# sourceMappingURL=geometry-types.d.ts.map