@pie-element/math-templated 7.1.1-next.30 → 7.1.1-next.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/editor-runtime/author/index.js +13468 -0
- package/dist/browser/editor-runtime/author/index.js.map +1 -0
- package/dist/browser/editor-runtime/browser-CCIOWBDT.js +342 -0
- package/dist/browser/editor-runtime/browser-CCIOWBDT.js.map +1 -0
- package/dist/browser/editor-runtime/controller/index.js +37733 -0
- package/dist/browser/editor-runtime/controller/index.js.map +1 -0
- package/dist/browser/editor-runtime/delivery/index.js +130 -0
- package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
- package/dist/browser/editor-runtime/dist-DCmVXYeO.js +1528 -0
- package/dist/browser/editor-runtime/dist-DCmVXYeO.js.map +1 -0
- package/dist/browser/editor-runtime/horizontal-keypad-CiYZhAxh.js +14467 -0
- package/dist/browser/editor-runtime/horizontal-keypad-CiYZhAxh.js.map +1 -0
- package/dist/browser/editor-runtime/main-Bq72a7tn.js +1270 -0
- package/dist/browser/editor-runtime/main-Bq72a7tn.js.map +1 -0
- package/dist/browser/editor-runtime/print/index.js +47 -0
- package/dist/browser/editor-runtime/print/index.js.map +1 -0
- package/package.json +12 -2
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { t as e } from "../main-Bq72a7tn.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import { createRoot as n } from "react-dom/client";
|
|
4
|
+
//#region ../../shared/player-events/dist/index.js
|
|
5
|
+
var r = "commitPendingSession", i = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
function a(e, t) {
|
|
7
|
+
let n = i.get(e);
|
|
8
|
+
n || (n = /* @__PURE__ */ new Set(), i.set(e, n)), n.add(t);
|
|
9
|
+
}
|
|
10
|
+
function o(e) {
|
|
11
|
+
return Object.getOwnPropertyDescriptor(e, r) !== void 0;
|
|
12
|
+
}
|
|
13
|
+
function s(e) {
|
|
14
|
+
if (o(e)) return;
|
|
15
|
+
let t = e[r];
|
|
16
|
+
Object.defineProperty(e, r, {
|
|
17
|
+
value: () => {
|
|
18
|
+
if (typeof t == "function") try {
|
|
19
|
+
t.call(e);
|
|
20
|
+
} catch {}
|
|
21
|
+
l(e);
|
|
22
|
+
},
|
|
23
|
+
configurable: !0,
|
|
24
|
+
enumerable: !1,
|
|
25
|
+
writable: !0
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function c(e, t, n = {}) {
|
|
29
|
+
let r = n.delayMs, i = typeof r == "function" ? r : () => r ?? 0, o = n.maxWaitMs, c = null, l = null, u = !1, d = () => {
|
|
30
|
+
c !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);
|
|
31
|
+
}, f = () => {
|
|
32
|
+
d(), u && (u = !1, t());
|
|
33
|
+
}, p = {
|
|
34
|
+
notify() {
|
|
35
|
+
u = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, i())), o !== void 0 && l === null && (l = setTimeout(f, Math.max(0, o)));
|
|
36
|
+
},
|
|
37
|
+
flush() {
|
|
38
|
+
if (!u) {
|
|
39
|
+
d();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
f();
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.warn("[session-notifier] a committed session-changed dispatch threw", e);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return a(e, p), s(e), p;
|
|
50
|
+
}
|
|
51
|
+
function l(e) {
|
|
52
|
+
let t = i.get(e);
|
|
53
|
+
if (t) for (let e of [...t]) e.flush();
|
|
54
|
+
}
|
|
55
|
+
var u = class e extends CustomEvent {
|
|
56
|
+
static {
|
|
57
|
+
this.TYPE = "model-set";
|
|
58
|
+
}
|
|
59
|
+
constructor(t, n, r) {
|
|
60
|
+
super(e.TYPE, {
|
|
61
|
+
bubbles: !0,
|
|
62
|
+
composed: !0,
|
|
63
|
+
detail: {
|
|
64
|
+
complete: n,
|
|
65
|
+
component: t,
|
|
66
|
+
hasModel: r
|
|
67
|
+
}
|
|
68
|
+
}), this.component = t, this.complete = n;
|
|
69
|
+
}
|
|
70
|
+
}, d = class e extends CustomEvent {
|
|
71
|
+
static {
|
|
72
|
+
this.TYPE = "session-changed";
|
|
73
|
+
}
|
|
74
|
+
constructor(t, n) {
|
|
75
|
+
super(e.TYPE, {
|
|
76
|
+
bubbles: !0,
|
|
77
|
+
composed: !0,
|
|
78
|
+
detail: {
|
|
79
|
+
complete: n,
|
|
80
|
+
component: t
|
|
81
|
+
}
|
|
82
|
+
}), this.component = t, this.complete = n;
|
|
83
|
+
}
|
|
84
|
+
}, f = class extends HTMLElement {
|
|
85
|
+
constructor() {
|
|
86
|
+
super(), this._root = null, this._sessionNotifier = c(this, () => {
|
|
87
|
+
this.dispatchEvent(new d(this.tagName.toLowerCase(), !0));
|
|
88
|
+
}, { delayMs: 1e3 }), this.sessionChangedEventCaller = () => this._sessionNotifier.notify();
|
|
89
|
+
}
|
|
90
|
+
set model(e) {
|
|
91
|
+
this._model = e, this.render(), this.dispatchEvent(new u(this.tagName.toLowerCase(), this.isSessionComplete(), this._model !== void 0));
|
|
92
|
+
}
|
|
93
|
+
get model() {
|
|
94
|
+
return this._model;
|
|
95
|
+
}
|
|
96
|
+
set session(e) {
|
|
97
|
+
this._session = e, this.render();
|
|
98
|
+
}
|
|
99
|
+
get session() {
|
|
100
|
+
return this._session;
|
|
101
|
+
}
|
|
102
|
+
isSessionComplete() {
|
|
103
|
+
return !0;
|
|
104
|
+
}
|
|
105
|
+
onSessionChange(e) {
|
|
106
|
+
Object.keys(e).map((t) => {
|
|
107
|
+
this._session[t] = e[t];
|
|
108
|
+
}), this.sessionChangedEventCaller(), this.render();
|
|
109
|
+
}
|
|
110
|
+
connectedCallback() {
|
|
111
|
+
this.render();
|
|
112
|
+
}
|
|
113
|
+
render() {
|
|
114
|
+
if (!(!this._model || !this._session) && this._model && this._session) {
|
|
115
|
+
let r = t.createElement(e, {
|
|
116
|
+
model: this._model,
|
|
117
|
+
session: this._session,
|
|
118
|
+
onSessionChange: this.onSessionChange.bind(this)
|
|
119
|
+
});
|
|
120
|
+
this._root ||= n(this), this._root.render(r);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
disconnectedCallback() {
|
|
124
|
+
l(this), this._root &&= (this._root.unmount(), null);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
//#endregion
|
|
128
|
+
export { f as default };
|
|
129
|
+
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../shared/player-events/dist/index.js","../../../../src/delivery/index.ts"],"sourcesContent":["//#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","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/math-templated/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport {\n SessionChangedEvent,\n ModelSetEvent,\n createSessionNotifier,\n flushSessionNotifiers,\n} from '@pie-element/shared-player-events';\nimport Main from './main.js';\n\nexport default class MathTemplated extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n // Session state is already written synchronously in `onSessionChange`; only\n // this dispatch is coalesced, and `disconnectedCallback` flushes it.\n this._sessionNotifier = createSessionNotifier(\n this,\n () => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), true));\n },\n { delayMs: 1000 },\n );\n this.sessionChangedEventCaller = () => this._sessionNotifier.notify();\n }\n\n set model(m) {\n this._model = m;\n\n this.render();\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), this.isSessionComplete(), this._model !== undefined),\n );\n }\n\n get model() {\n return this._model;\n }\n\n set session(s) {\n this._session = s;\n\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n isSessionComplete() {\n // a method to check if student answered the question\n return true;\n }\n\n onSessionChange(session) {\n // you can add an extra step here to validate session\n Object.keys(session).map((key) => {\n this._session[key] = session[key];\n });\n\n this.sessionChangedEventCaller();\n this.render();\n }\n\n connectedCallback() {\n // TODO set accessibility labels\n\n this.render();\n }\n\n render() {\n if (!this._model || !this._session) {\n return;\n }\n\n if (this._model && this._session) {\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onSessionChange: this.onSessionChange.bind(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n }\n }\n\n disconnectedCallback() {\n flushSessionNotifiers(this);\n\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }\n }\n}\n"],"mappings":";;;;AACA,IAAI,IAAI,wBAAwB,oBAAoB,IAAI,QAAQ;AAChE,SAAS,EAAE,GAAG,GAAG;CAChB,IAAI,IAAI,EAAE,IAAI,CAAC;CACf,MAAM,oBAAoB,IAAI,IAAI,GAAG,EAAE,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;AAC3D;AACA,SAAS,EAAE,GAAG;CACb,OAAO,OAAO,yBAAyB,GAAG,CAAC,MAAM,KAAK;AACvD;AACA,SAAS,EAAE,GAAG;CACb,IAAI,EAAE,CAAC,GAAG;CACV,IAAI,IAAI,EAAE;CACV,OAA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