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
|
@@ -16661,26 +16661,27 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
16661
16661
|
const CONFIG = {
|
|
16662
16662
|
color: {
|
|
16663
16663
|
bands: {
|
|
16664
|
-
silhouette: { fillEven: "#
|
|
16665
|
-
workspace: { fillEven: "#
|
|
16664
|
+
silhouette: { fillEven: "#fff2ccff", fillOdd: "#fff2ccff", stroke: "#b1b1b1" },
|
|
16665
|
+
workspace: { fillEven: "#fff2ccff", fillOdd: "#fff2ccff", stroke: "#b1b1b1" }
|
|
16666
16666
|
},
|
|
16667
|
-
completion: { fill: "#
|
|
16668
|
-
silhouetteMask: "#
|
|
16667
|
+
completion: { fill: "#ccfff2", stroke: "#13da57" },
|
|
16668
|
+
silhouetteMask: "#374151",
|
|
16669
16669
|
anchors: { invalid: "#7dd3fc", valid: "#475569" },
|
|
16670
|
-
piece: { draggingFill: "#
|
|
16670
|
+
piece: { draggingFill: "#8e7cc3ff", validFill: "#8e7cc3ff", invalidFill: "#ef4444", invalidStroke: "#dc2626", selectedStroke: "#674ea7", allGreenStroke: "#86efac", borderStroke: "#674ea7" },
|
|
16671
16671
|
ui: { light: "#60a5fa", dark: "#1d4ed8" },
|
|
16672
|
-
blueprint: { fill: "#374151", selectedStroke: "#111827", badgeFill: "#
|
|
16672
|
+
blueprint: { fill: "#374151", selectedStroke: "#111827", badgeFill: "#000000", labelFill: "#ffffff" }
|
|
16673
16673
|
},
|
|
16674
16674
|
opacity: {
|
|
16675
|
-
blueprint: 0.
|
|
16676
|
-
silhouetteMask: 0.
|
|
16677
|
-
anchors: { valid: 0.
|
|
16678
|
-
|
|
16675
|
+
blueprint: 0.4,
|
|
16676
|
+
silhouetteMask: 0.25,
|
|
16677
|
+
//anchors: { valid: 0.80, invalid: 0.50 },
|
|
16678
|
+
anchors: { invalid: 0, valid: 0 },
|
|
16679
|
+
piece: { invalid: 0.35, dragging: 0.75, locked: 1, normal: 1 }
|
|
16679
16680
|
},
|
|
16680
16681
|
size: {
|
|
16681
|
-
stroke: { bandPx:
|
|
16682
|
+
stroke: { bandPx: 5, pieceSelectedPx: 3, allGreenStrokePx: 10, pieceBorderPx: 2 },
|
|
16682
16683
|
anchorRadiusPx: { valid: 1, invalid: 1 },
|
|
16683
|
-
badgeFontPx:
|
|
16684
|
+
badgeFontPx: 16,
|
|
16684
16685
|
centerBadge: { fractionOfOuterR: 0.15, minPx: 20, marginPx: 4 }
|
|
16685
16686
|
},
|
|
16686
16687
|
layout: {
|
|
@@ -20258,6 +20259,7 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20258
20259
|
"medtriangle",
|
|
20259
20260
|
"largetriangle"
|
|
20260
20261
|
]);
|
|
20262
|
+
const PRIMITIVE_BLUEPRINTS_ORDERED = [...PRIMITIVE_BLUEPRINTS].sort((a, b) => params.primitiveOrder.indexOf(a.kind) - params.primitiveOrder.indexOf(b.kind));
|
|
20261
20263
|
const sectors = params.tangrams.map((tangramSpec, index) => {
|
|
20262
20264
|
const filteredTans = tangramSpec.solutionTans.filter((tan) => {
|
|
20263
20265
|
const tanName = tan.name ?? tan.kind;
|
|
@@ -20284,7 +20286,7 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20284
20286
|
const firstMacro = params.quickstash_macros[0];
|
|
20285
20287
|
if (firstMacro && "parts" in firstMacro && firstMacro.parts && firstMacro.parts[0] && "anchorOffset" in firstMacro.parts[0]) {
|
|
20286
20288
|
const primsByKind = /* @__PURE__ */ new Map();
|
|
20287
|
-
|
|
20289
|
+
PRIMITIVE_BLUEPRINTS_ORDERED.forEach((p) => primsByKind.set(p.kind, p));
|
|
20288
20290
|
quickstash = params.quickstash_macros.map(
|
|
20289
20291
|
(anchorComposite) => convertAnchorCompositeToPixels(anchorComposite, primsByKind, CONFIG.layout.grid.stepPx)
|
|
20290
20292
|
// Use current CONFIG grid step
|
|
@@ -20296,7 +20298,7 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20296
20298
|
const gameBoardProps = {
|
|
20297
20299
|
sectors,
|
|
20298
20300
|
quickstash,
|
|
20299
|
-
primitives:
|
|
20301
|
+
primitives: PRIMITIVE_BLUEPRINTS_ORDERED,
|
|
20300
20302
|
layout: params.layout,
|
|
20301
20303
|
target: params.target,
|
|
20302
20304
|
input: params.input,
|
|
@@ -20327,6 +20329,12 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20327
20329
|
default: [],
|
|
20328
20330
|
description: "Array of MacroSpec objects created in prep trial"
|
|
20329
20331
|
},
|
|
20332
|
+
/** Array of primitive names in the order they should be displayed */
|
|
20333
|
+
primitive_order: {
|
|
20334
|
+
type: jspsych.ParameterType.OBJECT,
|
|
20335
|
+
default: ["square", "smalltriangle", "parallelogram", "medtriangle", "largetriangle"],
|
|
20336
|
+
description: "Array of primitive names in the order they should be displayed"
|
|
20337
|
+
},
|
|
20330
20338
|
/** Whether to place pieces in workspace or directly on silhouette */
|
|
20331
20339
|
target: {
|
|
20332
20340
|
type: jspsych.ParameterType.SELECT,
|
|
@@ -20428,6 +20436,7 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20428
20436
|
const params = {
|
|
20429
20437
|
tangrams: trial.tangrams,
|
|
20430
20438
|
quickstash_macros: trial.quickstash_macros,
|
|
20439
|
+
primitiveOrder: trial.primitive_order,
|
|
20431
20440
|
target: trial.target,
|
|
20432
20441
|
input: trial.input,
|
|
20433
20442
|
layout: trial.layout,
|