@1024pix/epreuves-components 0.5.0 → 0.7.0

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.
@@ -0,0 +1,4 @@
1
+ import { d as e } from "../_plugin-vue_export-helper-CAqLqAA7.js";
2
+ import { I as m } from "../ImageQuiz.ce-DZvzQg_l.js";
3
+ window.customElements.define("image-quiz", e(m));
4
+ window.customElements.define("qcu-image", e(m));
@@ -0,0 +1,29 @@
1
+ import { a as l, r as f, w, c as z, o as t, b as p, e as d, m as g, F as v, d as _ } from "../_plugin-vue_export-helper-CAqLqAA7.js";
2
+ import { I as A } from "../ImageQuiz.ce-DZvzQg_l.js";
3
+ const h = /* @__PURE__ */ l({
4
+ __name: "ImageQuizzes.ce",
5
+ props: {
6
+ quizzes: { type: Array }
7
+ },
8
+ emits: ["answer"],
9
+ setup(o, { emit: i }) {
10
+ const n = i, r = f(new Array(o.quizzes.length).fill(void 0));
11
+ w(() => {
12
+ if (!r.value.some((e) => e == null)) {
13
+ if (r.value.some((e) => e === "")) {
14
+ n("answer", "");
15
+ return;
16
+ }
17
+ n("answer", r.value.join(","));
18
+ }
19
+ });
20
+ function m(e, s) {
21
+ r.value[s] = e;
22
+ }
23
+ return (e, s) => (t(!0), z(v, null, p(e.quizzes, (u, a) => (t(), d(A, g({ key: a }, { ref_for: !0 }, u, {
24
+ "show-name": !0,
25
+ onAnswer: (c) => m(c, a)
26
+ }), null, 16, ["onAnswer"]))), 128));
27
+ }
28
+ });
29
+ window.customElements.define("image-quizzes", _(h));
@@ -1,12 +1,12 @@
1
- import { d as m, c as a, o as n, a as s, t, F as i, r as d, b as r, _ as p, e as u } from "../_plugin-vue_export-helper-rf--DmCY.js";
2
- import { p as f, L as l } from "../LLMMessage.ce-CklO8QgD.js";
1
+ import { a as d, c as a, o as n, f as s, t, F as i, b as m, g as r, _ as p, d as f } from "../_plugin-vue_export-helper-CAqLqAA7.js";
2
+ import { p as u, L as l } from "../LLMMessage.ce-DMKmB1ZN.js";
3
3
  const g = {
4
4
  class: "header",
5
5
  "aria-hidden": "true"
6
6
  }, h = { class: "sr-only" }, v = { class: "llm-compare-messages" }, _ = { class: "conversation1" }, y = { class: "conversation2" }, b = { class: "conversation1" }, w = {
7
7
  "aria-hidden": "true",
8
8
  class: "conversation2"
9
- }, x = /* @__PURE__ */ m({
9
+ }, x = /* @__PURE__ */ d({
10
10
  __name: "LLMCompareMessages.ce",
11
11
  props: {
12
12
  conversation1: { type: Object },
@@ -15,14 +15,14 @@ const g = {
15
15
  messages: { type: Array }
16
16
  },
17
17
  setup(N) {
18
- return f(), (e, C) => (n(), a(i, null, [
18
+ return u(), (e, C) => (n(), a(i, null, [
19
19
  s("div", g, [
20
20
  s("p", null, t(e.conversation1.title), 1),
21
21
  s("p", null, t(e.conversation2.title), 1)
22
22
  ]),
23
23
  s("p", h, " Comparaison entre la conversation " + t(e.conversation1.title) + " et la conversation " + t(e.conversation2.title), 1),
24
24
  s("div", v, [
25
- (n(!0), a(i, null, d(e.messages, (o, c) => (n(), a("div", {
25
+ (n(!0), a(i, null, m(e.messages, (o, c) => (n(), a("div", {
26
26
  key: c,
27
27
  class: "llm-compare-messages__row"
28
28
  }, [
@@ -57,5 +57,5 @@ const g = {
57
57
  ])
58
58
  ], 64));
59
59
  }
60
- }), L = '*{box-sizing:border-box}:host{display:flex;flex-direction:column}.llm-compare-messages{display:flex;flex-direction:column;padding:24px;gap:24px;position:relative;height:100%;overflow:auto}.llm-compare-messages:after{content:"";position:absolute;height:100%;top:0;left:50%;border-left:dashed 1px grey}.llm-compare-messages__row{display:flex;flex-direction:row;justify-content:space-between}.llm-compare-messages__row>div{display:flex;flex-direction:column;width:calc(50% - 12px)}.conversation1 .inbound .bubble{background:#e9f4c3}.header{display:flex}.header p{background:#e6eaf2;display:flex;width:50%;justify-content:center;align-items:center;padding:1rem;margin:0;font-size:1.2rem;font-weight:700}.header p:first-child{background:#e9f4c3}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}', k = /* @__PURE__ */ p(x, [["styles", [L]]]);
61
- window.customElements.define("llm-compare-messages", u(k));
60
+ }), L = '*{box-sizing:border-box}:host{display:flex;flex-direction:column}.llm-compare-messages{display:flex;flex-direction:column;padding:24px;gap:24px;position:relative;height:100%;overflow:auto}.llm-compare-messages:after{content:"";position:absolute;height:100%;top:0;left:50%;border-left:dashed 1px grey}.llm-compare-messages__row{display:flex;flex-direction:row;justify-content:space-between}.llm-compare-messages__row>div{display:flex;flex-direction:column;width:calc(50% - 12px)}.conversation1 .inbound .bubble{background:#fff7da}.header{display:flex}.header p{background:#e6eaf2;display:flex;width:50%;justify-content:center;align-items:center;padding:1rem;margin:0;font-size:1.2rem;font-weight:700}.header p:first-child{background:#fff7da}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}', k = /* @__PURE__ */ p(x, [["styles", [L]]]);
61
+ window.customElements.define("llm-compare-messages", f(k));
@@ -1,5 +1,5 @@
1
- import { d as m, u as i, w as p, c as o, o as s, F as g, r as d, f, _ as u, e as _ } from "../_plugin-vue_export-helper-rf--DmCY.js";
2
- import { p as h, L as w } from "../LLMMessage.ce-CklO8QgD.js";
1
+ import { a as m, u as i, j as p, c as o, o as e, F as d, b as u, e as g, _ as f, d as h } from "../_plugin-vue_export-helper-CAqLqAA7.js";
2
+ import { p as _, L as v } from "../LLMMessage.ce-DMKmB1ZN.js";
3
3
  const y = {
4
4
  class: "llm-messages",
5
5
  "aria-live": "polite"
@@ -10,19 +10,19 @@ const y = {
10
10
  },
11
11
  setup(t) {
12
12
  const a = t;
13
- h();
14
- const e = i();
13
+ _();
14
+ const s = i();
15
15
  function l() {
16
- e.scrollTop = e.scrollHeight;
16
+ s.scrollTop = s.scrollHeight;
17
17
  }
18
18
  return p(async () => {
19
19
  a.messages, l();
20
- }), (n, B) => (s(), o("div", y, [
21
- (s(!0), o(g, null, d(n.messages, (r, c) => (s(), f(w, {
20
+ }), (r, B) => (e(), o("div", y, [
21
+ (e(!0), o(d, null, u(r.messages, (n, c) => (e(), g(v, {
22
22
  key: c,
23
- message: r
23
+ message: n
24
24
  }, null, 8, ["message"]))), 128))
25
25
  ]));
26
26
  }
27
- }), v = ":host{height:100%;overflow:auto;scroll-behavior:smooth}.llm-messages{display:flex;flex-direction:column;gap:24px;padding:24px}", x = /* @__PURE__ */ u(L, [["styles", [v]]]);
28
- window.customElements.define("llm-messages", _(x));
27
+ }), w = ":host{height:100%;overflow:auto;scroll-behavior:smooth}@media (prefers-reduced-motion: reduce){:host{scroll-behavior:auto}}.llm-messages{display:flex;flex-direction:column;gap:24px;padding:24px}", x = /* @__PURE__ */ f(L, [["styles", [w]]]);
28
+ window.customElements.define("llm-messages", h(x));
@@ -0,0 +1,67 @@
1
+ import { a as h, r as i, h as y, c, o as d, g as x, f as l, i as w, F as _, b as k, t as S, _ as C, d as L } from "../_plugin-vue_export-helper-CAqLqAA7.js";
2
+ import "./llm-messages.ce.js.js";
3
+ const N = { class: "prompt-select" }, P = { class: "prompt-select__options" }, B = ["disabled", "onClick"], E = /* @__PURE__ */ h({
4
+ __name: "LLMPromptSelect.ce",
5
+ props: {
6
+ messages: { type: Array },
7
+ prompts: { type: Array },
8
+ speed: { type: Number }
9
+ },
10
+ setup(f, { expose: b }) {
11
+ const t = f, s = i(t.messages), m = i(t.prompts.map((e) => ({
12
+ ...e,
13
+ disabled: !1
14
+ }))), r = i(!1);
15
+ function g() {
16
+ s.value = t.messages, m.value = t.prompts.map((e) => ({
17
+ ...e,
18
+ disabled: !1
19
+ })), r.value = !1;
20
+ }
21
+ b({
22
+ reset: g
23
+ });
24
+ async function v(e) {
25
+ const o = t.speed === 0 || window.matchMedia("(prefers-reduced-motion: reduce)").matches;
26
+ if (s.value = [
27
+ ...s.value,
28
+ {
29
+ direction: "outbound",
30
+ content: e.prompt
31
+ },
32
+ {
33
+ direction: "inbound",
34
+ content: o ? e.response : ""
35
+ }
36
+ ], e.disabled = !0, o) return;
37
+ const a = s.value.length - 1;
38
+ r.value = !0;
39
+ const n = e.response.split(/(\s+|<[^>]+>)/);
40
+ for (const p of n)
41
+ await new Promise((u) => {
42
+ setTimeout(u, t.speed ?? 20);
43
+ }), s.value = [...s.value], s.value[a].content += p;
44
+ r.value = !1;
45
+ }
46
+ return (e, o) => {
47
+ const a = y("llm-messages");
48
+ return d(), c(_, null, [
49
+ x(a, { messages: s.value }, null, 8, ["messages"]),
50
+ l("div", N, [
51
+ o[0] || (o[0] = l("p", { class: "prompt-select__label" }, [
52
+ w(" Sélectionner un des prompts "),
53
+ l("span", { class: "sr-only" }, "  une fois sélectionnés, les prompts ne sont plus disponibles. ")
54
+ ], -1)),
55
+ l("div", P, [
56
+ (d(!0), c(_, null, k(m.value, (n, p) => (d(), c("button", {
57
+ key: p,
58
+ disabled: n.disabled || r.value,
59
+ onClick: (u) => v(n)
60
+ }, S(n.prompt), 9, B))), 128))
61
+ ])
62
+ ])
63
+ ], 64);
64
+ };
65
+ }
66
+ }), M = ".sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}llm-messages{display:block;height:400px}.prompt-select{border-top:solid 1px grey;padding:24px}.prompt-select__label{margin-top:0;font-weight:700}.prompt-select__options{display:flex;gap:1rem;justify-content:left;padding-bottom:1rem;flex-wrap:wrap}.prompt-select__options>button{padding:.5rem 1.5rem;border:none;background:#cec3f4;border-radius:5px;font-size:1rem}.prompt-select__options>button:hover:not(:disabled){background:#9a8dc7;color:#fff;cursor:pointer}.prompt-select__options>button:disabled{cursor:not-allowed}", V = /* @__PURE__ */ C(E, [["styles", [M]]]);
67
+ window.customElements.define("llm-prompt-select", L(V));
@@ -1,9 +1,9 @@
1
- import { _ as f, c as i, o as t, d as x, g as D, k as v, l as S, n as h, p as u, a as p, q as b, t as _, b as $, F as y, r as k, f as M, e as A } from "../_plugin-vue_export-helper-rf--DmCY.js";
1
+ import { _ as f, c as i, o as t, a as x, r as D, s as v, y as S, q as h, z as u, f as p, i as b, t as _, g as $, F as y, b as w, e as M, d as A } from "../_plugin-vue_export-helper-CAqLqAA7.js";
2
2
  const C = ".loader{width:8px;aspect-ratio:1;border-radius:50%;animation:l5 1s infinite linear alternate;transform:translate(100%)}@keyframes l5{0%{box-shadow:13px 0 #000,-13px 0 #0002;background:#000}33%{box-shadow:13px 0 #000,-13px 0 #0002;background:#0002}66%{box-shadow:13px 0 #0002,-13px 0 #000;background:#0002}to{box-shadow:13px 0 #0002,-13px 0 #000;background:#000}}@media (prefers-reduced-motion: reduce){.loader{display:none}}", B = {}, V = { class: "loader" };
3
- function E(n, s) {
3
+ function z(n, s) {
4
4
  return t(), i("div", V);
5
5
  }
6
- const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), z = ["part"], L = {
6
+ const E = /* @__PURE__ */ f(B, [["render", z], ["styles", [C]]]), F = ["part"], L = {
7
7
  key: 1,
8
8
  class: "message__loader message__content",
9
9
  "aria-hidden": "true"
@@ -37,15 +37,15 @@ const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), z = ["part"],
37
37
  }, [
38
38
  a[0] || (a[0] = p("span", { class: "sr-only" }, "Message de ", -1)),
39
39
  b(_(e.message.userName), 1)
40
- ], 8, z)) : u("", !0),
40
+ ], 8, F)) : u("", !0),
41
41
  s.value === "loading" ? (t(), i("div", L, [
42
- $(F)
42
+ $(E)
43
43
  ])) : u("", !0),
44
44
  p("p", {
45
45
  class: h(["message__content", { "hidden-state": s.value !== "visible" }]),
46
46
  part: `message ${e.message.direction}`
47
47
  }, [
48
- (t(!0), i(y, null, k(m.value, (d, o) => (t(), i(y, { key: o }, [
48
+ (t(!0), i(y, null, w(m.value, (d, o) => (t(), i(y, { key: o }, [
49
49
  o > 0 ? (t(), i("br", j)) : u("", !0),
50
50
  b(" " + _(d), 1)
51
51
  ], 64))), 128))
@@ -70,8 +70,8 @@ const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), z = ["part"],
70
70
  message: l,
71
71
  startAnimation: c,
72
72
  animationDuration: g
73
- } = e.at(-1), w = a.direction !== l.direction || a.userName !== l.userName, N = c + g + s;
74
- return [...e, { message: a, displaySender: w, startAnimation: N, animationDuration: o }];
73
+ } = e.at(-1), k = a.direction !== l.direction || a.userName !== l.userName, N = c + g + s;
74
+ return [...e, { message: a, displaySender: k, startAnimation: N, animationDuration: o }];
75
75
  },
76
76
  []
77
77
  )
@@ -81,7 +81,7 @@ const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), z = ["part"],
81
81
  }
82
82
  return (e, a) => (t(), i("figure", G, [
83
83
  p("figcaption", H, _(e.title), 1),
84
- (t(!0), i(y, null, k(m.value, ({ message: d, displaySender: o, startAnimation: l, animationDuration: c }, g) => (t(), M(P, {
84
+ (t(!0), i(y, null, w(m.value, ({ message: d, displaySender: o, startAnimation: l, animationDuration: c }, g) => (t(), M(P, {
85
85
  message: d,
86
86
  "start-animation": l,
87
87
  "animation-duration": c,
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import "./components/message-conversation.ce.js.js";
2
2
  import "./components/llm-messages.ce.js.js";
3
3
  import "./components/llm-compare-messages.ce.js.js";
4
- import "./components/qcu-image.ce.js.js";
4
+ import "./components/llm-prompt-select.ce.js.js";
5
+ import "./components/image-quiz.ce.js.js";
6
+ import "./components/image-quizzes.ce.js.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/epreuves-components",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "A collection of interactive components to be used in Pix challenges or modules",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",