@1024pix/epreuves-components 1.4.5 → 1.5.1

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.
Files changed (30) hide show
  1. package/dist/LLMMessage.ce-CcaSmq0J.js +96 -0
  2. package/dist/Loading.ce-kO02LfAR.js +14 -0
  3. package/dist/NavigationButton.ce-BUeEdL4x.js +98 -0
  4. package/dist/{_plugin-vue_export-helper-CwwQJ1m6.js → _plugin-vue_export-helper-BGEtPlxS.js} +1373 -1355
  5. package/dist/components/calcul-impact.ce.js.js +91 -85
  6. package/dist/components/capacity-calculation.ce.js.js +117 -111
  7. package/dist/components/clickable-image.ce.js.js +83 -59
  8. package/dist/components/complete-phrase.ce.js.js +57 -51
  9. package/dist/components/flip-cards.ce.js.js +43 -46
  10. package/dist/components/image-quiz.ce.js.js +6 -4
  11. package/dist/components/image-quizzes.ce.js.js +18 -14
  12. package/dist/components/llm-compare-messages.ce.js.js +17 -17
  13. package/dist/components/llm-messages.ce.js.js +17 -17
  14. package/dist/components/llm-prompt-select.ce.js.js +37 -32
  15. package/dist/components/message-conversation.ce.js.js +61 -52
  16. package/dist/components/pix-article.ce.js.js +26 -20
  17. package/dist/components/pix-carousel.ce.js.js +142 -134
  18. package/dist/components/pix-cursor.ce.js.js +62 -62
  19. package/dist/components/qcm-deepfake.ce.js.js +97 -91
  20. package/dist/{i18n-gncqQJ0G.js → i18n-D3E2CT0o.js} +44 -40
  21. package/dist/image-quiz.ce-Qe3SbGDF.js +141 -0
  22. package/dist/index.js +1 -1
  23. package/dist/normalize-props-AlmAfi_u.js +13 -0
  24. package/dist/schema.js +8 -9
  25. package/dist/{shadow-dom-MxYtPVXS.js → shadow-dom-Bqt3ZRMI.js} +1 -1
  26. package/package.json +1 -1
  27. package/dist/ImageQuiz.ce-BLOWdEiw.js +0 -123
  28. package/dist/LLMMessage.ce-DnZ8kE2i.js +0 -89
  29. package/dist/Loading.ce-FI776zdC.js +0 -14
  30. package/dist/NavigationButton.ce-gp04deGY.js +0 -98
@@ -1,27 +1,27 @@
1
- import { s as Le, n as we, a as ve, i as Re } from "./_plugin-vue_export-helper-CwwQJ1m6.js";
1
+ import { s as Le, n as we, d as ve, i as Re } from "./_plugin-vue_export-helper-BGEtPlxS.js";
2
2
  const d = (o) => typeof o == "string", V = () => {
3
3
  let o, e;
4
4
  const t = new Promise((i, s) => {
5
5
  o = i, e = s;
6
6
  });
7
7
  return t.resolve = o, t.reject = e, t;
8
- }, te = (o) => o == null ? "" : "" + o, Ce = (o, e, t) => {
8
+ }, se = (o) => o == null ? "" : "" + o, Ce = (o, e, t) => {
9
9
  o.forEach((i) => {
10
10
  e[i] && (t[i] = e[i]);
11
11
  });
12
- }, Pe = /###/g, se = (o) => o && o.indexOf("###") > -1 ? o.replace(Pe, ".") : o, ie = (o) => !o || d(o), A = (o, e, t) => {
12
+ }, Pe = /###/g, ie = (o) => o && o.indexOf("###") > -1 ? o.replace(Pe, ".") : o, ne = (o) => !o || d(o), A = (o, e, t) => {
13
13
  const i = d(e) ? e.split(".") : e;
14
14
  let s = 0;
15
15
  for (; s < i.length - 1; ) {
16
- if (ie(o)) return {};
17
- const n = se(i[s]);
16
+ if (ne(o)) return {};
17
+ const n = ie(i[s]);
18
18
  !o[n] && t && (o[n] = new t()), Object.prototype.hasOwnProperty.call(o, n) ? o = o[n] : o = {}, ++s;
19
19
  }
20
- return ie(o) ? {} : {
20
+ return ne(o) ? {} : {
21
21
  obj: o,
22
- k: se(i[s])
22
+ k: ie(i[s])
23
23
  };
24
- }, ne = (o, e, t) => {
24
+ }, re = (o, e, t) => {
25
25
  const {
26
26
  obj: i,
27
27
  k: s
@@ -87,7 +87,7 @@ const je = [" ", ",", "?", "!", ";"], Ie = new Fe(20), Te = (o, e, t) => {
87
87
  r > 0 && !s.test(o.substring(0, r)) && (n = !0);
88
88
  }
89
89
  return n;
90
- }, Q = (o, e, t = ".") => {
90
+ }, G = (o, e, t = ".") => {
91
91
  if (!o) return;
92
92
  if (o[e])
93
93
  return Object.prototype.hasOwnProperty.call(o, e) ? o[e] : void 0;
@@ -185,7 +185,7 @@ class W {
185
185
  });
186
186
  }
187
187
  }
188
- class re extends W {
188
+ class ae extends W {
189
189
  constructor(e, t = {
190
190
  ns: ["translation"],
191
191
  defaultNS: "translation"
@@ -204,14 +204,14 @@ class re extends W {
204
204
  let a;
205
205
  e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t], i && (Array.isArray(i) ? a.push(...i) : d(i) && n ? a.push(...i.split(n)) : a.push(i)));
206
206
  const l = B(this.data, a);
207
- return !l && !t && !i && e.indexOf(".") > -1 && (e = a[0], t = a[1], i = a.slice(2).join(".")), l || !r || !d(i) ? l : Q(this.data?.[e]?.[t], i, n);
207
+ return !l && !t && !i && e.indexOf(".") > -1 && (e = a[0], t = a[1], i = a.slice(2).join(".")), l || !r || !d(i) ? l : G(this.data?.[e]?.[t], i, n);
208
208
  }
209
209
  addResource(e, t, i, s, n = {
210
210
  silent: !1
211
211
  }) {
212
212
  const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator;
213
213
  let a = [e, t];
214
- i && (a = a.concat(r ? i.split(r) : i)), e.indexOf(".") > -1 && (a = e.split("."), s = t, t = a[1]), this.addNamespaces(t), ne(this.data, a, s), n.silent || this.emit("added", e, t, i, s);
214
+ i && (a = a.concat(r ? i.split(r) : i)), e.indexOf(".") > -1 && (a = e.split("."), s = t, t = a[1]), this.addNamespaces(t), re(this.data, a, s), n.silent || this.emit("added", e, t, i, s);
215
215
  }
216
216
  addResources(e, t, i, s = {
217
217
  silent: !1
@@ -232,7 +232,7 @@ class re extends W {
232
232
  r.skipCopy || (i = JSON.parse(JSON.stringify(i))), s ? me(l, i, n) : l = {
233
233
  ...l,
234
234
  ...i
235
- }, ne(this.data, a, l), r.silent || this.emit("added", e, t, i);
235
+ }, re(this.data, a, l), r.silent || this.emit("added", e, t, i);
236
236
  }
237
237
  removeResourceBundle(e, t) {
238
238
  this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
@@ -271,13 +271,13 @@ function Ke() {
271
271
  let t;
272
272
  return e.get = (i, s) => (t?.revoke?.(), s === ye ? o : (o.push(s), t = Proxy.revocable(i, e), t.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
273
273
  }
274
- function G(o, e) {
274
+ function Z(o, e) {
275
275
  const {
276
276
  [ye]: t
277
277
  } = o(Ke());
278
278
  return t.join(e?.keySeparator ?? ".");
279
279
  }
280
- const ae = {}, oe = (o) => !d(o) && typeof o != "boolean" && typeof o != "number";
280
+ const oe = {}, Y = (o) => !d(o) && typeof o != "boolean" && typeof o != "number";
281
281
  class _ extends W {
282
282
  constructor(e, t = {}) {
283
283
  super(), Ce(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = P.create("translator");
@@ -291,7 +291,11 @@ class _ extends W {
291
291
  const i = {
292
292
  ...t
293
293
  };
294
- return e == null ? !1 : this.resolve(e, i)?.res !== void 0;
294
+ if (e == null) return !1;
295
+ const s = this.resolve(e, i);
296
+ if (s?.res === void 0) return !1;
297
+ const n = Y(s.res);
298
+ return !(i.returnObjects === !1 && n);
295
299
  }
296
300
  extractFromKey(e, t) {
297
301
  let i = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
@@ -321,7 +325,7 @@ class _ extends W {
321
325
  if (typeof s != "object" && this.options.overloadTranslationOptionHandler && (s = this.options.overloadTranslationOptionHandler(arguments)), typeof s == "object" && (s = {
322
326
  ...s
323
327
  }), s || (s = {}), e == null) return "";
324
- typeof e == "function" && (e = G(e, {
328
+ typeof e == "function" && (e = Z(e, {
325
329
  ...this.options,
326
330
  ...s
327
331
  })), Array.isArray(e) || (e = [String(e)]);
@@ -352,10 +356,10 @@ class _ extends W {
352
356
  let c = g?.res;
353
357
  const x = g?.usedKey || a, S = g?.exactUsedKey || a, L = ["[object Number]", "[object Function]", "[object RegExp]"], y = s.joinArrays !== void 0 ? s.joinArrays : this.options.joinArrays, E = !this.i18nFormat || this.i18nFormat.handleAsObject, O = s.count !== void 0 && !d(s.count), N = _.hasDefaultValue(s), j = O ? this.pluralResolver.getSuffix(f, s.count, s) : "", I = s.ordinal && O ? this.pluralResolver.getSuffix(f, s.count, {
354
358
  ordinal: !1
355
- }) : "", Z = O && !s.ordinal && s.count === 0, k = Z && s[`defaultValue${this.options.pluralSeparator}zero`] || s[`defaultValue${j}`] || s[`defaultValue${I}`] || s.defaultValue;
359
+ }) : "", X = O && !s.ordinal && s.count === 0, k = X && s[`defaultValue${this.options.pluralSeparator}zero`] || s[`defaultValue${j}`] || s[`defaultValue${I}`] || s.defaultValue;
356
360
  let v = c;
357
361
  E && !c && N && (v = k);
358
- const be = oe(v), Oe = Object.prototype.toString.apply(v);
362
+ const be = Y(v), Oe = Object.prototype.toString.apply(v);
359
363
  if (E && v && be && L.indexOf(Oe) < 0 && !(d(y) && Array.isArray(v))) {
360
364
  if (!s.returnObjects && !this.options.returnObjects) {
361
365
  this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
@@ -366,13 +370,13 @@ class _ extends W {
366
370
  return n ? (g.res = R, g.usedParams = this.getUsedParamsDetails(s), g) : R;
367
371
  }
368
372
  if (r) {
369
- const R = Array.isArray(v), w = R ? [] : {}, X = R ? S : x;
373
+ const R = Array.isArray(v), w = R ? [] : {}, q = R ? S : x;
370
374
  for (const C in v)
371
375
  if (Object.prototype.hasOwnProperty.call(v, C)) {
372
- const $ = `${X}${r}${C}`;
376
+ const $ = `${q}${r}${C}`;
373
377
  N && !c ? w[C] = this.translate($, {
374
378
  ...s,
375
- defaultValue: oe(k) ? k[C] : void 0,
379
+ defaultValue: Y(k) ? k[C] : void 0,
376
380
  joinArrays: !1,
377
381
  ns: l
378
382
  }) : w[C] = this.translate($, {
@@ -403,16 +407,16 @@ class _ extends W {
403
407
  for (let b = 0; b < H.length; b++)
404
408
  D.push(H[b]);
405
409
  else this.options.saveMissingTo === "all" ? D = this.languageUtils.toResolveHierarchy(s.lng || this.language) : D.push(s.lng || this.language);
406
- const q = (b, F, K) => {
407
- const ee = N && K !== c ? K : C;
408
- this.options.missingKeyHandler ? this.options.missingKeyHandler(b, u, F, ee, $, s) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(b, u, F, ee, $, s), this.emit("missingKey", b, u, F, c);
410
+ const ee = (b, F, K) => {
411
+ const te = N && K !== c ? K : C;
412
+ this.options.missingKeyHandler ? this.options.missingKeyHandler(b, u, F, te, $, s) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(b, u, F, te, $, s), this.emit("missingKey", b, u, F, c);
409
413
  };
410
414
  this.options.saveMissing && (this.options.saveMissingPlurals && O ? D.forEach((b) => {
411
415
  const F = this.pluralResolver.getSuffixes(b, s);
412
- Z && s[`defaultValue${this.options.pluralSeparator}zero`] && F.indexOf(`${this.options.pluralSeparator}zero`) < 0 && F.push(`${this.options.pluralSeparator}zero`), F.forEach((K) => {
413
- q([b], a + K, s[`defaultValue${K}`] || k);
416
+ X && s[`defaultValue${this.options.pluralSeparator}zero`] && F.indexOf(`${this.options.pluralSeparator}zero`) < 0 && F.push(`${this.options.pluralSeparator}zero`), F.forEach((K) => {
417
+ ee([b], a + K, s[`defaultValue${K}`] || k);
414
418
  });
415
- }) : q(D, a, k));
419
+ }) : ee(D, a, k));
416
420
  }
417
421
  c = this.extendTranslation(c, e, s, g, i), w && c === a && this.options.appendNamespaceToMissingKey && (c = `${u}${h}${a}`), (w || R) && this.options.parseMissingKeyHandler && (c = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${h}${a}` : a, R ? c : void 0, s));
418
422
  }
@@ -469,7 +473,7 @@ class _ extends W {
469
473
  this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
470
474
  const p = t.count !== void 0 && !d(t.count), g = p && !t.ordinal && t.count === 0, c = t.context !== void 0 && (d(t.context) || typeof t.context == "number") && t.context !== "", x = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
471
475
  f.forEach((S) => {
472
- this.isValidLookup(i) || (a = S, !ae[`${x[0]}-${S}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(a) && (ae[`${x[0]}-${S}`] = !0, this.logger.warn(`key "${s}" for languages "${x.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), x.forEach((L) => {
476
+ this.isValidLookup(i) || (a = S, !oe[`${x[0]}-${S}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(a) && (oe[`${x[0]}-${S}`] = !0, this.logger.warn(`key "${s}" for languages "${x.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), x.forEach((L) => {
473
477
  if (this.isValidLookup(i)) return;
474
478
  r = L;
475
479
  const y = [h];
@@ -652,8 +656,8 @@ class Ve {
652
656
  }
653
657
  const he = (o, e, t, i = ".", s = !0) => {
654
658
  let n = Ne(o, e, t);
655
- return !n && s && d(t) && (n = Q(o, t, i), n === void 0 && (n = Q(e, t, i))), n;
656
- }, Y = (o) => o.replace(/\$/g, "$$$$");
659
+ return !n && s && d(t) && (n = G(o, t, i), n === void 0 && (n = G(e, t, i))), n;
660
+ }, Q = (o) => o.replace(/\$/g, "$$$$");
657
661
  class Ae {
658
662
  constructor(e = {}) {
659
663
  this.logger = P.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((t) => t), this.init(e);
@@ -712,10 +716,10 @@ class Ae {
712
716
  const h = s?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = s?.interpolation?.skipOnVariables !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
713
717
  return [{
714
718
  regex: this.regexpUnescape,
715
- safeValue: (g) => Y(g)
719
+ safeValue: (g) => Q(g)
716
720
  }, {
717
721
  regex: this.regexp,
718
- safeValue: (g) => this.escapeValue ? Y(this.escape(g)) : Y(g)
722
+ safeValue: (g) => this.escapeValue ? Q(this.escape(g)) : Q(g)
719
723
  }].forEach((g) => {
720
724
  for (a = 0; n = g.regex.exec(e); ) {
721
725
  const c = n[1].trim();
@@ -730,7 +734,7 @@ class Ae {
730
734
  continue;
731
735
  } else
732
736
  this.logger.warn(`missed to pass in variable ${c} for interpolating ${e}`), r = "";
733
- else !d(r) && !this.useRawValueToEscape && (r = te(r));
737
+ else !d(r) && !this.useRawValueToEscape && (r = se(r));
734
738
  const x = g.safeValue(r);
735
739
  if (e = e.replace(n[0], x), f ? (g.regex.lastIndex += r.length, g.regex.lastIndex -= n[0].length) : g.regex.lastIndex = 0, a++, a >= this.maxReplaces)
736
740
  break;
@@ -764,7 +768,7 @@ class Ae {
764
768
  }, r = r.replace && !d(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
765
769
  const u = /{.*}/.test(s[1]) ? s[1].lastIndexOf("}") + 1 : s[1].indexOf(this.formatSeparator);
766
770
  if (u !== -1 && (l = s[1].slice(u).split(this.formatSeparator).map((h) => h.trim()).filter(Boolean), s[1] = s[1].slice(0, u)), n = t(a.call(this, s[1].trim(), r), r), n && s[0] === e && !d(n)) return n;
767
- d(n) || (n = te(n)), n || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), n = ""), l.length && (n = l.reduce((h, f) => this.format(h, f, i.lng, {
771
+ d(n) || (n = se(n)), n || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), n = ""), l.length && (n = l.reduce((h, f) => this.format(h, f, i.lng, {
768
772
  ...i,
769
773
  interpolationkey: s[1].trim()
770
774
  }), n.trim())), e = e.replace(s[0], n), this.regexp.lastIndex = 0;
@@ -1107,7 +1111,7 @@ class M extends W {
1107
1111
  let u;
1108
1112
  this.modules.formatter ? u = this.modules.formatter : u = He;
1109
1113
  const h = new le(this.options);
1110
- this.store = new re(this.options.resources, this.options);
1114
+ this.store = new ae(this.options.resources, this.options);
1111
1115
  const f = this.services;
1112
1116
  f.logger = P, f.resourceStore = this.store, f.languageUtils = h, f.pluralResolver = new Ve(h, {
1113
1117
  prepend: this.options.pluralSeparator,
@@ -1205,10 +1209,10 @@ class M extends W {
1205
1209
  }, l.lng = l.lng || s.lng, l.lngs = l.lngs || s.lngs, l.ns = l.ns || s.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || i || s.keyPrefix);
1206
1210
  const u = this.options.keySeparator || ".";
1207
1211
  let h;
1208
- return l.keyPrefix && Array.isArray(n) ? h = n.map((f) => (typeof f == "function" && (f = G(f, {
1212
+ return l.keyPrefix && Array.isArray(n) ? h = n.map((f) => (typeof f == "function" && (f = Z(f, {
1209
1213
  ...this.options,
1210
1214
  ...r
1211
- })), `${l.keyPrefix}${u}${f}`)) : (typeof n == "function" && (n = G(n, {
1215
+ })), `${l.keyPrefix}${u}${f}`)) : (typeof n == "function" && (n = Z(n, {
1212
1216
  ...this.options,
1213
1217
  ...r
1214
1218
  })), h = l.keyPrefix ? `${l.keyPrefix}${u}${n}` : n), this.t(h, l);
@@ -1293,7 +1297,7 @@ class M extends W {
1293
1297
  }, l[u] = Object.keys(l[u]).reduce((h, f) => (h[f] = {
1294
1298
  ...l[u][f]
1295
1299
  }, h), l[u]), l), {});
1296
- n.store = new re(a, s), n.services.resourceStore = n.store;
1300
+ n.store = new ae(a, s), n.services.resourceStore = n.store;
1297
1301
  }
1298
1302
  return n.translator = new _(n.services, s), n.translator.on("*", (a, ...l) => {
1299
1303
  n.emit(a, ...l);
@@ -1411,7 +1415,7 @@ var Ye = ve({
1411
1415
  const Qe = "translation";
1412
1416
  async function et(o) {
1413
1417
  for (const [e, t] of Object.entries(o)) {
1414
- const i = e.match(/\/(\w+)\.json$/)[1];
1418
+ const i = e.match(/\/([^/]+)\.json$/)[1];
1415
1419
  await Ge(i, t);
1416
1420
  }
1417
1421
  }
@@ -0,0 +1,141 @@
1
+ import { d as B, r as I, J as N, c as g, o as u, H as x, q as p, G as f, D as b, f as h, m as T, t as $, _ as P, k as d, K as E, g as F, F as k, a as H, b as K, e as L } from "./_plugin-vue_export-helper-BGEtPlxS.js";
2
+ import { u as A, a as D } from "./normalize-props-AlmAfi_u.js";
3
+ function R(e, s = G) {
4
+ const a = [...e];
5
+ for (let o = a.length - 1; o > 0; o--) {
6
+ const l = s() % (o + 1);
7
+ [a[o], a[l]] = [a[l], a[o]];
8
+ }
9
+ return a;
10
+ }
11
+ function G() {
12
+ return Math.floor(Math.random() * 2 ** 32);
13
+ }
14
+ const J = ["aria-labelledby", "aria-selected", "tabindex"], V = { key: 0 }, U = ["id"], W = ["id"], X = /* @__PURE__ */ B({
15
+ __name: "ImageOption.ce",
16
+ props: {
17
+ choice: { type: Object },
18
+ maxChoicesPerLine: { type: Number },
19
+ imageClass: { type: String },
20
+ nameClass: { type: String },
21
+ selected: { type: Boolean },
22
+ tabFocusable: { type: Boolean }
23
+ },
24
+ emits: ["toggle", "next", "previous"],
25
+ setup(e, { expose: s }) {
26
+ const a = e, o = I();
27
+ function l() {
28
+ o.value.focus();
29
+ }
30
+ s({ focus: l });
31
+ const n = N();
32
+ return (c, t) => (u(), g("div", {
33
+ ref_key: "el",
34
+ ref: o,
35
+ role: "option",
36
+ class: b(["image-option", `image-option--max${a.maxChoicesPerLine}`]),
37
+ "aria-labelledby": f(n),
38
+ "aria-selected": e.selected,
39
+ tabindex: e.tabFocusable ? 0 : -1,
40
+ onClick: t[0] || (t[0] = p((r) => c.$emit("toggle"), ["stop"])),
41
+ onKeydown: [
42
+ t[1] || (t[1] = x(p((r) => c.$emit("toggle"), ["stop", "prevent"]), ["space"])),
43
+ t[2] || (t[2] = x(p((r) => c.$emit("previous"), ["stop", "prevent"]), ["up", "left"])),
44
+ t[3] || (t[3] = x(p((r) => c.$emit("next"), ["stop", "prevent"]), ["down", "right"]))
45
+ ]
46
+ }, [
47
+ e.choice.image ? (u(), g("figure", V, [
48
+ h("img", T(e.choice.image, {
49
+ class: e.imageClass,
50
+ alt: ""
51
+ }), null, 16),
52
+ h("figcaption", {
53
+ class: b(e.nameClass),
54
+ id: f(n)
55
+ }, $(e.choice.name), 11, U)
56
+ ])) : (u(), g("span", {
57
+ key: 1,
58
+ id: f(n)
59
+ }, $(e.choice.name), 9, W))
60
+ ], 42, J));
61
+ }
62
+ }), Y = '.image-option{display:flex;position:relative;flex-direction:column;align-items:center;justify-content:center;margin:.5rem;border:solid 2px #c1c7d0;border-radius:10px;background:#fff;width:calc(20% - 2em);min-width:150px;padding:1rem}.image-option--max4{width:calc(25% - 2em);min-width:175px}.image-option--max3{width:calc(33% - 2em)}.image-option--max2{width:calc(50% - 2em);min-width:300px}.image-option--max1{width:calc(100% - 4em);min-width:300px}.image-option:hover{cursor:pointer;box-shadow:0 3px 10px #0000001a;transform:scale(1.04);transition:transform ease-in .1s}.image-option:focus{outline:none;box-shadow:5px 5px #ffbe00,-5px 5px #ffbe00,5px -5px #ffbe00,-5px -5px #ffbe00}.image-option[aria-selected=true]{border-color:#3d68ff}.image-option[aria-selected=true]:after{content:"";position:absolute;width:calc(100% + 2px);height:calc(100% + 2px);background:#3d68ff4d;border-radius:10px;z-index:3}.image-option figure{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;margin:0;text-align:center;width:100%}.image-option figure img{max-width:100%;height:auto}.image-option figure img.icon{max-height:100px;width:auto}.image-option figure img.medium{max-width:50%;height:auto}.image-option figure figcaption{margin:1ex}', Z = /* @__PURE__ */ P(X, [["styles", [Y]]]), _ = ["id", "innerHTML"], ee = ["aria-multiselectable", "aria-labelledby"], ie = /* @__PURE__ */ B({
63
+ __name: "ImageQuiz.ce",
64
+ props: {
65
+ multiple: { type: Boolean, default: !1 },
66
+ choices: { type: Array },
67
+ maxChoicesPerLine: { default: 5, type: Number },
68
+ name: { type: String },
69
+ hideChoicesName: { type: Boolean },
70
+ orderChoices: { type: Boolean },
71
+ imageChoicesSize: { default: "icon", type: String },
72
+ showName: { type: Boolean, default: !1 }
73
+ },
74
+ emits: ["answer"],
75
+ setup(e, { emit: s }) {
76
+ const a = s, o = d(() => e.hideChoicesName ? "sr-only" : ""), l = d(() => e.orderChoices ? e.choices : R(e.choices)), n = I(new Array(e.choices.length).fill(!1)), c = d(() => l.value.filter((i, C) => n.value[C])), t = d(() => c.value.map((i) => i.response ?? i.name).sort().join(",")), r = N();
77
+ E(t, () => {
78
+ a("answer", t.value);
79
+ }, { immediate: !1 });
80
+ const O = d(() => {
81
+ const i = n.value.indexOf(!0);
82
+ return i === -1 ? 0 : i;
83
+ }), y = F("options");
84
+ function w(i) {
85
+ e.multiple || n.value.fill(!1), n.value[i] = !n.value[i];
86
+ }
87
+ function v(i) {
88
+ i = (i + e.choices.length) % e.choices.length, e.multiple || w(i), y.value[i].focus();
89
+ }
90
+ return (i, C) => (u(), g(k, null, [
91
+ h("label", {
92
+ id: f(r),
93
+ class: b(["image-quiz-label", { "sr-only": !e.showName }]),
94
+ innerHTML: e.name
95
+ }, null, 10, _),
96
+ h("div", {
97
+ role: "listbox",
98
+ class: "image-quiz",
99
+ "aria-multiselectable": e.multiple,
100
+ "aria-labelledby": f(r),
101
+ "aria-orientation": "horizontal"
102
+ }, [
103
+ (u(!0), g(k, null, H(l.value, (Q, m) => (u(), K(Z, {
104
+ ref_for: !0,
105
+ ref_key: "options",
106
+ ref: y,
107
+ choice: Q,
108
+ "max-choices-per-line": e.maxChoicesPerLine,
109
+ key: m,
110
+ "name-class": o.value,
111
+ "image-class": e.imageChoicesSize,
112
+ selected: n.value[m],
113
+ "tab-focusable": m === O.value,
114
+ onToggle: (z) => w(m),
115
+ onNext: (z) => v(m + 1),
116
+ onPrevious: (z) => v(m - 1)
117
+ }, null, 8, ["choice", "max-choices-per-line", "name-class", "image-class", "selected", "tab-focusable", "onToggle", "onNext", "onPrevious"]))), 128))
118
+ ], 8, ee)
119
+ ], 64));
120
+ }
121
+ }), te = "*{box-sizing:border-box}.image-quiz-label{font-size:1.25rem;margin:1rem 0;display:inline-block}.image-quiz{display:flex;flex-wrap:wrap;justify-content:space-around}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);border:0}", j = /* @__PURE__ */ P(ie, [["styles", [te]]]);
122
+ function S(e) {
123
+ return {
124
+ ...e,
125
+ maxChoicesPerLine: A(e.maxChoicesPerLine),
126
+ choices: e.choices.map((s) => ({
127
+ ...s,
128
+ image: D(s.image)
129
+ }))
130
+ };
131
+ }
132
+ const q = L(j);
133
+ q.prototype.normalizeProps = S;
134
+ window.customElements.define("image-quiz", q);
135
+ const M = L(j);
136
+ M.prototype.normalizeProps = S;
137
+ window.customElements.define("qcu-image", M);
138
+ export {
139
+ j as I,
140
+ S as n
141
+ };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import "./components/capacity-calculation.ce.js.js";
3
3
  import "./components/clickable-image.ce.js.js";
4
4
  import "./components/complete-phrase.ce.js.js";
5
5
  import "./components/flip-cards.ce.js.js";
6
- import "./components/image-quiz.ce.js.js";
6
+ import "./image-quiz.ce-Qe3SbGDF.js";
7
7
  import "./components/image-quizzes.ce.js.js";
8
8
  import "./components/message-conversation.ce.js.js";
9
9
  import "./components/pix-article.ce.js.js";
@@ -0,0 +1,13 @@
1
+ function u(n) {
2
+ return n === 0 ? void 0 : n;
3
+ }
4
+ function r(n) {
5
+ if (n) {
6
+ for (const e of Object.values(n))
7
+ if (e) return n;
8
+ }
9
+ }
10
+ export {
11
+ r as a,
12
+ u
13
+ };
package/dist/schema.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import e from "joi";
2
2
  const o = e.object({
3
- titleLevel: e.number().required()
3
+ titleLevel: e.number().optional()
4
4
  }), a = e.object({
5
- titleLevel: e.number().required(),
5
+ titleLevel: e.number().optional(),
6
6
  images: e.object({
7
7
  initial: e.object({
8
8
  capacityImg: e.string().required(),
@@ -44,7 +44,7 @@ const o = e.object({
44
44
  tooltipPosition: e.string().valid("bottom").optional()
45
45
  }).required()).required().min(1)
46
46
  }), u = e.object({
47
- titleLevel: e.number().required(),
47
+ titleLevel: e.number().optional(),
48
48
  listOfProbabilityBarsLists: e.array().items(
49
49
  e.array().items(
50
50
  e.object({
@@ -83,9 +83,9 @@ const o = e.object({
83
83
  response: e.string().optional()
84
84
  }).required()
85
85
  ).required()
86
- }).required(), m = e.object({
87
- quizzes: e.array().items(i).required()
88
86
  }).required(), l = e.object({
87
+ quizzes: e.array().items(i).required()
88
+ }).required(), m = e.object({
89
89
  title: e.string().required(),
90
90
  messages: e.array().items(
91
91
  e.object({
@@ -99,7 +99,7 @@ const o = e.object({
99
99
  })
100
100
  ).required()
101
101
  }).required(), g = e.object({
102
- titleLevel: e.number().required(),
102
+ titleLevel: e.number().optional(),
103
103
  title: e.string().required(),
104
104
  author: e.string().required(),
105
105
  date: e.string().required(),
@@ -141,9 +141,8 @@ const o = e.object({
141
141
  { is: "text", then: e.array().items(p) }
142
142
  ]
143
143
  }).required(),
144
- aspectRatio: e.number().min(0).required(),
145
144
  randomSlides: e.boolean().required(),
146
- titleLevel: e.number().integer().min(0).max(6).optional(),
145
+ titleLevel: e.number().integer().optional(),
147
146
  disableAnimation: e.boolean().required(),
148
147
  disableLoop: e.boolean().optional()
149
148
  }).meta({ title: "pix-carousel" }).required(), h = e.object({
@@ -190,7 +189,7 @@ const o = e.object({
190
189
  failImage: e.string().required(),
191
190
  infoImage: e.string().required(),
192
191
  searchImage: e.string().required()
193
- }), L = /* @__PURE__ */ Object.assign({ "./calcul-impact/calcul-impact.schema.js": o, "./capacity-calculation/capacity-calculation.schema.js": a, "./clickable-image/clickable-image.schema.js": c, "./complete-phrase/complete-phrase.schema.js": u, "./flip-cards/flip-cards.schema.js": d, "./image-quiz/image-quiz.schema.js": i, "./image-quiz/image-quizzes.schema.js": m, "./message-conversation/message-conversation.schema.js": l, "./pix-article/pix-article.schema.js": g, "./pix-carousel/pix-carousel.schema.js": j, "./pix-cursor/pix-cursor.schema.js": h, "./pix-llm/llm-compare-messages.schema.js": x, "./pix-llm/llm-messages.schema.js": I, "./pix-llm/llm-prompt-select.schema.js": w, "./qcm-deepfake/qcm-deepfake.schema.js": f }), S = Object.fromEntries(Object.entries(L).map(([s, n]) => [
192
+ }), L = /* @__PURE__ */ Object.assign({ "./calcul-impact/calcul-impact.schema.js": o, "./capacity-calculation/capacity-calculation.schema.js": a, "./clickable-image/clickable-image.schema.js": c, "./complete-phrase/complete-phrase.schema.js": u, "./flip-cards/flip-cards.schema.js": d, "./image-quiz/image-quiz.schema.js": i, "./image-quiz/image-quizzes.schema.js": l, "./message-conversation/message-conversation.schema.js": m, "./pix-article/pix-article.schema.js": g, "./pix-carousel/pix-carousel.schema.js": j, "./pix-cursor/pix-cursor.schema.js": h, "./pix-llm/llm-compare-messages.schema.js": x, "./pix-llm/llm-messages.schema.js": I, "./pix-llm/llm-prompt-select.schema.js": w, "./qcm-deepfake/qcm-deepfake.schema.js": f }), S = Object.fromEntries(Object.entries(L).map(([s, n]) => [
194
193
  s.replace(/^.*\/([^/]+)\.schema\.js$/, "$1"),
195
194
  n
196
195
  ]));
@@ -1,4 +1,4 @@
1
- import { u as t, p as s } from "./_plugin-vue_export-helper-CwwQJ1m6.js";
1
+ import { u as t, p as s } from "./_plugin-vue_export-helper-BGEtPlxS.js";
2
2
  const a = Symbol("shadowRoot");
3
3
  function r() {
4
4
  const o = t();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/epreuves-components",
3
- "version": "1.4.5",
3
+ "version": "1.5.1",
4
4
  "description": "A collection of interactive components to be used in Pix challenges or modules",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -1,123 +0,0 @@
1
- import { a as B, r as N, G as I, c as d, o as m, H as b, q as f, I as g, D as y, f as h, m as j, t as k, _ as L, k as p, J as q, g as M, F as z, b as T, e as F } from "./_plugin-vue_export-helper-CwwQJ1m6.js";
2
- function O(i, u = H) {
3
- const a = [...i];
4
- for (let n = a.length - 1; n > 0; n--) {
5
- const l = u() % (n + 1);
6
- [a[n], a[l]] = [a[l], a[n]];
7
- }
8
- return a;
9
- }
10
- function H() {
11
- return Math.floor(Math.random() * 2 ** 32);
12
- }
13
- const A = ["aria-labelledby", "aria-selected", "tabindex"], D = { key: 0 }, K = ["id"], Q = ["id"], R = /* @__PURE__ */ B({
14
- __name: "ImageOption.ce",
15
- props: {
16
- choice: { type: Object },
17
- maxChoicesPerLine: { type: Number },
18
- imageClass: { type: String },
19
- nameClass: { type: String },
20
- selected: { type: Boolean },
21
- tabFocusable: { type: Boolean }
22
- },
23
- emits: ["toggle", "next", "previous"],
24
- setup(i, { expose: u }) {
25
- const a = i, n = N();
26
- function l() {
27
- n.value.focus();
28
- }
29
- u({ focus: l });
30
- const s = I();
31
- return (o, t) => (m(), d("div", {
32
- ref_key: "el",
33
- ref: n,
34
- role: "option",
35
- class: y(["image-option", `image-option--max${a.maxChoicesPerLine}`]),
36
- "aria-labelledby": g(s),
37
- "aria-selected": o.selected,
38
- tabindex: o.tabFocusable ? 0 : -1,
39
- onClick: t[0] || (t[0] = f((r) => o.$emit("toggle"), ["stop"])),
40
- onKeydown: [
41
- t[1] || (t[1] = b(f((r) => o.$emit("toggle"), ["stop", "prevent"]), ["space"])),
42
- t[2] || (t[2] = b(f((r) => o.$emit("previous"), ["stop", "prevent"]), ["up", "left"])),
43
- t[3] || (t[3] = b(f((r) => o.$emit("next"), ["stop", "prevent"]), ["down", "right"]))
44
- ]
45
- }, [
46
- o.choice.image ? (m(), d("figure", D, [
47
- h("img", j(o.choice.image, {
48
- class: o.imageClass,
49
- alt: ""
50
- }), null, 16),
51
- h("figcaption", {
52
- class: y(o.nameClass),
53
- id: g(s)
54
- }, k(o.choice.name), 11, K)
55
- ])) : (m(), d("span", {
56
- key: 1,
57
- id: g(s)
58
- }, k(o.choice.name), 9, Q))
59
- ], 42, A));
60
- }
61
- }), E = '.image-option{display:flex;position:relative;flex-direction:column;align-items:center;justify-content:center;margin:.5rem;border:solid 2px #c1c7d0;border-radius:10px;background:#fff;width:calc(20% - 2em);min-width:150px;padding:1rem}.image-option--max4{width:calc(25% - 2em);min-width:175px}.image-option--max3{width:calc(33% - 2em)}.image-option--max2{width:calc(50% - 2em);min-width:300px}.image-option--max1{width:calc(100% - 4em);min-width:300px}.image-option:hover{cursor:pointer;box-shadow:0 3px 10px #0000001a;transform:scale(1.04);transition:transform ease-in .1s}.image-option:focus{outline:none;box-shadow:5px 5px #ffbe00,-5px 5px #ffbe00,5px -5px #ffbe00,-5px -5px #ffbe00}.image-option[aria-selected=true]{border-color:#3d68ff}.image-option[aria-selected=true]:after{content:"";position:absolute;width:calc(100% + 2px);height:calc(100% + 2px);background:#3d68ff4d;border-radius:10px;z-index:3}.image-option figure{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;margin:0;text-align:center;width:100%}.image-option figure img{max-width:100%;height:auto}.image-option figure img.icon{max-height:100px;width:auto}.image-option figure img.medium{max-width:50%;height:auto}.image-option figure figcaption{margin:1ex}', G = /* @__PURE__ */ L(R, [["styles", [E]]]), J = ["id", "innerHTML"], V = ["aria-multiselectable", "aria-labelledby"], U = /* @__PURE__ */ B({
62
- __name: "ImageQuiz.ce",
63
- props: {
64
- multiple: { type: Boolean, default: !1 },
65
- choices: { type: Array },
66
- maxChoicesPerLine: { default: 5, type: Number },
67
- name: { type: String },
68
- hideChoicesName: { type: Boolean },
69
- orderChoices: { type: Boolean },
70
- imageChoicesSize: { default: "icon", type: String },
71
- showName: { type: Boolean, default: !1 }
72
- },
73
- emits: ["answer"],
74
- setup(i, { emit: u }) {
75
- const a = u, n = p(() => i.hideChoicesName ? "sr-only" : ""), l = p(() => i.orderChoices ? i.choices : O(i.choices)), s = N(new Array(i.choices.length).fill(!1)), o = p(() => l.value.filter((e, C) => s.value[C])), t = p(() => o.value.map((e) => e.response ?? e.name).sort().join(",")), r = I();
76
- q(t, () => {
77
- a("answer", t.value);
78
- }, { immediate: !1 });
79
- const P = p(() => {
80
- const e = s.value.indexOf(!0);
81
- return e === -1 ? 0 : e;
82
- }), x = M("options");
83
- function v(e) {
84
- i.multiple || s.value.fill(!1), s.value[e] = !s.value[e];
85
- }
86
- function w(e) {
87
- e = (e + i.choices.length) % i.choices.length, i.multiple || v(e), x.value[e].focus();
88
- }
89
- return (e, C) => (m(), d(z, null, [
90
- h("label", {
91
- id: g(r),
92
- class: y(["image-quiz-label", { "sr-only": !e.showName }]),
93
- innerHTML: e.name
94
- }, null, 10, J),
95
- h("div", {
96
- role: "listbox",
97
- class: "image-quiz",
98
- "aria-multiselectable": e.multiple,
99
- "aria-labelledby": g(r),
100
- "aria-orientation": "horizontal"
101
- }, [
102
- (m(!0), d(z, null, T(l.value, (S, c) => (m(), F(G, {
103
- ref_for: !0,
104
- ref_key: "options",
105
- ref: x,
106
- choice: S,
107
- "max-choices-per-line": e.maxChoicesPerLine,
108
- key: c,
109
- "name-class": n.value,
110
- "image-class": i.imageChoicesSize,
111
- selected: s.value[c],
112
- "tab-focusable": c === P.value,
113
- onToggle: ($) => v(c),
114
- onNext: ($) => w(c + 1),
115
- onPrevious: ($) => w(c - 1)
116
- }, null, 8, ["choice", "max-choices-per-line", "name-class", "image-class", "selected", "tab-focusable", "onToggle", "onNext", "onPrevious"]))), 128))
117
- ], 8, V)
118
- ], 64));
119
- }
120
- }), W = "*{box-sizing:border-box}.image-quiz-label{font-size:1.25rem;margin:1rem 0;display:inline-block}.image-quiz{display:flex;flex-wrap:wrap;justify-content:space-around}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}", Y = /* @__PURE__ */ L(U, [["styles", [W]]]);
121
- export {
122
- Y as I
123
- };