jspsych-tangram 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/construct/index.browser.js +23 -5
  2. package/dist/construct/index.browser.js.map +1 -1
  3. package/dist/construct/index.browser.min.js +8 -8
  4. package/dist/construct/index.browser.min.js.map +1 -1
  5. package/dist/construct/index.cjs +23 -5
  6. package/dist/construct/index.cjs.map +1 -1
  7. package/dist/construct/index.js +23 -5
  8. package/dist/construct/index.js.map +1 -1
  9. package/dist/grid/index.browser.js +17855 -0
  10. package/dist/grid/index.browser.js.map +1 -0
  11. package/dist/grid/index.browser.min.js +47 -0
  12. package/dist/grid/index.browser.min.js.map +1 -0
  13. package/dist/grid/index.cjs +547 -0
  14. package/dist/grid/index.cjs.map +1 -0
  15. package/dist/grid/index.d.ts +174 -0
  16. package/dist/grid/index.js +545 -0
  17. package/dist/grid/index.js.map +1 -0
  18. package/dist/index.cjs +548 -13
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.ts +187 -16
  21. package/dist/index.js +549 -15
  22. package/dist/index.js.map +1 -1
  23. package/dist/prep/index.browser.js +23 -5
  24. package/dist/prep/index.browser.js.map +1 -1
  25. package/dist/prep/index.browser.min.js +6 -6
  26. package/dist/prep/index.browser.min.js.map +1 -1
  27. package/dist/prep/index.cjs +23 -5
  28. package/dist/prep/index.cjs.map +1 -1
  29. package/dist/prep/index.js +23 -5
  30. package/dist/prep/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/core/components/board/GameBoard.tsx +12 -0
  33. package/src/core/io/InteractionTracker.ts +19 -7
  34. package/src/core/io/data-tracking.ts +5 -0
  35. package/src/index.ts +2 -1
  36. package/src/plugins/tangram-grid/GridApp.tsx +522 -0
  37. package/src/plugins/tangram-grid/index.ts +154 -0
  38. package/tangram-construct.min.js +8 -8
  39. package/tangram-prep.min.js +6 -6
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { JsPsychPlugin, ParameterType, JsPsych, TrialType } from 'jspsych';
2
2
 
3
- declare const info$3: {
3
+ declare const info$4: {
4
4
  name: string;
5
5
  version: string;
6
6
  parameters: {
@@ -127,7 +127,7 @@ declare const info$3: {
127
127
  };
128
128
  citations: string;
129
129
  };
130
- type Info$3 = typeof info$3;
130
+ type Info$4 = typeof info$4;
131
131
  /**
132
132
  * **tangram-construct**
133
133
  *
@@ -136,7 +136,7 @@ type Info$3 = typeof info$3;
136
136
  * @author Justin Yang & Sean Paul Anderson
137
137
  * @see {@link https://github.com/cogtoolslab/tangram_construction.git/tree/main/experiments/jspsych-tangram-prep}
138
138
  */
139
- declare class TangramConstructPlugin implements JsPsychPlugin<Info$3> {
139
+ declare class TangramConstructPlugin implements JsPsychPlugin<Info$4> {
140
140
  private jsPsych;
141
141
  static info: {
142
142
  name: string;
@@ -270,10 +270,10 @@ declare class TangramConstructPlugin implements JsPsychPlugin<Info$3> {
270
270
  * Launches the trial by invoking startConstructionTrial
271
271
  * with the display element, parameters, and jsPsych instance.
272
272
  */
273
- trial(display_element: HTMLElement, trial: TrialType<Info$3>): void;
273
+ trial(display_element: HTMLElement, trial: TrialType<Info$4>): void;
274
274
  }
275
275
 
276
- declare const info$2: {
276
+ declare const info$3: {
277
277
  name: string;
278
278
  version: string;
279
279
  parameters: {
@@ -356,7 +356,7 @@ declare const info$2: {
356
356
  };
357
357
  citations: string;
358
358
  };
359
- type Info$2 = typeof info$2;
359
+ type Info$3 = typeof info$3;
360
360
  /**
361
361
  * **tangram-prep**
362
362
  *
@@ -364,7 +364,7 @@ type Info$2 = typeof info$2;
364
364
  *
365
365
  * @author Justin Yang & Sean Paul Anderson
366
366
  */
367
- declare class TangramPrepPlugin implements JsPsychPlugin<Info$2> {
367
+ declare class TangramPrepPlugin implements JsPsychPlugin<Info$3> {
368
368
  private jsPsych;
369
369
  static info: {
370
370
  name: string;
@@ -454,10 +454,10 @@ declare class TangramPrepPlugin implements JsPsychPlugin<Info$2> {
454
454
  * Launches the trial by invoking startPrepTrial
455
455
  * with the display element, parameters, and jsPsych instance.
456
456
  */
457
- trial(display_element: HTMLElement, trial: TrialType<Info$2>): void;
457
+ trial(display_element: HTMLElement, trial: TrialType<Info$3>): void;
458
458
  }
459
459
 
460
- declare const info$1: {
460
+ declare const info$2: {
461
461
  name: string;
462
462
  version: string;
463
463
  parameters: {
@@ -545,7 +545,7 @@ declare const info$1: {
545
545
  };
546
546
  citations: string;
547
547
  };
548
- type Info$1 = typeof info$1;
548
+ type Info$2 = typeof info$2;
549
549
  /**
550
550
  * **tangram-nback**
551
551
  *
@@ -555,7 +555,7 @@ type Info$1 = typeof info$1;
555
555
  * @author Justin Yang & Sean Paul Anderson
556
556
  * @see {@link https://github.com/cogtoolslab/tangram_construction.git/tree/main/experiments/jspsych-tangram-prep}
557
557
  */
558
- declare class TangramNBackPlugin implements JsPsychPlugin<Info$1> {
558
+ declare class TangramNBackPlugin implements JsPsychPlugin<Info$2> {
559
559
  private jsPsych;
560
560
  static info: {
561
561
  name: string;
@@ -650,10 +650,10 @@ declare class TangramNBackPlugin implements JsPsychPlugin<Info$1> {
650
650
  * Launches the trial by invoking startNBackTrial
651
651
  * with the display element, parameters, and jsPsych instance.
652
652
  */
653
- trial(display_element: HTMLElement, trial: TrialType<Info$1>): void;
653
+ trial(display_element: HTMLElement, trial: TrialType<Info$2>): void;
654
654
  }
655
655
 
656
- declare const info: {
656
+ declare const info$1: {
657
657
  name: string;
658
658
  version: string;
659
659
  parameters: {
@@ -726,7 +726,7 @@ declare const info: {
726
726
  };
727
727
  citations: string;
728
728
  };
729
- type Info = typeof info;
729
+ type Info$1 = typeof info$1;
730
730
  /**
731
731
  * **tangram-afc**
732
732
  *
@@ -736,7 +736,7 @@ type Info = typeof info;
736
736
  * @author Justin Yang & Sean Paul Anderson
737
737
  * @see {@link https://github.com/cogtoolslab/tangram_construction.git/tree/main/experiments/jspsych-tangram-prep}
738
738
  */
739
- declare class TangramAFCPlugin implements JsPsychPlugin<Info> {
739
+ declare class TangramAFCPlugin implements JsPsychPlugin<Info$1> {
740
740
  private jsPsych;
741
741
  static info: {
742
742
  name: string;
@@ -816,7 +816,178 @@ declare class TangramAFCPlugin implements JsPsychPlugin<Info> {
816
816
  * Launches the trial by invoking startAFCTrial
817
817
  * with the display element, parameters, and jsPsych instance.
818
818
  */
819
+ trial(display_element: HTMLElement, trial: TrialType<Info$1>): void;
820
+ }
821
+
822
+ declare const info: {
823
+ name: string;
824
+ version: string;
825
+ parameters: {
826
+ /** Array of tangram specifications to display in the grid */
827
+ tangrams: {
828
+ type: ParameterType;
829
+ default: undefined;
830
+ description: string;
831
+ };
832
+ /** Number of rows in the grid */
833
+ n_rows: {
834
+ type: ParameterType;
835
+ default: number;
836
+ description: string;
837
+ };
838
+ /** Number of columns in the grid */
839
+ n_cols: {
840
+ type: ParameterType;
841
+ default: number;
842
+ description: string;
843
+ };
844
+ /** Prompt text displayed above the text input */
845
+ prompt_text: {
846
+ type: ParameterType;
847
+ default: string;
848
+ description: string;
849
+ };
850
+ /** Label for the submit button */
851
+ button_text: {
852
+ type: ParameterType;
853
+ default: string;
854
+ description: string;
855
+ };
856
+ /** Whether to show tangrams decomposed into primitives */
857
+ show_tangram_decomposition: {
858
+ type: ParameterType;
859
+ default: boolean;
860
+ description: string;
861
+ };
862
+ /** Whether to use distinct colors for each primitive type */
863
+ use_primitive_colors: {
864
+ type: ParameterType;
865
+ default: boolean;
866
+ description: string;
867
+ };
868
+ /** Indices mapping primitives to colors */
869
+ primitive_color_indices: {
870
+ type: ParameterType;
871
+ default: number[];
872
+ description: string;
873
+ };
874
+ /** Callback fired when trial ends */
875
+ onTrialEnd: {
876
+ type: ParameterType;
877
+ default: undefined;
878
+ description: string;
879
+ };
880
+ };
881
+ data: {
882
+ /** The text response entered by the participant */
883
+ response: {
884
+ type: ParameterType;
885
+ description: string;
886
+ };
887
+ /** Reaction time from trial start to submit button click */
888
+ rt: {
889
+ type: ParameterType;
890
+ description: string;
891
+ };
892
+ };
893
+ citations: string;
894
+ };
895
+ type Info = typeof info;
896
+ /**
897
+ * **tangram-grid**
898
+ *
899
+ * A jsPsych plugin that displays a grid of tangrams with a text input field
900
+ * and submit button for collecting free-text responses.
901
+ *
902
+ * @author Sean Paul Anderson & Justin Yang
903
+ * @see {@link https://github.com/cogtoolslab/tangram_construction.git}
904
+ */
905
+ declare class TangramGridPlugin implements JsPsychPlugin<Info> {
906
+ private jsPsych;
907
+ static info: {
908
+ name: string;
909
+ version: string;
910
+ parameters: {
911
+ /** Array of tangram specifications to display in the grid */
912
+ tangrams: {
913
+ type: ParameterType;
914
+ default: undefined;
915
+ description: string;
916
+ };
917
+ /** Number of rows in the grid */
918
+ n_rows: {
919
+ type: ParameterType;
920
+ default: number;
921
+ description: string;
922
+ };
923
+ /** Number of columns in the grid */
924
+ n_cols: {
925
+ type: ParameterType;
926
+ default: number;
927
+ description: string;
928
+ };
929
+ /** Prompt text displayed above the text input */
930
+ prompt_text: {
931
+ type: ParameterType;
932
+ default: string;
933
+ description: string;
934
+ };
935
+ /** Label for the submit button */
936
+ button_text: {
937
+ type: ParameterType;
938
+ default: string;
939
+ description: string;
940
+ };
941
+ /** Whether to show tangrams decomposed into primitives */
942
+ show_tangram_decomposition: {
943
+ type: ParameterType;
944
+ default: boolean;
945
+ description: string;
946
+ };
947
+ /** Whether to use distinct colors for each primitive type */
948
+ use_primitive_colors: {
949
+ type: ParameterType;
950
+ default: boolean;
951
+ description: string;
952
+ };
953
+ /** Indices mapping primitives to colors */
954
+ primitive_color_indices: {
955
+ type: ParameterType;
956
+ default: number[];
957
+ description: string;
958
+ };
959
+ /** Callback fired when trial ends */
960
+ onTrialEnd: {
961
+ type: ParameterType;
962
+ default: undefined;
963
+ description: string;
964
+ };
965
+ };
966
+ data: {
967
+ /** The text response entered by the participant */
968
+ response: {
969
+ type: ParameterType;
970
+ description: string;
971
+ };
972
+ /** Reaction time from trial start to submit button click */
973
+ rt: {
974
+ type: ParameterType;
975
+ description: string;
976
+ };
977
+ };
978
+ citations: string;
979
+ };
980
+ constructor(jsPsych: JsPsych);
981
+ /**
982
+ * Launches the trial by invoking startGridTrial with the display element,
983
+ * parameters, and jsPsych instance.
984
+ *
985
+ * REQUIRES: display_element is a valid HTMLElement, trial contains valid
986
+ * parameters
987
+ * MODIFIES: display_element (renders React component)
988
+ * EFFECTS: Starts the grid trial and handles cleanup on completion
989
+ */
819
990
  trial(display_element: HTMLElement, trial: TrialType<Info>): void;
820
991
  }
821
992
 
822
- export { TangramAFCPlugin, TangramConstructPlugin, TangramNBackPlugin, TangramPrepPlugin };
993
+ export { TangramAFCPlugin, TangramConstructPlugin, TangramGridPlugin, TangramNBackPlugin, TangramPrepPlugin };