@pie-element/graphing-solution-set 1.1.3-next.5 → 1.2.0

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.
@@ -1,4 +1,4 @@
1
- Model Object for
1
+ Model Object for @pie-elements/graphing-solution-set
2
2
 
3
3
  The schema defines the following properties:
4
4
 
@@ -46,6 +46,8 @@ Indicates if down arrow is enabled
46
46
 
47
47
  # `defaultGridConfiguration` (object, required)
48
48
 
49
+ An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.
50
+
49
51
  # `coordinatesOnHover` (boolean)
50
52
 
51
53
  Indicates if coordinates of a point are displayed on hover
@@ -215,10 +217,14 @@ Axis Label
215
217
 
216
218
  Indicates rationale for the answer
217
219
 
218
- # `scoringType` (string)
220
+ # `scoringType` (string, enum)
219
221
 
220
222
  Indicates scoring type
221
223
 
224
+ This element must be one of the following enum values:
225
+
226
+ * `dichotomous`
227
+
222
228
  # `studentInstructions` (string)
223
229
 
224
230
  Indicates student instructions
@@ -281,85 +287,325 @@ The html Element tag name
281
287
 
282
288
  The schema defines the following additional types:
283
289
 
284
- ## `Answer` (object)
290
+ ## `AuthoringConfigProp` (object)
285
291
 
286
- Properties of the `Answer` object:
292
+ Properties of the `AuthoringConfigProp` object:
287
293
 
288
- ### `name` (string, required)
294
+ ### `settings` (boolean)
289
295
 
290
- Indicates name of answer
296
+ Indicates if the item is displayed in the Settings Panel
291
297
 
292
- ### `marks` (array, required)
298
+ ### `label` (string)
293
299
 
294
- Indicates marks for the answer
300
+ Indicates the label for the item that is displayed in the Settings Panel
295
301
 
296
- Additional restrictions:
302
+ ### `enabled` (boolean)
297
303
 
298
- * Minimum items: `1`
304
+ Indicates if the Grid Setup Panel is displayed
299
305
 
300
- ## `Mark` (object)
306
+ ### `includeAxesEnabled` (boolean)
301
307
 
302
- Properties of the `Mark` object:
308
+ Indicates if the "includeAxes" toggle is displayed in the Grid Setup Panel
303
309
 
304
- ### `type` (string, required)
310
+ ### `standardGridEnabled` (boolean)
305
311
 
306
- Indicates type of mark
312
+ Indicates if the "standardGrid" toggle is displayed in the Grid Setup Panel
307
313
 
308
- ### `showLabel` (boolean)
314
+ ### `min` (object)
309
315
 
310
- Indicates if label should be visible
316
+ Properties of the `min` object:
317
+
318
+ #### `label` (string)
319
+
320
+ Indicates the label for the item that is displayed in the Grid Setup Panel
321
+
322
+ #### `enabled` (boolean)
323
+
324
+ Indicates if the item is displayed in the Grid Setup Panel
325
+
326
+ ### `max` (object)
327
+
328
+ Properties of the `max` object:
329
+
330
+ #### `label` (string)
331
+
332
+ Indicates the label for the item that is displayed in the Grid Setup Panel
333
+
334
+ #### `enabled` (boolean)
335
+
336
+ Indicates if the item is displayed in the Grid Setup Panel
337
+
338
+ ### `axisLabel` (object)
339
+
340
+ Properties of the `axisLabel` object:
341
+
342
+ #### `label` (string)
343
+
344
+ Indicates the label for the item that is displayed in the Grid Setup Panel
345
+
346
+ #### `enabled` (boolean)
347
+
348
+ Indicates if the item is displayed in the Grid Setup Panel
349
+
350
+ ### `step` (object)
351
+
352
+ Properties of the `step` object:
353
+
354
+ #### `label` (string)
355
+
356
+ Indicates the label for the item that is displayed in the Grid Setup Panel
357
+
358
+ #### `enabled` (boolean)
359
+
360
+ Indicates if the item is displayed in the Grid Setup Panel
361
+
362
+ ### `labelStep` (object)
363
+
364
+ Properties of the `labelStep` object:
365
+
366
+ #### `label` (string)
367
+
368
+ Indicates the label for the item that is displayed in the Grid Setup Panel
369
+
370
+ #### `enabled` (boolean)
371
+
372
+ Indicates if the item is displayed in the Grid Setup Panel
373
+
374
+ ## `GridPanelConfigProp` (object)
375
+
376
+ Properties of the `GridPanelConfigProp` object:
311
377
 
312
378
  ### `label` (string)
313
379
 
314
- Indicates label value for mark
380
+ Indicates the label for the item that is displayed in the Grid Setup Panel
315
381
 
316
- ### `building` (boolean, required)
382
+ ### `enabled` (boolean)
317
383
 
318
- Indicates if mark is in build process
384
+ Indicates if the item is displayed in the Grid Setup Panel
319
385
 
320
- ### `x` (number)
386
+ ## `ArrowsConfigProp` (object)
321
387
 
322
- Indicates x coordinate if type is point
388
+ Properties of the `ArrowsConfigProp` object:
323
389
 
324
- ### `y` (number)
390
+ ### `settings` (boolean)
325
391
 
326
- Indicates y coordinate if type is point
392
+ Indicates if the item has to be displayed in the Settings Panel
327
393
 
328
- ### `from` (object)
394
+ ### `label` (string)
329
395
 
330
- Properties of the `from` object:
396
+ Indicates the label for the item that has to be displayed in the Settings Panel
331
397
 
332
- #### `x` (number, required)
398
+ ### `left` (object)
333
399
 
334
- Indicates x coordinate
400
+ Properties of the `left` object:
335
401
 
336
- #### `y` (number, required)
402
+ #### `label` (string)
337
403
 
338
- Indicates y coordinate
404
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
339
405
 
340
- ### `to` (object)
406
+ ### `right` (object)
341
407
 
342
- Properties of the `to` object:
408
+ Properties of the `right` object:
343
409
 
344
- #### `x` (number, required)
410
+ #### `label` (string)
345
411
 
346
- Indicates x coordinate
412
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
347
413
 
348
- #### `y` (number, required)
414
+ ### `up` (object)
349
415
 
350
- Indicates y coordinate
416
+ Properties of the `up` object:
351
417
 
352
- ## `Point` (object)
418
+ #### `label` (string)
353
419
 
354
- Properties of the `Point` object:
420
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
355
421
 
356
- ### `x` (number, required)
422
+ ### `down` (object)
357
423
 
358
- Indicates x coordinate
424
+ Properties of the `down` object:
359
425
 
360
- ### `y` (number, required)
426
+ #### `label` (string)
361
427
 
362
- Indicates y coordinate
428
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
429
+
430
+ ## `ArrowsProp` (object)
431
+
432
+ Properties of the `ArrowsProp` object:
433
+
434
+ ### `label` (string)
435
+
436
+ Indicates the label for the arrow that has to be displayed in the Settings Panel
437
+
438
+ ## `ConfigureProp` (object)
439
+
440
+ Properties of the `ConfigureProp` object:
441
+
442
+ ### `settings` (boolean)
443
+
444
+ Indicates if the item has to be displayed in the Settings Panel
445
+
446
+ ### `label` (string)
447
+
448
+ Indicates the label for the item that has to be displayed in the Settings Panel
449
+
450
+ ## `DimensionsConfigProp` (object)
451
+
452
+ Properties of the `DimensionsConfigProp` object:
453
+
454
+ ### `settings` (boolean)
455
+
456
+ Indicates if the item has to be displayed in the Settings Panel
457
+
458
+ ### `label` (string)
459
+
460
+ Indicates the label for the item that has to be displayed in the Settings Panel
461
+
462
+ ### `enabled` (boolean)
463
+
464
+ Indicates if the graph dimensions are included in the Grid Setup Panel
465
+
466
+ ### `min` (number)
467
+
468
+ Indicates the minimum value for the graph width and height
469
+
470
+ ### `max` (number)
471
+
472
+ Indicates the maximum value for the graph width and height
473
+
474
+ ### `step` (number)
475
+
476
+ Indicates the increase/decrease value for the graph width and height
477
+
478
+ ## `GridConfigurationsProp` (object)
479
+
480
+ Properties of the `GridConfigurationsProp` object:
481
+
482
+ ### `label` (string)
483
+
484
+ Indicates the label for the configuration
485
+
486
+ ### `arrows` (object)
487
+
488
+ Properties of the `arrows` object:
489
+
490
+ #### `left` (boolean, required)
491
+
492
+ Indicates if left arrow is enabled
493
+
494
+ #### `right` (boolean, required)
495
+
496
+ Indicates if right arrow is enabled
497
+
498
+ #### `up` (boolean, required)
499
+
500
+ Indicates if up arrow is enabled
501
+
502
+ #### `down` (boolean, required)
503
+
504
+ Indicates if down arrow is enabled
505
+
506
+ ### `domain` (object, required)
507
+
508
+ Properties of the `domain` object:
509
+
510
+ #### `min` (number, required)
511
+
512
+ Min value
513
+
514
+ #### `max` (number, required)
515
+
516
+ Max value
517
+
518
+ #### `padding` (number, required)
519
+
520
+ Padding value
521
+
522
+ #### `step` (number, required)
523
+
524
+ Step value
525
+
526
+ #### `labelStep` (number, required)
527
+
528
+ Label step value
529
+
530
+ #### `axisLabel` (string, required)
531
+
532
+ Axis Label
533
+
534
+ ### `graph` (object, required)
535
+
536
+ Properties of the `graph` object:
537
+
538
+ #### `width` (number, required)
539
+
540
+ Width for graph representation
541
+
542
+ #### `height` (number, required)
543
+
544
+ Height for graph representation
545
+
546
+ ### `includeAxes` (boolean)
547
+
548
+ Indicates if the graph axes and labels are enabled
549
+
550
+ ### `labels` (object)
551
+
552
+ Properties of the `labels` object:
553
+
554
+ #### `top` (string, required)
555
+
556
+ Label for top side of the graph
557
+
558
+ #### `bottom` (string, required)
559
+
560
+ Label for bottom side of the graph
561
+
562
+ #### `left` (string, required)
563
+
564
+ Label for left side of the graph
565
+
566
+ #### `right` (string, required)
567
+
568
+ Label for right side of the graph
569
+
570
+ ### `padding` (boolean)
571
+
572
+ Indicates if padding is enabled
573
+
574
+ ### `range` (object, required)
575
+
576
+ Properties of the `range` object:
577
+
578
+ #### `min` (number, required)
579
+
580
+ Min value
581
+
582
+ #### `max` (number, required)
583
+
584
+ Max value
585
+
586
+ #### `padding` (number, required)
587
+
588
+ Padding value
589
+
590
+ #### `step` (number, required)
591
+
592
+ Step value
593
+
594
+ #### `labelStep` (number, required)
595
+
596
+ Label step value
597
+
598
+ #### `axisLabel` (string, required)
599
+
600
+ Axis Label
601
+
602
+ ### `standardGrid` (boolean)
603
+
604
+ Indicates if some domain values will be synched to the range values
605
+
606
+ ### `title` (string)
607
+
608
+ Indicates graph title
363
609
 
364
610
  ## `Arrows` (object)
365
611
 
@@ -381,8 +627,6 @@ Indicates if up arrow is enabled
381
627
 
382
628
  Indicates if down arrow is enabled
383
629
 
384
- ## `Number` (object)
385
-
386
630
  ## `GraphSettings` (object)
387
631
 
388
632
  Properties of the `GraphSettings` object:
@@ -423,6 +667,225 @@ Width for graph representation
423
667
 
424
668
  Height for graph representation
425
669
 
670
+ ## `Labels` (object)
671
+
672
+ Properties of the `Labels` object:
673
+
674
+ ### `top` (string, required)
675
+
676
+ Label for top side of the graph
677
+
678
+ ### `bottom` (string, required)
679
+
680
+ Label for bottom side of the graph
681
+
682
+ ### `left` (string, required)
683
+
684
+ Label for left side of the graph
685
+
686
+ ### `right` (string, required)
687
+
688
+ Label for right side of the graph
689
+
690
+ ## `LabelsConfigProp` (object)
691
+
692
+ Properties of the `LabelsConfigProp` object:
693
+
694
+ ### `top` (string)
695
+
696
+ Indicates the placeholder for the top label
697
+
698
+ ### `right` (string)
699
+
700
+ Indicates the placeholder for the right label
701
+
702
+ ### `bottom` (string)
703
+
704
+ Indicates the placeholder for the bottom label
705
+
706
+ ### `left` (string)
707
+
708
+ Indicates the placeholder for the left label
709
+
710
+ ### `enabled` (boolean)
711
+
712
+ Indicates the value of the item if it affects config-ui
713
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
714
+
715
+ ### `settings` (boolean)
716
+
717
+ Indicates if the item has to be displayed in the Settings Panel
718
+
719
+ ### `label` (string)
720
+
721
+ Indicates the label for the item that has to be displayed in the Settings Panel
722
+
723
+ ## `ConfigurePropWithEnabled` (object)
724
+
725
+ Properties of the `ConfigurePropWithEnabled` object:
726
+
727
+ ### `enabled` (boolean)
728
+
729
+ Indicates the value of the item if it affects config-ui
730
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
731
+
732
+ ### `settings` (boolean)
733
+
734
+ Indicates if the item has to be displayed in the Settings Panel
735
+
736
+ ### `label` (string)
737
+
738
+ Indicates the label for the item that has to be displayed in the Settings Panel
739
+
740
+ ## `ConfigureLanguageOptionsProp` (object)
741
+
742
+ Properties of the `ConfigureLanguageOptionsProp` object:
743
+
744
+ ### `value` (string, required)
745
+
746
+ Value of the language option
747
+
748
+ ### `label` (string, required)
749
+
750
+ Label of the language option
751
+
752
+ ## `TitleConfigProp` (object)
753
+
754
+ Properties of the `TitleConfigProp` object:
755
+
756
+ ### `placeholder` (string)
757
+
758
+ Indicates the placeholder for the title label
759
+
760
+ ### `enabled` (boolean)
761
+
762
+ Indicates the value of the item if it affects config-ui
763
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
764
+
765
+ ### `settings` (boolean)
766
+
767
+ Indicates if the item has to be displayed in the Settings Panel
768
+
769
+ ### `label` (string)
770
+
771
+ Indicates the label for the item that has to be displayed in the Settings Panel
772
+
773
+ ## `ConfigureMaxImageDimensionsProp` (object)
774
+
775
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
776
+
777
+ ### `teacherInstructions` (number)
778
+
779
+ Indicates the max dimension for images in teacher instructions
780
+
781
+ ### `prompt` (number)
782
+
783
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
784
+
785
+ ### `rationale` (number)
786
+
787
+ Indicates the max dimension for images in rationale
788
+
789
+ ## `ConfigureMathMLProp` (object)
790
+
791
+ Properties of the `ConfigureMathMLProp` object:
792
+
793
+ ### `mmlOutput` (number)
794
+
795
+ Indicates if model should have mathML output instead of latex
796
+
797
+ ### `mmlEditing` (number)
798
+
799
+ Indicates if mathML that's already in model should be editable
800
+
801
+ ## `Answer` (object)
802
+
803
+ Properties of the `Answer` object:
804
+
805
+ ### `name` (string, required)
806
+
807
+ Indicates name of answer
808
+
809
+ ### `marks` (array, required)
810
+
811
+ Indicates marks for the answer
812
+
813
+ Additional restrictions:
814
+
815
+ * Minimum items: `1`
816
+
817
+ ## `Mark` (object)
818
+
819
+ Properties of the `Mark` object:
820
+
821
+ ### `type` (string, enum, required)
822
+
823
+ Indicates type of mark
824
+
825
+ This element must be one of the following enum values:
826
+
827
+ * `line`
828
+
829
+ ### `showLabel` (boolean)
830
+
831
+ Indicates if label should be visible
832
+
833
+ ### `label` (string)
834
+
835
+ Indicates label value for mark
836
+
837
+ ### `building` (boolean, required)
838
+
839
+ Indicates if mark is in build process
840
+
841
+ ### `x` (number)
842
+
843
+ Indicates x coordinate if type is point
844
+
845
+ ### `y` (number)
846
+
847
+ Indicates y coordinate if type is point
848
+
849
+ ### `from` (object)
850
+
851
+ Properties of the `from` object:
852
+
853
+ #### `x` (number, required)
854
+
855
+ Indicates x coordinate
856
+
857
+ #### `y` (number, required)
858
+
859
+ Indicates y coordinate
860
+
861
+ ### `to` (object)
862
+
863
+ Properties of the `to` object:
864
+
865
+ #### `x` (number, required)
866
+
867
+ Indicates x coordinate
868
+
869
+ #### `y` (number, required)
870
+
871
+ Indicates y coordinate
872
+
873
+ ## `Point` (object)
874
+
875
+ Properties of the `Point` object:
876
+
877
+ ### `x` (number, required)
878
+
879
+ Indicates x coordinate
880
+
881
+ ### `y` (number, required)
882
+
883
+ Indicates y coordinate
884
+
885
+ ## `Number` (object)
886
+
887
+ An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.
888
+
426
889
  ## `GssLineData` (object)
427
890
 
428
891
  Properties of the `GssLineData` object:
@@ -486,24 +949,4 @@ Indicates if line is Solid or Dashed
486
949
  This element must be one of the following enum values:
487
950
 
488
951
  * `Dashed`
489
- * `Solid`
490
-
491
- ## `Labels` (object)
492
-
493
- Properties of the `Labels` object:
494
-
495
- ### `top` (string, required)
496
-
497
- Label for top side of the graph
498
-
499
- ### `bottom` (string, required)
500
-
501
- Label for bottom side of the graph
502
-
503
- ### `left` (string, required)
504
-
505
- Label for left side of the graph
506
-
507
- ### `right` (string, required)
508
-
509
- Label for right side of the graph
952
+ * `Solid`
package/lib/index.js CHANGED
@@ -126,6 +126,10 @@ var Graphing = /*#__PURE__*/function (_HTMLElement) {
126
126
  set: function set(s) {
127
127
  this._session = s;
128
128
 
129
+ if (!this._session.answer) {
130
+ this._session.answer = [];
131
+ }
132
+
129
133
  var _ref = this._session || {},
130
134
  answer = _ref.answer;
131
135
 
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["Graphing","answer","Array","isArray","length","isUndoOperation","gssData","_model","selectedTool","fill","lineType","_session","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_render","session","m","s","gssLineData","domain","range","section","filter","mark","type","numberOfLines","sections","lineA","lineB","el","React","createElement","Main","model","onAnswersChange","changeAnswers","setGssData","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA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nimport ReactDOM from 'react-dom';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering';\nimport { findSectionsInSolutionSet, removeInvalidAnswers } from './utils';\nimport Main from './main';\nimport { set } from 'lodash';\n\nexport { Main as Component };\n\nexport default class Graphing extends HTMLElement {\n constructor() {\n super();\n }\n\n /*\n * Function to set model\n * @param {object} m - Model object\n * */\n set model(m) {\n this._model = m;\n this._render();\n }\n\n /*\n * Function to set session\n * @param {object} s - Session object\n * */\n set session(s) {\n this._session = s;\n const { answer } = this._session || {};\n const { gssLineData, domain, range } = this._model;\n let section = answer && answer.filter((mark) => mark.type === 'polygon').length > 0;\n if (gssLineData.numberOfLines === 1) {\n this._model.gssData = {\n numberOfLines: 1,\n selectedTool: section ? 'solutionSet' : 'lineA',\n sections: [],\n lineA: {\n lineType: answer && answer.length > 0 ? answer[0].fill : 'Solid',\n },\n };\n } else {\n this._model.gssData = {\n numberOfLines: 2,\n selectedTool: section ? 'solutionSet' : 'lineA',\n sections: [],\n lineA: {\n lineType: answer && answer.length > 0 ? answer[0].fill : 'Solid',\n },\n lineB: {\n lineType: answer && answer.length > 1 ? answer[1].fill : 'Solid',\n },\n };\n }\n if (section) {\n this._model.gssData = findSectionsInSolutionSet(this._model.gssData, answer, domain, range);\n }\n this._render();\n }\n\n /*\n * Function to get session\n * */\n get session() {\n return this._session;\n }\n\n connectedCallback() {\n this._render();\n }\n\n /*\n * Is complete function\n * @param {object} answer - Answer object\n * */\n isComplete = (answer) => Array.isArray(answer) && answer.length > 0;\n\n /*\n * Callback function to change answers\n * @param {object} answer - Answer object\n * @param {boolean} isUndoOperation - Boolean value to check if undo operation is performed\n * */\n changeAnswers = (answer, isUndoOperation) => {\n // avoid removeInvalidObjects when undo or redo operations are executed\n // in order to preserve the logic of undo and redo\n const { gssData } = this._model;\n if (gssData.selectedTool === 'lineA' && answer.length > 0) {\n answer[0].fill = gssData['lineA'].lineType;\n }\n if (gssData.selectedTool === 'lineB' && answer.length > 1) {\n answer[1].fill = gssData['lineB'].lineType;\n }\n if (answer.length === 0) {\n gssData.selectedTool = 'lineA';\n this._model.gssData = gssData;\n }\n if (!isUndoOperation) {\n this._session.answer = removeInvalidAnswers(answer);\n } else {\n this._session.answer = answer;\n }\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete(this._session.answer)));\n this._render();\n };\n\n /*\n * Function to set gssData object and session object\n * @param {object} gssData - GSS Data object\n * @param {object} session - Session object\n * */\n setGssData = (gssData, session) => {\n this._model.gssData = gssData;\n this._session = session;\n this._render();\n };\n\n /*\n * Render function\n * */\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onAnswersChange: this.changeAnswers,\n setGssData: this.setGssData,\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","isUndoOperation","gssData","_model","selectedTool","fill","lineType","_session","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_render","session","m","s","gssLineData","domain","range","section","filter","mark","type","numberOfLines","sections","lineA","lineB","el","React","createElement","Main","model","onAnswersChange","changeAnswers","setGssData","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAIqBA,Q;;;;;AACnB,sBAAc;AAAA;;AAAA;AACZ;AADY,mGAoED,UAACC,MAAD;AAAA,aAAYC,KAAK,CAACC,OAAN,CAAcF,MAAd,KAAyBA,MAAM,CAACG,MAAP,GAAgB,CAArD;AAAA,KApEC;AAAA,sGA2EE,UAACH,MAAD,EAASI,eAAT,EAA6B;AAC3C;AACA;AACA,UAAQC,OAAR,GAAoB,MAAKC,MAAzB,CAAQD,OAAR;;AACA,UAAIA,OAAO,CAACE,YAAR,KAAyB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A8BH,MAAM,CAAC,CAAD,CAAN,CAAUQ,IAAxC,GAA+C;AADpD,WAJa;AAOpBsB,UAAAA,KAAK,EAAE;AACLrB,YAAAA,QAAQ,EAAET,MAAM,IAAIA,MAAM,CAACG,MAAP,GAAgB,CAA1B,GAA8BH,MAAM,CAAC,CAAD,CAAN,CAAUQ,IAAxC,GAA+C;AADpD;AAPa,SAAtB;AAWD;;AACD,UAAIe,OAAJ,EAAa;AACX,aAAKjB,MAAL,CAAYD,OAAZ,GAAsB,sCAA0B,KAAKC,MAAL,CAAYD,OAAtC,EAA+CL,MAA/C,EAAuDqB,MAAvD,EAA+DC,KAA/D,CAAtB;AACD;;AACD,WAAKN,OAAL;AACD;;;WASD,6BAAoB;AAClB,WAAKA,OAAL;AACD;AAED;AACF;AACA;AACA;;;;;AA0CE;AACF;AACA;AACE,uBAAU;AAAA;;AACR,UAAI,CAAC,KAAKV,MAAN,IAAgB,CAAC,KAAKI,QAA1B,EAAoC;AAClC;AACD;;AACD,UAAMqB,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,QAAAA,KAAK,EAAE,KAAK7B,MADuB;AAEnCW,QAAAA,OAAO,EAAE,KAAKP,QAFqB;AAGnC0B,QAAAA,eAAe,EAAE,KAAKC,aAHa;AAInCC,QAAAA,UAAU,EAAE,KAAKA;AAJkB,OAA1B,CAAX;;AAMAC,2BAASC,MAAT,CAAgBT,EAAhB,EAAoB,IAApB,EAA0B,YAAM;AAC9B,uCAAW,MAAX;AACD,OAFD;AAGD;;;kDA9HmCU,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering';\nimport { findSectionsInSolutionSet, removeInvalidAnswers } from './utils';\nimport Main from './main';\nimport { set } from 'lodash';\n\nexport { Main as Component };\n\nexport default class Graphing extends HTMLElement {\n constructor() {\n super();\n }\n\n /*\n * Function to set model\n * @param {object} m - Model object\n * */\n set model(m) {\n this._model = m;\n this._render();\n }\n\n /*\n * Function to set session\n * @param {object} s - Session object\n * */\n set session(s) {\n this._session = s;\n if (!this._session.answer) {\n this._session.answer = [];\n }\n const { answer } = this._session || {};\n const { gssLineData, domain, range } = this._model;\n let section = answer && answer.filter((mark) => mark.type === 'polygon').length > 0;\n if (gssLineData.numberOfLines === 1) {\n this._model.gssData = {\n numberOfLines: 1,\n selectedTool: section ? 'solutionSet' : 'lineA',\n sections: [],\n lineA: {\n lineType: answer && answer.length > 0 ? answer[0].fill : 'Solid',\n },\n };\n } else {\n this._model.gssData = {\n numberOfLines: 2,\n selectedTool: section ? 'solutionSet' : 'lineA',\n sections: [],\n lineA: {\n lineType: answer && answer.length > 0 ? answer[0].fill : 'Solid',\n },\n lineB: {\n lineType: answer && answer.length > 1 ? answer[1].fill : 'Solid',\n },\n };\n }\n if (section) {\n this._model.gssData = findSectionsInSolutionSet(this._model.gssData, answer, domain, range);\n }\n this._render();\n }\n\n /*\n * Function to get session\n * */\n get session() {\n return this._session;\n }\n\n connectedCallback() {\n this._render();\n }\n\n /*\n * Is complete function\n * @param {object} answer - Answer object\n * */\n isComplete = (answer) => Array.isArray(answer) && answer.length > 0;\n\n /*\n * Callback function to change answers\n * @param {object} answer - Answer object\n * @param {boolean} isUndoOperation - Boolean value to check if undo operation is performed\n * */\n changeAnswers = (answer, isUndoOperation) => {\n // avoid removeInvalidObjects when undo or redo operations are executed\n // in order to preserve the logic of undo and redo\n const { gssData } = this._model;\n if (gssData.selectedTool === 'lineA' && answer.length > 0) {\n answer[0].fill = gssData['lineA'].lineType;\n }\n if (gssData.selectedTool === 'lineB' && answer.length > 1) {\n answer[1].fill = gssData['lineB'].lineType;\n }\n if (answer.length === 0) {\n gssData.selectedTool = 'lineA';\n this._model.gssData = gssData;\n }\n if (!isUndoOperation) {\n this._session.answer = removeInvalidAnswers(answer);\n } else {\n this._session.answer = answer;\n }\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete(this._session.answer)));\n this._render();\n };\n\n /*\n * Function to set gssData object and session object\n * @param {object} gssData - GSS Data object\n * @param {object} session - Session object\n * */\n setGssData = (gssData, session) => {\n this._model.gssData = gssData;\n this._session = session;\n this._render();\n };\n\n /*\n * Render function\n * */\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onAnswersChange: this.changeAnswers,\n setGssData: this.setGssData,\n });\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n}\n"],"file":"index.js"}