jspsych-tangram 0.0.5 → 0.0.7
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 +23 -14
- 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 +23 -14
- package/dist/construct/index.cjs.map +1 -1
- package/dist/construct/index.d.ts +12 -0
- package/dist/construct/index.js +23 -14
- package/dist/construct/index.js.map +1 -1
- package/dist/index.cjs +34 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.js +34 -16
- package/dist/index.js.map +1 -1
- package/dist/prep/index.browser.js +24 -14
- 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 +24 -14
- package/dist/prep/index.cjs.map +1 -1
- package/dist/prep/index.d.ts +12 -0
- package/dist/prep/index.js +24 -14
- package/dist/prep/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/config/config.ts +13 -12
- 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.cjs
CHANGED
|
@@ -8,26 +8,27 @@ var uuid = require('uuid');
|
|
|
8
8
|
const CONFIG = {
|
|
9
9
|
color: {
|
|
10
10
|
bands: {
|
|
11
|
-
silhouette: { fillEven: "#
|
|
12
|
-
workspace: { fillEven: "#
|
|
11
|
+
silhouette: { fillEven: "#fff2ccff", fillOdd: "#fff2ccff", stroke: "#b1b1b1" },
|
|
12
|
+
workspace: { fillEven: "#fff2ccff", fillOdd: "#fff2ccff", stroke: "#b1b1b1" }
|
|
13
13
|
},
|
|
14
|
-
completion: { fill: "#
|
|
15
|
-
silhouetteMask: "#
|
|
14
|
+
completion: { fill: "#ccfff2", stroke: "#13da57" },
|
|
15
|
+
silhouetteMask: "#374151",
|
|
16
16
|
anchors: { invalid: "#7dd3fc", valid: "#475569" },
|
|
17
|
-
piece: { draggingFill: "#
|
|
17
|
+
piece: { draggingFill: "#8e7cc3ff", validFill: "#8e7cc3ff", invalidFill: "#ef4444", invalidStroke: "#dc2626", selectedStroke: "#674ea7", allGreenStroke: "#86efac", borderStroke: "#674ea7" },
|
|
18
18
|
ui: { light: "#60a5fa", dark: "#1d4ed8" },
|
|
19
|
-
blueprint: { fill: "#374151", selectedStroke: "#111827", badgeFill: "#
|
|
19
|
+
blueprint: { fill: "#374151", selectedStroke: "#111827", badgeFill: "#000000", labelFill: "#ffffff" }
|
|
20
20
|
},
|
|
21
21
|
opacity: {
|
|
22
|
-
blueprint: 0.
|
|
23
|
-
silhouetteMask: 0.
|
|
24
|
-
anchors: { valid: 0.
|
|
25
|
-
|
|
22
|
+
blueprint: 0.4,
|
|
23
|
+
silhouetteMask: 0.25,
|
|
24
|
+
//anchors: { valid: 0.80, invalid: 0.50 },
|
|
25
|
+
anchors: { invalid: 0, valid: 0 },
|
|
26
|
+
piece: { invalid: 0.35, dragging: 0.75, locked: 1, normal: 1 }
|
|
26
27
|
},
|
|
27
28
|
size: {
|
|
28
|
-
stroke: { bandPx:
|
|
29
|
+
stroke: { bandPx: 5, pieceSelectedPx: 3, allGreenStrokePx: 10, pieceBorderPx: 2 },
|
|
29
30
|
anchorRadiusPx: { valid: 1, invalid: 1 },
|
|
30
|
-
badgeFontPx:
|
|
31
|
+
badgeFontPx: 16,
|
|
31
32
|
centerBadge: { fractionOfOuterR: 0.15, minPx: 20, marginPx: 4 }
|
|
32
33
|
},
|
|
33
34
|
layout: {
|
|
@@ -3550,9 +3551,11 @@ function startPrepTrial(display_element, params, jsPsych) {
|
|
|
3550
3551
|
layoutMode,
|
|
3551
3552
|
requireAllSlots,
|
|
3552
3553
|
quickstashMacros,
|
|
3554
|
+
primitiveOrder,
|
|
3553
3555
|
onInteraction,
|
|
3554
3556
|
onTrialEnd
|
|
3555
3557
|
} = params;
|
|
3558
|
+
const PRIMITIVE_BLUEPRINTS_ORDERED = [...PRIMITIVE_BLUEPRINTS].sort((a, b) => primitiveOrder.indexOf(a.kind) - primitiveOrder.indexOf(b.kind));
|
|
3556
3559
|
const prepSectors = Array.from({ length: numQuickstashSlots }, (_, i) => ({
|
|
3557
3560
|
id: `prep-sector-${i}`,
|
|
3558
3561
|
tangramId: `prep-sector-${i}`,
|
|
@@ -3566,7 +3569,7 @@ function startPrepTrial(display_element, params, jsPsych) {
|
|
|
3566
3569
|
const handleControllerReady = (controller, layout, force) => {
|
|
3567
3570
|
if (quickstashMacros && quickstashMacros.length > 0 && layout) {
|
|
3568
3571
|
const primsByKind = /* @__PURE__ */ new Map();
|
|
3569
|
-
|
|
3572
|
+
PRIMITIVE_BLUEPRINTS_ORDERED.forEach((p) => primsByKind.set(p.kind, p));
|
|
3570
3573
|
quickstashMacros.forEach((anchorComposite, macroIndex) => {
|
|
3571
3574
|
const sectorId = `prep-sector-${macroIndex}`;
|
|
3572
3575
|
const compositeBlueprint = convertAnchorCompositeToPixels(
|
|
@@ -3623,7 +3626,7 @@ function startPrepTrial(display_element, params, jsPsych) {
|
|
|
3623
3626
|
sectors: prepSectors,
|
|
3624
3627
|
quickstash: [],
|
|
3625
3628
|
// No pre-made macros
|
|
3626
|
-
primitives:
|
|
3629
|
+
primitives: PRIMITIVE_BLUEPRINTS_ORDERED,
|
|
3627
3630
|
layout: layoutMode,
|
|
3628
3631
|
target: "workspace",
|
|
3629
3632
|
// Pieces go in sectors
|
|
@@ -3684,6 +3687,12 @@ const info = {
|
|
|
3684
3687
|
default: [],
|
|
3685
3688
|
description: "Array of AnchorComposite objects to edit as primitive pieces"
|
|
3686
3689
|
},
|
|
3690
|
+
/** Array of primitive names in the order they should be displayed */
|
|
3691
|
+
primitive_order: {
|
|
3692
|
+
type: jspsych.ParameterType.OBJECT,
|
|
3693
|
+
default: ["square", "smalltriangle", "parallelogram", "medtriangle", "largetriangle"],
|
|
3694
|
+
description: "Array of primitive names in the order they should be displayed"
|
|
3695
|
+
},
|
|
3687
3696
|
/** Callback fired after each interaction (optional analytics hook) */
|
|
3688
3697
|
onInteraction: {
|
|
3689
3698
|
type: jspsych.ParameterType.FUNCTION,
|
|
@@ -3734,6 +3743,7 @@ class TangramPrepPlugin {
|
|
|
3734
3743
|
layoutMode: trial.layout,
|
|
3735
3744
|
requireAllSlots: trial.require_all_slots,
|
|
3736
3745
|
quickstashMacros: trial.quickstash_macros,
|
|
3746
|
+
primitiveOrder: trial.primitive_order,
|
|
3737
3747
|
onInteraction: trial.onInteraction,
|
|
3738
3748
|
onTrialEnd: wrappedOnTrialEnd
|
|
3739
3749
|
};
|