@pie-element/match-list 7.1.2-next.7 → 7.1.2-next.8

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.
@@ -12712,9 +12712,13 @@ var uv = q("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outco
12712
12712
  })
12713
12713
  });
12714
12714
  }
12715
- };
12716
- function mv(e) {
12717
- let { id: t, instanceId: n, promptId: r, draggable: i = !0, disabled: a = !1, type: o, selectedAnswer: s, onSelectClick: c, onPlacementClick: l } = e, u = `${o || "answer"}-${t}`, d = r == null ? void 0 : `drop-${r}`, f = {
12715
+ }, mv = ({ type: e, id: t, promptId: n }) => n == null ? `${e || "answer"}-${t}` : `${e || "answer"}-prompt-${n}`;
12716
+ function hv(e) {
12717
+ let { id: t, instanceId: n, promptId: r, draggable: i = !0, disabled: a = !1, type: o, selectedAnswer: s, onSelectClick: c, onPlacementClick: l } = e, u = mv({
12718
+ type: o,
12719
+ id: t,
12720
+ promptId: r
12721
+ }), d = r == null ? void 0 : `drop-${r}`, f = {
12718
12722
  type: o || "answer",
12719
12723
  id: t,
12720
12724
  instanceId: n,
@@ -12794,7 +12798,7 @@ function mv(e) {
12794
12798
  })
12795
12799
  });
12796
12800
  }
12797
- mv.propTypes = {
12801
+ hv.propTypes = {
12798
12802
  id: X.default.any,
12799
12803
  instanceId: X.default.string,
12800
12804
  promptId: X.default.any,
@@ -12808,13 +12812,13 @@ mv.propTypes = {
12808
12812
  };
12809
12813
  //#endregion
12810
12814
  //#region src/delivery/answer-area.tsx
12811
- var hv = 200, gv = q("div")({
12815
+ var gv = 200, _v = q("div")({
12812
12816
  alignItems: "normal",
12813
12817
  display: "flex",
12814
12818
  flexShrink: 0,
12815
12819
  height: 40,
12816
12820
  margin: "10px 20px"
12817
- }), _v = q("div")(({ theme: e }) => ({
12821
+ }), vv = q("div")(({ theme: e }) => ({
12818
12822
  alignItems: "flex-start",
12819
12823
  display: "flex",
12820
12824
  flex: 1,
@@ -12822,24 +12826,24 @@ var hv = 200, gv = q("div")({
12822
12826
  justifyContent: "space-between",
12823
12827
  marginTop: e.spacing(2),
12824
12828
  marginBottom: e.spacing(2)
12825
- })), vv = q("div")(() => ({
12829
+ })), yv = q("div")(() => ({
12826
12830
  border: `1px solid ${Wo.border()}`,
12827
12831
  boxSizing: "border-box",
12828
12832
  flex: 1,
12829
12833
  margin: "10px 0",
12830
12834
  minHeight: 40,
12831
- minWidth: hv,
12835
+ minWidth: gv,
12832
12836
  overflow: "hidden",
12833
12837
  padding: 10,
12834
12838
  textAlign: "center",
12835
12839
  width: "100%",
12836
12840
  wordBreak: "break-word"
12837
- })), yv = q("div")({
12841
+ })), bv = q("div")({
12838
12842
  alignItems: "center",
12839
12843
  display: "flex",
12840
12844
  justifyContent: "space-between",
12841
12845
  width: "100%"
12842
- }), bv = class extends f.Component {
12846
+ }), xv = class extends f.Component {
12843
12847
  static propTypes = {
12844
12848
  session: X.default.object.isRequired,
12845
12849
  showCorrect: X.default.bool.isRequired,
@@ -12876,10 +12880,10 @@ var hv = 200, gv = q("div")({
12876
12880
  };
12877
12881
  render() {
12878
12882
  let { disabled: e, instanceId: t, onRemoveAnswer: n, selectedAnswer: r, onChoiceClick: i, onPlacementClick: a } = this.props, o = this.buildRows(), c = this.getCorrectOrIncorrectMap();
12879
- return /* @__PURE__ */ A(_v, { children: o.map(({ sessionAnswer: o, title: l, id: u }, d) => /* @__PURE__ */ j(yv, { children: [
12880
- /* @__PURE__ */ A(vv, { dangerouslySetInnerHTML: { __html: l } }),
12881
- /* @__PURE__ */ j(gv, { children: [/* @__PURE__ */ A(ov, { direction: "left" }), /* @__PURE__ */ A(ov, {})] }),
12882
- /* @__PURE__ */ A(mv, {
12883
+ return /* @__PURE__ */ A(vv, { children: o.map(({ sessionAnswer: o, title: l, id: u }, d) => /* @__PURE__ */ j(bv, { children: [
12884
+ /* @__PURE__ */ A(yv, { dangerouslySetInnerHTML: { __html: l } }),
12885
+ /* @__PURE__ */ j(_v, { children: [/* @__PURE__ */ A(ov, { direction: "left" }), /* @__PURE__ */ A(ov, {})] }),
12886
+ /* @__PURE__ */ A(hv, {
12883
12887
  className: "answer",
12884
12888
  index: d,
12885
12889
  promptId: u,
@@ -12894,10 +12898,10 @@ var hv = 200, gv = q("div")({
12894
12898
  selectedAnswer: r,
12895
12899
  onSelectClick: i,
12896
12900
  onPlacementClick: a
12897
- }, d)
12898
- ] }, d)) });
12901
+ })
12902
+ ] }, u)) });
12899
12903
  }
12900
- }, xv = q("div")(({ theme: e }) => ({
12904
+ }, Sv = q("div")(({ theme: e }) => ({
12901
12905
  alignItems: "center",
12902
12906
  display: "flex",
12903
12907
  flexDirection: "row",
@@ -12908,13 +12912,13 @@ var hv = 200, gv = q("div")({
12908
12912
  minHeight: 50,
12909
12913
  transition: "background-color 200ms ease"
12910
12914
  }));
12911
- function Sv({ id: e, disabled: t, children: n, onPlacementClick: r, ...i }) {
12915
+ function Cv({ id: e, disabled: t, children: n, onPlacementClick: r, ...i }) {
12912
12916
  let { setNodeRef: a, isOver: o } = hg({
12913
12917
  id: e || "choices-pool",
12914
12918
  data: { type: "choices-pool" },
12915
12919
  disabled: t
12916
12920
  });
12917
- return /* @__PURE__ */ A(xv, {
12921
+ return /* @__PURE__ */ A(Sv, {
12918
12922
  ref: a,
12919
12923
  onClick: () => {
12920
12924
  t || r?.({ type: "choices-pool" });
@@ -12928,7 +12932,7 @@ function Sv({ id: e, disabled: t, children: n, onPlacementClick: r, ...i }) {
12928
12932
  })
12929
12933
  });
12930
12934
  }
12931
- Sv.propTypes = {
12935
+ Cv.propTypes = {
12932
12936
  id: X.default.oneOfType([X.default.string, X.default.number]),
12933
12937
  disabled: X.default.bool,
12934
12938
  children: X.default.node,
@@ -12936,7 +12940,7 @@ Sv.propTypes = {
12936
12940
  };
12937
12941
  //#endregion
12938
12942
  //#region src/delivery/choices-list.tsx
12939
- var Cv = q("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), wv = class extends f.Component {
12943
+ var wv = q("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), Tv = class extends f.Component {
12940
12944
  static propTypes = {
12941
12945
  session: X.default.object.isRequired,
12942
12946
  instanceId: X.default.string.isRequired,
@@ -12949,12 +12953,12 @@ var Cv = q("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), wv = clas
12949
12953
  };
12950
12954
  render() {
12951
12955
  let { model: e, disabled: t, session: n, instanceId: i, onRemoveAnswer: o, selectedAnswer: c, onChoiceClick: l, onPlacementClick: u } = this.props, { config: d } = e, { duplicates: f } = d;
12952
- return /* @__PURE__ */ A(Cv, { children: /* @__PURE__ */ A(Sv, {
12956
+ return /* @__PURE__ */ A(wv, { children: /* @__PURE__ */ A(Cv, {
12953
12957
  id: "choices-pool",
12954
12958
  disabled: t,
12955
12959
  onRemoveAnswer: o,
12956
12960
  onPlacementClick: u,
12957
- children: d.answers.filter((e) => f || s(n) || !n.value || a(r(n.value, (t) => t === e.id))).map((e) => /* @__PURE__ */ A(mv, {
12961
+ children: d.answers.filter((e) => f || s(n) || !n.value || a(r(n.value, (t) => t === e.id))).map((e) => /* @__PURE__ */ A(hv, {
12958
12962
  instanceId: i,
12959
12963
  draggable: !0,
12960
12964
  disabled: t,
@@ -12969,13 +12973,13 @@ var Cv = q("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), wv = clas
12969
12973
  };
12970
12974
  //#endregion
12971
12975
  //#region src/delivery/main.tsx
12972
- function Tv(e) {
12976
+ function Ev(e) {
12973
12977
  return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
12974
12978
  }
12975
- function Ev(e, t) {
12976
- return !e || Tv(e) ? e : Tv(e.default) ? e.default : t && Tv(e[t]) ? e[t] : t && Tv(e[t]?.default) ? e[t].default : e;
12979
+ function Dv(e, t) {
12980
+ return !e || Ev(e) ? e : Ev(e.default) ? e.default : t && Ev(e[t]) ? e[t] : t && Ev(e[t]?.default) ? e[t].default : e;
12977
12981
  }
12978
- var Dv = Ev(Xf, "PreviewPrompt") || Ev(jv.PreviewPrompt, "PreviewPrompt"), Ov = Ev(Tc, "Feedback") || Ev(jv.Feedback, "Feedback"), kv = Dp, Av = kv.default, jv = Av && typeof Av == "object" ? Av : kv, Mv = 250, Nv = [{
12982
+ var Ov = Dv(Xf, "PreviewPrompt") || Dv(Mv.PreviewPrompt, "PreviewPrompt"), kv = Dv(Tc, "Feedback") || Dv(Mv.Feedback, "Feedback"), Av = Dp, jv = Av.default, Mv = jv && typeof jv == "object" ? jv : Av, Nv = 250, Pv = [{
12979
12983
  sensor: uh,
12980
12984
  options: { activationConstraint: { distance: 8 } }
12981
12985
  }, {
@@ -12988,21 +12992,21 @@ var Dv = Ev(Xf, "PreviewPrompt") || Ev(jv.PreviewPrompt, "PreviewPrompt"), Ov =
12988
12992
  end: [Q.Space, Q.Enter]
12989
12993
  }
12990
12994
  }
12991
- }], Pv = q("div")({
12995
+ }], Fv = q("div")({
12992
12996
  display: "flex",
12993
12997
  flexDirection: "column",
12994
12998
  justifyContent: "center",
12995
12999
  color: Wo.text(),
12996
13000
  backgroundColor: Wo.background()
12997
- }), Fv = q("div")({
13001
+ }), Iv = q("div")({
12998
13002
  width: "100%",
12999
13003
  overflowX: "auto",
13000
13004
  overflowY: "hidden"
13001
- }), Iv = q("div")({
13005
+ }), Lv = q("div")({
13002
13006
  display: "flex",
13003
13007
  flexDirection: "column",
13004
13008
  minWidth: "min-content"
13005
- }), Lv = class extends f.Component {
13009
+ }), Rv = class extends f.Component {
13006
13010
  static propTypes = {
13007
13011
  session: X.default.object.isRequired,
13008
13012
  onSessionChange: X.default.func,
@@ -13053,13 +13057,10 @@ var Dv = Ev(Xf, "PreviewPrompt") || Ev(jv.PreviewPrompt, "PreviewPrompt"), Ov =
13053
13057
  if (e.type === "choice" && i !== void 0) {
13054
13058
  let e = c(n.value, (e) => e === s);
13055
13059
  e && !o ? n.value = Og(n.value, e, i) : n.value[i] = s;
13056
- } else if (e.type === "target" && l != null && l !== i) {
13057
- let e = n.value[i] != null;
13058
- if (e && !o) {
13059
- let e = n.value[i];
13060
- n.value[i] = s, n.value[l] = e;
13061
- } else e || (n.value[i] = s, delete n.value[l]);
13062
- }
13060
+ } else if (e.type === "target" && l != null && l !== i) if (n.value[i] != null && !o) {
13061
+ let e = n.value[i];
13062
+ n.value[i] = s, n.value[l] = e;
13063
+ } else n.value[i] = s, delete n.value[l];
13063
13064
  r(n);
13064
13065
  }
13065
13066
  };
@@ -13091,7 +13092,7 @@ var Dv = Ev(Xf, "PreviewPrompt") || Ev(jv.PreviewPrompt, "PreviewPrompt"), Ov =
13091
13092
  let { selectedAnswer: t } = this.state;
13092
13093
  t && (this.placeAnswer(t, e), this.cancelSelection(), this.endAnyLiveKeyboardDrag(), this.lastDragEndAt = Date.now());
13093
13094
  };
13094
- isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < Mv;
13095
+ isClickSoonAfterDragEnd = () => Date.now() - this.lastDragEndAt < Nv;
13095
13096
  onChoiceClick = (e) => {
13096
13097
  this.isClickSoonAfterDragEnd() || this.toggleAnswerSelection(e);
13097
13098
  };
@@ -13118,15 +13119,15 @@ var Dv = Ev(Xf, "PreviewPrompt") || Ev(jv.PreviewPrompt, "PreviewPrompt"), Ov =
13118
13119
  render() {
13119
13120
  let { showCorrectAnswer: e } = this.state, { model: t, session: n } = this.props, { config: r, mode: i } = t, { prompt: a, language: o } = r;
13120
13121
  return /* @__PURE__ */ j(sg, {
13121
- sensors: Nv,
13122
+ sensors: Pv,
13122
13123
  collisionDetection: bm,
13123
13124
  onDragStart: this.onDragStart,
13124
13125
  onDragEnd: this.onPlaceAnswer,
13125
13126
  onDragCancel: this.onDragCancel,
13126
13127
  modifiers: [Ng],
13127
13128
  accessibility: { screenReaderInstructions: { draggable: "Press Space or Enter to pick up this answer choice. Once picked up, use Tab or Shift+Tab to cycle through response areas, or use arrow keys to move it freely. Press Space or Enter to drop, or Escape to cancel. You can also click an answer choice to select it, then click a response area to place it there." } },
13128
- children: [/* @__PURE__ */ j(Pv, { children: [
13129
- /* @__PURE__ */ A(Dv, {
13129
+ children: [/* @__PURE__ */ j(Fv, { children: [
13130
+ /* @__PURE__ */ A(Ov, {
13130
13131
  className: "prompt",
13131
13132
  prompt: a
13132
13133
  }),
@@ -13136,7 +13137,7 @@ var Dv = Ev(Xf, "PreviewPrompt") || Ev(jv.PreviewPrompt, "PreviewPrompt"), Ov =
13136
13137
  onToggle: this.toggleShowCorrect,
13137
13138
  language: o
13138
13139
  }),
13139
- /* @__PURE__ */ A(Fv, { children: /* @__PURE__ */ j(Iv, { children: [/* @__PURE__ */ A(bv, {
13140
+ /* @__PURE__ */ A(Iv, { children: /* @__PURE__ */ j(Lv, { children: [/* @__PURE__ */ A(xv, {
13140
13141
  instanceId: this.instanceId,
13141
13142
  model: t,
13142
13143
  session: n,
@@ -13146,7 +13147,7 @@ var Dv = Ev(Xf, "PreviewPrompt") || Ev(jv.PreviewPrompt, "PreviewPrompt"), Ov =
13146
13147
  selectedAnswer: this.state.selectedAnswer,
13147
13148
  onChoiceClick: this.onChoiceClick,
13148
13149
  onPlacementClick: this.onPlacementClick
13149
- }), /* @__PURE__ */ A(wv, {
13150
+ }), /* @__PURE__ */ A(Tv, {
13150
13151
  instanceId: this.instanceId,
13151
13152
  model: t,
13152
13153
  session: n,
@@ -13156,7 +13157,7 @@ var Dv = Ev(Xf, "PreviewPrompt") || Ev(jv.PreviewPrompt, "PreviewPrompt"), Ov =
13156
13157
  onChoiceClick: this.onChoiceClick,
13157
13158
  onPlacementClick: this.onPlacementClick
13158
13159
  })] }) }),
13159
- t.correctness && t.feedback && !e && /* @__PURE__ */ A(Ov, {
13160
+ t.correctness && t.feedback && !e && /* @__PURE__ */ A(kv, {
13160
13161
  correctness: t.correctness.correctness,
13161
13162
  feedback: t.feedback
13162
13163
  })
@@ -13180,7 +13181,7 @@ var Dv = Ev(Xf, "PreviewPrompt") || Ev(jv.PreviewPrompt, "PreviewPrompt"), Ov =
13180
13181
  }), this.component = t, this.complete = n;
13181
13182
  }
13182
13183
  });
13183
- var Rv = class e extends CustomEvent {
13184
+ var zv = class e extends CustomEvent {
13184
13185
  static {
13185
13186
  this.TYPE = "session-changed";
13186
13187
  }
@@ -13194,13 +13195,13 @@ var Rv = class e extends CustomEvent {
13194
13195
  }
13195
13196
  }), this.component = t, this.complete = n;
13196
13197
  }
13197
- }, zv = (0, zo.default)("pie-ui:graph-lines"), Bv = (e, t) => {
13198
+ }, Bv = (0, zo.default)("pie-ui:graph-lines"), Vv = (e, t) => {
13198
13199
  if (!e) return !1;
13199
13200
  let n = e.value, r = !0;
13200
13201
  return n && (t.config.prompts || []).forEach((e) => {
13201
13202
  Number.isFinite(n[e.id]) || (r = !1);
13202
13203
  }), r;
13203
- }, Vv = class extends HTMLElement {
13204
+ }, Hv = class extends HTMLElement {
13204
13205
  constructor() {
13205
13206
  super(), this._root = null;
13206
13207
  }
@@ -13214,14 +13215,14 @@ var Rv = class e extends CustomEvent {
13214
13215
  return this._session;
13215
13216
  }
13216
13217
  sessionChanged(e) {
13217
- this._session.value = e.value, this.dispatchEvent(new Rv(this.tagName.toLowerCase(), Bv(this._session, this._model))), zv("session: ", this._session), this._render();
13218
+ this._session.value = e.value, this.dispatchEvent(new zv(this.tagName.toLowerCase(), Vv(this._session, this._model))), Bv("session: ", this._session), this._render();
13218
13219
  }
13219
13220
  connectedCallback() {
13220
13221
  this._render();
13221
13222
  }
13222
13223
  _render() {
13223
13224
  if (!this._model || !this._session) return;
13224
- let e = f.createElement(Lv, {
13225
+ let e = f.createElement(Rv, {
13225
13226
  model: this._model,
13226
13227
  session: this._session,
13227
13228
  onSessionChange: this.sessionChanged.bind(this)
@@ -13235,6 +13236,6 @@ var Rv = class e extends CustomEvent {
13235
13236
  }
13236
13237
  };
13237
13238
  //#endregion
13238
- export { Lv as Component, Vv as default, Bv as isComplete };
13239
+ export { Rv as Component, Hv as default, Vv as isComplete };
13239
13240
 
13240
13241
  //# sourceMappingURL=index.js.map