@pie-element/extended-text-entry 6.8.0 → 6.8.1-beta.1445

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.
@@ -35,6 +35,43 @@
35
35
  }
36
36
  }
37
37
  },
38
+ "settingsPanelDisabled": {
39
+ "description": "Indicates if the settings panel is not available",
40
+ "type": "boolean",
41
+ "title": "settingsPanelDisabled"
42
+ },
43
+ "spanishInput": {
44
+ "title": "ConfigureProp",
45
+ "type": "object",
46
+ "properties": {
47
+ "settings": {
48
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
49
+ "type": "boolean",
50
+ "title": "settings"
51
+ },
52
+ "label": {
53
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
54
+ "type": "string",
55
+ "title": "label"
56
+ }
57
+ }
58
+ },
59
+ "specialInput": {
60
+ "title": "ConfigureProp",
61
+ "type": "object",
62
+ "properties": {
63
+ "settings": {
64
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
65
+ "type": "boolean",
66
+ "title": "settings"
67
+ },
68
+ "label": {
69
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
70
+ "type": "string",
71
+ "title": "label"
72
+ }
73
+ }
74
+ },
38
75
  "multiple": {
39
76
  "title": "ConfigurePropWithEnabled",
40
77
  "type": "object",
@@ -88,6 +125,38 @@
88
125
  }
89
126
  }
90
127
  },
128
+ "spellCheck": {
129
+ "title": "ConfigureProp",
130
+ "type": "object",
131
+ "properties": {
132
+ "settings": {
133
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
134
+ "type": "boolean",
135
+ "title": "settings"
136
+ },
137
+ "label": {
138
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
139
+ "type": "string",
140
+ "title": "label"
141
+ }
142
+ }
143
+ },
144
+ "playerSpellCheck": {
145
+ "title": "ConfigureProp",
146
+ "type": "object",
147
+ "properties": {
148
+ "settings": {
149
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
150
+ "type": "boolean",
151
+ "title": "settings"
152
+ },
153
+ "label": {
154
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
155
+ "type": "string",
156
+ "title": "label"
157
+ }
158
+ }
159
+ },
91
160
  "dimensions": {
92
161
  "title": "ConfigureProp",
93
162
  "type": "object",
@@ -104,6 +173,69 @@
104
173
  }
105
174
  }
106
175
  },
176
+ "maxImageWidth": {
177
+ "title": "ConfigureMaxImageDimensionsProp",
178
+ "type": "object",
179
+ "properties": {
180
+ "teacherInstructions": {
181
+ "description": "Indicates the max dimension for images in teacher instructions",
182
+ "type": "number",
183
+ "title": "teacherInstructions"
184
+ },
185
+ "prompt": {
186
+ "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",
187
+ "type": "number",
188
+ "title": "prompt"
189
+ },
190
+ "rationale": {
191
+ "description": "Indicates the max dimension for images in rationale",
192
+ "type": "number",
193
+ "title": "rationale"
194
+ }
195
+ }
196
+ },
197
+ "maxImageHeight": {
198
+ "title": "ConfigureMaxImageDimensionsProp",
199
+ "type": "object",
200
+ "properties": {
201
+ "teacherInstructions": {
202
+ "description": "Indicates the max dimension for images in teacher instructions",
203
+ "type": "number",
204
+ "title": "teacherInstructions"
205
+ },
206
+ "prompt": {
207
+ "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",
208
+ "type": "number",
209
+ "title": "prompt"
210
+ },
211
+ "rationale": {
212
+ "description": "Indicates the max dimension for images in rationale",
213
+ "type": "number",
214
+ "title": "rationale"
215
+ }
216
+ }
217
+ },
218
+ "withRubric": {
219
+ "title": "ConfigureWithForceProp",
220
+ "type": "object",
221
+ "properties": {
222
+ "settings": {
223
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
224
+ "type": "boolean",
225
+ "title": "settings"
226
+ },
227
+ "label": {
228
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
229
+ "type": "string",
230
+ "title": "label"
231
+ },
232
+ "forceEnabled": {
233
+ "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
234
+ "type": "boolean",
235
+ "title": "forceEnabled"
236
+ }
237
+ }
238
+ },
107
239
  "showPrompt": {
108
240
  "description": "Determines whether prompt field will be displayed or not",
109
241
  "default": true,
@@ -160,6 +292,48 @@
160
292
  "title": "enabled"
161
293
  }
162
294
  }
295
+ },
296
+ "ConfigureMaxImageDimensionsProp": {
297
+ "title": "ConfigureMaxImageDimensionsProp",
298
+ "type": "object",
299
+ "properties": {
300
+ "teacherInstructions": {
301
+ "description": "Indicates the max dimension for images in teacher instructions",
302
+ "type": "number",
303
+ "title": "teacherInstructions"
304
+ },
305
+ "prompt": {
306
+ "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",
307
+ "type": "number",
308
+ "title": "prompt"
309
+ },
310
+ "rationale": {
311
+ "description": "Indicates the max dimension for images in rationale",
312
+ "type": "number",
313
+ "title": "rationale"
314
+ }
315
+ }
316
+ },
317
+ "ConfigureWithForceProp": {
318
+ "title": "ConfigureWithForceProp",
319
+ "type": "object",
320
+ "properties": {
321
+ "settings": {
322
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
323
+ "type": "boolean",
324
+ "title": "settings"
325
+ },
326
+ "label": {
327
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
328
+ "type": "string",
329
+ "title": "label"
330
+ },
331
+ "forceEnabled": {
332
+ "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
333
+ "type": "boolean",
334
+ "title": "forceEnabled"
335
+ }
336
+ }
163
337
  }
164
338
  },
165
339
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -26,6 +26,34 @@ Indicates if the item has to be displayed in the Settings Panel
26
26
 
27
27
  Indicates the label for the item that has to be displayed in the Settings Panel
28
28
 
29
+ # `settingsPanelDisabled` (boolean)
30
+
31
+ Indicates if the settings panel is not available
32
+
33
+ # `spanishInput` (object)
34
+
35
+ Properties of the `spanishInput` object:
36
+
37
+ ## `settings` (boolean)
38
+
39
+ Indicates if the item has to be displayed in the Settings Panel
40
+
41
+ ## `label` (string)
42
+
43
+ Indicates the label for the item that has to be displayed in the Settings Panel
44
+
45
+ # `specialInput` (object)
46
+
47
+ Properties of the `specialInput` object:
48
+
49
+ ## `settings` (boolean)
50
+
51
+ Indicates if the item has to be displayed in the Settings Panel
52
+
53
+ ## `label` (string)
54
+
55
+ Indicates the label for the item that has to be displayed in the Settings Panel
56
+
29
57
  # `multiple` (object)
30
58
 
31
59
  Properties of the `multiple` object:
@@ -67,6 +95,30 @@ Indicates if the item has to be displayed in the Settings Panel
67
95
 
68
96
  Indicates the label for the item that has to be displayed in the Settings Panel
69
97
 
98
+ # `spellCheck` (object)
99
+
100
+ Properties of the `spellCheck` object:
101
+
102
+ ## `settings` (boolean)
103
+
104
+ Indicates if the item has to be displayed in the Settings Panel
105
+
106
+ ## `label` (string)
107
+
108
+ Indicates the label for the item that has to be displayed in the Settings Panel
109
+
110
+ # `playerSpellCheck` (object)
111
+
112
+ Properties of the `playerSpellCheck` object:
113
+
114
+ ## `settings` (boolean)
115
+
116
+ Indicates if the item has to be displayed in the Settings Panel
117
+
118
+ ## `label` (string)
119
+
120
+ Indicates the label for the item that has to be displayed in the Settings Panel
121
+
70
122
  # `dimensions` (object)
71
123
 
72
124
  Properties of the `dimensions` object:
@@ -79,6 +131,54 @@ Indicates if the item has to be displayed in the Settings Panel
79
131
 
80
132
  Indicates the label for the item that has to be displayed in the Settings Panel
81
133
 
134
+ # `maxImageWidth` (object)
135
+
136
+ Properties of the `maxImageWidth` object:
137
+
138
+ ## `teacherInstructions` (number)
139
+
140
+ Indicates the max dimension for images in teacher instructions
141
+
142
+ ## `prompt` (number)
143
+
144
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
145
+
146
+ ## `rationale` (number)
147
+
148
+ Indicates the max dimension for images in rationale
149
+
150
+ # `maxImageHeight` (object)
151
+
152
+ Properties of the `maxImageHeight` object:
153
+
154
+ ## `teacherInstructions` (number)
155
+
156
+ Indicates the max dimension for images in teacher instructions
157
+
158
+ ## `prompt` (number)
159
+
160
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
161
+
162
+ ## `rationale` (number)
163
+
164
+ Indicates the max dimension for images in rationale
165
+
166
+ # `withRubric` (object)
167
+
168
+ Properties of the `withRubric` object:
169
+
170
+ ## `settings` (boolean)
171
+
172
+ Indicates if the item has to be displayed in the Settings Panel
173
+
174
+ ## `label` (string)
175
+
176
+ Indicates the label for the item that has to be displayed in the Settings Panel
177
+
178
+ ## `forceEnabled` (boolean)
179
+
180
+ Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
181
+
82
182
  # `showPrompt` (boolean)
83
183
 
84
184
  Determines whether prompt field will be displayed or not
@@ -130,4 +230,36 @@ Indicates the label for the item that has to be displayed in the Settings Panel
130
230
  ### `enabled` (boolean)
131
231
 
132
232
  Indicates the value of the item if it affects config-ui
133
- (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
233
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
234
+
235
+ ## `ConfigureMaxImageDimensionsProp` (object)
236
+
237
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
238
+
239
+ ### `teacherInstructions` (number)
240
+
241
+ Indicates the max dimension for images in teacher instructions
242
+
243
+ ### `prompt` (number)
244
+
245
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
246
+
247
+ ### `rationale` (number)
248
+
249
+ Indicates the max dimension for images in rationale
250
+
251
+ ## `ConfigureWithForceProp` (object)
252
+
253
+ Properties of the `ConfigureWithForceProp` object:
254
+
255
+ ### `settings` (boolean)
256
+
257
+ Indicates if the item has to be displayed in the Settings Panel
258
+
259
+ ### `label` (string)
260
+
261
+ Indicates the label for the item that has to be displayed in the Settings Panel
262
+
263
+ ### `forceEnabled` (boolean)
264
+
265
+ Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
@@ -1,7 +1,7 @@
1
1
  const { model } = require('./generate');
2
2
  module.exports = {
3
3
  elements: {
4
- 'extended-text-entry': '../..'
4
+ 'extended-text-entry': '../..',
5
5
  },
6
- models: [model('1', 'extended-text-entry')]
6
+ models: [model('1', 'extended-text-entry')],
7
7
  };
@@ -1,12 +1,13 @@
1
1
  exports.model = (id, element) => ({
2
2
  id,
3
3
  element,
4
- customKeys: [
5
- '\\square'
6
- ],
4
+ customKeys: ['\\square'],
7
5
  feedback: { type: 'default', default: 'this is default feedback' },
8
6
  prompt: 'This is the question prompt',
9
7
  promptEnabled: true,
10
8
  mathInput: true,
9
+ playersToolbarPosition: 'bottom',
11
10
  toolbarEditorPosition: 'bottom',
11
+ spellCheckEnabled: true,
12
+ rubricEnabled: false,
12
13
  });
@@ -1,3 +1,3 @@
1
1
  <div class="body">
2
2
  <extended-text-entry pie-id="1"></extended-text-entry>
3
- </div>
3
+ </div>
@@ -3,5 +3,5 @@ module.exports = [
3
3
  id: '1',
4
4
  element: 'extended-text-entry',
5
5
  // value: 'This is test'
6
- }
6
+ },
7
7
  ];
@@ -63,6 +63,18 @@
63
63
  "type": "boolean",
64
64
  "title": "mathInput"
65
65
  },
66
+ "spanishInput": {
67
+ "description": "Whether a control to allow insertion of spanish characters should be displayed",
68
+ "default": false,
69
+ "type": "boolean",
70
+ "title": "spanishInput"
71
+ },
72
+ "specialInput": {
73
+ "description": "Whether a control to allow insertion of special characters should be displayed",
74
+ "default": false,
75
+ "type": "boolean",
76
+ "title": "specialInput"
77
+ },
66
78
  "multiple": {
67
79
  "description": "Indicates if multiple parts are enabled",
68
80
  "type": "boolean",
@@ -98,6 +110,16 @@
98
110
  "type": "boolean",
99
111
  "title": "rationaleEnabled"
100
112
  },
113
+ "spellCheckEnabled": {
114
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
115
+ "type": "boolean",
116
+ "title": "spellCheckEnabled"
117
+ },
118
+ "playerSpellCheckDisabled": {
119
+ "description": "Indicates if spellcheck is disabled for the player. Default value is true",
120
+ "type": "boolean",
121
+ "title": "playerSpellCheckDisabled"
122
+ },
101
123
  "studentInstructionsEnabled": {
102
124
  "description": "Indicates if Student Instructions are enabled",
103
125
  "type": "boolean",
@@ -116,6 +138,21 @@
116
138
  "type": "string",
117
139
  "title": "toolbarEditorPosition"
118
140
  },
141
+ "playersToolbarPosition": {
142
+ "description": "Indicates the editor's toolbar position for the player, which can be 'bottom' or 'top'",
143
+ "default": ": 'bottom'",
144
+ "enum": [
145
+ "bottom",
146
+ "top"
147
+ ],
148
+ "type": "string",
149
+ "title": "playersToolbarPosition"
150
+ },
151
+ "rubricEnabled": {
152
+ "description": "Indicates if Rubric is enabled",
153
+ "type": "boolean",
154
+ "title": "rubricEnabled"
155
+ },
119
156
  "id": {
120
157
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
121
158
  "type": "string",
@@ -132,7 +169,10 @@
132
169
  "element",
133
170
  "feedbackEnabled",
134
171
  "id",
172
+ "playerSpellCheckDisabled",
135
173
  "rationaleEnabled",
174
+ "rubricEnabled",
175
+ "spellCheckEnabled",
136
176
  "studentInstructionsEnabled",
137
177
  "teacherInstructionsEnabled"
138
178
  ],
@@ -174,6 +214,48 @@
174
214
  }
175
215
  }
176
216
  },
217
+ "ConfigureMaxImageDimensionsProp": {
218
+ "title": "ConfigureMaxImageDimensionsProp",
219
+ "type": "object",
220
+ "properties": {
221
+ "teacherInstructions": {
222
+ "description": "Indicates the max dimension for images in teacher instructions",
223
+ "type": "number",
224
+ "title": "teacherInstructions"
225
+ },
226
+ "prompt": {
227
+ "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",
228
+ "type": "number",
229
+ "title": "prompt"
230
+ },
231
+ "rationale": {
232
+ "description": "Indicates the max dimension for images in rationale",
233
+ "type": "number",
234
+ "title": "rationale"
235
+ }
236
+ }
237
+ },
238
+ "ConfigureWithForceProp": {
239
+ "title": "ConfigureWithForceProp",
240
+ "type": "object",
241
+ "properties": {
242
+ "settings": {
243
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
244
+ "type": "boolean",
245
+ "title": "settings"
246
+ },
247
+ "label": {
248
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
249
+ "type": "string",
250
+ "title": "label"
251
+ },
252
+ "forceEnabled": {
253
+ "description": "Indicates the value for the toggle; if true, this property will not be visible in Settings Panel",
254
+ "type": "boolean",
255
+ "title": "forceEnabled"
256
+ }
257
+ }
258
+ },
177
259
  "Dimensions": {
178
260
  "title": "Dimensions",
179
261
  "type": "object",
@@ -52,6 +52,18 @@ Whether a control to allow insertion of math forumulas should be displayed
52
52
 
53
53
  Default: `false`
54
54
 
55
+ # `spanishInput` (boolean)
56
+
57
+ Whether a control to allow insertion of spanish characters should be displayed
58
+
59
+ Default: `false`
60
+
61
+ # `specialInput` (boolean)
62
+
63
+ Whether a control to allow insertion of special characters should be displayed
64
+
65
+ Default: `false`
66
+
55
67
  # `multiple` (boolean)
56
68
 
57
69
  Indicates if multiple parts are enabled
@@ -80,6 +92,14 @@ Indicates if Feedback is enabled
80
92
 
81
93
  Indicates if Rationale are enabled
82
94
 
95
+ # `spellCheckEnabled` (boolean, required)
96
+
97
+ Indicates if spellcheck is enabled for the author. Default value is true
98
+
99
+ # `playerSpellCheckDisabled` (boolean, required)
100
+
101
+ Indicates if spellcheck is disabled for the player. Default value is true
102
+
83
103
  # `studentInstructionsEnabled` (boolean, required)
84
104
 
85
105
  Indicates if Student Instructions are enabled
@@ -95,6 +115,21 @@ This element must be one of the following enum values:
95
115
  * `bottom`
96
116
  * `top`
97
117
 
118
+ # `playersToolbarPosition` (string, enum)
119
+
120
+ Indicates the editor's toolbar position for the player, which can be 'bottom' or 'top'
121
+
122
+ This element must be one of the following enum values:
123
+
124
+ * `bottom`
125
+ * `top`
126
+
127
+ Default: `": 'bottom'"`
128
+
129
+ # `rubricEnabled` (boolean, required)
130
+
131
+ Indicates if Rubric is enabled
132
+
98
133
  # `id` (string, required)
99
134
 
100
135
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -138,6 +173,38 @@ Indicates the label for the item that has to be displayed in the Settings Panel
138
173
  Indicates the value of the item if it affects config-ui
139
174
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
140
175
 
176
+ ## `ConfigureMaxImageDimensionsProp` (object)
177
+
178
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
179
+
180
+ ### `teacherInstructions` (number)
181
+
182
+ Indicates the max dimension for images in teacher instructions
183
+
184
+ ### `prompt` (number)
185
+
186
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
187
+
188
+ ### `rationale` (number)
189
+
190
+ Indicates the max dimension for images in rationale
191
+
192
+ ## `ConfigureWithForceProp` (object)
193
+
194
+ Properties of the `ConfigureWithForceProp` object:
195
+
196
+ ### `settings` (boolean)
197
+
198
+ Indicates if the item has to be displayed in the Settings Panel
199
+
200
+ ### `label` (string)
201
+
202
+ Indicates the label for the item that has to be displayed in the Settings Panel
203
+
204
+ ### `forceEnabled` (boolean)
205
+
206
+ Indicates the value for the toggle; if true, this property will not be visible in Settings Panel
207
+
141
208
  ## `Dimensions` (object)
142
209
 
143
210
  Properties of the `Dimensions` object:
package/lib/index.js CHANGED
@@ -5,9 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.textContent = textContent;
9
- exports.isComplete = isComplete;
10
8
  exports["default"] = void 0;
9
+ exports.isComplete = isComplete;
10
+ exports.textContent = textContent;
11
11
 
12
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
13
 
@@ -29,6 +29,8 @@ var _react = _interopRequireDefault(require("react"));
29
29
 
30
30
  var _reactDom = _interopRequireDefault(require("react-dom"));
31
31
 
32
+ var _mathRendering = require("@pie-lib/math-rendering");
33
+
32
34
  var _piePlayerEvents = require("@pie-framework/pie-player-events");
33
35
 
34
36
  var _debug = _interopRequireDefault(require("debug"));
@@ -89,6 +91,9 @@ var RootExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
89
91
  }
90
92
  }, {
91
93
  key: "session",
94
+ get: function get() {
95
+ return this._session;
96
+ },
92
97
  set: function set(s) {
93
98
  this._session = s;
94
99
  this.render();
@@ -107,6 +112,8 @@ var RootExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
107
112
  }, {
108
113
  key: "render",
109
114
  value: function render() {
115
+ var _this2 = this;
116
+
110
117
  if (this._model && this._session) {
111
118
  var elem = /*#__PURE__*/_react["default"].createElement(_main["default"], {
112
119
  model: this._model,
@@ -114,7 +121,9 @@ var RootExtendedTextEntry = /*#__PURE__*/function (_HTMLElement) {
114
121
  onChange: this.handleChange.bind(this)
115
122
  });
116
123
 
117
- _reactDom["default"].render(elem, this);
124
+ _reactDom["default"].render(elem, this, function () {
125
+ (0, _mathRendering.renderMath)(_this2);
126
+ });
118
127
  }
119
128
  }
120
129
  }]);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["log","domParser","window","undefined","DOMParser","parseFromString","v","textContent","value","document","body","err","isComplete","tc","out","length","RootExtendedTextEntry","_model","_session","m","dispatchEvent","ModelSetEvent","tagName","toLowerCase","render","s","SessionChangedEvent","elem","React","createElement","Main","model","session","onChange","handleChange","bind","ReactDOM","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAIA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;AAEA,IAAMC,SAAS,GACb,QAAOC,MAAP,0DAAOA,MAAP,OAAkBC,SAAlB,GAA8B,IAAIC,SAAJ,EAA9B,GAAgD;AAAEC,EAAAA,eAAe,EAAE,yBAAAC,CAAC;AAAA,WAAIA,CAAJ;AAAA;AAApB,CADlD;;AAGO,SAASC,WAAT,CAAqBC,KAArB,EAA4B;AACjC,MAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B,WAAOL,SAAP;AACD;;AACD,MAAI;AACF,QAAMM,QAAQ,GAAGR,SAAS,CAACI,eAAV,CAA0BG,KAA1B,EAAiC,WAAjC,CAAjB;AACA,QAAMD,YAAW,GAAGE,QAAQ,CAACC,IAAT,CAAcH,WAAlC;AACA,WAAOA,YAAP;AACD,GAJD,CAIE,OAAOI,GAAP,EAAY;AACZX,IAAAA,GAAG,CAAC,kCAAD,EAAqCQ,KAArC,CAAH;AACA,WAAOA,KAAP;AACD;AACF;;AAEM,SAASI,UAAT,CAAoBJ,KAApB,EAA2B;AAChC,MAAMK,EAAE,GAAGN,WAAW,CAACC,KAAD,CAAtB;AACA,MAAMM,GAAG,GAAGD,EAAE,KAAKV,SAAP,IAAoBU,EAAE,CAACE,MAAH,GAAY,CAA5C;AACA,SAAOD,GAAP;AACD;;IAEoBE,qB;;;;;AACnB,mCAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,IAAhB;AAHY;AAIb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKF,MAAL,GAAcE,CAAd;AACA,WAAKC,aAAL,CACE,IAAIC,8BAAJ,CAAkB,KAAKC,OAAL,CAAaC,WAAb,EAAlB,EAA8C,KAA9C,EAAqD,CAAC,CAAC,KAAKN,MAA5D,CADF;AAIA,WAAKO,MAAL;AACD;;;SAED,aAAYC,CAAZ,EAAe;AACb,WAAKP,QAAL,GAAgBO,CAAhB;AACA,WAAKD,MAAL;AACD;;;WAED,sBAAahB,KAAb,EAAoB;AAClB,WAAKU,QAAL,CAAcV,KAAd,GAAsBA,KAAtB;AAEA,WAAKY,aAAL,CACE,IAAIM,oCAAJ,CAAwB,KAAKJ,OAAL,CAAaC,WAAb,EAAxB,EAAoDX,UAAU,CAACJ,KAAD,CAA9D,CADF;AAGD;;;WAED,6BAAoB;AAClB,WAAKgB,MAAL;AACD;;;WAED,kBAAS;AACP,UAAI,KAAKP,MAAL,IAAe,KAAKC,QAAxB,EAAkC;AAChC,YAAIS,IAAI,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,UAAAA,KAAK,EAAE,KAAKd,MADuB;AAEnCe,UAAAA,OAAO,EAAE,KAAKd,QAFqB;AAGnCe,UAAAA,QAAQ,EAAE,KAAKC,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB;AAHyB,SAA1B,CAAX;;AAKAC,6BAASZ,MAAT,CAAgBG,IAAhB,EAAsB,IAAtB;AACD;AACF;;;kDA1CgDU,W","sourcesContent":["import Main from './main';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport {\n ModelSetEvent,\n SessionChangedEvent\n} from '@pie-framework/pie-player-events';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst domParser =\n typeof window !== undefined ? new DOMParser() : { parseFromString: v => v };\n\nexport function textContent(value) {\n if (typeof value !== 'string') {\n return undefined;\n }\n try {\n const document = domParser.parseFromString(value, 'text/html');\n const textContent = document.body.textContent;\n return textContent;\n } catch (err) {\n log('tried to parse as dom and failed', value);\n return value;\n }\n}\n\nexport function isComplete(value) {\n const tc = textContent(value);\n const out = tc !== undefined && tc.length > 0;\n return out;\n}\n\nexport default class RootExtendedTextEntry extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), false, !!this._model)\n );\n\n this.render();\n }\n\n set session(s) {\n this._session = s;\n this.render();\n }\n\n handleChange(value) {\n this._session.value = value;\n\n this.dispatchEvent(\n new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value))\n );\n }\n\n connectedCallback() {\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onChange: this.handleChange.bind(this)\n });\n ReactDOM.render(elem, this);\n }\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["log","domParser","window","undefined","DOMParser","parseFromString","v","textContent","value","document","body","err","isComplete","tc","out","length","RootExtendedTextEntry","_model","_session","m","dispatchEvent","ModelSetEvent","tagName","toLowerCase","render","s","SessionChangedEvent","elem","React","createElement","Main","model","session","onChange","handleChange","bind","ReactDOM","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;AAEA,IAAMC,SAAS,GAAG,QAAOC,MAAP,0DAAOA,MAAP,OAAkBC,SAAlB,GAA8B,IAAIC,SAAJ,EAA9B,GAAgD;AAAEC,EAAAA,eAAe,EAAE,yBAACC,CAAD;AAAA,WAAOA,CAAP;AAAA;AAAnB,CAAlE;;AAEO,SAASC,WAAT,CAAqBC,KAArB,EAA4B;AACjC,MAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7B,WAAOL,SAAP;AACD;;AACD,MAAI;AACF,QAAMM,QAAQ,GAAGR,SAAS,CAACI,eAAV,CAA0BG,KAA1B,EAAiC,WAAjC,CAAjB;AACA,QAAMD,YAAW,GAAGE,QAAQ,CAACC,IAAT,CAAcH,WAAlC;AACA,WAAOA,YAAP;AACD,GAJD,CAIE,OAAOI,GAAP,EAAY;AACZX,IAAAA,GAAG,CAAC,kCAAD,EAAqCQ,KAArC,CAAH;AACA,WAAOA,KAAP;AACD;AACF;;AAEM,SAASI,UAAT,CAAoBJ,KAApB,EAA2B;AAChC,MAAMK,EAAE,GAAGN,WAAW,CAACC,KAAD,CAAtB;AACA,MAAMM,GAAG,GAAGD,EAAE,KAAKV,SAAP,IAAoBU,EAAE,CAACE,MAAH,GAAY,CAA5C;AACA,SAAOD,GAAP;AACD;;IAEoBE,qB;;;;;AACnB,mCAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,IAAhB;AAHY;AAIb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKF,MAAL,GAAcE,CAAd;AACA,WAAKC,aAAL,CAAmB,IAAIC,8BAAJ,CAAkB,KAAKC,OAAL,CAAaC,WAAb,EAAlB,EAA8C,KAA9C,EAAqD,CAAC,CAAC,KAAKN,MAA5D,CAAnB;AAEA,WAAKO,MAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAKN,QAAZ;AACD,K;SAPD,aAAYO,CAAZ,EAAe;AACb,WAAKP,QAAL,GAAgBO,CAAhB;AACA,WAAKD,MAAL;AACD;;;WAMD,sBAAahB,KAAb,EAAoB;AAClB,WAAKU,QAAL,CAAcV,KAAd,GAAsBA,KAAtB;AAEA,WAAKY,aAAL,CAAmB,IAAIM,oCAAJ,CAAwB,KAAKJ,OAAL,CAAaC,WAAb,EAAxB,EAAoDX,UAAU,CAACJ,KAAD,CAA9D,CAAnB;AACD;;;WAED,6BAAoB;AAClB,WAAKgB,MAAL;AACD;;;WAED,kBAAS;AAAA;;AACP,UAAI,KAAKP,MAAL,IAAe,KAAKC,QAAxB,EAAkC;AAChC,YAAIS,IAAI,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,UAAAA,KAAK,EAAE,KAAKd,MADuB;AAEnCe,UAAAA,OAAO,EAAE,KAAKd,QAFqB;AAGnCe,UAAAA,QAAQ,EAAE,KAAKC,YAAL,CAAkBC,IAAlB,CAAuB,IAAvB;AAHyB,SAA1B,CAAX;;AAMAC,6BAASZ,MAAT,CAAgBG,IAAhB,EAAsB,IAAtB,EAA4B,YAAM;AAChC,yCAAW,MAAX;AACD,SAFD;AAGD;AACF;;;kDA7CgDU,W","sourcesContent":["import Main from './main';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:extended-text-entry');\n\nconst domParser = typeof window !== undefined ? new DOMParser() : { parseFromString: (v) => v };\n\nexport function textContent(value) {\n if (typeof value !== 'string') {\n return undefined;\n }\n try {\n const document = domParser.parseFromString(value, 'text/html');\n const textContent = document.body.textContent;\n return textContent;\n } catch (err) {\n log('tried to parse as dom and failed', value);\n return value;\n }\n}\n\nexport function isComplete(value) {\n const tc = textContent(value);\n const out = tc !== undefined && tc.length > 0;\n return out;\n}\n\nexport default class RootExtendedTextEntry extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), false, !!this._model));\n\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 handleChange(value) {\n this._session.value = value;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), isComplete(value)));\n }\n\n connectedCallback() {\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n let elem = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onChange: this.handleChange.bind(this),\n });\n\n ReactDOM.render(elem, this, () => {\n renderMath(this);\n });\n }\n }\n}\n"],"file":"index.js"}