@pie-element/math-inline 5.6.4-next.133 → 5.6.4-next.1335

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.
@@ -225,7 +225,7 @@
225
225
  },
226
226
  "validation": {
227
227
  "description": "Indicates what type of validation should be applied on the response",
228
- "default": "is symbolic",
228
+ "default": "is literal",
229
229
  "enum": [
230
230
  "literal",
231
231
  "symbolic"
@@ -233,6 +233,18 @@
233
233
  "type": "string",
234
234
  "title": "validation"
235
235
  },
236
+ "ignoreOrder": {
237
+ "description": "Indicates if the order of expression elements in literal validation can be ignore - whilst the expression is still mathematically correct",
238
+ "default": "is false",
239
+ "type": "boolean",
240
+ "title": "ignoreOrder"
241
+ },
242
+ "allowTrailingZeros": {
243
+ "description": "Indicates the allowance of trailing zeros in expressions - whilst the expression is still mathematically correct",
244
+ "default": "is false",
245
+ "type": "boolean",
246
+ "title": "allowTrailingZeros"
247
+ },
236
248
  "answer": {
237
249
  "description": "The answer for the question",
238
250
  "type": "string",
@@ -268,9 +280,11 @@
268
280
  }
269
281
  },
270
282
  "required": [
283
+ "allowTrailingZeros",
271
284
  "alternates",
272
285
  "answer",
273
286
  "id",
287
+ "ignoreOrder",
274
288
  "validation"
275
289
  ]
276
290
  },
@@ -290,7 +304,7 @@
290
304
  },
291
305
  "validation": {
292
306
  "description": "Indicates what type of validation should be applied on the response",
293
- "default": "is symbolic",
307
+ "default": "is literal",
294
308
  "enum": [
295
309
  "literal",
296
310
  "symbolic"
@@ -298,6 +312,18 @@
298
312
  "type": "string",
299
313
  "title": "validation"
300
314
  },
315
+ "ignoreOrder": {
316
+ "description": "Indicates if the order of expression elements in literal validation can be ignore - whilst the expression is still mathematically correct",
317
+ "default": "is false",
318
+ "type": "boolean",
319
+ "title": "ignoreOrder"
320
+ },
321
+ "allowTrailingZeros": {
322
+ "description": "Indicates the allowance of trailing zeros in expressions - whilst the expression is still mathematically correct",
323
+ "default": "is false",
324
+ "type": "boolean",
325
+ "title": "allowTrailingZeros"
326
+ },
301
327
  "answer": {
302
328
  "description": "The answer for the question",
303
329
  "type": "string",
@@ -333,9 +359,11 @@
333
359
  }
334
360
  },
335
361
  "required": [
362
+ "allowTrailingZeros",
336
363
  "alternates",
337
364
  "answer",
338
365
  "id",
366
+ "ignoreOrder",
339
367
  "validation"
340
368
  ]
341
369
  },
@@ -344,6 +372,18 @@
344
372
  "type": "boolean",
345
373
  "title": "partialScoring"
346
374
  },
375
+ "ignoreOrderDefault": {
376
+ "description": "Indicates the default value for ignoreOrder, in case that it's not set",
377
+ "default": "is false",
378
+ "type": "boolean",
379
+ "title": "ignoreOrderDefault"
380
+ },
381
+ "allowTrailingZerosDefault": {
382
+ "description": "Indicates the default value for allowTrailingZeros, in case that it's not set",
383
+ "default": "is false",
384
+ "type": "boolean",
385
+ "title": "allowTrailingZerosDefault"
386
+ },
347
387
  "rationale": {
348
388
  "description": "Indicates the value for rationale",
349
389
  "type": "string",
@@ -386,6 +426,11 @@
386
426
  "type": "boolean",
387
427
  "title": "rationaleEnabled"
388
428
  },
429
+ "spellCheckEnabled": {
430
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
431
+ "type": "boolean",
432
+ "title": "spellCheckEnabled"
433
+ },
389
434
  "studentInstructionsEnabled": {
390
435
  "description": "Indicates if Student Instructions are enabled",
391
436
  "type": "boolean",
@@ -411,6 +456,11 @@
411
456
  "type": "string",
412
457
  "title": "toolbarEditorPosition"
413
458
  },
459
+ "rubricEnabled": {
460
+ "description": "Indicates if Rubric is enabled",
461
+ "type": "boolean",
462
+ "title": "rubricEnabled"
463
+ },
414
464
  "id": {
415
465
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
416
466
  "type": "string",
@@ -423,12 +473,16 @@
423
473
  }
424
474
  },
425
475
  "required": [
476
+ "allowTrailingZerosDefault",
426
477
  "element",
427
478
  "expression",
428
479
  "feedbackEnabled",
429
480
  "id",
481
+ "ignoreOrderDefault",
430
482
  "rationaleEnabled",
431
483
  "responses",
484
+ "rubricEnabled",
485
+ "spellCheckEnabled",
432
486
  "studentInstructionsEnabled",
433
487
  "teacherInstructionsEnabled"
434
488
  ],
@@ -449,6 +503,48 @@
449
503
  }
450
504
  }
451
505
  },
506
+ "ConfigurePropWithEnabled": {
507
+ "title": "ConfigurePropWithEnabled",
508
+ "type": "object",
509
+ "properties": {
510
+ "settings": {
511
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
512
+ "type": "boolean",
513
+ "title": "settings"
514
+ },
515
+ "label": {
516
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
517
+ "type": "string",
518
+ "title": "label"
519
+ },
520
+ "enabled": {
521
+ "description": "Indicates the value of the item if it affects config-ui\n(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)",
522
+ "type": "boolean",
523
+ "title": "enabled"
524
+ }
525
+ }
526
+ },
527
+ "ConfigureMaxImageDimensionsProp": {
528
+ "title": "ConfigureMaxImageDimensionsProp",
529
+ "type": "object",
530
+ "properties": {
531
+ "teacherInstructions": {
532
+ "description": "Indicates the max dimension for images in teacher instructions",
533
+ "type": "number",
534
+ "title": "teacherInstructions"
535
+ },
536
+ "prompt": {
537
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
538
+ "type": "number",
539
+ "title": "prompt"
540
+ },
541
+ "rationale": {
542
+ "description": "Indicates the max dimension for images in rationale",
543
+ "type": "number",
544
+ "title": "rationale"
545
+ }
546
+ }
547
+ },
452
548
  "ComplexFeedbackType": {
453
549
  "title": "ComplexFeedbackType",
454
550
  "type": "object",
@@ -675,7 +771,7 @@
675
771
  },
676
772
  "validation": {
677
773
  "description": "Indicates what type of validation should be applied on the response",
678
- "default": "is symbolic",
774
+ "default": "is literal",
679
775
  "enum": [
680
776
  "literal",
681
777
  "symbolic"
@@ -683,6 +779,18 @@
683
779
  "type": "string",
684
780
  "title": "validation"
685
781
  },
782
+ "ignoreOrder": {
783
+ "description": "Indicates if the order of expression elements in literal validation can be ignore - whilst the expression is still mathematically correct",
784
+ "default": "is false",
785
+ "type": "boolean",
786
+ "title": "ignoreOrder"
787
+ },
788
+ "allowTrailingZeros": {
789
+ "description": "Indicates the allowance of trailing zeros in expressions - whilst the expression is still mathematically correct",
790
+ "default": "is false",
791
+ "type": "boolean",
792
+ "title": "allowTrailingZeros"
793
+ },
686
794
  "answer": {
687
795
  "description": "The answer for the question",
688
796
  "type": "string",
@@ -718,9 +826,11 @@
718
826
  }
719
827
  },
720
828
  "required": [
829
+ "allowTrailingZeros",
721
830
  "alternates",
722
831
  "answer",
723
832
  "id",
833
+ "ignoreOrder",
724
834
  "validation"
725
835
  ]
726
836
  },
@@ -746,4 +856,4 @@
746
856
  }
747
857
  },
748
858
  "$schema": "http://json-schema.org/draft-07/schema#"
749
- }
859
+ }
@@ -81,7 +81,19 @@ This element must be one of the following enum values:
81
81
  * `literal`
82
82
  * `symbolic`
83
83
 
84
- Default: `"is symbolic"`
84
+ Default: `"is literal"`
85
+
86
+ ## `ignoreOrder` (boolean, required)
87
+
88
+ Indicates if the order of expression elements in literal validation can be ignore - whilst the expression is still mathematically correct
89
+
90
+ Default: `"is false"`
91
+
92
+ ## `allowTrailingZeros` (boolean, required)
93
+
94
+ Indicates the allowance of trailing zeros in expressions - whilst the expression is still mathematically correct
95
+
96
+ Default: `"is false"`
85
97
 
86
98
  ## `answer` (string, required)
87
99
 
@@ -109,7 +121,19 @@ This element must be one of the following enum values:
109
121
  * `literal`
110
122
  * `symbolic`
111
123
 
112
- Default: `"is symbolic"`
124
+ Default: `"is literal"`
125
+
126
+ ## `ignoreOrder` (boolean, required)
127
+
128
+ Indicates if the order of expression elements in literal validation can be ignore - whilst the expression is still mathematically correct
129
+
130
+ Default: `"is false"`
131
+
132
+ ## `allowTrailingZeros` (boolean, required)
133
+
134
+ Indicates the allowance of trailing zeros in expressions - whilst the expression is still mathematically correct
135
+
136
+ Default: `"is false"`
113
137
 
114
138
  ## `answer` (string, required)
115
139
 
@@ -125,6 +149,18 @@ an object with some alternatives for the correct answers
125
149
  Indicates if partial scoring is allowed.
126
150
  This property is not used yet.
127
151
 
152
+ # `ignoreOrderDefault` (boolean, required)
153
+
154
+ Indicates the default value for ignoreOrder, in case that it's not set
155
+
156
+ Default: `"is false"`
157
+
158
+ # `allowTrailingZerosDefault` (boolean, required)
159
+
160
+ Indicates the default value for allowTrailingZeros, in case that it's not set
161
+
162
+ Default: `"is false"`
163
+
128
164
  # `rationale` (string)
129
165
 
130
166
  Indicates the value for rationale
@@ -160,6 +196,10 @@ Indicates if Feedback is enabled
160
196
 
161
197
  Indicates if Rationale are enabled
162
198
 
199
+ # `spellCheckEnabled` (boolean, required)
200
+
201
+ Indicates if spellcheck is enabled for the author. Default value is true
202
+
163
203
  # `studentInstructionsEnabled` (boolean, required)
164
204
 
165
205
  Indicates if Student Instructions are enabled
@@ -183,6 +223,10 @@ This element must be one of the following enum values:
183
223
 
184
224
  Default: `": 'bottom'"`
185
225
 
226
+ # `rubricEnabled` (boolean, required)
227
+
228
+ Indicates if Rubric is enabled
229
+
186
230
  # `id` (string, required)
187
231
 
188
232
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -209,6 +253,39 @@ Indicates if the item has to be displayed in the Settings Panel
209
253
 
210
254
  Indicates the label for the item that has to be displayed in the Settings Panel
211
255
 
256
+ ## `ConfigurePropWithEnabled` (object)
257
+
258
+ Properties of the `ConfigurePropWithEnabled` object:
259
+
260
+ ### `settings` (boolean)
261
+
262
+ Indicates if the item has to be displayed in the Settings Panel
263
+
264
+ ### `label` (string)
265
+
266
+ Indicates the label for the item that has to be displayed in the Settings Panel
267
+
268
+ ### `enabled` (boolean)
269
+
270
+ Indicates the value of the item if it affects config-ui
271
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
272
+
273
+ ## `ConfigureMaxImageDimensionsProp` (object)
274
+
275
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
276
+
277
+ ### `teacherInstructions` (number)
278
+
279
+ Indicates the max dimension for images in teacher instructions
280
+
281
+ ### `prompt` (number)
282
+
283
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
284
+
285
+ ### `rationale` (number)
286
+
287
+ Indicates the max dimension for images in rationale
288
+
212
289
  ## `ComplexFeedbackType` (object)
213
290
 
214
291
  Properties of the `ComplexFeedbackType` object:
@@ -275,7 +352,19 @@ This element must be one of the following enum values:
275
352
  * `literal`
276
353
  * `symbolic`
277
354
 
278
- Default: `"is symbolic"`
355
+ Default: `"is literal"`
356
+
357
+ ### `ignoreOrder` (boolean, required)
358
+
359
+ Indicates if the order of expression elements in literal validation can be ignore - whilst the expression is still mathematically correct
360
+
361
+ Default: `"is false"`
362
+
363
+ ### `allowTrailingZeros` (boolean, required)
364
+
365
+ Indicates the allowance of trailing zeros in expressions - whilst the expression is still mathematically correct
366
+
367
+ Default: `"is false"`
279
368
 
280
369
  ### `answer` (string, required)
281
370
 
@@ -296,4 +385,4 @@ The id for the alternative response
296
385
 
297
386
  ### `answer` (string, required)
298
387
 
299
- The value for the alternative response
388
+ The value for the alternative response
package/lib/index.js CHANGED
@@ -41,7 +41,7 @@ var _defaults = _interopRequireDefault(require("../configure/lib/defaults"));
41
41
 
42
42
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
43
43
 
44
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
44
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
45
 
46
46
  var log = (0, _debug["default"])('pie-ui:math-inline');
47
47
 
@@ -56,8 +56,8 @@ var MathInline = /*#__PURE__*/function (_HTMLElement) {
56
56
  (0, _classCallCheck2["default"])(this, MathInline);
57
57
  _this = _super.call(this);
58
58
  _this._configuration = _defaults["default"].configuration;
59
- _this.sessionChangedEventCaller = _lodash["default"].debounce(function (session) {
60
- _this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(session, true));
59
+ _this.sessionChangedEventCaller = _lodash["default"].debounce(function () {
60
+ _this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(_this.tagName.toLowerCase(), true));
61
61
  }, 1000);
62
62
  return _this;
63
63
  }
@@ -72,6 +72,9 @@ var MathInline = /*#__PURE__*/function (_HTMLElement) {
72
72
  }
73
73
  }, {
74
74
  key: "session",
75
+ get: function get() {
76
+ return this._session;
77
+ },
75
78
  set: function set(s) {
76
79
  this._session = s;
77
80
 
@@ -92,7 +95,7 @@ var MathInline = /*#__PURE__*/function (_HTMLElement) {
92
95
  Object.keys(s).map(function (key) {
93
96
  _this2._session[key] = s[key];
94
97
  });
95
- this.sessionChangedEventCaller(this._session);
98
+ this.sessionChangedEventCaller();
96
99
  log('session: ', this._session);
97
100
  }
98
101
  }, {
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","MathInline","_configuration","defaults","configuration","sessionChangedEventCaller","_","debounce","session","dispatchEvent","SessionChangedEvent","m","_model","ModelSetEvent","_render","s","_session","c","Object","keys","map","key","el","React","createElement","Main","model","onSessionChange","sessionChanged","bind","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAIA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,o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QAAAA,OAAO,EAAE,KAAKQ,QAFqB;AAGnCZ,QAAAA,aAAa,EAAE,KAAKF,cAHe;AAInCyB,QAAAA,eAAe,EAAE,KAAKC,cAAL,CAAoBC,IAApB,CAAyB,IAAzB;AAJkB,OAA1B,CAAX;;AAOAC,2BAASC,MAAT,CAAgBT,EAAhB,EAAoB,IAApB;AACD;;;kDAnDqCU,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\nimport debug from 'debug';\nimport _ from 'lodash';\n\nimport {\n ModelSetEvent,\n SessionChangedEvent,\n} from '@pie-framework/pie-player-events';\nimport defaults from '../configure/lib/defaults';\n\nconst log = debug('pie-ui:math-inline');\n\nexport { Main as Component };\n\nexport default class MathInline extends HTMLElement {\n constructor() {\n super();\n this._configuration = defaults.configuration;\n this.sessionChangedEventCaller = _.debounce((session) => {\n this.dispatchEvent(new SessionChangedEvent(session, true));\n }, 1000);\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this._model, true, !!this._model));\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n set configuration(c) {\n this._configuration = c;\n this._render();\n }\n\n sessionChanged(s) {\n Object.keys(s).map(key => {\n this._session[key] = s[key];\n });\n\n this.sessionChangedEventCaller(this._session);\n log('session: ', this._session);\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n configuration: this._configuration,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n ReactDOM.render(el, this);\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","MathInline","_configuration","defaults","configuration","sessionChangedEventCaller","_","debounce","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","m","_model","ModelSetEvent","_render","_session","s","c","Object","keys","map","key","el","React","createElement","Main","model","session","onSessionChange","sessionChanged","bind","ReactDOM","render","HTMLElement"],"mappings":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AAgB,CAAC,KAAKG,QAA1B,EAAoC;AAClC;AACD;;AAED,UAAMO,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,QAAAA,KAAK,EAAE,KAAKd,MADuB;AAEnCe,QAAAA,OAAO,EAAE,KAAKZ,QAFqB;AAGnCZ,QAAAA,aAAa,EAAE,KAAKF,cAHe;AAInC2B,QAAAA,eAAe,EAAE,KAAKC,cAAL,CAAoBC,IAApB,CAAyB,IAAzB;AAJkB,OAA1B,CAAX;;AAOAC,2BAASC,MAAT,CAAgBV,EAAhB,EAAoB,IAApB;AACD;;;kDAvDqCW,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\nimport debug from 'debug';\nimport _ from 'lodash';\n\nimport {\n ModelSetEvent,\n SessionChangedEvent,\n} from '@pie-framework/pie-player-events';\nimport defaults from '../configure/lib/defaults';\n\nconst log = debug('pie-ui:math-inline');\n\nexport { Main as Component };\n\nexport default class MathInline extends HTMLElement {\n constructor() {\n super();\n this._configuration = defaults.configuration;\n this.sessionChangedEventCaller = _.debounce(() => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), true));\n }, 1000);\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this._model, true, !!this._model));\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n set configuration(c) {\n this._configuration = c;\n this._render();\n }\n\n sessionChanged(s) {\n Object.keys(s).map(key => {\n this._session[key] = s[key];\n });\n\n this.sessionChangedEventCaller();\n log('session: ', this._session);\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n configuration: this._configuration,\n onSessionChange: this.sessionChanged.bind(this),\n });\n\n ReactDOM.render(el, this);\n }\n}\n"],"file":"index.js"}