@pie-element/passage 2.21.4-next.3 → 2.21.5-next.16

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.
@@ -199,6 +199,149 @@
199
199
  "title": "disabled"
200
200
  }
201
201
  }
202
+ },
203
+ "languageCharacters": {
204
+ "title": "EditableHtmlButtonConfigure",
205
+ "type": "object",
206
+ "properties": {
207
+ "disabled": {
208
+ "description": "Indicates if the plugin is disabled or not",
209
+ "type": "boolean",
210
+ "title": "disabled"
211
+ }
212
+ }
213
+ },
214
+ "bold": {
215
+ "title": "EditableHtmlButtonConfigure",
216
+ "type": "object",
217
+ "properties": {
218
+ "disabled": {
219
+ "description": "Indicates if the plugin is disabled or not",
220
+ "type": "boolean",
221
+ "title": "disabled"
222
+ }
223
+ }
224
+ },
225
+ "html": {
226
+ "title": "EditableHtmlButtonConfigure",
227
+ "type": "object",
228
+ "properties": {
229
+ "disabled": {
230
+ "description": "Indicates if the plugin is disabled or not",
231
+ "type": "boolean",
232
+ "title": "disabled"
233
+ }
234
+ }
235
+ },
236
+ "italic": {
237
+ "title": "EditableHtmlButtonConfigure",
238
+ "type": "object",
239
+ "properties": {
240
+ "disabled": {
241
+ "description": "Indicates if the plugin is disabled or not",
242
+ "type": "boolean",
243
+ "title": "disabled"
244
+ }
245
+ }
246
+ },
247
+ "ol_list": {
248
+ "title": "EditableHtmlButtonConfigure",
249
+ "type": "object",
250
+ "properties": {
251
+ "disabled": {
252
+ "description": "Indicates if the plugin is disabled or not",
253
+ "type": "boolean",
254
+ "title": "disabled"
255
+ }
256
+ }
257
+ },
258
+ "redo": {
259
+ "title": "EditableHtmlButtonConfigure",
260
+ "type": "object",
261
+ "properties": {
262
+ "disabled": {
263
+ "description": "Indicates if the plugin is disabled or not",
264
+ "type": "boolean",
265
+ "title": "disabled"
266
+ }
267
+ }
268
+ },
269
+ "strikethrough": {
270
+ "title": "EditableHtmlButtonConfigure",
271
+ "type": "object",
272
+ "properties": {
273
+ "disabled": {
274
+ "description": "Indicates if the plugin is disabled or not",
275
+ "type": "boolean",
276
+ "title": "disabled"
277
+ }
278
+ }
279
+ },
280
+ "sub": {
281
+ "title": "EditableHtmlButtonConfigure",
282
+ "type": "object",
283
+ "properties": {
284
+ "disabled": {
285
+ "description": "Indicates if the plugin is disabled or not",
286
+ "type": "boolean",
287
+ "title": "disabled"
288
+ }
289
+ }
290
+ },
291
+ "sup": {
292
+ "title": "EditableHtmlButtonConfigure",
293
+ "type": "object",
294
+ "properties": {
295
+ "disabled": {
296
+ "description": "Indicates if the plugin is disabled or not",
297
+ "type": "boolean",
298
+ "title": "disabled"
299
+ }
300
+ }
301
+ },
302
+ "table": {
303
+ "title": "EditableHtmlButtonConfigure",
304
+ "type": "object",
305
+ "properties": {
306
+ "disabled": {
307
+ "description": "Indicates if the plugin is disabled or not",
308
+ "type": "boolean",
309
+ "title": "disabled"
310
+ }
311
+ }
312
+ },
313
+ "ul_list": {
314
+ "title": "EditableHtmlButtonConfigure",
315
+ "type": "object",
316
+ "properties": {
317
+ "disabled": {
318
+ "description": "Indicates if the plugin is disabled or not",
319
+ "type": "boolean",
320
+ "title": "disabled"
321
+ }
322
+ }
323
+ },
324
+ "underline": {
325
+ "title": "EditableHtmlButtonConfigure",
326
+ "type": "object",
327
+ "properties": {
328
+ "disabled": {
329
+ "description": "Indicates if the plugin is disabled or not",
330
+ "type": "boolean",
331
+ "title": "disabled"
332
+ }
333
+ }
334
+ },
335
+ "undo": {
336
+ "title": "EditableHtmlButtonConfigure",
337
+ "type": "object",
338
+ "properties": {
339
+ "disabled": {
340
+ "description": "Indicates if the plugin is disabled or not",
341
+ "type": "boolean",
342
+ "title": "disabled"
343
+ }
344
+ }
202
345
  }
203
346
  }
204
347
  },
@@ -325,6 +468,149 @@
325
468
  "title": "disabled"
326
469
  }
327
470
  }
471
+ },
472
+ "languageCharacters": {
473
+ "title": "EditableHtmlButtonConfigure",
474
+ "type": "object",
475
+ "properties": {
476
+ "disabled": {
477
+ "description": "Indicates if the plugin is disabled or not",
478
+ "type": "boolean",
479
+ "title": "disabled"
480
+ }
481
+ }
482
+ },
483
+ "bold": {
484
+ "title": "EditableHtmlButtonConfigure",
485
+ "type": "object",
486
+ "properties": {
487
+ "disabled": {
488
+ "description": "Indicates if the plugin is disabled or not",
489
+ "type": "boolean",
490
+ "title": "disabled"
491
+ }
492
+ }
493
+ },
494
+ "html": {
495
+ "title": "EditableHtmlButtonConfigure",
496
+ "type": "object",
497
+ "properties": {
498
+ "disabled": {
499
+ "description": "Indicates if the plugin is disabled or not",
500
+ "type": "boolean",
501
+ "title": "disabled"
502
+ }
503
+ }
504
+ },
505
+ "italic": {
506
+ "title": "EditableHtmlButtonConfigure",
507
+ "type": "object",
508
+ "properties": {
509
+ "disabled": {
510
+ "description": "Indicates if the plugin is disabled or not",
511
+ "type": "boolean",
512
+ "title": "disabled"
513
+ }
514
+ }
515
+ },
516
+ "ol_list": {
517
+ "title": "EditableHtmlButtonConfigure",
518
+ "type": "object",
519
+ "properties": {
520
+ "disabled": {
521
+ "description": "Indicates if the plugin is disabled or not",
522
+ "type": "boolean",
523
+ "title": "disabled"
524
+ }
525
+ }
526
+ },
527
+ "redo": {
528
+ "title": "EditableHtmlButtonConfigure",
529
+ "type": "object",
530
+ "properties": {
531
+ "disabled": {
532
+ "description": "Indicates if the plugin is disabled or not",
533
+ "type": "boolean",
534
+ "title": "disabled"
535
+ }
536
+ }
537
+ },
538
+ "strikethrough": {
539
+ "title": "EditableHtmlButtonConfigure",
540
+ "type": "object",
541
+ "properties": {
542
+ "disabled": {
543
+ "description": "Indicates if the plugin is disabled or not",
544
+ "type": "boolean",
545
+ "title": "disabled"
546
+ }
547
+ }
548
+ },
549
+ "sub": {
550
+ "title": "EditableHtmlButtonConfigure",
551
+ "type": "object",
552
+ "properties": {
553
+ "disabled": {
554
+ "description": "Indicates if the plugin is disabled or not",
555
+ "type": "boolean",
556
+ "title": "disabled"
557
+ }
558
+ }
559
+ },
560
+ "sup": {
561
+ "title": "EditableHtmlButtonConfigure",
562
+ "type": "object",
563
+ "properties": {
564
+ "disabled": {
565
+ "description": "Indicates if the plugin is disabled or not",
566
+ "type": "boolean",
567
+ "title": "disabled"
568
+ }
569
+ }
570
+ },
571
+ "table": {
572
+ "title": "EditableHtmlButtonConfigure",
573
+ "type": "object",
574
+ "properties": {
575
+ "disabled": {
576
+ "description": "Indicates if the plugin is disabled or not",
577
+ "type": "boolean",
578
+ "title": "disabled"
579
+ }
580
+ }
581
+ },
582
+ "ul_list": {
583
+ "title": "EditableHtmlButtonConfigure",
584
+ "type": "object",
585
+ "properties": {
586
+ "disabled": {
587
+ "description": "Indicates if the plugin is disabled or not",
588
+ "type": "boolean",
589
+ "title": "disabled"
590
+ }
591
+ }
592
+ },
593
+ "underline": {
594
+ "title": "EditableHtmlButtonConfigure",
595
+ "type": "object",
596
+ "properties": {
597
+ "disabled": {
598
+ "description": "Indicates if the plugin is disabled or not",
599
+ "type": "boolean",
600
+ "title": "disabled"
601
+ }
602
+ }
603
+ },
604
+ "undo": {
605
+ "title": "EditableHtmlButtonConfigure",
606
+ "type": "object",
607
+ "properties": {
608
+ "disabled": {
609
+ "description": "Indicates if the plugin is disabled or not",
610
+ "type": "boolean",
611
+ "title": "disabled"
612
+ }
613
+ }
328
614
  }
329
615
  }
330
616
  },
@@ -147,6 +147,110 @@ Properties of the `h3` object:
147
147
 
148
148
  Indicates if the plugin is disabled or not
149
149
 
150
+ #### `languageCharacters` (object)
151
+
152
+ Properties of the `languageCharacters` object:
153
+
154
+ ##### `disabled` (boolean)
155
+
156
+ Indicates if the plugin is disabled or not
157
+
158
+ #### `bold` (object)
159
+
160
+ Properties of the `bold` object:
161
+
162
+ ##### `disabled` (boolean)
163
+
164
+ Indicates if the plugin is disabled or not
165
+
166
+ #### `html` (object)
167
+
168
+ Properties of the `html` object:
169
+
170
+ ##### `disabled` (boolean)
171
+
172
+ Indicates if the plugin is disabled or not
173
+
174
+ #### `italic` (object)
175
+
176
+ Properties of the `italic` object:
177
+
178
+ ##### `disabled` (boolean)
179
+
180
+ Indicates if the plugin is disabled or not
181
+
182
+ #### `ol_list` (object)
183
+
184
+ Properties of the `ol_list` object:
185
+
186
+ ##### `disabled` (boolean)
187
+
188
+ Indicates if the plugin is disabled or not
189
+
190
+ #### `redo` (object)
191
+
192
+ Properties of the `redo` object:
193
+
194
+ ##### `disabled` (boolean)
195
+
196
+ Indicates if the plugin is disabled or not
197
+
198
+ #### `strikethrough` (object)
199
+
200
+ Properties of the `strikethrough` object:
201
+
202
+ ##### `disabled` (boolean)
203
+
204
+ Indicates if the plugin is disabled or not
205
+
206
+ #### `sub` (object)
207
+
208
+ Properties of the `sub` object:
209
+
210
+ ##### `disabled` (boolean)
211
+
212
+ Indicates if the plugin is disabled or not
213
+
214
+ #### `sup` (object)
215
+
216
+ Properties of the `sup` object:
217
+
218
+ ##### `disabled` (boolean)
219
+
220
+ Indicates if the plugin is disabled or not
221
+
222
+ #### `table` (object)
223
+
224
+ Properties of the `table` object:
225
+
226
+ ##### `disabled` (boolean)
227
+
228
+ Indicates if the plugin is disabled or not
229
+
230
+ #### `ul_list` (object)
231
+
232
+ Properties of the `ul_list` object:
233
+
234
+ ##### `disabled` (boolean)
235
+
236
+ Indicates if the plugin is disabled or not
237
+
238
+ #### `underline` (object)
239
+
240
+ Properties of the `underline` object:
241
+
242
+ ##### `disabled` (boolean)
243
+
244
+ Indicates if the plugin is disabled or not
245
+
246
+ #### `undo` (object)
247
+
248
+ Properties of the `undo` object:
249
+
250
+ ##### `disabled` (boolean)
251
+
252
+ Indicates if the plugin is disabled or not
253
+
150
254
  ### `required` (boolean)
151
255
 
152
256
  Indicates if the item is required and the value cannot be empty
@@ -240,6 +344,110 @@ Properties of the `h3` object:
240
344
 
241
345
  Indicates if the plugin is disabled or not
242
346
 
347
+ ### `languageCharacters` (object)
348
+
349
+ Properties of the `languageCharacters` object:
350
+
351
+ #### `disabled` (boolean)
352
+
353
+ Indicates if the plugin is disabled or not
354
+
355
+ ### `bold` (object)
356
+
357
+ Properties of the `bold` object:
358
+
359
+ #### `disabled` (boolean)
360
+
361
+ Indicates if the plugin is disabled or not
362
+
363
+ ### `html` (object)
364
+
365
+ Properties of the `html` object:
366
+
367
+ #### `disabled` (boolean)
368
+
369
+ Indicates if the plugin is disabled or not
370
+
371
+ ### `italic` (object)
372
+
373
+ Properties of the `italic` object:
374
+
375
+ #### `disabled` (boolean)
376
+
377
+ Indicates if the plugin is disabled or not
378
+
379
+ ### `ol_list` (object)
380
+
381
+ Properties of the `ol_list` object:
382
+
383
+ #### `disabled` (boolean)
384
+
385
+ Indicates if the plugin is disabled or not
386
+
387
+ ### `redo` (object)
388
+
389
+ Properties of the `redo` object:
390
+
391
+ #### `disabled` (boolean)
392
+
393
+ Indicates if the plugin is disabled or not
394
+
395
+ ### `strikethrough` (object)
396
+
397
+ Properties of the `strikethrough` object:
398
+
399
+ #### `disabled` (boolean)
400
+
401
+ Indicates if the plugin is disabled or not
402
+
403
+ ### `sub` (object)
404
+
405
+ Properties of the `sub` object:
406
+
407
+ #### `disabled` (boolean)
408
+
409
+ Indicates if the plugin is disabled or not
410
+
411
+ ### `sup` (object)
412
+
413
+ Properties of the `sup` object:
414
+
415
+ #### `disabled` (boolean)
416
+
417
+ Indicates if the plugin is disabled or not
418
+
419
+ ### `table` (object)
420
+
421
+ Properties of the `table` object:
422
+
423
+ #### `disabled` (boolean)
424
+
425
+ Indicates if the plugin is disabled or not
426
+
427
+ ### `ul_list` (object)
428
+
429
+ Properties of the `ul_list` object:
430
+
431
+ #### `disabled` (boolean)
432
+
433
+ Indicates if the plugin is disabled or not
434
+
435
+ ### `underline` (object)
436
+
437
+ Properties of the `underline` object:
438
+
439
+ #### `disabled` (boolean)
440
+
441
+ Indicates if the plugin is disabled or not
442
+
443
+ ### `undo` (object)
444
+
445
+ Properties of the `undo` object:
446
+
447
+ #### `disabled` (boolean)
448
+
449
+ Indicates if the plugin is disabled or not
450
+
243
451
  ## `EditableHtmlButtonConfigure` (object)
244
452
 
245
453
  Properties of the `EditableHtmlButtonConfigure` object:
package/lib/index.js CHANGED
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
10
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
13
 
12
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -31,6 +33,10 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
31
33
 
32
34
  var _stimulusTabs = _interopRequireDefault(require("./stimulus-tabs"));
33
35
 
36
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
+
38
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
39
+
34
40
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
35
41
 
36
42
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -86,27 +92,18 @@ var PiePassage = /*#__PURE__*/function (_HTMLElement) {
86
92
  value: function _render() {
87
93
  var _this2 = this;
88
94
 
89
- var _this$_model = this._model,
90
- _this$_model$passages = _this$_model.passages,
91
- passages = _this$_model$passages === void 0 ? [] : _this$_model$passages,
92
- _this$_model$showTeac = _this$_model.showTeacherInstructions,
93
- showTeacherInstructions = _this$_model$showTeac === void 0 ? false : _this$_model$showTeac;
95
+ var _this$_model$passages = this._model.passages,
96
+ passages = _this$_model$passages === void 0 ? [] : _this$_model$passages;
94
97
 
95
98
  if (this._model.passages.length > 0) {
96
99
  var passagesTabs = passages.map(function (passage, index) {
97
- return {
98
- id: index,
99
- title: passage.title,
100
- subtitle: passage.subtitle,
101
- author: passage.author,
102
- text: passage.text,
103
- teacherInstructions: passage.teacherInstructions || ''
104
- };
100
+ return _objectSpread({
101
+ id: index
102
+ }, passage);
105
103
  });
106
104
 
107
105
  var elem = /*#__PURE__*/_react["default"].createElement(_stimulusTabs["default"], {
108
- tabs: passagesTabs,
109
- showTeacherInstructions: showTeacherInstructions
106
+ tabs: passagesTabs
110
107
  });
111
108
 
112
109
  _reactDom["default"].render(elem, this, function () {
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["PiePassage","_model","passages","_session","language","lang","slice","setAttribute","s","dispatchEvent","ModelSetEvent","tagName","toLowerCase","setLangAttribute","_render","showTeacherInstructions","length","passagesTabs","map","passage","index","id","title","subtitle","author","text","teacherInstructions","elem","React","createElement","StimulusTabs","tabs","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;IAEqBA,U;;;;;AACnB,wBAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAc;AACZC,MAAAA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AAGrDC,YAAAA,QAAQ,EAAEJ,OAAO,CAACI,QAHmC;AAIrDC,YAAAA,MAAM,EAAEL,OAAO,CAACK,MAJqC;AAKrDC,YAAAA,IAAI,EAAEN,OAAO,CAACM,IALuC;AAMrDC,YAAAA,mBAAmB,EAAEP,OAAO,CAACO,mBAAR,IAA+B;AANC,WAArB;AAAA,SAAb,CAArB;;AAQA,YAAMC,IAAI,gBAAGC,kBAAMC,aAAN,CAAoBC,wBAApB,EAAkC;AAC7CC,UAAAA,IAAI,EAAEd,YADuC;AAE7CF,UAAAA,uBAAuB,EAAvBA;AAF6C,SAAlC,CAAb;;AAKAiB,6BAASC,MAAT,CAAgBN,IAAhB,EAAsB,IAAtB,EAA4B;AAAA,iBAAM,yCAAW,MAAX,CAAN;AAAA,SAA5B;AACD;AACF;;;kDApDqCO,W","sourcesContent":["import { ModelSetEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport StimulusTabs from './stimulus-tabs';\n\nexport default class PiePassage extends HTMLElement {\n constructor() {\n super();\n this._model = {\n passages: [],\n };\n this._session = null;\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n }\n\n set model(s) {\n this._model = s;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));\n this.setLangAttribute();\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Passage');\n this.setAttribute('role', 'region');\n this._render();\n }\n\n _render() {\n const { passages = [], showTeacherInstructions = false } = this._model;\n\n if (this._model.passages.length > 0) {\n const passagesTabs = passages.map((passage, index) => ({\n id: index,\n title: passage.title,\n subtitle: passage.subtitle,\n author: passage.author,\n text: passage.text,\n teacherInstructions: passage.teacherInstructions || '',\n }));\n const elem = React.createElement(StimulusTabs, {\n tabs: passagesTabs,\n showTeacherInstructions,\n });\n\n ReactDOM.render(elem, this, () => renderMath(this));\n }\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["PiePassage","_model","passages","_session","language","lang","slice","setAttribute","s","dispatchEvent","ModelSetEvent","tagName","toLowerCase","setLangAttribute","_render","length","passagesTabs","map","passage","index","id","elem","React","createElement","StimulusTabs","tabs","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;IAEqBA,U;;;;;AACnB,wBAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAc;AACZC,MAAAA,QAAQ,EAAE;AADE,KAAd;AAGA,UAAKC,QAAL,GAAgB,IAAhB;AALY;AAMb;;;;WAED,4BAAmB;AACjB,UAAMC,QAAQ,GAAG,KAAKH,MAAL,6BAAsB,KAAKA,MAAL,CAAYG,QAAlC,IAA6C,KAAKH,MAAL,CAAYG,QAAzD,GAAoE,EAArF;AACA,UAAMC,IAAI,GAAGD,QAAQ,GAAGA,QAAQ,CAACE,KAAT,CAAe,CAAf,EAAkB,CAAlB,CAAH,GAA0B,IAA/C;AACA,WAAKC,YAAL,CAAkB,MAAlB,EAA0BF,IAA1B;AACD;;;SAED,aAAUG,CAAV,EAAa;AACX,WAAKP,MAAL,GAAcO,CAAd;AACA,WAAKC,aAAL,CAAmB,IAAIC,8BAAJ,CAAkB,KAAKC,OAAL,CAAaC,WAAb,EAAlB,EAA8C,KAAKT,QAAnD,EAA6D,CAAC,CAAC,KAAKF,MAApE,CAAnB;AACA,WAAKY,gBAAL;;AAEA,WAAKC,OAAL;AACD;;;SAED,aAAYN,CAAZ,EAAe;AACb,WAAKL,QAAL,GAAgBK,CAAhB;AACD;;;WAED,6BAAoB;AAClB,WAAKD,YAAL,CAAkB,YAAlB,EAAgC,SAAhC;AACA,WAAKA,YAAL,CAAkB,MAAlB,EAA0B,QAA1B;;AACA,WAAKO,OAAL;AACD;;;WAED,mBAAU;AAAA;;AACR,kCAA0B,KAAKb,MAA/B,CAAQC,QAAR;AAAA,UAAQA,QAAR,sCAAmB,EAAnB;;AAEA,UAAI,KAAKD,MAAL,CAAYC,QAAZ,CAAqBa,MAArB,GAA8B,CAAlC,EAAqC;AACnC,YAAMC,YAAY,GAAGd,QAAQ,CAACe,GAAT,CAAa,UAACC,OAAD,EAAUC,KAAV;AAAA;AAChCC,YAAAA,EAAE,EAAED;AAD4B,aAE7BD,OAF6B;AAAA,SAAb,CAArB;;AAKA,YAAMG,IAAI,gBAAGC,kBAAMC,aAAN,CAAoBC,wBAApB,EAAkC;AAC7CC,UAAAA,IAAI,EAAET;AADuC,SAAlC,CAAb;;AAIAU,6BAASC,MAAT,CAAgBN,IAAhB,EAAsB,IAAtB,EAA4B;AAAA,iBAAM,yCAAW,MAAX,CAAN;AAAA,SAA5B;AACD;AACF;;;kDAhDqCO,W","sourcesContent":["import { ModelSetEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport StimulusTabs from './stimulus-tabs';\n\nexport default class PiePassage extends HTMLElement {\n constructor() {\n super();\n this._model = {\n passages: [],\n };\n this._session = null;\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n }\n\n set model(s) {\n this._model = s;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));\n this.setLangAttribute();\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Passage');\n this.setAttribute('role', 'region');\n this._render();\n }\n\n _render() {\n const { passages = [] } = this._model;\n\n if (this._model.passages.length > 0) {\n const passagesTabs = passages.map((passage, index) => ({\n id: index,\n ...passage,\n }));\n\n const elem = React.createElement(StimulusTabs, {\n tabs: passagesTabs,\n });\n\n ReactDOM.render(elem, this, () => renderMath(this));\n }\n }\n}\n"],"file":"index.js"}
package/lib/print.js CHANGED
@@ -42,11 +42,12 @@ var preparePrintPassage = function preparePrintPassage(model, opts) {
42
42
  return model.passages.map(function (passage, index) {
43
43
  return {
44
44
  id: index,
45
- title: passage.title,
46
- subtitle: passage.subtitle,
47
- author: passage.author,
48
- text: passage.text,
49
- teacherInstructions: isInstructor && passage.teacherInstructions
45
+ teacherInstructions: model.teacherInstructionsEnabled ? isInstructor && passage.teacherInstructions || '' : '',
46
+ label: passage.title || "Passage ".concat(index + 1),
47
+ title: model.titleEnabled ? passage.title || '' : '',
48
+ author: model.authorEnabled ? passage.author || '' : '',
49
+ subtitle: model.subtitleEnabled ? passage.subtitle || '' : '',
50
+ text: model.textEnabled ? passage.text || '' : ''
50
51
  };
51
52
  });
52
53
  };
@@ -70,9 +71,8 @@ var PassagePrint = /*#__PURE__*/function (_HTMLElement) {
70
71
  var printPassage = preparePrintPassage(_this._model, _this._options);
71
72
 
72
73
  var element = /*#__PURE__*/_react["default"].createElement(_stimulusTabs["default"], {
73
- tabs: printPassage,
74
74
  disabledTabs: true,
75
- showTeacherInstructions: _this._options.role === 'instructor'
75
+ tabs: printPassage
76
76
  });
77
77
 
78
78
  _reactDom["default"].render(element, (0, _assertThisInitialized2["default"])(_this));
package/lib/print.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/print.js"],"names":["log","preparePrintPassage","model","opts","isInstructor","role","passages","map","passage","index","id","title","subtitle","author","text","teacherInstructions","PassagePrint","_model","_options","_session","_rerender","length","printPassage","element","React","createElement","StimulusTabs","tabs","disabledTabs","showTeacherInstructions","ReactDOM","render","leading","trailing","s","o","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;;AAEA,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OAAhB;AACD;AACF,OAZD,MAYO;AACLvB,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAjBc,EAkBf,EAlBe,EAmBf;AAAEgC,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KAnBe,CAAjB;AANY;AA2Bb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKjB,MAAL,GAAciB,CAAd;;AACA,WAAKd,SAAL;AACD;;;SAED,aAAYe,CAAZ,EAAe;AACb,WAAKjB,QAAL,GAAgBiB,CAAhB;AACD;;;WAED,6BAAoB,CAAE;;;kDAvCkBC,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport debug from 'debug';\n\nimport StimulusTabs from './stimulus-tabs';\n\nconst log = debug('pie-element:passage:print');\n\nconst preparePrintPassage = (model, opts) => {\n const isInstructor = opts.role === 'instructor';\n\n return model.passages.map((passage, index) => ({\n id: index,\n title: passage.title,\n subtitle: passage.subtitle,\n author: passage.author,\n text: passage.text,\n teacherInstructions: isInstructor && passage.teacherInstructions,\n }));\n};\n\nexport default class PassagePrint extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._options = null;\n this._session = [];\n\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n if (this._model.passages && this._model.passages.length > 0) {\n const printPassage = preparePrintPassage(this._model, this._options);\n\n const element = React.createElement(StimulusTabs, {\n tabs: printPassage,\n disabledTabs: true,\n showTeacherInstructions: this._options.role === 'instructor',\n });\n\n ReactDOM.render(element, this);\n }\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n set options(o) {\n this._options = o;\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
1
+ {"version":3,"sources":["../src/print.js"],"names":["log","preparePrintPassage","model","opts","isInstructor","role","passages","map","passage","index","id","teacherInstructions","teacherInstructionsEnabled","label","title","titleEnabled","author","authorEnabled","subtitle","subtitleEnabled","text","textEnabled","PassagePrint","_model","_options","_session","_rerender","length","printPassage","element","React","createElement","StimulusTabs","disabledTabs","tabs","ReactDOM","render","leading","trailing","s","o","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;;AAEA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AAC3C,MAAMC,YAAY,GAAGD,IAAI,CAACE,IAAL,KAAc,YAAnC;AAEA,SAAOH,KAAK,CAACI,QAAN,CAAeC,GAAf,CAAmB,UAACC,OAAD,EAAUC,KAAV;AAAA,WAAqB;AAC7CC,MAAAA,EAAE,EAAED,KADyC;AAE7CE,MAAAA,mBAAmB,EAAET,KAAK,CAACU,0BAAN,GAAoCR,YAAY,IAAII,OAAO,CAACG,mBAAzB,IAAiD,EAApF,GAAyF,EAFjE;AAG7CE,MAAAA,KAAK,EAAEL,OAAO,CAACM,KAAR,sBAA4BL,KAAK,GAAG,CAApC,CAHsC;AAI7CK,MAAAA,KAAK,EAAEZ,KAAK,CAACa,YAAN,GAAqBP,OAAO,CAACM,KAAR,IAAiB,EAAtC,GAA2C,EAJL;AAK7CE,MAAAA,MAAM,EAAEd,KAAK,CAACe,aAAN,GAAsBT,OAAO,CAACQ,MAAR,IAAkB,EAAxC,GAA6C,EALR;AAM7CE,MAAAA,QAAQ,EAAEhB,KAAK,CAACiB,eAAN,GAAwBX,OAAO,CAACU,QAAR,IAAoB,EAA5C,GAAiD,EANd;AAO7CE,MAAAA,IAAI,EAAElB,KAAK,CAACmB,WAAN,GAAoBb,OAAO,CAACY,IAAR,IAAgB,EAApC,GAAyC;AAPF,KAArB;AAAA,GAAnB,CAAP;AASD,CAZD;;IAcqBE,Y;;;;;AACnB,0BAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,IAAhB;AACA,UAAKC,QAAL,GAAgB,EAAhB;AAEA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKH,MAAL,IAAe,MAAKE,QAAxB,EAAkC;AAChC,YAAI,MAAKF,MAAL,CAAYjB,QAAZ,IAAwB,MAAKiB,MAAL,CAAYjB,QAAZ,CAAqBqB,MAArB,GAA8B,CAA1D,EAA6D;AAC3D,cAAMC,YAAY,GAAG3B,mBAAmB,CAAC,MAAKsB,MAAN,EAAc,MAAKC,QAAnB,CAAxC;;AAEA,cAAMK,OAAO,gBAAGC,kBAAMC,aAAN,CAAoBC,wBAApB,EAAkC;AAChDC,YAAAA,YAAY,EAAE,IADkC;AAEhDC,YAAAA,IAAI,EAAEN;AAF0C,WAAlC,CAAhB;;AAKAO,+BAASC,MAAT,CAAgBP,OAAhB;AACD;AACF,OAXD,MAWO;AACL7B,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAhBc,EAiBf,EAjBe,EAkBf;AAAEqC,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KAlBe,CAAjB;AANY;AA0Bb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKhB,MAAL,GAAcgB,CAAd;;AACA,WAAKb,SAAL;AACD;;;SAED,aAAYc,CAAZ,EAAe;AACb,WAAKhB,QAAL,GAAgBgB,CAAhB;AACD;;;WAED,6BAAoB,CAAE;;;kDAtCkBC,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport debug from 'debug';\n\nimport StimulusTabs from './stimulus-tabs';\n\nconst log = debug('pie-element:passage:print');\n\nconst preparePrintPassage = (model, opts) => {\n const isInstructor = opts.role === 'instructor';\n\n return model.passages.map((passage, index) => ({\n id: index,\n teacherInstructions: model.teacherInstructionsEnabled ? (isInstructor && passage.teacherInstructions) || '' : '',\n label: passage.title || `Passage ${index + 1}`,\n title: model.titleEnabled ? passage.title || '' : '',\n author: model.authorEnabled ? passage.author || '' : '',\n subtitle: model.subtitleEnabled ? passage.subtitle || '' : '',\n text: model.textEnabled ? passage.text || '' : '',\n }));\n};\n\nexport default class PassagePrint extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._options = null;\n this._session = [];\n\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n if (this._model.passages && this._model.passages.length > 0) {\n const printPassage = preparePrintPassage(this._model, this._options);\n\n const element = React.createElement(StimulusTabs, {\n disabledTabs: true,\n tabs: printPassage,\n });\n\n ReactDOM.render(element, this);\n }\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n set options(o) {\n this._options = o;\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}