@pie-element/drawing-response 6.0.1-cr.1 → 6.0.1-next.14

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.
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createDefaultModel = void 0;
9
+ exports.model = model;
10
+ exports.normalize = void 0;
11
+ exports.outcome = outcome;
12
+
13
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
+
15
+ var _debug = _interopRequireDefault(require("debug"));
16
+
17
+ var _defaults = _interopRequireDefault(require("./defaults"));
18
+
19
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
+
21
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
22
+
23
+ var log = (0, _debug["default"])('pie-elements:drawing-response:controller');
24
+
25
+ var normalize = function normalize(question) {
26
+ return _objectSpread({
27
+ promptEnabled: true,
28
+ teacherInstructionsEnabled: true,
29
+ studentInstructionsEnabled: true,
30
+ backgroundImageEnabled: true
31
+ }, question);
32
+ };
33
+
34
+ exports.normalize = normalize;
35
+
36
+ function model(question, session, env) {
37
+ var normalizedQuestion = normalize(question);
38
+ var imageUrl = normalizedQuestion.imageUrl,
39
+ imageDimensions = normalizedQuestion.imageDimensions,
40
+ prompt = normalizedQuestion.prompt,
41
+ promptEnabled = normalizedQuestion.promptEnabled,
42
+ backgroundImageEnabled = normalizedQuestion.backgroundImageEnabled;
43
+ return new Promise(function (resolve) {
44
+ var out = {
45
+ disabled: env.mode !== 'gather',
46
+ mode: env.mode,
47
+ imageDimensions: imageDimensions,
48
+ imageUrl: imageUrl,
49
+ prompt: promptEnabled ? prompt : null,
50
+ backgroundImageEnabled: backgroundImageEnabled
51
+ };
52
+
53
+ if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {
54
+ out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
55
+ } else {
56
+ out.teacherInstructions = null;
57
+ }
58
+
59
+ resolve(out);
60
+ });
61
+ }
62
+
63
+ var createDefaultModel = function createDefaultModel() {
64
+ var model = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
65
+ return new Promise(function (resolve) {
66
+ resolve(_objectSpread(_objectSpread({}, _defaults["default"]), model));
67
+ });
68
+ };
69
+
70
+ exports.createDefaultModel = createDefaultModel;
71
+
72
+ function
73
+ /*config, session*/
74
+ outcome() {
75
+ return new Promise(function (resolve) {
76
+ log('outcome...');
77
+ resolve({
78
+ score: 0,
79
+ completed: 'n/a',
80
+ note: 'Requires manual scoring'
81
+ });
82
+ });
83
+ }
84
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","normalize","question","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","backgroundImageEnabled","model","session","env","normalizedQuestion","imageUrl","imageDimensions","prompt","Promise","resolve","out","disabled","mode","role","teacherInstructions","createDefaultModel","defaults","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0CAAN,CAAZ;;AAEO,IAAMC,SAAS,GAAG,SAAZA,SAAY,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B,IAA1B;AACD;;AAEDL,IAAAA,OAAO,CAACC,GAAD,CAAP;AACD,GAnBM,CAAP;AAoBD;;AAEM,IAAMK,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,MAACd,KAAD,uEAAS,EAAT;AAAA,SAChC,IAAIO,OAAJ,CAAY,UAACC,OAAD,EAAa;AACvBA,IAAAA,OAAO,iCACFO,oBADE,GAEFf,KAFE,EAAP;AAID,GALD,CADgC;AAAA,CAA3B;;;;AAQA;AAAiB;AAARgB,OAAT,GAAsC;AAC3C,SAAO,IAAIT,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC9Bf,IAAAA,GAAG,CAAC,YAAD,CAAH;AACAe,IAAAA,OAAO,CAAC;AACNS,MAAAA,KAAK,EAAE,CADD;AAENC,MAAAA,SAAS,EAAE,KAFL;AAGNC,MAAAA,IAAI,EAAE;AAHA,KAAD,CAAP;AAKD,GAPM,CAAP;AAQD","sourcesContent":["import debug from 'debug';\nimport defaults from './defaults';\n\nconst log = debug('pie-elements:drawing-response:controller');\n\nexport const normalize = (question) => ({\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n backgroundImageEnabled: true,\n ...question,\n});\n\nexport function model(question, session, env) {\n const normalizedQuestion = normalize(question);\n const { imageUrl, imageDimensions, prompt, promptEnabled, backgroundImageEnabled } = normalizedQuestion;\n\n return new Promise((resolve) => {\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n imageDimensions,\n imageUrl,\n prompt: promptEnabled ? prompt : null,\n backgroundImageEnabled,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n}\n\nexport const createDefaultModel = (model = {}) =>\n new Promise((resolve) => {\n resolve({\n ...defaults,\n ...model,\n });\n });\n\nexport function outcome(/*config, session*/) {\n return new Promise((resolve) => {\n log('outcome...');\n resolve({\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring',\n });\n });\n}\n"],"file":"index.js"}
@@ -150,7 +150,7 @@
150
150
  "title": "label"
151
151
  },
152
152
  "forceEnabled": {
153
- "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
153
+ "description": "Indicates the value for the toggle;\nif true:\n- this property will not be visible in Settings Panel (settings will become automatically false)\n- the model property afferent to it will become automatically false",
154
154
  "type": "boolean",
155
155
  "title": "forceEnabled"
156
156
  }
@@ -243,7 +243,7 @@
243
243
  "title": "label"
244
244
  },
245
245
  "forceEnabled": {
246
- "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
246
+ "description": "Indicates the value for the toggle;\nif true:\n- this property will not be visible in Settings Panel (settings will become automatically false)\n- the model property afferent to it will become automatically false",
247
247
  "type": "boolean",
248
248
  "title": "forceEnabled"
249
249
  }
@@ -117,7 +117,10 @@ Indicates the label for the item that has to be displayed in the Settings Panel
117
117
 
118
118
  ## `forceEnabled` (boolean)
119
119
 
120
- Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
120
+ Indicates the value for the toggle;
121
+ if true:
122
+ - this property will not be visible in Settings Panel (settings will become automatically false)
123
+ - the model property afferent to it will become automatically false
121
124
 
122
125
  # `showPrompt` (boolean)
123
126
 
@@ -196,4 +199,7 @@ Indicates the label for the item that has to be displayed in the Settings Panel
196
199
 
197
200
  ### `forceEnabled` (boolean)
198
201
 
199
- Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
202
+ Indicates the value for the toggle;
203
+ if true:
204
+ - this property will not be visible in Settings Panel (settings will become automatically false)
205
+ - the model property afferent to it will become automatically false
@@ -183,7 +183,7 @@
183
183
  "title": "label"
184
184
  },
185
185
  "forceEnabled": {
186
- "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
186
+ "description": "Indicates the value for the toggle;\nif true:\n- this property will not be visible in Settings Panel (settings will become automatically false)\n- the model property afferent to it will become automatically false",
187
187
  "type": "boolean",
188
188
  "title": "forceEnabled"
189
189
  }
@@ -142,7 +142,10 @@ Indicates the label for the item that has to be displayed in the Settings Panel
142
142
 
143
143
  ### `forceEnabled` (boolean)
144
144
 
145
- Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
145
+ Indicates the value for the toggle;
146
+ if true:
147
+ - this property will not be visible in Settings Panel (settings will become automatically false)
148
+ - the model property afferent to it will become automatically false
146
149
 
147
150
  ## `Dimension` (object)
148
151
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/drawing-response",
3
- "version": "6.0.1-cr.1",
3
+ "version": "6.0.1-next.14+dbc1d50cb",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "author": "pie framework developers",
26
26
  "license": "ISC",
27
- "gitHead": "0e14ff981bcdc8a89a0e58484026496701bfdbc3",
27
+ "gitHead": "dbc1d50cbc34321e5e6c5b334da11dcf4281cb0b",
28
28
  "scripts": {
29
29
  "postpublish": "../../scripts/postpublish"
30
30
  },