jspsych-tangram 0.0.4 → 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 +18 -49
- package/dist/construct/index.browser.js.map +1 -1
- package/dist/construct/index.browser.min.js +10 -14
- package/dist/construct/index.browser.min.js.map +1 -1
- package/dist/construct/index.cjs +18 -49
- package/dist/construct/index.cjs.map +1 -1
- package/dist/construct/index.d.ts +12 -0
- package/dist/construct/index.js +18 -49
- package/dist/construct/index.js.map +1 -1
- package/dist/index.cjs +30 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.js +30 -52
- package/dist/index.js.map +1 -1
- package/dist/prep/index.browser.js +15 -5
- 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 +15 -5
- package/dist/prep/index.cjs.map +1 -1
- package/dist/prep/index.d.ts +12 -0
- package/dist/prep/index.js +15 -5
- package/dist/prep/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/components/board/GameBoard.tsx +4 -1
- package/src/core/engine/state/BaseGameController.ts +0 -1
- package/src/plugins/tangram-construct/ConstructionApp.tsx +13 -53
- package/src/plugins/tangram-construct/index.ts +8 -1
- package/src/plugins/tangram-prep/PrepApp.tsx +8 -2
- package/src/plugins/tangram-prep/index.ts +8 -1
- package/tangram-construct.min.js +10 -14
- package/tangram-prep.min.js +11 -11
|
@@ -16840,7 +16840,6 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
16840
16840
|
const allDone = Object.values(this.state.sectors).every((s) => !!s.completedAt);
|
|
16841
16841
|
if (allDone && !this.state.endedAt) {
|
|
16842
16842
|
this.state.endedAt = NOW();
|
|
16843
|
-
console.log("[BaseGameController] all sectors complete");
|
|
16844
16843
|
}
|
|
16845
16844
|
}
|
|
16846
16845
|
// ===== Piece Operations =====
|
|
@@ -19864,7 +19863,9 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
19864
19863
|
if (allSectorsComplete && !gameCompleted) {
|
|
19865
19864
|
setGameCompleted(true);
|
|
19866
19865
|
if (tracker) {
|
|
19867
|
-
|
|
19866
|
+
setTimeout(() => {
|
|
19867
|
+
tracker.finalizeTrial("auto_complete");
|
|
19868
|
+
}, 0);
|
|
19868
19869
|
}
|
|
19869
19870
|
}
|
|
19870
19871
|
};
|
|
@@ -20258,9 +20259,11 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20258
20259
|
layoutMode,
|
|
20259
20260
|
requireAllSlots,
|
|
20260
20261
|
quickstashMacros,
|
|
20262
|
+
primitiveOrder,
|
|
20261
20263
|
onInteraction,
|
|
20262
20264
|
onTrialEnd
|
|
20263
20265
|
} = params;
|
|
20266
|
+
const PRIMITIVE_BLUEPRINTS_ORDERED = [...PRIMITIVE_BLUEPRINTS].sort((a, b) => primitiveOrder.indexOf(a.kind) - primitiveOrder.indexOf(b.kind));
|
|
20264
20267
|
const prepSectors = Array.from({ length: numQuickstashSlots }, (_, i) => ({
|
|
20265
20268
|
id: `prep-sector-${i}`,
|
|
20266
20269
|
tangramId: `prep-sector-${i}`,
|
|
@@ -20274,7 +20277,7 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20274
20277
|
const handleControllerReady = (controller, layout, force) => {
|
|
20275
20278
|
if (quickstashMacros && quickstashMacros.length > 0 && layout) {
|
|
20276
20279
|
const primsByKind = /* @__PURE__ */ new Map();
|
|
20277
|
-
|
|
20280
|
+
PRIMITIVE_BLUEPRINTS_ORDERED.forEach((p) => primsByKind.set(p.kind, p));
|
|
20278
20281
|
quickstashMacros.forEach((anchorComposite, macroIndex) => {
|
|
20279
20282
|
const sectorId = `prep-sector-${macroIndex}`;
|
|
20280
20283
|
const compositeBlueprint = convertAnchorCompositeToPixels(
|
|
@@ -20331,7 +20334,7 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20331
20334
|
sectors: prepSectors,
|
|
20332
20335
|
quickstash: [],
|
|
20333
20336
|
// No pre-made macros
|
|
20334
|
-
primitives:
|
|
20337
|
+
primitives: PRIMITIVE_BLUEPRINTS_ORDERED,
|
|
20335
20338
|
layout: layoutMode,
|
|
20336
20339
|
target: "workspace",
|
|
20337
20340
|
// Pieces go in sectors
|
|
@@ -20392,6 +20395,12 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20392
20395
|
default: [],
|
|
20393
20396
|
description: "Array of AnchorComposite objects to edit as primitive pieces"
|
|
20394
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
|
+
},
|
|
20395
20404
|
/** Callback fired after each interaction (optional analytics hook) */
|
|
20396
20405
|
onInteraction: {
|
|
20397
20406
|
type: jspsych.ParameterType.FUNCTION,
|
|
@@ -20435,13 +20444,14 @@ var TangramPrepPlugin = (function (jspsych) {
|
|
|
20435
20444
|
this.jsPsych.finishTrial(data);
|
|
20436
20445
|
};
|
|
20437
20446
|
const params = {
|
|
20438
|
-
numQuickstashSlots: trial.num_quickstash_slots
|
|
20447
|
+
numQuickstashSlots: trial.num_quickstash_slots,
|
|
20439
20448
|
maxPiecesPerMacro: trial.max_pieces_per_macro,
|
|
20440
20449
|
minPiecesPerMacro: trial.min_pieces_per_macro,
|
|
20441
20450
|
inputMode: trial.input,
|
|
20442
20451
|
layoutMode: trial.layout,
|
|
20443
20452
|
requireAllSlots: trial.require_all_slots,
|
|
20444
20453
|
quickstashMacros: trial.quickstash_macros,
|
|
20454
|
+
primitiveOrder: trial.primitive_order,
|
|
20445
20455
|
onInteraction: trial.onInteraction,
|
|
20446
20456
|
onTrialEnd: wrappedOnTrialEnd
|
|
20447
20457
|
};
|