@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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/delivery/index.ts"],"sourcesContent":["import VennClassificationComponent from './VennClassification.svelte';\nimport { isComplete as isControllerComplete } from '../controller/index.js';\nimport {\n ModelSetEvent,\n SessionChangedEvent,\n writeSessionInPlace,\n} from '@pie-lib/delivery-events-svelte';\n\nconst SvelteElementClass = (VennClassificationComponent as any).element;\n\nclass VennClassificationElement extends SvelteElementClass {\n _internalSession: any = null;\n /**\n * The session object the player handed us. A player reads the learner's\n * response back off this object, so every update is written into it as well\n * as into the copy the component renders from.\n */\n _playerSession: any = null;\n _model: any = null;\n\n _isComplete = () => {\n return isControllerComplete(this._model, this._internalSession);\n };\n\n /**\n * Dispatched a microtask later: on load a player sets the model and then the\n * session in the same task (`element.model = …; element.session = …`), and\n * `complete` can only report a restored placement once the session is here.\n */\n _dispatchModelSet = () => {\n queueMicrotask(() => {\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), this._isComplete(), this._model !== undefined)\n );\n });\n };\n\n _dispatchSessionChanged = () => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this._isComplete()));\n };\n\n set model(m: any) {\n this._model = m;\n super.model = m;\n this._dispatchModelSet();\n }\n\n get model() {\n return this._model;\n }\n\n /**\n * A re-set of the same object is an update, not a no-op: a player sets the\n * session before the model on load and again after it (`element.model = …;\n * element.session = sameObject`), and only that second event can report a\n * restored session as complete. A player that clears the response in place\n * re-sets its object the same way, and the component must re-render it.\n */\n set session(s: any) {\n this._playerSession = s;\n this._internalSession = s;\n super.session = s;\n this._dispatchSessionChanged();\n }\n\n get session() {\n return this._internalSession;\n }\n\n onSessionChange = (updatedSession: any) => {\n writeSessionInPlace(this._playerSession, updatedSession);\n this._internalSession = updatedSession;\n super.session = updatedSession;\n this._dispatchSessionChanged();\n };\n\n connectedCallback() {\n super.connectedCallback();\n (this as any).onSessionChange = this.onSessionChange;\n }\n}\n\nexport default VennClassificationElement;\n"],"mappings":";;;AAQA,IAAM,IAAsB,EAAoC,SAE1D,IAAN,cAAwC,EAAmB;CACzD,mBAAwB;CAMxB,iBAAsB;CACtB,SAAc;CAEd,oBACS,EAAqB,KAAK,QAAQ,KAAK,gBAAgB;CAQhE,0BAA0B;EACxB,qBAAqB;GACnB,KAAK,cACH,IAAI,EAAc,KAAK,QAAQ,YAAY,GAAG,KAAK,YAAY,GAAG,KAAK,WAAW,KAAA,CAAS,CAC7F;EACF,CAAC;CACH;CAEA,gCAAgC;EAC9B,KAAK,cAAc,IAAI,EAAoB,KAAK,QAAQ,YAAY,GAAG,KAAK,YAAY,CAAC,CAAC;CAC5F;CAEA,IAAI,MAAM,GAAQ;EAGhB,AAFA,KAAK,SAAS,GACd,MAAM,QAAQ,GACd,KAAK,kBAAkB;CACzB;CAEA,IAAI,QAAQ;EACV,OAAO,KAAK;CACd;CASA,IAAI,QAAQ,GAAQ;EAIlB,AAHA,KAAK,iBAAiB,GACtB,KAAK,mBAAmB,GACxB,MAAM,UAAU,GAChB,KAAK,wBAAwB;CAC/B;CAEA,IAAI,UAAU;EACZ,OAAO,KAAK;CACd;CAEA,mBAAmB,MAAwB;EAIzC,AAHA,EAAoB,KAAK,gBAAgB,CAAc,GACvD,KAAK,mBAAmB,GACxB,MAAM,UAAU,GAChB,KAAK,wBAAwB;CAC/B;CAEA,oBAAoB;EAElB,AADA,MAAM,kBAAkB,GACxB,KAAc,kBAAkB,KAAK;CACvC;AACF"}
1
+ {"version":3,"file":"index.js","names":["#e","t","#t","e","n"],"sources":["../../../../../lib-svelte/delivery-events/dist/index2.js","../../../../../shared/player-events/dist/index.js","../../../../../lib-svelte/delivery-events/dist/index3.js","../../../src/delivery/index.ts"],"sourcesContent":["//#region src/write-session-in-place.ts\nfunction e(e) {\n\treturn !!e && typeof e == \"object\" && !Array.isArray(e);\n}\nfunction t(t, n) {\n\tif (t === n) return t;\n\tif (!e(t) || !e(n) || Object.isFrozen(t) || !Object.isExtensible(t)) return n;\n\ttry {\n\t\tfor (let e of Object.keys(t)) e in n || delete t[e];\n\t\tObject.assign(t, n);\n\t} catch {\n\t\treturn n;\n\t}\n\treturn t;\n}\n//#endregion\nexport { t as writeSessionInPlace };\n","//#region src/session-notifier.ts\nvar e = \"commitPendingSession\", t = /* @__PURE__ */ new WeakMap();\nfunction n(e, n) {\n\tlet r = t.get(e);\n\tr || (r = /* @__PURE__ */ new Set(), t.set(e, r)), r.add(n);\n}\nfunction r(t) {\n\treturn Object.getOwnPropertyDescriptor(t, e) !== void 0;\n}\nfunction i(t) {\n\tif (r(t)) return;\n\tlet n = t[e];\n\tObject.defineProperty(t, e, {\n\t\tvalue: () => {\n\t\t\tif (typeof n == \"function\") try {\n\t\t\t\tn.call(t);\n\t\t\t} catch {}\n\t\t\to(t);\n\t\t},\n\t\tconfigurable: !0,\n\t\tenumerable: !1,\n\t\twritable: !0\n\t});\n}\nfunction a(e, t, r = {}) {\n\tlet a = r.delayMs, o = typeof a == \"function\" ? a : () => a ?? 0, s = r.maxWaitMs, c = null, l = null, u = !1, d = () => {\n\t\tc !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);\n\t}, f = () => {\n\t\td(), u && (u = !1, t());\n\t}, p = {\n\t\tnotify() {\n\t\t\tu = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, o())), s !== void 0 && l === null && (l = setTimeout(f, Math.max(0, s)));\n\t\t},\n\t\tflush() {\n\t\t\tif (!u) {\n\t\t\t\td();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tf();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[session-notifier] a committed session-changed dispatch threw\", e);\n\t\t\t}\n\t\t}\n\t};\n\treturn n(e, p), i(e), p;\n}\nfunction o(e) {\n\tlet n = t.get(e);\n\tif (n) for (let e of [...n]) e.flush();\n}\n//#endregion\n//#region src/index.ts\nvar s = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, c = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { s as ModelSetEvent, e as SESSION_COMMIT_METHOD, c as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers };\n","import { writeSessionInPlace as e } from \"./index2.js\";\nimport { ModelSetEvent as t, SessionChangedEvent as n } from \"@pie-element/shared-player-events\";\n//#region src/delivery-element.ts\nfunction r(r, i) {\n\tlet a = r.element;\n\tif (!a) throw TypeError(\"defineDeliveryElement: the component was not compiled with `customElement`\");\n\tclass o extends a {\n\t\t#e;\n\t\t#t;\n\t\tconstructor() {\n\t\t\tsuper(), this.onSessionChange = (e) => {\n\t\t\t\tthis.writeSession(e), this.dispatchSessionChanged();\n\t\t\t};\n\t\t}\n\t\tset model(e) {\n\t\t\tthis.#e = e, super.model = e, queueMicrotask(() => {\n\t\t\t\tthis.dispatchEvent(new t(this.tagName.toLowerCase(), this.isComplete(), this.#e !== void 0));\n\t\t\t});\n\t\t}\n\t\tget model() {\n\t\t\treturn this.#e;\n\t\t}\n\t\tset session(e) {\n\t\t\tthis.#t = e, super.session = e, this.dispatchSessionChanged();\n\t\t}\n\t\tget session() {\n\t\t\treturn this.#t;\n\t\t}\n\t\tisComplete() {\n\t\t\treturn i.isComplete(this.#e, this.#t);\n\t\t}\n\t\twriteSession(t) {\n\t\t\tthis.#t = e(this.#t, t), super.session = t;\n\t\t}\n\t\tdispatchSessionChanged() {\n\t\t\tthis.dispatchEvent(new n(this.tagName.toLowerCase(), this.isComplete()));\n\t\t}\n\t}\n\treturn o;\n}\n//#endregion\nexport { r as defineDeliveryElement };\n","import VennClassificationComponent from './VennClassification.svelte';\nimport { isComplete } from '../controller/index.js';\nimport { defineDeliveryElement } from '@pie-lib/delivery-events-svelte';\nimport type { VennModel, VennSession } from '../types.js';\n\nconst VennClassificationElement = defineDeliveryElement<VennModel, VennSession>(\n VennClassificationComponent,\n { isComplete }\n);\n\nexport default VennClassificationElement;\n"],"mappings":";;;AACA,SAAS,EAAE,GAAG;CACb,OAAO,CAAC,CAAC,KAAK,OAAO,KAAK,YAAY,CAAC,MAAM,QAAQ,CAAC;AACvD;AACA,SAAS,EAAE,GAAG,GAAG;CAChB,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,OAAO,SAAS,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GAAG,OAAO;CAC5E,IAAI;EACH,KAAK,IAAI,KAAK,OAAO,KAAK,CAAC,GAAG,KAAK,KAAK,OAAO,EAAE;EACjD,OAAO,OAAO,GAAG,CAAC;CACnB,QAAQ;EACP,OAAO;CACR;CACA,OAAO;AACR;;;ACuCA,IAAI,IAAI,MAAM,UAAU,YAAY;CACnC;EACC,KAAK,OAAO;CACb;CACA,YAAY,GAAG,GAAG,GAAG;EACpB,MAAM,EAAE,MAAM;GACb,SAAS,CAAC;GACV,UAAU,CAAC;GACX,QAAQ;IACP,UAAU;IACV,WAAW;IACX,UAAU;GACX;EACD,CAAC,GAAG,KAAK,YAAY,GAAG,KAAK,WAAW;CACzC;AACD,GAAG,IAAI,MAAM,UAAU,YAAY;CAClC;EACC,KAAK,OAAO;CACb;CACA,YAAY,GAAG,GAAG;EACjB,MAAM,EAAE,MAAM;GACb,SAAS,CAAC;GACV,UAAU,CAAC;GACX,QAAQ;IACP,UAAU;IACV,WAAW;GACZ;EACD,CAAC,GAAG,KAAK,YAAY,GAAG,KAAK,WAAW;CACzC;AACD;;;AC/EA,SAAS,EAAE,GAAG,GAAG;CAChB,IAAI,IAAI,EAAE;CACV,IAAI,CAAC,GAAG,MAAM,UAAU,4EAA4E;CACpG,MAAM,UAAU,EAAE;EACjB;EACA;EACA,cAAc;GACb,MAAM,GAAG,KAAK,mBAAmB,MAAM;IACtC,KAAK,aAAa,CAAC,GAAG,KAAK,uBAAuB;GACnD;EACD;EACA,IAAI,MAAM,GAAG;GACZ,KAAKA,KAAK,GAAG,MAAM,QAAQ,GAAG,qBAAqB;IAClD,KAAK,cAAc,IAAIC,EAAE,KAAK,QAAQ,YAAY,GAAG,KAAK,WAAW,GAAG,KAAKD,OAAO,KAAK,CAAC,CAAC;GAC5F,CAAC;EACF;EACA,IAAI,QAAQ;GACX,OAAO,KAAKA;EACb;EACA,IAAI,QAAQ,GAAG;GACd,KAAKE,KAAK,GAAG,MAAM,UAAU,GAAG,KAAK,uBAAuB;EAC7D;EACA,IAAI,UAAU;GACb,OAAO,KAAKA;EACb;EACA,aAAa;GACZ,OAAO,EAAE,WAAW,KAAKF,IAAI,KAAKE,EAAE;EACrC;EACA,aAAa,GAAG;GACf,KAAKA,KAAKC,EAAE,KAAKD,IAAID,CAAC,GAAG,MAAM,UAAUA;EAC1C;EACA,yBAAyB;GACxB,KAAK,cAAc,IAAIG,EAAE,KAAK,QAAQ,YAAY,GAAG,KAAK,WAAW,CAAC,CAAC;EACxE;CACD;CACA,OAAO;AACR;;;AClCA,IAAM,IAA4B,EAChC,GACA,EAAE,cAAW,CACf"}
@@ -98,8 +98,7 @@ var e$1 = {
98
98
  listenSilentAlt: "Repeat instructions",
99
99
  listenPlayingAlt: "Instructions are playing",
100
100
  printAudio: "Audio:",
101
- printTranscript: "Transcript:",
102
- printKey: "(key)"
101
+ printTranscript: "Transcript:"
103
102
  },
104
103
  multipleChoice: {
105
104
  minSelections: "Select at least {{minSelections}}.",
@@ -242,8 +241,7 @@ var e = {
242
241
  listenSilentAlt: "Escuchar. Repetir las instrucciones.",
243
242
  listenPlayingAlt: "Escuchar. Estas son las instrucciones.",
244
243
  printAudio: "Audio:",
245
- printTranscript: "Transcripción:",
246
- printKey: "(clave)"
244
+ printTranscript: "Transcripción:"
247
245
  },
248
246
  multipleChoice: {
249
247
  minSelections: "Seleccione al menos {{minSelections}}.",