jspsych-tangram 0.0.1

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 (72) hide show
  1. package/README.md +25 -0
  2. package/dist/construct/index.browser.js +20431 -0
  3. package/dist/construct/index.browser.js.map +1 -0
  4. package/dist/construct/index.browser.min.js +42 -0
  5. package/dist/construct/index.browser.min.js.map +1 -0
  6. package/dist/construct/index.cjs +3720 -0
  7. package/dist/construct/index.cjs.map +1 -0
  8. package/dist/construct/index.d.ts +204 -0
  9. package/dist/construct/index.js +3718 -0
  10. package/dist/construct/index.js.map +1 -0
  11. package/dist/index.cjs +3920 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.ts +340 -0
  14. package/dist/index.js +3917 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/prep/index.browser.js +20455 -0
  17. package/dist/prep/index.browser.js.map +1 -0
  18. package/dist/prep/index.browser.min.js +42 -0
  19. package/dist/prep/index.browser.min.js.map +1 -0
  20. package/dist/prep/index.cjs +3744 -0
  21. package/dist/prep/index.cjs.map +1 -0
  22. package/dist/prep/index.d.ts +139 -0
  23. package/dist/prep/index.js +3742 -0
  24. package/dist/prep/index.js.map +1 -0
  25. package/package.json +77 -0
  26. package/src/core/components/README.md +249 -0
  27. package/src/core/components/board/BoardView.tsx +352 -0
  28. package/src/core/components/board/GameBoard.tsx +682 -0
  29. package/src/core/components/board/index.ts +70 -0
  30. package/src/core/components/board/useAnchorGrid.ts +110 -0
  31. package/src/core/components/board/useClickController.ts +436 -0
  32. package/src/core/components/board/useDragController.ts +1051 -0
  33. package/src/core/components/board/usePieceState.ts +178 -0
  34. package/src/core/components/board/utils.ts +76 -0
  35. package/src/core/components/index.ts +33 -0
  36. package/src/core/components/pieces/BlueprintRing.tsx +238 -0
  37. package/src/core/config/config.ts +85 -0
  38. package/src/core/domain/blueprints.ts +25 -0
  39. package/src/core/domain/layout.ts +159 -0
  40. package/src/core/domain/primitives.ts +159 -0
  41. package/src/core/domain/solve.ts +184 -0
  42. package/src/core/domain/types.ts +111 -0
  43. package/src/core/engine/collision/grid-snapping.ts +283 -0
  44. package/src/core/engine/collision/index.ts +4 -0
  45. package/src/core/engine/collision/sat-collision.ts +46 -0
  46. package/src/core/engine/collision/validation.ts +166 -0
  47. package/src/core/engine/geometry/bounds.ts +91 -0
  48. package/src/core/engine/geometry/collision.ts +64 -0
  49. package/src/core/engine/geometry/index.ts +19 -0
  50. package/src/core/engine/geometry/math.ts +101 -0
  51. package/src/core/engine/geometry/pieces.ts +290 -0
  52. package/src/core/engine/geometry/polygons.ts +43 -0
  53. package/src/core/engine/state/BaseGameController.ts +368 -0
  54. package/src/core/engine/validation/border-rendering.ts +318 -0
  55. package/src/core/engine/validation/complete.ts +102 -0
  56. package/src/core/engine/validation/face-to-face.ts +217 -0
  57. package/src/core/index.ts +3 -0
  58. package/src/core/io/InteractionTracker.ts +742 -0
  59. package/src/core/io/data-tracking.ts +271 -0
  60. package/src/core/io/json-to-tangram-spec.ts +110 -0
  61. package/src/core/io/quickstash.ts +141 -0
  62. package/src/core/io/stims.ts +110 -0
  63. package/src/core/types/index.ts +5 -0
  64. package/src/core/types/plugin-interfaces.ts +101 -0
  65. package/src/index.spec.ts +19 -0
  66. package/src/index.ts +2 -0
  67. package/src/plugins/tangram-construct/ConstructionApp.tsx +105 -0
  68. package/src/plugins/tangram-construct/index.ts +156 -0
  69. package/src/plugins/tangram-prep/PrepApp.tsx +182 -0
  70. package/src/plugins/tangram-prep/index.ts +122 -0
  71. package/tangram-construct.min.js +42 -0
  72. package/tangram-prep.min.js +42 -0
@@ -0,0 +1,204 @@
1
+ import { JsPsychPlugin, ParameterType, JsPsych, TrialType } from 'jspsych';
2
+
3
+ declare const info: {
4
+ name: string;
5
+ version: string;
6
+ parameters: {
7
+ /** Array of tangram specifications defining the puzzles to solve */
8
+ tangrams: {
9
+ type: ParameterType;
10
+ default: undefined;
11
+ description: string;
12
+ };
13
+ /** Array of pre-made macro pieces from prep plugin */
14
+ quickstash_macros: {
15
+ type: ParameterType;
16
+ default: never[];
17
+ description: string;
18
+ };
19
+ /** Whether to place pieces in workspace or directly on silhouette */
20
+ target: {
21
+ type: ParameterType;
22
+ options: string[];
23
+ default: string;
24
+ description: string;
25
+ };
26
+ /** Input method for piece manipulation */
27
+ input: {
28
+ type: ParameterType;
29
+ options: string[];
30
+ default: string;
31
+ description: string;
32
+ };
33
+ /** Layout style for piece arrangement */
34
+ layout: {
35
+ type: ParameterType;
36
+ options: string[];
37
+ default: string;
38
+ description: string;
39
+ };
40
+ /** Maximum time allowed for trial in milliseconds */
41
+ time_limit_ms: {
42
+ type: ParameterType;
43
+ default: number;
44
+ description: string;
45
+ };
46
+ /** Snap radius for piece placement in pixels */
47
+ snap_radius_px: {
48
+ type: ParameterType;
49
+ default: number;
50
+ description: string;
51
+ };
52
+ /** Callback fired after each interaction (piece pickup + placedown) */
53
+ onInteraction: {
54
+ type: ParameterType;
55
+ default: undefined;
56
+ description: string;
57
+ };
58
+ /** Callback fired when trial ends */
59
+ onTrialEnd: {
60
+ type: ParameterType;
61
+ default: undefined;
62
+ description: string;
63
+ };
64
+ };
65
+ data: {
66
+ /** Array of all interaction events during trial */
67
+ events: {
68
+ type: ParameterType;
69
+ description: string;
70
+ };
71
+ /** Completion time for each sector/tangram */
72
+ completion_times: {
73
+ type: ParameterType;
74
+ description: string;
75
+ };
76
+ /** Final completion state of each sector */
77
+ final_state: {
78
+ type: ParameterType;
79
+ description: string;
80
+ };
81
+ /** Usage statistics for macro pieces */
82
+ macros_used: {
83
+ type: ParameterType;
84
+ description: string;
85
+ };
86
+ /** Total trial duration in milliseconds */
87
+ trial_duration_ms: {
88
+ type: ParameterType;
89
+ description: string;
90
+ };
91
+ };
92
+ citations: string;
93
+ };
94
+ type Info = typeof info;
95
+ /**
96
+ * **tangram-construct**
97
+ *
98
+ * A jsPsych wrapper around the React-based construction interface.
99
+ *
100
+ * @author Justin Yang & Sean Paul Anderson
101
+ * @see {@link https://github.com/cogtoolslab/tangram_construction.git/tree/main/experiments/jspsych-tangram-prep}
102
+ */
103
+ declare class TangramConstructPlugin implements JsPsychPlugin<Info> {
104
+ private jsPsych;
105
+ static info: {
106
+ name: string;
107
+ version: string;
108
+ parameters: {
109
+ /** Array of tangram specifications defining the puzzles to solve */
110
+ tangrams: {
111
+ type: ParameterType;
112
+ default: undefined;
113
+ description: string;
114
+ };
115
+ /** Array of pre-made macro pieces from prep plugin */
116
+ quickstash_macros: {
117
+ type: ParameterType;
118
+ default: never[];
119
+ description: string;
120
+ };
121
+ /** Whether to place pieces in workspace or directly on silhouette */
122
+ target: {
123
+ type: ParameterType;
124
+ options: string[];
125
+ default: string;
126
+ description: string;
127
+ };
128
+ /** Input method for piece manipulation */
129
+ input: {
130
+ type: ParameterType;
131
+ options: string[];
132
+ default: string;
133
+ description: string;
134
+ };
135
+ /** Layout style for piece arrangement */
136
+ layout: {
137
+ type: ParameterType;
138
+ options: string[];
139
+ default: string;
140
+ description: string;
141
+ };
142
+ /** Maximum time allowed for trial in milliseconds */
143
+ time_limit_ms: {
144
+ type: ParameterType;
145
+ default: number;
146
+ description: string;
147
+ };
148
+ /** Snap radius for piece placement in pixels */
149
+ snap_radius_px: {
150
+ type: ParameterType;
151
+ default: number;
152
+ description: string;
153
+ };
154
+ /** Callback fired after each interaction (piece pickup + placedown) */
155
+ onInteraction: {
156
+ type: ParameterType;
157
+ default: undefined;
158
+ description: string;
159
+ };
160
+ /** Callback fired when trial ends */
161
+ onTrialEnd: {
162
+ type: ParameterType;
163
+ default: undefined;
164
+ description: string;
165
+ };
166
+ };
167
+ data: {
168
+ /** Array of all interaction events during trial */
169
+ events: {
170
+ type: ParameterType;
171
+ description: string;
172
+ };
173
+ /** Completion time for each sector/tangram */
174
+ completion_times: {
175
+ type: ParameterType;
176
+ description: string;
177
+ };
178
+ /** Final completion state of each sector */
179
+ final_state: {
180
+ type: ParameterType;
181
+ description: string;
182
+ };
183
+ /** Usage statistics for macro pieces */
184
+ macros_used: {
185
+ type: ParameterType;
186
+ description: string;
187
+ };
188
+ /** Total trial duration in milliseconds */
189
+ trial_duration_ms: {
190
+ type: ParameterType;
191
+ description: string;
192
+ };
193
+ };
194
+ citations: string;
195
+ };
196
+ constructor(jsPsych: JsPsych);
197
+ /**
198
+ * Launches the trial by invoking startConstructionTrial
199
+ * with the display element, parameters, and jsPsych instance.
200
+ */
201
+ trial(display_element: HTMLElement, trial: TrialType<Info>): void;
202
+ }
203
+
204
+ export { TangramConstructPlugin as default };