eat-js-sdk 2.2.18 → 2.2.20

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.
@@ -7468,6 +7468,7 @@ function configureHtmlString(htmlString, maxHeight = "") {
7468
7468
  function PromptSection($$anchor, $$props) {
7469
7469
  push($$props, true);
7470
7470
  let prompt = prop($$props, "prompt", 7);
7471
+ let headerElement = /* @__PURE__ */ user_derived(() => get(promptRubricElem));
7471
7472
  let configuredPrompt = /* @__PURE__ */ user_derived(() => configureHtmlString(prompt()));
7472
7473
  var $$exports = {
7473
7474
  get prompt() {
@@ -7487,6 +7488,9 @@ function PromptSection($$anchor, $$props) {
7487
7488
  return get$1(configuredPrompt);
7488
7489
  },
7489
7490
  otherClass: "item-heading prompt",
7491
+ get htmlHeading() {
7492
+ return get$1(headerElement);
7493
+ },
7490
7494
  dataTestId: "qn-prompt-txt"
7491
7495
  });
7492
7496
  };
@@ -19666,13 +19670,14 @@ function SelectableTextInteractionContent($$anchor, $$props) {
19666
19670
  return stripTags2(s.text) + (s.trailingPunctuation ?? "");
19667
19671
  }).join(" ").replace(/\s+/g, " ").trim());
19668
19672
  let passageReaderLabel = /* @__PURE__ */ user_derived(() => `${get$1(passagePlainText)}`);
19669
- const getSegmentAriaLabel = (segment, seg) => {
19673
+ const getSegmentAriaLabel = (segment, seg, segmentId) => {
19670
19674
  const text = stripTags2(segment.text);
19671
19675
  const parts = [`Option: ${text}`];
19672
19676
  if (seg.isCorrect) parts.push("correct");
19673
19677
  else if (seg.isIncorrect) parts.push("incorrect");
19674
19678
  else if (seg.isMissing) parts.push("missing answer");
19675
19679
  else if (seg.isSegmentSelected) parts.push("selected");
19680
+ else if (deselectedIds.has(segmentId)) parts.push("unselected");
19676
19681
  return parts.length > 1 ? `${parts[0]} (${parts.slice(1).join(", ")})` : parts[0];
19677
19682
  };
19678
19683
  const handleSegmentClick = (segmentId, refocus = false) => {
@@ -19685,6 +19690,12 @@ function SelectableTextInteractionContent($$anchor, $$props) {
19685
19690
  }
19686
19691
  return;
19687
19692
  }
19693
+ const currentSeg = get$1(segmentStates).find((s) => s.segment.id === segmentId)?.seg;
19694
+ if (currentSeg?.isSegmentSelected) {
19695
+ deselectedIds.add(segmentId);
19696
+ } else {
19697
+ deselectedIds.delete(segmentId);
19698
+ }
19688
19699
  onselection()?.(new CustomEvent("selection", { detail: { segmentId } }));
19689
19700
  if (refocus) {
19690
19701
  tick().then(() => {
@@ -19705,9 +19716,10 @@ function SelectableTextInteractionContent($$anchor, $$props) {
19705
19716
  const focusSegment = (el) => {
19706
19717
  el?.focus();
19707
19718
  };
19708
- const handleSegmentFocus = (_segmentId) => {
19719
+ const handleSegmentFocus = (segmentId) => {
19709
19720
  set(exitSegmentId, null);
19710
19721
  if (!get$1(passageMode)) set(passageMode, true);
19722
+ deselectedIds.delete(segmentId);
19711
19723
  };
19712
19724
  const handleSegmentKeydown = (e2, segmentId) => {
19713
19725
  set(
@@ -19717,21 +19729,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
19717
19729
  );
19718
19730
  const focusable = getFocusableSegments();
19719
19731
  const posInDom = focusable.findIndex((el) => el.dataset.segmentId === segmentId);
19720
- if (e2.key === "Escape") {
19721
- e2.preventDefault();
19722
- suppressAutoJump = true;
19723
- set(passageMode, true);
19724
- get$1(passageEl)?.focus();
19725
- setTimeout(
19726
- () => {
19727
- suppressAutoJump = false;
19728
- const firstSeg = getFocusableSegments()[0];
19729
- firstSeg?.focus();
19730
- },
19731
- 400
19732
- );
19733
- return;
19734
- } else if (e2.key === " ") {
19732
+ if (e2.key === " ") {
19735
19733
  e2.preventDefault();
19736
19734
  if (!get$1(sharedState).isPreviewMode) handleSegmentClick(segmentId, true);
19737
19735
  } else if (e2.key === "Enter") {
@@ -19772,6 +19770,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
19772
19770
  ].filter(Boolean).join(" ");
19773
19771
  };
19774
19772
  let pinnedTooltipIds = new SvelteSet();
19773
+ let deselectedIds = new SvelteSet();
19775
19774
  let leavingViaLastSegmentTab = false;
19776
19775
  const handlePassageFocusOut = (e2) => {
19777
19776
  if (leavingViaLastSegmentTab) {
@@ -19783,9 +19782,7 @@ function SelectableTextInteractionContent($$anchor, $$props) {
19783
19782
  set(passageMode, false);
19784
19783
  }
19785
19784
  };
19786
- let suppressAutoJump = false;
19787
19785
  const handleMainFocus = () => {
19788
- if (suppressAutoJump) return;
19789
19786
  requestAnimationFrame(() => {
19790
19787
  const firstSeg = getFocusableSegments()[0];
19791
19788
  if (firstSeg) {
@@ -20239,14 +20236,14 @@ function SelectableTextInteractionContent($$anchor, $$props) {
20239
20236
  set_class(span_6, 1, `${$0 ?? ""}${$1 ?? ""}`);
20240
20237
  set_attribute(span_6, "aria-label", $2);
20241
20238
  set_attribute(span_6, "aria-selected", get$1(computed_const).seg.isSegmentSelected && !get$1(sharedState).isPreviewMode ? true : void 0);
20242
- set_attribute(span_6, "aria-disabled", isDataSaving() || get$1(sharedState).isPreviewMode || get$1(isSessionLocked));
20239
+ set_attribute(span_6, "aria-disabled", get$1(sharedState).isPreviewMode || get$1(isSessionLocked));
20243
20240
  set_attribute(span_6, "data-segment-id", get$1(segment).id);
20244
20241
  set_attribute(span_6, "data-testid", $3);
20245
20242
  },
20246
20243
  [
20247
20244
  () => getSegmentClasses(get$1(computed_const).seg, get$1(isSessionLocked)),
20248
20245
  () => pinnedTooltipIds.has(get$1(segment).id) ? " tooltip-pinned" : "",
20249
- () => getSegmentAriaLabel(get$1(segment), get$1(computed_const).seg),
20246
+ () => getSegmentAriaLabel(get$1(segment), get$1(computed_const).seg, get$1(segment).id),
20250
20247
  () => getSegmentTestId(get$1(computed_const).seg)
20251
20248
  ]
20252
20249
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eat-js-sdk",
3
- "version": "2.2.18",
4
- "change version": "2.2.1",
3
+ "version": "2.2.20",
4
+ "change version": "2.2.0",
5
5
  "description": "Authoring tool frontend SDK",
6
6
  "contributors": [
7
7
  {