jspsych-tangram 0.0.8 → 0.0.10

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 (44) hide show
  1. package/dist/construct/index.browser.js +4572 -3884
  2. package/dist/construct/index.browser.js.map +1 -1
  3. package/dist/construct/index.browser.min.js +15 -12
  4. package/dist/construct/index.browser.min.js.map +1 -1
  5. package/dist/construct/index.cjs +45 -9
  6. package/dist/construct/index.cjs.map +1 -1
  7. package/dist/construct/index.js +45 -9
  8. package/dist/construct/index.js.map +1 -1
  9. package/dist/index.cjs +373 -13
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +180 -8
  12. package/dist/index.js +374 -15
  13. package/dist/index.js.map +1 -1
  14. package/dist/nback/index.browser.js +17703 -0
  15. package/dist/nback/index.browser.js.map +1 -0
  16. package/dist/nback/index.browser.min.js +42 -0
  17. package/dist/nback/index.browser.min.js.map +1 -0
  18. package/dist/nback/index.cjs +395 -0
  19. package/dist/nback/index.cjs.map +1 -0
  20. package/dist/nback/index.d.ts +175 -0
  21. package/dist/nback/index.js +393 -0
  22. package/dist/nback/index.js.map +1 -0
  23. package/dist/prep/index.browser.js +4578 -3892
  24. package/dist/prep/index.browser.js.map +1 -1
  25. package/dist/prep/index.browser.min.js +16 -13
  26. package/dist/prep/index.browser.min.js.map +1 -1
  27. package/dist/prep/index.cjs +46 -12
  28. package/dist/prep/index.cjs.map +1 -1
  29. package/dist/prep/index.js +46 -12
  30. package/dist/prep/index.js.map +1 -1
  31. package/package.json +9 -3
  32. package/src/assets/README.md +6 -0
  33. package/src/assets/images.d.ts +19 -0
  34. package/src/assets/locked.png +0 -0
  35. package/src/assets/unlocked.png +0 -0
  36. package/src/core/components/board/BoardView.tsx +72 -29
  37. package/src/core/io/InteractionTracker.ts +16 -8
  38. package/src/core/io/data-tracking.ts +3 -0
  39. package/src/index.ts +2 -1
  40. package/src/plugins/tangram-nback/NBackApp.tsx +316 -0
  41. package/src/plugins/tangram-nback/index.ts +141 -0
  42. package/tangram-construct.min.js +15 -12
  43. package/tangram-nback.min.js +42 -0
  44. package/tangram-prep.min.js +16 -13
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$1: {
3
+ declare const info$2: {
4
4
  name: string;
5
5
  version: string;
6
6
  parameters: {
@@ -109,7 +109,7 @@ declare const info$1: {
109
109
  };
110
110
  citations: string;
111
111
  };
112
- type Info$1 = typeof info$1;
112
+ type Info$2 = typeof info$2;
113
113
  /**
114
114
  * **tangram-construct**
115
115
  *
@@ -118,7 +118,7 @@ type Info$1 = typeof info$1;
118
118
  * @author Justin Yang & Sean Paul Anderson
119
119
  * @see {@link https://github.com/cogtoolslab/tangram_construction.git/tree/main/experiments/jspsych-tangram-prep}
120
120
  */
121
- declare class TangramConstructPlugin implements JsPsychPlugin<Info$1> {
121
+ declare class TangramConstructPlugin implements JsPsychPlugin<Info$2> {
122
122
  private jsPsych;
123
123
  static info: {
124
124
  name: string;
@@ -234,10 +234,10 @@ declare class TangramConstructPlugin implements JsPsychPlugin<Info$1> {
234
234
  * Launches the trial by invoking startConstructionTrial
235
235
  * with the display element, parameters, and jsPsych instance.
236
236
  */
237
- trial(display_element: HTMLElement, trial: TrialType<Info$1>): void;
237
+ trial(display_element: HTMLElement, trial: TrialType<Info$2>): void;
238
238
  }
239
239
 
240
- declare const info: {
240
+ declare const info$1: {
241
241
  name: string;
242
242
  version: string;
243
243
  parameters: {
@@ -308,7 +308,7 @@ declare const info: {
308
308
  };
309
309
  citations: string;
310
310
  };
311
- type Info = typeof info;
311
+ type Info$1 = typeof info$1;
312
312
  /**
313
313
  * **tangram-prep**
314
314
  *
@@ -316,7 +316,7 @@ type Info = typeof info;
316
316
  *
317
317
  * @author Justin Yang & Sean Paul Anderson
318
318
  */
319
- declare class TangramPrepPlugin implements JsPsychPlugin<Info> {
319
+ declare class TangramPrepPlugin implements JsPsychPlugin<Info$1> {
320
320
  private jsPsych;
321
321
  static info: {
322
322
  name: string;
@@ -394,7 +394,179 @@ declare class TangramPrepPlugin implements JsPsychPlugin<Info> {
394
394
  * Launches the trial by invoking startPrepTrial
395
395
  * with the display element, parameters, and jsPsych instance.
396
396
  */
397
+ trial(display_element: HTMLElement, trial: TrialType<Info$1>): void;
398
+ }
399
+
400
+ declare const info: {
401
+ name: string;
402
+ version: string;
403
+ parameters: {
404
+ /** Single tangram specification to display */
405
+ tangram: {
406
+ type: ParameterType;
407
+ default: undefined;
408
+ description: string;
409
+ };
410
+ /** Whether this trial is a match (for computing accuracy) */
411
+ isMatch: {
412
+ type: ParameterType;
413
+ default: undefined;
414
+ description: string;
415
+ };
416
+ /** Whether to show tangram decomposed into individual primitives with borders */
417
+ show_tangram_decomposition: {
418
+ type: ParameterType;
419
+ default: boolean;
420
+ description: string;
421
+ };
422
+ /** HTML content to display above the tangram as instructions */
423
+ instructions: {
424
+ type: ParameterType;
425
+ default: string;
426
+ description: string;
427
+ };
428
+ /** Text to display on response button */
429
+ button_text: {
430
+ type: ParameterType;
431
+ default: string;
432
+ description: string;
433
+ };
434
+ /** Duration to display tangram and accept responses (milliseconds) */
435
+ duration: {
436
+ type: ParameterType;
437
+ default: number;
438
+ description: string;
439
+ };
440
+ /** Callback fired when trial ends */
441
+ onTrialEnd: {
442
+ type: ParameterType;
443
+ default: undefined;
444
+ description: string;
445
+ };
446
+ };
447
+ data: {
448
+ /** Whether participant clicked the response button before duration expired */
449
+ responded_match: {
450
+ type: ParameterType;
451
+ description: string;
452
+ };
453
+ /** Reaction time in milliseconds (NaN if no response or response after duration) */
454
+ rt: {
455
+ type: ParameterType;
456
+ description: string;
457
+ };
458
+ /** Accuracy: 1 if correct, 0 if incorrect, NaN if isMatch not provided */
459
+ accuracy: {
460
+ type: ParameterType;
461
+ description: string;
462
+ };
463
+ /** Whether response occurred after duration expired */
464
+ responded_after_duration: {
465
+ type: ParameterType;
466
+ description: string;
467
+ };
468
+ /** Time of late response (NaN if no late response) */
469
+ rt_after_duration: {
470
+ type: ParameterType;
471
+ description: string;
472
+ };
473
+ };
474
+ citations: string;
475
+ };
476
+ type Info = typeof info;
477
+ /**
478
+ * **tangram-nback**
479
+ *
480
+ * A jsPsych plugin for n-back matching trials displaying a single tangram
481
+ * with a response button.
482
+ *
483
+ * @author Justin Yang & Sean Paul Anderson
484
+ * @see {@link https://github.com/cogtoolslab/tangram_construction.git/tree/main/experiments/jspsych-tangram-prep}
485
+ */
486
+ declare class TangramNBackPlugin implements JsPsychPlugin<Info> {
487
+ private jsPsych;
488
+ static info: {
489
+ name: string;
490
+ version: string;
491
+ parameters: {
492
+ /** Single tangram specification to display */
493
+ tangram: {
494
+ type: ParameterType;
495
+ default: undefined;
496
+ description: string;
497
+ };
498
+ /** Whether this trial is a match (for computing accuracy) */
499
+ isMatch: {
500
+ type: ParameterType;
501
+ default: undefined;
502
+ description: string;
503
+ };
504
+ /** Whether to show tangram decomposed into individual primitives with borders */
505
+ show_tangram_decomposition: {
506
+ type: ParameterType;
507
+ default: boolean;
508
+ description: string;
509
+ };
510
+ /** HTML content to display above the tangram as instructions */
511
+ instructions: {
512
+ type: ParameterType;
513
+ default: string;
514
+ description: string;
515
+ };
516
+ /** Text to display on response button */
517
+ button_text: {
518
+ type: ParameterType;
519
+ default: string;
520
+ description: string;
521
+ };
522
+ /** Duration to display tangram and accept responses (milliseconds) */
523
+ duration: {
524
+ type: ParameterType;
525
+ default: number;
526
+ description: string;
527
+ };
528
+ /** Callback fired when trial ends */
529
+ onTrialEnd: {
530
+ type: ParameterType;
531
+ default: undefined;
532
+ description: string;
533
+ };
534
+ };
535
+ data: {
536
+ /** Whether participant clicked the response button before duration expired */
537
+ responded_match: {
538
+ type: ParameterType;
539
+ description: string;
540
+ };
541
+ /** Reaction time in milliseconds (NaN if no response or response after duration) */
542
+ rt: {
543
+ type: ParameterType;
544
+ description: string;
545
+ };
546
+ /** Accuracy: 1 if correct, 0 if incorrect, NaN if isMatch not provided */
547
+ accuracy: {
548
+ type: ParameterType;
549
+ description: string;
550
+ };
551
+ /** Whether response occurred after duration expired */
552
+ responded_after_duration: {
553
+ type: ParameterType;
554
+ description: string;
555
+ };
556
+ /** Time of late response (NaN if no late response) */
557
+ rt_after_duration: {
558
+ type: ParameterType;
559
+ description: string;
560
+ };
561
+ };
562
+ citations: string;
563
+ };
564
+ constructor(jsPsych: JsPsych);
565
+ /**
566
+ * Launches the trial by invoking startNBackTrial
567
+ * with the display element, parameters, and jsPsych instance.
568
+ */
397
569
  trial(display_element: HTMLElement, trial: TrialType<Info>): void;
398
570
  }
399
571
 
400
- export { TangramConstructPlugin, TangramPrepPlugin };
572
+ export { TangramConstructPlugin, TangramNBackPlugin, TangramPrepPlugin };