@m2c2kit/addons 0.3.6 → 0.3.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/README.md +19 -2
- package/dist/index.js +76 -36
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @m2c2kit/addons
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://github.com/m2c2-project/m2c2kit/actions/workflows/ci.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/@m2c2kit/addons)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
This package contains additions to m2c2kit core functionally, such as buttons, grids, and instructions.
|
|
8
|
+
|
|
9
|
+
**m2c2kit** is a library for cross-platform cognitive assessments. Features:
|
|
10
|
+
|
|
11
|
+
- **Mobile first**. Optimized for touch and mobile devices while also usable on desktops.
|
|
12
|
+
- **Portable**. Use on browsers, compile within native apps using web views, or embed in products like Qualtrics. A shared assessment codebase reduces development time and promotes experiment standardization across devices and services.
|
|
13
|
+
- **Rapid iteration**. Quickly develop and test new assessments with the JavaScript-based library and deploy them in studies.
|
|
14
|
+
|
|
15
|
+
## Resources
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
- [Website](https://m2c2-project.github.io/m2c2kit/)
|
|
20
|
+
- [Live Examples](https://m2c2-project.github.io/m2c2kit/docs/category/examples)
|
|
21
|
+
- [Getting Started](https://m2c2-project.github.io/m2c2kit/docs/getting-started)
|
|
22
|
+
- [Interactive Tutorial](https://m2c2-project.github.io/m2c2kit/docs/tutorial-fundamentals/fundamentals)
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { Composite, WebColors, Shape, Label, CanvasKitHelpers, EventType, Easings, Story, Transition, TransitionDirection, LabelHorizontalAlignmentMode, Scene, Dimensions, Sprite } from '@m2c2kit/core';
|
|
2
2
|
|
|
3
|
-
var __defProp$
|
|
3
|
+
var __defProp$3 = Object.defineProperty;
|
|
4
4
|
var __defProps$1 = Object.defineProperties;
|
|
5
5
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
6
6
|
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
7
7
|
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp$
|
|
9
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
10
|
var __spreadValues$1 = (a, b) => {
|
|
11
11
|
for (var prop in b || (b = {}))
|
|
12
12
|
if (__hasOwnProp$1.call(b, prop))
|
|
13
|
-
__defNormalProp$
|
|
13
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
14
14
|
if (__getOwnPropSymbols$1)
|
|
15
15
|
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
16
16
|
if (__propIsEnum$1.call(b, prop))
|
|
17
|
-
__defNormalProp$
|
|
17
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
21
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
22
|
+
var __publicField$3 = (obj, key, value) => {
|
|
23
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
22
26
|
class Grid extends Composite {
|
|
23
27
|
/**
|
|
24
28
|
* A rectangular grid that supports placement of entities within the grid's
|
|
@@ -32,16 +36,19 @@ class Grid extends Composite {
|
|
|
32
36
|
*/
|
|
33
37
|
constructor(options) {
|
|
34
38
|
super(options);
|
|
35
|
-
this
|
|
39
|
+
__publicField$3(this, "compositeType", "grid");
|
|
36
40
|
// Grid options
|
|
37
41
|
// TODO: make getter, setter for these so they can be changed after initial construction
|
|
38
|
-
this
|
|
39
|
-
this
|
|
42
|
+
__publicField$3(this, "rows", 0);
|
|
43
|
+
__publicField$3(this, "columns", 0);
|
|
40
44
|
// default Grid is: transparent gray, red lines, line width 1
|
|
41
|
-
this
|
|
42
|
-
this
|
|
43
|
-
this
|
|
44
|
-
this
|
|
45
|
+
__publicField$3(this, "gridBackgroundColor", [0, 0, 233, 0.25]);
|
|
46
|
+
__publicField$3(this, "gridLineColor", WebColors.Red);
|
|
47
|
+
__publicField$3(this, "gridLineWidth", 1);
|
|
48
|
+
__publicField$3(this, "cellWidth");
|
|
49
|
+
__publicField$3(this, "cellHeight");
|
|
50
|
+
__publicField$3(this, "gridChildren", new Array());
|
|
51
|
+
__publicField$3(this, "gridBackground");
|
|
45
52
|
if (options.size) {
|
|
46
53
|
this.size = options.size;
|
|
47
54
|
} else {
|
|
@@ -239,25 +246,29 @@ class Grid extends Composite {
|
|
|
239
246
|
}
|
|
240
247
|
}
|
|
241
248
|
|
|
242
|
-
var __defProp = Object.defineProperty;
|
|
249
|
+
var __defProp$2 = Object.defineProperty;
|
|
243
250
|
var __defProps = Object.defineProperties;
|
|
244
251
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
245
252
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
246
253
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
247
254
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
248
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
255
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
249
256
|
var __spreadValues = (a, b) => {
|
|
250
257
|
for (var prop in b || (b = {}))
|
|
251
258
|
if (__hasOwnProp.call(b, prop))
|
|
252
|
-
__defNormalProp(a, prop, b[prop]);
|
|
259
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
253
260
|
if (__getOwnPropSymbols)
|
|
254
261
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
255
262
|
if (__propIsEnum.call(b, prop))
|
|
256
|
-
__defNormalProp(a, prop, b[prop]);
|
|
263
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
257
264
|
}
|
|
258
265
|
return a;
|
|
259
266
|
};
|
|
260
267
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
268
|
+
var __publicField$2 = (obj, key, value) => {
|
|
269
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
270
|
+
return value;
|
|
271
|
+
};
|
|
261
272
|
class Button extends Composite {
|
|
262
273
|
// todo: add getters/setters so button can respond to changes in its options
|
|
263
274
|
// todo: add default "behaviors" (?) like button click animation?
|
|
@@ -272,14 +283,15 @@ class Button extends Composite {
|
|
|
272
283
|
*/
|
|
273
284
|
constructor(options) {
|
|
274
285
|
super(options);
|
|
275
|
-
this
|
|
286
|
+
__publicField$2(this, "compositeType", "button");
|
|
276
287
|
// Button options
|
|
277
|
-
this
|
|
278
|
-
this
|
|
279
|
-
this
|
|
280
|
-
this
|
|
281
|
-
this
|
|
282
|
-
this
|
|
288
|
+
__publicField$2(this, "_backgroundColor", WebColors.Black);
|
|
289
|
+
__publicField$2(this, "size", { width: 200, height: 50 });
|
|
290
|
+
__publicField$2(this, "cornerRadius", 9);
|
|
291
|
+
__publicField$2(this, "fontSize", 20);
|
|
292
|
+
__publicField$2(this, "text", "");
|
|
293
|
+
__publicField$2(this, "_fontColor", WebColors.White);
|
|
294
|
+
__publicField$2(this, "backgroundPaint");
|
|
283
295
|
if (options.text) {
|
|
284
296
|
this.text = options.text;
|
|
285
297
|
}
|
|
@@ -383,6 +395,12 @@ class Button extends Composite {
|
|
|
383
395
|
}
|
|
384
396
|
}
|
|
385
397
|
|
|
398
|
+
var __defProp$1 = Object.defineProperty;
|
|
399
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
400
|
+
var __publicField$1 = (obj, key, value) => {
|
|
401
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
402
|
+
return value;
|
|
403
|
+
};
|
|
386
404
|
var DialogResult = /* @__PURE__ */ ((DialogResult2) => {
|
|
387
405
|
DialogResult2["Dismiss"] = "Dismiss";
|
|
388
406
|
DialogResult2["Positive"] = "Positive";
|
|
@@ -394,16 +412,17 @@ class Dialog extends Composite {
|
|
|
394
412
|
// todo: add default "behaviors" (?) like button click animation?
|
|
395
413
|
constructor(options) {
|
|
396
414
|
super(options);
|
|
397
|
-
this
|
|
398
|
-
this
|
|
399
|
-
this
|
|
400
|
-
this
|
|
401
|
-
this
|
|
402
|
-
this
|
|
403
|
-
this
|
|
404
|
-
this
|
|
405
|
-
this
|
|
406
|
-
this
|
|
415
|
+
__publicField$1(this, "compositeType", "dialog");
|
|
416
|
+
__publicField$1(this, "_backgroundColor", WebColors.White);
|
|
417
|
+
__publicField$1(this, "cornerRadius", 9);
|
|
418
|
+
__publicField$1(this, "overlayAlpha", 0.5);
|
|
419
|
+
__publicField$1(this, "contentText", "");
|
|
420
|
+
__publicField$1(this, "positiveButtonText", "");
|
|
421
|
+
__publicField$1(this, "negativeButtonText", "");
|
|
422
|
+
__publicField$1(this, "zPosition", Number.MAX_VALUE);
|
|
423
|
+
__publicField$1(this, "hidden", true);
|
|
424
|
+
__publicField$1(this, "_fontColor", WebColors.White);
|
|
425
|
+
__publicField$1(this, "backgroundPaint");
|
|
407
426
|
if (!options) {
|
|
408
427
|
return;
|
|
409
428
|
}
|
|
@@ -591,6 +610,12 @@ class Dialog extends Composite {
|
|
|
591
610
|
}
|
|
592
611
|
}
|
|
593
612
|
|
|
613
|
+
var __defProp = Object.defineProperty;
|
|
614
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
615
|
+
var __publicField = (obj, key, value) => {
|
|
616
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
617
|
+
return value;
|
|
618
|
+
};
|
|
594
619
|
class VirtualKeyboard extends Composite {
|
|
595
620
|
/**
|
|
596
621
|
* An on-screen keyboard that can be used to enter text.
|
|
@@ -600,8 +625,23 @@ class VirtualKeyboard extends Composite {
|
|
|
600
625
|
constructor(options) {
|
|
601
626
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
602
627
|
super(options);
|
|
603
|
-
this
|
|
604
|
-
this
|
|
628
|
+
__publicField(this, "keyboardHorizontalPaddingPercent");
|
|
629
|
+
__publicField(this, "keyboardVerticalPaddingPercent");
|
|
630
|
+
__publicField(this, "keyHorizontalPaddingPercent");
|
|
631
|
+
__publicField(this, "keyVerticalPaddingPercent");
|
|
632
|
+
__publicField(this, "rowsConfiguration", new Array());
|
|
633
|
+
__publicField(this, "keysPerRow");
|
|
634
|
+
__publicField(this, "fontSize");
|
|
635
|
+
__publicField(this, "fontNames");
|
|
636
|
+
__publicField(this, "hiddenKeys");
|
|
637
|
+
__publicField(this, "capitalLettersOnly");
|
|
638
|
+
__publicField(this, "keyColor");
|
|
639
|
+
__publicField(this, "keyDownColor");
|
|
640
|
+
__publicField(this, "specialKeyDownColor");
|
|
641
|
+
__publicField(this, "backgroundColor");
|
|
642
|
+
__publicField(this, "showKeyDownPreview");
|
|
643
|
+
__publicField(this, "shiftActivated", false);
|
|
644
|
+
__publicField(this, "shiftKeyShape");
|
|
605
645
|
this.size = options.size;
|
|
606
646
|
this.position = (_a = options.position) != null ? _a : { x: 0, y: 0 };
|
|
607
647
|
this.keyboardHorizontalPaddingPercent = (_b = options.keyboardHorizontalPaddingPercent) != null ? _b : 0.02;
|
|
@@ -677,7 +717,7 @@ class VirtualKeyboard extends Composite {
|
|
|
677
717
|
const shiftArrowShapeOptions = {
|
|
678
718
|
path: {
|
|
679
719
|
// Public Domain from https://www.freesvg.org
|
|
680
|
-
|
|
720
|
+
svgPathString: "m288-6.6849e-14 -288 288h144v288h288v-288h144l-288-288z",
|
|
681
721
|
width: 24
|
|
682
722
|
},
|
|
683
723
|
lineWidth: 2,
|
|
@@ -687,7 +727,7 @@ class VirtualKeyboard extends Composite {
|
|
|
687
727
|
const backspaceShapeOptions = {
|
|
688
728
|
path: {
|
|
689
729
|
// CC0 from https://www.svgrepo.com
|
|
690
|
-
|
|
730
|
+
svgPathString: "M10.625 5.09 0 22.09l10.625 17H44.18v-34H10.625zm31.555 32H11.734l-9.375-15 9.375-15H42.18v30zm-23.293-6.293 7.293-7.293 7.293 7.293 1.414-1.414-7.293-7.293 7.293-7.293-1.414-1.414-7.293 7.293-7.293-7.293-1.414 1.414 7.293 7.293-7.293 7.293",
|
|
691
731
|
width: 24
|
|
692
732
|
},
|
|
693
733
|
lineWidth: 1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m2c2kit/addons",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Additions to m2c2kit core functionalty, such as button, grid, and instructions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@rollup/plugin-babel": "6.0.3",
|
|
27
27
|
"rimraf": "5.0.1",
|
|
28
|
-
"rollup": "3.
|
|
28
|
+
"rollup": "3.25.1",
|
|
29
29
|
"rollup-plugin-copy": "3.4.0",
|
|
30
30
|
"rollup-plugin-dts": "5.3.0",
|
|
31
31
|
"rollup-plugin-esbuild": "5.0.0",
|