jspsych-tangram 0.0.5 → 0.0.6
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/construct/index.browser.js +10 -2
- package/dist/construct/index.browser.js.map +1 -1
- package/dist/construct/index.browser.min.js +11 -11
- package/dist/construct/index.browser.min.js.map +1 -1
- package/dist/construct/index.cjs +10 -2
- package/dist/construct/index.cjs.map +1 -1
- package/dist/construct/index.d.ts +12 -0
- package/dist/construct/index.js +10 -2
- package/dist/construct/index.js.map +1 -1
- package/dist/index.cjs +21 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/prep/index.browser.js +11 -2
- package/dist/prep/index.browser.js.map +1 -1
- package/dist/prep/index.browser.min.js +11 -11
- package/dist/prep/index.browser.min.js.map +1 -1
- package/dist/prep/index.cjs +11 -2
- package/dist/prep/index.cjs.map +1 -1
- package/dist/prep/index.d.ts +12 -0
- package/dist/prep/index.js +11 -2
- package/dist/prep/index.js.map +1 -1
- package/package.json +1 -1
- package/src/plugins/tangram-construct/ConstructionApp.tsx +6 -2
- package/src/plugins/tangram-construct/index.ts +7 -0
- package/src/plugins/tangram-prep/PrepApp.tsx +8 -2
- package/src/plugins/tangram-prep/index.ts +7 -0
- package/tangram-construct.min.js +11 -11
- package/tangram-prep.min.js +11 -11
|
@@ -16,6 +16,12 @@ declare const info: {
|
|
|
16
16
|
default: never[];
|
|
17
17
|
description: string;
|
|
18
18
|
};
|
|
19
|
+
/** Array of primitive names in the order they should be displayed */
|
|
20
|
+
primitive_order: {
|
|
21
|
+
type: ParameterType;
|
|
22
|
+
default: string[];
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
19
25
|
/** Whether to place pieces in workspace or directly on silhouette */
|
|
20
26
|
target: {
|
|
21
27
|
type: ParameterType;
|
|
@@ -118,6 +124,12 @@ declare class TangramConstructPlugin implements JsPsychPlugin<Info> {
|
|
|
118
124
|
default: never[];
|
|
119
125
|
description: string;
|
|
120
126
|
};
|
|
127
|
+
/** Array of primitive names in the order they should be displayed */
|
|
128
|
+
primitive_order: {
|
|
129
|
+
type: ParameterType;
|
|
130
|
+
default: string[];
|
|
131
|
+
description: string;
|
|
132
|
+
};
|
|
121
133
|
/** Whether to place pieces in workspace or directly on silhouette */
|
|
122
134
|
target: {
|
|
123
135
|
type: ParameterType;
|
package/dist/construct/index.js
CHANGED
|
@@ -3547,6 +3547,7 @@ function startConstructionTrial(display_element, params, _jsPsych) {
|
|
|
3547
3547
|
"medtriangle",
|
|
3548
3548
|
"largetriangle"
|
|
3549
3549
|
]);
|
|
3550
|
+
const PRIMITIVE_BLUEPRINTS_ORDERED = [...PRIMITIVE_BLUEPRINTS].sort((a, b) => params.primitiveOrder.indexOf(a.kind) - params.primitiveOrder.indexOf(b.kind));
|
|
3550
3551
|
const sectors = params.tangrams.map((tangramSpec, index) => {
|
|
3551
3552
|
const filteredTans = tangramSpec.solutionTans.filter((tan) => {
|
|
3552
3553
|
const tanName = tan.name ?? tan.kind;
|
|
@@ -3573,7 +3574,7 @@ function startConstructionTrial(display_element, params, _jsPsych) {
|
|
|
3573
3574
|
const firstMacro = params.quickstash_macros[0];
|
|
3574
3575
|
if (firstMacro && "parts" in firstMacro && firstMacro.parts && firstMacro.parts[0] && "anchorOffset" in firstMacro.parts[0]) {
|
|
3575
3576
|
const primsByKind = /* @__PURE__ */ new Map();
|
|
3576
|
-
|
|
3577
|
+
PRIMITIVE_BLUEPRINTS_ORDERED.forEach((p) => primsByKind.set(p.kind, p));
|
|
3577
3578
|
quickstash = params.quickstash_macros.map(
|
|
3578
3579
|
(anchorComposite) => convertAnchorCompositeToPixels(anchorComposite, primsByKind, CONFIG.layout.grid.stepPx)
|
|
3579
3580
|
// Use current CONFIG grid step
|
|
@@ -3585,7 +3586,7 @@ function startConstructionTrial(display_element, params, _jsPsych) {
|
|
|
3585
3586
|
const gameBoardProps = {
|
|
3586
3587
|
sectors,
|
|
3587
3588
|
quickstash,
|
|
3588
|
-
primitives:
|
|
3589
|
+
primitives: PRIMITIVE_BLUEPRINTS_ORDERED,
|
|
3589
3590
|
layout: params.layout,
|
|
3590
3591
|
target: params.target,
|
|
3591
3592
|
input: params.input,
|
|
@@ -3616,6 +3617,12 @@ const info = {
|
|
|
3616
3617
|
default: [],
|
|
3617
3618
|
description: "Array of MacroSpec objects created in prep trial"
|
|
3618
3619
|
},
|
|
3620
|
+
/** Array of primitive names in the order they should be displayed */
|
|
3621
|
+
primitive_order: {
|
|
3622
|
+
type: ParameterType.OBJECT,
|
|
3623
|
+
default: ["square", "smalltriangle", "parallelogram", "medtriangle", "largetriangle"],
|
|
3624
|
+
description: "Array of primitive names in the order they should be displayed"
|
|
3625
|
+
},
|
|
3619
3626
|
/** Whether to place pieces in workspace or directly on silhouette */
|
|
3620
3627
|
target: {
|
|
3621
3628
|
type: ParameterType.SELECT,
|
|
@@ -3717,6 +3724,7 @@ class TangramConstructPlugin {
|
|
|
3717
3724
|
const params = {
|
|
3718
3725
|
tangrams: trial.tangrams,
|
|
3719
3726
|
quickstash_macros: trial.quickstash_macros,
|
|
3727
|
+
primitiveOrder: trial.primitive_order,
|
|
3720
3728
|
target: trial.target,
|
|
3721
3729
|
input: trial.input,
|
|
3722
3730
|
layout: trial.layout,
|