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
package/dist/prep/index.d.ts
CHANGED
|
@@ -40,6 +40,12 @@ declare const info: {
|
|
|
40
40
|
default: never[];
|
|
41
41
|
description: string;
|
|
42
42
|
};
|
|
43
|
+
/** Array of primitive names in the order they should be displayed */
|
|
44
|
+
primitive_order: {
|
|
45
|
+
type: ParameterType;
|
|
46
|
+
default: string[];
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
43
49
|
/** Callback fired after each interaction (optional analytics hook) */
|
|
44
50
|
onInteraction: {
|
|
45
51
|
type: ParameterType;
|
|
@@ -109,6 +115,12 @@ declare class TangramPrepPlugin implements JsPsychPlugin<Info> {
|
|
|
109
115
|
default: never[];
|
|
110
116
|
description: string;
|
|
111
117
|
};
|
|
118
|
+
/** Array of primitive names in the order they should be displayed */
|
|
119
|
+
primitive_order: {
|
|
120
|
+
type: ParameterType;
|
|
121
|
+
default: string[];
|
|
122
|
+
description: string;
|
|
123
|
+
};
|
|
112
124
|
/** Callback fired after each interaction (optional analytics hook) */
|
|
113
125
|
onInteraction: {
|
|
114
126
|
type: ParameterType;
|
package/dist/prep/index.js
CHANGED
|
@@ -3548,9 +3548,11 @@ function startPrepTrial(display_element, params, jsPsych) {
|
|
|
3548
3548
|
layoutMode,
|
|
3549
3549
|
requireAllSlots,
|
|
3550
3550
|
quickstashMacros,
|
|
3551
|
+
primitiveOrder,
|
|
3551
3552
|
onInteraction,
|
|
3552
3553
|
onTrialEnd
|
|
3553
3554
|
} = params;
|
|
3555
|
+
const PRIMITIVE_BLUEPRINTS_ORDERED = [...PRIMITIVE_BLUEPRINTS].sort((a, b) => primitiveOrder.indexOf(a.kind) - primitiveOrder.indexOf(b.kind));
|
|
3554
3556
|
const prepSectors = Array.from({ length: numQuickstashSlots }, (_, i) => ({
|
|
3555
3557
|
id: `prep-sector-${i}`,
|
|
3556
3558
|
tangramId: `prep-sector-${i}`,
|
|
@@ -3564,7 +3566,7 @@ function startPrepTrial(display_element, params, jsPsych) {
|
|
|
3564
3566
|
const handleControllerReady = (controller, layout, force) => {
|
|
3565
3567
|
if (quickstashMacros && quickstashMacros.length > 0 && layout) {
|
|
3566
3568
|
const primsByKind = /* @__PURE__ */ new Map();
|
|
3567
|
-
|
|
3569
|
+
PRIMITIVE_BLUEPRINTS_ORDERED.forEach((p) => primsByKind.set(p.kind, p));
|
|
3568
3570
|
quickstashMacros.forEach((anchorComposite, macroIndex) => {
|
|
3569
3571
|
const sectorId = `prep-sector-${macroIndex}`;
|
|
3570
3572
|
const compositeBlueprint = convertAnchorCompositeToPixels(
|
|
@@ -3621,7 +3623,7 @@ function startPrepTrial(display_element, params, jsPsych) {
|
|
|
3621
3623
|
sectors: prepSectors,
|
|
3622
3624
|
quickstash: [],
|
|
3623
3625
|
// No pre-made macros
|
|
3624
|
-
primitives:
|
|
3626
|
+
primitives: PRIMITIVE_BLUEPRINTS_ORDERED,
|
|
3625
3627
|
layout: layoutMode,
|
|
3626
3628
|
target: "workspace",
|
|
3627
3629
|
// Pieces go in sectors
|
|
@@ -3682,6 +3684,12 @@ const info = {
|
|
|
3682
3684
|
default: [],
|
|
3683
3685
|
description: "Array of AnchorComposite objects to edit as primitive pieces"
|
|
3684
3686
|
},
|
|
3687
|
+
/** Array of primitive names in the order they should be displayed */
|
|
3688
|
+
primitive_order: {
|
|
3689
|
+
type: ParameterType.OBJECT,
|
|
3690
|
+
default: ["square", "smalltriangle", "parallelogram", "medtriangle", "largetriangle"],
|
|
3691
|
+
description: "Array of primitive names in the order they should be displayed"
|
|
3692
|
+
},
|
|
3685
3693
|
/** Callback fired after each interaction (optional analytics hook) */
|
|
3686
3694
|
onInteraction: {
|
|
3687
3695
|
type: ParameterType.FUNCTION,
|
|
@@ -3732,6 +3740,7 @@ class TangramPrepPlugin {
|
|
|
3732
3740
|
layoutMode: trial.layout,
|
|
3733
3741
|
requireAllSlots: trial.require_all_slots,
|
|
3734
3742
|
quickstashMacros: trial.quickstash_macros,
|
|
3743
|
+
primitiveOrder: trial.primitive_order,
|
|
3735
3744
|
onInteraction: trial.onInteraction,
|
|
3736
3745
|
onTrialEnd: wrappedOnTrialEnd
|
|
3737
3746
|
};
|