cognikit 1.0.2 → 1.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/dist/builders/classification/index.d.ts +24 -0
- package/dist/builders/fill-blanks/index.d.ts +48 -0
- package/dist/client.js +2574 -2666
- package/dist/client.js.map +4 -4
- package/dist/core/builders/index.d.ts +48 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/core/{BaseInteraction.d.ts → interactions/index.d.ts} +11 -12
- package/dist/engines/index.d.ts +0 -1
- package/dist/engines/tables/index.d.ts +40 -2
- package/dist/engines/tables/{implementation/utils.d.ts → utils.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2570 -2662
- package/dist/index.js.map +4 -4
- package/dist/interactions/adjacency-table/index.d.ts +6 -7
- package/dist/interactions/classification-matrix/index.d.ts +7 -6
- package/dist/interactions/fill-blanks/index.d.ts +36 -2
- package/dist/interactions/index.d.ts +0 -2
- package/dist/interactions/list-recall/index.d.ts +27 -1
- package/dist/interactions/lookup-table/index.d.ts +6 -7
- package/dist/interactions/mark-the-words/index.d.ts +34 -2
- package/dist/interactions/mcq-mrq/index.d.ts +37 -2
- package/dist/interactions/nary-choice-table/index.d.ts +7 -13
- package/dist/interactions/open-classification/index.d.ts +9 -6
- package/dist/interactions/rank-order/index.d.ts +49 -2
- package/dist/interactions/registry.d.ts +5 -5
- package/dist/interactions/sequential-classification/index.d.ts +8 -6
- package/dist/interactions/simultaneous-association/index.d.ts +7 -12
- package/dist/{shared/managers → managers}/AnimationsManager.d.ts +6 -1
- package/dist/managers/DragAndDropManager.d.ts +37 -0
- package/dist/{core/utilities/ProgressTracker.d.ts → managers/ProgressManager.d.ts} +8 -8
- package/dist/managers/ScoringManager.d.ts +73 -0
- package/dist/managers/index.d.ts +4 -0
- package/dist/shared/config.d.ts +1 -1
- package/dist/shared/index.d.ts +0 -2
- package/dist/shared/utils.d.ts +2 -1
- package/dist/shell/builders/index.d.ts +29 -0
- package/dist/shell/index.d.ts +2 -1
- package/dist/shell/{simple-shell/script.d.ts → interactions/index.d.ts} +8 -7
- package/dist/types/Builders.d.ts +17 -0
- package/dist/types/Data.d.ts +49 -9
- package/dist/types/Global.d.ts +2 -23
- package/dist/types/Grading.d.ts +2 -0
- package/dist/types/Input.d.ts +12 -16
- package/dist/types/Interactions.d.ts +10 -14
- package/dist/types/Tables.d.ts +2 -2
- package/dist/ui/{misc/block.d.ts → block/index.d.ts} +1 -1
- package/dist/ui/{misc/chip/chip.d.ts → chip/index.d.ts} +8 -4
- package/dist/ui/{misc/dialog.d.ts → dialog/index.d.ts} +0 -1
- package/dist/ui/index.d.ts +4 -1
- package/dist/ui/input/index.d.ts +22 -1
- package/dist/ui/{misc/media.d.ts → media/index.d.ts} +1 -1
- package/package.json +1 -1
- package/public/app.js +5874 -8649
- package/public/app.js.map +4 -4
- package/public/assets/images/landscape.jpg +0 -0
- package/public/assets/images/mountains.jpg +0 -0
- package/public/builders.html +87 -0
- package/public/examples/data.ts +167 -0
- package/public/index.html +1008 -779
- package/dist/core/utilities/index.d.ts +0 -1
- package/dist/engines/tables/implementation/graders.d.ts +0 -23
- package/dist/engines/tables/implementation/index.d.ts +0 -4
- package/dist/engines/tables/implementation/parsers.d.ts +0 -36
- package/dist/engines/tables/implementation/validators.d.ts +0 -9
- package/dist/engines/tables/script.d.ts +0 -37
- package/dist/engines/text/implementation/graders.d.ts +0 -69
- package/dist/engines/text/implementation/index.d.ts +0 -3
- package/dist/engines/text/implementation/parsers.d.ts +0 -9
- package/dist/engines/text/implementation/validators.d.ts +0 -41
- package/dist/engines/text/index.d.ts +0 -2
- package/dist/engines/text/script.d.ts +0 -56
- package/dist/interactions/categorize-the-words/index.d.ts +0 -2
- package/dist/interactions/categorize-the-words/sequential.d.ts +0 -33
- package/dist/interactions/categorize-the-words/static.d.ts +0 -22
- package/dist/interactions/fill-blanks/sequential.d.ts +0 -32
- package/dist/interactions/fill-blanks/static.d.ts +0 -23
- package/dist/interactions/list-recall/script.d.ts +0 -25
- package/dist/interactions/mark-the-words/sequential.d.ts +0 -34
- package/dist/interactions/mark-the-words/static.d.ts +0 -40
- package/dist/interactions/mcq-mrq/implementation/grader.d.ts +0 -20
- package/dist/interactions/mcq-mrq/implementation/index.d.ts +0 -3
- package/dist/interactions/mcq-mrq/implementation/parser.d.ts +0 -21
- package/dist/interactions/mcq-mrq/implementation/validator.d.ts +0 -17
- package/dist/interactions/mcq-mrq/script.d.ts +0 -37
- package/dist/interactions/rank-order/implementation/grader.d.ts +0 -15
- package/dist/interactions/rank-order/implementation/index.d.ts +0 -3
- package/dist/interactions/rank-order/implementation/parser.d.ts +0 -25
- package/dist/interactions/rank-order/implementation/validator.d.ts +0 -3
- package/dist/interactions/rank-order/script.d.ts +0 -39
- package/dist/interactions/shared/association-implementation/grader.d.ts +0 -3
- package/dist/interactions/shared/association-implementation/index.d.ts +0 -1
- package/dist/interactions/shared/association-implementation/validator.d.ts +0 -0
- package/dist/interactions/shared/classification-implementation/grader.d.ts +0 -3
- package/dist/interactions/shared/classification-implementation/index.d.ts +0 -1
- package/dist/interactions/shared/classification-implementation/parser.d.ts +0 -11
- package/dist/interactions/shared/classification-implementation/validator.d.ts +0 -3
- package/dist/interactions/text-transformation/index.d.ts +0 -2
- package/dist/interactions/text-transformation/sequential.d.ts +0 -37
- package/dist/interactions/text-transformation/static.d.ts +0 -47
- package/dist/shared/dsl.d.ts +0 -9
- package/dist/shared/managers/index.d.ts +0 -3
- package/dist/shared/types.d.ts +0 -25
- package/dist/shell/simple-shell/index.d.ts +0 -1
- package/dist/types/Text.d.ts +0 -125
- package/dist/ui/input/input/index.d.ts +0 -1
- package/dist/ui/input/input/input.d.ts +0 -22
- package/dist/ui/misc/chip/index.d.ts +0 -1
- package/dist/ui/misc/index.d.ts +0 -4
- package/public/assets/images/pointing-hand.svg +0 -1
- package/public/examples/chip.html +0 -495
- package/public/scalable-bare.html +0 -432
- package/public/tables-demo.html +0 -534
- package/public/text-interactions-demo.html +0 -604
- /package/dist/{interactions/list-recall/implementation → builders/list}/index.d.ts +0 -0
- /package/dist/{core/utilities/ScoringTracker.d.ts → builders/matching/inde.d.ts} +0 -0
- /package/dist/{ui/input/color → builders/ordering}/index.d.ts +0 -0
- /package/dist/{ui/input/letter → builders/tables}/index.d.ts +0 -0
- /package/dist/{interactions/list-recall/implementation/grader.d.ts → builders/text/index.d.ts} +0 -0
- /package/dist/interactions/{list-recall/implementation/parser.d.ts → exp/CategorizeTheWords.d.ts} +0 -0
- /package/dist/interactions/{list-recall/implementation/validator.d.ts → exp/DndFillBlanks.d.ts} +0 -0
- /package/dist/interactions/{shared/association-implementation/parser.d.ts → exp/TextTransformation.d.ts} +0 -0
- /package/dist/{shared/managers → managers}/SoundManager.d.ts +0 -0
- /package/dist/ui/{input/color/color-picker.d.ts → exp/color/index.d.ts} +0 -0
- /package/dist/ui/{input/letter/letter-picker.d.ts → exp/letter/index.d.ts} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BaseInteraction } from "
|
|
2
|
-
import { Variant } from "
|
|
3
|
-
import { InteractionConfig, InteractionMechanic } from "
|
|
4
|
-
import { ValueTableData, TableCompletion } from "
|
|
1
|
+
import { BaseInteraction } from "@/core";
|
|
2
|
+
import type { Variant } from "@/types/Global";
|
|
3
|
+
import type { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
4
|
+
import type { ValueTableData, TableCompletion } from "@/types/Tables";
|
|
5
5
|
export declare class AdjacencyTable extends BaseInteraction<ValueTableData> {
|
|
6
|
+
id: string;
|
|
6
7
|
interactionMechanic: InteractionMechanic;
|
|
7
8
|
private _tableConfig;
|
|
8
9
|
private _$table;
|
|
@@ -18,9 +19,7 @@ export declare class AdjacencyTable extends BaseInteraction<ValueTableData> {
|
|
|
18
19
|
getCurrentState(): TableCompletion;
|
|
19
20
|
isInteractionComplete(): boolean;
|
|
20
21
|
onHint(): void;
|
|
21
|
-
|
|
22
|
-
* Override submit to include grading using adjacency grader
|
|
23
|
-
*/
|
|
22
|
+
grade(): void;
|
|
24
23
|
submit(): void;
|
|
25
24
|
reset(): void;
|
|
26
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseInteraction } from "
|
|
2
|
-
import { Variant } from "
|
|
3
|
-
import { InteractionConfig, InteractionMechanic } from "
|
|
4
|
-
import { BaseTableData, TableCompletion } from "
|
|
1
|
+
import { BaseInteraction } from "@/core";
|
|
2
|
+
import { Variant } from "@/types/Global";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
4
|
+
import { BaseTableData, TableCompletion } from "@/types/Tables";
|
|
5
5
|
/**
|
|
6
6
|
* ClassificationMatrix
|
|
7
7
|
*
|
|
@@ -14,18 +14,19 @@ import { BaseTableData, TableCompletion } from "../../types/Tables";
|
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
export declare class ClassificationMatrix extends BaseInteraction<BaseTableData> {
|
|
17
|
+
id: string;
|
|
17
18
|
interactionMechanic: InteractionMechanic;
|
|
18
19
|
private _tableConfig;
|
|
19
20
|
private _$table;
|
|
20
21
|
constructor(data: BaseTableData, config: InteractionConfig);
|
|
21
22
|
protected initialize(): void;
|
|
22
|
-
|
|
23
|
-
onVariantChange(newVariant: Variant): void;
|
|
23
|
+
onVariantChange(v: Variant): void;
|
|
24
24
|
render(): void;
|
|
25
25
|
private updateProgressBasedOnCompletion;
|
|
26
26
|
getCurrentState(): TableCompletion;
|
|
27
27
|
isInteractionComplete(): boolean;
|
|
28
28
|
onHint(): void;
|
|
29
|
+
private grade;
|
|
29
30
|
submit(): void;
|
|
30
31
|
reset(): void;
|
|
31
32
|
}
|
|
@@ -1,2 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* FILL BLANKS INTERACTIONS <"Cloze Text">, with all-in variations for single/multiple slides and various input elements.
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
import { BaseInteraction } from "@/core";
|
|
6
|
+
import type { Variant } from "@/types/Global";
|
|
7
|
+
import type { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
8
|
+
import type { FillBlanksData as DATA } from "@/types/Data";
|
|
9
|
+
export declare class FillBlanks extends BaseInteraction<DATA> {
|
|
10
|
+
id: string;
|
|
11
|
+
interactionMechanic: InteractionMechanic;
|
|
12
|
+
private _totalItems;
|
|
13
|
+
private _answerKey;
|
|
14
|
+
private currentSlide;
|
|
15
|
+
private _completionState;
|
|
16
|
+
private _gradingState;
|
|
17
|
+
private _isGraded;
|
|
18
|
+
private _$container;
|
|
19
|
+
get slidesCount(): number;
|
|
20
|
+
constructor(data: DATA, config: InteractionConfig);
|
|
21
|
+
protected initialize(): void;
|
|
22
|
+
onVariantChange(v: Variant): void;
|
|
23
|
+
private static generateAnswerKey;
|
|
24
|
+
private static convertRef;
|
|
25
|
+
render(): void;
|
|
26
|
+
private renderCurrentSlide;
|
|
27
|
+
private setUpElementEventListener;
|
|
28
|
+
private isElementValueCorrect;
|
|
29
|
+
setSteps(n: number): void;
|
|
30
|
+
getCurrentState(): any;
|
|
31
|
+
isInteractionComplete(): boolean;
|
|
32
|
+
onHint(): void;
|
|
33
|
+
private grade;
|
|
34
|
+
submit(): void;
|
|
35
|
+
reset(): void;
|
|
36
|
+
}
|
|
@@ -11,7 +11,5 @@ export * from "./classification-matrix";
|
|
|
11
11
|
export * from "./nary-choice-table";
|
|
12
12
|
export * from "./adjacency-table";
|
|
13
13
|
export * from "./mark-the-words";
|
|
14
|
-
export * from "./categorize-the-words";
|
|
15
|
-
export * from "./text-transformation";
|
|
16
14
|
export * from "./fill-blanks";
|
|
17
15
|
export * from "./rank-order";
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import { BaseInteraction } from "@/core";
|
|
2
|
+
import { Variant } from "@/types/Global";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
4
|
+
import { FreeRecallData } from "@/types/Data";
|
|
5
|
+
export declare class ListRecall extends BaseInteraction<FreeRecallData> {
|
|
6
|
+
id: string;
|
|
7
|
+
interactionMechanic: InteractionMechanic;
|
|
8
|
+
private _$chipsContainer;
|
|
9
|
+
private _$textInput;
|
|
10
|
+
private _$addButton;
|
|
11
|
+
private _recalledItems;
|
|
12
|
+
private _fanthomPlaceholdersQueue;
|
|
13
|
+
private _currentAmountOfItems;
|
|
14
|
+
constructor(data: FreeRecallData, config: InteractionConfig);
|
|
15
|
+
protected initialize(): void;
|
|
16
|
+
protected cleanup(): void;
|
|
17
|
+
onVariantChange(newVariant: Variant): void;
|
|
18
|
+
render(): void;
|
|
19
|
+
private renderFanthomPlaceholders;
|
|
20
|
+
private handleAddItem;
|
|
21
|
+
private addChip;
|
|
22
|
+
getCurrentState(): string[];
|
|
23
|
+
isInteractionComplete(): boolean;
|
|
24
|
+
onHint(): void;
|
|
25
|
+
submit(): void;
|
|
26
|
+
reset(): void;
|
|
27
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BaseInteraction } from "
|
|
2
|
-
import { Variant } from "
|
|
3
|
-
import { InteractionConfig, InteractionMechanic } from "
|
|
4
|
-
import { ValueTableData, TableCompletion } from "
|
|
1
|
+
import { BaseInteraction } from "@/core";
|
|
2
|
+
import { Variant } from "@/types/Global";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
4
|
+
import { ValueTableData, TableCompletion } from "@/types/Tables";
|
|
5
5
|
export declare class LookupTable extends BaseInteraction<ValueTableData> {
|
|
6
|
+
id: string;
|
|
6
7
|
interactionMechanic: InteractionMechanic;
|
|
7
8
|
private _tableConfig;
|
|
8
9
|
private _$table;
|
|
@@ -18,9 +19,7 @@ export declare class LookupTable extends BaseInteraction<ValueTableData> {
|
|
|
18
19
|
getCurrentState(): TableCompletion;
|
|
19
20
|
isInteractionComplete(): boolean;
|
|
20
21
|
onHint(): void;
|
|
21
|
-
|
|
22
|
-
* Override submit to include grading using lookup grader
|
|
23
|
-
*/
|
|
22
|
+
grade(): void;
|
|
24
23
|
submit(): void;
|
|
25
24
|
reset(): void;
|
|
26
25
|
}
|
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { BaseInteraction } from "@/core";
|
|
2
|
+
import type { Variant } from "@/types/Global";
|
|
3
|
+
import type { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
4
|
+
import type { MarkTheWordsData as DATA } from "@/types/Data";
|
|
5
|
+
export declare class MarkTheWords extends BaseInteraction<DATA> {
|
|
6
|
+
id: string;
|
|
7
|
+
interactionMechanic: InteractionMechanic;
|
|
8
|
+
private _totalItems;
|
|
9
|
+
private _itemsPerSlide;
|
|
10
|
+
private _answerKey;
|
|
11
|
+
private _currentSlide;
|
|
12
|
+
private _gradingState;
|
|
13
|
+
private _completionState;
|
|
14
|
+
private _mappedTargets;
|
|
15
|
+
private _isGraded;
|
|
16
|
+
private _$counter;
|
|
17
|
+
private _$container;
|
|
18
|
+
get slidesCount(): number;
|
|
19
|
+
constructor(data: DATA, config: InteractionConfig);
|
|
20
|
+
protected initialize(): void;
|
|
21
|
+
onVariantChange(v: Variant): void;
|
|
22
|
+
render(): void;
|
|
23
|
+
private renderCurrentSlide;
|
|
24
|
+
private updateCounter;
|
|
25
|
+
private createChip;
|
|
26
|
+
private setUpChipEventListener;
|
|
27
|
+
getCurrentState(): any;
|
|
28
|
+
isInteractionComplete(): boolean;
|
|
29
|
+
onHint(): void;
|
|
30
|
+
setSteps(n: number): void;
|
|
31
|
+
private grade;
|
|
32
|
+
submit(): void;
|
|
33
|
+
reset(): void;
|
|
34
|
+
}
|
|
@@ -1,2 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { BaseInteraction } from "@/core";
|
|
2
|
+
import type { Variant } from "@/types/Global";
|
|
3
|
+
import type { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
4
|
+
import type { NormalizedAssets } from "@/types/Assets";
|
|
5
|
+
import type { RecognitionData } from "@/types/Data";
|
|
6
|
+
export declare class MCQ extends BaseInteraction<RecognitionData> {
|
|
7
|
+
id: string;
|
|
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(): Record<string, string[]>;
|
|
33
|
+
isInteractionComplete(): boolean;
|
|
34
|
+
onHint(): void;
|
|
35
|
+
submit(): void;
|
|
36
|
+
reset(): void;
|
|
37
|
+
}
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
import { BaseInteraction } from "
|
|
2
|
-
import { Variant } from "
|
|
3
|
-
import { InteractionConfig, InteractionMechanic } from "
|
|
4
|
-
import { BaseTableData, TableCompletion } from "
|
|
1
|
+
import { BaseInteraction } from "@/core";
|
|
2
|
+
import { Variant } from "@/types/Global";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
4
|
+
import { BaseTableData, TableCompletion } from "@/types/Tables";
|
|
5
5
|
export declare class NaryChoiceTable extends BaseInteraction<BaseTableData> {
|
|
6
|
+
id: string;
|
|
6
7
|
interactionMechanic: InteractionMechanic;
|
|
7
8
|
private _tableConfig;
|
|
8
9
|
private _$table;
|
|
9
10
|
constructor(data: BaseTableData, config: InteractionConfig);
|
|
10
11
|
protected initialize(): void;
|
|
11
12
|
protected cleanup(): void;
|
|
12
|
-
onVariantChange(
|
|
13
|
+
onVariantChange(v: Variant): void;
|
|
13
14
|
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
15
|
private updateProgressBasedOnCompletion;
|
|
19
16
|
getCurrentState(): TableCompletion;
|
|
20
17
|
isInteractionComplete(): boolean;
|
|
21
18
|
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
|
-
*/
|
|
19
|
+
private grade;
|
|
26
20
|
submit(): void;
|
|
27
21
|
reset(): void;
|
|
28
22
|
}
|
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
*
|
|
4
4
|
* No idea if there's something like out there, but it's something I just came with
|
|
5
5
|
*/
|
|
6
|
-
import { BaseInteraction } from "
|
|
7
|
-
import { Variant } from "
|
|
8
|
-
import { InteractionConfig, InteractionMechanic } from "
|
|
9
|
-
import { NormalizedAssets } from "
|
|
10
|
-
import { ClassificationData } from "
|
|
6
|
+
import { BaseInteraction } from "@/core";
|
|
7
|
+
import { Variant } from "@/types/Global";
|
|
8
|
+
import { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
9
|
+
import { NormalizedAssets } from "@/types/Assets";
|
|
10
|
+
import { ClassificationData } from "@/types/Data";
|
|
11
11
|
export declare class OpenClassification extends BaseInteraction<ClassificationData> {
|
|
12
|
+
id: "open-classification";
|
|
12
13
|
interactionMechanic: InteractionMechanic;
|
|
13
14
|
private categories;
|
|
14
15
|
private allItems;
|
|
15
|
-
private categoryColors;
|
|
16
16
|
private categorized;
|
|
17
17
|
private currentCategory;
|
|
18
18
|
private currentColor;
|
|
19
|
+
private activeAnimationInterval;
|
|
19
20
|
private $categoriesBar;
|
|
20
21
|
constructor(data: ClassificationData, config: InteractionConfig, assets: NormalizedAssets | null);
|
|
21
22
|
protected initialize(): void;
|
|
@@ -27,6 +28,8 @@ export declare class OpenClassification extends BaseInteraction<ClassificationDa
|
|
|
27
28
|
getCurrentState(): any;
|
|
28
29
|
isInteractionComplete(): boolean;
|
|
29
30
|
onHint(): void;
|
|
31
|
+
immediatelyGradeItems(): void;
|
|
32
|
+
grade(): void;
|
|
30
33
|
submit(): void;
|
|
31
34
|
reset(): void;
|
|
32
35
|
}
|
|
@@ -1,2 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 'Rank Order' - "I really dislike the name"
|
|
3
|
+
*
|
|
4
|
+
* Inspired from H5P 'Sort the Paragraphs' interaction implementation.
|
|
5
|
+
* @see https://h5p.org/content-types/sort-the-paragraphs
|
|
6
|
+
* */
|
|
7
|
+
import { BaseInteraction } from "@/core";
|
|
8
|
+
import { Variant } from "@/types/Global";
|
|
9
|
+
import { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
10
|
+
import { NormalizedAssets } from "@/types/Assets";
|
|
11
|
+
import { SeriationData } from "@/types/Data";
|
|
12
|
+
export declare class RankOrder extends BaseInteraction<SeriationData> {
|
|
13
|
+
id: string;
|
|
14
|
+
interactionMechanic: InteractionMechanic;
|
|
15
|
+
private currentOrder;
|
|
16
|
+
private isGraded;
|
|
17
|
+
private $container;
|
|
18
|
+
private $rowsContainer;
|
|
19
|
+
private draggedRowIndex;
|
|
20
|
+
private dragOverRowIndex;
|
|
21
|
+
private isDragging;
|
|
22
|
+
private draggedRow;
|
|
23
|
+
private dragOffsetY;
|
|
24
|
+
private boundPointerMove;
|
|
25
|
+
private boundPointerUp;
|
|
26
|
+
private variant;
|
|
27
|
+
private _activeAnimationInterval;
|
|
28
|
+
private readonly MAX_ITEMS;
|
|
29
|
+
private readonly MIN_ITEM_HEIGHT;
|
|
30
|
+
constructor(data: SeriationData, config: InteractionConfig, assets: NormalizedAssets | null);
|
|
31
|
+
protected initialize(): void;
|
|
32
|
+
protected cleanup(): void;
|
|
33
|
+
onVariantChange(newVariant: Variant): void;
|
|
34
|
+
render(): void;
|
|
35
|
+
private renderRows;
|
|
36
|
+
private createButton;
|
|
37
|
+
private swapItems;
|
|
38
|
+
private captureRowPositions;
|
|
39
|
+
private animateRowReorder;
|
|
40
|
+
private handlePointerDown;
|
|
41
|
+
private handlePointerMove;
|
|
42
|
+
private handlePointerUp;
|
|
43
|
+
private getRowIndexAtY;
|
|
44
|
+
getCurrentState(): any;
|
|
45
|
+
isInteractionComplete(): boolean;
|
|
46
|
+
onHint(): void;
|
|
47
|
+
submit(): void;
|
|
48
|
+
reset(): void;
|
|
49
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseInteraction } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { BaseInteraction } from "@/core";
|
|
2
|
+
import type { CognitiveOperation } from "@/types/Global";
|
|
3
|
+
import { InteractionMechanic } from "@/types/Interactions";
|
|
4
|
+
import { InteractionData } from "@/types/Data";
|
|
5
5
|
export type InteractionConstructor = new (...args: any[]) => BaseInteraction<InteractionData>;
|
|
6
6
|
export type InteractionCapabilities = {
|
|
7
7
|
isSequential: boolean;
|
|
@@ -15,7 +15,7 @@ export type InteractionRegistryItem = {
|
|
|
15
15
|
id: string;
|
|
16
16
|
label: string;
|
|
17
17
|
elementTag: string;
|
|
18
|
-
cognitiveOp?:
|
|
18
|
+
cognitiveOp?: CognitiveOperation;
|
|
19
19
|
mechanic: InteractionMechanic;
|
|
20
20
|
engine: "tables" | "text" | "direct" | "mixed";
|
|
21
21
|
ctor: InteractionConstructor;
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* SEQUENTIAL CLASSIFICATION - Classify items one at a time
|
|
3
3
|
*
|
|
4
4
|
* interaction mechanics inspired from
|
|
5
|
-
* @see https://learningapps.org
|
|
5
|
+
* @see https://learningapps.org (group assignment)
|
|
6
6
|
*/
|
|
7
|
-
import { BaseInteraction } from "
|
|
8
|
-
import { Variant } from "
|
|
9
|
-
import { InteractionConfig, InteractionMechanic } from "
|
|
10
|
-
import { NormalizedAssets } from "
|
|
11
|
-
import { ClassificationData } from "
|
|
7
|
+
import { BaseInteraction } from "@/core";
|
|
8
|
+
import { Variant } from "@/types/Global";
|
|
9
|
+
import { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
10
|
+
import { NormalizedAssets } from "@/types/Assets";
|
|
11
|
+
import { ClassificationData } from "@/types/Data";
|
|
12
12
|
export declare class SequentialClassification extends BaseInteraction<ClassificationData> {
|
|
13
|
+
id: string;
|
|
13
14
|
interactionMechanic: InteractionMechanic;
|
|
14
15
|
private categories;
|
|
15
16
|
private allItems;
|
|
@@ -28,6 +29,7 @@ export declare class SequentialClassification extends BaseInteraction<Classifica
|
|
|
28
29
|
private offsetY;
|
|
29
30
|
private boundPointerMove;
|
|
30
31
|
private boundPointerUp;
|
|
32
|
+
private activeAnimationInterval;
|
|
31
33
|
private variant;
|
|
32
34
|
constructor(data: ClassificationData, config: InteractionConfig, assets: NormalizedAssets | null);
|
|
33
35
|
protected initialize(): void;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { BaseInteraction } from "
|
|
2
|
-
import { Variant } from "
|
|
3
|
-
import { InteractionConfig, InteractionMechanic } from "
|
|
4
|
-
import { NormalizedAssets } from "
|
|
5
|
-
import { AssociationData } from "
|
|
6
|
-
type SimultaneousAssociationSpec = {
|
|
7
|
-
rightColumnLabel: string;
|
|
8
|
-
leftColumnLabel: string;
|
|
9
|
-
layoutDirection: 'vertical' | 'horizontal';
|
|
10
|
-
};
|
|
1
|
+
import { BaseInteraction } from "@/core";
|
|
2
|
+
import { Variant } from "@/types/Global";
|
|
3
|
+
import { InteractionConfig, InteractionMechanic } from "@/types/Interactions";
|
|
4
|
+
import { NormalizedAssets } from "@/types/Assets";
|
|
5
|
+
import { AssociationData } from "@/types/Data";
|
|
11
6
|
export declare class SimultaneousAssociation extends BaseInteraction<AssociationData> {
|
|
7
|
+
id: string;
|
|
12
8
|
interactionMechanic: InteractionMechanic;
|
|
13
9
|
private leftItems;
|
|
14
10
|
private rightItems;
|
|
@@ -19,7 +15,7 @@ export declare class SimultaneousAssociation extends BaseInteraction<Association
|
|
|
19
15
|
private currentColor;
|
|
20
16
|
private $leftCol;
|
|
21
17
|
private $rightCol;
|
|
22
|
-
constructor(data: AssociationData, config: InteractionConfig, assets: NormalizedAssets | null
|
|
18
|
+
constructor(data: AssociationData, config: InteractionConfig, assets: NormalizedAssets | null);
|
|
23
19
|
protected initialize(): void;
|
|
24
20
|
protected cleanup(): void;
|
|
25
21
|
onVariantChange(newVariant: Variant): void;
|
|
@@ -31,4 +27,3 @@ export declare class SimultaneousAssociation extends BaseInteraction<Association
|
|
|
31
27
|
submit(): void;
|
|
32
28
|
reset(): void;
|
|
33
29
|
}
|
|
34
|
-
export {};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* This manager injects keyframe definitions into Shadow DOM and provides
|
|
6
6
|
* a simple API to apply animations to elements.
|
|
7
7
|
*/
|
|
8
|
-
export type AnimationName = 'shake' | 'pulse-
|
|
8
|
+
export type AnimationName = 'shake' | 'pulse-color' | 'bounce-in' | 'float' | 'rubber' | 'jello' | 'heartbeat' | 'shimmer' | 'wobble' | 'pop' | 'fade-slide' | 'swing' | 'orbit' | 'flash' | 'spin-pulse' | 'wobble-no-transform' | 'shake-no-transform';
|
|
9
9
|
export interface AnimationOptions {
|
|
10
10
|
duration?: string;
|
|
11
11
|
timing?: string;
|
|
@@ -39,6 +39,11 @@ export declare class AnimationsManager {
|
|
|
39
39
|
* @param options - Optional animation configuration
|
|
40
40
|
*/
|
|
41
41
|
animateFor(element: HTMLElement, animationName: AnimationName, durationMs: number, options?: AnimationOptions): void;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* NOTE: new
|
|
45
|
+
*/
|
|
46
|
+
randomlyAnimateChildrenFromContainer(children: HTMLElement[], animationName?: AnimationName, durationMs?: number, timeout?: number, options?: AnimationOptions): number;
|
|
42
47
|
/**
|
|
43
48
|
* Get all available animation names
|
|
44
49
|
*/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
type Point = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
type DragStartEvent = {
|
|
6
|
+
pointerId: number;
|
|
7
|
+
point: Point;
|
|
8
|
+
};
|
|
9
|
+
type DragMoveEvent = {
|
|
10
|
+
pointerId: number;
|
|
11
|
+
point: Point;
|
|
12
|
+
delta: Point;
|
|
13
|
+
};
|
|
14
|
+
type DragEndEvent = {
|
|
15
|
+
pointerId: number;
|
|
16
|
+
point: Point;
|
|
17
|
+
};
|
|
18
|
+
type DropTarget = {
|
|
19
|
+
id: string;
|
|
20
|
+
element: HTMLElement;
|
|
21
|
+
accepts?: (dragId: string) => boolean;
|
|
22
|
+
};
|
|
23
|
+
type DragSession = {
|
|
24
|
+
dragId: string;
|
|
25
|
+
pointerId: number;
|
|
26
|
+
start: Point;
|
|
27
|
+
current: Point;
|
|
28
|
+
offset: Point;
|
|
29
|
+
activeTargetId: string | null;
|
|
30
|
+
};
|
|
31
|
+
declare class DndManager {
|
|
32
|
+
private session;
|
|
33
|
+
beginDrag(dragId: string, pointerId: number, start: Point, offset: Point): void;
|
|
34
|
+
moveDrag(point: Point): void;
|
|
35
|
+
endDrag(): DragSession;
|
|
36
|
+
getSession(): DragSession;
|
|
37
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* ProgressManager - Utility for managing interaction progress
|
|
3
3
|
*
|
|
4
|
-
* Shell-agnostic progress
|
|
4
|
+
* Shell-agnostic progress management that can be used by any interaction.
|
|
5
5
|
* Maintains current/total state and calculates percentage.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
|
-
* const
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* const manager = new ProgressManager();
|
|
10
|
+
* manager.initialize(10);
|
|
11
|
+
* manager.increment(); // current = 1
|
|
12
|
+
* manager.getPercentage(); // 10
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
export declare class
|
|
15
|
+
export declare class ProgressManager {
|
|
16
16
|
private _current;
|
|
17
17
|
_total: number;
|
|
18
18
|
/**
|
|
19
|
-
* Initialize
|
|
19
|
+
* Initialize manager with total number of items
|
|
20
20
|
*/
|
|
21
21
|
initialize(total: number): void;
|
|
22
22
|
/**
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scoring Manager - Utility class for tracking scoring. Supports immediate feedback and single grading pass.
|
|
3
|
+
*
|
|
4
|
+
* Intended to solve all grading problems at once.
|
|
5
|
+
* For deterministic interactions, where it's just a set number of items divided againt the incorrect portion.
|
|
6
|
+
* For dynamic interactions, where one item can have multiple options that need to be calculated independently.
|
|
7
|
+
* For complex interactions, where there can be an undefined amount of options.
|
|
8
|
+
*/
|
|
9
|
+
import { GradingResult } from "@/types/Grading";
|
|
10
|
+
type ComplexItem = {
|
|
11
|
+
id: string;
|
|
12
|
+
total: number;
|
|
13
|
+
incorrect: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Intended usage
|
|
17
|
+
*
|
|
18
|
+
* scoringManager = new ScoringManager();
|
|
19
|
+
*
|
|
20
|
+
* scoringManager.initialize(10, 100, 75);
|
|
21
|
+
*
|
|
22
|
+
* when grading, meaning you get correct/wrong state.
|
|
23
|
+
* if (wrong) scoringManager.reduceOne();
|
|
24
|
+
* correct answered items don't need to do anything since we start calculating from 100 percentange.
|
|
25
|
+
*
|
|
26
|
+
* when having a complex item
|
|
27
|
+
* scoringManager.calculateCoplexItem({ total: 5, incorrect: 2 });
|
|
28
|
+
*
|
|
29
|
+
* in case we remove the graded state from one item.
|
|
30
|
+
* scoringManager.resetGradedItem();
|
|
31
|
+
* that can be seen as 'undo marking of an item as wrong'.
|
|
32
|
+
*
|
|
33
|
+
* if time is up and we are on question n/10
|
|
34
|
+
* scoringManager.reduceAmountOfItemsLeft();
|
|
35
|
+
*/
|
|
36
|
+
export declare class ScoringManager {
|
|
37
|
+
_totalItems: number;
|
|
38
|
+
_currentlyGradedItems: number;
|
|
39
|
+
private _points;
|
|
40
|
+
private _minimumScore;
|
|
41
|
+
private _itemValue;
|
|
42
|
+
private _currentScore;
|
|
43
|
+
private _gradedComplexItems;
|
|
44
|
+
/**
|
|
45
|
+
* By points we understand to be dealing with the base scoring unit.
|
|
46
|
+
* For example: 5 points, 15 points, 20 points, 50 points, etc. With limit of 100 of points.
|
|
47
|
+
*/
|
|
48
|
+
initialize(total: number, points?: number, minimum?: number): void;
|
|
49
|
+
resetGradedItem(): void;
|
|
50
|
+
resetGradedItemAmount(amount: number): void;
|
|
51
|
+
resetComplexGradedItem(id: string): void;
|
|
52
|
+
reduceOne(): void;
|
|
53
|
+
reduceAmount(amount: number): void;
|
|
54
|
+
/**
|
|
55
|
+
* Useful for timeouts, rule breaking or lives end
|
|
56
|
+
*/
|
|
57
|
+
reduceAmountOfItemsLeft(): void;
|
|
58
|
+
getAmountOfItemsLeft(): number;
|
|
59
|
+
getCurrentlyGradedItems(): number;
|
|
60
|
+
increaseCurrentlyGradedItems(amount?: number): void;
|
|
61
|
+
reduceCurrentlyGradedItems(amount?: number): void;
|
|
62
|
+
private decreaseScore;
|
|
63
|
+
private increaseScore;
|
|
64
|
+
calculateComplexItem(item: ComplexItem): void;
|
|
65
|
+
getScore(): GradingResult;
|
|
66
|
+
getResultLabel(): string;
|
|
67
|
+
getResultFeedbackHelper(): {
|
|
68
|
+
color: string;
|
|
69
|
+
message: string;
|
|
70
|
+
};
|
|
71
|
+
reset(): void;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
package/dist/shared/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SoundName } from "
|
|
1
|
+
import type { SoundName } from "@/managers/SoundManager";
|
|
2
2
|
export type CognikitThemeVariableName = "--edu-bg" | "--edu-card" | "--edu-ink" | "--edu-second-ink" | "--edu-third-ink" | "--edu-inverted-ink" | "--edu-success" | "--edu-error" | "--edu-warning" | "--edu-neutral" | "--edu-first-accent" | "--edu-second-accent" | "--edu-third-accent" | "--edu-border" | "--edu-muted" | "--edu-radius" | "--edu-shadow-color" | "--edu-pad" | "--edu-mar";
|
|
3
3
|
export type CognikitThemeVariables = Record<CognikitThemeVariableName, string>;
|
|
4
4
|
export type CognikitThemeName = "default-light" | "default-dark" | "ocean-light" | "ocean-dark" | "forest-light" | "forest-dark";
|
package/dist/shared/index.d.ts
CHANGED
package/dist/shared/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const ASCII_LETTERS = "abcdefghijklmnopqrstuvwxyz";
|
|
2
|
+
export declare const COLORS_LIST: string[];
|
|
2
3
|
export declare function shuffle<T>(array: T[]): T[];
|
|
3
4
|
export declare const hash: (str: string, seed?: number) => string;
|
|
4
5
|
export declare function escapeHtml(s: string): string;
|