@pie-element/mc-populated-blank 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -2
- package/dist/controller/defaults.d.ts +89 -0
- package/dist/controller/defaults.d.ts.map +1 -1
- package/dist/controller/index.d.ts.map +1 -1
- package/dist/controller/index.js +110 -4
- package/dist/controller/index.js.map +1 -1
- package/dist/delivery/index.js +589 -477
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.d.ts +2 -1
- package/dist/index.iife.d.ts.map +1 -1
- package/dist/index.iife.js +25 -19
- package/dist/index.js +589 -477
- package/dist/index.js.map +1 -1
- package/package.json +1 -4
- package/src/controller/defaults.ts +53 -0
- package/src/controller/index.ts +83 -5
- package/src/delivery/McPopulatedBlank.svelte +464 -457
- package/src/index.iife.ts +2 -8
package/dist/delivery/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
|
/**
|
|
@@ -187,6 +179,14 @@ function hydration_failed() {
|
|
|
187
179
|
throw new Error(`https://svelte.dev/e/hydration_failed`);
|
|
188
180
|
}
|
|
189
181
|
/**
|
|
182
|
+
* Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value
|
|
183
|
+
* @param {string} key
|
|
184
|
+
* @returns {never}
|
|
185
|
+
*/
|
|
186
|
+
function props_invalid_value(key) {
|
|
187
|
+
throw new Error(`https://svelte.dev/e/props_invalid_value`);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
190
|
* Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
|
|
191
191
|
* @returns {never}
|
|
192
192
|
*/
|
|
@@ -495,6 +495,29 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
|
|
|
495
495
|
* schedule effects if the update takes place inside a `$:` effect
|
|
496
496
|
*/
|
|
497
497
|
var legacy_is_updating_store = false;
|
|
498
|
+
/**
|
|
499
|
+
* Whether or not the prop currently being read is a store binding, as in
|
|
500
|
+
* `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in
|
|
501
|
+
* runes mode, and skip `binding_property_non_reactive` validation
|
|
502
|
+
*/
|
|
503
|
+
var is_store_binding = false;
|
|
504
|
+
/**
|
|
505
|
+
* Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.
|
|
506
|
+
* Used to prevent `binding_property_non_reactive` validation false positives and
|
|
507
|
+
* ensure that these props are treated as mutable even in runes mode
|
|
508
|
+
* @template T
|
|
509
|
+
* @param {() => T} fn
|
|
510
|
+
* @returns {[T, boolean]}
|
|
511
|
+
*/
|
|
512
|
+
function capture_store_binding(fn) {
|
|
513
|
+
var previous_is_store_binding = is_store_binding;
|
|
514
|
+
try {
|
|
515
|
+
is_store_binding = false;
|
|
516
|
+
return [fn(), is_store_binding];
|
|
517
|
+
} finally {
|
|
518
|
+
is_store_binding = previous_is_store_binding;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
498
521
|
//#endregion
|
|
499
522
|
//#region \0@oxc-project+runtime@0.120.0/helpers/checkPrivateRedeclaration.js
|
|
500
523
|
function _checkPrivateRedeclaration(e, t) {
|
|
@@ -3078,63 +3101,6 @@ var event_symbol = Symbol("events");
|
|
|
3078
3101
|
var all_registered_events = /* @__PURE__ */ new Set();
|
|
3079
3102
|
/** @type {Set<(events: Array<string>) => void>} */
|
|
3080
3103
|
var root_event_handles = /* @__PURE__ */ new Set();
|
|
3081
|
-
/**
|
|
3082
|
-
* @param {string} event_name
|
|
3083
|
-
* @param {EventTarget} dom
|
|
3084
|
-
* @param {EventListener} [handler]
|
|
3085
|
-
* @param {AddEventListenerOptions} [options]
|
|
3086
|
-
*/
|
|
3087
|
-
function create_event(event_name, dom, handler, options = {}) {
|
|
3088
|
-
/**
|
|
3089
|
-
* @this {EventTarget}
|
|
3090
|
-
*/
|
|
3091
|
-
function target_handler(event) {
|
|
3092
|
-
if (!options.capture) handle_event_propagation.call(dom, event);
|
|
3093
|
-
if (!event.cancelBubble) return without_reactive_context(() => {
|
|
3094
|
-
return handler?.call(this, event);
|
|
3095
|
-
});
|
|
3096
|
-
}
|
|
3097
|
-
if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") queue_micro_task(() => {
|
|
3098
|
-
dom.addEventListener(event_name, target_handler, options);
|
|
3099
|
-
});
|
|
3100
|
-
else dom.addEventListener(event_name, target_handler, options);
|
|
3101
|
-
return target_handler;
|
|
3102
|
-
}
|
|
3103
|
-
/**
|
|
3104
|
-
* @param {string} event_name
|
|
3105
|
-
* @param {Element} dom
|
|
3106
|
-
* @param {EventListener} [handler]
|
|
3107
|
-
* @param {boolean} [capture]
|
|
3108
|
-
* @param {boolean} [passive]
|
|
3109
|
-
* @returns {void}
|
|
3110
|
-
*/
|
|
3111
|
-
function event(event_name, dom, handler, capture, passive) {
|
|
3112
|
-
var options = {
|
|
3113
|
-
capture,
|
|
3114
|
-
passive
|
|
3115
|
-
};
|
|
3116
|
-
var target_handler = create_event(event_name, dom, handler, options);
|
|
3117
|
-
if (dom === document.body || dom === window || dom === document || dom instanceof HTMLMediaElement) teardown(() => {
|
|
3118
|
-
dom.removeEventListener(event_name, target_handler, options);
|
|
3119
|
-
});
|
|
3120
|
-
}
|
|
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
3104
|
var last_propagated_event = null;
|
|
3139
3105
|
/**
|
|
3140
3106
|
* @this {EventTarget}
|
|
@@ -3632,53 +3598,6 @@ var BranchManager = class {
|
|
|
3632
3598
|
}
|
|
3633
3599
|
}
|
|
3634
3600
|
};
|
|
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
3601
|
//#endregion
|
|
3683
3602
|
//#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/dom/blocks/if.js
|
|
3684
3603
|
/** @import { TemplateNode } from '#client' */
|
|
@@ -4589,6 +4508,94 @@ function bind_this(element_or_component = {}, update, get_value, get_parts) {
|
|
|
4589
4508
|
return element_or_component;
|
|
4590
4509
|
}
|
|
4591
4510
|
//#endregion
|
|
4511
|
+
//#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/internal/client/reactivity/props.js
|
|
4512
|
+
/** @import { Effect, Source } from './types.js' */
|
|
4513
|
+
/**
|
|
4514
|
+
* This function is responsible for synchronizing a possibly bound prop with the inner component state.
|
|
4515
|
+
* It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
|
|
4516
|
+
* @template V
|
|
4517
|
+
* @param {Record<string, unknown>} props
|
|
4518
|
+
* @param {string} key
|
|
4519
|
+
* @param {number} flags
|
|
4520
|
+
* @param {V | (() => V)} [fallback]
|
|
4521
|
+
* @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}
|
|
4522
|
+
*/
|
|
4523
|
+
function prop(props, key, flags, fallback) {
|
|
4524
|
+
var runes = !legacy_mode_flag || (flags & 2) !== 0;
|
|
4525
|
+
var bindable = (flags & 8) !== 0;
|
|
4526
|
+
var lazy = (flags & 16) !== 0;
|
|
4527
|
+
var fallback_value = fallback;
|
|
4528
|
+
var fallback_dirty = true;
|
|
4529
|
+
var get_fallback = () => {
|
|
4530
|
+
if (fallback_dirty) {
|
|
4531
|
+
fallback_dirty = false;
|
|
4532
|
+
fallback_value = lazy ? untrack(fallback) : fallback;
|
|
4533
|
+
}
|
|
4534
|
+
return fallback_value;
|
|
4535
|
+
};
|
|
4536
|
+
/** @type {((v: V) => void) | undefined} */
|
|
4537
|
+
let setter;
|
|
4538
|
+
if (bindable) {
|
|
4539
|
+
var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;
|
|
4540
|
+
setter = get_descriptor(props, key)?.set ?? (is_entry_props && key in props ? (v) => props[key] = v : void 0);
|
|
4541
|
+
}
|
|
4542
|
+
/** @type {V} */
|
|
4543
|
+
var initial_value;
|
|
4544
|
+
var is_store_sub = false;
|
|
4545
|
+
if (bindable) [initial_value, is_store_sub] = capture_store_binding(() => props[key]);
|
|
4546
|
+
else initial_value = props[key];
|
|
4547
|
+
if (initial_value === void 0 && fallback !== void 0) {
|
|
4548
|
+
initial_value = get_fallback();
|
|
4549
|
+
if (setter) {
|
|
4550
|
+
if (runes) props_invalid_value(key);
|
|
4551
|
+
setter(initial_value);
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
/** @type {() => V} */
|
|
4555
|
+
var getter;
|
|
4556
|
+
if (runes) getter = () => {
|
|
4557
|
+
var value = props[key];
|
|
4558
|
+
if (value === void 0) return get_fallback();
|
|
4559
|
+
fallback_dirty = true;
|
|
4560
|
+
return value;
|
|
4561
|
+
};
|
|
4562
|
+
else getter = () => {
|
|
4563
|
+
var value = props[key];
|
|
4564
|
+
if (value !== void 0) fallback_value = void 0;
|
|
4565
|
+
return value === void 0 ? fallback_value : value;
|
|
4566
|
+
};
|
|
4567
|
+
if (runes && (flags & 4) === 0) return getter;
|
|
4568
|
+
if (setter) {
|
|
4569
|
+
var legacy_parent = props.$$legacy;
|
|
4570
|
+
return (function(value, mutation) {
|
|
4571
|
+
if (arguments.length > 0) {
|
|
4572
|
+
if (!runes || !mutation || legacy_parent || is_store_sub)
|
|
4573
|
+
/** @type {Function} */ setter(mutation ? getter() : value);
|
|
4574
|
+
return value;
|
|
4575
|
+
}
|
|
4576
|
+
return getter();
|
|
4577
|
+
});
|
|
4578
|
+
}
|
|
4579
|
+
var overridden = false;
|
|
4580
|
+
var d = ((flags & 1) !== 0 ? derived : derived_safe_equal)(() => {
|
|
4581
|
+
overridden = false;
|
|
4582
|
+
return getter();
|
|
4583
|
+
});
|
|
4584
|
+
if (bindable) get(d);
|
|
4585
|
+
var parent_effect = active_effect;
|
|
4586
|
+
return (function(value, mutation) {
|
|
4587
|
+
if (arguments.length > 0) {
|
|
4588
|
+
const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
|
|
4589
|
+
set(d, new_value);
|
|
4590
|
+
overridden = true;
|
|
4591
|
+
if (fallback_value !== void 0) fallback_value = new_value;
|
|
4592
|
+
return value;
|
|
4593
|
+
}
|
|
4594
|
+
if (is_destroying_effect && overridden || (parent_effect.f & 16384) !== 0) return d.v;
|
|
4595
|
+
return get(d);
|
|
4596
|
+
});
|
|
4597
|
+
}
|
|
4598
|
+
//#endregion
|
|
4592
4599
|
//#region ../../../node_modules/.bun/svelte@5.55.1/node_modules/svelte/src/legacy/legacy-client.js
|
|
4593
4600
|
/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
|
|
4594
4601
|
/**
|
|
@@ -4993,73 +5000,204 @@ function create_custom_element(Component, props_definition, slots, exports, shad
|
|
|
4993
5000
|
}
|
|
4994
5001
|
//#endregion
|
|
4995
5002
|
//#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>`);
|
|
5003
|
+
var root_1 = /* @__PURE__ */ from_html(`<div class="mb-4 prose pie-prompt"></div>`);
|
|
5004
|
+
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);
|
|
5005
|
+
var root_5 = /* @__PURE__ */ from_html(`<button class="mt-2 text-sm underline pie-audio-autoplay-enable" type="button"> </button>`);
|
|
5006
|
+
var root_4 = /* @__PURE__ */ from_html(`<audio controls="" class="w-full max-w-md pie-audio-player" preload="metadata"><track kind="captions"/></audio> <!>`, 1);
|
|
5007
|
+
var root_6 = /* @__PURE__ */ from_html(`<p class="text-sm text-red-700 pie-audio-error" role="alert"> </p>`);
|
|
5008
|
+
var root_7 = /* @__PURE__ */ from_html(`<p><strong> </strong> </p>`);
|
|
5009
|
+
var root_2 = /* @__PURE__ */ from_html(`<div class="mb-4 audio-container pie-audio-container svelte-6wlbb4"><!> <!></div>`);
|
|
5010
|
+
var root_8 = /* @__PURE__ */ from_html(`<div class="mb-3 prose prose-p:my-1 sentence-line pie-sentence-line svelte-6wlbb4"></div>`);
|
|
5011
|
+
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);"/>`);
|
|
5012
|
+
var root_11 = /* @__PURE__ */ from_html(`<span class="blank-inner choice-label pie-blank-value svelte-6wlbb4"></span>`);
|
|
5013
|
+
var root_12 = /* @__PURE__ */ from_html(`<span class="blank-inner-empty svelte-6wlbb4" aria-hidden="true"> </span>`);
|
|
5014
|
+
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>`);
|
|
5015
|
+
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>`);
|
|
5016
|
+
var root_14 = /* @__PURE__ */ from_html(`<p class="sr-only pie-result-feedback svelte-6wlbb4" role="status" aria-live="polite"> </p>`);
|
|
5017
|
+
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);"/>`);
|
|
5018
|
+
var root_18 = /* @__PURE__ */ from_html(`<span class="choice-label pie-choice-label svelte-6wlbb4"></span>`);
|
|
5019
|
+
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>`);
|
|
5020
|
+
var root_20 = /* @__PURE__ */ from_html(`<img class="object-contain pie-choice-image" style="max-height:var(--mpb-choice-image-max-height, 5rem);"/>`);
|
|
5021
|
+
var root_21 = /* @__PURE__ */ from_html(`<span class="choice-label pie-choice-label svelte-6wlbb4"></span>`);
|
|
5022
|
+
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);
|
|
5023
|
+
var root_23 = /* @__PURE__ */ from_html(`<span class="text-green-600 text-sm font-medium pie-choice-feedback-correct" aria-hidden="true">✓</span>`);
|
|
5024
|
+
var root_24 = /* @__PURE__ */ from_html(`<span class="text-red-600 text-sm font-medium pie-choice-feedback-incorrect" aria-hidden="true">✗</span>`);
|
|
5025
|
+
var root_15 = /* @__PURE__ */ from_html(`<div style="gap:var(--mpb-choice-row-gap, 0.5rem);"><!> <!></div>`);
|
|
5026
|
+
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
5027
|
var $$css = {
|
|
5022
5028
|
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:
|
|
5029
|
+
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;width:min(100%, var(--mpb-audio-instructions-max-width, 875px));margin-left:auto;margin-right:auto;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);}\n\n /* Match Learnosity responsive behavior for CQT audio-blank layouts:\n at smaller widths, audio control shifts left and answer tiles stack. */\n @media (max-width: 760px) {.layout-audio_blank_only.svelte-6wlbb4 .audio-container:where(.svelte-6wlbb4),\n .layout-stimulus_image_blank.svelte-6wlbb4 .audio-container:where(.svelte-6wlbb4),\n .layout-token_sequence.svelte-6wlbb4 .audio-container:where(.svelte-6wlbb4),\n .layout-inline_sentence.has-inline-audio.svelte-6wlbb4 .audio-container:where(.svelte-6wlbb4) {width:100%;margin-left:0;margin-right:0;justify-content:flex-start;justify-self:start;}.layout-audio_blank_only.svelte-6wlbb4 .pie-choices:where(.svelte-6wlbb4),\n .layout-token_sequence.svelte-6wlbb4 .pie-choices:where(.svelte-6wlbb4),\n .layout-stimulus_image_blank.svelte-6wlbb4 .pie-choices:where(.svelte-6wlbb4),\n .layout-inline_sentence.has-inline-audio.svelte-6wlbb4 .pie-choices:where(.svelte-6wlbb4) {flex-direction:column;align-items:flex-start;justify-content:flex-start;}.layout-audio_blank_only.svelte-6wlbb4 .choice-row-horizontal:where(.svelte-6wlbb4),\n .layout-token_sequence.svelte-6wlbb4 .choice-row-horizontal:where(.svelte-6wlbb4),\n .layout-stimulus_image_blank.svelte-6wlbb4 .choice-row-horizontal:where(.svelte-6wlbb4),\n .layout-inline_sentence.has-inline-audio.svelte-6wlbb4 .choice-row-horizontal:where(.svelte-6wlbb4) {width:min(100%, var(--mpb-narrow-choice-max-width, 230px));align-items:flex-start;}\n }"
|
|
5024
5030
|
};
|
|
5025
5031
|
function McPopulatedBlank($$anchor, $$props) {
|
|
5026
5032
|
push($$props, true);
|
|
5027
5033
|
append_styles$1($$anchor, $$css);
|
|
5028
5034
|
/** Must match controller `BLANK_TOKEN` (kept local to avoid pulling controller into delivery). */
|
|
5029
5035
|
const BLANK_TOKEN = "{{blank}}";
|
|
5036
|
+
const DEFAULT_LAYOUT_LIMITS = {
|
|
5037
|
+
blankStandaloneWidthRem: 7,
|
|
5038
|
+
blankWideWidthRem: 10,
|
|
5039
|
+
blankUnderlineWidthPx: 2,
|
|
5040
|
+
blankUnderlineWideWidthPx: 4,
|
|
5041
|
+
horizontalChoiceWidthPx: 170,
|
|
5042
|
+
horizontalChoiceWidthVw: 30,
|
|
5043
|
+
horizontalChoiceTileMinHeightRem: 11,
|
|
5044
|
+
horizontalChoiceContentMinHeightRem: 7.5,
|
|
5045
|
+
selectedImageMaxHeightRem: 4,
|
|
5046
|
+
choiceImageMaxHeightRem: 5,
|
|
5047
|
+
listenButtonSizePx: 128,
|
|
5048
|
+
stimulusMinColumnPx: 210,
|
|
5049
|
+
textMinColumnPx: 260,
|
|
5050
|
+
legendMaxChars: 120,
|
|
5051
|
+
choiceGroupGapRem: .5,
|
|
5052
|
+
choiceRowGapRem: .5,
|
|
5053
|
+
toggleButtonGapRem: .5,
|
|
5054
|
+
horizontalChoiceRadioTopMarginRem: .5,
|
|
5055
|
+
audioBlankTemplateMarginTopRem: .8,
|
|
5056
|
+
audioBlankTemplateMarginBottomRem: 1.8,
|
|
5057
|
+
audioInstructionsMaxWidthPx: 875,
|
|
5058
|
+
narrowHorizontalChoiceMaxWidthPx: 230,
|
|
5059
|
+
stimulusGridColumnGapRem: 2,
|
|
5060
|
+
stimulusGridRowGapRem: .7,
|
|
5061
|
+
stimulusSentenceMarginTopRem: .2,
|
|
5062
|
+
stimulusChoicesMarginTopRem: .9,
|
|
5063
|
+
tokenGridColumnGapRem: 1.5,
|
|
5064
|
+
tokenGridRowGapRem: .8,
|
|
5065
|
+
tokenTemplateMarginTopRem: .6,
|
|
5066
|
+
tokenInlineTokenGapRem: .35,
|
|
5067
|
+
tokenChoicesMarginTopRem: .2,
|
|
5068
|
+
inlineGridColumnGapRem: 1.5,
|
|
5069
|
+
inlineGridRowGapRem: .65,
|
|
5070
|
+
inlineTemplateMarginTopRem: .45,
|
|
5071
|
+
inlineChoicesMarginTopRem: .25
|
|
5072
|
+
};
|
|
5073
|
+
const DEFAULT_LAYOUT_PROFILE_PRESETS = {
|
|
5074
|
+
audio_blank_only: {
|
|
5075
|
+
blankWideWidthRem: 10,
|
|
5076
|
+
blankUnderlineWideWidthPx: 4
|
|
5077
|
+
},
|
|
5078
|
+
stimulus_image_blank: {
|
|
5079
|
+
blankWideWidthRem: 10,
|
|
5080
|
+
blankUnderlineWideWidthPx: 4
|
|
5081
|
+
},
|
|
5082
|
+
token_sequence: {
|
|
5083
|
+
blankStandaloneWidthRem: 7,
|
|
5084
|
+
blankUnderlineWideWidthPx: 4
|
|
5085
|
+
}
|
|
5086
|
+
};
|
|
5087
|
+
const DEFAULT_AUDIO_BUTTON_SKINS = {
|
|
5088
|
+
default: {
|
|
5089
|
+
silentUrl: "https://assets.learnosity.com/organisations/844/0c9f2aa3-3cd5-4de7-93ef-541c24ca35da.svg",
|
|
5090
|
+
playingUrl: "https://assets.learnosity.com/organisations/844/231dfdc2-c113-4be5-91fb-e75a0ca5994b.svg"
|
|
5091
|
+
},
|
|
5092
|
+
es: {
|
|
5093
|
+
silentUrl: "https://assets.learnosity.com/organisations/844/27a9d5b5-d873-4bd5-b9ba-22748782d8ba.svg",
|
|
5094
|
+
playingUrl: "https://assets.learnosity.com/organisations/844/120f216d-96b7-4560-94b8-1d90710216b7.svg"
|
|
5095
|
+
}
|
|
5096
|
+
};
|
|
5097
|
+
const DEFAULT_UI_TEXT = {
|
|
5098
|
+
answerChoices: "Answer choices",
|
|
5099
|
+
selectedAnswerInSentence: "Selected answer in sentence",
|
|
5100
|
+
showCorrectAnswer: "Show correct answer",
|
|
5101
|
+
hideCorrectAnswer: "Hide correct answer",
|
|
5102
|
+
clickToEnableAutoplay: "Click to enable audio autoplay",
|
|
5103
|
+
audioResourceUnavailable: "Audio is enabled but no playable audio URL is configured.",
|
|
5104
|
+
transcriptLabel: "Transcript",
|
|
5105
|
+
listenLabelEn: "Listen",
|
|
5106
|
+
listenLabelEs: "Escuchar"
|
|
5107
|
+
};
|
|
5108
|
+
let model = prop($$props, "model", 7), session = prop($$props, "session", 7), options = prop($$props, "options", 7);
|
|
5030
5109
|
let audioEl = /* @__PURE__ */ state(null);
|
|
5031
|
-
let activeUtterance = /* @__PURE__ */ state(null);
|
|
5032
|
-
let isSynthSpeaking = /* @__PURE__ */ state(false);
|
|
5033
5110
|
let isMediaPlaying = /* @__PURE__ */ state(false);
|
|
5034
5111
|
let localChoiceId = /* @__PURE__ */ state("");
|
|
5035
5112
|
let autoPlayPromptOpen = /* @__PURE__ */ state(false);
|
|
5036
5113
|
let autoplayAttempted = /* @__PURE__ */ state(false);
|
|
5114
|
+
let featureAudioButtonEl = /* @__PURE__ */ state(null);
|
|
5115
|
+
let autoplayEnableButtonEl = /* @__PURE__ */ state(null);
|
|
5116
|
+
let toggleCorrectAnswerButtonEl = /* @__PURE__ */ state(null);
|
|
5117
|
+
let choicesGroupEl = /* @__PURE__ */ state(null);
|
|
5037
5118
|
const instanceId = `mc-populated-blank-${Math.random().toString(36).slice(2, 10)}`;
|
|
5038
|
-
const isEvaluateMode = /* @__PURE__ */ user_derived(() =>
|
|
5039
|
-
const correctness = /* @__PURE__ */ user_derived(() =>
|
|
5119
|
+
const isEvaluateMode = /* @__PURE__ */ user_derived(() => model()?.env?.mode === "evaluate");
|
|
5120
|
+
const correctness = /* @__PURE__ */ user_derived(() => model()?.correctness);
|
|
5040
5121
|
const isCorrect = /* @__PURE__ */ user_derived(() => get(correctness) === "correct");
|
|
5041
5122
|
const isIncorrect = /* @__PURE__ */ user_derived(() => get(correctness) === "incorrect");
|
|
5042
|
-
const isAudioOnlyMode = /* @__PURE__ */ user_derived(() =>
|
|
5123
|
+
const isAudioOnlyMode = /* @__PURE__ */ user_derived(() => model()?.interactionMode === "audio_mc_only");
|
|
5043
5124
|
const isBlankOnlyTemplate = /* @__PURE__ */ user_derived(() => {
|
|
5044
|
-
const t =
|
|
5125
|
+
const t = model()?.template || "";
|
|
5045
5126
|
if (!t) return false;
|
|
5046
5127
|
return t.replace(/<[^>]+>/g, "").replace(/ /g, " ").trim() === BLANK_TOKEN;
|
|
5047
5128
|
});
|
|
5048
|
-
const layoutProfile = /* @__PURE__ */ user_derived(() =>
|
|
5049
|
-
const choiceLayout = /* @__PURE__ */ user_derived(() =>
|
|
5129
|
+
const layoutProfile = /* @__PURE__ */ user_derived(() => model()?.layoutProfile || "");
|
|
5130
|
+
const choiceLayout = /* @__PURE__ */ user_derived(() => model()?.choiceLayout || (get(isAudioOnlyMode) || get(isBlankOnlyTemplate) ? "horizontal" : "vertical"));
|
|
5050
5131
|
const isHorizontalChoices = /* @__PURE__ */ user_derived(() => get(choiceLayout) === "horizontal");
|
|
5051
|
-
const
|
|
5052
|
-
const
|
|
5053
|
-
const
|
|
5054
|
-
const
|
|
5055
|
-
const
|
|
5056
|
-
|
|
5132
|
+
const showVisibleTranscript = /* @__PURE__ */ user_derived(() => !!model()?.showVisibleTranscript);
|
|
5133
|
+
const hasPlayableAudio = /* @__PURE__ */ user_derived(() => !!model()?.hasAudio && !!model()?.audioUrl);
|
|
5134
|
+
const hasAudioButMissingResource = /* @__PURE__ */ user_derived(() => !!model()?.hasAudio && !model()?.audioUrl);
|
|
5135
|
+
const hasInlineSentenceAudioLayout = /* @__PURE__ */ user_derived(() => get(layoutProfile) === "inline_sentence" && !!model()?.hasAudio);
|
|
5136
|
+
const uiText = /* @__PURE__ */ user_derived(() => ({
|
|
5137
|
+
...DEFAULT_UI_TEXT,
|
|
5138
|
+
...model()?.uiText || {}
|
|
5139
|
+
}));
|
|
5140
|
+
const profilePresetLimits = /* @__PURE__ */ user_derived(() => {
|
|
5141
|
+
const profile = String(get(layoutProfile) || "");
|
|
5142
|
+
const defaults = DEFAULT_LAYOUT_PROFILE_PRESETS[profile] || {};
|
|
5143
|
+
const customPresets = model()?.layoutProfilePresets && typeof model().layoutProfilePresets === "object" ? model().layoutProfilePresets : {};
|
|
5144
|
+
const custom = customPresets[profile] && typeof customPresets[profile] === "object" ? customPresets[profile] : {};
|
|
5145
|
+
return {
|
|
5146
|
+
...defaults,
|
|
5147
|
+
...custom
|
|
5148
|
+
};
|
|
5149
|
+
});
|
|
5150
|
+
const layoutLimits = /* @__PURE__ */ user_derived(() => {
|
|
5151
|
+
const configured = model()?.layoutLimits && typeof model().layoutLimits === "object" ? model().layoutLimits : {};
|
|
5152
|
+
return {
|
|
5153
|
+
...DEFAULT_LAYOUT_LIMITS,
|
|
5154
|
+
...get(profilePresetLimits),
|
|
5155
|
+
...configured
|
|
5156
|
+
};
|
|
5157
|
+
});
|
|
5158
|
+
const rootStyle = /* @__PURE__ */ user_derived(() => [
|
|
5159
|
+
`--mpb-listen-button-size:${get(layoutLimits).listenButtonSizePx}px`,
|
|
5160
|
+
`--mpb-blank-standalone-width:${get(layoutLimits).blankStandaloneWidthRem}rem`,
|
|
5161
|
+
`--mpb-blank-wide-width:${get(layoutLimits).blankWideWidthRem}rem`,
|
|
5162
|
+
`--mpb-blank-underline-width:${get(layoutLimits).blankUnderlineWidthPx}px`,
|
|
5163
|
+
`--mpb-blank-underline-wide-width:${get(layoutLimits).blankUnderlineWideWidthPx}px`,
|
|
5164
|
+
`--mpb-selected-image-max-height:${get(layoutLimits).selectedImageMaxHeightRem}rem`,
|
|
5165
|
+
`--mpb-choice-image-max-height:${get(layoutLimits).choiceImageMaxHeightRem}rem`,
|
|
5166
|
+
`--mpb-choice-width-px:${get(layoutLimits).horizontalChoiceWidthPx}px`,
|
|
5167
|
+
`--mpb-choice-width-vw:${get(layoutLimits).horizontalChoiceWidthVw}vw`,
|
|
5168
|
+
`--mpb-choice-tile-min-height:${get(layoutLimits).horizontalChoiceTileMinHeightRem}rem`,
|
|
5169
|
+
`--mpb-choice-content-min-height:${get(layoutLimits).horizontalChoiceContentMinHeightRem}rem`,
|
|
5170
|
+
`--mpb-stimulus-min-column:${get(layoutLimits).stimulusMinColumnPx}px`,
|
|
5171
|
+
`--mpb-text-min-column:${get(layoutLimits).textMinColumnPx}px`,
|
|
5172
|
+
`--mpb-choice-group-gap:${get(layoutLimits).choiceGroupGapRem}rem`,
|
|
5173
|
+
`--mpb-choice-row-gap:${get(layoutLimits).choiceRowGapRem}rem`,
|
|
5174
|
+
`--mpb-toggle-button-gap:${get(layoutLimits).toggleButtonGapRem}rem`,
|
|
5175
|
+
`--mpb-horizontal-choice-radio-top-margin:${get(layoutLimits).horizontalChoiceRadioTopMarginRem}rem`,
|
|
5176
|
+
`--mpb-audio-blank-template-margin-top:${get(layoutLimits).audioBlankTemplateMarginTopRem}rem`,
|
|
5177
|
+
`--mpb-audio-blank-template-margin-bottom:${get(layoutLimits).audioBlankTemplateMarginBottomRem}rem`,
|
|
5178
|
+
`--mpb-audio-instructions-max-width:${get(layoutLimits).audioInstructionsMaxWidthPx}px`,
|
|
5179
|
+
`--mpb-narrow-choice-max-width:${get(layoutLimits).narrowHorizontalChoiceMaxWidthPx}px`,
|
|
5180
|
+
`--mpb-stimulus-grid-column-gap:${get(layoutLimits).stimulusGridColumnGapRem}rem`,
|
|
5181
|
+
`--mpb-stimulus-grid-row-gap:${get(layoutLimits).stimulusGridRowGapRem}rem`,
|
|
5182
|
+
`--mpb-stimulus-sentence-margin-top:${get(layoutLimits).stimulusSentenceMarginTopRem}rem`,
|
|
5183
|
+
`--mpb-stimulus-choices-margin-top:${get(layoutLimits).stimulusChoicesMarginTopRem}rem`,
|
|
5184
|
+
`--mpb-token-grid-column-gap:${get(layoutLimits).tokenGridColumnGapRem}rem`,
|
|
5185
|
+
`--mpb-token-grid-row-gap:${get(layoutLimits).tokenGridRowGapRem}rem`,
|
|
5186
|
+
`--mpb-token-template-margin-top:${get(layoutLimits).tokenTemplateMarginTopRem}rem`,
|
|
5187
|
+
`--mpb-token-inline-token-gap:${get(layoutLimits).tokenInlineTokenGapRem}rem`,
|
|
5188
|
+
`--mpb-token-choices-margin-top:${get(layoutLimits).tokenChoicesMarginTopRem}rem`,
|
|
5189
|
+
`--mpb-inline-grid-column-gap:${get(layoutLimits).inlineGridColumnGapRem}rem`,
|
|
5190
|
+
`--mpb-inline-grid-row-gap:${get(layoutLimits).inlineGridRowGapRem}rem`,
|
|
5191
|
+
`--mpb-inline-template-margin-top:${get(layoutLimits).inlineTemplateMarginTopRem}rem`,
|
|
5192
|
+
`--mpb-inline-choices-margin-top:${get(layoutLimits).inlineChoicesMarginTopRem}rem`
|
|
5193
|
+
].join(";"));
|
|
5057
5194
|
const useFeatureButtonAudio = /* @__PURE__ */ user_derived(() => {
|
|
5195
|
+
if (typeof model()?.useFeatureButtonAudio === "boolean") return !!model().useFeatureButtonAudio;
|
|
5058
5196
|
const profile = get(layoutProfile) || "";
|
|
5059
|
-
return
|
|
5197
|
+
return !!model()?.hasAudio && (profile === "audio_blank_only" || profile === "stimulus_image_blank" || profile === "token_sequence");
|
|
5060
5198
|
});
|
|
5061
5199
|
const templateParts = /* @__PURE__ */ user_derived(() => {
|
|
5062
|
-
const t =
|
|
5200
|
+
const t = model()?.template || "";
|
|
5063
5201
|
const idx = t.indexOf(BLANK_TOKEN);
|
|
5064
5202
|
if (idx < 0) return {
|
|
5065
5203
|
before: t,
|
|
@@ -5070,113 +5208,72 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5070
5208
|
after: t.slice(idx + 9)
|
|
5071
5209
|
};
|
|
5072
5210
|
});
|
|
5073
|
-
function plainTextFromHtml(value = "") {
|
|
5074
|
-
return value.replace(/<[^>]+>/g, " ").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
5075
|
-
}
|
|
5076
5211
|
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
|
-
}
|
|
5212
|
+
if (get(layoutProfile) === "audio_blank_only" || get(layoutProfile) === "stimulus_image_blank") return `${get(layoutLimits).blankWideWidthRem}rem`;
|
|
5213
|
+
if (get(isBlankOnlyTemplate)) return `${get(layoutLimits).blankStandaloneWidthRem}rem`;
|
|
5086
5214
|
return "auto";
|
|
5087
5215
|
});
|
|
5088
5216
|
const blankBorderWidth = /* @__PURE__ */ user_derived(() => {
|
|
5089
|
-
if (get(layoutProfile) === "audio_blank_only" || get(layoutProfile) === "stimulus_image_blank") return
|
|
5090
|
-
return
|
|
5217
|
+
if (get(layoutProfile) === "audio_blank_only" || get(layoutProfile) === "stimulus_image_blank") return `${get(layoutLimits).blankUnderlineWideWidthPx}px`;
|
|
5218
|
+
return `${get(layoutLimits).blankUnderlineWidthPx}px`;
|
|
5091
5219
|
});
|
|
5092
|
-
const choices = /* @__PURE__ */ user_derived(() => Array.isArray(
|
|
5093
|
-
const
|
|
5094
|
-
|
|
5095
|
-
|
|
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
|
-
const choiceMode = /* @__PURE__ */ user_derived(() => $$props?.model?.choiceMode || "text");
|
|
5116
|
-
const selectedId = /* @__PURE__ */ user_derived(() => $$props?.session?.choiceId || get(localChoiceId) || "");
|
|
5117
|
-
const radioGroupName = /* @__PURE__ */ user_derived(() => `${instanceId}-choice-group-${$$props?.model?.id || "1"}`);
|
|
5220
|
+
const choices = /* @__PURE__ */ user_derived(() => Array.isArray(model()?.choices) ? model().choices : []);
|
|
5221
|
+
const choiceMode = /* @__PURE__ */ user_derived(() => model()?.choiceMode || "text");
|
|
5222
|
+
const selectedId = /* @__PURE__ */ user_derived(() => session()?.choiceId || get(localChoiceId) || "");
|
|
5223
|
+
const radioGroupName = /* @__PURE__ */ user_derived(() => `${instanceId}-choice-group-${model()?.id || "1"}`);
|
|
5118
5224
|
let showCorrectAnswer = /* @__PURE__ */ state(false);
|
|
5119
5225
|
const displayChoiceId = /* @__PURE__ */ user_derived(() => {
|
|
5120
|
-
if (get(isEvaluateMode) && get(showCorrectAnswer) &&
|
|
5226
|
+
if (get(isEvaluateMode) && get(showCorrectAnswer) && model()?.correctChoiceId) return model().correctChoiceId;
|
|
5121
5227
|
return get(selectedId);
|
|
5122
5228
|
});
|
|
5123
|
-
const displayChoice = /* @__PURE__ */ user_derived(() => get(
|
|
5229
|
+
const displayChoice = /* @__PURE__ */ user_derived(() => get(choices).find((c) => c.id === get(displayChoiceId)));
|
|
5124
5230
|
const legendText = /* @__PURE__ */ user_derived(() => {
|
|
5125
|
-
const plain =
|
|
5126
|
-
|
|
5231
|
+
const plain = (model()?.prompt || "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
5232
|
+
const maxChars = Math.max(8, Number(get(layoutLimits).legendMaxChars) || DEFAULT_LAYOUT_LIMITS.legendMaxChars);
|
|
5233
|
+
return plain.length > maxChars ? `${plain.slice(0, Math.max(1, maxChars - 1))}…` : plain || get(uiText).answerChoices;
|
|
5127
5234
|
});
|
|
5128
5235
|
const promptId = /* @__PURE__ */ user_derived(() => `${instanceId}-prompt`);
|
|
5129
5236
|
const transcriptId = /* @__PURE__ */ user_derived(() => `${instanceId}-transcript`);
|
|
5130
5237
|
const legendId = /* @__PURE__ */ user_derived(() => `${instanceId}-choices-legend`);
|
|
5131
5238
|
const resultId = /* @__PURE__ */ user_derived(() => `${instanceId}-result`);
|
|
5132
|
-
const choicesGroupLabelledBy = /* @__PURE__ */ user_derived(() =>
|
|
5239
|
+
const choicesGroupLabelledBy = /* @__PURE__ */ user_derived(() => model()?.prompt ? get(promptId) : void 0);
|
|
5240
|
+
const choicesGroupAriaLabel = /* @__PURE__ */ user_derived(() => {
|
|
5241
|
+
if (model()?.prompt) return void 0;
|
|
5242
|
+
const explicit = String(model()?.choiceGroupLabel || "").trim();
|
|
5243
|
+
if (explicit) return explicit;
|
|
5244
|
+
return get(legendText);
|
|
5245
|
+
});
|
|
5133
5246
|
const templateDescribedBy = /* @__PURE__ */ user_derived(() => {
|
|
5134
5247
|
const ids = [];
|
|
5135
|
-
if (
|
|
5136
|
-
if (
|
|
5248
|
+
if (model()?.prompt) ids.push(get(promptId));
|
|
5249
|
+
if (model()?.hasAudio && model()?.audioTranscript) ids.push(get(transcriptId));
|
|
5137
5250
|
return ids.length ? ids.join(" ") : void 0;
|
|
5138
5251
|
});
|
|
5139
5252
|
const lang = /* @__PURE__ */ user_derived(() => {
|
|
5140
|
-
const locale =
|
|
5253
|
+
const locale = model()?.locale || "";
|
|
5141
5254
|
return locale ? locale.slice(0, 2) : "en";
|
|
5142
5255
|
});
|
|
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
|
-
}
|
|
5256
|
+
const audioErrorMessage = /* @__PURE__ */ user_derived(() => get(hasAudioButMissingResource) ? get(uiText).audioResourceUnavailable : "");
|
|
5172
5257
|
const resultText = /* @__PURE__ */ user_derived(() => {
|
|
5173
5258
|
if (!get(isEvaluateMode) || get(showCorrectAnswer)) return "";
|
|
5174
|
-
if (get(isCorrect)) return
|
|
5175
|
-
if (get(isIncorrect) && get(selectedId)) return
|
|
5259
|
+
if (get(isCorrect)) return "Correct answer selected";
|
|
5260
|
+
if (get(isIncorrect) && get(selectedId)) return "Incorrect answer selected";
|
|
5176
5261
|
return "";
|
|
5177
5262
|
});
|
|
5178
|
-
function emitSession(updatedSession) {
|
|
5179
|
-
|
|
5263
|
+
function emitSession(updatedSession, sourceEl) {
|
|
5264
|
+
const host = getHostElement(sourceEl);
|
|
5265
|
+
if (host?.onSessionChange) {
|
|
5266
|
+
host.onSessionChange(updatedSession);
|
|
5267
|
+
return;
|
|
5268
|
+
}
|
|
5269
|
+
host?.dispatchEvent(new CustomEvent("session-changed", {
|
|
5270
|
+
bubbles: true,
|
|
5271
|
+
composed: true,
|
|
5272
|
+
detail: {
|
|
5273
|
+
complete: !!updatedSession?.choiceId,
|
|
5274
|
+
component: "mc-populated-blank"
|
|
5275
|
+
}
|
|
5276
|
+
}));
|
|
5180
5277
|
}
|
|
5181
5278
|
function onRadioChange(e) {
|
|
5182
5279
|
const input = e.target;
|
|
@@ -5184,17 +5281,17 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5184
5281
|
const choiceId = input.value;
|
|
5185
5282
|
set(localChoiceId, choiceId, true);
|
|
5186
5283
|
emitSession({
|
|
5187
|
-
|
|
5188
|
-
id:
|
|
5284
|
+
...session(),
|
|
5285
|
+
id: session()?.id || model()?.id || "1",
|
|
5189
5286
|
element: "mc-populated-blank",
|
|
5190
5287
|
choiceId
|
|
5191
|
-
});
|
|
5288
|
+
}, input);
|
|
5192
5289
|
}
|
|
5193
5290
|
function toggleCorrectAnswer() {
|
|
5194
5291
|
set(showCorrectAnswer, !get(showCorrectAnswer));
|
|
5195
5292
|
}
|
|
5196
5293
|
function onRadioGroupKeydown(e) {
|
|
5197
|
-
if (
|
|
5294
|
+
if (model()?.disabled) return;
|
|
5198
5295
|
const key = e.key;
|
|
5199
5296
|
if (![
|
|
5200
5297
|
"ArrowDown",
|
|
@@ -5215,97 +5312,144 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5215
5312
|
next.focus();
|
|
5216
5313
|
}
|
|
5217
5314
|
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();
|
|
5315
|
+
if (get(hasPlayableAudio) && get(audioEl)) get(audioEl).play().finally(() => {
|
|
5226
5316
|
set(autoPlayPromptOpen, false);
|
|
5227
|
-
}
|
|
5317
|
+
});
|
|
5228
5318
|
}
|
|
5229
|
-
function onAudioPlaying() {
|
|
5319
|
+
function onAudioPlaying(e) {
|
|
5320
|
+
const host = getHostElement(e.currentTarget);
|
|
5230
5321
|
set(isMediaPlaying, true);
|
|
5231
|
-
|
|
5322
|
+
host?.onAudioStarted?.();
|
|
5232
5323
|
set(autoPlayPromptOpen, false);
|
|
5233
5324
|
}
|
|
5234
|
-
function onAudioEnded() {
|
|
5325
|
+
function onAudioEnded(e) {
|
|
5326
|
+
const host = getHostElement(e.currentTarget);
|
|
5235
5327
|
set(isMediaPlaying, false);
|
|
5236
|
-
|
|
5328
|
+
host?.onAudioEnded?.();
|
|
5329
|
+
}
|
|
5330
|
+
function getHostElement(sourceEl) {
|
|
5331
|
+
let cursor = sourceEl;
|
|
5332
|
+
while (cursor) {
|
|
5333
|
+
const maybeHost = cursor;
|
|
5334
|
+
if (typeof maybeHost?.onSessionChange === "function" || typeof maybeHost?.onAudioStarted === "function" || typeof maybeHost?.onAudioEnded === "function") return maybeHost;
|
|
5335
|
+
cursor = cursor.parentElement;
|
|
5336
|
+
}
|
|
5337
|
+
return document.querySelector("mc-populated-blank") || null;
|
|
5237
5338
|
}
|
|
5238
|
-
function speechButtonLabel() {
|
|
5239
|
-
return
|
|
5339
|
+
function speechButtonLabel(locale = "") {
|
|
5340
|
+
return locale.toLowerCase().startsWith("es") ? get(uiText).listenLabelEs : get(uiText).listenLabelEn;
|
|
5240
5341
|
}
|
|
5241
5342
|
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
|
-
};
|
|
5343
|
+
const locale = String(model()?.locale || "").toLowerCase();
|
|
5344
|
+
const lang = locale.slice(0, 2);
|
|
5345
|
+
const byLocale = model()?.audioButtonSkinsByLocale && typeof model().audioButtonSkinsByLocale === "object" ? model().audioButtonSkinsByLocale : {};
|
|
5346
|
+
const customSingle = model()?.audioButtonSkin && typeof model().audioButtonSkin === "object" ? model().audioButtonSkin : null;
|
|
5347
|
+
const defaultSkin = locale.startsWith("es") ? DEFAULT_AUDIO_BUTTON_SKINS.es : DEFAULT_AUDIO_BUTTON_SKINS.default;
|
|
5348
|
+
return byLocale[locale] || byLocale[lang] || byLocale.default || customSingle || defaultSkin;
|
|
5250
5349
|
});
|
|
5251
5350
|
function playFeatureAudio() {
|
|
5252
|
-
if (get(hasPlayableAudio) && get(audioEl)) {
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5351
|
+
if (get(hasPlayableAudio) && get(audioEl)) get(audioEl).play().catch(() => {});
|
|
5352
|
+
}
|
|
5353
|
+
user_effect(() => {
|
|
5354
|
+
if (session()?.choiceId) set(localChoiceId, session().choiceId, true);
|
|
5355
|
+
});
|
|
5356
|
+
user_effect(() => {
|
|
5357
|
+
const el = get(audioEl);
|
|
5358
|
+
if (!el) return;
|
|
5359
|
+
const handlePlaying = (e) => onAudioPlaying(e);
|
|
5360
|
+
const handleEnded = (e) => onAudioEnded(e);
|
|
5361
|
+
el.addEventListener("playing", handlePlaying);
|
|
5362
|
+
el.addEventListener("ended", handleEnded);
|
|
5363
|
+
return () => {
|
|
5364
|
+
el.removeEventListener("playing", handlePlaying);
|
|
5365
|
+
el.removeEventListener("ended", handleEnded);
|
|
5267
5366
|
};
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5367
|
+
});
|
|
5368
|
+
user_effect(() => {
|
|
5369
|
+
const btn = get(featureAudioButtonEl);
|
|
5370
|
+
if (!btn) return;
|
|
5371
|
+
const handleClick = () => playFeatureAudio();
|
|
5372
|
+
btn.addEventListener("click", handleClick);
|
|
5373
|
+
return () => {
|
|
5374
|
+
btn.removeEventListener("click", handleClick);
|
|
5272
5375
|
};
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5376
|
+
});
|
|
5377
|
+
user_effect(() => {
|
|
5378
|
+
const btn = get(autoplayEnableButtonEl);
|
|
5379
|
+
if (!btn) return;
|
|
5380
|
+
const handleClick = () => handleEnableAutoplayClick();
|
|
5381
|
+
btn.addEventListener("click", handleClick);
|
|
5382
|
+
return () => {
|
|
5383
|
+
btn.removeEventListener("click", handleClick);
|
|
5384
|
+
};
|
|
5385
|
+
});
|
|
5386
|
+
user_effect(() => {
|
|
5387
|
+
const btn = get(toggleCorrectAnswerButtonEl);
|
|
5388
|
+
if (!btn) return;
|
|
5389
|
+
const handleClick = () => toggleCorrectAnswer();
|
|
5390
|
+
btn.addEventListener("click", handleClick);
|
|
5391
|
+
return () => {
|
|
5392
|
+
btn.removeEventListener("click", handleClick);
|
|
5276
5393
|
};
|
|
5277
|
-
set(activeUtterance, utterance, true);
|
|
5278
|
-
window.speechSynthesis.speak(utterance);
|
|
5279
|
-
}
|
|
5280
|
-
onDestroy(() => {
|
|
5281
|
-
if (get(activeUtterance) && window?.speechSynthesis) window.speechSynthesis.cancel();
|
|
5282
5394
|
});
|
|
5283
5395
|
user_effect(() => {
|
|
5284
|
-
|
|
5396
|
+
const group = get(choicesGroupEl);
|
|
5397
|
+
if (!group) return;
|
|
5398
|
+
const handleChange = (e) => {
|
|
5399
|
+
const target = e.target;
|
|
5400
|
+
if (!target || target.type !== "radio") return;
|
|
5401
|
+
onRadioChange(e);
|
|
5402
|
+
};
|
|
5403
|
+
const handleKeydown = (e) => onRadioGroupKeydown(e);
|
|
5404
|
+
group.addEventListener("change", handleChange);
|
|
5405
|
+
group.addEventListener("keydown", handleKeydown);
|
|
5406
|
+
return () => {
|
|
5407
|
+
group.removeEventListener("change", handleChange);
|
|
5408
|
+
group.removeEventListener("keydown", handleKeydown);
|
|
5409
|
+
};
|
|
5285
5410
|
});
|
|
5286
5411
|
user_effect(() => {
|
|
5287
|
-
if (
|
|
5412
|
+
if (!model()?.hasAudio || !model()?.autoplayAudioEnabled) return;
|
|
5288
5413
|
if (get(autoplayAttempted)) return;
|
|
5289
5414
|
set(autoplayAttempted, true);
|
|
5290
|
-
if (get(audioEl) &&
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
});
|
|
5294
|
-
return;
|
|
5295
|
-
}
|
|
5296
|
-
if ($$props?.model?.audioTranscript) set(autoPlayPromptOpen, true);
|
|
5415
|
+
if (get(audioEl) && model()?.audioUrl) get(audioEl).play().catch(() => {
|
|
5416
|
+
set(autoPlayPromptOpen, true);
|
|
5417
|
+
});
|
|
5297
5418
|
});
|
|
5419
|
+
var $$exports = {
|
|
5420
|
+
get model() {
|
|
5421
|
+
return model();
|
|
5422
|
+
},
|
|
5423
|
+
set model($$value) {
|
|
5424
|
+
model($$value);
|
|
5425
|
+
flushSync();
|
|
5426
|
+
},
|
|
5427
|
+
get session() {
|
|
5428
|
+
return session();
|
|
5429
|
+
},
|
|
5430
|
+
set session($$value) {
|
|
5431
|
+
session($$value);
|
|
5432
|
+
flushSync();
|
|
5433
|
+
},
|
|
5434
|
+
get options() {
|
|
5435
|
+
return options();
|
|
5436
|
+
},
|
|
5437
|
+
set options($$value) {
|
|
5438
|
+
options($$value);
|
|
5439
|
+
flushSync();
|
|
5440
|
+
}
|
|
5441
|
+
};
|
|
5298
5442
|
var div = root();
|
|
5299
5443
|
var node = child(div);
|
|
5300
5444
|
var consequent = ($$anchor) => {
|
|
5301
5445
|
var div_1 = root_1();
|
|
5302
|
-
html(div_1, () =>
|
|
5446
|
+
html(div_1, () => model().prompt, true);
|
|
5303
5447
|
reset(div_1);
|
|
5304
5448
|
template_effect(() => set_attribute(div_1, "id", get(promptId)));
|
|
5305
5449
|
append($$anchor, div_1);
|
|
5306
5450
|
};
|
|
5307
5451
|
if_block(node, ($$render) => {
|
|
5308
|
-
if (
|
|
5452
|
+
if (model()?.prompt) $$render(consequent);
|
|
5309
5453
|
});
|
|
5310
5454
|
var node_1 = sibling(node, 2);
|
|
5311
5455
|
var consequent_6 = ($$anchor) => {
|
|
@@ -5319,17 +5463,15 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5319
5463
|
var img = child(button);
|
|
5320
5464
|
var img_1 = sibling(img, 2);
|
|
5321
5465
|
reset(button);
|
|
5466
|
+
bind_this(button, ($$value) => set(featureAudioButtonEl, $$value), () => get(featureAudioButtonEl));
|
|
5322
5467
|
template_effect(($0) => {
|
|
5323
|
-
set_attribute(audio, "src",
|
|
5468
|
+
set_attribute(audio, "src", model().audioUrl);
|
|
5324
5469
|
set_attribute(button, "aria-label", $0);
|
|
5325
|
-
set_class(img, 1, `listen-feature-icon rli-feature-listen ${get(isMediaPlaying)
|
|
5470
|
+
set_class(img, 1, `listen-feature-icon pie-listen-icon rli-feature-listen ${get(isMediaPlaying) ? "" : "listen-active"}`, "svelte-6wlbb4");
|
|
5326
5471
|
set_attribute(img, "src", get(featureAudioSkin).silentUrl);
|
|
5327
|
-
set_class(img_1, 1, `listen-feature-icon rli-feature-listen ${get(isMediaPlaying)
|
|
5472
|
+
set_class(img_1, 1, `listen-feature-icon pie-listen-icon rli-feature-listen ${get(isMediaPlaying) ? "listen-active" : ""}`, "svelte-6wlbb4");
|
|
5328
5473
|
set_attribute(img_1, "src", get(featureAudioSkin).playingUrl);
|
|
5329
|
-
}, [() => speechButtonLabel()]);
|
|
5330
|
-
event("playing", audio, onAudioPlaying);
|
|
5331
|
-
event("ended", audio, onAudioEnded);
|
|
5332
|
-
delegated("click", button, playFeatureAudio);
|
|
5474
|
+
}, [() => speechButtonLabel(model()?.locale)]);
|
|
5333
5475
|
append($$anchor, fragment);
|
|
5334
5476
|
};
|
|
5335
5477
|
var consequent_3 = ($$anchor) => {
|
|
@@ -5341,191 +5483,169 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5341
5483
|
var button_1 = root_5();
|
|
5342
5484
|
var text = child(button_1, true);
|
|
5343
5485
|
reset(button_1);
|
|
5344
|
-
|
|
5345
|
-
|
|
5486
|
+
bind_this(button_1, ($$value) => set(autoplayEnableButtonEl, $$value), () => get(autoplayEnableButtonEl));
|
|
5487
|
+
template_effect(() => set_text(text, get(uiText).clickToEnableAutoplay));
|
|
5346
5488
|
append($$anchor, button_1);
|
|
5347
5489
|
};
|
|
5348
5490
|
if_block(node_3, ($$render) => {
|
|
5349
5491
|
if (get(autoPlayPromptOpen)) $$render(consequent_2);
|
|
5350
5492
|
});
|
|
5351
5493
|
template_effect(() => {
|
|
5352
|
-
set_attribute(audio_1, "src",
|
|
5353
|
-
set_attribute(audio_1, "aria-describedby",
|
|
5494
|
+
set_attribute(audio_1, "src", model().audioUrl);
|
|
5495
|
+
set_attribute(audio_1, "aria-describedby", model()?.audioTranscript ? get(transcriptId) : void 0);
|
|
5354
5496
|
});
|
|
5355
|
-
event("playing", audio_1, onAudioPlaying);
|
|
5356
|
-
event("ended", audio_1, onAudioEnded);
|
|
5357
5497
|
append($$anchor, fragment_1);
|
|
5358
5498
|
};
|
|
5359
5499
|
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);
|
|
5500
|
+
var p = root_6();
|
|
5501
|
+
var text_1 = child(p, true);
|
|
5502
|
+
reset(p);
|
|
5503
|
+
template_effect(() => set_text(text_1, get(audioErrorMessage)));
|
|
5504
|
+
append($$anchor, p);
|
|
5373
5505
|
};
|
|
5374
5506
|
if_block(node_2, ($$render) => {
|
|
5375
5507
|
if (get(hasPlayableAudio) && get(useFeatureButtonAudio)) $$render(consequent_1);
|
|
5376
5508
|
else if (get(hasPlayableAudio)) $$render(consequent_3, 1);
|
|
5377
|
-
else if (get(
|
|
5509
|
+
else if (get(hasAudioButMissingResource)) $$render(consequent_4, 2);
|
|
5378
5510
|
});
|
|
5379
5511
|
var node_4 = sibling(node_2, 2);
|
|
5380
5512
|
var consequent_5 = ($$anchor) => {
|
|
5381
|
-
var
|
|
5382
|
-
var
|
|
5383
|
-
|
|
5513
|
+
var p_1 = root_7();
|
|
5514
|
+
var strong = child(p_1);
|
|
5515
|
+
var text_2 = child(strong);
|
|
5516
|
+
reset(strong);
|
|
5517
|
+
var text_3 = sibling(strong);
|
|
5518
|
+
reset(p_1);
|
|
5384
5519
|
template_effect(() => {
|
|
5385
|
-
set_class(
|
|
5386
|
-
set_attribute(
|
|
5387
|
-
set_text(
|
|
5520
|
+
set_class(p_1, 1, `text-sm mt-2 text-gray-700 pie-audio-transcript ${get(showVisibleTranscript) ? "" : "sr-only"}`, "svelte-6wlbb4");
|
|
5521
|
+
set_attribute(p_1, "id", get(transcriptId));
|
|
5522
|
+
set_text(text_2, `${get(uiText).transcriptLabel ?? ""}:`);
|
|
5523
|
+
set_text(text_3, ` ${model().audioTranscript ?? ""}`);
|
|
5388
5524
|
});
|
|
5389
|
-
append($$anchor,
|
|
5525
|
+
append($$anchor, p_1);
|
|
5390
5526
|
};
|
|
5391
5527
|
if_block(node_4, ($$render) => {
|
|
5392
|
-
if (
|
|
5528
|
+
if (model()?.audioTranscript) $$render(consequent_5);
|
|
5393
5529
|
});
|
|
5394
5530
|
reset(div_2);
|
|
5395
5531
|
append($$anchor, div_2);
|
|
5396
5532
|
};
|
|
5397
5533
|
if_block(node_1, ($$render) => {
|
|
5398
|
-
if (
|
|
5534
|
+
if (model()?.hasAudio) $$render(consequent_6);
|
|
5399
5535
|
});
|
|
5400
5536
|
var node_5 = sibling(node_1, 2);
|
|
5401
5537
|
var consequent_7 = ($$anchor) => {
|
|
5402
5538
|
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);
|
|
5539
|
+
html(div_3, () => model().sentenceHtml, true);
|
|
5409
5540
|
reset(div_3);
|
|
5410
|
-
template_effect((
|
|
5541
|
+
template_effect(() => set_attribute(div_3, "aria-describedby", get(templateDescribedBy)));
|
|
5411
5542
|
append($$anchor, div_3);
|
|
5412
5543
|
};
|
|
5413
5544
|
if_block(node_5, ($$render) => {
|
|
5414
|
-
if (
|
|
5545
|
+
if (model()?.sentenceHtml) $$render(consequent_7);
|
|
5415
5546
|
});
|
|
5416
5547
|
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);
|
|
5548
|
+
var consequent_10 = ($$anchor) => {
|
|
5549
|
+
var div_4 = root_9();
|
|
5550
|
+
var node_7 = child(div_4);
|
|
5551
|
+
html(node_7, () => get(templateParts).before);
|
|
5552
|
+
var span = sibling(node_7, 2);
|
|
5553
|
+
var node_8 = child(span);
|
|
5554
|
+
var consequent_8 = ($$anchor) => {
|
|
5555
|
+
var img_2 = root_10();
|
|
5556
|
+
template_effect(() => {
|
|
5557
|
+
set_attribute(img_2, "src", get(displayChoice).imageUrl);
|
|
5558
|
+
set_attribute(img_2, "alt", get(displayChoice).imageAlt || "Selected answer image");
|
|
5559
|
+
});
|
|
5560
|
+
append($$anchor, img_2);
|
|
5441
5561
|
};
|
|
5442
|
-
var
|
|
5443
|
-
var span_1 =
|
|
5562
|
+
var consequent_9 = ($$anchor) => {
|
|
5563
|
+
var span_1 = root_11();
|
|
5444
5564
|
html(span_1, () => get(displayChoice).labelHtml, true);
|
|
5445
5565
|
reset(span_1);
|
|
5446
5566
|
append($$anchor, span_1);
|
|
5447
5567
|
};
|
|
5448
5568
|
var alternate = ($$anchor) => {
|
|
5449
|
-
append($$anchor,
|
|
5569
|
+
append($$anchor, root_12());
|
|
5450
5570
|
};
|
|
5451
|
-
if_block(
|
|
5452
|
-
if (get(choiceMode) === "image" && get(displayChoice)?.imageUrl) $$render(
|
|
5453
|
-
else if (get(displayChoice)?.labelHtml) $$render(
|
|
5571
|
+
if_block(node_8, ($$render) => {
|
|
5572
|
+
if (get(choiceMode) === "image" && get(displayChoice)?.imageUrl) $$render(consequent_8);
|
|
5573
|
+
else if (get(displayChoice)?.labelHtml) $$render(consequent_9, 1);
|
|
5454
5574
|
else $$render(alternate, -1);
|
|
5455
5575
|
});
|
|
5456
5576
|
reset(span);
|
|
5457
5577
|
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");
|
|
5578
|
+
reset(div_4);
|
|
5579
|
+
template_effect(() => {
|
|
5580
|
+
set_attribute(div_4, "aria-describedby", get(templateDescribedBy));
|
|
5581
|
+
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
5582
|
set_style(span, `width:${get(blankWidth)};border-bottom-width:${get(blankBorderWidth)};`);
|
|
5463
|
-
set_attribute(span, "aria-label",
|
|
5464
|
-
}
|
|
5465
|
-
append($$anchor,
|
|
5583
|
+
set_attribute(span, "aria-label", get(uiText).selectedAnswerInSentence);
|
|
5584
|
+
});
|
|
5585
|
+
append($$anchor, div_4);
|
|
5466
5586
|
};
|
|
5467
|
-
if_block(
|
|
5468
|
-
if (!get(isAudioOnlyMode)) $$render(
|
|
5587
|
+
if_block(node_6, ($$render) => {
|
|
5588
|
+
if (!get(isAudioOnlyMode)) $$render(consequent_10);
|
|
5469
5589
|
});
|
|
5470
|
-
var
|
|
5471
|
-
var
|
|
5472
|
-
var
|
|
5473
|
-
var span_3 = child(
|
|
5474
|
-
var
|
|
5590
|
+
var node_10 = sibling(node_6, 2);
|
|
5591
|
+
var consequent_11 = ($$anchor) => {
|
|
5592
|
+
var button_2 = root_13();
|
|
5593
|
+
var span_3 = child(button_2);
|
|
5594
|
+
var text_4 = child(span_3, true);
|
|
5475
5595
|
reset(span_3);
|
|
5476
|
-
reset(
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
append($$anchor,
|
|
5596
|
+
reset(button_2);
|
|
5597
|
+
bind_this(button_2, ($$value) => set(toggleCorrectAnswerButtonEl, $$value), () => get(toggleCorrectAnswerButtonEl));
|
|
5598
|
+
template_effect(() => {
|
|
5599
|
+
set_attribute(button_2, "aria-pressed", get(showCorrectAnswer));
|
|
5600
|
+
set_text(text_4, get(showCorrectAnswer) ? get(uiText).hideCorrectAnswer : get(uiText).showCorrectAnswer);
|
|
5601
|
+
});
|
|
5602
|
+
append($$anchor, button_2);
|
|
5483
5603
|
};
|
|
5484
|
-
if_block(
|
|
5485
|
-
if (get(isEvaluateMode) && get(isIncorrect)) $$render(
|
|
5604
|
+
if_block(node_10, ($$render) => {
|
|
5605
|
+
if (get(isEvaluateMode) && get(isIncorrect)) $$render(consequent_11);
|
|
5486
5606
|
});
|
|
5487
|
-
var
|
|
5488
|
-
var
|
|
5489
|
-
var
|
|
5490
|
-
var
|
|
5491
|
-
reset(
|
|
5607
|
+
var node_11 = sibling(node_10, 2);
|
|
5608
|
+
var consequent_12 = ($$anchor) => {
|
|
5609
|
+
var p_2 = root_14();
|
|
5610
|
+
var text_5 = child(p_2, true);
|
|
5611
|
+
reset(p_2);
|
|
5492
5612
|
template_effect(() => {
|
|
5493
|
-
set_attribute(
|
|
5494
|
-
set_text(
|
|
5613
|
+
set_attribute(p_2, "id", get(resultId));
|
|
5614
|
+
set_text(text_5, get(resultText));
|
|
5495
5615
|
});
|
|
5496
|
-
append($$anchor,
|
|
5616
|
+
append($$anchor, p_2);
|
|
5497
5617
|
};
|
|
5498
|
-
if_block(
|
|
5499
|
-
if (get(resultText)) $$render(
|
|
5618
|
+
if_block(node_11, ($$render) => {
|
|
5619
|
+
if (get(resultText)) $$render(consequent_12);
|
|
5500
5620
|
});
|
|
5501
|
-
var fieldset = sibling(
|
|
5621
|
+
var fieldset = sibling(node_11, 2);
|
|
5502
5622
|
var legend = child(fieldset);
|
|
5503
|
-
var
|
|
5623
|
+
var text_6 = child(legend, true);
|
|
5504
5624
|
reset(legend);
|
|
5505
|
-
var
|
|
5506
|
-
each(
|
|
5507
|
-
var
|
|
5508
|
-
var
|
|
5509
|
-
var
|
|
5510
|
-
var label =
|
|
5625
|
+
var div_5 = sibling(legend, 2);
|
|
5626
|
+
each(div_5, 21, () => get(choices), (c) => c.id, ($$anchor, c) => {
|
|
5627
|
+
var div_6 = root_15();
|
|
5628
|
+
var node_12 = child(div_6);
|
|
5629
|
+
var consequent_14 = ($$anchor) => {
|
|
5630
|
+
var label = root_16();
|
|
5511
5631
|
var span_4 = child(label);
|
|
5512
|
-
var
|
|
5513
|
-
var
|
|
5514
|
-
var
|
|
5632
|
+
var node_13 = child(span_4);
|
|
5633
|
+
var consequent_13 = ($$anchor) => {
|
|
5634
|
+
var img_3 = root_17();
|
|
5515
5635
|
template_effect(() => {
|
|
5516
|
-
set_attribute(
|
|
5517
|
-
set_attribute(
|
|
5636
|
+
set_attribute(img_3, "src", get(c).imageUrl);
|
|
5637
|
+
set_attribute(img_3, "alt", get(c).imageAlt || `Choice ${get(c).id}`);
|
|
5518
5638
|
});
|
|
5519
|
-
append($$anchor,
|
|
5639
|
+
append($$anchor, img_3);
|
|
5520
5640
|
};
|
|
5521
5641
|
var alternate_1 = ($$anchor) => {
|
|
5522
|
-
var span_5 =
|
|
5642
|
+
var span_5 = root_18();
|
|
5523
5643
|
html(span_5, () => get(c).labelHtml || "", true);
|
|
5524
5644
|
reset(span_5);
|
|
5525
5645
|
append($$anchor, span_5);
|
|
5526
5646
|
};
|
|
5527
|
-
if_block(
|
|
5528
|
-
if (get(choiceMode) === "image" && get(c).imageUrl) $$render(
|
|
5647
|
+
if_block(node_13, ($$render) => {
|
|
5648
|
+
if (get(choiceMode) === "image" && get(c).imageUrl) $$render(consequent_13);
|
|
5529
5649
|
else $$render(alternate_1, -1);
|
|
5530
5650
|
});
|
|
5531
5651
|
reset(span_4);
|
|
@@ -5537,34 +5657,33 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5537
5657
|
set_attribute(input_1, "name", get(radioGroupName));
|
|
5538
5658
|
set_attribute(input_1, "id", `${instanceId}-opt-${get(c).id}`);
|
|
5539
5659
|
set_value(input_1, get(c).id);
|
|
5540
|
-
set_checked(input_1, (get(showCorrectAnswer) && get(isEvaluateMode) ?
|
|
5541
|
-
input_1.disabled =
|
|
5660
|
+
set_checked(input_1, (get(showCorrectAnswer) && get(isEvaluateMode) ? model()?.correctChoiceId : get(selectedId)) === get(c).id);
|
|
5661
|
+
input_1.disabled = model()?.disabled;
|
|
5542
5662
|
});
|
|
5543
|
-
delegated("change", input_1, onRadioChange);
|
|
5544
5663
|
append($$anchor, label);
|
|
5545
5664
|
};
|
|
5546
5665
|
var alternate_3 = ($$anchor) => {
|
|
5547
|
-
var fragment_2 =
|
|
5666
|
+
var fragment_2 = root_19();
|
|
5548
5667
|
var input_2 = first_child(fragment_2);
|
|
5549
5668
|
remove_input_defaults(input_2);
|
|
5550
5669
|
var label_1 = sibling(input_2, 2);
|
|
5551
|
-
var
|
|
5552
|
-
var
|
|
5553
|
-
var
|
|
5670
|
+
var node_14 = child(label_1);
|
|
5671
|
+
var consequent_15 = ($$anchor) => {
|
|
5672
|
+
var img_4 = root_20();
|
|
5554
5673
|
template_effect(() => {
|
|
5555
|
-
set_attribute(
|
|
5556
|
-
set_attribute(
|
|
5674
|
+
set_attribute(img_4, "src", get(c).imageUrl);
|
|
5675
|
+
set_attribute(img_4, "alt", get(c).imageAlt || `Choice ${get(c).id}`);
|
|
5557
5676
|
});
|
|
5558
|
-
append($$anchor,
|
|
5677
|
+
append($$anchor, img_4);
|
|
5559
5678
|
};
|
|
5560
5679
|
var alternate_2 = ($$anchor) => {
|
|
5561
|
-
var span_6 =
|
|
5680
|
+
var span_6 = root_21();
|
|
5562
5681
|
html(span_6, () => get(c).labelHtml || "", true);
|
|
5563
5682
|
reset(span_6);
|
|
5564
5683
|
append($$anchor, span_6);
|
|
5565
5684
|
};
|
|
5566
|
-
if_block(
|
|
5567
|
-
if (get(choiceMode) === "image" && get(c).imageUrl) $$render(
|
|
5685
|
+
if_block(node_14, ($$render) => {
|
|
5686
|
+
if (get(choiceMode) === "image" && get(c).imageUrl) $$render(consequent_15);
|
|
5568
5687
|
else $$render(alternate_2, -1);
|
|
5569
5688
|
});
|
|
5570
5689
|
reset(label_1);
|
|
@@ -5572,70 +5691,63 @@ function McPopulatedBlank($$anchor, $$props) {
|
|
|
5572
5691
|
set_attribute(input_2, "name", get(radioGroupName));
|
|
5573
5692
|
set_attribute(input_2, "id", `${instanceId}-opt-${get(c).id}`);
|
|
5574
5693
|
set_value(input_2, get(c).id);
|
|
5575
|
-
set_checked(input_2, (get(showCorrectAnswer) && get(isEvaluateMode) ?
|
|
5576
|
-
input_2.disabled =
|
|
5694
|
+
set_checked(input_2, (get(showCorrectAnswer) && get(isEvaluateMode) ? model()?.correctChoiceId : get(selectedId)) === get(c).id);
|
|
5695
|
+
input_2.disabled = model()?.disabled;
|
|
5577
5696
|
set_attribute(label_1, "for", `${instanceId}-opt-${get(c).id}`);
|
|
5578
5697
|
});
|
|
5579
|
-
delegated("change", input_2, onRadioChange);
|
|
5580
5698
|
append($$anchor, fragment_2);
|
|
5581
5699
|
};
|
|
5582
|
-
if_block(
|
|
5583
|
-
if (get(isHorizontalChoices)) $$render(
|
|
5700
|
+
if_block(node_12, ($$render) => {
|
|
5701
|
+
if (get(isHorizontalChoices)) $$render(consequent_14);
|
|
5584
5702
|
else $$render(alternate_3, -1);
|
|
5585
5703
|
});
|
|
5586
|
-
var
|
|
5587
|
-
var
|
|
5704
|
+
var node_15 = sibling(node_12, 2);
|
|
5705
|
+
var consequent_18 = ($$anchor) => {
|
|
5588
5706
|
var fragment_3 = comment();
|
|
5589
|
-
var
|
|
5707
|
+
var node_16 = first_child(fragment_3);
|
|
5708
|
+
var consequent_16 = ($$anchor) => {
|
|
5709
|
+
append($$anchor, root_23());
|
|
5710
|
+
};
|
|
5590
5711
|
var consequent_17 = ($$anchor) => {
|
|
5591
5712
|
append($$anchor, root_24());
|
|
5592
5713
|
};
|
|
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);
|
|
5714
|
+
if_block(node_16, ($$render) => {
|
|
5715
|
+
if (get(selectedId) === get(c).id && get(isCorrect)) $$render(consequent_16);
|
|
5716
|
+
else if (get(selectedId) === get(c).id && get(isIncorrect)) $$render(consequent_17, 1);
|
|
5599
5717
|
});
|
|
5600
5718
|
append($$anchor, fragment_3);
|
|
5601
5719
|
};
|
|
5602
|
-
if_block(
|
|
5603
|
-
if (get(isEvaluateMode) && !get(showCorrectAnswer)) $$render(
|
|
5720
|
+
if_block(node_15, ($$render) => {
|
|
5721
|
+
if (get(isEvaluateMode) && !get(showCorrectAnswer)) $$render(consequent_18);
|
|
5604
5722
|
});
|
|
5605
|
-
reset(
|
|
5606
|
-
template_effect(() => set_class(
|
|
5607
|
-
append($$anchor,
|
|
5723
|
+
reset(div_6);
|
|
5724
|
+
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) ? model()?.correctChoiceId : get(selectedId)) === get(c).id ? "is-selected pie-choice-selected" : ""}`, "svelte-6wlbb4"));
|
|
5725
|
+
append($$anchor, div_6);
|
|
5608
5726
|
});
|
|
5609
|
-
reset(
|
|
5727
|
+
reset(div_5);
|
|
5728
|
+
bind_this(div_5, ($$value) => set(choicesGroupEl, $$value), () => get(choicesGroupEl));
|
|
5610
5729
|
reset(fieldset);
|
|
5611
5730
|
reset(div);
|
|
5612
5731
|
template_effect(() => {
|
|
5613
|
-
set_class(div, 1, `p-4 mc-populated-blank-root layout-${get(layoutProfile)} ${get(hasInlineSentenceAudioLayout) ? "has-inline-audio" : ""}
|
|
5732
|
+
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
5733
|
set_attribute(div, "lang", get(lang));
|
|
5615
|
-
|
|
5734
|
+
set_style(div, get(rootStyle));
|
|
5735
|
+
fieldset.disabled = model()?.disabled;
|
|
5616
5736
|
set_attribute(legend, "id", get(legendId));
|
|
5617
|
-
set_text(
|
|
5618
|
-
set_class(
|
|
5619
|
-
set_attribute(
|
|
5620
|
-
set_attribute(
|
|
5737
|
+
set_text(text_6, get(legendText));
|
|
5738
|
+
set_class(div_5, 1, `pie-choices ${get(isHorizontalChoices) ? "flex flex-row flex-wrap items-start justify-center" : "flex flex-col"}`, "svelte-6wlbb4");
|
|
5739
|
+
set_attribute(div_5, "aria-labelledby", get(choicesGroupLabelledBy));
|
|
5740
|
+
set_attribute(div_5, "aria-label", get(choicesGroupAriaLabel));
|
|
5741
|
+
set_attribute(div_5, "aria-describedby", get(resultText) ? get(resultId) : void 0);
|
|
5621
5742
|
});
|
|
5622
|
-
delegated("keydown", div_7, onRadioGroupKeydown);
|
|
5623
5743
|
append($$anchor, div);
|
|
5624
|
-
pop();
|
|
5625
|
-
}
|
|
5626
|
-
|
|
5627
|
-
"click",
|
|
5628
|
-
"keydown",
|
|
5629
|
-
"change"
|
|
5630
|
-
]);
|
|
5631
|
-
create_custom_element(McPopulatedBlank, {
|
|
5744
|
+
return pop($$exports);
|
|
5745
|
+
}
|
|
5746
|
+
customElements.define("mc-populated-blank", create_custom_element(McPopulatedBlank, {
|
|
5632
5747
|
model: { type: "Object" },
|
|
5633
5748
|
session: { type: "Object" },
|
|
5634
|
-
options: { type: "Object" }
|
|
5635
|
-
|
|
5636
|
-
onAudioStarted: { type: "Object" },
|
|
5637
|
-
onAudioEnded: { type: "Object" }
|
|
5638
|
-
}, [], []);
|
|
5749
|
+
options: { type: "Object" }
|
|
5750
|
+
}, [], []));
|
|
5639
5751
|
//#endregion
|
|
5640
5752
|
//#region src/controller/index.ts
|
|
5641
5753
|
var isComplete = (question, session, audioComplete = false) => {
|