@pie-element/simple-cloze 0.1.4-next.6 → 0.1.4-next.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/author.js +2 -0
  2. package/dist/author/index.d.ts +8 -0
  3. package/dist/author/index.js +181 -242
  4. package/dist/author/index.js.map +1 -1
  5. package/dist/browser/author/index.js +3136 -3044
  6. package/dist/browser/author/index.js.map +1 -1
  7. package/dist/browser/{client-Dt8SOe5Z.js → client-BSTc3boO.js} +650 -755
  8. package/dist/browser/client-BSTc3boO.js.map +1 -0
  9. package/dist/browser/controller/index.js +42 -32
  10. package/dist/browser/controller/index.js.map +1 -1
  11. package/dist/browser/delivery/index.js +205 -156
  12. package/dist/browser/delivery/index.js.map +1 -1
  13. package/dist/browser/i18n-BaF24Jzw.js +1610 -0
  14. package/dist/browser/i18n-BaF24Jzw.js.map +1 -0
  15. package/dist/browser/plain-text-iaQZhkGe.js +53 -0
  16. package/dist/browser/plain-text-iaQZhkGe.js.map +1 -0
  17. package/dist/browser/print/index.js +64 -21
  18. package/dist/browser/print/index.js.map +1 -1
  19. package/dist/controller/defaults.d.ts +1 -0
  20. package/dist/controller/index.d.ts +51 -8
  21. package/dist/controller/index.js +121 -29
  22. package/dist/controller/index.js.map +1 -1
  23. package/dist/controller/plain-text.d.ts +11 -0
  24. package/dist/delivery/index.d.ts +2 -20
  25. package/dist/delivery/index.js +2896 -392
  26. package/dist/delivery/index.js.map +1 -1
  27. package/dist/i18n.d.ts +7 -0
  28. package/dist/index.iife.js +9 -3
  29. package/dist/index.js +2 -4912
  30. package/dist/print/index.d.ts +7 -0
  31. package/dist/print/index.js +2773 -28
  32. package/dist/print/index.js.map +1 -1
  33. package/dist/runtime-support.js +5 -5
  34. package/dist/runtime-support.js.map +1 -1
  35. package/module/print.js +2381 -600
  36. package/module/print.js.map +1 -1
  37. package/package.json +3 -4
  38. package/dist/browser/client-Dt8SOe5Z.js.map +0 -1
  39. package/dist/index.js.map +0 -1
package/author.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './dist/author/index.js';
2
+ export * from './dist/author/index.js';
@@ -2,6 +2,14 @@ declare const SvelteElementClass: any;
2
2
  declare class SimpleClozeAuthor extends SvelteElementClass {
3
3
  private _model;
4
4
  private _onChange;
5
+ onModelChange: (update: any) => void;
6
+ /**
7
+ * The component reports each edit through its `onModelChange` prop, assigned
8
+ * here through the accessor Svelte generates for it. The host keeps the
9
+ * edited model, renders from it, and announces it as `model.updated`, which
10
+ * bubbles to the listener an authoring player registers at its root.
11
+ */
12
+ constructor();
5
13
  set model(m: any);
6
14
  get model(): any;
7
15
  set onChange(fn: (model: any) => void);
@@ -1,3 +1,59 @@
1
+ //#region ../../shared/configure-events/dist/index.js
2
+ var _e;
3
+ var _e2;
4
+ var _e3;
5
+ var _e4;
6
+ var _e5;
7
+ var e = (_e = class e extends CustomEvent {
8
+ constructor(t, n = !1) {
9
+ super(e.TYPE, {
10
+ bubbles: !0,
11
+ detail: {
12
+ update: t,
13
+ reset: n
14
+ }
15
+ }), this.update = t, this.reset = n;
16
+ }
17
+ }, _e.TYPE = "model.updated", _e);
18
+ _e2 = class e extends CustomEvent {
19
+ constructor(t, n) {
20
+ super(e.TYPE, {
21
+ bubbles: !0,
22
+ detail: {
23
+ src: t,
24
+ done: n
25
+ }
26
+ }), this.src = t, this.done = n;
27
+ }
28
+ }, _e2.TYPE = "delete.image";
29
+ _e3 = class e extends CustomEvent {
30
+ constructor(t) {
31
+ super(e.TYPE, {
32
+ bubbles: !0,
33
+ detail: t
34
+ }), this.handler = t;
35
+ }
36
+ }, _e3.TYPE = "insert.image";
37
+ _e4 = class e extends CustomEvent {
38
+ constructor(t, n) {
39
+ super(e.TYPE, {
40
+ bubbles: !0,
41
+ detail: {
42
+ src: t,
43
+ done: n
44
+ }
45
+ }), this.src = t, this.done = n;
46
+ }
47
+ }, _e4.TYPE = "delete.sound";
48
+ _e5 = class e extends CustomEvent {
49
+ constructor(t) {
50
+ super(e.TYPE, {
51
+ bubbles: !0,
52
+ detail: t
53
+ }), this.handler = t;
54
+ }
55
+ }, _e5.TYPE = "insert.sound";
56
+ //#endregion
1
57
  //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/disclose-version.js
2
58
  if (typeof window !== "undefined") {
3
59
  var _window$__svelte, _window;
@@ -3858,61 +3914,6 @@ function onDestroy(fn) {
3858
3914
  onMount(() => () => untrack(fn));
3859
3915
  }
3860
3916
  /**
3861
- * @template [T=any]
3862
- * @param {string} type
3863
- * @param {T} [detail]
3864
- * @param {any}params_0
3865
- * @returns {CustomEvent<T>}
3866
- */
3867
- function create_custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
3868
- return new CustomEvent(type, {
3869
- detail,
3870
- bubbles,
3871
- cancelable
3872
- });
3873
- }
3874
- /**
3875
- * Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs/svelte/legacy-on#Component-events).
3876
- * Event dispatchers are functions that can take two arguments: `name` and `detail`.
3877
- *
3878
- * Component events created with `createEventDispatcher` create a
3879
- * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).
3880
- * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).
3881
- * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)
3882
- * property and can contain any type of data.
3883
- *
3884
- * The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument:
3885
- * ```ts
3886
- * const dispatch = createEventDispatcher<{
3887
- * loaded: null; // does not take a detail argument
3888
- * change: string; // takes a detail argument of type string, which is required
3889
- * optional: number | null; // takes an optional detail argument of type number
3890
- * }>();
3891
- * ```
3892
- *
3893
- * @deprecated Use callback props and/or the `$host()` rune instead — see [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Event-changes-Component-events)
3894
- * @template {Record<string, any>} [EventMap = any]
3895
- * @returns {EventDispatcher<EventMap>}
3896
- */
3897
- function createEventDispatcher() {
3898
- const active_component_context = component_context;
3899
- if (active_component_context === null) lifecycle_outside_component("createEventDispatcher");
3900
- /**
3901
- * @param [detail]
3902
- * @param [options]
3903
- */
3904
- return (type, detail, options) => {
3905
- const events = active_component_context.s.$$events?.[type];
3906
- if (events) {
3907
- const callbacks = is_array(events) ? events.slice() : [events];
3908
- const event = create_custom_event(type, detail, options);
3909
- for (const fn of callbacks) fn.call(active_component_context.x, event);
3910
- return !event.defaultPrevented;
3911
- }
3912
- return true;
3913
- };
3914
- }
3915
- /**
3916
3917
  * Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate
3917
3918
  * @param {ComponentContext} context
3918
3919
  */
@@ -4036,7 +4037,7 @@ function html(node, get_value, is_controlled = false, svg = false, mathml = fals
4036
4037
  * @param {Node} anchor
4037
4038
  * @param {{ hash: string, code: string }} css
4038
4039
  */
4039
- function append_styles$1(anchor, css) {
4040
+ function append_styles(anchor, css) {
4040
4041
  effect(() => {
4041
4042
  anchor = active_effect?.parent?.nodes?.start ?? anchor;
4042
4043
  var root = anchor.getRootNode();
@@ -4075,90 +4076,6 @@ function to_class(value, hash, directives) {
4075
4076
  }
4076
4077
  return classname === "" ? null : classname;
4077
4078
  }
4078
- /**
4079
- *
4080
- * @param {Record<string,any>} styles
4081
- * @param {boolean} important
4082
- */
4083
- function append_styles(styles, important = false) {
4084
- var separator = important ? " !important;" : ";";
4085
- var css = "";
4086
- for (var key of Object.keys(styles)) {
4087
- var value = styles[key];
4088
- if (value != null && value !== "") css += " " + key + ": " + value + separator;
4089
- }
4090
- return css;
4091
- }
4092
- /**
4093
- * @param {string} name
4094
- * @returns {string}
4095
- */
4096
- function to_css_name(name) {
4097
- if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase();
4098
- return name;
4099
- }
4100
- /**
4101
- * @param {any} value
4102
- * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]
4103
- * @returns {string | null}
4104
- */
4105
- function to_style(value, styles) {
4106
- if (styles) {
4107
- var new_style = "";
4108
- /** @type {Record<string,any> | undefined} */
4109
- var normal_styles;
4110
- /** @type {Record<string,any> | undefined} */
4111
- var important_styles;
4112
- if (Array.isArray(styles)) {
4113
- normal_styles = styles[0];
4114
- important_styles = styles[1];
4115
- } else normal_styles = styles;
4116
- if (value) {
4117
- value = String(value).replaceAll(/\/\*.*?\*\//g, "").trim();
4118
- /** @type {boolean | '"' | "'"} */
4119
- var in_str = false;
4120
- var in_apo = 0;
4121
- var in_comment = false;
4122
- var reserved_names = [];
4123
- if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
4124
- if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name));
4125
- var start_index = 0;
4126
- var name_index = -1;
4127
- const len = value.length;
4128
- for (var i = 0; i < len; i++) {
4129
- var c = value[i];
4130
- if (in_comment) {
4131
- if (c === "/" && value[i - 1] === "*") in_comment = false;
4132
- } else if (in_str) {
4133
- if (in_str === c) in_str = false;
4134
- } else if (c === "/" && value[i + 1] === "*") in_comment = true;
4135
- else if (c === "\"" || c === "'") in_str = c;
4136
- else if (c === "(") in_apo++;
4137
- else if (c === ")") in_apo--;
4138
- if (!in_comment && in_str === false && in_apo === 0) {
4139
- if (c === ":" && name_index === -1) name_index = i;
4140
- else if (c === ";" || i === len - 1) {
4141
- if (name_index !== -1) {
4142
- var name = to_css_name(value.substring(start_index, name_index).trim());
4143
- if (!reserved_names.includes(name)) {
4144
- if (c !== ";") i++;
4145
- var property = value.substring(start_index, i).trim();
4146
- new_style += " " + property + ";";
4147
- }
4148
- }
4149
- start_index = i + 1;
4150
- name_index = -1;
4151
- }
4152
- }
4153
- }
4154
- }
4155
- if (normal_styles) new_style += append_styles(normal_styles);
4156
- if (important_styles) new_style += append_styles(important_styles, true);
4157
- new_style = new_style.trim();
4158
- return new_style === "" ? null : new_style;
4159
- }
4160
- return value == null ? null : String(value);
4161
- }
4162
4079
  //#endregion
4163
4080
  //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/class.js
4164
4081
  /**
@@ -4185,40 +4102,6 @@ function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
4185
4102
  return next_classes;
4186
4103
  }
4187
4104
  //#endregion
4188
- //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/style.js
4189
- /**
4190
- * @param {Element & ElementCSSInlineStyle} dom
4191
- * @param {Record<string, any>} prev
4192
- * @param {Record<string, any>} next
4193
- * @param {string} [priority]
4194
- */
4195
- function update_styles(dom, prev = {}, next, priority) {
4196
- for (var key in next) {
4197
- var value = next[key];
4198
- if (prev[key] !== value) if (next[key] == null) dom.style.removeProperty(key);
4199
- else dom.style.setProperty(key, value, priority);
4200
- }
4201
- }
4202
- /**
4203
- * @param {Element & ElementCSSInlineStyle} dom
4204
- * @param {string | null} value
4205
- * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles]
4206
- * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]
4207
- */
4208
- function set_style(dom, value, prev_styles, next_styles) {
4209
- var prev = dom[STYLE_CACHE];
4210
- if (hydrating || prev !== value) {
4211
- var next_style_attr = to_style(value, next_styles);
4212
- if (!hydrating || next_style_attr !== dom.getAttribute("style")) if (next_style_attr == null) dom.removeAttribute("style");
4213
- else dom.style.cssText = next_style_attr;
4214
- /** @type {any} */ dom[STYLE_CACHE] = value;
4215
- } else if (next_styles) if (Array.isArray(next_styles)) {
4216
- update_styles(dom, prev_styles?.[0], next_styles[0]);
4217
- update_styles(dom, prev_styles?.[1], next_styles[1], "important");
4218
- } else update_styles(dom, prev_styles, next_styles);
4219
- return next_styles;
4220
- }
4221
- //#endregion
4222
4105
  //#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/attributes.js
4223
4106
  /** @import { Blocker, Effect } from '#client' */
4224
4107
  var IS_CUSTOM_ELEMENT = Symbol("is custom element");
@@ -26624,7 +26507,6 @@ var Underline = Mark.create({
26624
26507
  };
26625
26508
  }
26626
26509
  });
26627
- var src_default$5 = Underline;
26628
26510
  //#endregion
26629
26511
  //#region ../../../node_modules/.bun/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
26630
26512
  /**
@@ -27900,7 +27782,12 @@ function createPlaceholderPlugin({ editor, options }) {
27900
27782
  } }
27901
27783
  });
27902
27784
  }
27903
- Extension.create({
27785
+ /**
27786
+ * This extension allows you to add a placeholder to your editor.
27787
+ * A placeholder is a text that appears when the editor or a node is empty.
27788
+ * @see https://www.tiptap.dev/api/extensions/placeholder
27789
+ */
27790
+ var Placeholder = Extension.create({
27904
27791
  name: "placeholder",
27905
27792
  addOptions() {
27906
27793
  return {
@@ -31348,26 +31235,31 @@ Extension.create({
31348
31235
  });
31349
31236
  //#endregion
31350
31237
  //#region ../../lib-svelte/editable-html-tiptap-svelte/dist/index2.js
31351
- var root$1 = /* @__PURE__ */ from_html(`<button type="button" class="pie-toolbar-btn" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Insert Table"></button>`);
31352
- var root_1 = /* @__PURE__ */ from_html(`<button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Add Row"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Delete Row"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Add Column"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Delete Column"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Delete Table"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Toggle Table Border"></button>`, 1);
31353
- var root_2 = /* @__PURE__ */ from_html(`<div class="align-menu"><button type="button" class="align-menu-btn" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Align Left"></button> <button type="button" class="align-menu-btn" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Align Center"></button> <button type="button" class="align-menu-btn" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Align Right"></button></div>`);
31354
- var root_3 = /* @__PURE__ */ from_html(`<button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Bold"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Italic"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Strikethrough"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Code"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Underline"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Subscript"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Superscript"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Heading"></button> <button type="button" class="pie-toolbar-btn" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Insert Image"></button> <div class="align-dropdown"><button type="button" class="pie-toolbar-btn" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Text Alignment"><!> <span class="dropdown-arrow">▼</span></button> <!></div> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Bullet List"></button> <button type="button" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Numbered List"></button> <button type="button" class="pie-toolbar-btn" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Undo"></button> <button type="button" class="pie-toolbar-btn" style="border: none; background: none; padding: 2px; color: grey; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Redo"></button>`, 1);
31355
- var root_4 = /* @__PURE__ */ from_html(`<div role="toolbar" tabindex="-1"><div class="toolbar-content"><div class="toolbar-buttons"><!> <!> <!></div> <button type="button" class="done-btn" style="border: none; background: none; padding: 2px; color: #00bb00; display: inline-flex; cursor: pointer; align-items: center; justify-content: center;" title="Done"></button></div></div>`);
31356
- var root_5 = /* @__PURE__ */ from_html(`<div class="editor-container editable-html" style="position: relative; padding: 0; border: 1px solid #ccc; border-radius: 4px; cursor: text; background-color: var(--pie-background, white); width: 100%;"><div style="position: relative; padding: 0; overflow-y: auto; color: var(--pie-text, rgba(0, 0, 0, 0.87)); background-color: var(--pie-background, white); min-height: 120px;"><div class="editor-children" style="padding: 10px 16px;"><div class="editor" style="padding: 5px; min-height: 100px;"></div></div></div> <!></div>`);
31238
+ var root$1 = /* @__PURE__ */ from_html(`<button type="button" class="pie-toolbar-btn" title="Insert Table"></button>`);
31239
+ var root_1 = /* @__PURE__ */ from_html(`<button type="button" title="Add Row"></button> <button type="button" title="Delete Row"></button> <button type="button" title="Add Column"></button> <button type="button" title="Delete Column"></button> <button type="button" title="Delete Table"></button> <button type="button" title="Toggle Table Border"></button>`, 1);
31240
+ var root_2 = /* @__PURE__ */ from_html(`<div class="align-menu"><button type="button" class="align-menu-btn" title="Align Left"></button> <button type="button" class="align-menu-btn" title="Align Center"></button> <button type="button" class="align-menu-btn" title="Align Right"></button></div>`);
31241
+ var root_3 = /* @__PURE__ */ from_html(`<button type="button" title="Bold"></button> <button type="button" title="Italic"></button> <button type="button" title="Strikethrough"></button> <button type="button" title="Code"></button> <button type="button" title="Underline"></button> <button type="button" title="Subscript"></button> <button type="button" title="Superscript"></button> <button type="button" title="Heading"></button> <button type="button" class="pie-toolbar-btn" title="Insert Image"></button> <div class="align-dropdown"><button type="button" class="pie-toolbar-btn" title="Text Alignment"><!> <span class="dropdown-arrow">▼</span></button> <!></div> <button type="button" title="Bullet List"></button> <button type="button" title="Numbered List"></button> <button type="button" class="pie-toolbar-btn" title="Undo"></button> <button type="button" class="pie-toolbar-btn" title="Redo"></button>`, 1);
31242
+ var root_4 = /* @__PURE__ */ from_html(`<div role="toolbar" tabindex="-1"><div class="toolbar-content"><div class="toolbar-buttons"><!> <!> <!></div> <button type="button" class="done-btn" title="Done"></button></div></div>`);
31243
+ var root_5 = /* @__PURE__ */ from_html(`<div class="pie-editable-html editor-container editable-html svelte-rx7so6"><div><div class="editor-children"><div class="editor"></div></div></div> <!></div>`);
31357
31244
  var $$css$1 = {
31358
31245
  hash: "svelte-rx7so6",
31359
- code: ".editor-container {position:relative;padding:0px;border:1px solid #ccc;border-radius:4px;cursor:text;background-color:var(--pie-background, white);width:100%;}.editor-holder {position:relative;padding:0px;overflow-y:auto;color:var(--pie-text, rgba(0, 0, 0, 0.87));background-color:var(--pie-background, white);min-height:120px;}.editor-holder.disabled {background-color:var(--pie-background-dark, #f5f5f5);cursor:not-allowed;}.editor-children {padding:10px 16px;}.editor {padding:5px;min-height:100px;}\n\n /* Toolbar styles matching React version EXACTLY */.toolbar {position:absolute;z-index:20;cursor:pointer;justify-content:space-between;background:var(--editable-html-toolbar-bg, #efefef);min-width:280px;margin:5px 0 0 0;padding:2px;box-shadow:0px 1px 5px 0px rgba(0, 0, 0, 0.2),\n 0px 2px 2px 0px rgba(0, 0, 0, 0.14),\n 0px 3px 1px -2px rgba(0, 0, 0, 0.12);box-sizing:border-box;display:flex;opacity:0;pointer-events:none;top:100%;left:0;}.toolbar.focused {opacity:1;pointer-events:auto;}.toolbar-content {display:flex;width:100%;justify-content:space-between;}.toolbar-buttons {align-items:center;display:flex;width:100%;}.toolbar button.pie-toolbar-btn {\n /* Reset all browser defaults */appearance:none;-webkit-appearance:none;-moz-appearance:none;\n\n /* Core button styling - matching React MenuBar exactly */color:grey !important;display:inline-flex !important;padding:2px !important;background:none !important;border:0 !important;border-width:0 !important;border-style:none !important;outline:none !important;box-shadow:none !important;cursor:pointer !important;align-items:center !important;justify-content:center !important;min-width:auto !important;width:auto !important;height:auto !important;margin:0 !important;font:inherit !important;text-align:inherit !important;text-transform:none !important;}.pie-toolbar-btn:hover:not(:disabled) {color:black;}.pie-toolbar-btn:focus {outline:2px solid #666;}.pie-toolbar-btn:disabled {opacity:0.7;cursor:not-allowed;}.pie-toolbar-btn:disabled:hover {color:grey;}.pie-toolbar-btn.active {background:var(--pie-primary, #9c27b0);color:var(--pie-white, #ffffff);}.pie-toolbar-btn svg {width:24px;height:24px;}\n\n /* Done Button - matching React DoneButton component */.done-btn {vertical-align:top;width:28px;height:28px;color:var(--editable-html-toolbar-check, #00bb00);padding:4px;display:inline-flex;align-items:center;justify-content:center;background:none;border:none;cursor:pointer;}.done-btn:hover {background-color:rgba(0, 187, 0, 0.08);border-radius:4px;}.done-btn svg {width:24px;height:24px;}\n\n /* Text alignment dropdown */.align-dropdown {position:relative;}.dropdown-arrow {margin-left:2px;font-size:8px;}.align-menu {position:absolute;top:100%;left:0;background:var(--pie-white, #fff);display:flex;flex-direction:row;padding:2px;box-shadow:0px 1px 5px 0px rgba(0, 0, 0, 0.2),\n 0px 2px 2px 0px rgba(0, 0, 0, 0.14),\n 0px 3px 1px -2px rgba(0, 0, 0, 0.12);z-index:30;}.align-menu-btn {color:var(--pie-disabled, grey);display:inline-flex;padding:4px;background:none;border:none;cursor:pointer;align-items:center;justify-content:center;min-width:32px;min-height:32px;}.align-menu-btn:hover {color:var(--pie-black, black);background-color:rgba(0, 0, 0, 0.04);}\n\n /* ProseMirror editor styles */.ProseMirror {outline:none !important;min-height:100px;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;font-size:14px;line-height:1.6;color:var(--pie-text, rgba(0, 0, 0, 0.87));}.ProseMirror p {margin:0;}.ProseMirror ul,\n .ProseMirror ol {padding:0 1rem;margin:1.25rem 1rem 1.25rem 0.4rem;}.ProseMirror ul li p,\n .ProseMirror ol li p {margin-top:0.25em;margin-bottom:0.25em;}.ProseMirror h1,\n .ProseMirror h2,\n .ProseMirror h3,\n .ProseMirror h4,\n .ProseMirror h5,\n .ProseMirror h6 {line-height:1.1;margin-top:2.5rem;text-wrap:pretty;}.ProseMirror h1,\n .ProseMirror h2 {margin-top:3.5rem;margin-bottom:1.5rem;}.ProseMirror h1 {font-size:1.4rem;}.ProseMirror h2 {font-size:1.2rem;}.ProseMirror h3 {font-size:1.1rem;}.ProseMirror h4,\n .ProseMirror h5,\n .ProseMirror h6 {font-size:1rem;}.ProseMirror code {background-color:rgba(88, 5, 255, 0.05);border-radius:0.4rem;color:#2e2b29;font-size:0.85rem;padding:0.25em 0.3em;}.ProseMirror pre {background:#2e2b29;border-radius:0.5rem;color:#fff;font-family:'JetBrainsMono', monospace;margin:1.5rem 0;padding:0.75rem 1rem;}.ProseMirror pre code {background:none;color:inherit;font-size:0.8rem;padding:0;}.ProseMirror blockquote {border-left:3px solid rgba(61, 37, 20, 0.12);margin:1.5rem 0;padding-left:1rem;}.ProseMirror hr {border:none;border-top:1px solid rgba(61, 37, 20, 0.08);margin:2rem 0;}.ProseMirror img {max-width:100%;height:auto;}\n\n /* Table styles */.ProseMirror table {table-layout:fixed;width:100%;border-collapse:collapse;color:var(--pie-text, rgba(0, 0, 0, 0.87));background-color:var(--pie-background, white);margin:1rem 0;}.ProseMirror table:not([border=\"1\"]) tr {border-top:1px solid #dfe2e5;}.ProseMirror td,\n .ProseMirror th {padding:0.6em 1em;text-align:center;vertical-align:top;position:relative;}.ProseMirror table:not([border=\"1\"]) td,\n .ProseMirror table:not([border=\"1\"]) th {border:1px solid #dfe2e5;}.ProseMirror table[border=\"1\"] {border:2px solid var(--pie-black, #000);}.ProseMirror table[border=\"1\"] td,\n .ProseMirror table[border=\"1\"] th {border:1px solid var(--pie-black, #000);}.ProseMirror .selectedCell {background-color:rgba(200, 200, 255, 0.4);}\n\n /* Placeholder */.ProseMirror p.is-editor-empty:first-child::before {content:attr(data-placeholder);float:left;color:#adb5bd;pointer-events:none;height:0;}.ProseMirror:focus {outline:none;}"
31246
+ code: ".pie-editable-html.svelte-rx7so6 {position:relative;padding:0px;border:1px solid #ccc;border-radius:4px;cursor:text;background-color:var(--pie-background, rgba(255, 255, 255, 0));width:100%;}.pie-editable-html.svelte-rx7so6 .editor-holder {position:relative;padding:0px;overflow-y:auto;color:var(--pie-text, black);background-color:var(--pie-background, rgba(255, 255, 255, 0));min-height:120px;}.pie-editable-html.svelte-rx7so6 .editor-holder.disabled {cursor:not-allowed;}.pie-editable-html.svelte-rx7so6 .editor-children {padding:10px 16px;}.pie-editable-html.svelte-rx7so6 .editor {padding:5px;min-height:100px;}\n\n /* Toolbar styles matching React version EXACTLY */.pie-editable-html.svelte-rx7so6 .toolbar {position:absolute;z-index:20;cursor:pointer;justify-content:space-between;background:var(--editable-html-toolbar-bg, #efefef);min-width:280px;margin:5px 0 0 0;padding:2px;box-shadow:0px 1px 5px 0px rgba(0, 0, 0, 0.2),\n 0px 2px 2px 0px rgba(0, 0, 0, 0.14),\n 0px 3px 1px -2px rgba(0, 0, 0, 0.12);box-sizing:border-box;display:flex;opacity:0;pointer-events:none;top:100%;left:0;}.pie-editable-html.svelte-rx7so6 .toolbar.focused {opacity:1;pointer-events:auto;}.pie-editable-html.svelte-rx7so6 .toolbar-content {display:flex;width:100%;justify-content:space-between;}.pie-editable-html.svelte-rx7so6 .toolbar-buttons {align-items:center;display:flex;width:100%;}.pie-editable-html.svelte-rx7so6 .toolbar button.pie-toolbar-btn {\n /* Reset all browser defaults */appearance:none;-webkit-appearance:none;-moz-appearance:none;\n\n /* Core button styling - matching React MenuBar exactly */color:grey !important;display:inline-flex !important;padding:2px !important;background:none !important;border:0 !important;border-width:0 !important;border-style:none !important;outline:none !important;box-shadow:none !important;cursor:pointer !important;align-items:center !important;justify-content:center !important;min-width:auto !important;width:auto !important;height:auto !important;margin:0 !important;font:inherit !important;text-align:inherit !important;text-transform:none !important;}.pie-editable-html.svelte-rx7so6 .pie-toolbar-btn:hover:not(:disabled) {color:black;}.pie-editable-html.svelte-rx7so6 .pie-toolbar-btn:focus {outline:2px solid #666;}.pie-editable-html.svelte-rx7so6 .pie-toolbar-btn:disabled {opacity:0.7;cursor:not-allowed;}.pie-editable-html.svelte-rx7so6 .pie-toolbar-btn:disabled:hover {color:grey;}.pie-editable-html.svelte-rx7so6 .pie-toolbar-btn.active {background:var(--pie-primary, #3f51b5);color:var(--pie-white, #ffffff);}.pie-editable-html.svelte-rx7so6 .pie-toolbar-btn svg {width:24px;height:24px;}\n\n /* Done Button - matching React DoneButton component */.pie-editable-html.svelte-rx7so6 .done-btn {vertical-align:top;width:28px;height:28px;color:var(--editable-html-toolbar-check, #00bb00);padding:4px;display:inline-flex;align-items:center;justify-content:center;background:none;border:none;cursor:pointer;}.pie-editable-html.svelte-rx7so6 .done-btn:hover {background-color:rgba(0, 187, 0, 0.08);border-radius:4px;}.pie-editable-html.svelte-rx7so6 .done-btn svg {width:24px;height:24px;}\n\n /* Text alignment dropdown */.pie-editable-html.svelte-rx7so6 .align-dropdown {position:relative;}.pie-editable-html.svelte-rx7so6 .dropdown-arrow {margin-left:2px;font-size:8px;}.pie-editable-html.svelte-rx7so6 .align-menu {position:absolute;top:100%;left:0;background:var(--pie-white, #ffffff);display:flex;flex-direction:row;padding:2px;box-shadow:0px 1px 5px 0px rgba(0, 0, 0, 0.2),\n 0px 2px 2px 0px rgba(0, 0, 0, 0.14),\n 0px 3px 1px -2px rgba(0, 0, 0, 0.12);z-index:30;}.pie-editable-html.svelte-rx7so6 .align-menu-btn {color:var(--pie-disabled, grey);display:inline-flex;padding:4px;background:none;border:none;cursor:pointer;align-items:center;justify-content:center;min-width:32px;min-height:32px;}.pie-editable-html.svelte-rx7so6 .align-menu-btn:hover {color:var(--pie-black, #000000);background-color:rgba(0, 0, 0, 0.04);}\n\n /* ProseMirror editor styles */.pie-editable-html.svelte-rx7so6 .ProseMirror {outline:none !important;min-height:100px;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;font-size:14px;line-height:1.6;color:var(--pie-text, black);}.pie-editable-html.svelte-rx7so6 .ProseMirror p {margin:0;}.pie-editable-html.svelte-rx7so6 .ProseMirror ul,\n .pie-editable-html.svelte-rx7so6 .ProseMirror ol {padding:0 1rem;margin:1.25rem 1rem 1.25rem 0.4rem;}.pie-editable-html.svelte-rx7so6 .ProseMirror ul li p,\n .pie-editable-html.svelte-rx7so6 .ProseMirror ol li p {margin-top:0.25em;margin-bottom:0.25em;}.pie-editable-html.svelte-rx7so6 .ProseMirror h1,\n .pie-editable-html.svelte-rx7so6 .ProseMirror h2,\n .pie-editable-html.svelte-rx7so6 .ProseMirror h3,\n .pie-editable-html.svelte-rx7so6 .ProseMirror h4,\n .pie-editable-html.svelte-rx7so6 .ProseMirror h5,\n .pie-editable-html.svelte-rx7so6 .ProseMirror h6 {line-height:1.1;margin-top:2.5rem;text-wrap:pretty;}.pie-editable-html.svelte-rx7so6 .ProseMirror h1,\n .pie-editable-html.svelte-rx7so6 .ProseMirror h2 {margin-top:3.5rem;margin-bottom:1.5rem;}.pie-editable-html.svelte-rx7so6 .ProseMirror h1 {font-size:1.4rem;}.pie-editable-html.svelte-rx7so6 .ProseMirror h2 {font-size:1.2rem;}.pie-editable-html.svelte-rx7so6 .ProseMirror h3 {font-size:1.1rem;}.pie-editable-html.svelte-rx7so6 .ProseMirror h4,\n .pie-editable-html.svelte-rx7so6 .ProseMirror h5,\n .pie-editable-html.svelte-rx7so6 .ProseMirror h6 {font-size:1rem;}.pie-editable-html.svelte-rx7so6 .ProseMirror code {background-color:rgba(88, 5, 255, 0.05);border-radius:0.4rem;color:#2e2b29;font-size:0.85rem;padding:0.25em 0.3em;}.pie-editable-html.svelte-rx7so6 .ProseMirror pre {background:#2e2b29;border-radius:0.5rem;color:#fff;font-family:'JetBrainsMono', monospace;margin:1.5rem 0;padding:0.75rem 1rem;}.pie-editable-html.svelte-rx7so6 .ProseMirror pre code {background:none;color:inherit;font-size:0.8rem;padding:0;}.pie-editable-html.svelte-rx7so6 .ProseMirror blockquote {border-left:3px solid rgba(61, 37, 20, 0.12);margin:1.5rem 0;padding-left:1rem;}.pie-editable-html.svelte-rx7so6 .ProseMirror hr {border:none;border-top:1px solid rgba(61, 37, 20, 0.08);margin:2rem 0;}.pie-editable-html.svelte-rx7so6 .ProseMirror img {max-width:100%;height:auto;}\n\n /* Table styles */.pie-editable-html.svelte-rx7so6 .ProseMirror table {table-layout:fixed;width:100%;border-collapse:collapse;color:var(--pie-text, black);background-color:var(--pie-background, rgba(255, 255, 255, 0));margin:1rem 0;}.pie-editable-html.svelte-rx7so6 .ProseMirror table:not([border=\"1\"]) tr {border-top:1px solid #dfe2e5;}.pie-editable-html.svelte-rx7so6 .ProseMirror td,\n .pie-editable-html.svelte-rx7so6 .ProseMirror th {padding:0.6em 1em;text-align:center;vertical-align:top;position:relative;}.pie-editable-html.svelte-rx7so6 .ProseMirror table:not([border=\"1\"]) td,\n .pie-editable-html.svelte-rx7so6 .ProseMirror table:not([border=\"1\"]) th {border:1px solid #dfe2e5;}.pie-editable-html.svelte-rx7so6 .ProseMirror table[border=\"1\"] {border:2px solid var(--pie-black, #000000);}.pie-editable-html.svelte-rx7so6 .ProseMirror table[border=\"1\"] td,\n .pie-editable-html.svelte-rx7so6 .ProseMirror table[border=\"1\"] th {border:1px solid var(--pie-black, #000000);}.pie-editable-html.svelte-rx7so6 .ProseMirror .selectedCell {background-color:rgba(200, 200, 255, 0.4);}\n\n /* Placeholder */.pie-editable-html.svelte-rx7so6 .ProseMirror p.is-editor-empty:first-child::before {content:attr(data-placeholder);float:left;color:#adb5bd;pointer-events:none;height:0;}.pie-editable-html.svelte-rx7so6 .ProseMirror:focus {outline:none;}"
31360
31247
  };
31361
- function EditableHtml($$anchor, $$props) {
31248
+ function EditableHtml$1($$anchor, $$props) {
31362
31249
  push($$props, true);
31363
- append_styles$1($$anchor, $$css$1);
31364
- let markup = prop($$props, "markup", 3, "");
31365
- prop($$props, "placeholder", 3, "Enter text here...");
31366
- let showToolbar = prop($$props, "showToolbar", 3, true), disabled = prop($$props, "disabled", 3, false);
31250
+ append_styles($$anchor, $$css$1);
31251
+ let markup = prop($$props, "markup", 3, ""), placeholder = prop($$props, "placeholder", 3, "Enter text here..."), showToolbar = prop($$props, "showToolbar", 3, true), disabled = prop($$props, "disabled", 3, false);
31367
31252
  let editorElement;
31368
31253
  let editor = /* @__PURE__ */ state(null);
31369
- let isFocused = /* @__PURE__ */ state(false);
31254
+ let hasFocus = /* @__PURE__ */ state(false);
31370
31255
  let showAlignMenu = /* @__PURE__ */ state(false);
31256
+ function editorAttributes() {
31257
+ return {
31258
+ role: "textbox",
31259
+ "aria-multiline": "true",
31260
+ ...$$props.ariaLabel ? { "aria-label": $$props.ariaLabel } : {}
31261
+ };
31262
+ }
31371
31263
  let editorState = /* @__PURE__ */ state(proxy({
31372
31264
  isBold: false,
31373
31265
  canBold: false,
@@ -31419,17 +31311,23 @@ function EditableHtml($$anchor, $$props) {
31419
31311
  set(editor, new Editor({
31420
31312
  element: editorElement,
31421
31313
  extensions: [
31422
- src_default$4.configure({ heading: { levels: [
31423
- 1,
31424
- 2,
31425
- 3,
31426
- 4,
31427
- 5,
31428
- 6
31429
- ] } }),
31314
+ src_default$4.configure({
31315
+ heading: { levels: [
31316
+ 1,
31317
+ 2,
31318
+ 3,
31319
+ 4,
31320
+ 5,
31321
+ 6
31322
+ ] },
31323
+ link: {
31324
+ autolink: false,
31325
+ linkOnPaste: false,
31326
+ shouldAutoLink: () => false
31327
+ }
31328
+ }),
31430
31329
  TextStyle,
31431
31330
  CharacterCount.configure({ limit: 1e6 }),
31432
- src_default$5,
31433
31331
  src_default$2,
31434
31332
  src_default$3,
31435
31333
  src_default$1.configure({
@@ -31447,11 +31345,13 @@ function EditableHtml($$anchor, $$props) {
31447
31345
  }),
31448
31346
  TableRow,
31449
31347
  TableHeader,
31450
- TableCell
31348
+ TableCell,
31349
+ Placeholder.configure({ placeholder: () => placeholder() })
31451
31350
  ],
31452
31351
  content: markup() || "",
31453
31352
  editable: !disabled(),
31454
31353
  autofocus: false,
31354
+ editorProps: { attributes: editorAttributes() },
31455
31355
  onUpdate: ({ editor }) => {
31456
31356
  const html = editor.getHTML();
31457
31357
  if ($$props.onChange) $$props.onChange(html);
@@ -31461,12 +31361,7 @@ function EditableHtml($$anchor, $$props) {
31461
31361
  updateEditorState();
31462
31362
  },
31463
31363
  onFocus: () => {
31464
- set(isFocused, true);
31465
31364
  updateEditorState();
31466
- },
31467
- onBlur: () => {
31468
- set(isFocused, false);
31469
- set(showAlignMenu, false);
31470
31365
  }
31471
31366
  }), true);
31472
31367
  updateEditorState();
@@ -31475,11 +31370,25 @@ function EditableHtml($$anchor, $$props) {
31475
31370
  if (get(editor)) get(editor).destroy();
31476
31371
  });
31477
31372
  user_effect(() => {
31478
- if (get(editor) && markup() !== get(editor).getHTML()) get(editor).commands.setContent(markup() || "", false);
31373
+ if (get(editor) && markup() !== get(editor).getHTML()) get(editor).commands.setContent(markup() || "", { emitUpdate: false });
31479
31374
  });
31480
31375
  user_effect(() => {
31481
- if (get(editor)) get(editor).setEditable(!disabled());
31376
+ const editable = !disabled();
31377
+ if (get(editor) && get(editor).isEditable !== editable) get(editor).setEditable(editable, false);
31482
31378
  });
31379
+ user_effect(() => {
31380
+ const attributes = editorAttributes();
31381
+ if (get(editor) && get(editor).view.dom.getAttribute("aria-label") !== (attributes["aria-label"] ?? null)) get(editor).setOptions({ editorProps: { attributes } });
31382
+ });
31383
+ function handleFocusIn() {
31384
+ set(hasFocus, true);
31385
+ }
31386
+ function handleFocusOut(e) {
31387
+ if (!e.currentTarget.contains(e.relatedTarget)) {
31388
+ set(hasFocus, false);
31389
+ set(showAlignMenu, false);
31390
+ }
31391
+ }
31483
31392
  function toggleBold() {
31484
31393
  get(editor)?.chain().focus().toggleBold().run();
31485
31394
  }
@@ -31561,7 +31470,7 @@ function EditableHtml($$anchor, $$props) {
31561
31470
  function handleDoneClick() {
31562
31471
  if (get(editor)) {
31563
31472
  const html = get(editor).getHTML();
31564
- if ($$props.onChange) $$props.onChange(html);
31473
+ if (html !== markup()) $$props.onChange?.(html);
31565
31474
  get(editor).commands.blur();
31566
31475
  }
31567
31476
  }
@@ -31785,8 +31694,8 @@ function EditableHtml($$anchor, $$props) {
31785
31694
  reset$1(div_5);
31786
31695
  reset$1(div_4);
31787
31696
  template_effect(() => {
31788
- classes_1 = set_class(div_4, 1, "toolbar", null, classes_1, { focused: get(isFocused) });
31789
- set_style(div_4, `position: absolute; z-index: 20; cursor: pointer; justify-content: space-between; background: var(--editable-html-toolbar-bg, #efefef); min-width: 280px; margin: 5px 0 0 0; padding: 2px; box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 3px 1px -2px rgba(0, 0, 0, 0.12); box-sizing: border-box; display: flex; top: 100%; left: 0; opacity: ${get(isFocused) ? 1 : 0}; pointer-events: ${get(isFocused) ? "auto" : "none"};`);
31697
+ classes_1 = set_class(div_4, 1, "toolbar", null, classes_1, { focused: get(hasFocus) });
31698
+ div_4.inert = !get(hasFocus);
31790
31699
  });
31791
31700
  delegated("mousedown", div_4, handleMouseDown);
31792
31701
  delegated("click", button_24, handleDoneClick);
@@ -31797,48 +31706,53 @@ function EditableHtml($$anchor, $$props) {
31797
31706
  });
31798
31707
  reset$1(div);
31799
31708
  template_effect(() => classes = set_class(div_1, 1, "editor-holder", null, classes, { disabled: disabled() }));
31709
+ delegated("focusin", div, handleFocusIn);
31710
+ delegated("focusout", div, handleFocusOut);
31800
31711
  append($$anchor, div);
31801
31712
  pop();
31802
31713
  }
31803
- delegate(["mousedown", "click"]);
31714
+ delegate([
31715
+ "focusin",
31716
+ "focusout",
31717
+ "mousedown",
31718
+ "click"
31719
+ ]);
31720
+ //#endregion
31721
+ //#region ../../lib-svelte/editable-html-tiptap-svelte/dist/index.js
31722
+ var EditableHtml = EditableHtml$1;
31804
31723
  //#endregion
31805
31724
  //#region src/author/Author.svelte
31806
- var root = /* @__PURE__ */ from_html(`<div class="simple-cloze-author svelte-13ppn6m"><div class="input-container svelte-13ppn6m"><span class="input-label svelte-13ppn6m">Prompt</span> <!></div> <div class="mb-6"><label for="simple-cloze-correct-answer" class="block text-sm text-gray-600 mb-2">Correct Answer</label> <input id="simple-cloze-correct-answer" type="text" class="input input-bordered w-full" placeholder="Enter the correct answer"/></div></div>`);
31725
+ var root = /* @__PURE__ */ from_html(`<div class="simple-cloze-author svelte-13ppn6m"><div class="input-container svelte-13ppn6m"><span class="input-label svelte-13ppn6m">Prompt</span> <!></div> <div class="mb-6"><label class="block text-sm text-gray-600 mb-2">Correct Answer</label> <input type="text" class="input input-bordered w-full" placeholder="Enter the correct answer"/></div></div>`);
31807
31726
  var $$css = {
31808
31727
  hash: "svelte-13ppn6m",
31809
31728
  code: ".simple-cloze-author.svelte-13ppn6m {max-width:56rem;margin:0 auto;padding:24px;}.input-container.svelte-13ppn6m {position:relative;padding-top:16px;margin-bottom:24px;width:100%;}.input-label.svelte-13ppn6m {position:absolute;top:0;left:0;transform-origin:top left;transform:scale(0.75) translate(0, -0.75em);color:var(--pie-text, rgba(0, 0, 0, 0.6));pointer-events:none;}.simple-cloze-author .editor-container {border-color:var(--pie-border-light, #ccc);border-radius:4px;}.simple-cloze-author .editor-holder {min-height:140px;}"
31810
31729
  };
31811
31730
  function Author($$anchor, $$props) {
31812
31731
  push($$props, true);
31813
- append_styles$1($$anchor, $$css);
31814
- const dispatch = createEventDispatcher();
31815
- let model = prop($$props, "model", 15), onChange = prop($$props, "onChange", 7);
31816
- function emitModelUpdate(nextModel) {
31817
- dispatch("model.updated", {
31818
- update: nextModel,
31819
- reset: false
31820
- });
31732
+ append_styles($$anchor, $$css);
31733
+ let model = prop($$props, "model", 15), onChange = prop($$props, "onChange", 7), onModelChange = prop($$props, "onModelChange", 7);
31734
+ const answerInputId = `simple-cloze-correct-answer-${Math.random().toString(36).slice(2, 10)}`;
31735
+ /**
31736
+ * The wrapper owns the model and announces the edit; `onChange` serves a
31737
+ * component mounted without one. The update spreads the whole model, so fields
31738
+ * this form does not edit survive.
31739
+ */
31740
+ function emitModelUpdate(patch) {
31741
+ const nextModel = {
31742
+ ...model() || {},
31743
+ ...patch
31744
+ };
31745
+ if (onModelChange()) onModelChange()(nextModel);
31746
+ else {
31747
+ model(nextModel);
31748
+ onChange()?.(nextModel);
31749
+ }
31821
31750
  }
31822
31751
  function handlePromptChange(html) {
31823
- if (onChange() && model()) onChange()({
31824
- ...model(),
31825
- prompt: html
31826
- });
31827
- if (model()) emitModelUpdate({
31828
- ...model(),
31829
- prompt: html
31830
- });
31752
+ emitModelUpdate({ prompt: html });
31831
31753
  }
31832
31754
  function handleAnswerChange(e) {
31833
- const target = e.target;
31834
- if (onChange() && model()) onChange()({
31835
- ...model(),
31836
- correctAnswer: target.value
31837
- });
31838
- if (model()) emitModelUpdate({
31839
- ...model(),
31840
- correctAnswer: target.value
31841
- });
31755
+ emitModelUpdate({ correctAnswer: e.target.value });
31842
31756
  }
31843
31757
  var $$exports = {
31844
31758
  get model() {
@@ -31854,6 +31768,13 @@ function Author($$anchor, $$props) {
31854
31768
  set onChange($$value) {
31855
31769
  onChange($$value);
31856
31770
  flushSync();
31771
+ },
31772
+ get onModelChange() {
31773
+ return onModelChange();
31774
+ },
31775
+ set onModelChange($$value) {
31776
+ onModelChange($$value);
31777
+ flushSync();
31857
31778
  }
31858
31779
  };
31859
31780
  var div = root();
@@ -31866,16 +31787,22 @@ function Author($$anchor, $$props) {
31866
31787
  return get($0);
31867
31788
  },
31868
31789
  onChange: handlePromptChange,
31869
- placeholder: "Enter your question here..."
31790
+ placeholder: "Enter your question here...",
31791
+ ariaLabel: "Prompt"
31870
31792
  });
31871
31793
  }
31872
31794
  reset$1(div_1);
31873
31795
  var div_2 = sibling(div_1, 2);
31874
- var input = sibling(child(div_2), 2);
31796
+ var label = child(div_2);
31797
+ var input = sibling(label, 2);
31875
31798
  remove_input_defaults(input);
31876
31799
  reset$1(div_2);
31877
31800
  reset$1(div);
31878
- template_effect(() => set_value(input, model()?.correctAnswer || ""));
31801
+ template_effect(() => {
31802
+ set_attribute(label, "for", answerInputId);
31803
+ set_attribute(input, "id", answerInputId);
31804
+ set_value(input, model()?.correctAnswer || "");
31805
+ });
31879
31806
  delegated("input", input, handleAnswerChange);
31880
31807
  append($$anchor, div);
31881
31808
  return pop($$exports);
@@ -31883,16 +31810,29 @@ function Author($$anchor, $$props) {
31883
31810
  delegate(["input"]);
31884
31811
  create_custom_element(Author, {
31885
31812
  model: { type: "Object" },
31813
+ onModelChange: {},
31886
31814
  onChange: {}
31887
31815
  }, [], []);
31888
31816
  //#endregion
31889
31817
  //#region src/author/index.ts
31890
31818
  var SvelteElementClass = Author.element;
31891
31819
  var SimpleClozeAuthor = class extends SvelteElementClass {
31892
- constructor(..._args) {
31893
- super(..._args);
31820
+ /**
31821
+ * The component reports each edit through its `onModelChange` prop, assigned
31822
+ * here through the accessor Svelte generates for it. The host keeps the
31823
+ * edited model, renders from it, and announces it as `model.updated`, which
31824
+ * bubbles to the listener an authoring player registers at its root.
31825
+ */
31826
+ constructor() {
31827
+ super();
31894
31828
  _defineProperty(this, "_model", null);
31895
31829
  _defineProperty(this, "_onChange", null);
31830
+ this.onModelChange = (update) => {
31831
+ this._model = update;
31832
+ super.model = update;
31833
+ this._onChange?.(update);
31834
+ this.dispatchEvent(new e(update, false));
31835
+ };
31896
31836
  }
31897
31837
  set model(m) {
31898
31838
  this._model = m;
@@ -31903,7 +31843,6 @@ var SimpleClozeAuthor = class extends SvelteElementClass {
31903
31843
  }
31904
31844
  set onChange(fn) {
31905
31845
  this._onChange = fn;
31906
- this.onChange = fn;
31907
31846
  }
31908
31847
  get onChange() {
31909
31848
  return this._onChange || (() => {});