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

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 +6 -0
  3. package/dist/author/index.js +194 -235
  4. package/dist/author/index.js.map +1 -1
  5. package/dist/browser/author/index.js +3497 -3436
  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 +129 -136
  12. package/dist/browser/delivery/index.js.map +1 -1
  13. package/dist/browser/dist-CYpSKy-4.js +80 -0
  14. package/dist/browser/dist-CYpSKy-4.js.map +1 -0
  15. package/dist/browser/i18n-DJMxdTMU.js +1612 -0
  16. package/dist/browser/i18n-DJMxdTMU.js.map +1 -0
  17. package/dist/browser/plain-text-iaQZhkGe.js +53 -0
  18. package/dist/browser/plain-text-iaQZhkGe.js.map +1 -0
  19. package/dist/browser/print/index.js +64 -21
  20. package/dist/browser/print/index.js.map +1 -1
  21. package/dist/controller/defaults.d.ts +1 -0
  22. package/dist/controller/index.d.ts +51 -8
  23. package/dist/controller/index.js +121 -29
  24. package/dist/controller/index.js.map +1 -1
  25. package/dist/controller/plain-text.d.ts +11 -0
  26. package/dist/delivery/index.d.ts +9 -4
  27. package/dist/delivery/index.js +2826 -267
  28. package/dist/delivery/index.js.map +1 -1
  29. package/dist/i18n.d.ts +7 -0
  30. package/dist/index.iife.js +9 -3
  31. package/dist/index.js +2826 -267
  32. package/dist/index.js.map +1 -1
  33. package/dist/print/index.d.ts +7 -0
  34. package/dist/print/index.js +2775 -28
  35. package/dist/print/index.js.map +1 -1
  36. package/module/print.js +2383 -600
  37. package/module/print.js.map +1 -1
  38. package/package.json +2 -1
  39. package/dist/browser/client-Dt8SOe5Z.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';
@@ -6,5 +6,11 @@ declare class SimpleClozeAuthor extends SvelteElementClass {
6
6
  get model(): any;
7
7
  set onChange(fn: (model: any) => void);
8
8
  get onChange(): (model: any) => void;
9
+ /**
10
+ * The component reports each edit here. The host keeps the edited model,
11
+ * renders from it, and announces it as `model.updated`, which bubbles to
12
+ * the listener an authoring player registers at its root.
13
+ */
14
+ onModelChange: (update: any) => void;
9
15
  }
10
16
  export default SimpleClozeAuthor;
@@ -1,3 +1,59 @@
1
+ //#region ../../shared/configure-events/dist/index.js
2
+ var _e$1;
3
+ var _e2$1;
4
+ var _e3;
5
+ var _e4;
6
+ var _e5;
7
+ var e = (_e$1 = 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$1.TYPE = "model.updated", _e$1);
18
+ _e2$1 = 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$1.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");
@@ -4912,6 +4795,54 @@ function create_custom_element(Component, props_definition, slots, exports, shad
4912
4795
  return Class;
4913
4796
  }
4914
4797
  //#endregion
4798
+ //#region ../../shared/player-events/dist/index.js
4799
+ var _e;
4800
+ var _e2;
4801
+ _e = class e extends CustomEvent {
4802
+ constructor(t, n, r) {
4803
+ super(e.TYPE, {
4804
+ bubbles: !0,
4805
+ composed: !0,
4806
+ detail: {
4807
+ complete: n,
4808
+ component: t,
4809
+ hasModel: r
4810
+ }
4811
+ }), this.component = t, this.complete = n;
4812
+ }
4813
+ }, _e.TYPE = "model-set";
4814
+ _e2 = class e extends CustomEvent {
4815
+ constructor(t, n) {
4816
+ super(e.TYPE, {
4817
+ bubbles: !0,
4818
+ composed: !0,
4819
+ detail: {
4820
+ complete: n,
4821
+ component: t
4822
+ }
4823
+ }), this.component = t, this.complete = n;
4824
+ }
4825
+ }, _e2.TYPE = "session-changed";
4826
+ //#endregion
4827
+ //#region ../../lib-svelte/delivery-events/dist/index2.js
4828
+ var t = (e) => {
4829
+ let t = e;
4830
+ return t ? typeof t.onSessionChange == "function" || typeof t.onAudioStarted == "function" || typeof t.onAudioEnded == "function" : !1;
4831
+ };
4832
+ function n(e) {
4833
+ if (e.parentElement) return e.parentElement;
4834
+ let t = e.getRootNode();
4835
+ return t instanceof ShadowRoot ? t.host : null;
4836
+ }
4837
+ function r(e, r = {}) {
4838
+ let i = r.hostPredicate ?? t, a = e;
4839
+ for (; a;) {
4840
+ if (i(a)) return a;
4841
+ a = n(a);
4842
+ }
4843
+ return null;
4844
+ }
4845
+ //#endregion
4915
4846
  //#region ../../../node_modules/.bun/@tiptap+core@3.31.3+ef29727eaaf819d3/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
4916
4847
  var __defProp = Object.defineProperty;
4917
4848
  var __exportAll = (all, no_symbols) => {
@@ -26624,7 +26555,6 @@ var Underline = Mark.create({
26624
26555
  };
26625
26556
  }
26626
26557
  });
26627
- var src_default$5 = Underline;
26628
26558
  //#endregion
26629
26559
  //#region ../../../node_modules/.bun/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
26630
26560
  /**
@@ -27900,7 +27830,12 @@ function createPlaceholderPlugin({ editor, options }) {
27900
27830
  } }
27901
27831
  });
27902
27832
  }
27903
- Extension.create({
27833
+ /**
27834
+ * This extension allows you to add a placeholder to your editor.
27835
+ * A placeholder is a text that appears when the editor or a node is empty.
27836
+ * @see https://www.tiptap.dev/api/extensions/placeholder
27837
+ */
27838
+ var Placeholder = Extension.create({
27904
27839
  name: "placeholder",
27905
27840
  addOptions() {
27906
27841
  return {
@@ -31348,22 +31283,20 @@ Extension.create({
31348
31283
  });
31349
31284
  //#endregion
31350
31285
  //#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>`);
31286
+ var root$1 = /* @__PURE__ */ from_html(`<button type="button" class="pie-toolbar-btn" title="Insert Table"></button>`);
31287
+ 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);
31288
+ 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>`);
31289
+ 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);
31290
+ 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>`);
31291
+ 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
31292
  var $$css$1 = {
31358
31293
  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;}"
31294
+ 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
31295
  };
31361
- function EditableHtml($$anchor, $$props) {
31296
+ function EditableHtml$1($$anchor, $$props) {
31362
31297
  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);
31298
+ append_styles($$anchor, $$css$1);
31299
+ 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
31300
  let editorElement;
31368
31301
  let editor = /* @__PURE__ */ state(null);
31369
31302
  let isFocused = /* @__PURE__ */ state(false);
@@ -31419,17 +31352,23 @@ function EditableHtml($$anchor, $$props) {
31419
31352
  set(editor, new Editor({
31420
31353
  element: editorElement,
31421
31354
  extensions: [
31422
- src_default$4.configure({ heading: { levels: [
31423
- 1,
31424
- 2,
31425
- 3,
31426
- 4,
31427
- 5,
31428
- 6
31429
- ] } }),
31355
+ src_default$4.configure({
31356
+ heading: { levels: [
31357
+ 1,
31358
+ 2,
31359
+ 3,
31360
+ 4,
31361
+ 5,
31362
+ 6
31363
+ ] },
31364
+ link: {
31365
+ autolink: false,
31366
+ linkOnPaste: false,
31367
+ shouldAutoLink: () => false
31368
+ }
31369
+ }),
31430
31370
  TextStyle,
31431
31371
  CharacterCount.configure({ limit: 1e6 }),
31432
- src_default$5,
31433
31372
  src_default$2,
31434
31373
  src_default$3,
31435
31374
  src_default$1.configure({
@@ -31447,7 +31386,8 @@ function EditableHtml($$anchor, $$props) {
31447
31386
  }),
31448
31387
  TableRow,
31449
31388
  TableHeader,
31450
- TableCell
31389
+ TableCell,
31390
+ Placeholder.configure({ placeholder: () => placeholder() })
31451
31391
  ],
31452
31392
  content: markup() || "",
31453
31393
  editable: !disabled(),
@@ -31475,10 +31415,11 @@ function EditableHtml($$anchor, $$props) {
31475
31415
  if (get(editor)) get(editor).destroy();
31476
31416
  });
31477
31417
  user_effect(() => {
31478
- if (get(editor) && markup() !== get(editor).getHTML()) get(editor).commands.setContent(markup() || "", false);
31418
+ if (get(editor) && markup() !== get(editor).getHTML()) get(editor).commands.setContent(markup() || "", { emitUpdate: false });
31479
31419
  });
31480
31420
  user_effect(() => {
31481
- if (get(editor)) get(editor).setEditable(!disabled());
31421
+ const editable = !disabled();
31422
+ if (get(editor) && get(editor).isEditable !== editable) get(editor).setEditable(editable, false);
31482
31423
  });
31483
31424
  function toggleBold() {
31484
31425
  get(editor)?.chain().focus().toggleBold().run();
@@ -31561,7 +31502,7 @@ function EditableHtml($$anchor, $$props) {
31561
31502
  function handleDoneClick() {
31562
31503
  if (get(editor)) {
31563
31504
  const html = get(editor).getHTML();
31564
- if ($$props.onChange) $$props.onChange(html);
31505
+ if (html !== markup()) $$props.onChange?.(html);
31565
31506
  get(editor).commands.blur();
31566
31507
  }
31567
31508
  }
@@ -31784,10 +31725,7 @@ function EditableHtml($$anchor, $$props) {
31784
31725
  reset$1(button_24);
31785
31726
  reset$1(div_5);
31786
31727
  reset$1(div_4);
31787
- 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"};`);
31790
- });
31728
+ template_effect(() => classes_1 = set_class(div_4, 1, "toolbar", null, classes_1, { focused: get(isFocused) }));
31791
31729
  delegated("mousedown", div_4, handleMouseDown);
31792
31730
  delegated("click", button_24, handleDoneClick);
31793
31731
  append($$anchor, div_4);
@@ -31802,43 +31740,44 @@ function EditableHtml($$anchor, $$props) {
31802
31740
  }
31803
31741
  delegate(["mousedown", "click"]);
31804
31742
  //#endregion
31743
+ //#region ../../lib-svelte/editable-html-tiptap-svelte/dist/index.js
31744
+ var EditableHtml = EditableHtml$1;
31745
+ //#endregion
31805
31746
  //#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>`);
31747
+ 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
31748
  var $$css = {
31808
31749
  hash: "svelte-13ppn6m",
31809
31750
  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
31751
  };
31811
31752
  function Author($$anchor, $$props) {
31812
31753
  push($$props, true);
31813
- append_styles$1($$anchor, $$css);
31814
- const dispatch = createEventDispatcher();
31754
+ append_styles($$anchor, $$css);
31815
31755
  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
- });
31756
+ let rootEl = /* @__PURE__ */ state(null);
31757
+ const answerInputId = `simple-cloze-correct-answer-${Math.random().toString(36).slice(2, 10)}`;
31758
+ const isAuthorHost = (node) => typeof node?.onModelChange === "function";
31759
+ /**
31760
+ * The wrapper owns the model and announces the edit; `onChange` serves a
31761
+ * component mounted without one. The update spreads the whole model, so fields
31762
+ * this form does not edit survive.
31763
+ */
31764
+ function emitModelUpdate(patch) {
31765
+ const nextModel = {
31766
+ ...model() || {},
31767
+ ...patch
31768
+ };
31769
+ const host = r(get(rootEl), { hostPredicate: isAuthorHost });
31770
+ if (host) host.onModelChange(nextModel);
31771
+ else {
31772
+ model(nextModel);
31773
+ onChange()?.(nextModel);
31774
+ }
31821
31775
  }
31822
31776
  function handlePromptChange(html) {
31823
- if (onChange() && model()) onChange()({
31824
- ...model(),
31825
- prompt: html
31826
- });
31827
- if (model()) emitModelUpdate({
31828
- ...model(),
31829
- prompt: html
31830
- });
31777
+ emitModelUpdate({ prompt: html });
31831
31778
  }
31832
31779
  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
- });
31780
+ emitModelUpdate({ correctAnswer: e.target.value });
31842
31781
  }
31843
31782
  var $$exports = {
31844
31783
  get model() {
@@ -31858,10 +31797,10 @@ function Author($$anchor, $$props) {
31858
31797
  };
31859
31798
  var div = root();
31860
31799
  var div_1 = child(div);
31861
- var node = sibling(child(div_1), 2);
31800
+ var node_1 = sibling(child(div_1), 2);
31862
31801
  {
31863
31802
  let $0 = /* @__PURE__ */ user_derived(() => model()?.prompt || "");
31864
- EditableHtml(node, {
31803
+ EditableHtml(node_1, {
31865
31804
  get markup() {
31866
31805
  return get($0);
31867
31806
  },
@@ -31871,11 +31810,17 @@ function Author($$anchor, $$props) {
31871
31810
  }
31872
31811
  reset$1(div_1);
31873
31812
  var div_2 = sibling(div_1, 2);
31874
- var input = sibling(child(div_2), 2);
31813
+ var label = child(div_2);
31814
+ var input = sibling(label, 2);
31875
31815
  remove_input_defaults(input);
31876
31816
  reset$1(div_2);
31877
31817
  reset$1(div);
31878
- template_effect(() => set_value(input, model()?.correctAnswer || ""));
31818
+ bind_this(div, ($$value) => set(rootEl, $$value), () => get(rootEl));
31819
+ template_effect(() => {
31820
+ set_attribute(label, "for", answerInputId);
31821
+ set_attribute(input, "id", answerInputId);
31822
+ set_value(input, model()?.correctAnswer || "");
31823
+ });
31879
31824
  delegated("input", input, handleAnswerChange);
31880
31825
  append($$anchor, div);
31881
31826
  return pop($$exports);
@@ -31893,6 +31838,21 @@ var SimpleClozeAuthor = class extends SvelteElementClass {
31893
31838
  super(..._args);
31894
31839
  _defineProperty(this, "_model", null);
31895
31840
  _defineProperty(this, "_onChange", null);
31841
+ _defineProperty(
31842
+ this,
31843
+ /**
31844
+ * The component reports each edit here. The host keeps the edited model,
31845
+ * renders from it, and announces it as `model.updated`, which bubbles to
31846
+ * the listener an authoring player registers at its root.
31847
+ */
31848
+ "onModelChange",
31849
+ (update) => {
31850
+ this._model = update;
31851
+ super.model = update;
31852
+ this._onChange?.(update);
31853
+ this.dispatchEvent(new e(update, false));
31854
+ }
31855
+ );
31896
31856
  }
31897
31857
  set model(m) {
31898
31858
  this._model = m;
@@ -31903,7 +31863,6 @@ var SimpleClozeAuthor = class extends SvelteElementClass {
31903
31863
  }
31904
31864
  set onChange(fn) {
31905
31865
  this._onChange = fn;
31906
- this.onChange = fn;
31907
31866
  }
31908
31867
  get onChange() {
31909
31868
  return this._onChange || (() => {});