qti3-item-player-vue3 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1426,9 +1426,9 @@ class re {
1426
1426
  case "directedPair":
1427
1427
  case "pair":
1428
1428
  case "uri":
1429
+ case "file":
1429
1430
  return s[i] = t, s;
1430
1431
  case "intOrIdentifier":
1431
- case "file":
1432
1432
  return s[i] = null, s;
1433
1433
  default:
1434
1434
  return s[i] = null, s;
@@ -4550,10 +4550,27 @@ class aT {
4550
4550
  return this.audioElement = t, this.isPaused = !0, this.onPlayPauseClick = this.playPauseClickHandler.bind(this), this.onKeyDown = this.keydownHandler.bind(this), this.onEnded = this.endedHandler.bind(this), this;
4551
4551
  }
4552
4552
  create() {
4553
- return this.createAudioTemplate(), this;
4553
+ return this.createAudioTemplate(this.isNestedAmpAudioElement(this.audioElement)), this;
4554
+ }
4555
+ isNestedAmpAudioElement(t) {
4556
+ return t.parentNode.classList.contains("amp-audio__holder");
4557
+ }
4558
+ createAudioTemplate(t) {
4559
+ this.outerWrapper = t ? this.createNestedAmpAudioWrapper(this.audioElement) : this.createAudioWrapper(this.audioElement), this.playerContainer = this.createPlayerContainer(), this.outerWrapper.appendChild(this.playerContainer), this.addListeners();
4560
+ }
4561
+ createNestedAmpAudioWrapper(t) {
4562
+ const i = t.parentNode.parentNode;
4563
+ i.classList.add("cat-audio__wrapper");
4564
+ const s = i.querySelector(".amp-audio-captions__container");
4565
+ s != null && s.remove();
4566
+ const n = i.querySelector(".amp-audio__container");
4567
+ return n != null && n.remove(), i;
4554
4568
  }
4555
- createAudioTemplate() {
4556
- this.outerWrapper = document.createElement("div"), this.outerWrapper.classList.add("cat-audio__wrapper"), this.wrapper = document.createElement("div"), this.wrapper.classList.add("cat-audio__holder"), this.audioElement.parentNode.appendChild(this.outerWrapper), this.audioElement.setAttribute("tabindex", "-1"), this.outerWrapper.appendChild(this.wrapper), this.wrapper.appendChild(this.audioElement), this.playerContainer = this.createPlayerContainer(), this.outerWrapper.appendChild(this.playerContainer), this.addListeners();
4569
+ createAudioWrapper(t) {
4570
+ const i = document.createElement("div");
4571
+ i.classList.add("cat-audio__wrapper");
4572
+ const s = document.createElement("div");
4573
+ return s.classList.add("cat-audio__holder"), t.parentNode.appendChild(i), t.setAttribute("tabindex", "-1"), i.appendChild(s), s.appendChild(t), i;
4557
4574
  }
4558
4575
  createPlayerContainer() {
4559
4576
  const t = document.createElement("div");
@@ -4898,8 +4915,11 @@ const D = (e, t) => {
4898
4915
  createTabs(e) {
4899
4916
  this.tabs.create(e);
4900
4917
  },
4918
+ focusFirstTab() {
4919
+ this.tabs !== null && this.tabs.focusFirstTab();
4920
+ },
4901
4921
  show() {
4902
- this.state.hidden = !1, this.render(), this.state.isShown || (this.state.isShown = !0, this.center());
4922
+ this.state.hidden = !1, this.render(), this.focusFirstTab(), this.state.isShown || (this.state.isShown = !0, this.center());
4903
4923
  },
4904
4924
  hide() {
4905
4925
  this.state.hidden = !0, this.render();
@@ -5115,7 +5135,7 @@ const mT = /* @__PURE__ */ D(lT, [["render", pT]]), gT = {
5115
5135
  this.audioSubType = e, this.audioSubType === "audioprogress" && (this.showProgress = !0, this.showPlayTimer = !0, this.showVolumeMute = !0);
5116
5136
  },
5117
5137
  /**
5118
- * @description Try to detect a class of audio player that we recognoze.
5138
+ * @description Try to detect a class of audio player that we recognize.
5119
5139
  * @param {*} props - vnode props
5120
5140
  */
5121
5141
  getAudioSubType(e) {
@@ -5336,7 +5356,7 @@ function RT(e, t, i, s, n, r) {
5336
5356
  ])
5337
5357
  ]);
5338
5358
  }
5339
- const NT = /* @__PURE__ */ D(wT, [["render", RT], ["__scopeId", "data-v-b0ac2e17"]]), qT = new j(), OT = {
5359
+ const NT = /* @__PURE__ */ D(wT, [["render", RT], ["__scopeId", "data-v-a1958132"]]), qT = new j(), OT = {
5340
5360
  name: "AmpVideo",
5341
5361
  emits: [
5342
5362
  "mediaLoaded",
@@ -5740,9 +5760,13 @@ class ZT {
5740
5760
  },
5741
5761
  GLOSSARY_CLICKABLE_CLASS: "qti3-player-catalog-clickable-term",
5742
5762
  // No language specified
5743
- LANGUAGE_OFF: ""
5763
+ LANGUAGE_OFF: "",
5764
+ keys: {
5765
+ ENTER: 13,
5766
+ SPACE: 32
5767
+ }
5744
5768
  });
5745
- return this.item = t, this.itemElement = t.$refs.item, this.store = i, this.nodeList = null, this.showGlossary = this.showGlossaryHandler.bind(this), this;
5769
+ return this.item = t, this.itemElement = t.$refs.item, this.store = i, this.nodeList = null, this.showGlossary = this.showGlossaryHandler.bind(this), this.onKeyDown = this.keydownHandler.bind(this), this;
5746
5770
  }
5747
5771
  bindAll() {
5748
5772
  this.store.getCatalogs().length !== 0 && (this.resetAll(), this.nodeList = this.itemElement.querySelectorAll("[data-catalog-idref]"), this.nodeList.length !== 0 && this.bindGlossary(this.nodeList));
@@ -5791,7 +5815,7 @@ class ZT {
5791
5815
  * @param {DomElement} node
5792
5816
  */
5793
5817
  bindGlossaryDOM(t) {
5794
- t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS) || (t.classList.add(this.constants.GLOSSARY_CLICKABLE_CLASS), this.setGlossaryTerm(t), t.addEventListener("click", this.showGlossary), t.addEventListener("touchend", this.showGlossary));
5818
+ t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS) || (t.classList.add(this.constants.GLOSSARY_CLICKABLE_CLASS), t.setAttribute("tabindex", "0"), this.setGlossaryTerm(t), t.addEventListener("click", this.showGlossary), t.addEventListener("touchend", this.showGlossary), t.addEventListener("keydown", this.onKeyDown));
5795
5819
  }
5796
5820
  /**
5797
5821
  * @description This unbinds a DOM element as a clickable
@@ -5799,7 +5823,7 @@ class ZT {
5799
5823
  * @param {DomElement} node
5800
5824
  */
5801
5825
  unbindGlossaryDOM(t) {
5802
- t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS) && (t.classList.remove(this.constants.GLOSSARY_CLICKABLE_CLASS), t.removeEventListener("click", this.showGlossary), t.removeEventListener("touchend", this.showGlossary));
5826
+ t.classList.contains(this.constants.GLOSSARY_CLICKABLE_CLASS) && (t.classList.remove(this.constants.GLOSSARY_CLICKABLE_CLASS), t.setAttribute("tabindex", "-1"), t.removeEventListener("click", this.showGlossary), t.removeEventListener("touchend", this.showGlossary), t.removeEventListener("keydown", this.keyDownHandler));
5803
5827
  }
5804
5828
  /**
5805
5829
  * @description Set a data-glossary-term on a node in the DOM.
@@ -5814,6 +5838,29 @@ class ZT {
5814
5838
  t.setAttribute("data-glossary-term", t.innerText);
5815
5839
  }
5816
5840
  }
5841
+ /**
5842
+ * @description Handles a Show Glossary Click or Touch event.
5843
+ * @param {Event} event - contains the event target and
5844
+ * the data-catalog-idref
5845
+ */
5846
+ showGlossaryHandler(t) {
5847
+ t.preventDefault(), t.stopPropagation(), this.emitShowGlossaryEvent(t);
5848
+ }
5849
+ /**
5850
+ * @description Handles a Show Glossary Keydown event.
5851
+ * @param {Event} event - contains the event target and
5852
+ * the data-catalog-idref
5853
+ */
5854
+ keydownHandler(t) {
5855
+ let i = !1;
5856
+ switch (t.keyCode) {
5857
+ case this.constants.keys.SPACE:
5858
+ case this.constants.keys.ENTER:
5859
+ this.emitShowGlossaryEvent(t), i = !0;
5860
+ break;
5861
+ }
5862
+ i && (t.stopPropagation(), t.preventDefault());
5863
+ }
5817
5864
  /**
5818
5865
  * @description Does the heavy work of building a Glossary data payload.
5819
5866
  * Sends an 'itemCatalogEvent' to the parent and passes the Glossary data
@@ -5821,8 +5868,7 @@ class ZT {
5821
5868
  * @param {Event} event - contains the event target and
5822
5869
  * the data-catalog-idref
5823
5870
  */
5824
- showGlossaryHandler(t) {
5825
- t.preventDefault(), t.stopPropagation();
5871
+ emitShowGlossaryEvent(t) {
5826
5872
  const i = t.target.getAttribute("data-catalog-idref"), s = this.createGlossaryData(i);
5827
5873
  this.item.$parent.$emit("itemCatalogEvent", {
5828
5874
  type: "glossary",
@@ -11801,7 +11847,7 @@ const ow = /* @__PURE__ */ D(e_, [["render", i_]]), ap = new j(), s_ = {
11801
11847
  */
11802
11848
  getPrompts(e) {
11803
11849
  let t = [];
11804
- return e.default().forEach((i) => {
11850
+ return e.default && e.default().forEach((i) => {
11805
11851
  typeof i.type < "u" && i.type.name === "QtiPrompt" && t.push(i);
11806
11852
  }), t;
11807
11853
  },
@@ -24569,7 +24615,7 @@ const pa = new j(), mq = new re(), gq = {
24569
24615
  */
24570
24616
  getPrompts(e) {
24571
24617
  let t = [];
24572
- return e.default().forEach((i) => {
24618
+ return e.default && e.default().forEach((i) => {
24573
24619
  typeof i.type < "u" && i.type.name === "QtiPrompt" && t.push(i);
24574
24620
  }), t;
24575
24621
  },
@@ -25914,7 +25960,7 @@ const Bq = /* @__PURE__ */ D(Pq, [["render", Dq]]), Qq = new j(), Hq = {
25914
25960
  */
25915
25961
  getPrompts(e) {
25916
25962
  let t = [];
25917
- return e.default().forEach((i) => {
25963
+ return e.default && e.default().forEach((i) => {
25918
25964
  typeof i.type < "u" && i.type.name === "QtiPrompt" && t.push(i);
25919
25965
  }), t;
25920
25966
  },
@@ -26301,7 +26347,7 @@ const jq = /* @__PURE__ */ D(Hq, [["render", Gq]]), Wq = new j(), zq = {
26301
26347
  */
26302
26348
  getPrompts(e) {
26303
26349
  let t = [];
26304
- return e.default().forEach((i) => {
26350
+ return e.default && e.default().forEach((i) => {
26305
26351
  typeof i.type < "u" && i.type.name === "QtiPrompt" && t.push(i);
26306
26352
  }), t;
26307
26353
  },
@@ -26667,7 +26713,7 @@ const Zq = /* @__PURE__ */ D(zq, [["render", Xq]]), Jq = new j(), eO = {
26667
26713
  */
26668
26714
  getPrompts(e) {
26669
26715
  let t = [];
26670
- return e.default().forEach((i) => {
26716
+ return e.default && e.default().forEach((i) => {
26671
26717
  typeof i.type < "u" && i.type.name === "QtiPrompt" && t.push(i);
26672
26718
  }), t;
26673
26719
  },
@@ -27039,7 +27085,7 @@ const Hb = /* @__PURE__ */ D(rO, [["render", oO]]), Lm = new j(), lO = {
27039
27085
  */
27040
27086
  getPrompts(e) {
27041
27087
  let t = [];
27042
- return e.default().forEach((i) => {
27088
+ return e.default && e.default().forEach((i) => {
27043
27089
  typeof i.type < "u" && i.type.name === "QtiPrompt" && t.push(i);
27044
27090
  }), t;
27045
27091
  },
@@ -27421,7 +27467,7 @@ const dO = /* @__PURE__ */ D(lO, [["render", hO]]), rh = new j(), fO = {
27421
27467
  */
27422
27468
  getPrompts(e) {
27423
27469
  let t = [];
27424
- return e.default().forEach((i) => {
27470
+ return e.default && e.default().forEach((i) => {
27425
27471
  typeof i.type < "u" && i.type.name === "QtiPrompt" && t.push(i);
27426
27472
  }), t;
27427
27473
  },
@@ -27867,7 +27913,7 @@ const Mm = new j(), vO = new wO(), EO = {
27867
27913
  */
27868
27914
  getPrompts(e) {
27869
27915
  let t = [];
27870
- return e.default().forEach((i) => {
27916
+ return e.default && e.default().forEach((i) => {
27871
27917
  typeof i.type < "u" && i.type.name === "QtiPrompt" && t.push(i);
27872
27918
  }), t;
27873
27919
  },
@@ -28282,7 +28328,7 @@ const Rm = new j(), IO = {
28282
28328
  */
28283
28329
  getPrompts(e) {
28284
28330
  let t = [];
28285
- return e.default().forEach((i) => {
28331
+ return e.default && e.default().forEach((i) => {
28286
28332
  typeof i.type < "u" && i.type.name === "QtiPrompt" && t.push(i);
28287
28333
  }), t;
28288
28334
  },
@@ -28655,7 +28701,7 @@ class RO {
28655
28701
  a[o] !== null && !a[o].startsWith("http") && (s ? a[o] = `${this.getConfigurationRelativePath(t)}${a[o]}` : a[o] = `${this.getItemPathUri()}${a[o]}`);
28656
28702
  return r;
28657
28703
  } catch (n) {
28658
- return console.log((i ? "Primary" : "Fallback") + "configuration Fetch error:", n), null;
28704
+ return console.log((i ? "Primary" : "Fallback") + " Configuration Fetch error:", n), null;
28659
28705
  }
28660
28706
  }
28661
28707
  async fetchDefaultModuleResolution(t, i) {