jspsych-tangram 0.0.18 → 0.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jspsych-tangram",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "Tangram tasks for jsPsych: prep and construct.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -32,6 +32,11 @@
32
32
  "types": "./dist/afc/index.d.ts",
33
33
  "import": "./dist/afc/index.js",
34
34
  "require": "./dist/afc/index.cjs"
35
+ },
36
+ "./grid": {
37
+ "types": "./dist/grid/index.d.ts",
38
+ "import": "./dist/grid/index.js",
39
+ "require": "./dist/grid/index.cjs"
35
40
  }
36
41
  },
37
42
  "files": [
@@ -40,12 +45,13 @@
40
45
  "tangram-prep.min.js",
41
46
  "tangram-construct.min.js",
42
47
  "tangram-nback.min.js",
43
- "tangram-afc.min.js"
48
+ "tangram-afc.min.js",
49
+ "tangram-grid.min.js"
44
50
  ],
45
51
  "source": "src/index.ts",
46
52
  "scripts": {
47
53
  "build": "rollup --config",
48
- "postbuild": "cp dist/prep/index.browser.min.js tangram-prep.min.js && cp dist/construct/index.browser.min.js tangram-construct.min.js && cp dist/nback/index.browser.min.js tangram-nback.min.js && cp dist/afc/index.browser.min.js tangram-afc.min.js",
54
+ "postbuild": "cp dist/prep/index.browser.min.js tangram-prep.min.js && cp dist/construct/index.browser.min.js tangram-construct.min.js && cp dist/nback/index.browser.min.js tangram-nback.min.js && cp dist/afc/index.browser.min.js tangram-afc.min.js && cp dist/grid/index.browser.min.js tangram-grid.min.js",
49
55
  "build:watch": "npm run build -- --watch",
50
56
  "dev": "vite",
51
57
  "test": "jest",
@@ -32,7 +32,7 @@ const info = {
32
32
  },
33
33
  /** Input method for piece manipulation */
34
34
  input: {
35
- type: ParameterType.SELECT,
35
+ type: ParameterType.SELECT,
36
36
  options: ["click", "drag"],
37
37
  default: "drag",
38
38
  description: "Input mode: drag (mouse/touch drag) or click (click to select/place)"
@@ -40,7 +40,7 @@ const info = {
40
40
  /** Layout style for piece arrangement */
41
41
  layout: {
42
42
  type: ParameterType.SELECT,
43
- options: ["circle", "semicircle"],
43
+ options: ["circle", "semicircle"],
44
44
  default: "semicircle",
45
45
  description: "Layout mode: full circle or semicircle piece arrangement"
46
46
  },
@@ -189,7 +189,7 @@ class TangramConstructPlugin implements JsPsychPlugin<Info> {
189
189
 
190
190
  // Use React wrapper to start the trial
191
191
  const { root, display_element: element, jsPsych } = startConstructionTrial(display_element, params, this.jsPsych);
192
-
192
+
193
193
  // Store React context for cleanup
194
194
  (element as any).__reactContext = { root, jsPsych };
195
195
  }
@@ -85,6 +85,9 @@ function GridView({ params }: GridViewProps) {
85
85
  onTrialEnd
86
86
  } = params;
87
87
 
88
+ // Extract non-callback params for trial data
89
+ const { onTrialEnd: _, ...trialParams } = params;
90
+
88
91
  const trialStartTime = useRef<number>(Date.now());
89
92
  const [response, setResponse] = useState<string>("");
90
93
  const [cellSize, setCellSize] = useState<number>(100);
@@ -241,12 +244,10 @@ function GridView({ params }: GridViewProps) {
241
244
  const trialData = {
242
245
  response,
243
246
  rt,
244
- n_rows,
245
- n_cols,
246
- tangram_ids: processedTangrams.map((t) => t.tangramId),
247
- show_tangram_decomposition,
248
- use_primitive_colors: usePrimitiveColors,
249
- primitive_color_indices: primitiveColorIndices
247
+ trialParams: {
248
+ ...trialParams,
249
+ tangramIDs: processedTangrams.map((t) => t.tangramId)
250
+ }
250
251
  };
251
252
  if (onTrialEnd) {
252
253
  onTrialEnd(trialData);