@pie-element/mc-populated-blank 0.1.0 → 0.2.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.
- package/README.md +110 -2
- package/dist/controller/defaults.d.ts +85 -0
- package/dist/controller/defaults.d.ts.map +1 -1
- package/dist/controller/index.d.ts.map +1 -1
- package/dist/controller/index.js +109 -4
- package/dist/controller/index.js.map +1 -1
- package/dist/delivery/index.js +334 -398
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.js +10 -18
- package/dist/index.js +334 -398
- package/dist/index.js.map +1 -1
- package/package.json +1 -4
- package/src/controller/defaults.ts +51 -0
- package/src/controller/index.ts +84 -5
- package/src/delivery/McPopulatedBlank.svelte +317 -425
package/dist/index.js
CHANGED
|
@@ -122,14 +122,6 @@ var STALE_REACTION = new class StaleReactionError extends Error {
|
|
|
122
122
|
}
|
|
123
123
|
}();
|
|
124
124
|
var IS_XHTML = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
|
|
125
|
-
/**
|
|
126
|
-
* `%name%(...)` can only be used during component initialisation
|
|
127
|
-
* @param {string} name
|
|
128
|
-
* @returns {never}
|
|
129
|
-
*/
|
|
130
|
-
function lifecycle_outside_component(name) {
|
|
131
|
-
throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
|
|
132
|
-
}
|
|
133
125
|
//#endregion
|
|
134
126
|
//#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/errors.js
|
|
135
127
|
/**
|
|
@@ -3118,23 +3110,6 @@ function event(event_name, dom, handler, capture, passive) {
|
|
|
3118
3110
|
dom.removeEventListener(event_name, target_handler, options);
|
|
3119
3111
|
});
|
|
3120
3112
|
}
|
|
3121
|
-
/**
|
|
3122
|
-
* @param {string} event_name
|
|
3123
|
-
* @param {Element} element
|
|
3124
|
-
* @param {EventListener} [handler]
|
|
3125
|
-
* @returns {void}
|
|
3126
|
-
*/
|
|
3127
|
-
function delegated(event_name, element, handler) {
|
|
3128
|
-
(element[event_symbol] ?? (element[event_symbol] = {}))[event_name] = handler;
|
|
3129
|
-
}
|
|
3130
|
-
/**
|
|
3131
|
-
* @param {Array<string>} events
|
|
3132
|
-
* @returns {void}
|
|
3133
|
-
*/
|
|
3134
|
-
function delegate(events) {
|
|
3135
|
-
for (var i = 0; i < events.length; i++) all_registered_events.add(events[i]);
|
|
3136
|
-
for (var fn of root_event_handles) fn(events);
|
|
3137
|
-
}
|
|
3138
3113
|
var last_propagated_event = null;
|
|
3139
3114
|
/**
|
|
3140
3115
|
* @this {EventTarget}
|
|
@@ -3632,53 +3607,6 @@ var BranchManager = class {
|
|
|
3632
3607
|
}
|
|
3633
3608
|
}
|
|
3634
3609
|
};
|
|
3635
|
-
/**
|
|
3636
|
-
* `onMount`, like [`$effect`](https://svelte.dev/docs/svelte/$effect), schedules a function to run as soon as the component has been mounted to the DOM.
|
|
3637
|
-
* Unlike `$effect`, the provided function only runs once.
|
|
3638
|
-
*
|
|
3639
|
-
* It must be called during the component's initialisation (but doesn't need to live _inside_ the component;
|
|
3640
|
-
* it can be called from an external module). If a function is returned _synchronously_ from `onMount`,
|
|
3641
|
-
* it will be called when the component is unmounted.
|
|
3642
|
-
*
|
|
3643
|
-
* `onMount` functions do not run during [server-side rendering](https://svelte.dev/docs/svelte/svelte-server#render).
|
|
3644
|
-
*
|
|
3645
|
-
* @template T
|
|
3646
|
-
* @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn
|
|
3647
|
-
* @returns {void}
|
|
3648
|
-
*/
|
|
3649
|
-
function onMount(fn) {
|
|
3650
|
-
if (component_context === null) lifecycle_outside_component("onMount");
|
|
3651
|
-
if (legacy_mode_flag && component_context.l !== null) init_update_callbacks(component_context).m.push(fn);
|
|
3652
|
-
else user_effect(() => {
|
|
3653
|
-
const cleanup = untrack(fn);
|
|
3654
|
-
if (typeof cleanup === "function") return cleanup;
|
|
3655
|
-
});
|
|
3656
|
-
}
|
|
3657
|
-
/**
|
|
3658
|
-
* Schedules a callback to run immediately before the component is unmounted.
|
|
3659
|
-
*
|
|
3660
|
-
* Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the
|
|
3661
|
-
* only one that runs inside a server-side component.
|
|
3662
|
-
*
|
|
3663
|
-
* @param {() => any} fn
|
|
3664
|
-
* @returns {void}
|
|
3665
|
-
*/
|
|
3666
|
-
function onDestroy(fn) {
|
|
3667
|
-
if (component_context === null) lifecycle_outside_component("onDestroy");
|
|
3668
|
-
onMount(() => () => untrack(fn));
|
|
3669
|
-
}
|
|
3670
|
-
/**
|
|
3671
|
-
* Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate
|
|
3672
|
-
* @param {ComponentContext} context
|
|
3673
|
-
*/
|
|
3674
|
-
function init_update_callbacks(context) {
|
|
3675
|
-
var l = context.l;
|
|
3676
|
-
return l.u ?? (l.u = {
|
|
3677
|
-
a: [],
|
|
3678
|
-
b: [],
|
|
3679
|
-
m: []
|
|
3680
|
-
});
|
|
3681
|
-
}
|
|
3682
3610
|
//#endregion
|
|
3683
3611
|
//#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/blocks/if.js
|
|
3684
3612
|
/** @import { TemplateNode } from '#client' */
|
|
@@ -4993,49 +4921,116 @@ function create_custom_element(Component, props_definition, slots, exports, shad
|
|
|
4993
4921
|
}
|
|
4994
4922
|
//#endregion
|
|
4995
4923
|
//#region src/delivery/McPopulatedBlank.svelte
|
|
4996
|
-
var root_1 = /* @__PURE__ */ from_html(`<div class="mb-4 prose"></div>`);
|
|
4997
|
-
var root_3 = /* @__PURE__ */ from_html(`<audio class="sr-only svelte-6wlbb4" preload="metadata" aria-hidden="true" tabindex="-1"></audio> <button class="listen-button rli-feature-audio svelte-6wlbb4" type="button"><img alt="" aria-hidden="true"/> <img alt="" aria-hidden="true"/></button>`, 1);
|
|
4998
|
-
var root_5 = /* @__PURE__ */ from_html(`<button class="mt-2 text-sm underline" type="button"> </button>`);
|
|
4999
|
-
var root_4 = /* @__PURE__ */ from_html(`<audio controls="" class="w-full max-w-md" preload="metadata"><track kind="captions"/></audio> <!>`, 1);
|
|
5000
|
-
var root_6 = /* @__PURE__ */ from_html(`<
|
|
5001
|
-
var root_7 = /* @__PURE__ */ from_html(`<p> </p>`);
|
|
5002
|
-
var root_2 = /* @__PURE__ */ from_html(`<div class="mb-4 audio-container svelte-6wlbb4"><!> <!></div>`);
|
|
5003
|
-
var root_8 = /* @__PURE__ */ from_html(`<div class="mb-
|
|
5004
|
-
var
|
|
5005
|
-
var root_11 = /* @__PURE__ */ from_html(`<
|
|
5006
|
-
var root_12 = /* @__PURE__ */ from_html(`<span class="blank-inner
|
|
5007
|
-
var
|
|
5008
|
-
var
|
|
5009
|
-
var root_14 = /* @__PURE__ */ from_html(`<
|
|
5010
|
-
var
|
|
5011
|
-
var root_18 = /* @__PURE__ */ from_html(`<
|
|
5012
|
-
var
|
|
5013
|
-
var
|
|
5014
|
-
var root_21 = /* @__PURE__ */ from_html(`<
|
|
5015
|
-
var
|
|
5016
|
-
var
|
|
5017
|
-
var root_24 = /* @__PURE__ */ from_html(`<span class="text-
|
|
5018
|
-
var
|
|
5019
|
-
var
|
|
5020
|
-
var root = /* @__PURE__ */ from_html(`<div><!> <!> <!> <!> <!> <!> <!> <fieldset class="border-0 p-0 m-0 svelte-6wlbb4"><legend class="sr-only svelte-6wlbb4"> </legend> <div role="radiogroup" tabindex="-1"></div></fieldset></div>`);
|
|
4924
|
+
var root_1 = /* @__PURE__ */ from_html(`<div class="mb-4 prose pie-prompt"></div>`);
|
|
4925
|
+
var root_3 = /* @__PURE__ */ from_html(`<audio class="sr-only pie-audio-player svelte-6wlbb4" preload="metadata" aria-hidden="true" tabindex="-1"></audio> <button class="listen-button pie-listen-button rli-feature-audio svelte-6wlbb4" type="button"><img alt="" aria-hidden="true"/> <img alt="" aria-hidden="true"/></button>`, 1);
|
|
4926
|
+
var root_5 = /* @__PURE__ */ from_html(`<button class="mt-2 text-sm underline pie-audio-autoplay-enable" type="button"> </button>`);
|
|
4927
|
+
var root_4 = /* @__PURE__ */ from_html(`<audio controls="" class="w-full max-w-md pie-audio-player" preload="metadata"><track kind="captions"/></audio> <!>`, 1);
|
|
4928
|
+
var root_6 = /* @__PURE__ */ from_html(`<p class="text-sm text-red-700 pie-audio-error" role="alert"> </p>`);
|
|
4929
|
+
var root_7 = /* @__PURE__ */ from_html(`<p><strong> </strong> </p>`);
|
|
4930
|
+
var root_2 = /* @__PURE__ */ from_html(`<div class="mb-4 audio-container pie-audio-container svelte-6wlbb4"><!> <!></div>`);
|
|
4931
|
+
var root_8 = /* @__PURE__ */ from_html(`<div class="mb-3 prose prose-p:my-1 sentence-line pie-sentence-line svelte-6wlbb4"></div>`);
|
|
4932
|
+
var root_10 = /* @__PURE__ */ from_html(`<img class="w-auto object-contain pie-blank-image" style="max-height:var(--mpb-selected-image-max-height, 4rem);"/>`);
|
|
4933
|
+
var root_11 = /* @__PURE__ */ from_html(`<span class="blank-inner choice-label pie-blank-value svelte-6wlbb4"></span>`);
|
|
4934
|
+
var root_12 = /* @__PURE__ */ from_html(`<span class="blank-inner-empty svelte-6wlbb4" aria-hidden="true"> </span>`);
|
|
4935
|
+
var root_9 = /* @__PURE__ */ from_html(`<div class="mb-4 template-line pie-template-line svelte-6wlbb4"><!> <span role="status" aria-live="polite" aria-atomic="true"><!></span> <!></div>`);
|
|
4936
|
+
var root_13 = /* @__PURE__ */ from_html(`<button type="button" class="mb-3 flex items-center cursor-pointer select-none pie-toggle-correct-answer" style="gap:var(--mpb-toggle-button-gap, 0.5rem);"><span class="text-sm hover:underline"> </span></button>`);
|
|
4937
|
+
var root_14 = /* @__PURE__ */ from_html(`<p class="sr-only pie-result-feedback svelte-6wlbb4" role="status" aria-live="polite"> </p>`);
|
|
4938
|
+
var root_17 = /* @__PURE__ */ from_html(`<img class="object-contain mx-auto pie-choice-image" style="max-height:var(--mpb-choice-image-max-height, 5rem);"/>`);
|
|
4939
|
+
var root_18 = /* @__PURE__ */ from_html(`<span class="choice-label pie-choice-label svelte-6wlbb4"></span>`);
|
|
4940
|
+
var root_16 = /* @__PURE__ */ from_html(`<label class="cursor-pointer choice-tile text-center pie-choice-tile svelte-6wlbb4"><span class="choice-tile-content pie-choice-tile-content svelte-6wlbb4"><!></span> <input type="radio" class="choice-radio-bottom pie-choice-radio pie-choice-radio-bottom svelte-6wlbb4"/></label>`);
|
|
4941
|
+
var root_20 = /* @__PURE__ */ from_html(`<img class="object-contain pie-choice-image" style="max-height:var(--mpb-choice-image-max-height, 5rem);"/>`);
|
|
4942
|
+
var root_21 = /* @__PURE__ */ from_html(`<span class="choice-label pie-choice-label svelte-6wlbb4"></span>`);
|
|
4943
|
+
var root_19 = /* @__PURE__ */ from_html(`<input type="radio" class="choice-radio-inline pie-choice-radio pie-choice-radio-inline svelte-6wlbb4"/> <label class="cursor-pointer flex-1 pie-choice-label-wrap"><!></label>`, 1);
|
|
4944
|
+
var root_23 = /* @__PURE__ */ from_html(`<span class="text-green-600 text-sm font-medium pie-choice-feedback-correct" aria-hidden="true">✓</span>`);
|
|
4945
|
+
var root_24 = /* @__PURE__ */ from_html(`<span class="text-red-600 text-sm font-medium pie-choice-feedback-incorrect" aria-hidden="true">✗</span>`);
|
|
4946
|
+
var root_15 = /* @__PURE__ */ from_html(`<div style="gap:var(--mpb-choice-row-gap, 0.5rem);"><!> <!></div>`);
|
|
4947
|
+
var root = /* @__PURE__ */ from_html(`<div><!> <!> <!> <!> <!> <!> <fieldset class="border-0 p-0 m-0 pie-choices-fieldset svelte-6wlbb4"><legend class="sr-only pie-choices-legend svelte-6wlbb4"> </legend> <div style="gap:var(--mpb-choice-group-gap, 0.5rem);" role="radiogroup" tabindex="-1"></div></fieldset></div>`);
|
|
5021
4948
|
var $$css = {
|
|
5022
4949
|
hash: "svelte-6wlbb4",
|
|
5023
|
-
code: ".sr-only.svelte-6wlbb4 {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;}.mc-populated-blank-root.svelte-6wlbb4 .prose {max-width:none;}.blank-slot.svelte-6wlbb4:focus-within {outline:2px solid var(--pie-focus, #2563eb);outline-offset:2px;}.blank-slot.svelte-6wlbb4 {display:inline-flex;align-items:center;justify-content:center;text-align:center;vertical-align:baseline;}.template-line.svelte-6wlbb4 {white-space:pre-wrap;}.template-line.svelte-6wlbb4 p {margin:0;}.blank-inner-empty.svelte-6wlbb4 {display:inline-block;min-width:4ch;}.blank-slot-standalone.svelte-6wlbb4 {width:7rem;}.listen-button.svelte-6wlbb4 {width:128px;height:128px;border:0;padding:0;background-color:transparent;cursor:pointer;z-index:1;}.listen-button.svelte-6wlbb4:hover {background-color:#e2f1fe;}.listen-feature-icon.svelte-6wlbb4 {width:128px;height:128px;object-fit:contain;display:none;}.listen-feature-icon.listen-active.svelte-6wlbb4 {display:block;}.choice-row-horizontal.svelte-6wlbb4 {flex-direction:column;align-items:center;width:min(170px, 30vw);gap:0;}.choice-tile.svelte-6wlbb4 {display:flex;flex-direction:column;justify-content:space-between;align-items:center;width:100%;min-height:11rem;padding:0.8rem 0.65rem 0.5rem;border-radius:8px;background:transparent;transition:background-color 120ms ease-in-out;}.choice-tile-content.svelte-6wlbb4 {width:100%;display:flex;align-items:center;justify-content:center;min-height:
|
|
4950
|
+
code: ".sr-only.svelte-6wlbb4 {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;}.mc-populated-blank-root.svelte-6wlbb4 .prose {max-width:none;}.blank-slot.svelte-6wlbb4:focus-within {outline:2px solid var(--pie-focus, #2563eb);outline-offset:2px;}.blank-slot.svelte-6wlbb4 {display:inline-flex;align-items:center;justify-content:center;text-align:center;vertical-align:baseline;}.template-line.svelte-6wlbb4 {white-space:pre-wrap;}.template-line.svelte-6wlbb4 p {margin:0;}.blank-inner-empty.svelte-6wlbb4 {display:inline-block;min-width:4ch;}.blank-slot-standalone.svelte-6wlbb4 {width:var(--mpb-blank-standalone-width, 7rem);}.listen-button.svelte-6wlbb4 {width:var(--mpb-listen-button-size, 128px);height:var(--mpb-listen-button-size, 128px);border:0;padding:0;background-color:transparent;cursor:pointer;z-index:1;}.listen-button.svelte-6wlbb4:hover {background-color:#e2f1fe;}.listen-feature-icon.svelte-6wlbb4 {width:var(--mpb-listen-button-size, 128px);height:var(--mpb-listen-button-size, 128px);object-fit:contain;display:none;}.listen-feature-icon.listen-active.svelte-6wlbb4 {display:block;}.choice-row-horizontal.svelte-6wlbb4 {flex-direction:column;align-items:center;width:min(var(--mpb-choice-width-px, 170px), var(--mpb-choice-width-vw, 30vw));gap:0;}.choice-tile.svelte-6wlbb4 {display:flex;flex-direction:column;justify-content:space-between;align-items:center;width:100%;min-height:var(--mpb-choice-tile-min-height, 11rem);padding:0.8rem 0.65rem 0.5rem;border-radius:8px;background:transparent;transition:background-color 120ms ease-in-out;}.choice-tile-content.svelte-6wlbb4 {width:100%;display:flex;align-items:center;justify-content:center;min-height:var(--mpb-choice-content-min-height, 7.5rem);}.choice-row-horizontal.svelte-6wlbb4:hover .choice-tile:where(.svelte-6wlbb4) {background:#ececec;}.choice-row-horizontal.is-selected.svelte-6wlbb4 .choice-tile:where(.svelte-6wlbb4) {background:#eceabf;}.choice-row-horizontal.is-selected.svelte-6wlbb4:hover .choice-tile:where(.svelte-6wlbb4) {background:#eceabf;}.choice-row-horizontal.svelte-6wlbb4 p {margin:0;text-align:center;}.choice-label.svelte-6wlbb4 p,\n .blank-inner.svelte-6wlbb4 p {margin:0;}.blank-inner.svelte-6wlbb4 {width:100%;display:inline-flex;align-items:center;justify-content:center;text-align:center;}.choice-radio-bottom.svelte-6wlbb4 {margin-top:var(--mpb-horizontal-choice-radio-top-margin, 0.5rem);}.choice-radio-inline.svelte-6wlbb4 {margin-top:var(--mpb-horizontal-choice-radio-top-margin, 0.5rem);}.layout-audio_blank_only.svelte-6wlbb4 .audio-container:where(.svelte-6wlbb4),\n .layout-stimulus_image_blank.svelte-6wlbb4 .audio-container:where(.svelte-6wlbb4) {display:flex;justify-content:flex-end;}.layout-audio_blank_only.svelte-6wlbb4 .template-line:where(.svelte-6wlbb4),\n .layout-stimulus_image_blank.svelte-6wlbb4 .template-line:where(.svelte-6wlbb4) {text-align:center;margin:var(--mpb-audio-blank-template-margin-top, 0.8rem) 0\n var(--mpb-audio-blank-template-margin-bottom, 1.8rem);}.layout-audio_blank_only.svelte-6wlbb4 .blank-slot:where(.svelte-6wlbb4),\n .layout-stimulus_image_blank.svelte-6wlbb4 .blank-slot:where(.svelte-6wlbb4) {width:var(--mpb-blank-wide-width, 10rem);border-bottom-width:var(--mpb-blank-underline-wide-width, 4px);}.layout-stimulus_image_blank.svelte-6wlbb4 {display:grid;grid-template-columns:minmax(var(--mpb-stimulus-min-column, 210px), 1fr) auto;grid-template-areas:'sentence audio'\n '. template'\n 'choices choices';column-gap:var(--mpb-stimulus-grid-column-gap, 2rem);row-gap:var(--mpb-stimulus-grid-row-gap, 0.7rem);align-items:start;}.layout-stimulus_image_blank.svelte-6wlbb4 .audio-container:where(.svelte-6wlbb4) {grid-area:audio;margin:0;}.layout-stimulus_image_blank.svelte-6wlbb4 .sentence-line:where(.svelte-6wlbb4) {grid-area:sentence;margin:var(--mpb-stimulus-sentence-margin-top, 0.2rem) 0 0;}.layout-stimulus_image_blank.svelte-6wlbb4 .template-line:where(.svelte-6wlbb4) {grid-area:template;margin:0;text-align:center;justify-self:center;}.layout-stimulus_image_blank.svelte-6wlbb4 fieldset:where(.svelte-6wlbb4) {grid-area:choices;margin-top:var(--mpb-stimulus-choices-margin-top, 0.9rem);}.layout-token_sequence.svelte-6wlbb4 {display:grid;grid-template-columns:minmax(var(--mpb-text-min-column, 260px), 1fr) auto;grid-template-areas:'template audio'\n 'choices choices';column-gap:var(--mpb-token-grid-column-gap, 1.5rem);row-gap:var(--mpb-token-grid-row-gap, 0.8rem);align-items:start;}.layout-token_sequence.svelte-6wlbb4 .audio-container:where(.svelte-6wlbb4) {grid-area:audio;margin:0;justify-self:end;}.layout-token_sequence.svelte-6wlbb4 .template-line:where(.svelte-6wlbb4) {grid-area:template;margin:var(--mpb-token-template-margin-top, 0.6rem) 0 0;justify-self:center;text-align:center;}.layout-token_sequence.svelte-6wlbb4 .template-line:where(.svelte-6wlbb4) span + span {margin-left:var(--mpb-token-inline-token-gap, 0.35rem);}.layout-token_sequence.svelte-6wlbb4 .blank-slot:where(.svelte-6wlbb4) {width:var(--mpb-blank-standalone-width, 7rem);border-bottom-width:var(--mpb-blank-underline-wide-width, 4px);margin-left:var(--mpb-token-inline-token-gap, 0.35rem);}.layout-token_sequence.svelte-6wlbb4 fieldset:where(.svelte-6wlbb4) {grid-area:choices;margin-top:var(--mpb-token-choices-margin-top, 0.2rem);}.layout-inline_sentence.has-inline-audio.svelte-6wlbb4 {display:grid;grid-template-columns:minmax(var(--mpb-text-min-column, 260px), 1fr) auto;grid-template-areas:'template audio'\n 'choices choices';column-gap:var(--mpb-inline-grid-column-gap, 1.5rem);row-gap:var(--mpb-inline-grid-row-gap, 0.65rem);align-items:start;}.layout-inline_sentence.has-inline-audio.svelte-6wlbb4 .audio-container:where(.svelte-6wlbb4) {grid-area:audio;margin:0;justify-self:end;}.layout-inline_sentence.has-inline-audio.svelte-6wlbb4 .template-line:where(.svelte-6wlbb4) {grid-area:template;margin:var(--mpb-inline-template-margin-top, 0.45rem) 0 0;text-align:center;justify-self:center;}.layout-inline_sentence.has-inline-audio.svelte-6wlbb4 fieldset:where(.svelte-6wlbb4) {grid-area:choices;margin-top:var(--mpb-inline-choices-margin-top, 0.25rem);}"
|
|
5024
4951
|
};
|
|
5025
4952
|
function McPopulatedBlank($$anchor, $$props) {
|
|
5026
4953
|
push($$props, true);
|
|
5027
4954
|
append_styles$1($$anchor, $$css);
|
|
5028
4955
|
/** Must match controller `BLANK_TOKEN` (kept local to avoid pulling controller into delivery). */
|
|
5029
4956
|
const BLANK_TOKEN = "{{blank}}";
|
|
4957
|
+
const DEFAULT_LAYOUT_LIMITS = {
|
|
4958
|
+
blankStandaloneWidthRem: 7,
|
|
4959
|
+
blankWideWidthRem: 10,
|
|
4960
|
+
blankUnderlineWidthPx: 2,
|
|
4961
|
+
blankUnderlineWideWidthPx: 4,
|
|
4962
|
+
horizontalChoiceWidthPx: 170,
|
|
4963
|
+
horizontalChoiceWidthVw: 30,
|
|
4964
|
+
horizontalChoiceTileMinHeightRem: 11,
|
|
4965
|
+
horizontalChoiceContentMinHeightRem: 7.5,
|
|
4966
|
+
selectedImageMaxHeightRem: 4,
|
|
4967
|
+
choiceImageMaxHeightRem: 5,
|
|
4968
|
+
listenButtonSizePx: 128,
|
|
4969
|
+
stimulusMinColumnPx: 210,
|
|
4970
|
+
textMinColumnPx: 260,
|
|
4971
|
+
legendMaxChars: 120,
|
|
4972
|
+
choiceGroupGapRem: .5,
|
|
4973
|
+
choiceRowGapRem: .5,
|
|
4974
|
+
toggleButtonGapRem: .5,
|
|
4975
|
+
horizontalChoiceRadioTopMarginRem: .5,
|
|
4976
|
+
audioBlankTemplateMarginTopRem: .8,
|
|
4977
|
+
audioBlankTemplateMarginBottomRem: 1.8,
|
|
4978
|
+
stimulusGridColumnGapRem: 2,
|
|
4979
|
+
stimulusGridRowGapRem: .7,
|
|
4980
|
+
stimulusSentenceMarginTopRem: .2,
|
|
4981
|
+
stimulusChoicesMarginTopRem: .9,
|
|
4982
|
+
tokenGridColumnGapRem: 1.5,
|
|
4983
|
+
tokenGridRowGapRem: .8,
|
|
4984
|
+
tokenTemplateMarginTopRem: .6,
|
|
4985
|
+
tokenInlineTokenGapRem: .35,
|
|
4986
|
+
tokenChoicesMarginTopRem: .2,
|
|
4987
|
+
inlineGridColumnGapRem: 1.5,
|
|
4988
|
+
inlineGridRowGapRem: .65,
|
|
4989
|
+
inlineTemplateMarginTopRem: .45,
|
|
4990
|
+
inlineChoicesMarginTopRem: .25
|
|
4991
|
+
};
|
|
4992
|
+
const DEFAULT_LAYOUT_PROFILE_PRESETS = {
|
|
4993
|
+
audio_blank_only: {
|
|
4994
|
+
blankWideWidthRem: 10,
|
|
4995
|
+
blankUnderlineWideWidthPx: 4
|
|
4996
|
+
},
|
|
4997
|
+
stimulus_image_blank: {
|
|
4998
|
+
blankWideWidthRem: 10,
|
|
4999
|
+
blankUnderlineWideWidthPx: 4
|
|
5000
|
+
},
|
|
5001
|
+
token_sequence: {
|
|
5002
|
+
blankStandaloneWidthRem: 7,
|
|
5003
|
+
blankUnderlineWideWidthPx: 4
|
|
5004
|
+
}
|
|
5005
|
+
};
|
|
5006
|
+
const DEFAULT_AUDIO_BUTTON_SKINS = {
|
|
5007
|
+
default: {
|
|
5008
|
+
silentUrl: "https://assets.learnosity.com/organisations/844/0c9f2aa3-3cd5-4de7-93ef-541c24ca35da.svg",
|
|
5009
|
+
playingUrl: "https://assets.learnosity.com/organisations/844/231dfdc2-c113-4be5-91fb-e75a0ca5994b.svg"
|
|
5010
|
+
},
|
|
5011
|
+
es: {
|
|
5012
|
+
silentUrl: "https://assets.learnosity.com/organisations/844/27a9d5b5-d873-4bd5-b9ba-22748782d8ba.svg",
|
|
5013
|
+
playingUrl: "https://assets.learnosity.com/organisations/844/120f216d-96b7-4560-94b8-1d90710216b7.svg"
|
|
5014
|
+
}
|
|
5015
|
+
};
|
|
5016
|
+
const DEFAULT_UI_TEXT = {
|
|
5017
|
+
answerChoices: "Answer choices",
|
|
5018
|
+
selectedAnswerInSentence: "Selected answer in sentence",
|
|
5019
|
+
showCorrectAnswer: "Show correct answer",
|
|
5020
|
+
hideCorrectAnswer: "Hide correct answer",
|
|
5021
|
+
clickToEnableAutoplay: "Click to enable audio autoplay",
|
|
5022
|
+
audioResourceUnavailable: "Audio is enabled but no playable audio URL is configured.",
|
|
5023
|
+
transcriptLabel: "Transcript",
|
|
5024
|
+
listenLabelEn: "Listen",
|
|
5025
|
+
listenLabelEs: "Escuchar"
|
|
5026
|
+
};
|
|
5030
5027
|
let audioEl = /* @__PURE__ */ state(null);
|
|
5031
|
-
let activeUtterance = /* @__PURE__ */ state(null);
|
|
5032
|
-
let isSynthSpeaking = /* @__PURE__ */ state(false);
|
|
5033
5028
|
let isMediaPlaying = /* @__PURE__ */ state(false);
|
|
5034
5029
|
let localChoiceId = /* @__PURE__ */ state("");
|
|
5035
5030
|
let autoPlayPromptOpen = /* @__PURE__ */ state(false);
|
|
5036
5031
|
let autoplayAttempted = /* @__PURE__ */ state(false);
|
|
5037
5032
|
const instanceId = `mc-populated-blank-${Math.random().toString(36).slice(2, 10)}`;
|
|
5038
|
-
const isEvaluateMode = /* @__PURE__ */ user_derived(() => $$props?.model?.mode === "evaluate");
|
|
5033
|
+
const isEvaluateMode = /* @__PURE__ */ user_derived(() => $$props?.model?.env?.mode === "evaluate");
|
|
5039
5034
|
const correctness = /* @__PURE__ */ user_derived(() => $$props?.model?.correctness);
|
|
5040
5035
|
const isCorrect = /* @__PURE__ */ user_derived(() => get(correctness) === "correct");
|
|
5041
5036
|
const isIncorrect = /* @__PURE__ */ user_derived(() => get(correctness) === "incorrect");
|
|
@@ -5048,13 +5043,68 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5048
5043
|
const layoutProfile = /* @__PURE__ */ user_derived(() => $$props?.model?.layoutProfile || "");
|
|
5049
5044
|
const choiceLayout = /* @__PURE__ */ user_derived(() => $$props?.model?.choiceLayout || (get(isAudioOnlyMode) || get(isBlankOnlyTemplate) ? "horizontal" : "vertical"));
|
|
5050
5045
|
const isHorizontalChoices = /* @__PURE__ */ user_derived(() => get(choiceLayout) === "horizontal");
|
|
5051
|
-
const isVicFamilyLayout = /* @__PURE__ */ user_derived(() => get(layoutProfile) === "inline_sentence" && !get(isHorizontalChoices));
|
|
5052
|
-
const isSelVicFamilyLayout = /* @__PURE__ */ user_derived(() => get(isVicFamilyLayout) && !!$$props?.model?.hasAudio);
|
|
5053
5046
|
const showVisibleTranscript = /* @__PURE__ */ user_derived(() => !!$$props?.model?.showVisibleTranscript);
|
|
5054
5047
|
const hasPlayableAudio = /* @__PURE__ */ user_derived(() => !!$$props?.model?.hasAudio && !!$$props?.model?.audioUrl);
|
|
5055
|
-
const
|
|
5048
|
+
const hasAudioButMissingResource = /* @__PURE__ */ user_derived(() => !!$$props?.model?.hasAudio && !$$props?.model?.audioUrl);
|
|
5056
5049
|
const hasInlineSentenceAudioLayout = /* @__PURE__ */ user_derived(() => get(layoutProfile) === "inline_sentence" && !!$$props?.model?.hasAudio);
|
|
5050
|
+
const uiText = /* @__PURE__ */ user_derived(() => ({
|
|
5051
|
+
...DEFAULT_UI_TEXT,
|
|
5052
|
+
...$$props?.model?.uiText || {}
|
|
5053
|
+
}));
|
|
5054
|
+
const profilePresetLimits = /* @__PURE__ */ user_derived(() => {
|
|
5055
|
+
const profile = String(get(layoutProfile) || "");
|
|
5056
|
+
const defaults = DEFAULT_LAYOUT_PROFILE_PRESETS[profile] || {};
|
|
5057
|
+
const customPresets = $$props?.model?.layoutProfilePresets && typeof $$props.model.layoutProfilePresets === "object" ? $$props.model.layoutProfilePresets : {};
|
|
5058
|
+
const custom = customPresets[profile] && typeof customPresets[profile] === "object" ? customPresets[profile] : {};
|
|
5059
|
+
return {
|
|
5060
|
+
...defaults,
|
|
5061
|
+
...custom
|
|
5062
|
+
};
|
|
5063
|
+
});
|
|
5064
|
+
const layoutLimits = /* @__PURE__ */ user_derived(() => {
|
|
5065
|
+
const configured = $$props?.model?.layoutLimits && typeof $$props.model.layoutLimits === "object" ? $$props.model.layoutLimits : {};
|
|
5066
|
+
return {
|
|
5067
|
+
...DEFAULT_LAYOUT_LIMITS,
|
|
5068
|
+
...get(profilePresetLimits),
|
|
5069
|
+
...configured
|
|
5070
|
+
};
|
|
5071
|
+
});
|
|
5072
|
+
const rootStyle = /* @__PURE__ */ user_derived(() => [
|
|
5073
|
+
`--mpb-listen-button-size:${get(layoutLimits).listenButtonSizePx}px`,
|
|
5074
|
+
`--mpb-blank-standalone-width:${get(layoutLimits).blankStandaloneWidthRem}rem`,
|
|
5075
|
+
`--mpb-blank-wide-width:${get(layoutLimits).blankWideWidthRem}rem`,
|
|
5076
|
+
`--mpb-blank-underline-width:${get(layoutLimits).blankUnderlineWidthPx}px`,
|
|
5077
|
+
`--mpb-blank-underline-wide-width:${get(layoutLimits).blankUnderlineWideWidthPx}px`,
|
|
5078
|
+
`--mpb-selected-image-max-height:${get(layoutLimits).selectedImageMaxHeightRem}rem`,
|
|
5079
|
+
`--mpb-choice-image-max-height:${get(layoutLimits).choiceImageMaxHeightRem}rem`,
|
|
5080
|
+
`--mpb-choice-width-px:${get(layoutLimits).horizontalChoiceWidthPx}px`,
|
|
5081
|
+
`--mpb-choice-width-vw:${get(layoutLimits).horizontalChoiceWidthVw}vw`,
|
|
5082
|
+
`--mpb-choice-tile-min-height:${get(layoutLimits).horizontalChoiceTileMinHeightRem}rem`,
|
|
5083
|
+
`--mpb-choice-content-min-height:${get(layoutLimits).horizontalChoiceContentMinHeightRem}rem`,
|
|
5084
|
+
`--mpb-stimulus-min-column:${get(layoutLimits).stimulusMinColumnPx}px`,
|
|
5085
|
+
`--mpb-text-min-column:${get(layoutLimits).textMinColumnPx}px`,
|
|
5086
|
+
`--mpb-choice-group-gap:${get(layoutLimits).choiceGroupGapRem}rem`,
|
|
5087
|
+
`--mpb-choice-row-gap:${get(layoutLimits).choiceRowGapRem}rem`,
|
|
5088
|
+
`--mpb-toggle-button-gap:${get(layoutLimits).toggleButtonGapRem}rem`,
|
|
5089
|
+
`--mpb-horizontal-choice-radio-top-margin:${get(layoutLimits).horizontalChoiceRadioTopMarginRem}rem`,
|
|
5090
|
+
`--mpb-audio-blank-template-margin-top:${get(layoutLimits).audioBlankTemplateMarginTopRem}rem`,
|
|
5091
|
+
`--mpb-audio-blank-template-margin-bottom:${get(layoutLimits).audioBlankTemplateMarginBottomRem}rem`,
|
|
5092
|
+
`--mpb-stimulus-grid-column-gap:${get(layoutLimits).stimulusGridColumnGapRem}rem`,
|
|
5093
|
+
`--mpb-stimulus-grid-row-gap:${get(layoutLimits).stimulusGridRowGapRem}rem`,
|
|
5094
|
+
`--mpb-stimulus-sentence-margin-top:${get(layoutLimits).stimulusSentenceMarginTopRem}rem`,
|
|
5095
|
+
`--mpb-stimulus-choices-margin-top:${get(layoutLimits).stimulusChoicesMarginTopRem}rem`,
|
|
5096
|
+
`--mpb-token-grid-column-gap:${get(layoutLimits).tokenGridColumnGapRem}rem`,
|
|
5097
|
+
`--mpb-token-grid-row-gap:${get(layoutLimits).tokenGridRowGapRem}rem`,
|
|
5098
|
+
`--mpb-token-template-margin-top:${get(layoutLimits).tokenTemplateMarginTopRem}rem`,
|
|
5099
|
+
`--mpb-token-inline-token-gap:${get(layoutLimits).tokenInlineTokenGapRem}rem`,
|
|
5100
|
+
`--mpb-token-choices-margin-top:${get(layoutLimits).tokenChoicesMarginTopRem}rem`,
|
|
5101
|
+
`--mpb-inline-grid-column-gap:${get(layoutLimits).inlineGridColumnGapRem}rem`,
|
|
5102
|
+
`--mpb-inline-grid-row-gap:${get(layoutLimits).inlineGridRowGapRem}rem`,
|
|
5103
|
+
`--mpb-inline-template-margin-top:${get(layoutLimits).inlineTemplateMarginTopRem}rem`,
|
|
5104
|
+
`--mpb-inline-choices-margin-top:${get(layoutLimits).inlineChoicesMarginTopRem}rem`
|
|
5105
|
+
].join(";"));
|
|
5057
5106
|
const useFeatureButtonAudio = /* @__PURE__ */ user_derived(() => {
|
|
5107
|
+
if (typeof $$props?.model?.useFeatureButtonAudio === "boolean") return !!$$props.model.useFeatureButtonAudio;
|
|
5058
5108
|
const profile = get(layoutProfile) || "";
|
|
5059
5109
|
return !!$$props?.model?.hasAudio && (profile === "audio_blank_only" || profile === "stimulus_image_blank" || profile === "token_sequence");
|
|
5060
5110
|
});
|
|
@@ -5070,48 +5120,16 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5070
5120
|
after: t.slice(idx + 9)
|
|
5071
5121
|
};
|
|
5072
5122
|
});
|
|
5073
|
-
function plainTextFromHtml(value = "") {
|
|
5074
|
-
return value.replace(/<[^>]+>/g, " ").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
5075
|
-
}
|
|
5076
5123
|
const blankWidth = /* @__PURE__ */ user_derived(() => {
|
|
5077
|
-
if (get(layoutProfile) === "audio_blank_only" || get(layoutProfile) === "stimulus_image_blank") return
|
|
5078
|
-
if (get(isBlankOnlyTemplate)) return
|
|
5079
|
-
if (get(choiceMode) === "text") {
|
|
5080
|
-
const longestChoiceChars = (Array.isArray($$props?.model?.choices) ? $$props.model.choices : []).reduce((max, choice) => {
|
|
5081
|
-
const textLength = plainTextFromHtml(choice?.labelHtml || "").length;
|
|
5082
|
-
return Math.max(max, textLength);
|
|
5083
|
-
}, 0);
|
|
5084
|
-
if (longestChoiceChars > 0) return `${Math.min(24, Math.max(7, longestChoiceChars + 1))}ch`;
|
|
5085
|
-
}
|
|
5124
|
+
if (get(layoutProfile) === "audio_blank_only" || get(layoutProfile) === "stimulus_image_blank") return `${get(layoutLimits).blankWideWidthRem}rem`;
|
|
5125
|
+
if (get(isBlankOnlyTemplate)) return `${get(layoutLimits).blankStandaloneWidthRem}rem`;
|
|
5086
5126
|
return "auto";
|
|
5087
5127
|
});
|
|
5088
5128
|
const blankBorderWidth = /* @__PURE__ */ user_derived(() => {
|
|
5089
|
-
if (get(layoutProfile) === "audio_blank_only" || get(layoutProfile) === "stimulus_image_blank") return
|
|
5090
|
-
return
|
|
5129
|
+
if (get(layoutProfile) === "audio_blank_only" || get(layoutProfile) === "stimulus_image_blank") return `${get(layoutLimits).blankUnderlineWideWidthPx}px`;
|
|
5130
|
+
return `${get(layoutLimits).blankUnderlineWidthPx}px`;
|
|
5091
5131
|
});
|
|
5092
5132
|
const choices = /* @__PURE__ */ user_derived(() => Array.isArray($$props?.model?.choices) ? $$props.model.choices : []);
|
|
5093
|
-
const shouldShuffleChoices = /* @__PURE__ */ user_derived(() => {
|
|
5094
|
-
const modelShuffle = !!$$props?.model?.shuffle;
|
|
5095
|
-
const optionsShuffle = !!$$props?.options?.shuffle;
|
|
5096
|
-
const lockChoiceOrder = !!$$props?.model?.lockChoiceOrder || !!$$props?.options?.lockChoiceOrder;
|
|
5097
|
-
return (modelShuffle || optionsShuffle) && !lockChoiceOrder;
|
|
5098
|
-
});
|
|
5099
|
-
const shuffleSeed = /* @__PURE__ */ user_derived(() => `${$$props?.session?.id || $$props?.model?.id || instanceId}:${get(choices).map((c) => c.id).join("|")}`);
|
|
5100
|
-
function hashString(value) {
|
|
5101
|
-
let hash = 2166136261;
|
|
5102
|
-
for (let i = 0; i < value.length; i++) {
|
|
5103
|
-
hash ^= value.charCodeAt(i);
|
|
5104
|
-
hash = Math.imul(hash, 16777619);
|
|
5105
|
-
}
|
|
5106
|
-
return hash >>> 0;
|
|
5107
|
-
}
|
|
5108
|
-
function deterministicShuffle(items, seed) {
|
|
5109
|
-
return [...items].map((item, index) => ({
|
|
5110
|
-
item,
|
|
5111
|
-
key: hashString(`${seed}:${item?.id || index}:${index}`)
|
|
5112
|
-
})).sort((a, b) => a.key - b.key).map((entry) => entry.item);
|
|
5113
|
-
}
|
|
5114
|
-
const renderedChoices = /* @__PURE__ */ user_derived(() => get(shouldShuffleChoices) ? deterministicShuffle(get(choices), get(shuffleSeed)) : get(choices));
|
|
5115
5133
|
const choiceMode = /* @__PURE__ */ user_derived(() => $$props?.model?.choiceMode || "text");
|
|
5116
5134
|
const selectedId = /* @__PURE__ */ user_derived(() => $$props?.session?.choiceId || get(localChoiceId) || "");
|
|
5117
5135
|
const radioGroupName = /* @__PURE__ */ user_derived(() => `${instanceId}-choice-group-${$$props?.model?.id || "1"}`);
|
|
@@ -5120,10 +5138,11 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5120
5138
|
if (get(isEvaluateMode) && get(showCorrectAnswer) && $$props?.model?.correctChoiceId) return $$props.model.correctChoiceId;
|
|
5121
5139
|
return get(selectedId);
|
|
5122
5140
|
});
|
|
5123
|
-
const displayChoice = /* @__PURE__ */ user_derived(() => get(
|
|
5141
|
+
const displayChoice = /* @__PURE__ */ user_derived(() => get(choices).find((c) => c.id === get(displayChoiceId)));
|
|
5124
5142
|
const legendText = /* @__PURE__ */ user_derived(() => {
|
|
5125
|
-
const plain =
|
|
5126
|
-
|
|
5143
|
+
const plain = ($$props?.model?.prompt || "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
5144
|
+
const maxChars = Math.max(8, Number(get(layoutLimits).legendMaxChars) || DEFAULT_LAYOUT_LIMITS.legendMaxChars);
|
|
5145
|
+
return plain.length > maxChars ? `${plain.slice(0, Math.max(1, maxChars - 1))}…` : plain || get(uiText).answerChoices;
|
|
5127
5146
|
});
|
|
5128
5147
|
const promptId = /* @__PURE__ */ user_derived(() => `${instanceId}-prompt`);
|
|
5129
5148
|
const transcriptId = /* @__PURE__ */ user_derived(() => `${instanceId}-transcript`);
|
|
@@ -5140,43 +5159,27 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5140
5159
|
const locale = $$props?.model?.locale || "";
|
|
5141
5160
|
return locale ? locale.slice(0, 2) : "en";
|
|
5142
5161
|
});
|
|
5143
|
-
const
|
|
5144
|
-
en: {
|
|
5145
|
-
answerChoices: "Answer choices",
|
|
5146
|
-
correctSelected: "Correct answer selected",
|
|
5147
|
-
incorrectSelected: "Incorrect answer selected",
|
|
5148
|
-
selectedAnswerInSentence: "Selected answer in sentence",
|
|
5149
|
-
selectedAnswerImage: "Selected answer image",
|
|
5150
|
-
showCorrect: "Show correct answer",
|
|
5151
|
-
hideCorrect: "Hide correct answer",
|
|
5152
|
-
enableAutoplay: "Click to enable audio autoplay",
|
|
5153
|
-
listen: "Listen",
|
|
5154
|
-
teacherInstructions: "Teacher instructions"
|
|
5155
|
-
},
|
|
5156
|
-
es: {
|
|
5157
|
-
answerChoices: "Opciones de respuesta",
|
|
5158
|
-
correctSelected: "Respuesta correcta seleccionada",
|
|
5159
|
-
incorrectSelected: "Respuesta incorrecta seleccionada",
|
|
5160
|
-
selectedAnswerInSentence: "Respuesta seleccionada en la oración",
|
|
5161
|
-
selectedAnswerImage: "Imagen de la respuesta seleccionada",
|
|
5162
|
-
showCorrect: "Mostrar respuesta correcta",
|
|
5163
|
-
hideCorrect: "Ocultar respuesta correcta",
|
|
5164
|
-
enableAutoplay: "Haga clic para habilitar la reproducción automática de audio",
|
|
5165
|
-
listen: "Escuchar",
|
|
5166
|
-
teacherInstructions: "Instrucciones para el docente"
|
|
5167
|
-
}
|
|
5168
|
-
};
|
|
5169
|
-
function t(key) {
|
|
5170
|
-
return (get(lang) === "es" ? uiStrings.es[key] : uiStrings.en[key]) || uiStrings.en[key];
|
|
5171
|
-
}
|
|
5162
|
+
const audioErrorMessage = /* @__PURE__ */ user_derived(() => get(hasAudioButMissingResource) ? get(uiText).audioResourceUnavailable : "");
|
|
5172
5163
|
const resultText = /* @__PURE__ */ user_derived(() => {
|
|
5173
5164
|
if (!get(isEvaluateMode) || get(showCorrectAnswer)) return "";
|
|
5174
|
-
if (get(isCorrect)) return
|
|
5175
|
-
if (get(isIncorrect) && get(selectedId)) return
|
|
5165
|
+
if (get(isCorrect)) return "Correct answer selected";
|
|
5166
|
+
if (get(isIncorrect) && get(selectedId)) return "Incorrect answer selected";
|
|
5176
5167
|
return "";
|
|
5177
5168
|
});
|
|
5178
|
-
function emitSession(updatedSession) {
|
|
5179
|
-
|
|
5169
|
+
function emitSession(updatedSession, sourceEl) {
|
|
5170
|
+
const host = sourceEl?.closest?.("mc-populated-blank-element") || document.querySelector("mc-populated-blank-element");
|
|
5171
|
+
if (host?.onSessionChange) {
|
|
5172
|
+
host.onSessionChange(updatedSession);
|
|
5173
|
+
return;
|
|
5174
|
+
}
|
|
5175
|
+
host?.dispatchEvent(new CustomEvent("session-changed", {
|
|
5176
|
+
bubbles: true,
|
|
5177
|
+
composed: true,
|
|
5178
|
+
detail: {
|
|
5179
|
+
complete: !!updatedSession?.choiceId,
|
|
5180
|
+
component: "mc-populated-blank"
|
|
5181
|
+
}
|
|
5182
|
+
}));
|
|
5180
5183
|
}
|
|
5181
5184
|
function onRadioChange(e) {
|
|
5182
5185
|
const input = e.target;
|
|
@@ -5188,7 +5191,7 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5188
5191
|
id: $$props.session?.id || $$props.model?.id || "1",
|
|
5189
5192
|
element: "mc-populated-blank",
|
|
5190
5193
|
choiceId
|
|
5191
|
-
});
|
|
5194
|
+
}, input);
|
|
5192
5195
|
}
|
|
5193
5196
|
function toggleCorrectAnswer() {
|
|
5194
5197
|
set(showCorrectAnswer, !get(showCorrectAnswer));
|
|
@@ -5215,71 +5218,35 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5215
5218
|
next.focus();
|
|
5216
5219
|
}
|
|
5217
5220
|
function handleEnableAutoplayClick() {
|
|
5218
|
-
if (get(hasPlayableAudio) && get(audioEl)) {
|
|
5219
|
-
get(audioEl).play().finally(() => {
|
|
5220
|
-
set(autoPlayPromptOpen, false);
|
|
5221
|
-
});
|
|
5222
|
-
return;
|
|
5223
|
-
}
|
|
5224
|
-
if (get(hasTranscriptOnlyAudio)) {
|
|
5225
|
-
speakTranscript();
|
|
5221
|
+
if (get(hasPlayableAudio) && get(audioEl)) get(audioEl).play().finally(() => {
|
|
5226
5222
|
set(autoPlayPromptOpen, false);
|
|
5227
|
-
}
|
|
5223
|
+
});
|
|
5228
5224
|
}
|
|
5229
|
-
function onAudioPlaying() {
|
|
5225
|
+
function onAudioPlaying(e) {
|
|
5226
|
+
const host = e.currentTarget?.closest("mc-populated-blank-element");
|
|
5230
5227
|
set(isMediaPlaying, true);
|
|
5231
|
-
|
|
5228
|
+
host?.onAudioStarted?.();
|
|
5232
5229
|
set(autoPlayPromptOpen, false);
|
|
5233
5230
|
}
|
|
5234
|
-
function onAudioEnded() {
|
|
5231
|
+
function onAudioEnded(e) {
|
|
5232
|
+
const host = e.currentTarget?.closest("mc-populated-blank-element");
|
|
5235
5233
|
set(isMediaPlaying, false);
|
|
5236
|
-
|
|
5234
|
+
host?.onAudioEnded?.();
|
|
5237
5235
|
}
|
|
5238
|
-
function speechButtonLabel() {
|
|
5239
|
-
return
|
|
5236
|
+
function speechButtonLabel(locale = "") {
|
|
5237
|
+
return locale.toLowerCase().startsWith("es") ? get(uiText).listenLabelEs : get(uiText).listenLabelEn;
|
|
5240
5238
|
}
|
|
5241
5239
|
const featureAudioSkin = /* @__PURE__ */ user_derived(() => {
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
playingUrl: "https://assets.learnosity.com/organisations/844/231dfdc2-c113-4be5-91fb-e75a0ca5994b.svg"
|
|
5249
|
-
};
|
|
5240
|
+
const locale = String($$props?.model?.locale || "").toLowerCase();
|
|
5241
|
+
const lang = locale.slice(0, 2);
|
|
5242
|
+
const byLocale = $$props?.model?.audioButtonSkinsByLocale && typeof $$props.model.audioButtonSkinsByLocale === "object" ? $$props.model.audioButtonSkinsByLocale : {};
|
|
5243
|
+
const customSingle = $$props?.model?.audioButtonSkin && typeof $$props.model.audioButtonSkin === "object" ? $$props.model.audioButtonSkin : null;
|
|
5244
|
+
const defaultSkin = locale.startsWith("es") ? DEFAULT_AUDIO_BUTTON_SKINS.es : DEFAULT_AUDIO_BUTTON_SKINS.default;
|
|
5245
|
+
return byLocale[locale] || byLocale[lang] || byLocale.default || customSingle || defaultSkin;
|
|
5250
5246
|
});
|
|
5251
5247
|
function playFeatureAudio() {
|
|
5252
|
-
if (get(hasPlayableAudio) && get(audioEl)) {
|
|
5253
|
-
get(audioEl).play().catch(() => {});
|
|
5254
|
-
return;
|
|
5255
|
-
}
|
|
5256
|
-
speakTranscript();
|
|
5257
|
-
}
|
|
5258
|
-
function speakTranscript() {
|
|
5259
|
-
const transcript = ($$props?.model?.audioTranscript || "").trim();
|
|
5260
|
-
if (!transcript || !window?.speechSynthesis) return;
|
|
5261
|
-
window.speechSynthesis.cancel();
|
|
5262
|
-
const utterance = new SpeechSynthesisUtterance(transcript);
|
|
5263
|
-
utterance.lang = $$props?.model?.locale || "en-US";
|
|
5264
|
-
utterance.onstart = () => {
|
|
5265
|
-
set(isSynthSpeaking, true);
|
|
5266
|
-
$$props?.onAudioStarted?.();
|
|
5267
|
-
};
|
|
5268
|
-
utterance.onend = () => {
|
|
5269
|
-
set(isSynthSpeaking, false);
|
|
5270
|
-
set(activeUtterance, null);
|
|
5271
|
-
$$props?.onAudioEnded?.();
|
|
5272
|
-
};
|
|
5273
|
-
utterance.onerror = () => {
|
|
5274
|
-
set(isSynthSpeaking, false);
|
|
5275
|
-
set(activeUtterance, null);
|
|
5276
|
-
};
|
|
5277
|
-
set(activeUtterance, utterance, true);
|
|
5278
|
-
window.speechSynthesis.speak(utterance);
|
|
5248
|
+
if (get(hasPlayableAudio) && get(audioEl)) get(audioEl).play().catch(() => {});
|
|
5279
5249
|
}
|
|
5280
|
-
onDestroy(() => {
|
|
5281
|
-
if (get(activeUtterance) && window?.speechSynthesis) window.speechSynthesis.cancel();
|
|
5282
|
-
});
|
|
5283
5250
|
user_effect(() => {
|
|
5284
5251
|
if ($$props?.session?.choiceId) set(localChoiceId, $$props.session.choiceId, true);
|
|
5285
5252
|
});
|
|
@@ -5287,13 +5254,9 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5287
5254
|
if (!$$props?.model?.hasAudio || !$$props?.model?.autoplayAudioEnabled) return;
|
|
5288
5255
|
if (get(autoplayAttempted)) return;
|
|
5289
5256
|
set(autoplayAttempted, true);
|
|
5290
|
-
if (get(audioEl) && $$props?.model?.audioUrl) {
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
});
|
|
5294
|
-
return;
|
|
5295
|
-
}
|
|
5296
|
-
if ($$props?.model?.audioTranscript) set(autoPlayPromptOpen, true);
|
|
5257
|
+
if (get(audioEl) && $$props?.model?.audioUrl) get(audioEl).play().catch(() => {
|
|
5258
|
+
set(autoPlayPromptOpen, true);
|
|
5259
|
+
});
|
|
5297
5260
|
});
|
|
5298
5261
|
var div = root();
|
|
5299
5262
|
var node = child(div);
|
|
@@ -5322,14 +5285,14 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5322
5285
|
template_effect(($0) => {
|
|
5323
5286
|
set_attribute(audio, "src", $$props.model.audioUrl);
|
|
5324
5287
|
set_attribute(button, "aria-label", $0);
|
|
5325
|
-
set_class(img, 1, `listen-feature-icon rli-feature-listen ${get(isMediaPlaying)
|
|
5288
|
+
set_class(img, 1, `listen-feature-icon pie-listen-icon rli-feature-listen ${get(isMediaPlaying) ? "" : "listen-active"}`, "svelte-6wlbb4");
|
|
5326
5289
|
set_attribute(img, "src", get(featureAudioSkin).silentUrl);
|
|
5327
|
-
set_class(img_1, 1, `listen-feature-icon rli-feature-listen ${get(isMediaPlaying)
|
|
5290
|
+
set_class(img_1, 1, `listen-feature-icon pie-listen-icon rli-feature-listen ${get(isMediaPlaying) ? "listen-active" : ""}`, "svelte-6wlbb4");
|
|
5328
5291
|
set_attribute(img_1, "src", get(featureAudioSkin).playingUrl);
|
|
5329
|
-
}, [() => speechButtonLabel()]);
|
|
5292
|
+
}, [() => speechButtonLabel($$props?.model?.locale)]);
|
|
5330
5293
|
event("playing", audio, onAudioPlaying);
|
|
5331
5294
|
event("ended", audio, onAudioEnded);
|
|
5332
|
-
|
|
5295
|
+
event("click", button, playFeatureAudio);
|
|
5333
5296
|
append($$anchor, fragment);
|
|
5334
5297
|
};
|
|
5335
5298
|
var consequent_3 = ($$anchor) => {
|
|
@@ -5341,8 +5304,8 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5341
5304
|
var button_1 = root_5();
|
|
5342
5305
|
var text = child(button_1, true);
|
|
5343
5306
|
reset(button_1);
|
|
5344
|
-
template_effect((
|
|
5345
|
-
|
|
5307
|
+
template_effect(() => set_text(text, get(uiText).clickToEnableAutoplay));
|
|
5308
|
+
event("click", button_1, handleEnableAutoplayClick);
|
|
5346
5309
|
append($$anchor, button_1);
|
|
5347
5310
|
};
|
|
5348
5311
|
if_block(node_3, ($$render) => {
|
|
@@ -5357,36 +5320,32 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5357
5320
|
append($$anchor, fragment_1);
|
|
5358
5321
|
};
|
|
5359
5322
|
var consequent_4 = ($$anchor) => {
|
|
5360
|
-
var
|
|
5361
|
-
var
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
set_attribute(button_2, "aria-label", $0);
|
|
5366
|
-
set_class(img_2, 1, `listen-feature-icon rli-feature-listen ${get(isMediaPlaying) || get(isSynthSpeaking) ? "" : "listen-active"}`, "svelte-6wlbb4");
|
|
5367
|
-
set_attribute(img_2, "src", get(featureAudioSkin).silentUrl);
|
|
5368
|
-
set_class(img_3, 1, `listen-feature-icon rli-feature-listen ${get(isMediaPlaying) || get(isSynthSpeaking) ? "listen-active" : ""}`, "svelte-6wlbb4");
|
|
5369
|
-
set_attribute(img_3, "src", get(featureAudioSkin).playingUrl);
|
|
5370
|
-
}, [() => speechButtonLabel()]);
|
|
5371
|
-
delegated("click", button_2, playFeatureAudio);
|
|
5372
|
-
append($$anchor, button_2);
|
|
5323
|
+
var p = root_6();
|
|
5324
|
+
var text_1 = child(p, true);
|
|
5325
|
+
reset(p);
|
|
5326
|
+
template_effect(() => set_text(text_1, get(audioErrorMessage)));
|
|
5327
|
+
append($$anchor, p);
|
|
5373
5328
|
};
|
|
5374
5329
|
if_block(node_2, ($$render) => {
|
|
5375
5330
|
if (get(hasPlayableAudio) && get(useFeatureButtonAudio)) $$render(consequent_1);
|
|
5376
5331
|
else if (get(hasPlayableAudio)) $$render(consequent_3, 1);
|
|
5377
|
-
else if (get(
|
|
5332
|
+
else if (get(hasAudioButMissingResource)) $$render(consequent_4, 2);
|
|
5378
5333
|
});
|
|
5379
5334
|
var node_4 = sibling(node_2, 2);
|
|
5380
5335
|
var consequent_5 = ($$anchor) => {
|
|
5381
|
-
var
|
|
5382
|
-
var
|
|
5383
|
-
|
|
5336
|
+
var p_1 = root_7();
|
|
5337
|
+
var strong = child(p_1);
|
|
5338
|
+
var text_2 = child(strong);
|
|
5339
|
+
reset(strong);
|
|
5340
|
+
var text_3 = sibling(strong);
|
|
5341
|
+
reset(p_1);
|
|
5384
5342
|
template_effect(() => {
|
|
5385
|
-
set_class(
|
|
5386
|
-
set_attribute(
|
|
5387
|
-
set_text(
|
|
5343
|
+
set_class(p_1, 1, `text-sm mt-2 text-gray-700 pie-audio-transcript ${get(showVisibleTranscript) ? "" : "sr-only"}`, "svelte-6wlbb4");
|
|
5344
|
+
set_attribute(p_1, "id", get(transcriptId));
|
|
5345
|
+
set_text(text_2, `${get(uiText).transcriptLabel ?? ""}:`);
|
|
5346
|
+
set_text(text_3, ` ${$$props.model.audioTranscript ?? ""}`);
|
|
5388
5347
|
});
|
|
5389
|
-
append($$anchor,
|
|
5348
|
+
append($$anchor, p_1);
|
|
5390
5349
|
};
|
|
5391
5350
|
if_block(node_4, ($$render) => {
|
|
5392
5351
|
if ($$props?.model?.audioTranscript) $$render(consequent_5);
|
|
@@ -5400,132 +5359,116 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5400
5359
|
var node_5 = sibling(node_1, 2);
|
|
5401
5360
|
var consequent_7 = ($$anchor) => {
|
|
5402
5361
|
var div_3 = root_8();
|
|
5403
|
-
|
|
5404
|
-
var text_2 = child(h4, true);
|
|
5405
|
-
reset(h4);
|
|
5406
|
-
var div_4 = sibling(h4, 2);
|
|
5407
|
-
html(div_4, () => $$props.model.teacherInstructions, true);
|
|
5408
|
-
reset(div_4);
|
|
5362
|
+
html(div_3, () => $$props.model.sentenceHtml, true);
|
|
5409
5363
|
reset(div_3);
|
|
5410
|
-
template_effect((
|
|
5364
|
+
template_effect(() => set_attribute(div_3, "aria-describedby", get(templateDescribedBy)));
|
|
5411
5365
|
append($$anchor, div_3);
|
|
5412
5366
|
};
|
|
5413
5367
|
if_block(node_5, ($$render) => {
|
|
5414
|
-
if ($$props?.model?.
|
|
5368
|
+
if ($$props?.model?.sentenceHtml) $$render(consequent_7);
|
|
5415
5369
|
});
|
|
5416
5370
|
var node_6 = sibling(node_5, 2);
|
|
5417
|
-
var
|
|
5418
|
-
var
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
var node_8 = child(div_6);
|
|
5431
|
-
html(node_8, () => get(templateParts).before);
|
|
5432
|
-
var span = sibling(node_8, 2);
|
|
5433
|
-
var node_9 = child(span);
|
|
5434
|
-
var consequent_9 = ($$anchor) => {
|
|
5435
|
-
var img_4 = root_11();
|
|
5436
|
-
template_effect(($0) => {
|
|
5437
|
-
set_attribute(img_4, "src", get(displayChoice).imageUrl);
|
|
5438
|
-
set_attribute(img_4, "alt", $0);
|
|
5439
|
-
}, [() => get(displayChoice).imageAlt || t("selectedAnswerImage")]);
|
|
5440
|
-
append($$anchor, img_4);
|
|
5371
|
+
var consequent_10 = ($$anchor) => {
|
|
5372
|
+
var div_4 = root_9();
|
|
5373
|
+
var node_7 = child(div_4);
|
|
5374
|
+
html(node_7, () => get(templateParts).before);
|
|
5375
|
+
var span = sibling(node_7, 2);
|
|
5376
|
+
var node_8 = child(span);
|
|
5377
|
+
var consequent_8 = ($$anchor) => {
|
|
5378
|
+
var img_2 = root_10();
|
|
5379
|
+
template_effect(() => {
|
|
5380
|
+
set_attribute(img_2, "src", get(displayChoice).imageUrl);
|
|
5381
|
+
set_attribute(img_2, "alt", get(displayChoice).imageAlt || "Selected answer image");
|
|
5382
|
+
});
|
|
5383
|
+
append($$anchor, img_2);
|
|
5441
5384
|
};
|
|
5442
|
-
var
|
|
5443
|
-
var span_1 =
|
|
5385
|
+
var consequent_9 = ($$anchor) => {
|
|
5386
|
+
var span_1 = root_11();
|
|
5444
5387
|
html(span_1, () => get(displayChoice).labelHtml, true);
|
|
5445
5388
|
reset(span_1);
|
|
5446
5389
|
append($$anchor, span_1);
|
|
5447
5390
|
};
|
|
5448
5391
|
var alternate = ($$anchor) => {
|
|
5449
|
-
append($$anchor,
|
|
5392
|
+
append($$anchor, root_12());
|
|
5450
5393
|
};
|
|
5451
|
-
if_block(
|
|
5452
|
-
if (get(choiceMode) === "image" && get(displayChoice)?.imageUrl) $$render(
|
|
5453
|
-
else if (get(displayChoice)?.labelHtml) $$render(
|
|
5394
|
+
if_block(node_8, ($$render) => {
|
|
5395
|
+
if (get(choiceMode) === "image" && get(displayChoice)?.imageUrl) $$render(consequent_8);
|
|
5396
|
+
else if (get(displayChoice)?.labelHtml) $$render(consequent_9, 1);
|
|
5454
5397
|
else $$render(alternate, -1);
|
|
5455
5398
|
});
|
|
5456
5399
|
reset(span);
|
|
5457
5400
|
html(sibling(span, 2), () => get(templateParts).after);
|
|
5458
|
-
reset(
|
|
5459
|
-
template_effect((
|
|
5460
|
-
set_attribute(
|
|
5461
|
-
set_class(span, 1, `inline-flex items-center min-h-[1.5em] px-2 mx-1 border-b-2 border-gray-500 align-baseline blank-slot ${get(isBlankOnlyTemplate) ? "blank-slot-standalone" : ""}`, "svelte-6wlbb4");
|
|
5401
|
+
reset(div_4);
|
|
5402
|
+
template_effect(() => {
|
|
5403
|
+
set_attribute(div_4, "aria-describedby", get(templateDescribedBy));
|
|
5404
|
+
set_class(span, 1, `inline-flex items-center min-h-[1.5em] px-2 mx-1 border-b-2 border-gray-500 align-baseline blank-slot pie-blank-slot ${get(isBlankOnlyTemplate) ? "blank-slot-standalone pie-blank-slot-standalone" : ""}`, "svelte-6wlbb4");
|
|
5462
5405
|
set_style(span, `width:${get(blankWidth)};border-bottom-width:${get(blankBorderWidth)};`);
|
|
5463
|
-
set_attribute(span, "aria-label",
|
|
5464
|
-
}
|
|
5465
|
-
append($$anchor,
|
|
5406
|
+
set_attribute(span, "aria-label", get(uiText).selectedAnswerInSentence);
|
|
5407
|
+
});
|
|
5408
|
+
append($$anchor, div_4);
|
|
5466
5409
|
};
|
|
5467
|
-
if_block(
|
|
5468
|
-
if (!get(isAudioOnlyMode)) $$render(
|
|
5410
|
+
if_block(node_6, ($$render) => {
|
|
5411
|
+
if (!get(isAudioOnlyMode)) $$render(consequent_10);
|
|
5469
5412
|
});
|
|
5470
|
-
var
|
|
5471
|
-
var
|
|
5472
|
-
var
|
|
5473
|
-
var span_3 = child(
|
|
5474
|
-
var
|
|
5413
|
+
var node_10 = sibling(node_6, 2);
|
|
5414
|
+
var consequent_11 = ($$anchor) => {
|
|
5415
|
+
var button_2 = root_13();
|
|
5416
|
+
var span_3 = child(button_2);
|
|
5417
|
+
var text_4 = child(span_3, true);
|
|
5475
5418
|
reset(span_3);
|
|
5476
|
-
reset(
|
|
5477
|
-
template_effect((
|
|
5478
|
-
set_attribute(
|
|
5479
|
-
set_text(
|
|
5480
|
-
}
|
|
5481
|
-
|
|
5482
|
-
append($$anchor,
|
|
5419
|
+
reset(button_2);
|
|
5420
|
+
template_effect(() => {
|
|
5421
|
+
set_attribute(button_2, "aria-pressed", get(showCorrectAnswer));
|
|
5422
|
+
set_text(text_4, get(showCorrectAnswer) ? get(uiText).hideCorrectAnswer : get(uiText).showCorrectAnswer);
|
|
5423
|
+
});
|
|
5424
|
+
event("click", button_2, toggleCorrectAnswer);
|
|
5425
|
+
append($$anchor, button_2);
|
|
5483
5426
|
};
|
|
5484
|
-
if_block(
|
|
5485
|
-
if (get(isEvaluateMode) && get(isIncorrect)) $$render(
|
|
5427
|
+
if_block(node_10, ($$render) => {
|
|
5428
|
+
if (get(isEvaluateMode) && get(isIncorrect)) $$render(consequent_11);
|
|
5486
5429
|
});
|
|
5487
|
-
var
|
|
5488
|
-
var
|
|
5489
|
-
var
|
|
5490
|
-
var
|
|
5491
|
-
reset(
|
|
5430
|
+
var node_11 = sibling(node_10, 2);
|
|
5431
|
+
var consequent_12 = ($$anchor) => {
|
|
5432
|
+
var p_2 = root_14();
|
|
5433
|
+
var text_5 = child(p_2, true);
|
|
5434
|
+
reset(p_2);
|
|
5492
5435
|
template_effect(() => {
|
|
5493
|
-
set_attribute(
|
|
5494
|
-
set_text(
|
|
5436
|
+
set_attribute(p_2, "id", get(resultId));
|
|
5437
|
+
set_text(text_5, get(resultText));
|
|
5495
5438
|
});
|
|
5496
|
-
append($$anchor,
|
|
5439
|
+
append($$anchor, p_2);
|
|
5497
5440
|
};
|
|
5498
|
-
if_block(
|
|
5499
|
-
if (get(resultText)) $$render(
|
|
5441
|
+
if_block(node_11, ($$render) => {
|
|
5442
|
+
if (get(resultText)) $$render(consequent_12);
|
|
5500
5443
|
});
|
|
5501
|
-
var fieldset = sibling(
|
|
5444
|
+
var fieldset = sibling(node_11, 2);
|
|
5502
5445
|
var legend = child(fieldset);
|
|
5503
|
-
var
|
|
5446
|
+
var text_6 = child(legend, true);
|
|
5504
5447
|
reset(legend);
|
|
5505
|
-
var
|
|
5506
|
-
each(
|
|
5507
|
-
var
|
|
5508
|
-
var
|
|
5509
|
-
var
|
|
5510
|
-
var label =
|
|
5448
|
+
var div_5 = sibling(legend, 2);
|
|
5449
|
+
each(div_5, 21, () => get(choices), (c) => c.id, ($$anchor, c) => {
|
|
5450
|
+
var div_6 = root_15();
|
|
5451
|
+
var node_12 = child(div_6);
|
|
5452
|
+
var consequent_14 = ($$anchor) => {
|
|
5453
|
+
var label = root_16();
|
|
5511
5454
|
var span_4 = child(label);
|
|
5512
|
-
var
|
|
5513
|
-
var
|
|
5514
|
-
var
|
|
5455
|
+
var node_13 = child(span_4);
|
|
5456
|
+
var consequent_13 = ($$anchor) => {
|
|
5457
|
+
var img_3 = root_17();
|
|
5515
5458
|
template_effect(() => {
|
|
5516
|
-
set_attribute(
|
|
5517
|
-
set_attribute(
|
|
5459
|
+
set_attribute(img_3, "src", get(c).imageUrl);
|
|
5460
|
+
set_attribute(img_3, "alt", get(c).imageAlt || `Choice ${get(c).id}`);
|
|
5518
5461
|
});
|
|
5519
|
-
append($$anchor,
|
|
5462
|
+
append($$anchor, img_3);
|
|
5520
5463
|
};
|
|
5521
5464
|
var alternate_1 = ($$anchor) => {
|
|
5522
|
-
var span_5 =
|
|
5465
|
+
var span_5 = root_18();
|
|
5523
5466
|
html(span_5, () => get(c).labelHtml || "", true);
|
|
5524
5467
|
reset(span_5);
|
|
5525
5468
|
append($$anchor, span_5);
|
|
5526
5469
|
};
|
|
5527
|
-
if_block(
|
|
5528
|
-
if (get(choiceMode) === "image" && get(c).imageUrl) $$render(
|
|
5470
|
+
if_block(node_13, ($$render) => {
|
|
5471
|
+
if (get(choiceMode) === "image" && get(c).imageUrl) $$render(consequent_13);
|
|
5529
5472
|
else $$render(alternate_1, -1);
|
|
5530
5473
|
});
|
|
5531
5474
|
reset(span_4);
|
|
@@ -5540,31 +5483,31 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5540
5483
|
set_checked(input_1, (get(showCorrectAnswer) && get(isEvaluateMode) ? $$props?.model?.correctChoiceId : get(selectedId)) === get(c).id);
|
|
5541
5484
|
input_1.disabled = $$props?.model?.disabled;
|
|
5542
5485
|
});
|
|
5543
|
-
|
|
5486
|
+
event("change", input_1, onRadioChange);
|
|
5544
5487
|
append($$anchor, label);
|
|
5545
5488
|
};
|
|
5546
5489
|
var alternate_3 = ($$anchor) => {
|
|
5547
|
-
var fragment_2 =
|
|
5490
|
+
var fragment_2 = root_19();
|
|
5548
5491
|
var input_2 = first_child(fragment_2);
|
|
5549
5492
|
remove_input_defaults(input_2);
|
|
5550
5493
|
var label_1 = sibling(input_2, 2);
|
|
5551
|
-
var
|
|
5552
|
-
var
|
|
5553
|
-
var
|
|
5494
|
+
var node_14 = child(label_1);
|
|
5495
|
+
var consequent_15 = ($$anchor) => {
|
|
5496
|
+
var img_4 = root_20();
|
|
5554
5497
|
template_effect(() => {
|
|
5555
|
-
set_attribute(
|
|
5556
|
-
set_attribute(
|
|
5498
|
+
set_attribute(img_4, "src", get(c).imageUrl);
|
|
5499
|
+
set_attribute(img_4, "alt", get(c).imageAlt || `Choice ${get(c).id}`);
|
|
5557
5500
|
});
|
|
5558
|
-
append($$anchor,
|
|
5501
|
+
append($$anchor, img_4);
|
|
5559
5502
|
};
|
|
5560
5503
|
var alternate_2 = ($$anchor) => {
|
|
5561
|
-
var span_6 =
|
|
5504
|
+
var span_6 = root_21();
|
|
5562
5505
|
html(span_6, () => get(c).labelHtml || "", true);
|
|
5563
5506
|
reset(span_6);
|
|
5564
5507
|
append($$anchor, span_6);
|
|
5565
5508
|
};
|
|
5566
|
-
if_block(
|
|
5567
|
-
if (get(choiceMode) === "image" && get(c).imageUrl) $$render(
|
|
5509
|
+
if_block(node_14, ($$render) => {
|
|
5510
|
+
if (get(choiceMode) === "image" && get(c).imageUrl) $$render(consequent_15);
|
|
5568
5511
|
else $$render(alternate_2, -1);
|
|
5569
5512
|
});
|
|
5570
5513
|
reset(label_1);
|
|
@@ -5576,66 +5519,59 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5576
5519
|
input_2.disabled = $$props?.model?.disabled;
|
|
5577
5520
|
set_attribute(label_1, "for", `${instanceId}-opt-${get(c).id}`);
|
|
5578
5521
|
});
|
|
5579
|
-
|
|
5522
|
+
event("change", input_2, onRadioChange);
|
|
5580
5523
|
append($$anchor, fragment_2);
|
|
5581
5524
|
};
|
|
5582
|
-
if_block(
|
|
5583
|
-
if (get(isHorizontalChoices)) $$render(
|
|
5525
|
+
if_block(node_12, ($$render) => {
|
|
5526
|
+
if (get(isHorizontalChoices)) $$render(consequent_14);
|
|
5584
5527
|
else $$render(alternate_3, -1);
|
|
5585
5528
|
});
|
|
5586
|
-
var
|
|
5587
|
-
var
|
|
5529
|
+
var node_15 = sibling(node_12, 2);
|
|
5530
|
+
var consequent_18 = ($$anchor) => {
|
|
5588
5531
|
var fragment_3 = comment();
|
|
5589
|
-
var
|
|
5532
|
+
var node_16 = first_child(fragment_3);
|
|
5533
|
+
var consequent_16 = ($$anchor) => {
|
|
5534
|
+
append($$anchor, root_23());
|
|
5535
|
+
};
|
|
5590
5536
|
var consequent_17 = ($$anchor) => {
|
|
5591
5537
|
append($$anchor, root_24());
|
|
5592
5538
|
};
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
if_block(node_17, ($$render) => {
|
|
5597
|
-
if (get(selectedId) === get(c).id && get(isCorrect)) $$render(consequent_17);
|
|
5598
|
-
else if (get(selectedId) === get(c).id && get(isIncorrect)) $$render(consequent_18, 1);
|
|
5539
|
+
if_block(node_16, ($$render) => {
|
|
5540
|
+
if (get(selectedId) === get(c).id && get(isCorrect)) $$render(consequent_16);
|
|
5541
|
+
else if (get(selectedId) === get(c).id && get(isIncorrect)) $$render(consequent_17, 1);
|
|
5599
5542
|
});
|
|
5600
5543
|
append($$anchor, fragment_3);
|
|
5601
5544
|
};
|
|
5602
|
-
if_block(
|
|
5603
|
-
if (get(isEvaluateMode) && !get(showCorrectAnswer)) $$render(
|
|
5545
|
+
if_block(node_15, ($$render) => {
|
|
5546
|
+
if (get(isEvaluateMode) && !get(showCorrectAnswer)) $$render(consequent_18);
|
|
5604
5547
|
});
|
|
5605
|
-
reset(
|
|
5606
|
-
template_effect(() => set_class(
|
|
5607
|
-
append($$anchor,
|
|
5548
|
+
reset(div_6);
|
|
5549
|
+
template_effect(() => set_class(div_6, 1, `flex items-start choice-row pie-choice ${get(isHorizontalChoices) ? "choice-row-horizontal pie-choice-horizontal" : ""} ${(get(showCorrectAnswer) && get(isEvaluateMode) ? $$props?.model?.correctChoiceId : get(selectedId)) === get(c).id ? "is-selected pie-choice-selected" : ""}`, "svelte-6wlbb4"));
|
|
5550
|
+
append($$anchor, div_6);
|
|
5608
5551
|
});
|
|
5609
|
-
reset(
|
|
5552
|
+
reset(div_5);
|
|
5610
5553
|
reset(fieldset);
|
|
5611
5554
|
reset(div);
|
|
5612
5555
|
template_effect(() => {
|
|
5613
|
-
set_class(div, 1, `p-4 mc-populated-blank-root layout-${get(layoutProfile)} ${get(hasInlineSentenceAudioLayout) ? "has-inline-audio" : ""}
|
|
5556
|
+
set_class(div, 1, `p-4 mc-populated-blank-root pie-element pie-element-mc-populated-blank pie-delivery-root layout-${get(layoutProfile)} ${get(hasInlineSentenceAudioLayout) ? "has-inline-audio" : ""}`, "svelte-6wlbb4");
|
|
5614
5557
|
set_attribute(div, "lang", get(lang));
|
|
5558
|
+
set_style(div, get(rootStyle));
|
|
5615
5559
|
fieldset.disabled = $$props?.model?.disabled;
|
|
5616
5560
|
set_attribute(legend, "id", get(legendId));
|
|
5617
|
-
set_text(
|
|
5618
|
-
set_class(
|
|
5619
|
-
set_attribute(
|
|
5620
|
-
set_attribute(
|
|
5561
|
+
set_text(text_6, get(legendText));
|
|
5562
|
+
set_class(div_5, 1, `pie-choices ${get(isHorizontalChoices) ? "flex flex-row flex-wrap items-start justify-center" : "flex flex-col"}`, "svelte-6wlbb4");
|
|
5563
|
+
set_attribute(div_5, "aria-labelledby", get(choicesGroupLabelledBy));
|
|
5564
|
+
set_attribute(div_5, "aria-describedby", get(resultText) ? get(resultId) : void 0);
|
|
5621
5565
|
});
|
|
5622
|
-
|
|
5566
|
+
event("keydown", div_5, onRadioGroupKeydown);
|
|
5623
5567
|
append($$anchor, div);
|
|
5624
5568
|
pop();
|
|
5625
5569
|
}
|
|
5626
|
-
|
|
5627
|
-
"click",
|
|
5628
|
-
"keydown",
|
|
5629
|
-
"change"
|
|
5630
|
-
]);
|
|
5631
|
-
create_custom_element(McPopulatedBlank, {
|
|
5570
|
+
customElements.define("mc-populated-blank-element", create_custom_element(McPopulatedBlank, {
|
|
5632
5571
|
model: { type: "Object" },
|
|
5633
5572
|
session: { type: "Object" },
|
|
5634
|
-
options: { type: "Object" }
|
|
5635
|
-
|
|
5636
|
-
onAudioStarted: { type: "Object" },
|
|
5637
|
-
onAudioEnded: { type: "Object" }
|
|
5638
|
-
}, [], []);
|
|
5573
|
+
options: { type: "Object" }
|
|
5574
|
+
}, [], []));
|
|
5639
5575
|
//#endregion
|
|
5640
5576
|
//#region src/controller/index.ts
|
|
5641
5577
|
var isComplete = (question, session, audioComplete = false) => {
|