@pie-element/extended-text-entry 6.5.4-next.419 → 6.5.4-next.428

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.
@@ -8,7 +8,72 @@ var _default = {
8
8
  dimensions: {
9
9
  height: 100,
10
10
  width: 500
11
- }
11
+ },
12
+ predefinedAnnotations: [{
13
+ label: 'good',
14
+ text: 'good',
15
+ type: 'positive'
16
+ }, {
17
+ label: '★',
18
+ text: '★',
19
+ type: 'positive'
20
+ }, {
21
+ label: ':-)',
22
+ text: ':-)',
23
+ type: 'positive'
24
+ }, {
25
+ label: 'creative',
26
+ text: 'creative',
27
+ type: 'positive'
28
+ }, {
29
+ label: 'run-on',
30
+ text: 'run-on',
31
+ type: 'negative'
32
+ }, {
33
+ label: 'frag',
34
+ text: 'fragment',
35
+ type: 'negative'
36
+ }, {
37
+ label: 'tran',
38
+ text: 'transition',
39
+ type: 'negative'
40
+ }, {
41
+ label: 'supp',
42
+ text: 'support needed',
43
+ type: 'negative'
44
+ }, {
45
+ label: 'punc',
46
+ text: 'punctuation',
47
+ type: 'negative'
48
+ }, {
49
+ label: 'agr',
50
+ text: 'agreement wrong',
51
+ type: 'negative'
52
+ }, {
53
+ label: 'unclear',
54
+ text: 'unclear',
55
+ type: 'negative'
56
+ }, {
57
+ label: 'cut',
58
+ text: 'cut',
59
+ type: 'negative'
60
+ }, {
61
+ label: 'sp',
62
+ text: 'spelling',
63
+ type: 'negative'
64
+ }, {
65
+ label: 'cap',
66
+ text: 'capitalization',
67
+ type: 'negative'
68
+ }, {
69
+ label: 'inf',
70
+ text: 'informal',
71
+ type: 'negative'
72
+ }, {
73
+ label: 'awk',
74
+ text: 'awkward',
75
+ type: 'negative'
76
+ }]
12
77
  };
13
78
  exports["default"] = _default;
14
79
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/defaults.js"],"names":["dimensions","height","width"],"mappings":";;;;;;eAAe;AACbA,EAAAA,UAAU,EAAE;AACVC,IAAAA,MAAM,EAAE,GADE;AAEVC,IAAAA,KAAK,EAAE;AAFG;AADC,C","sourcesContent":["export default {\n dimensions: {\n height: 100,\n width: 500,\n }\n};\n"],"file":"defaults.js"}
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["dimensions","height","width","predefinedAnnotations","label","text","type"],"mappings":";;;;;;eAAe;AACbA,EAAAA,UAAU,EAAE;AACVC,IAAAA,MAAM,EAAE,GADE;AAEVC,IAAAA,KAAK,EAAE;AAFG,GADC;AAKbC,EAAAA,qBAAqB,EAAE,CACrB;AACEC,IAAAA,KAAK,EAAE,MADT;AAEEC,IAAAA,IAAI,EAAE,MAFR;AAGEC,IAAAA,IAAI,EAAE;AAHR,GADqB,EAKlB;AACDF,IAAAA,KAAK,EAAE,GADN;AAEDC,IAAAA,IAAI,EAAE,GAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GALkB,EASlB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,KAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GATkB,EAalB;AACDF,IAAAA,KAAK,EAAE,UADN;AAEDC,IAAAA,IAAI,EAAE,UAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GAbkB,EAiBlB;AACDF,IAAAA,KAAK,EAAE,QADN;AAEDC,IAAAA,IAAI,EAAE,QAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GAjBkB,EAqBlB;AACDF,IAAAA,KAAK,EAAE,MADN;AAEDC,IAAAA,IAAI,EAAE,UAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GArBkB,EAyBlB;AACDF,IAAAA,KAAK,EAAE,MADN;AAEDC,IAAAA,IAAI,EAAE,YAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GAzBkB,EA6BlB;AACDF,IAAAA,KAAK,EAAE,MADN;AAEDC,IAAAA,IAAI,EAAE,gBAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GA7BkB,EAiClB;AACDF,IAAAA,KAAK,EAAE,MADN;AAEDC,IAAAA,IAAI,EAAE,aAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GAjCkB,EAqClB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,iBAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GArCkB,EAyClB;AACDF,IAAAA,KAAK,EAAE,SADN;AAEDC,IAAAA,IAAI,EAAE,SAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GAzCkB,EA6ClB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,KAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GA7CkB,EAiDlB;AACDF,IAAAA,KAAK,EAAE,IADN;AAEDC,IAAAA,IAAI,EAAE,UAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GAjDkB,EAqDlB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,gBAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GArDkB,EAyDlB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,UAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GAzDkB,EA6DlB;AACDF,IAAAA,KAAK,EAAE,KADN;AAEDC,IAAAA,IAAI,EAAE,SAFL;AAGDC,IAAAA,IAAI,EAAE;AAHL,GA7DkB;AALV,C","sourcesContent":["export default {\n dimensions: {\n height: 100,\n width: 500,\n },\n predefinedAnnotations: [\n {\n label: 'good',\n text: 'good',\n type: 'positive'\n }, {\n label: '★',\n text: '★',\n type: 'positive'\n }, {\n label: ':-)',\n text: ':-)',\n type: 'positive'\n }, {\n label: 'creative',\n text: 'creative',\n type: 'positive'\n }, {\n label: 'run-on',\n text: 'run-on',\n type: 'negative'\n }, {\n label: 'frag',\n text: 'fragment',\n type: 'negative'\n }, {\n label: 'tran',\n text: 'transition',\n type: 'negative'\n }, {\n label: 'supp',\n text: 'support needed',\n type: 'negative'\n }, {\n label: 'punc',\n text: 'punctuation',\n type: 'negative'\n }, {\n label: 'agr',\n text: 'agreement wrong',\n type: 'negative'\n }, {\n label: 'unclear',\n text: 'unclear',\n type: 'negative'\n }, {\n label: 'cut',\n text: 'cut',\n type: 'negative'\n }, {\n label: 'sp',\n text: 'spelling',\n type: 'negative'\n }, {\n label: 'cap',\n text: 'capitalization',\n type: 'negative'\n }, {\n label: 'inf',\n text: 'informal',\n type: 'negative'\n }, {\n label: 'awk',\n text: 'awkward',\n type: 'negative'\n }\n ]\n};\n"],"file":"defaults.js"}
@@ -72,13 +72,17 @@ function model(_x, _x2, _x3) {
72
72
 
73
73
  function _model() {
74
74
  _model = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(question, session, env) {
75
- var normalizedQuestion, fb, teacherInstructions, equationEditor;
75
+ var normalizedQuestion, fb, teacherInstructions, equationEditor, annotatorMode, disabledAnnotator;
76
76
  return _regenerator["default"].wrap(function _callee2$(_context2) {
77
77
  while (1) {
78
78
  switch (_context2.prev = _context2.next) {
79
79
  case 0:
80
80
  log('[question]', question);
81
+ console.log('session', session);
82
+ console.log('question', question);
83
+ console.log('env', env);
81
84
  normalizedQuestion = normalize(question);
85
+ console.log('normalizedQuestion', normalizedQuestion);
82
86
  fb = env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled ? (0, _feedback.getFeedback)(normalizedQuestion.feedback, 'Your answer has been submitted') : Promise.resolve(undefined);
83
87
  teacherInstructions = null;
84
88
 
@@ -90,43 +94,49 @@ function _model() {
90
94
 
91
95
  equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';
92
96
  _context2.t0 = normalizedQuestion.equationEditor;
93
- _context2.next = _context2.t0 === 'Grade 1 - 2' ? 9 : _context2.t0 === 'Grade 3 - 5' ? 11 : _context2.t0 === 'Grade 6 - 7' ? 13 : _context2.t0 === 'Grade 8 - HS' ? 15 : 17;
97
+ _context2.next = _context2.t0 === 'Grade 1 - 2' ? 13 : _context2.t0 === 'Grade 3 - 5' ? 15 : _context2.t0 === 'Grade 6 - 7' ? 17 : _context2.t0 === 'Grade 8 - HS' ? 19 : 21;
94
98
  break;
95
99
 
96
- case 9:
100
+ case 13:
97
101
  equationEditor = 1;
98
- return _context2.abrupt("break", 18);
102
+ return _context2.abrupt("break", 22);
99
103
 
100
- case 11:
104
+ case 15:
101
105
  equationEditor = 3;
102
- return _context2.abrupt("break", 18);
106
+ return _context2.abrupt("break", 22);
103
107
 
104
- case 13:
108
+ case 17:
105
109
  equationEditor = 6;
106
- return _context2.abrupt("break", 18);
110
+ return _context2.abrupt("break", 22);
107
111
 
108
- case 15:
112
+ case 19:
109
113
  equationEditor = 8;
110
- return _context2.abrupt("break", 18);
114
+ return _context2.abrupt("break", 22);
111
115
 
112
- case 17:
113
- return _context2.abrupt("break", 18);
116
+ case 21:
117
+ return _context2.abrupt("break", 22);
114
118
 
115
- case 18:
119
+ case 22:
120
+ annotatorMode = env.role === 'instructor' || env.mode === 'evaluate';
121
+ disabledAnnotator = env.role !== 'instructor';
116
122
  return _context2.abrupt("return", fb.then(function (feedback) {
117
123
  return {
118
124
  prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,
119
125
  dimensions: normalizedQuestion.dimensions,
120
126
  customKeys: normalizedQuestion.customKeys || [],
127
+ id: normalizedQuestion.id,
121
128
  disabled: env.mode !== 'gather',
122
129
  feedback: feedback,
123
130
  teacherInstructions: teacherInstructions,
124
131
  mathInput: normalizedQuestion.mathInput,
125
- equationEditor: equationEditor
132
+ equationEditor: equationEditor,
133
+ annotatorMode: annotatorMode,
134
+ disabledAnnotator: disabledAnnotator,
135
+ predefinedAnnotations: normalizedQuestion.predefinedAnnotations
126
136
  };
127
137
  }));
128
138
 
129
- case 19:
139
+ case 25:
130
140
  case "end":
131
141
  return _context2.stop();
132
142
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","createDefaultModel","model","defaults","normalize","question","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","session","env","normalizedQuestion","fb","mode","feedback","Promise","resolve","undefined","teacherInstructions","role","equationEditor","then","prompt","dimensions","customKeys","disabled","mathInput","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAGA;;AAEA;;;;;;AAHA,IAAMA,GAAG,GAAG,uBAAM,6CAAN,CAAZ;;SAKsBC,kB;;;;;sGAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAkCC,YAAAA,KAAlC,2DAA0C,EAA1C;AACLF,YAAAA,GAAG,CAAC,sBAAD,EAAyBE,KAAzB,CAAH;AADK,6EAIAC,oBAJA,GAKAD,KALA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AASA,IAAME,SAAS,GAAG,SAAZA,SAAY,CAAAC,QAAQ;AAAA,yCAC5BF,oBAD4B;AAE/BG,IAAAA,eAAe,EAAE,IAFc;AAG/BC,IAAAA,gBAAgB,EAAE,IAHa;AAI/BC,IAAAA,aAAa,EAAE,IAJgB;AAK/BC,IAAAA,0BAA0B,EAAE,IALG;AAM/BC,IAAAA,0BAA0B,EAAE;AANG,KAO5BL,QAP4B;AAAA,CAA1B;;;;SAWeH,K;;;;;yFAAf,kBAAqBG,QAArB,EAA+BM,OAA/B,EAAwCC,GAAxC;AAAA;AAAA;AAAA;AAAA;AAAA;AACLZ,YAAAA,GAAG,CAAC,YAAD,EAAeK,QAAf,CAAH;AACMQ,YAAAA,kBAFD,GAEsBT,SAAS,CAACC,QAAD,CAF/B;AAICS,YAAAA,EAJD,GAKHF,GAAG,CAACG,IAAJ,KAAa,UAAb,IAA2BF,kBAAkB,CAACP,eAA9C,GACI,2BAAYO,kBAAkB,CAACG,QAA/B,EAAyC,gCAAzC,CADJ,GAEIC,OAAO,CAACC,OAAR,CAAgBC,SAAhB,CAPD;AASDC,YAAAA,mBATC,GASqB,IATrB;;AAU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CF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SA+CeO,O;;;;;2FAAf;AAAA;AAAA;AAAA;AAAA;AAAA,8CACE;AACLC,cAAAA,KAAK,EAAE,CADF;AAELC,cAAAA,SAAS,EAAE,KAFN;AAGLC,cAAAA,IAAI,EAAE;AAHD,aADF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import debug from 'debug';\n\nconst log = debug('@pie-element:extended-text-entry:controller');\nimport { getFeedback } from '@pie-lib/feedback';\n\nimport defaults from './defaults';\n\nexport async function createDefaultModel(model = {}) {\n log('[createDefaultModel]', model);\n\n return {\n ...defaults,\n ...model,\n };\n}\n\nexport const normalize = question => ({\n ...defaults,\n feedbackEnabled: true,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\n\nexport async function model(question, session, env) {\n log('[question]', question);\n const normalizedQuestion = normalize(question);\n\n const fb =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? getFeedback(normalizedQuestion.feedback, 'Your answer has been submitted')\n : Promise.resolve(undefined);\n\n let teacherInstructions = null;\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n teacherInstructions = null;\n }\n\n let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';\n\n switch (normalizedQuestion.equationEditor) {\n case 'Grade 1 - 2':\n equationEditor = 1;\n break;\n case 'Grade 3 - 5':\n equationEditor = 3;\n break;\n case 'Grade 6 - 7':\n equationEditor = 6;\n break;\n case 'Grade 8 - HS':\n equationEditor = 8;\n break;\n default:\n break;\n }\n\n return fb.then(feedback => ({\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n dimensions: normalizedQuestion.dimensions,\n customKeys: normalizedQuestion.customKeys || [],\n disabled: env.mode !== 'gather',\n feedback,\n teacherInstructions,\n mathInput: normalizedQuestion.mathInput,\n equationEditor\n }));\n}\n\nexport async function outcome(/*question, session, env*/) {\n return {\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring'\n };\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","createDefaultModel","model","defaults","normalize","question","feedbackEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","session","env","console","normalizedQuestion","fb","mode","feedback","Promise","resolve","undefined","teacherInstructions","role","equationEditor","annotatorMode","disabledAnnotator","then","prompt","dimensions","customKeys","id","disabled","mathInput","predefinedAnnotations","outcome","score","completed","note"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAGA;;AAEA;;;;;;AAHA,IAAMA,GAAG,GAAG,uBAAM,6CAAN,CAAZ;;SAKsBC,kB;;;;;sGAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAkCC,YAAAA,KAAlC,2DAA0C,EAA1C;AACLF,YAAAA,GAAG,CAAC,sBAAD,EAAyBE,KAAzB,CAAH;AADK,6EAIAC,oBAJA,GAKAD,KALA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AASA,IAAME,SAAS,GAAG,SAAZA,SAAY,CAAAC,QAAQ;AAAA,yCAC5BF,oBAD4B;AAE/BG,IAAAA,eAAe,EAAE,IAFc;AAG/BC,IAAAA,gBAAgB,EAAE,IAHa;AAI/BC,IAAAA,aAAa,EAAE,IAJgB;AAK/BC,IAAAA,0BAA0B,EAAE,IALG;AAM/BC,IAAAA,0BAA0B,EAAE;AANG,KAO5BL,QAP4B;AAAA,CAA1B;;;;SAWeH,K;;;;;yFAAf,kBAAqBG,QAArB,EAA+BM,OAA/B,EAAwCC,GAAxC;AAAA;AAAA;AAAA;AAAA;AAAA;AACLZ,YAAAA,GAAG,CAAC,YAAD,EAAeK,QAAf,CAAH;AACAQ,YAAAA,OAAO,CAACb,GAAR,CAA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,IAAJ,KAAa,YAAb,IAA6BV,GAAG,CAACI,IAAJ,KAAa,UAvC3D;AAwCCS,YAAAA,iBAxCD,GAwCqBb,GAAG,CAACU,IAAJ,KAAa,YAxClC;AAAA,8CA0CEP,EAAE,CAACW,IAAH,CAAQ,UAAAT,QAAQ;AAAA,qBAAK;AAC1BU,gBAAAA,MAAM,EAAEb,kBAAkB,CAACN,aAAnB,GAAmCM,kBAAkB,CAACa,MAAtD,GAA+D,IAD7C;AAE1BC,gBAAAA,UAAU,EAAEd,kBAAkB,CAACc,UAFL;AAG1BC,gBAAAA,UAAU,EAAEf,kBAAkB,CAACe,UAAnB,IAAiC,EAHnB;AAI1BC,gBAAAA,EAAE,EAAEhB,kBAAkB,CAACgB,EAJG;AAK1BC,gBAAAA,QAAQ,EAAEnB,GAAG,CAACI,IAAJ,KAAa,QALG;AAM1BC,gBAAAA,QAAQ,EAARA,QAN0B;AAO1BI,gBAAAA,mBAAmB,EAAnBA,mBAP0B;AAQ1BW,gBAAAA,SAAS,EAAElB,kBAAkB,CAACkB,SARJ;AAS1BT,gBAAAA,cAAc,EAAdA,cAT0B;AAU1BC,gBAAAA,aAAa,EAAbA,aAV0B;AAW1BC,gBAAAA,iBAAiB,EAAjBA,iBAX0B;AAY1BQ,gBAAAA,qBAAqB,EAAEnB,kBAAkB,CAACmB;AAZhB,eAAL;AAAA,aAAhB,CA1CF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SA0DeC,O;;;;;2FAAf;AAAA;AAAA;AAAA;AAAA;AAAA,8CACE;AACLC,cAAAA,KAAK,EAAE,CADF;AAELC,cAAAA,SAAS,EAAE,KAFN;AAGLC,cAAAA,IAAI,EAAE;AAHD,aADF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import debug from 'debug';\n\nconst log = debug('@pie-element:extended-text-entry:controller');\nimport { getFeedback } from '@pie-lib/feedback';\n\nimport defaults from './defaults';\n\nexport async function createDefaultModel(model = {}) {\n log('[createDefaultModel]', model);\n\n return {\n ...defaults,\n ...model,\n };\n}\n\nexport const normalize = question => ({\n ...defaults,\n feedbackEnabled: true,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\n\nexport async function model(question, session, env) {\n log('[question]', question);\n console.log('session', session);\n console.log('question', question);\n console.log('env', env);\n const normalizedQuestion = normalize(question);\n console.log('normalizedQuestion', normalizedQuestion);\n\n const fb =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? getFeedback(normalizedQuestion.feedback, 'Your answer has been submitted')\n : Promise.resolve(undefined);\n\n let teacherInstructions = null;\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n } else {\n teacherInstructions = null;\n }\n\n let equationEditor = normalizedQuestion.equationEditor || 'miscellaneous';\n\n switch (normalizedQuestion.equationEditor) {\n case 'Grade 1 - 2':\n equationEditor = 1;\n break;\n case 'Grade 3 - 5':\n equationEditor = 3;\n break;\n case 'Grade 6 - 7':\n equationEditor = 6;\n break;\n case 'Grade 8 - HS':\n equationEditor = 8;\n break;\n default:\n break;\n }\n\n const annotatorMode = env.role === 'instructor' || env.mode === 'evaluate';\n const disabledAnnotator = env.role !== 'instructor';\n\n return fb.then(feedback => ({\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n dimensions: normalizedQuestion.dimensions,\n customKeys: normalizedQuestion.customKeys || [],\n id: normalizedQuestion.id,\n disabled: env.mode !== 'gather',\n feedback,\n teacherInstructions,\n mathInput: normalizedQuestion.mathInput,\n equationEditor,\n annotatorMode,\n disabledAnnotator,\n predefinedAnnotations: normalizedQuestion.predefinedAnnotations\n }));\n}\n\nexport async function outcome(/*question, session, env*/) {\n return {\n score: 0,\n completed: 'n/a',\n note: 'Requires manual scoring'\n };\n}\n"],"file":"index.js"}
@@ -116,6 +116,41 @@
116
116
  "type": "string",
117
117
  "title": "toolbarEditorPosition"
118
118
  },
119
+ "predefinedAnnotations": {
120
+ "description": "Indicates the predefined annotations for the annotation menu",
121
+ "type": "array",
122
+ "items": {
123
+ "title": "PredefinedAnnotation",
124
+ "type": "object",
125
+ "properties": {
126
+ "label": {
127
+ "description": "Indicates the value displayed in the annotation button",
128
+ "type": "string",
129
+ "title": "label"
130
+ },
131
+ "text": {
132
+ "description": "Indicates the annotation value",
133
+ "type": "string",
134
+ "title": "text"
135
+ },
136
+ "type": {
137
+ "description": "Indicates the type of the annotation",
138
+ "enum": [
139
+ "negative",
140
+ "positive"
141
+ ],
142
+ "type": "string",
143
+ "title": "type"
144
+ }
145
+ },
146
+ "required": [
147
+ "label",
148
+ "text",
149
+ "type"
150
+ ]
151
+ },
152
+ "title": "predefinedAnnotations"
153
+ },
119
154
  "id": {
120
155
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
121
156
  "type": "string",
@@ -212,6 +247,36 @@
212
247
  "required": [
213
248
  "type"
214
249
  ]
250
+ },
251
+ "PredefinedAnnotation": {
252
+ "title": "PredefinedAnnotation",
253
+ "type": "object",
254
+ "properties": {
255
+ "label": {
256
+ "description": "Indicates the value displayed in the annotation button",
257
+ "type": "string",
258
+ "title": "label"
259
+ },
260
+ "text": {
261
+ "description": "Indicates the annotation value",
262
+ "type": "string",
263
+ "title": "text"
264
+ },
265
+ "type": {
266
+ "description": "Indicates the type of the annotation",
267
+ "enum": [
268
+ "negative",
269
+ "positive"
270
+ ],
271
+ "type": "string",
272
+ "title": "type"
273
+ }
274
+ },
275
+ "required": [
276
+ "label",
277
+ "text",
278
+ "type"
279
+ ]
215
280
  }
216
281
  },
217
282
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -95,6 +95,31 @@ This element must be one of the following enum values:
95
95
  * `bottom`
96
96
  * `top`
97
97
 
98
+ # `predefinedAnnotations` (array)
99
+
100
+ Indicates the predefined annotations for the annotation menu
101
+
102
+ The object is an array with all elements of the type `object`.
103
+
104
+ The array object has the following properties:
105
+
106
+ ## `label` (string, required)
107
+
108
+ Indicates the value displayed in the annotation button
109
+
110
+ ## `text` (string, required)
111
+
112
+ Indicates the annotation value
113
+
114
+ ## `type` (string, enum, required)
115
+
116
+ Indicates the type of the annotation
117
+
118
+ This element must be one of the following enum values:
119
+
120
+ * `negative`
121
+ * `positive`
122
+
98
123
  # `id` (string, required)
99
124
 
100
125
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -165,4 +190,25 @@ This element must be one of the following enum values:
165
190
 
166
191
  ### `default` (string)
167
192
 
168
- Indicates the feedback value
193
+ Indicates the feedback value
194
+
195
+ ## `PredefinedAnnotation` (object)
196
+
197
+ Properties of the `PredefinedAnnotation` object:
198
+
199
+ ### `label` (string, required)
200
+
201
+ Indicates the value displayed in the annotation button
202
+
203
+ ### `text` (string, required)
204
+
205
+ Indicates the annotation value
206
+
207
+ ### `type` (string, enum, required)
208
+
209
+ Indicates the type of the annotation
210
+
211
+ This element must be one of the following enum values:
212
+
213
+ * `negative`
214
+ * `positive`