@pie-element/graphing 3.5.3 → 3.5.4-next.1008

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/configure/CHANGELOG.md +152 -0
  3. package/configure/lib/configure.js +108 -47
  4. package/configure/lib/configure.js.map +1 -1
  5. package/configure/lib/correct-response.js +203 -46
  6. package/configure/lib/correct-response.js.map +1 -1
  7. package/configure/lib/defaults.js +49 -7
  8. package/configure/lib/defaults.js.map +1 -1
  9. package/configure/lib/graphing-config.js +162 -183
  10. package/configure/lib/graphing-config.js.map +1 -1
  11. package/configure/lib/index.js +36 -19
  12. package/configure/lib/index.js.map +1 -1
  13. package/configure/lib/utils.js +94 -0
  14. package/configure/lib/utils.js.map +1 -0
  15. package/configure/package.json +4 -4
  16. package/controller/CHANGELOG.md +40 -0
  17. package/controller/lib/defaults.js +9 -1
  18. package/controller/lib/defaults.js.map +1 -1
  19. package/controller/lib/index.js +38 -23
  20. package/controller/lib/index.js.map +1 -1
  21. package/controller/lib/utils.js +8 -6
  22. package/controller/lib/utils.js.map +1 -1
  23. package/controller/package.json +1 -1
  24. package/docs/config-schema.json +282 -0
  25. package/docs/config-schema.json.md +213 -1
  26. package/docs/demo/generate.js +7 -1
  27. package/docs/pie-schema.json +211 -3
  28. package/docs/pie-schema.json.md +150 -2
  29. package/lib/index.js +4 -1
  30. package/lib/index.js.map +1 -1
  31. package/lib/main.js +13 -19
  32. package/lib/main.js.map +1 -1
  33. package/lib/utils.js +3 -1
  34. package/lib/utils.js.map +1 -1
  35. package/package.json +6 -6
  36. package/module/configure.js +0 -1260
  37. package/module/controller.js +0 -21893
  38. package/module/demo.js +0 -92
  39. package/module/element.js +0 -245
  40. package/module/index.html +0 -16
  41. package/module/manifest.json +0 -14
@@ -981,9 +981,36 @@
981
981
  "title": "answers"
982
982
  },
983
983
  "arrows": {
984
- "description": "Indicates if arrows are enabled",
985
- "type": "boolean",
986
- "title": "arrows"
984
+ "title": "Arrows",
985
+ "type": "object",
986
+ "properties": {
987
+ "left": {
988
+ "description": "Indicates if left arrow is enabled",
989
+ "type": "boolean",
990
+ "title": "left"
991
+ },
992
+ "right": {
993
+ "description": "Indicates if right arrow is enabled",
994
+ "type": "boolean",
995
+ "title": "right"
996
+ },
997
+ "up": {
998
+ "description": "Indicates if up arrow is enabled",
999
+ "type": "boolean",
1000
+ "title": "up"
1001
+ },
1002
+ "down": {
1003
+ "description": "Indicates if down arrow is enabled",
1004
+ "type": "boolean",
1005
+ "title": "down"
1006
+ }
1007
+ },
1008
+ "required": [
1009
+ "down",
1010
+ "left",
1011
+ "right",
1012
+ "up"
1013
+ ]
987
1014
  },
988
1015
  "backgroundMarks": {
989
1016
  "description": "Indicates marks that have to be displayed in background",
@@ -1453,6 +1480,11 @@
1453
1480
  },
1454
1481
  "title": "backgroundMarks"
1455
1482
  },
1483
+ "coordinatesOnHover": {
1484
+ "description": "Indicates if coordinates of a point are displayed on hover",
1485
+ "type": "boolean",
1486
+ "title": "coordinatesOnHover"
1487
+ },
1456
1488
  "domain": {
1457
1489
  "title": "GraphSettings",
1458
1490
  "type": "object",
@@ -1517,6 +1549,11 @@
1517
1549
  "width"
1518
1550
  ]
1519
1551
  },
1552
+ "includeAxes": {
1553
+ "description": "Indicates if the graph axes and labels are enabled",
1554
+ "type": "boolean",
1555
+ "title": "includeAxes"
1556
+ },
1520
1557
  "labels": {
1521
1558
  "title": "Labels",
1522
1559
  "type": "object",
@@ -1684,6 +1721,16 @@
1684
1721
  "type": "boolean",
1685
1722
  "title": "rationaleEnabled"
1686
1723
  },
1724
+ "spellCheckEnabled": {
1725
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
1726
+ "type": "boolean",
1727
+ "title": "spellCheckEnabled"
1728
+ },
1729
+ "standardGrid": {
1730
+ "description": "Indicates if some domain values will be synched to the range values",
1731
+ "type": "boolean",
1732
+ "title": "standardGrid"
1733
+ },
1687
1734
  "studentInstructionsEnabled": {
1688
1735
  "description": "Indicates if Student Instructions are enabled",
1689
1736
  "type": "boolean",
@@ -1714,6 +1761,7 @@
1714
1761
  "id",
1715
1762
  "range",
1716
1763
  "rationaleEnabled",
1764
+ "spellCheckEnabled",
1717
1765
  "studentInstructionsEnabled",
1718
1766
  "teacherInstructionsEnabled"
1719
1767
  ],
@@ -1739,6 +1787,77 @@
1739
1787
  }
1740
1788
  }
1741
1789
  },
1790
+ "ArrowsConfigProp": {
1791
+ "title": "ArrowsConfigProp",
1792
+ "type": "object",
1793
+ "properties": {
1794
+ "settings": {
1795
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
1796
+ "type": "boolean",
1797
+ "title": "settings"
1798
+ },
1799
+ "label": {
1800
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
1801
+ "type": "string",
1802
+ "title": "label"
1803
+ },
1804
+ "left": {
1805
+ "title": "ArrowsProp",
1806
+ "type": "object",
1807
+ "properties": {
1808
+ "label": {
1809
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1810
+ "type": "string",
1811
+ "title": "label"
1812
+ }
1813
+ }
1814
+ },
1815
+ "right": {
1816
+ "title": "ArrowsProp",
1817
+ "type": "object",
1818
+ "properties": {
1819
+ "label": {
1820
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1821
+ "type": "string",
1822
+ "title": "label"
1823
+ }
1824
+ }
1825
+ },
1826
+ "up": {
1827
+ "title": "ArrowsProp",
1828
+ "type": "object",
1829
+ "properties": {
1830
+ "label": {
1831
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1832
+ "type": "string",
1833
+ "title": "label"
1834
+ }
1835
+ }
1836
+ },
1837
+ "down": {
1838
+ "title": "ArrowsProp",
1839
+ "type": "object",
1840
+ "properties": {
1841
+ "label": {
1842
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1843
+ "type": "string",
1844
+ "title": "label"
1845
+ }
1846
+ }
1847
+ }
1848
+ }
1849
+ },
1850
+ "ArrowsProp": {
1851
+ "title": "ArrowsProp",
1852
+ "type": "object",
1853
+ "properties": {
1854
+ "label": {
1855
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1856
+ "type": "string",
1857
+ "title": "label"
1858
+ }
1859
+ }
1860
+ },
1742
1861
  "ConfigureProp": {
1743
1862
  "title": "ConfigureProp",
1744
1863
  "type": "object",
@@ -1755,6 +1874,63 @@
1755
1874
  }
1756
1875
  }
1757
1876
  },
1877
+ "DimensionsConfigProp": {
1878
+ "title": "DimensionsConfigProp",
1879
+ "type": "object",
1880
+ "properties": {
1881
+ "settings": {
1882
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
1883
+ "type": "boolean",
1884
+ "title": "settings"
1885
+ },
1886
+ "label": {
1887
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
1888
+ "type": "string",
1889
+ "title": "label"
1890
+ },
1891
+ "enabled": {
1892
+ "description": "Indicates if the graph dimensions are included in the Grid Setup Panel",
1893
+ "type": "boolean",
1894
+ "title": "enabled"
1895
+ },
1896
+ "min": {
1897
+ "description": "Indicates the minimum value for the graph width and height",
1898
+ "type": "number",
1899
+ "title": "min"
1900
+ },
1901
+ "max": {
1902
+ "description": "Indicates the maximum value for the graph width and height",
1903
+ "type": "number",
1904
+ "title": "max"
1905
+ },
1906
+ "step": {
1907
+ "description": "Indicates the increase/decrease value for the graph width and height",
1908
+ "type": "number",
1909
+ "title": "step"
1910
+ }
1911
+ }
1912
+ },
1913
+ "ConfigureMaxImageDimensionsProp": {
1914
+ "title": "ConfigureMaxImageDimensionsProp",
1915
+ "type": "object",
1916
+ "properties": {
1917
+ "teacherInstructions": {
1918
+ "description": "Indicates the max dimension for images in teacher instructions",
1919
+ "type": "number",
1920
+ "title": "teacherInstructions"
1921
+ },
1922
+ "prompt": {
1923
+ "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",
1924
+ "type": "number",
1925
+ "title": "prompt"
1926
+ },
1927
+ "rationale": {
1928
+ "description": "Indicates the max dimension for images in rationale",
1929
+ "type": "number",
1930
+ "title": "rationale"
1931
+ }
1932
+ }
1933
+ },
1758
1934
  "Answer": {
1759
1935
  "title": "Answer",
1760
1936
  "type": "object",
@@ -2486,6 +2662,38 @@
2486
2662
  "y"
2487
2663
  ]
2488
2664
  },
2665
+ "Arrows": {
2666
+ "title": "Arrows",
2667
+ "type": "object",
2668
+ "properties": {
2669
+ "left": {
2670
+ "description": "Indicates if left arrow is enabled",
2671
+ "type": "boolean",
2672
+ "title": "left"
2673
+ },
2674
+ "right": {
2675
+ "description": "Indicates if right arrow is enabled",
2676
+ "type": "boolean",
2677
+ "title": "right"
2678
+ },
2679
+ "up": {
2680
+ "description": "Indicates if up arrow is enabled",
2681
+ "type": "boolean",
2682
+ "title": "up"
2683
+ },
2684
+ "down": {
2685
+ "description": "Indicates if down arrow is enabled",
2686
+ "type": "boolean",
2687
+ "title": "down"
2688
+ }
2689
+ },
2690
+ "required": [
2691
+ "down",
2692
+ "left",
2693
+ "right",
2694
+ "up"
2695
+ ]
2696
+ },
2489
2697
  "GraphSettings": {
2490
2698
  "title": "GraphSettings",
2491
2699
  "type": "object",
@@ -40,9 +40,25 @@ Additional restrictions:
40
40
 
41
41
  * Minimum items: `1`
42
42
 
43
- # `arrows` (boolean)
43
+ # `arrows` (object)
44
44
 
45
- Indicates if arrows are enabled
45
+ Properties of the `arrows` object:
46
+
47
+ ## `left` (boolean, required)
48
+
49
+ Indicates if left arrow is enabled
50
+
51
+ ## `right` (boolean, required)
52
+
53
+ Indicates if right arrow is enabled
54
+
55
+ ## `up` (boolean, required)
56
+
57
+ Indicates if up arrow is enabled
58
+
59
+ ## `down` (boolean, required)
60
+
61
+ Indicates if down arrow is enabled
46
62
 
47
63
  # `backgroundMarks` (array, required)
48
64
 
@@ -52,6 +68,10 @@ Additional restrictions:
52
68
 
53
69
  * Minimum items: `1`
54
70
 
71
+ # `coordinatesOnHover` (boolean)
72
+
73
+ Indicates if coordinates of a point are displayed on hover
74
+
55
75
  # `domain` (object, required)
56
76
 
57
77
  Properties of the `domain` object:
@@ -92,6 +112,10 @@ Width for graph representation
92
112
 
93
113
  Height for graph representation
94
114
 
115
+ # `includeAxes` (boolean)
116
+
117
+ Indicates if the graph axes and labels are enabled
118
+
95
119
  # `labels` (object)
96
120
 
97
121
  Properties of the `labels` object:
@@ -189,6 +213,14 @@ Additional restrictions:
189
213
 
190
214
  Indicates if Rationale are enabled
191
215
 
216
+ # `spellCheckEnabled` (boolean, required)
217
+
218
+ Indicates if spellcheck is enabled for the author. Default value is true
219
+
220
+ # `standardGrid` (boolean)
221
+
222
+ Indicates if some domain values will be synched to the range values
223
+
192
224
  # `studentInstructionsEnabled` (boolean, required)
193
225
 
194
226
  Indicates if Student Instructions are enabled
@@ -228,6 +260,58 @@ Indicates the label for the item that has to be displayed in the Settings Panel
228
260
  Indicates the value of the item if it affects config-ui
229
261
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
230
262
 
263
+ ## `ArrowsConfigProp` (object)
264
+
265
+ Properties of the `ArrowsConfigProp` object:
266
+
267
+ ### `settings` (boolean)
268
+
269
+ Indicates if the item has to be displayed in the Settings Panel
270
+
271
+ ### `label` (string)
272
+
273
+ Indicates the label for the item that has to be displayed in the Settings Panel
274
+
275
+ ### `left` (object)
276
+
277
+ Properties of the `left` object:
278
+
279
+ #### `label` (string)
280
+
281
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
282
+
283
+ ### `right` (object)
284
+
285
+ Properties of the `right` object:
286
+
287
+ #### `label` (string)
288
+
289
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
290
+
291
+ ### `up` (object)
292
+
293
+ Properties of the `up` object:
294
+
295
+ #### `label` (string)
296
+
297
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
298
+
299
+ ### `down` (object)
300
+
301
+ Properties of the `down` object:
302
+
303
+ #### `label` (string)
304
+
305
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
306
+
307
+ ## `ArrowsProp` (object)
308
+
309
+ Properties of the `ArrowsProp` object:
310
+
311
+ ### `label` (string)
312
+
313
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
314
+
231
315
  ## `ConfigureProp` (object)
232
316
 
233
317
  Properties of the `ConfigureProp` object:
@@ -240,6 +324,50 @@ Indicates if the item has to be displayed in the Settings Panel
240
324
 
241
325
  Indicates the label for the item that has to be displayed in the Settings Panel
242
326
 
327
+ ## `DimensionsConfigProp` (object)
328
+
329
+ Properties of the `DimensionsConfigProp` object:
330
+
331
+ ### `settings` (boolean)
332
+
333
+ Indicates if the item has to be displayed in the Settings Panel
334
+
335
+ ### `label` (string)
336
+
337
+ Indicates the label for the item that has to be displayed in the Settings Panel
338
+
339
+ ### `enabled` (boolean)
340
+
341
+ Indicates if the graph dimensions are included in the Grid Setup Panel
342
+
343
+ ### `min` (number)
344
+
345
+ Indicates the minimum value for the graph width and height
346
+
347
+ ### `max` (number)
348
+
349
+ Indicates the maximum value for the graph width and height
350
+
351
+ ### `step` (number)
352
+
353
+ Indicates the increase/decrease value for the graph width and height
354
+
355
+ ## `ConfigureMaxImageDimensionsProp` (object)
356
+
357
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
358
+
359
+ ### `teacherInstructions` (number)
360
+
361
+ Indicates the max dimension for images in teacher instructions
362
+
363
+ ### `prompt` (number)
364
+
365
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
366
+
367
+ ### `rationale` (number)
368
+
369
+ Indicates the max dimension for images in rationale
370
+
243
371
  ## `Answer` (object)
244
372
 
245
373
  Properties of the `Answer` object:
@@ -392,6 +520,26 @@ Indicates x coordinate
392
520
 
393
521
  Indicates y coordinate
394
522
 
523
+ ## `Arrows` (object)
524
+
525
+ Properties of the `Arrows` object:
526
+
527
+ ### `left` (boolean, required)
528
+
529
+ Indicates if left arrow is enabled
530
+
531
+ ### `right` (boolean, required)
532
+
533
+ Indicates if right arrow is enabled
534
+
535
+ ### `up` (boolean, required)
536
+
537
+ Indicates if up arrow is enabled
538
+
539
+ ### `down` (boolean, required)
540
+
541
+ Indicates if down arrow is enabled
542
+
395
543
  ## `GraphSettings` (object)
396
544
 
397
545
  Properties of the `GraphSettings` object:
package/lib/index.js CHANGED
@@ -43,7 +43,7 @@ var _main = _interopRequireDefault(require("./main"));
43
43
 
44
44
  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); }; }
45
45
 
46
- 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; } }
46
+ 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; } }
47
47
 
48
48
  var Graphing = /*#__PURE__*/function (_HTMLElement) {
49
49
  (0, _inherits2["default"])(Graphing, _HTMLElement);
@@ -77,6 +77,9 @@ var Graphing = /*#__PURE__*/function (_HTMLElement) {
77
77
  }
78
78
  }, {
79
79
  key: "session",
80
+ get: function get() {
81
+ return this._session;
82
+ },
80
83
  set: function set(s) {
81
84
  this._session = s;
82
85
 
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["Graphing","answer","Array","isArray","length","_session","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_render","m","_model","s","el","React","createElement","Main","model","session","onAnswersChange","changeAnswers","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;IAIqBA,Q;;;;;AACnB,sBAAc;AAAA;;AAAA;AACZ;AADY,mGAkBD,UAAAC,MAAM;AAAA,aAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,KAAyBA,MAAM,CAACG,MAAP,GAAgB,CAA7C;AAAA,KAlBL;AAAA,sGAoBE,UAAAH,MAAM,EAAI;AACxB,YAAKI,QAAL,CAAcJ,MAAd,GAAuB,iCAAqBA,MAArB,CAAvB;;AAEA,YAAKK,aAAL,CACE,IAAIC,oCAAJ,CACE,MAAKC,OAAL,CAAaC,WAAb,EADF,EAEE,MAAKC,UAAL,CAAgB,MAAKL,QAAL,CAAcJ,MAA9B,CAFF,CADF;;AAOA,YAAKU,OAAL;AACD,KA/Ba;AAAA;AAEb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;;AACA,WAAKD,OAAL;AACD;;;SAED,aAAYG,CAAZ,EAAe;AACb,WAAKT,QAAL,GAAgBS,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WAED,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;WAiBD,mBAAU;AAAA;;AACR,UAAI,CAAC,KAAKE,MAAN,IAAgB,CAAC,KAAKR,QAA1B,EAAoC;AAClC;AACD;;AAED,UAAMU,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,QAAAA,KAAK,EAAE,KAAKN,MADuB;AAEnCO,QAAAA,OAAO,EAAE,KAAKf,QAFqB;AAGnCgB,QAAAA,eAAe,EAAE,KAAKC;AAHa,OAA1B,CAAX;;AAMAC,2BAASC,MAAT,CAAgBT,EAAhB,EAAoB,IAApB,EAA0B,YAAM;AAC9B,uCAAW,MAAX;AACD,OAFD;AAGD;;;kDAhDmCU,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport { removeInvalidAnswers } from './utils';\nimport Main from './main';\n\nexport { Main as Component };\n\nexport default class Graphing extends HTMLElement {\n constructor() {\n super();\n }\n\n set model(m) {\n this._model = m;\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n connectedCallback() {\n this._render();\n }\n\n isComplete = answer => Array.isArray(answer) && answer.length > 0;\n\n changeAnswers = answer => {\n this._session.answer = removeInvalidAnswers(answer);\n\n this.dispatchEvent(\n new SessionChangedEvent(\n this.tagName.toLowerCase(),\n this.isComplete(this._session.answer)\n )\n );\n\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 onAnswersChange: this.changeAnswers\n });\n\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["Graphing","answer","Array","isArray","length","_session","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_render","m","_model","s","el","React","createElement","Main","model","session","onAnswersChange","changeAnswers","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;IAIqBA,Q;;;;;AACnB,sBAAc;AAAA;;AAAA;AACZ;AADY,mGAsBD,UAAAC,MAAM;AAAA,aAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,KAAyBA,MAAM,CAACG,MAAP,GAAgB,CAA7C;AAAA,KAtBL;AAAA,sGAwBE,UAAAH,MAAM,EAAI;AACxB,YAAKI,QAAL,CAAcJ,MAAd,GAAuB,iCAAqBA,MAArB,CAAvB;;AAEA,YAAKK,aAAL,CACE,IAAIC,oCAAJ,CACE,MAAKC,OAAL,CAAaC,WAAb,EADF,EAEE,MAAKC,UAAL,CAAgB,MAAKL,QAAL,CAAcJ,MAA9B,CAFF,CADF;;AAOA,YAAKU,OAAL;AACD,KAnCa;AAAA;AAEb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;;AACA,WAAKD,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAKN,QAAZ;AACD,K;SAPD,aAAYS,CAAZ,EAAe;AACb,WAAKT,QAAL,GAAgBS,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WAMD,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;WAiBD,mBAAU;AAAA;;AACR,UAAI,CAAC,KAAKE,MAAN,IAAgB,CAAC,KAAKR,QAA1B,EAAoC;AAClC;AACD;;AAED,UAAMU,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,QAAAA,KAAK,EAAE,KAAKN,MADuB;AAEnCO,QAAAA,OAAO,EAAE,KAAKf,QAFqB;AAGnCgB,QAAAA,eAAe,EAAE,KAAKC;AAHa,OAA1B,CAAX;;AAMAC,2BAASC,MAAT,CAAgBT,EAAhB,EAAoB,IAApB,EAA0B,YAAM;AAC9B,uCAAW,MAAX;AACD,OAFD;AAGD;;;kDApDmCU,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport { removeInvalidAnswers } from './utils';\nimport Main from './main';\n\nexport { Main as Component };\n\nexport default class Graphing extends HTMLElement {\n constructor() {\n super();\n }\n\n set model(m) {\n this._model = m;\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 connectedCallback() {\n this._render();\n }\n\n isComplete = answer => Array.isArray(answer) && answer.length > 0;\n\n changeAnswers = answer => {\n this._session.answer = removeInvalidAnswers(answer);\n\n this.dispatchEvent(\n new SessionChangedEvent(\n this.tagName.toLowerCase(),\n this.isComplete(this._session.answer)\n )\n );\n\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 onAnswersChange: this.changeAnswers\n });\n\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n}\n"],"file":"index.js"}
package/lib/main.js CHANGED
@@ -33,13 +33,13 @@ var _renderUi = require("@pie-lib/render-ui");
33
33
 
34
34
  var _correctAnswerToggle = _interopRequireDefault(require("@pie-lib/correct-answer-toggle"));
35
35
 
36
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
36
+ 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; }
37
37
 
38
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
38
+ 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; }
39
39
 
40
40
  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); }; }
41
41
 
42
- 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; } }
42
+ 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; } }
43
43
 
44
44
  var Main = /*#__PURE__*/function (_React$Component) {
45
45
  (0, _inherits2["default"])(Main, _React$Component);
@@ -84,6 +84,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
84
84
  answersCorrected = _ref2.answersCorrected,
85
85
  arrows = _ref2.arrows,
86
86
  backgroundMarks = _ref2.backgroundMarks,
87
+ coordinatesOnHover = _ref2.coordinatesOnHover,
87
88
  correctResponse = _ref2.correctResponse,
88
89
  disabled = _ref2.disabled,
89
90
  domain = _ref2.domain,
@@ -109,6 +110,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
109
110
  includeArrows: arrows
110
111
  },
111
112
  backgroundMarks: backgroundMarks,
113
+ coordinatesOnHover: coordinatesOnHover,
112
114
  disabled: true,
113
115
  domain: domain,
114
116
  labels: labels,
@@ -127,20 +129,17 @@ var Main = /*#__PURE__*/function (_React$Component) {
127
129
  hidden: 'Show Teacher Instructions',
128
130
  visible: 'Hide Teacher Instructions'
129
131
  }
130
- }, /*#__PURE__*/_react["default"].createElement("div", {
131
- dangerouslySetInnerHTML: {
132
- __html: teacherInstructions
133
- }
134
- })), /*#__PURE__*/_react["default"].createElement("br", null)), prompt && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
135
- className: classes.prompt,
136
- dangerouslySetInnerHTML: {
137
- __html: prompt
138
- }
132
+ }, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
133
+ prompt: teacherInstructions
134
+ })), /*#__PURE__*/_react["default"].createElement("br", null)), prompt && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
135
+ className: "prompt",
136
+ prompt: prompt
139
137
  }), /*#__PURE__*/_react["default"].createElement("br", null)), /*#__PURE__*/_react["default"].createElement(_graphing.GraphContainer, {
140
138
  axesSettings: {
141
139
  includeArrows: arrows
142
140
  },
143
141
  backgroundMarks: backgroundMarks,
142
+ coordinatesOnHover: coordinatesOnHover,
144
143
  disabled: disabled,
145
144
  domain: domain,
146
145
  labels: labels,
@@ -155,10 +154,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
155
154
  hidden: 'Show Rationale',
156
155
  visible: 'Hide Rationale'
157
156
  }
158
- }, /*#__PURE__*/_react["default"].createElement("div", {
159
- dangerouslySetInnerHTML: {
160
- __html: rationale
161
- }
157
+ }, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
158
+ prompt: rationale
162
159
  })));
163
160
  }
164
161
  }]);
@@ -182,9 +179,6 @@ var styles = function styles(theme) {
182
179
  padding: theme.spacing.unit,
183
180
  color: _renderUi.color.text(),
184
181
  backgroundColor: _renderUi.color.background()
185
- },
186
- prompt: {
187
- verticalAlign: 'middle'
188
182
  }
189
183
  };
190
184
  };
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["Main","showingCorrect","setState","props","model","classes","onAnswersChange","session","state","answer","answersCorrected","arrows","backgroundMarks","correctResponse","disabled","domain","labels","prompt","range","rationale","size","showToggle","title","teacherInstructions","toolbarTools","marks","mainContainer","toggleCorrect","includeArrows","map","i","correctness","hidden","visible","__html","React","Component","PropTypes","object","isRequired","func","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","verticalAlign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,I;;;;;;;;;;;;;;;8FAYH;AAAEC,MAAAA,cAAc,EAAE;AAAlB,K;sGAEQ,UAAAA,cAAc;AAAA,aAAI,MAAKC,QAAL,CAAc;AAAED,QAAAA,cAAc,EAAdA;AAAF,OAAd,CAAJ;AAAA,K;;;;;;WAE9B,kBAAS;AAAA,wBAC8C,KAAKE,KADnD;AAAA,UACCC,KADD,eACCA,KADD;AAAA,UACQC,OADR,eACQA,OADR;AAAA,UACiBC,eADjB,eACiBA,eADjB;AAAA,UACkCC,OADlC,eACkCA,OADlC;AAAA,UAECN,cAFD,GAEoB,KAAKO,KAFzB,CAECP,cAFD;;AAAA,iBAGYM,OAAO,IAAI,EAHvB;AAAA,UAGCE,MAHD,QAGCA,MAHD;;AAAA,kBAoBHL,KAAK,IAAI,EApBN;AAAA,UAKLM,gBALK,SAKLA,gBALK;AAAA,UAMLC,MANK,SAMLA,MANK;AAAA,UAOLC,eAPK,SAOLA,eAPK;AAAA,UAQLC,eARK,SAQLA,eARK;AAAA,UASLC,QATK,SASLA,QATK;AAAA,UAULC,MAVK,SAULA,MAVK;AAAA,UAWLC,MAXK,SAWLA,MAXK;AAAA,UAYLC,MAZK,SAYLA,MAZK;AAAA,UAaLC,KAbK,SAaLA,KAbK;AAAA,UAcLC,SAdK,SAcLA,SAdK;AAAA,UAeLC,IAfK,SAeLA,IAfK;AAAA,UAgBLC,UAhBK,SAgBLA,UAhBK;AAAA,UAiBLC,KAjBK,SAiBLA,KAjBK;AAAA,UAkBLC,mBAlBK,SAkBLA,mBAlBK;AAAA,UAmBLC,YAnBK,SAmBLA,YAnBK;;AAsBP,UAAMC,K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eAAe,EAAEF,gBAAMG,UAAN;AAHJ,KADQ;AAMvBhC,IAAAA,MAAM,EAAE;AAAEiC,MAAAA,aAAa,EAAE;AAAjB;AANe,GAAL;AAAA,CAApB;;eASe,wBAAWT,MAAX,EAAmBzC,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { GraphContainer } from '@pie-lib/graphing';\nimport { color, Collapsible, hasText } from '@pie-lib/render-ui';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n model: PropTypes.object.isRequired,\n session: PropTypes.object.isRequired,\n onAnswersChange: PropTypes.func\n };\n\n static defaultProps = {\n classes: {}\n };\n\n state = { showingCorrect: false };\n\n toggleCorrect = showingCorrect => this.setState({ showingCorrect });\n\n render() {\n const { model, classes, onAnswersChange, session } = this.props;\n const { showingCorrect } = this.state;\n const { answer } = session || {};\n const {\n answersCorrected,\n arrows,\n backgroundMarks,\n correctResponse,\n disabled,\n domain,\n labels,\n prompt,\n range,\n rationale,\n size,\n showToggle,\n title,\n teacherInstructions,\n toolbarTools\n } = model || {};\n\n const marks = answersCorrected || answer || [];\n\n\n return (\n <div className={classes.mainContainer}>\n <CorrectAnswerToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n />\n\n {(showingCorrect && showToggle) && (\n <GraphContainer\n axesSettings={{ includeArrows: arrows }}\n backgroundMarks={backgroundMarks}\n disabled={true}\n domain={domain}\n labels={labels}\n marks={correctResponse.map(i => ({ ...i, correctness: 'correct' }))}\n onChangeMarks={onAnswersChange}\n range={range}\n size={size}\n title={title}\n toolbarTools={toolbarTools}\n />\n )}\n\n {\n teacherInstructions && hasText(teacherInstructions) && (\n <React.Fragment>\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n <div dangerouslySetInnerHTML={{ __html: teacherInstructions }}/>\n </Collapsible>\n <br />\n </React.Fragment>\n )\n }\n\n {prompt && (\n <React.Fragment>\n <div className={classes.prompt} dangerouslySetInnerHTML={{ __html: prompt }}/>\n <br />\n </React.Fragment>\n )}\n\n <GraphContainer\n axesSettings={{ includeArrows: arrows }}\n backgroundMarks={backgroundMarks}\n disabled={disabled}\n domain={domain}\n labels={labels}\n marks={marks}\n onChangeMarks={onAnswersChange}\n range={range}\n size={size}\n title={title}\n toolbarTools={toolbarTools}\n />\n\n <br />\n\n {\n rationale && hasText(rationale) && (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <div dangerouslySetInnerHTML={{ __html: rationale }}/>\n </Collapsible>\n )\n }\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background()\n },\n prompt: { verticalAlign: 'middle' }\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
1
+ {"version":3,"sources":["../src/main.jsx"],"names":["Main","showingCorrect","setState","props","model","classes","onAnswersChange","session","state","answer","answersCorrected","arrows","backgroundMarks","coordinatesOnHover","correctResponse","disabled","domain","labels","prompt","range","rationale","size","showToggle","title","teacherInstructions","toolbarTools","marks","mainContainer","toggleCorrect","includeArrows","map","i","correctness","hidden","visible","React","Component","PropTypes","object","isRequired","func","styles","theme","padding","spacing","unit","color","text","backgroundColor","background"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,I;;;;;;;;;;;;;;;8FAYH;AAAEC,MAAAA,cAAc,EAAE;AAAlB,K;sGAEQ,UAAAA,cAAc;AAAA,aAAI,MAAKC,QAAL,CAAc;AAAED,QAAAA,cAAc,EAAdA;AAAF,OAAd,CAAJ;AAAA,K;;;;;;WAE9B,kBAAS;AACP,wBAAqD,KAAKE,KAA1D;AAAA,UAAQC,KAAR,eAAQA,KAAR;AAAA,UAAeC,OAAf,eA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2CAzDF,EA4DIL,SAAS,IAAI,uBAAQA,SAAR,CAAb,iBACE,gCAAC,qBAAD;AAAa,QAAA,MAAM,EAAE;AAAEa,UAAAA,MAAM,EAAE,gBAAV;AAA4BC,UAAAA,OAAO,EAAE;AAArC;AAArB,sBACE,gCAAC,uBAAD;AAAe,QAAA,MAAM,EAAEd;AAAvB,QADF,CA7DN,CADF;AAqED;;;EA7GuBe,kBAAMC,S;;;iCAAnBpC,I,eACQ;AACjBK,EAAAA,OAAO,EAAEgC,sBAAUC,MADF;AAEjBlC,EAAAA,KAAK,EAAEiC,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBhC,EAAAA,OAAO,EAAE8B,sBAAUC,MAAV,CAAiBC,UAHT;AAIjBjC,EAAAA,eAAe,EAAE+B,sBAAUG;AAJV,C;iCADRxC,I,kBAQW;AACpBK,EAAAA,OAAO,EAAE;AADW,C;;AAwGxB,IAAMoC,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBf,IAAAA,aAAa,EAAE;AACbgB,MAAAA,OAAO,EAAED,KAAK,CAACE,OAAN,CAAcC,IADV;AAEbC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EAFM;AAGbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN;AAHJ;AADQ,GAAL;AAAA,CAApB;;eAQe,wBAAWR,MAAX,EAAmBzC,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { GraphContainer } from '@pie-lib/graphing';\nimport {color, Collapsible, hasText, PreviewPrompt} from '@pie-lib/render-ui';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n model: PropTypes.object.isRequired,\n session: PropTypes.object.isRequired,\n onAnswersChange: PropTypes.func\n };\n\n static defaultProps = {\n classes: {}\n };\n\n state = { showingCorrect: false };\n\n toggleCorrect = showingCorrect => this.setState({ showingCorrect });\n\n render() {\n const { model, classes, onAnswersChange, session } = this.props;\n const { showingCorrect } = this.state;\n const { answer } = session || {};\n const {\n answersCorrected,\n arrows,\n backgroundMarks,\n coordinatesOnHover,\n correctResponse,\n disabled,\n domain,\n labels,\n prompt,\n range,\n rationale,\n size,\n showToggle,\n title,\n teacherInstructions,\n toolbarTools\n } = model || {};\n const marks = answersCorrected || answer || [];\n\n return (\n <div className={classes.mainContainer}>\n <CorrectAnswerToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n />\n\n {(showingCorrect && showToggle) && (\n <GraphContainer\n axesSettings={{ includeArrows: arrows }}\n backgroundMarks={backgroundMarks}\n coordinatesOnHover={coordinatesOnHover}\n disabled={true}\n domain={domain}\n labels={labels}\n marks={correctResponse.map(i => ({ ...i, correctness: 'correct' }))}\n onChangeMarks={onAnswersChange}\n range={range}\n size={size}\n title={title}\n toolbarTools={toolbarTools}\n />\n )}\n\n {\n teacherInstructions && hasText(teacherInstructions) && (\n <React.Fragment>\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n <br />\n </React.Fragment>\n )\n }\n\n {prompt && (\n <React.Fragment>\n <PreviewPrompt className=\"prompt\" prompt={prompt} />\n <br />\n </React.Fragment>\n )}\n\n <GraphContainer\n axesSettings={{ includeArrows: arrows }}\n backgroundMarks={backgroundMarks}\n coordinatesOnHover={coordinatesOnHover}\n disabled={disabled}\n domain={domain}\n labels={labels}\n marks={marks}\n onChangeMarks={onAnswersChange}\n range={range}\n size={size}\n title={title}\n toolbarTools={toolbarTools}\n />\n\n <br />\n\n {\n rationale && hasText(rationale) && (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )\n }\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background()\n }\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
package/lib/utils.js CHANGED
@@ -9,6 +9,8 @@ exports.removeInvalidAnswers = void 0;
9
9
 
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
 
12
+ var _excluded = ["type"];
13
+
12
14
  var completePoint = function completePoint(point) {
13
15
  return point && Number.isFinite(point.x) && Number.isFinite(point.y);
14
16
  };
@@ -42,7 +44,7 @@ var completeMark = {
42
44
  var removeInvalidAnswers = function removeInvalidAnswers(answers) {
43
45
  return answers ? (answers || []).filter(function (_ref) {
44
46
  var type = _ref.type,
45
- answer = (0, _objectWithoutProperties2["default"])(_ref, ["type"]);
47
+ answer = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
46
48
  return completeMark[type] ? completeMark[type](answer) : false;
47
49
  }) : [];
48
50
  };
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils.js"],"names":["completePoint","point","Number","isFinite","x","y","completeFromTo","item","completeMark","from","to","completeRootEdge","edge","root","completePoints","points","length","filter","line","ray","segment","vector","circle","parabola","sine","polygon","removeInvalidAnswers","answers","type","answer"],"mappings":";;;;;;;;;;;AAAA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAAAC,KAAK;AAAA,SAAKA,KAAK,IAAIC,MAAM,CAACC,QAAP,CAAgBF,KAAK,CAACG,CAAtB,CAAT,IAAqCF,MAAM,CAACC,QAAP,CAAgBF,KAAK,CAACI,CAAtB,CAA1C;AAAA,CAA3B;;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAAAC,IAAI;AAAA,SAAIA,IAAI,IAAIC,YAAY,CAACP,KAAb,CAAmBM,IAAI,CAACE,IAAxB,CAAR,IAAyCD,YAAY,CAACP,KAAb,CAAmBM,IAAI,CAACG,EAAxB,CAA7C;AAAA,CAA3B;;AACA,IAAMC,gBAAgB,GAAG,S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= point => (point && Number.isFinite(point.x) && Number.isFinite(point.y));\nconst completeFromTo = item => item && completeMark.point(item.from) && completeMark.point(item.to);\nconst completeRootEdge = item => item && completeMark.point(item.edge) && completeMark.point(item.root);\nconst completePoints = item => item && item.points && item.points.length &&\n (item.points.filter(point => completePoint(point)) || []).length === item.points.length;\n\nconst completeMark = {\n point: completePoint,\n line: completeFromTo,\n ray: completeFromTo,\n segment: completeFromTo,\n vector: completeFromTo,\n circle: completeRootEdge,\n parabola: completeRootEdge,\n sine: completeRootEdge,\n polygon: completePoints,\n};\n\nexport const removeInvalidAnswers = answers => answers\n ? (answers || []).filter(({ type, ...answer}) => completeMark[type] ? completeMark[type](answer) : false)\n : [];\n"],"file":"utils.js"}
1
+ {"version":3,"sources":["../src/utils.js"],"names":["completePoint","point","Number","isFinite","x","y","completeFromTo","item","completeMark","from","to","completeRootEdge","edge","root","completePoints","points","length","filter","line","ray","segment","vector","circle","parabola","sine","polygon","removeInvalidAnswers","answers","type","answer"],"mappings":";;;;;;;;;;;;;AAAA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAAAC,KAAK;AAAA,SAAKA,KAAK,IAAIC,MAAM,CAACC,QAAP,CAAgBF,KAAK,CAACG,CAAtB,CAAT,IAAqCF,MAAM,CAACC,QAAP,CAAgBF,KAAK,CAACI,CAAtB,CAA1C;AAAA,CAA3B;;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAAAC,IAAI;AAAA,SAAIA,IAAI,IAAIC,YAAY,CAACP,KAAb,CAAmBM,IAAI,CAACE,IAAxB,CAAR,IAAyCD,YAAY,CAACP,KAAb,CAAmBM,IAAI,CAACG,EAAxB,CAA7C;AAAA,CAA3B;;AACA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAAAJ,IAAI;AAAA,SAAIA,IAAI,IAAIC,YAAY,CAACP,KAAb,CAAmBM,IAAI,CAACK,IAAxB,CAAR,IAAyCJ,YAAY,CAACP,KAAb,CAAmBM,IAAI,CAACM,IAAxB,CAA7C;AAAA,CAA7B;;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAAAP,IAAI;AAAA,SAAIA,IAAI,IAAIA,IAAI,CAACQ,MAAb,IAAuBR,IAAI,CAACQ,MAAL,CAAYC,MAAnC,IAC7B,CAACT,IAAI,CAACQ,MAAL,CAAYE,MAAZ,CAAmB,UAAAhB,KAAK;AAAA,WAAID,aAAa,CAACC,KAAD,CAAjB;AAAA,GAAxB,KAAqD,EAAtD,EAA0De,MAA1D,KAAqET,IAAI,CAACQ,MAAL,CAAYC,MADxD;AAAA,CAA3B;;AAGA,IAAMR,YAAY,GAAG;AACnBP,EAAAA,KAAK,EAAED,aADY;AAEnBkB,EAAAA,IAAI,EAAEZ,cAFa;AAGnBa,EAAAA,GAAG,EAAEb,cAHc;AAInBc,EAAAA,OAAO,EAAEd,cAJU;AAKnBe,EAAAA,MAAM,EAAEf,cALW;AAMnBgB,EAAAA,MAAM,EAAEX,gBANW;AAOnBY,EAAAA,QAAQ,EAAEZ,gBAPS;AAQnBa,EAAAA,IAAI,EAAEb,gBARa;AASnBc,EAAAA,OAAO,EAAEX;AATU,CAArB;;AAYO,IAAMY,oBAAoB,GAAG,SAAvBA,oBAAuB,CAAAC,OAAO;AAAA,SAAIA,OAAO,GAClD,CAACA,OAAO,IAAI,EAAZ,EAAgBV,MAAhB,CAAuB;AAAA,QAAGW,IAAH,QAAGA,IAAH;AAAA,QAAYC,MAAZ;AAAA,WAAwBrB,YAAY,CAACoB,IAAD,CAAZ,GAAqBpB,YAAY,CAACoB,IAAD,CAAZ,CAAmBC,MAAnB,CAArB,GAAkD,KAA1E;AAAA,GAAvB,CADkD,GAElD,EAFuC;AAAA,CAApC","sourcesContent":["const completePoint = point => (point && Number.isFinite(point.x) && Number.isFinite(point.y));\nconst completeFromTo = item => item && completeMark.point(item.from) && completeMark.point(item.to);\nconst completeRootEdge = item => item && completeMark.point(item.edge) && completeMark.point(item.root);\nconst completePoints = item => item && item.points && item.points.length &&\n (item.points.filter(point => completePoint(point)) || []).length === item.points.length;\n\nconst completeMark = {\n point: completePoint,\n line: completeFromTo,\n ray: completeFromTo,\n segment: completeFromTo,\n vector: completeFromTo,\n circle: completeRootEdge,\n parabola: completeRootEdge,\n sine: completeRootEdge,\n polygon: completePoints,\n};\n\nexport const removeInvalidAnswers = answers => answers\n ? (answers || []).filter(({ type, ...answer}) => completeMark[type] ? completeMark[type](answer) : false)\n : [];\n"],"file":"utils.js"}