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
|
@@ -20259,9 +20259,11 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20259
20259
|
layoutMode,
|
|
20260
20260
|
requireAllSlots,
|
|
20261
20261
|
quickstashMacros,
|
|
20262
|
+
primitiveOrder,
|
|
20262
20263
|
onInteraction,
|
|
20263
20264
|
onTrialEnd
|
|
20264
20265
|
} = params;
|
|
20266
|
+
const PRIMITIVE_BLUEPRINTS_ORDERED = [...PRIMITIVE_BLUEPRINTS].sort((a, b) => primitiveOrder.indexOf(a.kind) - primitiveOrder.indexOf(b.kind));
|
|
20265
20267
|
const prepSectors = Array.from({ length: numQuickstashSlots }, (_, i) => ({
|
|
20266
20268
|
id: `prep-sector-${i}`,
|
|
20267
20269
|
tangramId: `prep-sector-${i}`,
|
|
@@ -20275,7 +20277,7 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20275
20277
|
const handleControllerReady = (controller, layout, force) => {
|
|
20276
20278
|
if (quickstashMacros && quickstashMacros.length > 0 && layout) {
|
|
20277
20279
|
const primsByKind = /* @__PURE__ */ new Map();
|
|
20278
|
-
|
|
20280
|
+
PRIMITIVE_BLUEPRINTS_ORDERED.forEach((p) => primsByKind.set(p.kind, p));
|
|
20279
20281
|
quickstashMacros.forEach((anchorComposite, macroIndex) => {
|
|
20280
20282
|
const sectorId = `prep-sector-${macroIndex}`;
|
|
20281
20283
|
const compositeBlueprint = convertAnchorCompositeToPixels(
|
|
@@ -20332,7 +20334,7 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20332
20334
|
sectors: prepSectors,
|
|
20333
20335
|
quickstash: [],
|
|
20334
20336
|
// No pre-made macros
|
|
20335
|
-
primitives:
|
|
20337
|
+
primitives: PRIMITIVE_BLUEPRINTS_ORDERED,
|
|
20336
20338
|
layout: layoutMode,
|
|
20337
20339
|
target: "workspace",
|
|
20338
20340
|
// Pieces go in sectors
|
|
@@ -20393,6 +20395,12 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20393
20395
|
default: [],
|
|
20394
20396
|
description: "Array of AnchorComposite objects to edit as primitive pieces"
|
|
20395
20397
|
},
|
|
20398
|
+
/** Array of primitive names in the order they should be displayed */
|
|
20399
|
+
primitive_order: {
|
|
20400
|
+
type: jspsych.ParameterType.OBJECT,
|
|
20401
|
+
default: ["square", "smalltriangle", "parallelogram", "medtriangle", "largetriangle"],
|
|
20402
|
+
description: "Array of primitive names in the order they should be displayed"
|
|
20403
|
+
},
|
|
20396
20404
|
/** Callback fired after each interaction (optional analytics hook) */
|
|
20397
20405
|
onInteraction: {
|
|
20398
20406
|
type: jspsych.ParameterType.FUNCTION,
|
|
@@ -20443,6 +20451,7 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20443
20451
|
layoutMode: trial.layout,
|
|
20444
20452
|
requireAllSlots: trial.require_all_slots,
|
|
20445
20453
|
quickstashMacros: trial.quickstash_macros,
|
|
20454
|
+
primitiveOrder: trial.primitive_order,
|
|
20446
20455
|
onInteraction: trial.onInteraction,
|
|
20447
20456
|
onTrialEnd: wrappedOnTrialEnd
|
|
20448
20457
|
};
|