cognikit 0.1.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.
- package/LICENSE +21 -0
- package/README.md +316 -0
- package/dist/core/BaseInteraction.d.ts +78 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/utilities/ProgressTracker.d.ts +58 -0
- package/dist/core/utilities/ScoringTracker.d.ts +0 -0
- package/dist/core/utilities/index.d.ts +1 -0
- package/dist/engines/index.d.ts +2 -0
- package/dist/engines/tables/implementation/graders.d.ts +23 -0
- package/dist/engines/tables/implementation/index.d.ts +4 -0
- package/dist/engines/tables/implementation/parsers.d.ts +36 -0
- package/dist/engines/tables/implementation/utils.d.ts +18 -0
- package/dist/engines/tables/implementation/validators.d.ts +9 -0
- package/dist/engines/tables/index.d.ts +2 -0
- package/dist/engines/tables/script.d.ts +37 -0
- package/dist/engines/text/implementation/graders.d.ts +69 -0
- package/dist/engines/text/implementation/index.d.ts +3 -0
- package/dist/engines/text/implementation/parsers.d.ts +9 -0
- package/dist/engines/text/implementation/validators.d.ts +41 -0
- package/dist/engines/text/index.d.ts +2 -0
- package/dist/engines/text/script.d.ts +56 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4518 -0
- package/dist/index.js.map +7 -0
- package/dist/interactions/adjacency-table/index.d.ts +26 -0
- package/dist/interactions/categorize-the-words/index.d.ts +2 -0
- package/dist/interactions/categorize-the-words/sequential.d.ts +33 -0
- package/dist/interactions/categorize-the-words/static.d.ts +22 -0
- package/dist/interactions/classification-matrix/index.d.ts +31 -0
- package/dist/interactions/fill-blanks/index.d.ts +2 -0
- package/dist/interactions/fill-blanks/sequential.d.ts +32 -0
- package/dist/interactions/fill-blanks/static.d.ts +23 -0
- package/dist/interactions/index.d.ts +17 -0
- package/dist/interactions/list-recall/implementation/grader.d.ts +0 -0
- package/dist/interactions/list-recall/implementation/index.d.ts +0 -0
- package/dist/interactions/list-recall/implementation/parser.d.ts +0 -0
- package/dist/interactions/list-recall/implementation/validator.d.ts +0 -0
- package/dist/interactions/list-recall/index.d.ts +1 -0
- package/dist/interactions/list-recall/script.d.ts +25 -0
- package/dist/interactions/lookup-table/index.d.ts +26 -0
- package/dist/interactions/mark-the-words/index.d.ts +2 -0
- package/dist/interactions/mark-the-words/sequential.d.ts +34 -0
- package/dist/interactions/mark-the-words/static.d.ts +40 -0
- package/dist/interactions/mcq-mrq/implementation/grader.d.ts +20 -0
- package/dist/interactions/mcq-mrq/implementation/index.d.ts +3 -0
- package/dist/interactions/mcq-mrq/implementation/parser.d.ts +21 -0
- package/dist/interactions/mcq-mrq/implementation/validator.d.ts +17 -0
- package/dist/interactions/mcq-mrq/index.d.ts +2 -0
- package/dist/interactions/mcq-mrq/script.d.ts +37 -0
- package/dist/interactions/nary-choice-table/index.d.ts +28 -0
- package/dist/interactions/open-classification/index.d.ts +32 -0
- package/dist/interactions/rank-order/implementation/grader.d.ts +15 -0
- package/dist/interactions/rank-order/implementation/index.d.ts +3 -0
- package/dist/interactions/rank-order/implementation/parser.d.ts +25 -0
- package/dist/interactions/rank-order/implementation/validator.d.ts +3 -0
- package/dist/interactions/rank-order/index.d.ts +2 -0
- package/dist/interactions/rank-order/script.d.ts +39 -0
- package/dist/interactions/register-builtins.d.ts +1 -0
- package/dist/interactions/registry.d.ts +30 -0
- package/dist/interactions/sequential-classification/index.d.ts +49 -0
- package/dist/interactions/shared/association-implementation/grader.d.ts +3 -0
- package/dist/interactions/shared/association-implementation/index.d.ts +1 -0
- package/dist/interactions/shared/association-implementation/parser.d.ts +0 -0
- package/dist/interactions/shared/association-implementation/validator.d.ts +0 -0
- package/dist/interactions/shared/classification-implementation/grader.d.ts +3 -0
- package/dist/interactions/shared/classification-implementation/index.d.ts +1 -0
- package/dist/interactions/shared/classification-implementation/parser.d.ts +11 -0
- package/dist/interactions/shared/classification-implementation/validator.d.ts +3 -0
- package/dist/interactions/simultaneous-association/index.d.ts +34 -0
- package/dist/interactions/text-transformation/index.d.ts +2 -0
- package/dist/interactions/text-transformation/sequential.d.ts +37 -0
- package/dist/interactions/text-transformation/static.d.ts +47 -0
- package/dist/shared/assets.d.ts +6 -0
- package/dist/shared/dsl.d.ts +9 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/managers/AnimationsManager.d.ts +55 -0
- package/dist/shared/managers/SoundManager.d.ts +78 -0
- package/dist/shared/managers/index.d.ts +3 -0
- package/dist/shared/types.d.ts +25 -0
- package/dist/shared/utils.d.ts +13 -0
- package/dist/shell/index.d.ts +1 -0
- package/dist/shell/simple-shell/index.d.ts +1 -0
- package/dist/shell/simple-shell/script.d.ts +61 -0
- package/dist/types/Assets.d.ts +40 -0
- package/dist/types/Data.d.ts +32 -0
- package/dist/types/Global.d.ts +24 -0
- package/dist/types/Grading.d.ts +8 -0
- package/dist/types/Input.d.ts +35 -0
- package/dist/types/Interactions.d.ts +28 -0
- package/dist/types/Tables.d.ts +40 -0
- package/dist/types/Text.d.ts +125 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/input/color/color-picker.d.ts +37 -0
- package/dist/ui/input/color/index.d.ts +0 -0
- package/dist/ui/input/index.d.ts +1 -0
- package/dist/ui/input/input/index.d.ts +1 -0
- package/dist/ui/input/input/input.d.ts +22 -0
- package/dist/ui/input/letter/index.d.ts +0 -0
- package/dist/ui/input/letter/letter-picker.d.ts +27 -0
- package/dist/ui/misc/block.d.ts +14 -0
- package/dist/ui/misc/chip/chip.d.ts +46 -0
- package/dist/ui/misc/chip/index.d.ts +1 -0
- package/dist/ui/misc/dialog.d.ts +24 -0
- package/dist/ui/misc/index.d.ts +4 -0
- package/dist/ui/misc/media.d.ts +54 -0
- package/package.json +59 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { ValueTableData, TableCompletion } from "../../types/Tables";
|
|
5
|
+
export declare class AdjacencyTable extends BaseInteraction<ValueTableData> {
|
|
6
|
+
interactionMechanic: InteractionMechanic;
|
|
7
|
+
private _tableConfig;
|
|
8
|
+
private _$table;
|
|
9
|
+
constructor(data: ValueTableData, config: InteractionConfig);
|
|
10
|
+
protected initialize(): void;
|
|
11
|
+
protected cleanup(): void;
|
|
12
|
+
onVariantChange(newVariant: Variant): void;
|
|
13
|
+
render(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Update progress bar based on how many non-diagonal cells are filled
|
|
16
|
+
*/
|
|
17
|
+
private updateProgressBasedOnCompletion;
|
|
18
|
+
getCurrentState(): TableCompletion;
|
|
19
|
+
isInteractionComplete(): boolean;
|
|
20
|
+
onHint(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Override submit to include grading using adjacency grader
|
|
23
|
+
*/
|
|
24
|
+
submit(): void;
|
|
25
|
+
reset(): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { GradingResult } from "../../types/Grading";
|
|
5
|
+
import { TextEngineSequentialInteractionData } from "../../types/Text";
|
|
6
|
+
export declare class SequentialCategorizeTheWords extends BaseInteraction<TextEngineSequentialInteractionData> {
|
|
7
|
+
interactionMechanic: InteractionMechanic;
|
|
8
|
+
private _slides;
|
|
9
|
+
private _currentStep;
|
|
10
|
+
private _textConfig;
|
|
11
|
+
private _$text;
|
|
12
|
+
private _responses;
|
|
13
|
+
private _gradingByStep;
|
|
14
|
+
private _isGraded;
|
|
15
|
+
get slidesCount(): number;
|
|
16
|
+
constructor(data: TextEngineSequentialInteractionData, config: InteractionConfig);
|
|
17
|
+
protected initialize(): void;
|
|
18
|
+
protected cleanup(): void;
|
|
19
|
+
onVariantChange(newVariant: Variant): void;
|
|
20
|
+
setSteps(stepIndex: number): void;
|
|
21
|
+
render(): void;
|
|
22
|
+
private getTargetIndices;
|
|
23
|
+
private getTotalTargetCount;
|
|
24
|
+
private saveCurrentStepResponse;
|
|
25
|
+
private getResponseForStep;
|
|
26
|
+
private updateProgressAcrossSteps;
|
|
27
|
+
getCurrentState(): any;
|
|
28
|
+
isInteractionComplete(): boolean;
|
|
29
|
+
onHint(): void;
|
|
30
|
+
grade(): GradingResult;
|
|
31
|
+
submit(): void;
|
|
32
|
+
reset(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { TextEngineClassificationData } from "../../types/Text";
|
|
5
|
+
import { type TextEngineClassificationUserData } from "../../engines/text";
|
|
6
|
+
export declare class CategorizeTheWords extends BaseInteraction<TextEngineClassificationData> {
|
|
7
|
+
interactionMechanic: InteractionMechanic;
|
|
8
|
+
private _textConfig;
|
|
9
|
+
private _$text;
|
|
10
|
+
constructor(data: TextEngineClassificationData, config: InteractionConfig);
|
|
11
|
+
protected initialize(): void;
|
|
12
|
+
protected cleanup(): void;
|
|
13
|
+
onVariantChange(newVariant: Variant): void;
|
|
14
|
+
render(): void;
|
|
15
|
+
private getTargetIndices;
|
|
16
|
+
getCurrentState(): TextEngineClassificationUserData;
|
|
17
|
+
isInteractionComplete(): boolean;
|
|
18
|
+
onHint(): void;
|
|
19
|
+
grade(): import("../../types").GradingResult;
|
|
20
|
+
submit(): void;
|
|
21
|
+
reset(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { BaseTableData, TableCompletion } from "../../types/Tables";
|
|
5
|
+
/**
|
|
6
|
+
* ClassificationMatrix
|
|
7
|
+
*
|
|
8
|
+
* Table-based interaction using checkboxes to assign multiple attributes
|
|
9
|
+
* to items.
|
|
10
|
+
*
|
|
11
|
+
* Inspired from Typeform's matrix and based on my table's engine
|
|
12
|
+
* See their implementation in their content features:
|
|
13
|
+
* @see https://admin.typeform.com
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export declare class ClassificationMatrix extends BaseInteraction<BaseTableData> {
|
|
17
|
+
interactionMechanic: InteractionMechanic;
|
|
18
|
+
private _tableConfig;
|
|
19
|
+
private _$table;
|
|
20
|
+
constructor(data: BaseTableData, config: InteractionConfig);
|
|
21
|
+
protected initialize(): void;
|
|
22
|
+
protected cleanup(): void;
|
|
23
|
+
onVariantChange(newVariant: Variant): void;
|
|
24
|
+
render(): void;
|
|
25
|
+
private updateProgressBasedOnCompletion;
|
|
26
|
+
getCurrentState(): TableCompletion;
|
|
27
|
+
isInteractionComplete(): boolean;
|
|
28
|
+
onHint(): void;
|
|
29
|
+
submit(): void;
|
|
30
|
+
reset(): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { TextEngineSequentialInteractionData } from "../../types/Text";
|
|
5
|
+
import { GradingResult } from "../../types/Grading";
|
|
6
|
+
export declare class SequentialFillBlanks extends BaseInteraction<TextEngineSequentialInteractionData> {
|
|
7
|
+
interactionMechanic: InteractionMechanic;
|
|
8
|
+
private _slides;
|
|
9
|
+
private _currentStep;
|
|
10
|
+
private _textConfig;
|
|
11
|
+
private _$text;
|
|
12
|
+
private _responses;
|
|
13
|
+
private _gradingByStep;
|
|
14
|
+
private _isGraded;
|
|
15
|
+
get slidesCount(): number;
|
|
16
|
+
constructor(data: TextEngineSequentialInteractionData, config: InteractionConfig);
|
|
17
|
+
protected initialize(): void;
|
|
18
|
+
protected cleanup(): void;
|
|
19
|
+
onVariantChange(newVariant: Variant): void;
|
|
20
|
+
setSteps(stepIndex: number): void;
|
|
21
|
+
render(): void;
|
|
22
|
+
private getTotalTargetCount;
|
|
23
|
+
private saveCurrentStepResponse;
|
|
24
|
+
private getResponseForStep;
|
|
25
|
+
private updateProgressAcrossSteps;
|
|
26
|
+
getCurrentState(): any;
|
|
27
|
+
isInteractionComplete(): boolean;
|
|
28
|
+
onHint(): void;
|
|
29
|
+
grade(): GradingResult;
|
|
30
|
+
submit(): void;
|
|
31
|
+
reset(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { TextEngineBlanksData } from "../../types/Text";
|
|
5
|
+
import { type TextEngineBlanksUserData } from "../../engines/text";
|
|
6
|
+
export declare class FillBlanks extends BaseInteraction<TextEngineBlanksData> {
|
|
7
|
+
interactionMechanic: InteractionMechanic;
|
|
8
|
+
private _textConfig;
|
|
9
|
+
private _$text;
|
|
10
|
+
constructor(data: TextEngineBlanksData, config: InteractionConfig);
|
|
11
|
+
protected initialize(): void;
|
|
12
|
+
protected cleanup(): void;
|
|
13
|
+
onVariantChange(newVariant: Variant): void;
|
|
14
|
+
render(): void;
|
|
15
|
+
getCurrentState(): TextEngineBlanksUserData;
|
|
16
|
+
private updateProgressBasedOnInputs;
|
|
17
|
+
isInteractionComplete(): boolean;
|
|
18
|
+
onHint(): void;
|
|
19
|
+
private getHintText;
|
|
20
|
+
grade(): import("../../types").GradingResult;
|
|
21
|
+
submit(): void;
|
|
22
|
+
reset(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "./register-builtins";
|
|
2
|
+
export * from "./open-classification";
|
|
3
|
+
export * from "./sequential-classification";
|
|
4
|
+
export * from "./registry";
|
|
5
|
+
export * from "./register-builtins";
|
|
6
|
+
export * from "./mcq-mrq";
|
|
7
|
+
export * from "./simultaneous-association";
|
|
8
|
+
export * from "./list-recall";
|
|
9
|
+
export * from "./lookup-table";
|
|
10
|
+
export * from "./classification-matrix";
|
|
11
|
+
export * from "./nary-choice-table";
|
|
12
|
+
export * from "./adjacency-table";
|
|
13
|
+
export * from "./mark-the-words";
|
|
14
|
+
export * from "./categorize-the-words";
|
|
15
|
+
export * from "./text-transformation";
|
|
16
|
+
export * from "./fill-blanks";
|
|
17
|
+
export * from "./rank-order";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ListRecall } from "./script";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { FreeRecallData } from "../../types/Data";
|
|
5
|
+
export declare class ListRecall extends BaseInteraction<FreeRecallData> {
|
|
6
|
+
interactionMechanic: InteractionMechanic;
|
|
7
|
+
private _$chipsContainer;
|
|
8
|
+
private _$textInput;
|
|
9
|
+
private _$addButton;
|
|
10
|
+
private _recalledItems;
|
|
11
|
+
constructor(data: FreeRecallData, config: InteractionConfig);
|
|
12
|
+
protected initialize(): void;
|
|
13
|
+
protected cleanup(): void;
|
|
14
|
+
onVariantChange(newVariant: Variant): void;
|
|
15
|
+
render(): void;
|
|
16
|
+
private handleAddItem;
|
|
17
|
+
private addChip;
|
|
18
|
+
getCurrentState(): string[];
|
|
19
|
+
isInteractionComplete(): boolean;
|
|
20
|
+
onHint(): void;
|
|
21
|
+
submit(): void;
|
|
22
|
+
private gradeRecall;
|
|
23
|
+
private applyGradingFeedback;
|
|
24
|
+
reset(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { ValueTableData, TableCompletion } from "../../types/Tables";
|
|
5
|
+
export declare class LookupTable extends BaseInteraction<ValueTableData> {
|
|
6
|
+
interactionMechanic: InteractionMechanic;
|
|
7
|
+
private _tableConfig;
|
|
8
|
+
private _$table;
|
|
9
|
+
constructor(data: ValueTableData, config: InteractionConfig);
|
|
10
|
+
protected initialize(): void;
|
|
11
|
+
protected cleanup(): void;
|
|
12
|
+
onVariantChange(newVariant: Variant): void;
|
|
13
|
+
render(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Update progress bar based on how many cells are filled
|
|
16
|
+
*/
|
|
17
|
+
private updateProgressBasedOnCompletion;
|
|
18
|
+
getCurrentState(): TableCompletion;
|
|
19
|
+
isInteractionComplete(): boolean;
|
|
20
|
+
onHint(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Override submit to include grading using lookup grader
|
|
23
|
+
*/
|
|
24
|
+
submit(): void;
|
|
25
|
+
reset(): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { GradingResult } from "../../types/Grading";
|
|
5
|
+
import { TextEngineSequentialInteractionData } from "../../types/Text";
|
|
6
|
+
export declare class SequentialMarkTheWords extends BaseInteraction<TextEngineSequentialInteractionData> {
|
|
7
|
+
interactionMechanic: InteractionMechanic;
|
|
8
|
+
private _slides;
|
|
9
|
+
private _currentStep;
|
|
10
|
+
private _textConfig;
|
|
11
|
+
private _$text;
|
|
12
|
+
private _responses;
|
|
13
|
+
private _gradingByStep;
|
|
14
|
+
private _isGraded;
|
|
15
|
+
get slidesCount(): number;
|
|
16
|
+
constructor(data: TextEngineSequentialInteractionData, config: InteractionConfig);
|
|
17
|
+
protected initialize(): void;
|
|
18
|
+
protected cleanup(): void;
|
|
19
|
+
onVariantChange(newVariant: Variant): void;
|
|
20
|
+
setSteps(stepIndex: number): void;
|
|
21
|
+
render(): void;
|
|
22
|
+
private getTargetCountForSlide;
|
|
23
|
+
private getTotalTargetCount;
|
|
24
|
+
private saveCurrentStepResponse;
|
|
25
|
+
private getResponseForStep;
|
|
26
|
+
private getTargetIndices;
|
|
27
|
+
private updateProgressAcrossSteps;
|
|
28
|
+
getCurrentState(): any;
|
|
29
|
+
isInteractionComplete(): boolean;
|
|
30
|
+
onHint(): void;
|
|
31
|
+
grade(): GradingResult;
|
|
32
|
+
submit(): void;
|
|
33
|
+
reset(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { TextEngineBaseData } from "../../types/Text";
|
|
5
|
+
import { type TextEngineBaseUserData } from "../../engines/text";
|
|
6
|
+
/**
|
|
7
|
+
* Mark The Words - Text Highlight Interaction
|
|
8
|
+
*
|
|
9
|
+
* Users click to select/highlight target words in a passage of text.
|
|
10
|
+
* Based on the TextEngineBaseData with highlight mode.
|
|
11
|
+
*
|
|
12
|
+
* Example data:
|
|
13
|
+
* ```
|
|
14
|
+
* {
|
|
15
|
+
* type: 'base',
|
|
16
|
+
* parts: ['The', 'cat', 'sat', 'on', 'the', 'mat'],
|
|
17
|
+
* targets: [
|
|
18
|
+
* { words: ['cat'], startPos: 1, endPos: 1 },
|
|
19
|
+
* { words: ['mat'], startPos: 5, endPos: 5 }
|
|
20
|
+
* ]
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class MarkTheWords extends BaseInteraction<TextEngineBaseData> {
|
|
25
|
+
interactionMechanic: InteractionMechanic;
|
|
26
|
+
private _textConfig;
|
|
27
|
+
private _$text;
|
|
28
|
+
constructor(data: TextEngineBaseData, config: InteractionConfig);
|
|
29
|
+
protected initialize(): void;
|
|
30
|
+
protected cleanup(): void;
|
|
31
|
+
onVariantChange(newVariant: Variant): void;
|
|
32
|
+
render(): void;
|
|
33
|
+
getCurrentState(): TextEngineBaseUserData;
|
|
34
|
+
isInteractionComplete(): boolean;
|
|
35
|
+
onHint(): void;
|
|
36
|
+
getUserData(): TextEngineBaseUserData;
|
|
37
|
+
submit(): void;
|
|
38
|
+
grade(): import("../../types").GradingResult;
|
|
39
|
+
reset(): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GradingResult } from "../../../types/Grading";
|
|
2
|
+
import { RecognitionData } from "../../../types/Data";
|
|
3
|
+
/**
|
|
4
|
+
* User's answers for MCQ/MRQ
|
|
5
|
+
* Format: { "question text": ["selected option 1", "selected option 2", ...] }
|
|
6
|
+
*/
|
|
7
|
+
export type RecognitionAnswers = Record<string, string[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Grader for MCQ/MRQ interactions
|
|
10
|
+
*
|
|
11
|
+
* Grading logic per question:
|
|
12
|
+
* - Each correct option selected: +1 point
|
|
13
|
+
* - Each incorrect option selected: -1 point (penalty)
|
|
14
|
+
* - Each correct option NOT selected (missed): -1 point (penalty)
|
|
15
|
+
* - Score is (correct selections - wrong selections - missed) / total correct options
|
|
16
|
+
* - Rounded to whole number percentage
|
|
17
|
+
*
|
|
18
|
+
* Overall score: average of all question scores
|
|
19
|
+
*/
|
|
20
|
+
export declare function recognitionGrader(data: RecognitionData, userAnswers: RecognitionAnswers): GradingResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RecognitionData } from "../../../types/Data";
|
|
2
|
+
type ParseResult = {
|
|
3
|
+
data: RecognitionData;
|
|
4
|
+
errors?: Record<string, string>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Parser for MCQ/MRQ grammar
|
|
8
|
+
*
|
|
9
|
+
* Grammar:
|
|
10
|
+
* # question
|
|
11
|
+
* [correct1 | correct2] | incorrect1 | incorrect2;
|
|
12
|
+
*
|
|
13
|
+
* Rules:
|
|
14
|
+
* - '#' indicates a question
|
|
15
|
+
* - '[...]' contains correct options separated by '|'
|
|
16
|
+
* - Options outside brackets are incorrect
|
|
17
|
+
* - Lines must end with ';'
|
|
18
|
+
* - '@:assetName' for asset references (preserved as-is)
|
|
19
|
+
*/
|
|
20
|
+
export declare function recognitionParser(code: string): ParseResult;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RecognitionData } from "../../../types/Data";
|
|
2
|
+
type ValidationResult = {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
errors?: Record<string, string>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Validator for MCQ/MRQ recognition data
|
|
8
|
+
*
|
|
9
|
+
* Validates:
|
|
10
|
+
* - At least one question exists
|
|
11
|
+
* - Each question has at least one correct answer
|
|
12
|
+
* - Each question has at least two total options
|
|
13
|
+
* - No duplicate options within a question
|
|
14
|
+
* - Question text is not empty
|
|
15
|
+
*/
|
|
16
|
+
export declare function recognitionValidator(data: RecognitionData): ValidationResult;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { NormalizedAssets } from "../../types/Assets";
|
|
5
|
+
import { RecognitionData } from "../../types/Data";
|
|
6
|
+
import { RecognitionAnswers } from "./implementation/grader";
|
|
7
|
+
export declare class MCQ extends BaseInteraction<RecognitionData> {
|
|
8
|
+
interactionMechanic: InteractionMechanic;
|
|
9
|
+
private currentQuestionIndex;
|
|
10
|
+
private userAnswers;
|
|
11
|
+
private shuffledOptions;
|
|
12
|
+
private isGraded;
|
|
13
|
+
private $questionBlock;
|
|
14
|
+
private $questionText;
|
|
15
|
+
private $optionsContainer;
|
|
16
|
+
private $modeLabel;
|
|
17
|
+
private variant;
|
|
18
|
+
get slidesCount(): number;
|
|
19
|
+
constructor(data: RecognitionData, config: InteractionConfig, assets: NormalizedAssets | null);
|
|
20
|
+
protected initialize(): void;
|
|
21
|
+
protected cleanup(): void;
|
|
22
|
+
onVariantChange(newVariant: Variant): void;
|
|
23
|
+
/**
|
|
24
|
+
* Called by shell when radio navigation changes
|
|
25
|
+
* @param stepIndex 1-based index from shell
|
|
26
|
+
*/
|
|
27
|
+
setSteps(stepIndex: number): void;
|
|
28
|
+
render(): void;
|
|
29
|
+
private renderCurrentQuestion;
|
|
30
|
+
private handleOptionClick;
|
|
31
|
+
private updateProgress;
|
|
32
|
+
getCurrentState(): RecognitionAnswers;
|
|
33
|
+
isInteractionComplete(): boolean;
|
|
34
|
+
onHint(): void;
|
|
35
|
+
submit(): void;
|
|
36
|
+
reset(): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { BaseTableData, TableCompletion } from "../../types/Tables";
|
|
5
|
+
export declare class NaryChoiceTable extends BaseInteraction<BaseTableData> {
|
|
6
|
+
interactionMechanic: InteractionMechanic;
|
|
7
|
+
private _tableConfig;
|
|
8
|
+
private _$table;
|
|
9
|
+
constructor(data: BaseTableData, config: InteractionConfig);
|
|
10
|
+
protected initialize(): void;
|
|
11
|
+
protected cleanup(): void;
|
|
12
|
+
onVariantChange(newVariant: Variant): void;
|
|
13
|
+
render(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Update progress bar based on how many rows have exactly one selection
|
|
16
|
+
* N-ary requires single selection per row
|
|
17
|
+
*/
|
|
18
|
+
private updateProgressBasedOnCompletion;
|
|
19
|
+
getCurrentState(): TableCompletion;
|
|
20
|
+
isInteractionComplete(): boolean;
|
|
21
|
+
onHint(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Override submit to include grading using n-ary grader
|
|
24
|
+
* N-ary grading is binary per row (100% or 0%)
|
|
25
|
+
*/
|
|
26
|
+
submit(): void;
|
|
27
|
+
reset(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open Classification
|
|
3
|
+
*
|
|
4
|
+
* No idea if there's something like out there, but it's something I just came with
|
|
5
|
+
*/
|
|
6
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
7
|
+
import { Variant } from "../../shared/types";
|
|
8
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
9
|
+
import { NormalizedAssets } from "../../types/Assets";
|
|
10
|
+
import { ClassificationData } from "../../types/Data";
|
|
11
|
+
export declare class OpenClassification extends BaseInteraction<ClassificationData> {
|
|
12
|
+
interactionMechanic: InteractionMechanic;
|
|
13
|
+
private categories;
|
|
14
|
+
private allItems;
|
|
15
|
+
private categoryColors;
|
|
16
|
+
private categorized;
|
|
17
|
+
private currentCategory;
|
|
18
|
+
private currentColor;
|
|
19
|
+
private $categoriesBar;
|
|
20
|
+
constructor(data: ClassificationData, config: InteractionConfig, assets: NormalizedAssets | null);
|
|
21
|
+
protected initialize(): void;
|
|
22
|
+
protected cleanup(): void;
|
|
23
|
+
onVariantChange(newVariant: Variant): void;
|
|
24
|
+
render(): void;
|
|
25
|
+
private setItems;
|
|
26
|
+
private setCategories;
|
|
27
|
+
getCurrentState(): any;
|
|
28
|
+
isInteractionComplete(): boolean;
|
|
29
|
+
onHint(): void;
|
|
30
|
+
submit(): void;
|
|
31
|
+
reset(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SeriationData } from "../../../types/Data";
|
|
2
|
+
import { GradingResult } from "../../../types/Grading";
|
|
3
|
+
/**
|
|
4
|
+
* Grades a seriation/sequencing interaction with partial credit
|
|
5
|
+
*
|
|
6
|
+
* Scoring approach:
|
|
7
|
+
* - Correct position: 100% for that item
|
|
8
|
+
* - Adjacent position (±1): 50% for that item
|
|
9
|
+
* - Further away: 0% for that item
|
|
10
|
+
*
|
|
11
|
+
* @param correctOrder - The correct sequence of items
|
|
12
|
+
* @param userOrder - The user's submitted sequence
|
|
13
|
+
* @param parent - Parent element containing chips (for visual feedback)
|
|
14
|
+
*/
|
|
15
|
+
export declare function seriationGrader(correctOrder: SeriationData["items"], userOrder: string[], parent: HTMLElement): GradingResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ParsingResult } from "../../../shared";
|
|
2
|
+
/**
|
|
3
|
+
* Parses a simple DSL for seriation data
|
|
4
|
+
*
|
|
5
|
+
* Format: Items separated by pipes (|) or newlines
|
|
6
|
+
*
|
|
7
|
+
* Example 1 (pipe-separated):
|
|
8
|
+
* ```
|
|
9
|
+
* Egg | Caterpillar | Chrysalis | Butterfly
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Example 2 (numbered):
|
|
13
|
+
* ```
|
|
14
|
+
* 1. American Revolution
|
|
15
|
+
* 2. French Revolution
|
|
16
|
+
* 3. Industrial Revolution
|
|
17
|
+
* 4. World War I
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Example 3 (with assets):
|
|
21
|
+
* ```
|
|
22
|
+
* @:step1 | @:step2 | @:step3 | Final Product
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function seriationParser(code: string): ParsingResult;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BaseInteraction } from "../../core/BaseInteraction";
|
|
2
|
+
import { Variant } from "../../shared/types";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "../../types/Interactions";
|
|
4
|
+
import { NormalizedAssets } from "../../types/Assets";
|
|
5
|
+
import { SeriationData } from "../../types/Data";
|
|
6
|
+
export declare class RankOrder extends BaseInteraction<SeriationData> {
|
|
7
|
+
interactionMechanic: InteractionMechanic;
|
|
8
|
+
private currentOrder;
|
|
9
|
+
private isGraded;
|
|
10
|
+
private $container;
|
|
11
|
+
private $rowsContainer;
|
|
12
|
+
private draggedRowIndex;
|
|
13
|
+
private dragOverRowIndex;
|
|
14
|
+
private isDragging;
|
|
15
|
+
private draggedRow;
|
|
16
|
+
private dragOffsetY;
|
|
17
|
+
private boundPointerMove;
|
|
18
|
+
private boundPointerUp;
|
|
19
|
+
private variant;
|
|
20
|
+
private readonly MAX_ITEMS;
|
|
21
|
+
private readonly MIN_ITEM_HEIGHT;
|
|
22
|
+
constructor(data: SeriationData, config: InteractionConfig, assets: NormalizedAssets | null);
|
|
23
|
+
protected initialize(): void;
|
|
24
|
+
protected cleanup(): void;
|
|
25
|
+
onVariantChange(newVariant: Variant): void;
|
|
26
|
+
render(): void;
|
|
27
|
+
private renderRows;
|
|
28
|
+
private createButton;
|
|
29
|
+
private swapItems;
|
|
30
|
+
private handlePointerDown;
|
|
31
|
+
private handlePointerMove;
|
|
32
|
+
private handlePointerUp;
|
|
33
|
+
private getRowIndexAtY;
|
|
34
|
+
getCurrentState(): any;
|
|
35
|
+
isInteractionComplete(): boolean;
|
|
36
|
+
onHint(): void;
|
|
37
|
+
submit(): void;
|
|
38
|
+
reset(): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const registerBuiltInInteractions: () => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseInteraction } from "../core/BaseInteraction";
|
|
2
|
+
import { CognitiveOp } from "../shared/types";
|
|
3
|
+
import { InteractionData } from "../types/Data";
|
|
4
|
+
import { InteractionMechanic } from "../types/Interactions";
|
|
5
|
+
export type InteractionConstructor = new (...args: any[]) => BaseInteraction<InteractionData>;
|
|
6
|
+
export type InteractionCapabilities = {
|
|
7
|
+
isSequential: boolean;
|
|
8
|
+
implementsProgress: boolean;
|
|
9
|
+
usesAssets: boolean;
|
|
10
|
+
hasParser: boolean;
|
|
11
|
+
hasValidator: boolean;
|
|
12
|
+
hasGrader: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type InteractionRegistryItem = {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
elementTag: string;
|
|
18
|
+
cognitiveOp?: CognitiveOp;
|
|
19
|
+
mechanic: InteractionMechanic;
|
|
20
|
+
engine: "tables" | "text" | "direct" | "mixed";
|
|
21
|
+
ctor: InteractionConstructor;
|
|
22
|
+
capabilities: InteractionCapabilities;
|
|
23
|
+
};
|
|
24
|
+
export declare const registerInteraction: (item: InteractionRegistryItem) => void;
|
|
25
|
+
export declare const unregisterInteraction: (id: string) => boolean;
|
|
26
|
+
export declare const clearInteractionRegistry: () => void;
|
|
27
|
+
export declare const getInteractionRegistry: () => ReadonlyMap<string, InteractionRegistryItem>;
|
|
28
|
+
export declare const listInteractions: () => InteractionRegistryItem[];
|
|
29
|
+
export declare const getInteraction: (id: string) => InteractionRegistryItem | null;
|
|
30
|
+
export declare const createInteraction: (id: string, ...args: any[]) => BaseInteraction<InteractionData>;
|