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.
@@ -8,26 +8,27 @@ var uuid = require('uuid');
8
8
  const CONFIG = {
9
9
  color: {
10
10
  bands: {
11
- silhouette: { fillEven: "#eef2ff", fillOdd: "#f6f7fb", stroke: "#c7d2fe" },
12
- workspace: { fillEven: "#f3f4f6", fillOdd: "#f9fafb", stroke: "#e5e7eb" }
11
+ silhouette: { fillEven: "#fff2ccff", fillOdd: "#fff2ccff", stroke: "#b1b1b1" },
12
+ workspace: { fillEven: "#fff2ccff", fillOdd: "#fff2ccff", stroke: "#b1b1b1" }
13
13
  },
14
- completion: { fill: "#dcfce7", stroke: "#86efac" },
15
- silhouetteMask: "#94a3b8",
14
+ completion: { fill: "#ccfff2", stroke: "#13da57" },
15
+ silhouetteMask: "#374151",
16
16
  anchors: { invalid: "#7dd3fc", valid: "#475569" },
17
- piece: { draggingFill: "#1d4ed8", validFill: "#60a5fa", invalidFill: "#ef4444", invalidStroke: "#dc2626", selectedStroke: "#111827", allGreenStroke: "#86efac", borderStroke: "#374151" },
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: "#eef2ff", labelFill: "#374151" }
19
+ blueprint: { fill: "#374151", selectedStroke: "#111827", badgeFill: "#000000", labelFill: "#ffffff" }
20
20
  },
21
21
  opacity: {
22
- blueprint: 0.95,
23
- silhouetteMask: 0.45,
24
- anchors: { valid: 0.8, invalid: 0.5 },
25
- piece: { invalid: 0.35, dragging: 0.6, locked: 0.7, normal: 0.95 }
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: 1, pieceSelectedPx: 1.5, allGreenStrokePx: 6, pieceBorderPx: 1 },
29
+ stroke: { bandPx: 5, pieceSelectedPx: 3, allGreenStrokePx: 10, pieceBorderPx: 2 },
29
30
  anchorRadiusPx: { valid: 1, invalid: 1 },
30
- badgeFontPx: 12,
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
- PRIMITIVE_BLUEPRINTS.forEach((p) => primsByKind.set(p.kind, p));
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: PRIMITIVE_BLUEPRINTS,
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
  };