@mathscan/math-exercise-engine 1.1.6 → 1.1.8
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/index.d.ts +420 -0
- package/dist/index.js +1181 -270
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1181 -270
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +54 -23
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -77,6 +77,12 @@ export declare const AST_TYPES: {
|
|
|
77
77
|
readonly RADIO_OPTIONS: "RadioOptions";
|
|
78
78
|
/** Numeric keypad input tool */
|
|
79
79
|
readonly NUMERIC_KEYPAD: "NumericKeypad";
|
|
80
|
+
/** Geometry ruler tool */
|
|
81
|
+
readonly GEOMETRY_RULER: "GeometryRuler";
|
|
82
|
+
/** Geometry protractor tool */
|
|
83
|
+
readonly GEOMETRY_PROTRACTOR: "GeometryProtractor";
|
|
84
|
+
/** Geometry set square tool */
|
|
85
|
+
readonly GEOMETRY_SET_SQUARE: "GeometrySetSquare";
|
|
80
86
|
/** Simple answer matching validation */
|
|
81
87
|
readonly SIMPLE_VALIDATION: "SimpleValidation";
|
|
82
88
|
/** Expression-based validation */
|
|
@@ -874,6 +880,15 @@ export declare function compileWithAST(dsl: string): {
|
|
|
874
880
|
style?: "diamond" | "classic" | undefined;
|
|
875
881
|
includeOperators?: boolean | undefined;
|
|
876
882
|
includeDecimal?: boolean | undefined;
|
|
883
|
+
} | {
|
|
884
|
+
type: "GeometryRuler";
|
|
885
|
+
size: number;
|
|
886
|
+
} | {
|
|
887
|
+
type: "GeometryProtractor";
|
|
888
|
+
size: number;
|
|
889
|
+
} | {
|
|
890
|
+
type: "GeometrySetSquare";
|
|
891
|
+
size: number;
|
|
877
892
|
})[] | undefined;
|
|
878
893
|
};
|
|
879
894
|
json: {
|
|
@@ -946,6 +961,15 @@ export declare function compileWithAST(dsl: string): {
|
|
|
946
961
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
947
962
|
label?: string | undefined;
|
|
948
963
|
size?: number | undefined;
|
|
964
|
+
} | {
|
|
965
|
+
type: "ruler";
|
|
966
|
+
size?: number | undefined;
|
|
967
|
+
} | {
|
|
968
|
+
type: "protractor";
|
|
969
|
+
size?: number | undefined;
|
|
970
|
+
} | {
|
|
971
|
+
type: "set-square";
|
|
972
|
+
size?: number | undefined;
|
|
949
973
|
}>;
|
|
950
974
|
validation?: {
|
|
951
975
|
mode: "simple" | "expression" | "mixed";
|
|
@@ -5442,6 +5466,12 @@ export declare function createNumericKeypad(includeOperators?: boolean, includeD
|
|
|
5442
5466
|
|
|
5443
5467
|
export declare function createPairMatcherBlock(name: string, topItems: MatcherItem[], bottomItems: MatcherItem[], answers: [string, string][]): PairMatcherBlock;
|
|
5444
5468
|
|
|
5469
|
+
export declare function createProtractorTool(size?: number): ProtractorTool;
|
|
5470
|
+
|
|
5471
|
+
export declare function createRulerTool(size?: number): RulerTool;
|
|
5472
|
+
|
|
5473
|
+
export declare function createSetSquareTool(size?: number): SetSquareTool;
|
|
5474
|
+
|
|
5445
5475
|
/**
|
|
5446
5476
|
* Create a simple validation node
|
|
5447
5477
|
*/
|
|
@@ -10183,6 +10213,33 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
10183
10213
|
style?: "diamond" | "classic" | undefined;
|
|
10184
10214
|
includeOperators?: boolean | undefined;
|
|
10185
10215
|
includeDecimal?: boolean | undefined;
|
|
10216
|
+
}>, z.ZodObject<{
|
|
10217
|
+
type: z.ZodLiteral<"GeometryRuler">;
|
|
10218
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
10219
|
+
}, "strip", z.ZodTypeAny, {
|
|
10220
|
+
type: "GeometryRuler";
|
|
10221
|
+
size: number;
|
|
10222
|
+
}, {
|
|
10223
|
+
type: "GeometryRuler";
|
|
10224
|
+
size?: number | undefined;
|
|
10225
|
+
}>, z.ZodObject<{
|
|
10226
|
+
type: z.ZodLiteral<"GeometryProtractor">;
|
|
10227
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
10228
|
+
}, "strip", z.ZodTypeAny, {
|
|
10229
|
+
type: "GeometryProtractor";
|
|
10230
|
+
size: number;
|
|
10231
|
+
}, {
|
|
10232
|
+
type: "GeometryProtractor";
|
|
10233
|
+
size?: number | undefined;
|
|
10234
|
+
}>, z.ZodObject<{
|
|
10235
|
+
type: z.ZodLiteral<"GeometrySetSquare">;
|
|
10236
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
10237
|
+
}, "strip", z.ZodTypeAny, {
|
|
10238
|
+
type: "GeometrySetSquare";
|
|
10239
|
+
size: number;
|
|
10240
|
+
}, {
|
|
10241
|
+
type: "GeometrySetSquare";
|
|
10242
|
+
size?: number | undefined;
|
|
10186
10243
|
}>]>, "many">>;
|
|
10187
10244
|
validation: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
10188
10245
|
type: z.ZodLiteral<"SimpleValidation">;
|
|
@@ -10738,6 +10795,15 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
10738
10795
|
style?: "diamond" | "classic" | undefined;
|
|
10739
10796
|
includeOperators?: boolean | undefined;
|
|
10740
10797
|
includeDecimal?: boolean | undefined;
|
|
10798
|
+
} | {
|
|
10799
|
+
type: "GeometryRuler";
|
|
10800
|
+
size: number;
|
|
10801
|
+
} | {
|
|
10802
|
+
type: "GeometryProtractor";
|
|
10803
|
+
size: number;
|
|
10804
|
+
} | {
|
|
10805
|
+
type: "GeometrySetSquare";
|
|
10806
|
+
size: number;
|
|
10741
10807
|
})[] | undefined;
|
|
10742
10808
|
}, {
|
|
10743
10809
|
type: "ExerciseDocument";
|
|
@@ -11268,6 +11334,15 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
11268
11334
|
style?: "diamond" | "classic" | undefined;
|
|
11269
11335
|
includeOperators?: boolean | undefined;
|
|
11270
11336
|
includeDecimal?: boolean | undefined;
|
|
11337
|
+
} | {
|
|
11338
|
+
type: "GeometryRuler";
|
|
11339
|
+
size?: number | undefined;
|
|
11340
|
+
} | {
|
|
11341
|
+
type: "GeometryProtractor";
|
|
11342
|
+
size?: number | undefined;
|
|
11343
|
+
} | {
|
|
11344
|
+
type: "GeometrySetSquare";
|
|
11345
|
+
size?: number | undefined;
|
|
11271
11346
|
})[] | undefined;
|
|
11272
11347
|
}>, {
|
|
11273
11348
|
type: "ExerciseDocument";
|
|
@@ -11798,6 +11873,15 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
11798
11873
|
style?: "diamond" | "classic" | undefined;
|
|
11799
11874
|
includeOperators?: boolean | undefined;
|
|
11800
11875
|
includeDecimal?: boolean | undefined;
|
|
11876
|
+
} | {
|
|
11877
|
+
type: "GeometryRuler";
|
|
11878
|
+
size: number;
|
|
11879
|
+
} | {
|
|
11880
|
+
type: "GeometryProtractor";
|
|
11881
|
+
size: number;
|
|
11882
|
+
} | {
|
|
11883
|
+
type: "GeometrySetSquare";
|
|
11884
|
+
size: number;
|
|
11801
11885
|
})[] | undefined;
|
|
11802
11886
|
}, {
|
|
11803
11887
|
type: "ExerciseDocument";
|
|
@@ -12328,6 +12412,15 @@ export declare const ExerciseDocumentSchema: z.ZodEffects<z.ZodObject<{
|
|
|
12328
12412
|
style?: "diamond" | "classic" | undefined;
|
|
12329
12413
|
includeOperators?: boolean | undefined;
|
|
12330
12414
|
includeDecimal?: boolean | undefined;
|
|
12415
|
+
} | {
|
|
12416
|
+
type: "GeometryRuler";
|
|
12417
|
+
size?: number | undefined;
|
|
12418
|
+
} | {
|
|
12419
|
+
type: "GeometryProtractor";
|
|
12420
|
+
size?: number | undefined;
|
|
12421
|
+
} | {
|
|
12422
|
+
type: "GeometrySetSquare";
|
|
12423
|
+
size?: number | undefined;
|
|
12331
12424
|
})[] | undefined;
|
|
12332
12425
|
}>;
|
|
12333
12426
|
|
|
@@ -12617,6 +12710,33 @@ export declare const ExerciseJSONSchema: z.ZodObject<{
|
|
|
12617
12710
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
12618
12711
|
label?: string | undefined;
|
|
12619
12712
|
size?: number | undefined;
|
|
12713
|
+
}>, z.ZodObject<{
|
|
12714
|
+
type: z.ZodLiteral<"ruler">;
|
|
12715
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
12716
|
+
}, "strip", z.ZodTypeAny, {
|
|
12717
|
+
type: "ruler";
|
|
12718
|
+
size?: number | undefined;
|
|
12719
|
+
}, {
|
|
12720
|
+
type: "ruler";
|
|
12721
|
+
size?: number | undefined;
|
|
12722
|
+
}>, z.ZodObject<{
|
|
12723
|
+
type: z.ZodLiteral<"protractor">;
|
|
12724
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
12725
|
+
}, "strip", z.ZodTypeAny, {
|
|
12726
|
+
type: "protractor";
|
|
12727
|
+
size?: number | undefined;
|
|
12728
|
+
}, {
|
|
12729
|
+
type: "protractor";
|
|
12730
|
+
size?: number | undefined;
|
|
12731
|
+
}>, z.ZodObject<{
|
|
12732
|
+
type: z.ZodLiteral<"set-square">;
|
|
12733
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
12734
|
+
}, "strip", z.ZodTypeAny, {
|
|
12735
|
+
type: "set-square";
|
|
12736
|
+
size?: number | undefined;
|
|
12737
|
+
}, {
|
|
12738
|
+
type: "set-square";
|
|
12739
|
+
size?: number | undefined;
|
|
12620
12740
|
}>]>>;
|
|
12621
12741
|
validation: z.ZodOptional<z.ZodObject<{
|
|
12622
12742
|
mode: z.ZodEnum<["simple", "expression", "mixed"]>;
|
|
@@ -12720,6 +12840,15 @@ export declare const ExerciseJSONSchema: z.ZodObject<{
|
|
|
12720
12840
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
12721
12841
|
label?: string | undefined;
|
|
12722
12842
|
size?: number | undefined;
|
|
12843
|
+
} | {
|
|
12844
|
+
type: "ruler";
|
|
12845
|
+
size?: number | undefined;
|
|
12846
|
+
} | {
|
|
12847
|
+
type: "protractor";
|
|
12848
|
+
size?: number | undefined;
|
|
12849
|
+
} | {
|
|
12850
|
+
type: "set-square";
|
|
12851
|
+
size?: number | undefined;
|
|
12723
12852
|
}>;
|
|
12724
12853
|
validation?: {
|
|
12725
12854
|
mode: "simple" | "expression" | "mixed";
|
|
@@ -12804,6 +12933,15 @@ export declare const ExerciseJSONSchema: z.ZodObject<{
|
|
|
12804
12933
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
12805
12934
|
label?: string | undefined;
|
|
12806
12935
|
size?: number | undefined;
|
|
12936
|
+
} | {
|
|
12937
|
+
type: "ruler";
|
|
12938
|
+
size?: number | undefined;
|
|
12939
|
+
} | {
|
|
12940
|
+
type: "protractor";
|
|
12941
|
+
size?: number | undefined;
|
|
12942
|
+
} | {
|
|
12943
|
+
type: "set-square";
|
|
12944
|
+
size?: number | undefined;
|
|
12807
12945
|
}>;
|
|
12808
12946
|
validation?: {
|
|
12809
12947
|
mode: "simple" | "expression" | "mixed";
|
|
@@ -12853,11 +12991,17 @@ export declare interface ExerciseRendererProps {
|
|
|
12853
12991
|
onChange?: (values: Record<string, UserAnswerValue>) => void;
|
|
12854
12992
|
showSubmitButton?: boolean;
|
|
12855
12993
|
className?: string;
|
|
12994
|
+
/** Master on/off for interaction sounds (default true). */
|
|
12995
|
+
soundEnabled?: boolean;
|
|
12996
|
+
/** Maps sound events → URL or callback. Omitted events stay silent. */
|
|
12997
|
+
sounds?: SoundConfig;
|
|
12856
12998
|
}
|
|
12857
12999
|
|
|
12858
13000
|
export declare interface ExerciseRendererRef {
|
|
12859
13001
|
submit: () => ValidationResult;
|
|
12860
13002
|
getValues: () => Record<string, UserAnswerValue>;
|
|
13003
|
+
/** Fill status of the answerable inputs — caller decides when to block submit. */
|
|
13004
|
+
getCompletion: () => InputCompletion;
|
|
12861
13005
|
reset: () => void;
|
|
12862
13006
|
focusFirstInput: () => void;
|
|
12863
13007
|
}
|
|
@@ -13004,6 +13148,16 @@ export declare const FreeTextInlineSchema: z.ZodObject<{
|
|
|
13004
13148
|
type: "FreeText";
|
|
13005
13149
|
}>;
|
|
13006
13150
|
|
|
13151
|
+
/**
|
|
13152
|
+
* List every widget the exercise expects an answer for (simple answers,
|
|
13153
|
+
* expression variables, or both in mixed mode). Empty when the exercise has
|
|
13154
|
+
* no validation (display-only / hint exercises).
|
|
13155
|
+
*
|
|
13156
|
+
* @param exercise - The exercise JSON
|
|
13157
|
+
* @returns Array of answerable widget IDs
|
|
13158
|
+
*/
|
|
13159
|
+
export declare function getAnswerableInputs(exercise: ExerciseJSON): string[];
|
|
13160
|
+
|
|
13007
13161
|
export declare function getFractionKey(widgetId: string, part: FractionPart): string;
|
|
13008
13162
|
|
|
13009
13163
|
/**
|
|
@@ -13531,6 +13685,22 @@ export declare const InlineNodeSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
13531
13685
|
snap?: number | undefined;
|
|
13532
13686
|
}>]>]>;
|
|
13533
13687
|
|
|
13688
|
+
/** Snapshot of how many answerable inputs are currently filled. */
|
|
13689
|
+
export declare interface InputCompletion {
|
|
13690
|
+
/** Number of widgets the exercise expects an answer for (0 = display-only). */
|
|
13691
|
+
total: number;
|
|
13692
|
+
/** How many of those currently have a usable value. */
|
|
13693
|
+
filled: number;
|
|
13694
|
+
/** Widget IDs still empty. */
|
|
13695
|
+
missing: string[];
|
|
13696
|
+
/** Widget IDs that have a value. */
|
|
13697
|
+
filledIds: string[];
|
|
13698
|
+
/** true when there is at least one input AND none are missing. */
|
|
13699
|
+
isComplete: boolean;
|
|
13700
|
+
/** true when at least one input has a value. */
|
|
13701
|
+
isAnyFilled: boolean;
|
|
13702
|
+
}
|
|
13703
|
+
|
|
13534
13704
|
/**
|
|
13535
13705
|
* Type guard for BoldText
|
|
13536
13706
|
*/
|
|
@@ -13660,6 +13830,15 @@ export declare function isPairMatcherBlock(value: unknown): value is PairMatcher
|
|
|
13660
13830
|
|
|
13661
13831
|
export declare function isPairMatcherWidget(widget: WidgetJSON): widget is PairMatcherWidgetJSON;
|
|
13662
13832
|
|
|
13833
|
+
export declare function isProtractorTool(value: unknown): value is ProtractorTool;
|
|
13834
|
+
|
|
13835
|
+
/**
|
|
13836
|
+
* Type guard for ProtractorWidgetJSON
|
|
13837
|
+
*/
|
|
13838
|
+
export declare function isProtractorWidget(widget: WidgetJSON): widget is Extract<WidgetJSON, {
|
|
13839
|
+
type: 'protractor';
|
|
13840
|
+
}>;
|
|
13841
|
+
|
|
13663
13842
|
/**
|
|
13664
13843
|
* Type guard for QuestionText
|
|
13665
13844
|
*/
|
|
@@ -13674,6 +13853,24 @@ export declare function isRadioOptionsJSON(widget: WidgetJSON): widget is Extrac
|
|
|
13674
13853
|
type: 'radio-options';
|
|
13675
13854
|
}>;
|
|
13676
13855
|
|
|
13856
|
+
export declare function isRulerTool(value: unknown): value is RulerTool;
|
|
13857
|
+
|
|
13858
|
+
/**
|
|
13859
|
+
* Type guard for RulerWidgetJSON
|
|
13860
|
+
*/
|
|
13861
|
+
export declare function isRulerWidget(widget: WidgetJSON): widget is Extract<WidgetJSON, {
|
|
13862
|
+
type: 'ruler';
|
|
13863
|
+
}>;
|
|
13864
|
+
|
|
13865
|
+
export declare function isSetSquareTool(value: unknown): value is SetSquareTool;
|
|
13866
|
+
|
|
13867
|
+
/**
|
|
13868
|
+
* Type guard for SetSquareWidgetJSON
|
|
13869
|
+
*/
|
|
13870
|
+
export declare function isSetSquareWidget(widget: WidgetJSON): widget is Extract<WidgetJSON, {
|
|
13871
|
+
type: 'set-square';
|
|
13872
|
+
}>;
|
|
13873
|
+
|
|
13677
13874
|
export declare function isSimpleValidation(value: unknown): value is SimpleValidation;
|
|
13678
13875
|
|
|
13679
13876
|
export declare function isSpace(value: unknown): value is SpaceInline;
|
|
@@ -13829,6 +14026,12 @@ export declare const JSON_TYPES: {
|
|
|
13829
14026
|
readonly FRACTION: "fraction";
|
|
13830
14027
|
/** Visual fraction widget */
|
|
13831
14028
|
readonly VISUAL_FRACTION: "visual-fraction";
|
|
14029
|
+
/** Ruler geometry tool widget */
|
|
14030
|
+
readonly RULER: "ruler";
|
|
14031
|
+
/** Protractor geometry tool widget */
|
|
14032
|
+
readonly PROTRACTOR: "protractor";
|
|
14033
|
+
/** Set square geometry tool widget */
|
|
14034
|
+
readonly SET_SQUARE: "set-square";
|
|
13832
14035
|
};
|
|
13833
14036
|
|
|
13834
14037
|
/**
|
|
@@ -18811,6 +19014,32 @@ export declare function parseSafe(tokens: IToken[]): {
|
|
|
18811
19014
|
cst?: undefined;
|
|
18812
19015
|
};
|
|
18813
19016
|
|
|
19017
|
+
export declare type ProtractorTool = z.infer<typeof ProtractorToolSchema>;
|
|
19018
|
+
|
|
19019
|
+
export declare const ProtractorToolSchema: z.ZodObject<{
|
|
19020
|
+
type: z.ZodLiteral<"GeometryProtractor">;
|
|
19021
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
19022
|
+
}, "strip", z.ZodTypeAny, {
|
|
19023
|
+
type: "GeometryProtractor";
|
|
19024
|
+
size: number;
|
|
19025
|
+
}, {
|
|
19026
|
+
type: "GeometryProtractor";
|
|
19027
|
+
size?: number | undefined;
|
|
19028
|
+
}>;
|
|
19029
|
+
|
|
19030
|
+
export declare type ProtractorWidgetJSON = z.infer<typeof ProtractorWidgetSchema>;
|
|
19031
|
+
|
|
19032
|
+
export declare const ProtractorWidgetSchema: z.ZodObject<{
|
|
19033
|
+
type: z.ZodLiteral<"protractor">;
|
|
19034
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
19035
|
+
}, "strip", z.ZodTypeAny, {
|
|
19036
|
+
type: "protractor";
|
|
19037
|
+
size?: number | undefined;
|
|
19038
|
+
}, {
|
|
19039
|
+
type: "protractor";
|
|
19040
|
+
size?: number | undefined;
|
|
19041
|
+
}>;
|
|
19042
|
+
|
|
18814
19043
|
export declare type QuestionText = z.infer<typeof QuestionTextSchema>;
|
|
18815
19044
|
|
|
18816
19045
|
export declare const QuestionTextSchema: z.ZodObject<{
|
|
@@ -18905,6 +19134,58 @@ export declare interface RenderOptions {
|
|
|
18905
19134
|
className?: string;
|
|
18906
19135
|
}
|
|
18907
19136
|
|
|
19137
|
+
export declare type RulerTool = z.infer<typeof RulerToolSchema>;
|
|
19138
|
+
|
|
19139
|
+
export declare const RulerToolSchema: z.ZodObject<{
|
|
19140
|
+
type: z.ZodLiteral<"GeometryRuler">;
|
|
19141
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
19142
|
+
}, "strip", z.ZodTypeAny, {
|
|
19143
|
+
type: "GeometryRuler";
|
|
19144
|
+
size: number;
|
|
19145
|
+
}, {
|
|
19146
|
+
type: "GeometryRuler";
|
|
19147
|
+
size?: number | undefined;
|
|
19148
|
+
}>;
|
|
19149
|
+
|
|
19150
|
+
export declare type RulerWidgetJSON = z.infer<typeof RulerWidgetSchema>;
|
|
19151
|
+
|
|
19152
|
+
export declare const RulerWidgetSchema: z.ZodObject<{
|
|
19153
|
+
type: z.ZodLiteral<"ruler">;
|
|
19154
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
19155
|
+
}, "strip", z.ZodTypeAny, {
|
|
19156
|
+
type: "ruler";
|
|
19157
|
+
size?: number | undefined;
|
|
19158
|
+
}, {
|
|
19159
|
+
type: "ruler";
|
|
19160
|
+
size?: number | undefined;
|
|
19161
|
+
}>;
|
|
19162
|
+
|
|
19163
|
+
export declare type SetSquareTool = z.infer<typeof SetSquareToolSchema>;
|
|
19164
|
+
|
|
19165
|
+
export declare const SetSquareToolSchema: z.ZodObject<{
|
|
19166
|
+
type: z.ZodLiteral<"GeometrySetSquare">;
|
|
19167
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
19168
|
+
}, "strip", z.ZodTypeAny, {
|
|
19169
|
+
type: "GeometrySetSquare";
|
|
19170
|
+
size: number;
|
|
19171
|
+
}, {
|
|
19172
|
+
type: "GeometrySetSquare";
|
|
19173
|
+
size?: number | undefined;
|
|
19174
|
+
}>;
|
|
19175
|
+
|
|
19176
|
+
export declare type SetSquareWidgetJSON = z.infer<typeof SetSquareWidgetSchema>;
|
|
19177
|
+
|
|
19178
|
+
export declare const SetSquareWidgetSchema: z.ZodObject<{
|
|
19179
|
+
type: z.ZodLiteral<"set-square">;
|
|
19180
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
19181
|
+
}, "strip", z.ZodTypeAny, {
|
|
19182
|
+
type: "set-square";
|
|
19183
|
+
size?: number | undefined;
|
|
19184
|
+
}, {
|
|
19185
|
+
type: "set-square";
|
|
19186
|
+
size?: number | undefined;
|
|
19187
|
+
}>;
|
|
19188
|
+
|
|
18908
19189
|
export declare type SimpleValidation = z.infer<typeof SimpleValidationSchema>;
|
|
18909
19190
|
|
|
18910
19191
|
/**
|
|
@@ -18928,6 +19209,31 @@ export declare const SimpleValidationSchema: z.ZodObject<{
|
|
|
18928
19209
|
type: "SimpleValidation";
|
|
18929
19210
|
}>;
|
|
18930
19211
|
|
|
19212
|
+
/**
|
|
19213
|
+
* Maps a sound event to either:
|
|
19214
|
+
* - a `string` URL (renderer plays it via the native Audio API), or
|
|
19215
|
+
* - a `() => void` callback (consumer owns playback — preloading, mobile
|
|
19216
|
+
* unlock, volume, etc.).
|
|
19217
|
+
* Omitted events are silent.
|
|
19218
|
+
*/
|
|
19219
|
+
export declare type SoundConfig = Partial<Record<SoundEvent, string | (() => void)>>;
|
|
19220
|
+
|
|
19221
|
+
/** All sound events the renderer can emit. */
|
|
19222
|
+
export declare type SoundEvent = 'drag-start' | 'drag-drop' | 'drag-cancel' | 'radio-select' | 'pair-select' | 'pair-link' | 'pair-unlink' | 'keypad-press' | 'matcher-select' | 'fraction-shade' | 'clock-hour-tick' | 'clock-minute-tick' | 'counter-step' | 'input-select' | 'answer-correct' | 'answer-wrong';
|
|
19223
|
+
|
|
19224
|
+
export declare const SoundProvider: default_2.FC<SoundProviderProps>;
|
|
19225
|
+
|
|
19226
|
+
export declare interface SoundProviderProps {
|
|
19227
|
+
children: default_2.ReactNode;
|
|
19228
|
+
/** Master on/off switch. When false, `play()` is a no-op. */
|
|
19229
|
+
enabled?: boolean;
|
|
19230
|
+
/**
|
|
19231
|
+
* Per-event overrides (URL or callback), merged over the bundled defaults.
|
|
19232
|
+
* Omit to use the built-in sounds for every event.
|
|
19233
|
+
*/
|
|
19234
|
+
sounds?: SoundConfig;
|
|
19235
|
+
}
|
|
19236
|
+
|
|
18931
19237
|
/**
|
|
18932
19238
|
* Source position information for error reporting
|
|
18933
19239
|
*/
|
|
@@ -20975,6 +21281,33 @@ export declare const ToolNodeSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObjec
|
|
|
20975
21281
|
style?: "diamond" | "classic" | undefined;
|
|
20976
21282
|
includeOperators?: boolean | undefined;
|
|
20977
21283
|
includeDecimal?: boolean | undefined;
|
|
21284
|
+
}>, z.ZodObject<{
|
|
21285
|
+
type: z.ZodLiteral<"GeometryRuler">;
|
|
21286
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
21287
|
+
}, "strip", z.ZodTypeAny, {
|
|
21288
|
+
type: "GeometryRuler";
|
|
21289
|
+
size: number;
|
|
21290
|
+
}, {
|
|
21291
|
+
type: "GeometryRuler";
|
|
21292
|
+
size?: number | undefined;
|
|
21293
|
+
}>, z.ZodObject<{
|
|
21294
|
+
type: z.ZodLiteral<"GeometryProtractor">;
|
|
21295
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
21296
|
+
}, "strip", z.ZodTypeAny, {
|
|
21297
|
+
type: "GeometryProtractor";
|
|
21298
|
+
size: number;
|
|
21299
|
+
}, {
|
|
21300
|
+
type: "GeometryProtractor";
|
|
21301
|
+
size?: number | undefined;
|
|
21302
|
+
}>, z.ZodObject<{
|
|
21303
|
+
type: z.ZodLiteral<"GeometrySetSquare">;
|
|
21304
|
+
size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
21305
|
+
}, "strip", z.ZodTypeAny, {
|
|
21306
|
+
type: "GeometrySetSquare";
|
|
21307
|
+
size: number;
|
|
21308
|
+
}, {
|
|
21309
|
+
type: "GeometrySetSquare";
|
|
21310
|
+
size?: number | undefined;
|
|
20978
21311
|
}>]>;
|
|
20979
21312
|
|
|
20980
21313
|
/**
|
|
@@ -20998,6 +21331,12 @@ export declare class TransformError extends EngineError {
|
|
|
20998
21331
|
*/
|
|
20999
21332
|
declare type UserAnswerValue = string | string[][] | number[];
|
|
21000
21333
|
|
|
21334
|
+
/**
|
|
21335
|
+
* Returns `play(event)`. Safe to call outside a SoundProvider — it returns a
|
|
21336
|
+
* stable no-op, so widgets never need to know whether sound is wired up.
|
|
21337
|
+
*/
|
|
21338
|
+
export declare function useSound(): (event: SoundEvent) => void;
|
|
21339
|
+
|
|
21001
21340
|
/**
|
|
21002
21341
|
* Validate user inputs against an exercise
|
|
21003
21342
|
*
|
|
@@ -21119,6 +21458,15 @@ export declare function validateExerciseJSON(data: unknown): {
|
|
|
21119
21458
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
21120
21459
|
label?: string | undefined;
|
|
21121
21460
|
size?: number | undefined;
|
|
21461
|
+
} | {
|
|
21462
|
+
type: "ruler";
|
|
21463
|
+
size?: number | undefined;
|
|
21464
|
+
} | {
|
|
21465
|
+
type: "protractor";
|
|
21466
|
+
size?: number | undefined;
|
|
21467
|
+
} | {
|
|
21468
|
+
type: "set-square";
|
|
21469
|
+
size?: number | undefined;
|
|
21122
21470
|
}>;
|
|
21123
21471
|
validation?: {
|
|
21124
21472
|
mode: "simple" | "expression" | "mixed";
|
|
@@ -21221,6 +21569,15 @@ export declare function validateExerciseJSONSafe(data: unknown): z.SafeParseRetu
|
|
|
21221
21569
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
21222
21570
|
label?: string | undefined;
|
|
21223
21571
|
size?: number | undefined;
|
|
21572
|
+
} | {
|
|
21573
|
+
type: "ruler";
|
|
21574
|
+
size?: number | undefined;
|
|
21575
|
+
} | {
|
|
21576
|
+
type: "protractor";
|
|
21577
|
+
size?: number | undefined;
|
|
21578
|
+
} | {
|
|
21579
|
+
type: "set-square";
|
|
21580
|
+
size?: number | undefined;
|
|
21224
21581
|
}>;
|
|
21225
21582
|
validation?: {
|
|
21226
21583
|
mode: "simple" | "expression" | "mixed";
|
|
@@ -21305,6 +21662,15 @@ export declare function validateExerciseJSONSafe(data: unknown): z.SafeParseRetu
|
|
|
21305
21662
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
21306
21663
|
label?: string | undefined;
|
|
21307
21664
|
size?: number | undefined;
|
|
21665
|
+
} | {
|
|
21666
|
+
type: "ruler";
|
|
21667
|
+
size?: number | undefined;
|
|
21668
|
+
} | {
|
|
21669
|
+
type: "protractor";
|
|
21670
|
+
size?: number | undefined;
|
|
21671
|
+
} | {
|
|
21672
|
+
type: "set-square";
|
|
21673
|
+
size?: number | undefined;
|
|
21308
21674
|
}>;
|
|
21309
21675
|
validation?: {
|
|
21310
21676
|
mode: "simple" | "expression" | "mixed";
|
|
@@ -21439,6 +21805,15 @@ export declare function validateWidgetJSON(data: unknown): {
|
|
|
21439
21805
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
21440
21806
|
label?: string | undefined;
|
|
21441
21807
|
size?: number | undefined;
|
|
21808
|
+
} | {
|
|
21809
|
+
type: "ruler";
|
|
21810
|
+
size?: number | undefined;
|
|
21811
|
+
} | {
|
|
21812
|
+
type: "protractor";
|
|
21813
|
+
size?: number | undefined;
|
|
21814
|
+
} | {
|
|
21815
|
+
type: "set-square";
|
|
21816
|
+
size?: number | undefined;
|
|
21442
21817
|
};
|
|
21443
21818
|
|
|
21444
21819
|
/**
|
|
@@ -21514,6 +21889,15 @@ export declare function validateWidgetJSONSafe(data: unknown): z.SafeParseReturn
|
|
|
21514
21889
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
21515
21890
|
label?: string | undefined;
|
|
21516
21891
|
size?: number | undefined;
|
|
21892
|
+
} | {
|
|
21893
|
+
type: "ruler";
|
|
21894
|
+
size?: number | undefined;
|
|
21895
|
+
} | {
|
|
21896
|
+
type: "protractor";
|
|
21897
|
+
size?: number | undefined;
|
|
21898
|
+
} | {
|
|
21899
|
+
type: "set-square";
|
|
21900
|
+
size?: number | undefined;
|
|
21517
21901
|
}, {
|
|
21518
21902
|
length: number;
|
|
21519
21903
|
type: "inline-input";
|
|
@@ -21581,6 +21965,15 @@ export declare function validateWidgetJSONSafe(data: unknown): z.SafeParseReturn
|
|
|
21581
21965
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
21582
21966
|
label?: string | undefined;
|
|
21583
21967
|
size?: number | undefined;
|
|
21968
|
+
} | {
|
|
21969
|
+
type: "ruler";
|
|
21970
|
+
size?: number | undefined;
|
|
21971
|
+
} | {
|
|
21972
|
+
type: "protractor";
|
|
21973
|
+
size?: number | undefined;
|
|
21974
|
+
} | {
|
|
21975
|
+
type: "set-square";
|
|
21976
|
+
size?: number | undefined;
|
|
21584
21977
|
}>;
|
|
21585
21978
|
|
|
21586
21979
|
/**
|
|
@@ -24608,6 +25001,33 @@ export declare const WidgetJSONSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"inpu
|
|
|
24608
25001
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
24609
25002
|
label?: string | undefined;
|
|
24610
25003
|
size?: number | undefined;
|
|
25004
|
+
}>, z.ZodObject<{
|
|
25005
|
+
type: z.ZodLiteral<"ruler">;
|
|
25006
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
25007
|
+
}, "strip", z.ZodTypeAny, {
|
|
25008
|
+
type: "ruler";
|
|
25009
|
+
size?: number | undefined;
|
|
25010
|
+
}, {
|
|
25011
|
+
type: "ruler";
|
|
25012
|
+
size?: number | undefined;
|
|
25013
|
+
}>, z.ZodObject<{
|
|
25014
|
+
type: z.ZodLiteral<"protractor">;
|
|
25015
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
25016
|
+
}, "strip", z.ZodTypeAny, {
|
|
25017
|
+
type: "protractor";
|
|
25018
|
+
size?: number | undefined;
|
|
25019
|
+
}, {
|
|
25020
|
+
type: "protractor";
|
|
25021
|
+
size?: number | undefined;
|
|
25022
|
+
}>, z.ZodObject<{
|
|
25023
|
+
type: z.ZodLiteral<"set-square">;
|
|
25024
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
25025
|
+
}, "strip", z.ZodTypeAny, {
|
|
25026
|
+
type: "set-square";
|
|
25027
|
+
size?: number | undefined;
|
|
25028
|
+
}, {
|
|
25029
|
+
type: "set-square";
|
|
25030
|
+
size?: number | undefined;
|
|
24611
25031
|
}>]>;
|
|
24612
25032
|
|
|
24613
25033
|
export declare type WidgetRef = z.infer<typeof WidgetRefSchema>;
|