@pie-element/venn-classification 0.1.1-next.7 → 0.1.1-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.
@@ -2,15 +2,17 @@ declare const SvelteElementClass: any;
2
2
  declare class VennClassificationAuthor 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);
8
16
  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;
15
17
  }
16
18
  export default VennClassificationAuthor;
@@ -1,10 +1,10 @@
1
1
  //#region ../../shared/configure-events/dist/index.js
2
- var _e$1;
3
- var _e2$1;
2
+ var _e;
3
+ var _e2;
4
4
  var _e3;
5
5
  var _e4;
6
6
  var _e5;
7
- var e$3 = (_e$1 = class e extends CustomEvent {
7
+ var e$3 = (_e = class e extends CustomEvent {
8
8
  constructor(t, n = !1) {
9
9
  super(e.TYPE, {
10
10
  bubbles: !0,
@@ -14,8 +14,8 @@ var e$3 = (_e$1 = class e extends CustomEvent {
14
14
  }
15
15
  }), this.update = t, this.reset = n;
16
16
  }
17
- }, _e$1.TYPE = "model.updated", _e$1);
18
- _e2$1 = class e extends CustomEvent {
17
+ }, _e.TYPE = "model.updated", _e);
18
+ _e2 = class e extends CustomEvent {
19
19
  constructor(t, n) {
20
20
  super(e.TYPE, {
21
21
  bubbles: !0,
@@ -25,7 +25,7 @@ _e2$1 = class e extends CustomEvent {
25
25
  }
26
26
  }), this.src = t, this.done = n;
27
27
  }
28
- }, _e2$1.TYPE = "delete.image";
28
+ }, _e2.TYPE = "delete.image";
29
29
  _e3 = class e extends CustomEvent {
30
30
  constructor(t) {
31
31
  super(e.TYPE, {
@@ -5528,84 +5528,6 @@ function create_custom_element(Component, props_definition, slots, exports, shad
5528
5528
  return Class;
5529
5529
  }
5530
5530
  //#endregion
5531
- //#region ../../shared/player-events/dist/index.js
5532
- var _e;
5533
- var _e2;
5534
- _e = class e extends CustomEvent {
5535
- constructor(t, n, r) {
5536
- super(e.TYPE, {
5537
- bubbles: !0,
5538
- composed: !0,
5539
- detail: {
5540
- complete: n,
5541
- component: t,
5542
- hasModel: r
5543
- }
5544
- }), this.component = t, this.complete = n;
5545
- }
5546
- }, _e.TYPE = "model-set";
5547
- var c$2 = (_e2 = class e extends CustomEvent {
5548
- constructor(t, n) {
5549
- super(e.TYPE, {
5550
- bubbles: !0,
5551
- composed: !0,
5552
- detail: {
5553
- complete: n,
5554
- component: t
5555
- }
5556
- }), this.component = t, this.complete = n;
5557
- }
5558
- }, _e2.TYPE = "session-changed", _e2);
5559
- //#endregion
5560
- //#region ../../lib-svelte/delivery-events/dist/index2.js
5561
- var t$3 = (e) => {
5562
- let t = e;
5563
- return t ? typeof t.onSessionChange == "function" || typeof t.onAudioStarted == "function" || typeof t.onAudioEnded == "function" : !1;
5564
- };
5565
- function n$1(e) {
5566
- if (e.parentElement) return e.parentElement;
5567
- let t = e.getRootNode();
5568
- return t instanceof ShadowRoot ? t.host : null;
5569
- }
5570
- function r$2(e, r = {}) {
5571
- let i = r.hostPredicate ?? t$3, a = e;
5572
- for (; a;) {
5573
- if (i(a)) return a;
5574
- a = n$1(a);
5575
- }
5576
- return null;
5577
- }
5578
- function i$1(e) {
5579
- return !!e && typeof e == "object" && !Array.isArray(e);
5580
- }
5581
- function a$1(e, t) {
5582
- if (e === t) return e;
5583
- if (!i$1(e) || !i$1(t) || Object.isFrozen(e) || !Object.isExtensible(e)) return t;
5584
- try {
5585
- for (let n of Object.keys(e)) n in t || delete e[n];
5586
- Object.assign(e, t);
5587
- } catch {
5588
- return t;
5589
- }
5590
- return e;
5591
- }
5592
- var o$1 = {};
5593
- var s$1 = /* @__PURE__ */ new WeakSet();
5594
- function c$1(e) {
5595
- let t = e ?? o$1;
5596
- if (s$1.has(t)) return;
5597
- s$1.add(t);
5598
- let n = e ? `above <${e.tagName.toLowerCase()}>` : "for an update with no source element";
5599
- console.warn(`[session-bridge] no delivery host ${n}; the session change was not forwarded to the player`);
5600
- }
5601
- function l({ sourceEl: t, complete: n, session: i }) {
5602
- let o = r$2(t);
5603
- if (!o) return c$1(t), null;
5604
- if (typeof o.onSessionChange == "function") return o.onSessionChange(i), o;
5605
- let s = a$1(o.session, i);
5606
- return s !== o.session && (o.session = s), o.dispatchEvent(new c$2(o.tagName.toLowerCase(), n)), o;
5607
- }
5608
- //#endregion
5609
5531
  //#region ../../../node_modules/.bun/@tiptap+core@3.31.3+ef29727eaaf819d3/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
5610
5532
  var __defProp = Object.defineProperty;
5611
5533
  var __exportAll = (all, no_symbols) => {
@@ -32062,8 +31984,15 @@ function EditableHtml$1($$anchor, $$props) {
32062
31984
  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);
32063
31985
  let editorElement;
32064
31986
  let editor = /* @__PURE__ */ state(null);
32065
- let isFocused = /* @__PURE__ */ state(false);
31987
+ let hasFocus = /* @__PURE__ */ state(false);
32066
31988
  let showAlignMenu = /* @__PURE__ */ state(false);
31989
+ function editorAttributes() {
31990
+ return {
31991
+ role: "textbox",
31992
+ "aria-multiline": "true",
31993
+ ...$$props.ariaLabel ? { "aria-label": $$props.ariaLabel } : {}
31994
+ };
31995
+ }
32067
31996
  let editorState = /* @__PURE__ */ state(proxy({
32068
31997
  isBold: false,
32069
31998
  canBold: false,
@@ -32155,6 +32084,7 @@ function EditableHtml$1($$anchor, $$props) {
32155
32084
  content: markup() || "",
32156
32085
  editable: !disabled(),
32157
32086
  autofocus: false,
32087
+ editorProps: { attributes: editorAttributes() },
32158
32088
  onUpdate: ({ editor }) => {
32159
32089
  const html = editor.getHTML();
32160
32090
  if ($$props.onChange) $$props.onChange(html);
@@ -32164,12 +32094,7 @@ function EditableHtml$1($$anchor, $$props) {
32164
32094
  updateEditorState();
32165
32095
  },
32166
32096
  onFocus: () => {
32167
- set(isFocused, true);
32168
32097
  updateEditorState();
32169
- },
32170
- onBlur: () => {
32171
- set(isFocused, false);
32172
- set(showAlignMenu, false);
32173
32098
  }
32174
32099
  }), true);
32175
32100
  updateEditorState();
@@ -32184,6 +32109,19 @@ function EditableHtml$1($$anchor, $$props) {
32184
32109
  const editable = !disabled();
32185
32110
  if (get$1(editor) && get$1(editor).isEditable !== editable) get$1(editor).setEditable(editable, false);
32186
32111
  });
32112
+ user_effect(() => {
32113
+ const attributes = editorAttributes();
32114
+ if (get$1(editor) && get$1(editor).view.dom.getAttribute("aria-label") !== (attributes["aria-label"] ?? null)) get$1(editor).setOptions({ editorProps: { attributes } });
32115
+ });
32116
+ function handleFocusIn() {
32117
+ set(hasFocus, true);
32118
+ }
32119
+ function handleFocusOut(e) {
32120
+ if (!e.currentTarget.contains(e.relatedTarget)) {
32121
+ set(hasFocus, false);
32122
+ set(showAlignMenu, false);
32123
+ }
32124
+ }
32187
32125
  function toggleBold() {
32188
32126
  get$1(editor)?.chain().focus().toggleBold().run();
32189
32127
  }
@@ -32488,7 +32426,10 @@ function EditableHtml$1($$anchor, $$props) {
32488
32426
  reset$1(button_24);
32489
32427
  reset$1(div_5);
32490
32428
  reset$1(div_4);
32491
- template_effect(() => classes_1 = set_class(div_4, 1, "toolbar", null, classes_1, { focused: get$1(isFocused) }));
32429
+ template_effect(() => {
32430
+ classes_1 = set_class(div_4, 1, "toolbar", null, classes_1, { focused: get$1(hasFocus) });
32431
+ div_4.inert = !get$1(hasFocus);
32432
+ });
32492
32433
  delegated("mousedown", div_4, handleMouseDown);
32493
32434
  delegated("click", button_24, handleDoneClick);
32494
32435
  append($$anchor, div_4);
@@ -32498,10 +32439,17 @@ function EditableHtml$1($$anchor, $$props) {
32498
32439
  });
32499
32440
  reset$1(div);
32500
32441
  template_effect(() => classes = set_class(div_1, 1, "editor-holder", null, classes, { disabled: disabled() }));
32442
+ delegated("focusin", div, handleFocusIn);
32443
+ delegated("focusout", div, handleFocusOut);
32501
32444
  append($$anchor, div);
32502
32445
  pop();
32503
32446
  }
32504
- delegate(["mousedown", "click"]);
32447
+ delegate([
32448
+ "focusin",
32449
+ "focusout",
32450
+ "mousedown",
32451
+ "click"
32452
+ ]);
32505
32453
  //#endregion
32506
32454
  //#region ../../lib-svelte/editable-html-tiptap-svelte/dist/index.js
32507
32455
  var EditableHtml = EditableHtml$1;
@@ -32584,8 +32532,7 @@ var e$2 = {
32584
32532
  listenSilentAlt: "Repeat instructions",
32585
32533
  listenPlayingAlt: "Instructions are playing",
32586
32534
  printAudio: "Audio:",
32587
- printTranscript: "Transcript:",
32588
- printKey: "(key)"
32535
+ printTranscript: "Transcript:"
32589
32536
  },
32590
32537
  multipleChoice: {
32591
32538
  minSelections: "Select at least {{minSelections}}.",
@@ -32728,8 +32675,7 @@ var e$1 = {
32728
32675
  listenSilentAlt: "Escuchar. Repetir las instrucciones.",
32729
32676
  listenPlayingAlt: "Escuchar. Estas son las instrucciones.",
32730
32677
  printAudio: "Audio:",
32731
- printTranscript: "Transcripción:",
32732
- printKey: "(clave)"
32678
+ printTranscript: "Transcripción:"
32733
32679
  },
32734
32680
  multipleChoice: {
32735
32681
  minSelections: "Seleccione al menos {{minSelections}}.",
@@ -36221,11 +36167,7 @@ function VennClassification($$anchor, $$props) {
36221
36167
  tileId,
36222
36168
  placement
36223
36169
  });
36224
- l({
36225
- sourceEl: containerEl,
36226
- session: next,
36227
- complete: next.completed === true
36228
- });
36170
+ $$props.onSessionChange?.(next);
36229
36171
  }
36230
36172
  function findTile(id) {
36231
36173
  if (!id) return null;
@@ -36855,7 +36797,8 @@ function VennClassification($$anchor, $$props) {
36855
36797
  delegate(["focusout", "click"]);
36856
36798
  create_custom_element(VennClassification, {
36857
36799
  model: { type: "Object" },
36858
- session: { type: "Object" }
36800
+ session: { type: "Object" },
36801
+ onSessionChange: {}
36859
36802
  }, [], []);
36860
36803
  //#endregion
36861
36804
  //#region src/author/Author.svelte
@@ -36880,12 +36823,10 @@ var $$css = {
36880
36823
  function Author($$anchor, $$props) {
36881
36824
  push($$props, true);
36882
36825
  append_styles$1($$anchor, $$css);
36883
- let model = prop($$props, "model", 15), onChange = prop($$props, "onChange", 7);
36884
- const isAuthorHost = (node) => typeof node?.onModelChange === "function";
36826
+ let model = prop($$props, "model", 15), onChange = prop($$props, "onChange", 7), onModelChange = prop($$props, "onModelChange", 7);
36885
36827
  /** The wrapper owns the model and announces the edit; `onChange` serves a component mounted without one. */
36886
36828
  function emit(next) {
36887
- const host = r$2(get$1(authorShellEl), { hostPredicate: isAuthorHost });
36888
- if (host) host.onModelChange(next);
36829
+ if (onModelChange()) onModelChange()(next);
36889
36830
  else {
36890
36831
  model(next);
36891
36832
  onChange()?.(next);
@@ -37103,6 +37044,13 @@ function Author($$anchor, $$props) {
37103
37044
  set onChange($$value) {
37104
37045
  onChange($$value);
37105
37046
  flushSync();
37047
+ },
37048
+ get onModelChange() {
37049
+ return onModelChange();
37050
+ },
37051
+ set onModelChange($$value) {
37052
+ onModelChange($$value);
37053
+ flushSync();
37106
37054
  }
37107
37055
  };
37108
37056
  var div = root_11();
@@ -37115,7 +37063,7 @@ function Author($$anchor, $$props) {
37115
37063
  remove_input_defaults(input);
37116
37064
  next(2);
37117
37065
  reset$1(label_1);
37118
- var node_1 = sibling(label_1, 2);
37066
+ var node = sibling(label_1, 2);
37119
37067
  var consequent = ($$anchor) => {
37120
37068
  {
37121
37069
  let $0 = /* @__PURE__ */ user_derived(() => get$1(m).prompt || "");
@@ -37124,11 +37072,12 @@ function Author($$anchor, $$props) {
37124
37072
  return get$1($0);
37125
37073
  },
37126
37074
  onChange: onPromptChange,
37127
- placeholder: "Enter a prompt for the Venn classification question..."
37075
+ placeholder: "Enter a prompt for the Venn classification question...",
37076
+ ariaLabel: "Prompt"
37128
37077
  });
37129
37078
  }
37130
37079
  };
37131
- if_block(node_1, ($$render) => {
37080
+ if_block(node, ($$render) => {
37132
37081
  if (get$1(m).promptEnabled !== false) $$render(consequent);
37133
37082
  });
37134
37083
  reset$1(div_3);
@@ -37151,14 +37100,14 @@ function Author($$anchor, $$props) {
37151
37100
  var div_7 = child(div_6);
37152
37101
  var button = sibling(child(div_7), 2);
37153
37102
  reset$1(div_7);
37154
- var node_2 = sibling(div_7, 2);
37103
+ var node_1 = sibling(div_7, 2);
37155
37104
  var consequent_1 = ($$anchor) => {
37156
37105
  append($$anchor, root_1());
37157
37106
  };
37158
- if_block(node_2, ($$render) => {
37107
+ if_block(node_1, ($$render) => {
37159
37108
  if (get$1(m).tiles.length === 0) $$render(consequent_1);
37160
37109
  });
37161
- var ul = sibling(node_2, 2);
37110
+ var ul = sibling(node_1, 2);
37162
37111
  each(ul, 21, () => get$1(m).tiles, index, ($$anchor, tile, idx) => {
37163
37112
  var li = root_3();
37164
37113
  var div_9 = child(li);
@@ -37179,14 +37128,14 @@ function Author($$anchor, $$props) {
37179
37128
  var input_5 = sibling(child(label_6), 2);
37180
37129
  remove_input_defaults(input_5);
37181
37130
  reset$1(label_6);
37182
- var node_3 = sibling(label_6, 2);
37131
+ var node_2 = sibling(label_6, 2);
37183
37132
  var consequent_2 = ($$anchor) => {
37184
37133
  var div_11 = root_2();
37185
37134
  delegated("click", only_child(div_11), () => clearTileImage(idx));
37186
37135
  append($$anchor, div_11);
37187
37136
  };
37188
37137
  var d = /* @__PURE__ */ user_derived(() => (get$1(tile).imageUrl ?? "").trim());
37189
- if_block(node_3, ($$render) => {
37138
+ if_block(node_2, ($$render) => {
37190
37139
  if (get$1(d)) $$render(consequent_2);
37191
37140
  });
37192
37141
  reset$1(div_10);
@@ -37276,7 +37225,7 @@ function Author($$anchor, $$props) {
37276
37225
  var text_3 = sibling(child(div_19));
37277
37226
  reset$1(div_19);
37278
37227
  reset$1(div_16);
37279
- var node_6 = sibling(div_16, 2);
37228
+ var node_5 = sibling(div_16, 2);
37280
37229
  var consequent_3 = ($$anchor) => {
37281
37230
  var div_20 = root_5();
37282
37231
  VennClassification(child(div_20), {
@@ -37296,29 +37245,29 @@ function Author($$anchor, $$props) {
37296
37245
  var alternate = ($$anchor) => {
37297
37246
  append($$anchor, root_7());
37298
37247
  };
37299
- if_block(node_6, ($$render) => {
37248
+ if_block(node_5, ($$render) => {
37300
37249
  if (get$1(m).tiles.length > 0 && get$1(m).circles?.length === 2) $$render(consequent_3);
37301
37250
  else if (get$1(m).tiles.length === 0) $$render(consequent_4, 1);
37302
37251
  else $$render(alternate, -1);
37303
37252
  });
37304
- var node_8 = sibling(node_6, 2);
37253
+ var node_7 = sibling(node_5, 2);
37305
37254
  var consequent_6 = ($$anchor) => {
37306
37255
  var fragment_1 = root_10();
37307
37256
  var ol = sibling(first_child(fragment_1), 2);
37308
37257
  each(ol, 21, () => get$1(m).tiles, index, ($$anchor, tile) => {
37309
37258
  var li_1 = root_9();
37310
37259
  var span_2 = child(li_1);
37311
- var node_9 = child(span_2);
37260
+ var node_8 = child(span_2);
37312
37261
  var consequent_5 = ($$anchor) => {
37313
37262
  var img = root_8();
37314
37263
  template_effect(() => set_attribute(img, "src", get$1(tile).imageUrl));
37315
37264
  append($$anchor, img);
37316
37265
  };
37317
37266
  var d_1 = /* @__PURE__ */ user_derived(() => (get$1(tile).imageUrl ?? "").trim());
37318
- if_block(node_9, ($$render) => {
37267
+ if_block(node_8, ($$render) => {
37319
37268
  if (get$1(d_1)) $$render(consequent_5);
37320
37269
  });
37321
- var text_4 = sibling(node_9);
37270
+ var text_4 = sibling(node_8);
37322
37271
  reset$1(span_2);
37323
37272
  var text_5 = only_child(sibling(span_2, 4), true);
37324
37273
  reset$1(li_1);
@@ -37331,7 +37280,7 @@ function Author($$anchor, $$props) {
37331
37280
  reset$1(ol);
37332
37281
  append($$anchor, fragment_1);
37333
37282
  };
37334
- if_block(node_8, ($$render) => {
37283
+ if_block(node_7, ($$render) => {
37335
37284
  if (get$1(m).tiles.length > 0) $$render(consequent_6);
37336
37285
  });
37337
37286
  reset$1(div_15);
@@ -37368,31 +37317,29 @@ delegate([
37368
37317
  ]);
37369
37318
  create_custom_element(Author, {
37370
37319
  model: { type: "Object" },
37320
+ onModelChange: {},
37371
37321
  onChange: {}
37372
37322
  }, [], []);
37373
37323
  //#endregion
37374
37324
  //#region src/author/index.ts
37375
37325
  var SvelteElementClass = Author.element;
37376
37326
  var VennClassificationAuthor = class extends SvelteElementClass {
37377
- constructor(..._args) {
37378
- super(..._args);
37327
+ /**
37328
+ * The component reports each edit through its `onModelChange` prop, assigned
37329
+ * here through the accessor Svelte generates for it. The host keeps the
37330
+ * edited model, renders from it, and announces it as `model.updated`, which
37331
+ * bubbles to the listener an authoring player registers at its root.
37332
+ */
37333
+ constructor() {
37334
+ super();
37379
37335
  _defineProperty(this, "_model", null);
37380
37336
  _defineProperty(this, "_onChange", null);
37381
- _defineProperty(
37382
- this,
37383
- /**
37384
- * The component reports each edit here. The host keeps the edited model,
37385
- * renders from it, and announces it as `model.updated`, which bubbles to
37386
- * the listener an authoring player registers at its root.
37387
- */
37388
- "onModelChange",
37389
- (update) => {
37390
- this._model = update;
37391
- super.model = update;
37392
- this._onChange?.(update);
37393
- this.dispatchEvent(new e$3(update, false));
37394
- }
37395
- );
37337
+ this.onModelChange = (update) => {
37338
+ this._model = update;
37339
+ super.model = update;
37340
+ this._onChange?.(update);
37341
+ this.dispatchEvent(new e$3(update, false));
37342
+ };
37396
37343
  }
37397
37344
  set model(m) {
37398
37345
  this._model = m;