@pie-element/fraction-model 1.1.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.
Files changed (43) hide show
  1. package/CHANGELOG.json +1 -0
  2. package/CHANGELOG.md +12 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +18 -0
  5. package/configure/CHANGELOG.json +1 -0
  6. package/configure/CHANGELOG.md +12 -0
  7. package/configure/lib/card-bar.js +78 -0
  8. package/configure/lib/card-bar.js.map +1 -0
  9. package/configure/lib/defaults.js +103 -0
  10. package/configure/lib/defaults.js.map +1 -0
  11. package/configure/lib/index.js +225 -0
  12. package/configure/lib/index.js.map +1 -0
  13. package/configure/lib/main.js +302 -0
  14. package/configure/lib/main.js.map +1 -0
  15. package/configure/lib/model-options.js +221 -0
  16. package/configure/lib/model-options.js.map +1 -0
  17. package/configure/lib/number-text-field.js +103 -0
  18. package/configure/lib/number-text-field.js.map +1 -0
  19. package/configure/package.json +20 -0
  20. package/controller/CHANGELOG.json +1 -0
  21. package/controller/CHANGELOG.md +11 -0
  22. package/controller/lib/defaults.js +21 -0
  23. package/controller/lib/defaults.js.map +1 -0
  24. package/controller/lib/index.js +260 -0
  25. package/controller/lib/index.js.map +1 -0
  26. package/controller/package.json +18 -0
  27. package/docs/config-schema.json +975 -0
  28. package/docs/config-schema.json.md +718 -0
  29. package/docs/demo/config.js +8 -0
  30. package/docs/demo/generate.js +6 -0
  31. package/docs/demo/index.html +1 -0
  32. package/docs/demo/session.js +6 -0
  33. package/docs/pie-schema.json +123 -0
  34. package/docs/pie-schema.json.md +93 -0
  35. package/lib/answer-fraction.js +161 -0
  36. package/lib/answer-fraction.js.map +1 -0
  37. package/lib/fraction-model-chart.js +343 -0
  38. package/lib/fraction-model-chart.js.map +1 -0
  39. package/lib/index.js +131 -0
  40. package/lib/index.js.map +1 -0
  41. package/lib/main.js +248 -0
  42. package/lib/main.js.map +1 -0
  43. package/package.json +29 -0
@@ -0,0 +1,718 @@
1
+ Config Object for
2
+
3
+ The schema defines the following properties:
4
+
5
+ # `baseInputConfiguration` (object)
6
+
7
+ Properties of the `baseInputConfiguration` object:
8
+
9
+ ## `math` (object)
10
+
11
+ Properties of the `math` object:
12
+
13
+ ### `disabled` (boolean)
14
+
15
+ Indicates if the plugin is disabled or not
16
+
17
+ ## `audio` (object)
18
+
19
+ Properties of the `audio` object:
20
+
21
+ ### `disabled` (boolean)
22
+
23
+ Indicates if the plugin is disabled or not
24
+
25
+ ## `video` (object)
26
+
27
+ Properties of the `video` object:
28
+
29
+ ### `disabled` (boolean)
30
+
31
+ Indicates if the plugin is disabled or not
32
+
33
+ ## `image` (object)
34
+
35
+ Properties of the `image` object:
36
+
37
+ ### `disabled` (boolean)
38
+
39
+ Indicates if the plugin is disabled or not
40
+
41
+ ## `customPlugins` (array)
42
+
43
+ An array of objects that determine custom plugins.
44
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
45
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
46
+
47
+ The object is an array with all elements of the type `object`.
48
+
49
+ The array object has the following properties:
50
+
51
+ ### `event` (string, required)
52
+
53
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
54
+ PIE will emit the event prefixed with "PIE-".
55
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
56
+
57
+ ### `iconAlt` (string, required)
58
+
59
+ The alt for the custom button icon
60
+
61
+ ### `iconType` (string, required)
62
+
63
+ The icon type.
64
+ Currently, only "SVG" is supported.
65
+
66
+ ### `icon` (string, required)
67
+
68
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
69
+
70
+ # `title` (object)
71
+
72
+ Properties of the `title` object:
73
+
74
+ ## `inputConfiguration` (object)
75
+
76
+ Properties of the `inputConfiguration` object:
77
+
78
+ ### `math` (object)
79
+
80
+ Properties of the `math` object:
81
+
82
+ #### `disabled` (boolean)
83
+
84
+ Indicates if the plugin is disabled or not
85
+
86
+ ### `audio` (object)
87
+
88
+ Properties of the `audio` object:
89
+
90
+ #### `disabled` (boolean)
91
+
92
+ Indicates if the plugin is disabled or not
93
+
94
+ ### `video` (object)
95
+
96
+ Properties of the `video` object:
97
+
98
+ #### `disabled` (boolean)
99
+
100
+ Indicates if the plugin is disabled or not
101
+
102
+ ### `image` (object)
103
+
104
+ Properties of the `image` object:
105
+
106
+ #### `disabled` (boolean)
107
+
108
+ Indicates if the plugin is disabled or not
109
+
110
+ ### `customPlugins` (array)
111
+
112
+ An array of objects that determine custom plugins.
113
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
114
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
115
+
116
+ The object is an array with all elements of the type `object`.
117
+
118
+ The array object has the following properties:
119
+
120
+ #### `event` (string, required)
121
+
122
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
123
+ PIE will emit the event prefixed with "PIE-".
124
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
125
+
126
+ #### `iconAlt` (string, required)
127
+
128
+ The alt for the custom button icon
129
+
130
+ #### `iconType` (string, required)
131
+
132
+ The icon type.
133
+ Currently, only "SVG" is supported.
134
+
135
+ #### `icon` (string, required)
136
+
137
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
138
+
139
+ ## `settings` (boolean)
140
+
141
+ Indicates if the item has to be displayed in the Settings Panel
142
+
143
+ ## `label` (string)
144
+
145
+ Indicates the label for the item that has to be displayed in the Settings Panel
146
+
147
+ # `question` (object)
148
+
149
+ Properties of the `question` object:
150
+
151
+ ## `inputConfiguration` (object)
152
+
153
+ Properties of the `inputConfiguration` object:
154
+
155
+ ### `math` (object)
156
+
157
+ Properties of the `math` object:
158
+
159
+ #### `disabled` (boolean)
160
+
161
+ Indicates if the plugin is disabled or not
162
+
163
+ ### `audio` (object)
164
+
165
+ Properties of the `audio` object:
166
+
167
+ #### `disabled` (boolean)
168
+
169
+ Indicates if the plugin is disabled or not
170
+
171
+ ### `video` (object)
172
+
173
+ Properties of the `video` object:
174
+
175
+ #### `disabled` (boolean)
176
+
177
+ Indicates if the plugin is disabled or not
178
+
179
+ ### `image` (object)
180
+
181
+ Properties of the `image` object:
182
+
183
+ #### `disabled` (boolean)
184
+
185
+ Indicates if the plugin is disabled or not
186
+
187
+ ### `customPlugins` (array)
188
+
189
+ An array of objects that determine custom plugins.
190
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
191
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
192
+
193
+ The object is an array with all elements of the type `object`.
194
+
195
+ The array object has the following properties:
196
+
197
+ #### `event` (string, required)
198
+
199
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
200
+ PIE will emit the event prefixed with "PIE-".
201
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
202
+
203
+ #### `iconAlt` (string, required)
204
+
205
+ The alt for the custom button icon
206
+
207
+ #### `iconType` (string, required)
208
+
209
+ The icon type.
210
+ Currently, only "SVG" is supported.
211
+
212
+ #### `icon` (string, required)
213
+
214
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
215
+
216
+ ## `settings` (boolean)
217
+
218
+ Indicates if the item has to be displayed in the Settings Panel
219
+
220
+ ## `label` (string)
221
+
222
+ Indicates the label for the item that has to be displayed in the Settings Panel
223
+
224
+ # `modelOptions` (object)
225
+
226
+ Properties of the `modelOptions` object:
227
+
228
+ ## `maxOfModel` (object)
229
+
230
+ Properties of the `maxOfModel` object:
231
+
232
+ ### `min` (number)
233
+
234
+ Indicates the min value for number model
235
+
236
+ ### `max` (number)
237
+
238
+ Indicates the max value for number model
239
+
240
+ ### `default` (number)
241
+
242
+ Indicates the default value for number model
243
+
244
+ ## `partsPerModel` (object)
245
+
246
+ Properties of the `partsPerModel` object:
247
+
248
+ ### `min` (number)
249
+
250
+ Indicates the min value for number model
251
+
252
+ ### `max` (number)
253
+
254
+ Indicates the max value for number model
255
+
256
+ ### `default` (number)
257
+
258
+ Indicates the default value for number model
259
+
260
+ ## `modelTypeChoices` (array)
261
+
262
+ Indicates the model types of item
263
+
264
+ The object is an array with all elements of the type `object`.
265
+
266
+ The array object has the following properties:
267
+
268
+ ### `value` (string, required)
269
+
270
+ Indicates the value for model choice
271
+
272
+ ### `label` (string, required)
273
+
274
+ Indicates the label for model choice
275
+
276
+ # `mathMlOptions` (object)
277
+
278
+ Properties of the `mathMlOptions` object:
279
+
280
+ ## `mmlOutput` (number)
281
+
282
+ Indicates if model should have mathML output instead of latex
283
+
284
+ ## `mmlEditing` (number)
285
+
286
+ Indicates if mathML that's already in model should be editable
287
+
288
+ # `language` (object)
289
+
290
+ Properties of the `language` object:
291
+
292
+ ## `enabled` (boolean)
293
+
294
+ Indicates the value of the item if it affects config-ui
295
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
296
+
297
+ ## `settings` (boolean)
298
+
299
+ Indicates if the item has to be displayed in the Settings Panel
300
+
301
+ ## `label` (string)
302
+
303
+ Indicates the label for the item that has to be displayed in the Settings Panel
304
+
305
+ # `languageChoices` (object)
306
+
307
+ Language choices configuration
308
+ Only available if language is enabled
309
+
310
+ Properties of the `languageChoices` object:
311
+
312
+ ## `label` (string, required)
313
+
314
+ ## `options` (array, required)
315
+
316
+ The object is an array with all elements of the type `object`.
317
+
318
+ The array object has the following properties:
319
+
320
+ ### `value` (string, required)
321
+
322
+ Value of the language option
323
+
324
+ ### `label` (string, required)
325
+
326
+ Label of the language option
327
+
328
+ # `feedback` (object)
329
+
330
+ Properties of the `feedback` object:
331
+
332
+ ## `settings` (boolean)
333
+
334
+ Indicates if the item has to be displayed in the Settings Panel
335
+
336
+ ## `label` (string)
337
+
338
+ Indicates the label for the item that has to be displayed in the Settings Panel
339
+
340
+ # `settingsPanelDisabled` (boolean)
341
+
342
+ Indicates if the settings panel is not available
343
+
344
+ # `spellCheck` (object)
345
+
346
+ Properties of the `spellCheck` object:
347
+
348
+ ## `settings` (boolean)
349
+
350
+ Indicates if the item has to be displayed in the Settings Panel
351
+
352
+ ## `label` (string)
353
+
354
+ Indicates the label for the item that has to be displayed in the Settings Panel
355
+
356
+ # `showPrompt` (boolean)
357
+
358
+ Determines whether prompt field will be displayed or not
359
+
360
+ Default: `true`
361
+
362
+ # `promptLabel` (string)
363
+
364
+ The label for the item stem/prompt field
365
+
366
+ Default: `"Item Stemm"`
367
+
368
+ # `contentDimensions` (object)
369
+
370
+ Indicates the dimensions configuration for the authoring container
371
+ Note: Some items have a default minimum width because of their content, but if
372
+ the minWidth is lower than this, the overflow behavior will take care of that
373
+
374
+ Properties of the `contentDimensions` object:
375
+
376
+ ## `maxHeight` (string,number)
377
+
378
+ Indicates the max height of the authoring container
379
+
380
+ Default: `"undefined"`
381
+
382
+ ## `maxWidth` (string,number)
383
+
384
+ Indicates the max width of the authoring container
385
+
386
+ Default: `"undefined"`
387
+
388
+ ## `minHeight` (string,number)
389
+
390
+ Indicates the min height of the authoring container
391
+
392
+ Default: `"undefined"`
393
+
394
+ ## `minWidth` (string,number)
395
+
396
+ Indicates the min width of the authoring container
397
+
398
+ Default: `"undefined"`
399
+
400
+ Default: `": {}"`
401
+
402
+ # `settingsPartialScoring` (boolean)
403
+
404
+ Indicates whether the settings panel wil allow the author to modify settings for partial scoring
405
+
406
+ Default: `true`
407
+
408
+ ---
409
+
410
+ # Sub Schemas
411
+
412
+ The schema defines the following additional types:
413
+
414
+ ## `EditableHtmlConfigureProp` (object)
415
+
416
+ Properties of the `EditableHtmlConfigureProp` object:
417
+
418
+ ### `math` (object)
419
+
420
+ Properties of the `math` object:
421
+
422
+ #### `disabled` (boolean)
423
+
424
+ Indicates if the plugin is disabled or not
425
+
426
+ ### `audio` (object)
427
+
428
+ Properties of the `audio` object:
429
+
430
+ #### `disabled` (boolean)
431
+
432
+ Indicates if the plugin is disabled or not
433
+
434
+ ### `video` (object)
435
+
436
+ Properties of the `video` object:
437
+
438
+ #### `disabled` (boolean)
439
+
440
+ Indicates if the plugin is disabled or not
441
+
442
+ ### `image` (object)
443
+
444
+ Properties of the `image` object:
445
+
446
+ #### `disabled` (boolean)
447
+
448
+ Indicates if the plugin is disabled or not
449
+
450
+ ### `customPlugins` (array)
451
+
452
+ An array of objects that determine custom plugins.
453
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
454
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
455
+
456
+ The object is an array with all elements of the type `object`.
457
+
458
+ The array object has the following properties:
459
+
460
+ #### `event` (string, required)
461
+
462
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
463
+ PIE will emit the event prefixed with "PIE-".
464
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
465
+
466
+ #### `iconAlt` (string, required)
467
+
468
+ The alt for the custom button icon
469
+
470
+ #### `iconType` (string, required)
471
+
472
+ The icon type.
473
+ Currently, only "SVG" is supported.
474
+
475
+ #### `icon` (string, required)
476
+
477
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
478
+
479
+ ## `EditableHtmlButtonConfigure` (object)
480
+
481
+ Properties of the `EditableHtmlButtonConfigure` object:
482
+
483
+ ### `disabled` (boolean)
484
+
485
+ Indicates if the plugin is disabled or not
486
+
487
+ ## `CustomPlugin` (object)
488
+
489
+ Properties of the `CustomPlugin` object:
490
+
491
+ ### `event` (string, required)
492
+
493
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
494
+ PIE will emit the event prefixed with "PIE-".
495
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
496
+
497
+ ### `iconAlt` (string, required)
498
+
499
+ The alt for the custom button icon
500
+
501
+ ### `iconType` (string, required)
502
+
503
+ The icon type.
504
+ Currently, only "SVG" is supported.
505
+
506
+ ### `icon` (string, required)
507
+
508
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
509
+
510
+ ## `EditableHtmlPluginConfigure` (object)
511
+
512
+ Properties of the `EditableHtmlPluginConfigure` object:
513
+
514
+ ### `inputConfiguration` (object)
515
+
516
+ Properties of the `inputConfiguration` object:
517
+
518
+ #### `math` (object)
519
+
520
+ Properties of the `math` object:
521
+
522
+ ##### `disabled` (boolean)
523
+
524
+ Indicates if the plugin is disabled or not
525
+
526
+ #### `audio` (object)
527
+
528
+ Properties of the `audio` object:
529
+
530
+ ##### `disabled` (boolean)
531
+
532
+ Indicates if the plugin is disabled or not
533
+
534
+ #### `video` (object)
535
+
536
+ Properties of the `video` object:
537
+
538
+ ##### `disabled` (boolean)
539
+
540
+ Indicates if the plugin is disabled or not
541
+
542
+ #### `image` (object)
543
+
544
+ Properties of the `image` object:
545
+
546
+ ##### `disabled` (boolean)
547
+
548
+ Indicates if the plugin is disabled or not
549
+
550
+ #### `customPlugins` (array)
551
+
552
+ An array of objects that determine custom plugins.
553
+ A custom plugin is an object which determines how the button will look like (icon) and the event name that will be triggered when button gets pressed (event).
554
+ Example can be found at https://github.com/pie-framework/pie-lib/blob/develop/packages/demo/pages/editable-html.js#L425.
555
+
556
+ The object is an array with all elements of the type `object`.
557
+
558
+ The array object has the following properties:
559
+
560
+ ##### `event` (string, required)
561
+
562
+ The name of the custom event. It needs to be valid (only letters, numbers and "_" can be used).
563
+ PIE will emit the event prefixed with "PIE-".
564
+ Eg: event = 'client_custom_event_A' => the emitted event will be "PIE-client_custom_event_A"
565
+
566
+ ##### `iconAlt` (string, required)
567
+
568
+ The alt for the custom button icon
569
+
570
+ ##### `iconType` (string, required)
571
+
572
+ The icon type.
573
+ Currently, only "SVG" is supported.
574
+
575
+ ##### `icon` (string, required)
576
+
577
+ The icon string. Currently, only "SVG" is supported, so it needs to be a valid svg.
578
+
579
+ ### `settings` (boolean)
580
+
581
+ Indicates if the item has to be displayed in the Settings Panel
582
+
583
+ ### `label` (string)
584
+
585
+ Indicates the label for the item that has to be displayed in the Settings Panel
586
+
587
+ ## `FractionModelOptionsConfigure` (object)
588
+
589
+ Properties of the `FractionModelOptionsConfigure` object:
590
+
591
+ ### `maxOfModel` (object)
592
+
593
+ Properties of the `maxOfModel` object:
594
+
595
+ #### `min` (number)
596
+
597
+ Indicates the min value for number model
598
+
599
+ #### `max` (number)
600
+
601
+ Indicates the max value for number model
602
+
603
+ #### `default` (number)
604
+
605
+ Indicates the default value for number model
606
+
607
+ ### `partsPerModel` (object)
608
+
609
+ Properties of the `partsPerModel` object:
610
+
611
+ #### `min` (number)
612
+
613
+ Indicates the min value for number model
614
+
615
+ #### `max` (number)
616
+
617
+ Indicates the max value for number model
618
+
619
+ #### `default` (number)
620
+
621
+ Indicates the default value for number model
622
+
623
+ ### `modelTypeChoices` (array)
624
+
625
+ Indicates the model types of item
626
+
627
+ The object is an array with all elements of the type `object`.
628
+
629
+ The array object has the following properties:
630
+
631
+ #### `value` (string, required)
632
+
633
+ Indicates the value for model choice
634
+
635
+ #### `label` (string, required)
636
+
637
+ Indicates the label for model choice
638
+
639
+ ## `ModelConfig` (object)
640
+
641
+ Properties of the `ModelConfig` object:
642
+
643
+ ### `min` (number)
644
+
645
+ Indicates the min value for number model
646
+
647
+ ### `max` (number)
648
+
649
+ Indicates the max value for number model
650
+
651
+ ### `default` (number)
652
+
653
+ Indicates the default value for number model
654
+
655
+ ## `ChoiceConfig` (object)
656
+
657
+ Properties of the `ChoiceConfig` object:
658
+
659
+ ### `value` (string, required)
660
+
661
+ Indicates the value for model choice
662
+
663
+ ### `label` (string, required)
664
+
665
+ Indicates the label for model choice
666
+
667
+ ## `ConfigureMathMLProp` (object)
668
+
669
+ Properties of the `ConfigureMathMLProp` object:
670
+
671
+ ### `mmlOutput` (number)
672
+
673
+ Indicates if model should have mathML output instead of latex
674
+
675
+ ### `mmlEditing` (number)
676
+
677
+ Indicates if mathML that's already in model should be editable
678
+
679
+ ## `ConfigurePropWithEnabled` (object)
680
+
681
+ Properties of the `ConfigurePropWithEnabled` object:
682
+
683
+ ### `enabled` (boolean)
684
+
685
+ Indicates the value of the item if it affects config-ui
686
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
687
+
688
+ ### `settings` (boolean)
689
+
690
+ Indicates if the item has to be displayed in the Settings Panel
691
+
692
+ ### `label` (string)
693
+
694
+ Indicates the label for the item that has to be displayed in the Settings Panel
695
+
696
+ ## `ConfigureLanguageOptionsProp` (object)
697
+
698
+ Properties of the `ConfigureLanguageOptionsProp` object:
699
+
700
+ ### `value` (string, required)
701
+
702
+ Value of the language option
703
+
704
+ ### `label` (string, required)
705
+
706
+ Label of the language option
707
+
708
+ ## `ConfigureProp` (object)
709
+
710
+ Properties of the `ConfigureProp` object:
711
+
712
+ ### `settings` (boolean)
713
+
714
+ Indicates if the item has to be displayed in the Settings Panel
715
+
716
+ ### `label` (string)
717
+
718
+ Indicates the label for the item that has to be displayed in the Settings Panel
@@ -0,0 +1,8 @@
1
+ const { model } = require('./generate');
2
+
3
+ module.exports = {
4
+ elements: {
5
+ 'fraction-model': '../..',
6
+ },
7
+ models: [model('1', 'fraction-model')],
8
+ };
@@ -0,0 +1,6 @@
1
+ exports.model = (id, element) => ({
2
+ id,
3
+ element,
4
+ title: 'Title',
5
+ question: 'Custom Question',
6
+ });