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

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 +287 -54
  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 +160 -184
  10. package/configure/lib/graphing-config.js.map +1 -1
  11. package/configure/lib/index.js +43 -18
  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 +48 -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 +8 -1
  27. package/docs/pie-schema.json +228 -3
  28. package/docs/pie-schema.json.md +166 -2
  29. package/lib/index.js +4 -1
  30. package/lib/index.js.map +1 -1
  31. package/lib/main.js +15 -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
@@ -105,7 +105,12 @@ exports.model = (id, element) => ({
105
105
  }]
106
106
  }
107
107
  },
108
- arrows: true,
108
+ arrows: {
109
+ left: true,
110
+ right: true,
111
+ up: true,
112
+ down: true
113
+ },
109
114
  backgroundMarks: [
110
115
  {
111
116
  type: 'point',
@@ -123,10 +128,12 @@ exports.model = (id, element) => ({
123
128
  labelStep: 1,
124
129
  axisLabel: 'x'
125
130
  },
131
+ defaultTool: 'point',
126
132
  graph: {
127
133
  width: 480,
128
134
  height: 480
129
135
  },
136
+ coordinatesOnHover: false,
130
137
  labels: { top: 'top', left: 'left', bottom: 'bottom', right: 'right' },
131
138
  padding: true,
132
139
  prompt: 'Here goes item stem !!!!!!',
@@ -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,27 @@
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
+ },
1488
+ "defaultTool": {
1489
+ "description": "Indicates the default selected tool for the graph",
1490
+ "enum": [
1491
+ "circle",
1492
+ "line",
1493
+ "parabola",
1494
+ "point",
1495
+ "polygon",
1496
+ "ray",
1497
+ "segment",
1498
+ "sine",
1499
+ "vector"
1500
+ ],
1501
+ "type": "string",
1502
+ "title": "defaultTool"
1503
+ },
1456
1504
  "domain": {
1457
1505
  "title": "GraphSettings",
1458
1506
  "type": "object",
@@ -1517,6 +1565,11 @@
1517
1565
  "width"
1518
1566
  ]
1519
1567
  },
1568
+ "includeAxes": {
1569
+ "description": "Indicates if the graph axes and labels are enabled",
1570
+ "type": "boolean",
1571
+ "title": "includeAxes"
1572
+ },
1520
1573
  "labels": {
1521
1574
  "title": "Labels",
1522
1575
  "type": "object",
@@ -1684,6 +1737,16 @@
1684
1737
  "type": "boolean",
1685
1738
  "title": "rationaleEnabled"
1686
1739
  },
1740
+ "spellCheckEnabled": {
1741
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
1742
+ "type": "boolean",
1743
+ "title": "spellCheckEnabled"
1744
+ },
1745
+ "standardGrid": {
1746
+ "description": "Indicates if some domain values will be synched to the range values",
1747
+ "type": "boolean",
1748
+ "title": "standardGrid"
1749
+ },
1687
1750
  "studentInstructionsEnabled": {
1688
1751
  "description": "Indicates if Student Instructions are enabled",
1689
1752
  "type": "boolean",
@@ -1708,12 +1771,14 @@
1708
1771
  "required": [
1709
1772
  "answers",
1710
1773
  "backgroundMarks",
1774
+ "defaultTool",
1711
1775
  "domain",
1712
1776
  "element",
1713
1777
  "graph",
1714
1778
  "id",
1715
1779
  "range",
1716
1780
  "rationaleEnabled",
1781
+ "spellCheckEnabled",
1717
1782
  "studentInstructionsEnabled",
1718
1783
  "teacherInstructionsEnabled"
1719
1784
  ],
@@ -1739,6 +1804,77 @@
1739
1804
  }
1740
1805
  }
1741
1806
  },
1807
+ "ArrowsConfigProp": {
1808
+ "title": "ArrowsConfigProp",
1809
+ "type": "object",
1810
+ "properties": {
1811
+ "settings": {
1812
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
1813
+ "type": "boolean",
1814
+ "title": "settings"
1815
+ },
1816
+ "label": {
1817
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
1818
+ "type": "string",
1819
+ "title": "label"
1820
+ },
1821
+ "left": {
1822
+ "title": "ArrowsProp",
1823
+ "type": "object",
1824
+ "properties": {
1825
+ "label": {
1826
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1827
+ "type": "string",
1828
+ "title": "label"
1829
+ }
1830
+ }
1831
+ },
1832
+ "right": {
1833
+ "title": "ArrowsProp",
1834
+ "type": "object",
1835
+ "properties": {
1836
+ "label": {
1837
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1838
+ "type": "string",
1839
+ "title": "label"
1840
+ }
1841
+ }
1842
+ },
1843
+ "up": {
1844
+ "title": "ArrowsProp",
1845
+ "type": "object",
1846
+ "properties": {
1847
+ "label": {
1848
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1849
+ "type": "string",
1850
+ "title": "label"
1851
+ }
1852
+ }
1853
+ },
1854
+ "down": {
1855
+ "title": "ArrowsProp",
1856
+ "type": "object",
1857
+ "properties": {
1858
+ "label": {
1859
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1860
+ "type": "string",
1861
+ "title": "label"
1862
+ }
1863
+ }
1864
+ }
1865
+ }
1866
+ },
1867
+ "ArrowsProp": {
1868
+ "title": "ArrowsProp",
1869
+ "type": "object",
1870
+ "properties": {
1871
+ "label": {
1872
+ "description": "Indicates the label for the arrow that has to be displayed in the Settings Panel",
1873
+ "type": "string",
1874
+ "title": "label"
1875
+ }
1876
+ }
1877
+ },
1742
1878
  "ConfigureProp": {
1743
1879
  "title": "ConfigureProp",
1744
1880
  "type": "object",
@@ -1755,6 +1891,63 @@
1755
1891
  }
1756
1892
  }
1757
1893
  },
1894
+ "DimensionsConfigProp": {
1895
+ "title": "DimensionsConfigProp",
1896
+ "type": "object",
1897
+ "properties": {
1898
+ "settings": {
1899
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
1900
+ "type": "boolean",
1901
+ "title": "settings"
1902
+ },
1903
+ "label": {
1904
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
1905
+ "type": "string",
1906
+ "title": "label"
1907
+ },
1908
+ "enabled": {
1909
+ "description": "Indicates if the graph dimensions are included in the Grid Setup Panel",
1910
+ "type": "boolean",
1911
+ "title": "enabled"
1912
+ },
1913
+ "min": {
1914
+ "description": "Indicates the minimum value for the graph width and height",
1915
+ "type": "number",
1916
+ "title": "min"
1917
+ },
1918
+ "max": {
1919
+ "description": "Indicates the maximum value for the graph width and height",
1920
+ "type": "number",
1921
+ "title": "max"
1922
+ },
1923
+ "step": {
1924
+ "description": "Indicates the increase/decrease value for the graph width and height",
1925
+ "type": "number",
1926
+ "title": "step"
1927
+ }
1928
+ }
1929
+ },
1930
+ "ConfigureMaxImageDimensionsProp": {
1931
+ "title": "ConfigureMaxImageDimensionsProp",
1932
+ "type": "object",
1933
+ "properties": {
1934
+ "teacherInstructions": {
1935
+ "description": "Indicates the max dimension for images in teacher instructions",
1936
+ "type": "number",
1937
+ "title": "teacherInstructions"
1938
+ },
1939
+ "prompt": {
1940
+ "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",
1941
+ "type": "number",
1942
+ "title": "prompt"
1943
+ },
1944
+ "rationale": {
1945
+ "description": "Indicates the max dimension for images in rationale",
1946
+ "type": "number",
1947
+ "title": "rationale"
1948
+ }
1949
+ }
1950
+ },
1758
1951
  "Answer": {
1759
1952
  "title": "Answer",
1760
1953
  "type": "object",
@@ -2486,6 +2679,38 @@
2486
2679
  "y"
2487
2680
  ]
2488
2681
  },
2682
+ "Arrows": {
2683
+ "title": "Arrows",
2684
+ "type": "object",
2685
+ "properties": {
2686
+ "left": {
2687
+ "description": "Indicates if left arrow is enabled",
2688
+ "type": "boolean",
2689
+ "title": "left"
2690
+ },
2691
+ "right": {
2692
+ "description": "Indicates if right arrow is enabled",
2693
+ "type": "boolean",
2694
+ "title": "right"
2695
+ },
2696
+ "up": {
2697
+ "description": "Indicates if up arrow is enabled",
2698
+ "type": "boolean",
2699
+ "title": "up"
2700
+ },
2701
+ "down": {
2702
+ "description": "Indicates if down arrow is enabled",
2703
+ "type": "boolean",
2704
+ "title": "down"
2705
+ }
2706
+ },
2707
+ "required": [
2708
+ "down",
2709
+ "left",
2710
+ "right",
2711
+ "up"
2712
+ ]
2713
+ },
2489
2714
  "GraphSettings": {
2490
2715
  "title": "GraphSettings",
2491
2716
  "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,26 @@ 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
+
75
+ # `defaultTool` (string, enum, required)
76
+
77
+ Indicates the default selected tool for the graph
78
+
79
+ This element must be one of the following enum values:
80
+
81
+ * `circle`
82
+ * `line`
83
+ * `parabola`
84
+ * `point`
85
+ * `polygon`
86
+ * `ray`
87
+ * `segment`
88
+ * `sine`
89
+ * `vector`
90
+
55
91
  # `domain` (object, required)
56
92
 
57
93
  Properties of the `domain` object:
@@ -92,6 +128,10 @@ Width for graph representation
92
128
 
93
129
  Height for graph representation
94
130
 
131
+ # `includeAxes` (boolean)
132
+
133
+ Indicates if the graph axes and labels are enabled
134
+
95
135
  # `labels` (object)
96
136
 
97
137
  Properties of the `labels` object:
@@ -189,6 +229,14 @@ Additional restrictions:
189
229
 
190
230
  Indicates if Rationale are enabled
191
231
 
232
+ # `spellCheckEnabled` (boolean, required)
233
+
234
+ Indicates if spellcheck is enabled for the author. Default value is true
235
+
236
+ # `standardGrid` (boolean)
237
+
238
+ Indicates if some domain values will be synched to the range values
239
+
192
240
  # `studentInstructionsEnabled` (boolean, required)
193
241
 
194
242
  Indicates if Student Instructions are enabled
@@ -228,6 +276,58 @@ Indicates the label for the item that has to be displayed in the Settings Panel
228
276
  Indicates the value of the item if it affects config-ui
229
277
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
230
278
 
279
+ ## `ArrowsConfigProp` (object)
280
+
281
+ Properties of the `ArrowsConfigProp` object:
282
+
283
+ ### `settings` (boolean)
284
+
285
+ Indicates if the item has to be displayed in the Settings Panel
286
+
287
+ ### `label` (string)
288
+
289
+ Indicates the label for the item that has to be displayed in the Settings Panel
290
+
291
+ ### `left` (object)
292
+
293
+ Properties of the `left` object:
294
+
295
+ #### `label` (string)
296
+
297
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
298
+
299
+ ### `right` (object)
300
+
301
+ Properties of the `right` object:
302
+
303
+ #### `label` (string)
304
+
305
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
306
+
307
+ ### `up` (object)
308
+
309
+ Properties of the `up` object:
310
+
311
+ #### `label` (string)
312
+
313
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
314
+
315
+ ### `down` (object)
316
+
317
+ Properties of the `down` object:
318
+
319
+ #### `label` (string)
320
+
321
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
322
+
323
+ ## `ArrowsProp` (object)
324
+
325
+ Properties of the `ArrowsProp` object:
326
+
327
+ ### `label` (string)
328
+
329
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
330
+
231
331
  ## `ConfigureProp` (object)
232
332
 
233
333
  Properties of the `ConfigureProp` object:
@@ -240,6 +340,50 @@ Indicates if the item has to be displayed in the Settings Panel
240
340
 
241
341
  Indicates the label for the item that has to be displayed in the Settings Panel
242
342
 
343
+ ## `DimensionsConfigProp` (object)
344
+
345
+ Properties of the `DimensionsConfigProp` object:
346
+
347
+ ### `settings` (boolean)
348
+
349
+ Indicates if the item has to be displayed in the Settings Panel
350
+
351
+ ### `label` (string)
352
+
353
+ Indicates the label for the item that has to be displayed in the Settings Panel
354
+
355
+ ### `enabled` (boolean)
356
+
357
+ Indicates if the graph dimensions are included in the Grid Setup Panel
358
+
359
+ ### `min` (number)
360
+
361
+ Indicates the minimum value for the graph width and height
362
+
363
+ ### `max` (number)
364
+
365
+ Indicates the maximum value for the graph width and height
366
+
367
+ ### `step` (number)
368
+
369
+ Indicates the increase/decrease value for the graph width and height
370
+
371
+ ## `ConfigureMaxImageDimensionsProp` (object)
372
+
373
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
374
+
375
+ ### `teacherInstructions` (number)
376
+
377
+ Indicates the max dimension for images in teacher instructions
378
+
379
+ ### `prompt` (number)
380
+
381
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
382
+
383
+ ### `rationale` (number)
384
+
385
+ Indicates the max dimension for images in rationale
386
+
243
387
  ## `Answer` (object)
244
388
 
245
389
  Properties of the `Answer` object:
@@ -392,6 +536,26 @@ Indicates x coordinate
392
536
 
393
537
  Indicates y coordinate
394
538
 
539
+ ## `Arrows` (object)
540
+
541
+ Properties of the `Arrows` object:
542
+
543
+ ### `left` (boolean, required)
544
+
545
+ Indicates if left arrow is enabled
546
+
547
+ ### `right` (boolean, required)
548
+
549
+ Indicates if right arrow is enabled
550
+
551
+ ### `up` (boolean, required)
552
+
553
+ Indicates if up arrow is enabled
554
+
555
+ ### `down` (boolean, required)
556
+
557
+ Indicates if down arrow is enabled
558
+
395
559
  ## `GraphSettings` (object)
396
560
 
397
561
  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,7 +84,9 @@ 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,
89
+ defaultTool = _ref2.defaultTool,
88
90
  disabled = _ref2.disabled,
89
91
  domain = _ref2.domain,
90
92
  labels = _ref2.labels,
@@ -109,6 +111,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
109
111
  includeArrows: arrows
110
112
  },
111
113
  backgroundMarks: backgroundMarks,
114
+ coordinatesOnHover: coordinatesOnHover,
112
115
  disabled: true,
113
116
  domain: domain,
114
117
  labels: labels,
@@ -127,20 +130,18 @@ var Main = /*#__PURE__*/function (_React$Component) {
127
130
  hidden: 'Show Teacher Instructions',
128
131
  visible: 'Hide Teacher Instructions'
129
132
  }
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
- }
133
+ }, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
134
+ prompt: teacherInstructions
135
+ })), /*#__PURE__*/_react["default"].createElement("br", null)), prompt && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
136
+ className: "prompt",
137
+ prompt: prompt
139
138
  }), /*#__PURE__*/_react["default"].createElement("br", null)), /*#__PURE__*/_react["default"].createElement(_graphing.GraphContainer, {
140
139
  axesSettings: {
141
140
  includeArrows: arrows
142
141
  },
143
142
  backgroundMarks: backgroundMarks,
143
+ coordinatesOnHover: coordinatesOnHover,
144
+ defaultTool: defaultTool,
144
145
  disabled: disabled,
145
146
  domain: domain,
146
147
  labels: labels,
@@ -155,10 +156,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
155
156
  hidden: 'Show Rationale',
156
157
  visible: 'Hide Rationale'
157
158
  }
158
- }, /*#__PURE__*/_react["default"].createElement("div", {
159
- dangerouslySetInnerHTML: {
160
- __html: rationale
161
- }
159
+ }, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
160
+ prompt: rationale
162
161
  })));
163
162
  }
164
163
  }]);
@@ -182,9 +181,6 @@ var styles = function styles(theme) {
182
181
  padding: theme.spacing.unit,
183
182
  color: _renderUi.color.text(),
184
183
  backgroundColor: _renderUi.color.background()
185
- },
186
- prompt: {
187
- verticalAlign: 'middle'
188
184
  }
189
185
  };
190
186
  };