@pie-element/ebsr 10.3.14-next.0 → 10.3.14-next.11

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.
package/module/element.js CHANGED
@@ -13101,6 +13101,27 @@ const ReactDOM = _dll_react_dom;
13101
13101
  const {debounce: debounce} = _dll_lodash;
13102
13102
  const debug$1 = _dll_debug;
13103
13103
  const {renderMath: renderMath} = _dll_pie_lib__pie_toolbox_math_rendering;
13104
+ function _optionalChain$1(ops) {
13105
+ let lastAccessLHS = undefined;
13106
+ let value = ops[0];
13107
+ let i = 1;
13108
+ while (i < ops.length) {
13109
+ const op = ops[i];
13110
+ const fn = ops[i + 1];
13111
+ i += 2;
13112
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
13113
+ return undefined;
13114
+ }
13115
+ if (op === 'access' || op === 'optionalAccess') {
13116
+ lastAccessLHS = value;
13117
+ value = fn(value);
13118
+ } else if (op === 'call' || op === 'optionalCall') {
13119
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
13120
+ lastAccessLHS = undefined;
13121
+ }
13122
+ }
13123
+ return value;
13124
+ }
13104
13125
  const log$1 = debug$1('pie-ui:multiple-choice');
13105
13126
  const isComplete = (session, model, audioComplete) => {
13106
13127
  const {autoplayAudioEnabled, completeAudioEnabled} = model || ({});
@@ -13259,6 +13280,10 @@ class MultipleChoice extends HTMLElement {
13259
13280
  audio.removeEventListener('ended', handleEnded);
13260
13281
  };
13261
13282
  audio.addEventListener('ended', handleEnded);
13283
+ this._audio = audio;
13284
+ this._handlePlaying = handlePlaying;
13285
+ this._handleEnded = handleEnded;
13286
+ this._enableAudio = enableAudio;
13262
13287
  observer.disconnect();
13263
13288
  }
13264
13289
  });
@@ -13279,6 +13304,12 @@ class MultipleChoice extends HTMLElement {
13279
13304
  window.removeEventListener('keydown', this._boundHandleKeyDown);
13280
13305
  this._keyboardEventsEnabled = false;
13281
13306
  }
13307
+ document.removeEventListener('click', this._enableAudio);
13308
+ if (this._audio) {
13309
+ this._audio.removeEventListener('playing', this._handlePlaying);
13310
+ this._audio.removeEventListener('ended', this._handleEnded);
13311
+ this._audio = null;
13312
+ }
13282
13313
  }
13283
13314
  handleKeyDown(event) {
13284
13315
  if (!this._model || !this._session) {
@@ -13290,7 +13321,7 @@ class MultipleChoice extends HTMLElement {
13290
13321
  return numOffset >= 0 ? numOffset : letterOffset;
13291
13322
  };
13292
13323
  const choiceIndex = keyToIndex(event.key);
13293
- if (choiceIndex === undefined || choiceIndex >= this._model.choices.length) {
13324
+ if (choiceIndex === undefined || choiceIndex <= -1 || choiceIndex >= _optionalChain$1([this, 'access', _ => _._model, 'access', _2 => _2.choices, 'optionalAccess', _3 => _3.length])) {
13294
13325
  return;
13295
13326
  }
13296
13327
  const currentValue = this._session.value || [];
package/module/print.js CHANGED
@@ -13101,6 +13101,27 @@ const ReactDOM = _dll_react_dom;
13101
13101
  const {debounce: debounce} = _dll_lodash;
13102
13102
  const debug$1 = _dll_debug;
13103
13103
  const {renderMath: renderMath} = _dll_pie_lib__pie_toolbox_math_rendering;
13104
+ function _optionalChain(ops) {
13105
+ let lastAccessLHS = undefined;
13106
+ let value = ops[0];
13107
+ let i = 1;
13108
+ while (i < ops.length) {
13109
+ const op = ops[i];
13110
+ const fn = ops[i + 1];
13111
+ i += 2;
13112
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
13113
+ return undefined;
13114
+ }
13115
+ if (op === 'access' || op === 'optionalAccess') {
13116
+ lastAccessLHS = value;
13117
+ value = fn(value);
13118
+ } else if (op === 'call' || op === 'optionalCall') {
13119
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
13120
+ lastAccessLHS = undefined;
13121
+ }
13122
+ }
13123
+ return value;
13124
+ }
13104
13125
  const log$1 = debug$1('pie-ui:multiple-choice');
13105
13126
  const isComplete = (session, model, audioComplete) => {
13106
13127
  const {autoplayAudioEnabled, completeAudioEnabled} = model || ({});
@@ -13259,6 +13280,10 @@ class MultipleChoice extends HTMLElement {
13259
13280
  audio.removeEventListener('ended', handleEnded);
13260
13281
  };
13261
13282
  audio.addEventListener('ended', handleEnded);
13283
+ this._audio = audio;
13284
+ this._handlePlaying = handlePlaying;
13285
+ this._handleEnded = handleEnded;
13286
+ this._enableAudio = enableAudio;
13262
13287
  observer.disconnect();
13263
13288
  }
13264
13289
  });
@@ -13279,6 +13304,12 @@ class MultipleChoice extends HTMLElement {
13279
13304
  window.removeEventListener('keydown', this._boundHandleKeyDown);
13280
13305
  this._keyboardEventsEnabled = false;
13281
13306
  }
13307
+ document.removeEventListener('click', this._enableAudio);
13308
+ if (this._audio) {
13309
+ this._audio.removeEventListener('playing', this._handlePlaying);
13310
+ this._audio.removeEventListener('ended', this._handleEnded);
13311
+ this._audio = null;
13312
+ }
13282
13313
  }
13283
13314
  handleKeyDown(event) {
13284
13315
  if (!this._model || !this._session) {
@@ -13290,7 +13321,7 @@ class MultipleChoice extends HTMLElement {
13290
13321
  return numOffset >= 0 ? numOffset : letterOffset;
13291
13322
  };
13292
13323
  const choiceIndex = keyToIndex(event.key);
13293
- if (choiceIndex === undefined || choiceIndex >= this._model.choices.length) {
13324
+ if (choiceIndex === undefined || choiceIndex <= -1 || choiceIndex >= _optionalChain([this, 'access', _ => _._model, 'access', _2 => _2.choices, 'optionalAccess', _3 => _3.length])) {
13294
13325
  return;
13295
13326
  }
13296
13327
  const currentValue = this._session.value || [];
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@pie-element/ebsr",
3
- "version": "10.3.14-next.0+b4500da8f",
3
+ "version": "10.3.14-next.11+d030a51b5",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-element/multiple-choice": "^9.13.1-next.0+b4500da8f",
10
+ "@pie-element/multiple-choice": "^9.13.1-next.11+d030a51b5",
11
11
  "@pie-framework/pie-player-events": "^0.1.0",
12
12
  "@pie-lib/pie-toolbox": "2.10.0",
13
13
  "classnames": "^2.2.5",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "author": "pie framework developers",
18
18
  "license": "ISC",
19
- "gitHead": "b4500da8fabfe7df3b676439b040916dda6a9e8c",
19
+ "gitHead": "d030a51b53d7c9188f667389ee6dbac0950ede47",
20
20
  "scripts": {
21
21
  "postpublish": "../../scripts/postpublish"
22
22
  },