@pie-element/categorize 13.1.2-next.2 → 13.1.2
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/CHANGELOG.json +1637 -0
- package/CHANGELOG.md +2542 -0
- package/LICENSE.md +5 -0
- package/README.md +5 -0
- package/configure/CHANGELOG.json +1202 -0
- package/configure/CHANGELOG.md +2125 -0
- package/configure/lib/defaults.js +222 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/design/builder.js +55 -0
- package/configure/lib/design/builder.js.map +1 -0
- package/configure/lib/design/buttons.js +59 -0
- package/configure/lib/design/buttons.js.map +1 -0
- package/configure/lib/design/categories/RowLabel.js +66 -0
- package/configure/lib/design/categories/RowLabel.js.map +1 -0
- package/configure/lib/design/categories/alternateResponses.js +116 -0
- package/configure/lib/design/categories/alternateResponses.js.map +1 -0
- package/configure/lib/design/categories/category.js +153 -0
- package/configure/lib/design/categories/category.js.map +1 -0
- package/configure/lib/design/categories/choice-preview.js +79 -0
- package/configure/lib/design/categories/choice-preview.js.map +1 -0
- package/configure/lib/design/categories/droppable-placeholder.js +93 -0
- package/configure/lib/design/categories/droppable-placeholder.js.map +1 -0
- package/configure/lib/design/categories/index.js +256 -0
- package/configure/lib/design/categories/index.js.map +1 -0
- package/configure/lib/design/choices/choice.js +187 -0
- package/configure/lib/design/choices/choice.js.map +1 -0
- package/configure/lib/design/choices/config.js +58 -0
- package/configure/lib/design/choices/config.js.map +1 -0
- package/configure/lib/design/choices/index.js +197 -0
- package/configure/lib/design/choices/index.js.map +1 -0
- package/configure/lib/design/header.js +71 -0
- package/configure/lib/design/header.js.map +1 -0
- package/configure/lib/design/index.js +727 -0
- package/configure/lib/design/index.js.map +1 -0
- package/configure/lib/design/input-header.js +105 -0
- package/configure/lib/design/input-header.js.map +1 -0
- package/configure/lib/design/utils.js +12 -0
- package/configure/lib/design/utils.js.map +1 -0
- package/configure/lib/index.js +147 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +44 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/utils.js +43 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +32 -0
- package/controller/CHANGELOG.json +452 -0
- package/controller/CHANGELOG.md +1377 -0
- package/controller/lib/defaults.js +33 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +479 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +69 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +18 -0
- package/docs/config-schema.json +2897 -0
- package/docs/config-schema.json.md +2138 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +357 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +12 -0
- package/docs/pie-schema.json +1784 -0
- package/docs/pie-schema.json.md +1046 -0
- package/lib/categorize/categories.js +135 -0
- package/lib/categorize/categories.js.map +1 -0
- package/lib/categorize/category.js +67 -0
- package/lib/categorize/category.js.map +1 -0
- package/lib/categorize/choice.js +140 -0
- package/lib/categorize/choice.js.map +1 -0
- package/lib/categorize/choices.js +99 -0
- package/lib/categorize/choices.js.map +1 -0
- package/lib/categorize/droppable-placeholder.js +84 -0
- package/lib/categorize/droppable-placeholder.js.map +1 -0
- package/lib/categorize/grid-content.js +55 -0
- package/lib/categorize/grid-content.js.map +1 -0
- package/lib/categorize/index.js +450 -0
- package/lib/categorize/index.js.map +1 -0
- package/lib/index.js +316 -0
- package/lib/index.js.map +1 -0
- package/package.json +22 -85
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/defaults.d.ts +0 -223
- package/dist/author/defaults.js +0 -170
- package/dist/author/design/builder.d.ts +0 -10
- package/dist/author/design/builder.js +0 -24
- package/dist/author/design/buttons.d.ts +0 -28
- package/dist/author/design/buttons.js +0 -36
- package/dist/author/design/categories/RowLabel.d.ts +0 -23
- package/dist/author/design/categories/RowLabel.js +0 -47
- package/dist/author/design/categories/alternateResponses.d.ts +0 -31
- package/dist/author/design/categories/alternateResponses.js +0 -62
- package/dist/author/design/categories/category.d.ts +0 -44
- package/dist/author/design/categories/category.js +0 -98
- package/dist/author/design/categories/choice-preview.d.ts +0 -25
- package/dist/author/design/categories/choice-preview.js +0 -60
- package/dist/author/design/categories/droppable-placeholder.d.ts +0 -11
- package/dist/author/design/categories/droppable-placeholder.js +0 -71
- package/dist/author/design/categories/index.d.ts +0 -41
- package/dist/author/design/categories/index.js +0 -146
- package/dist/author/design/choices/choice.d.ts +0 -11
- package/dist/author/design/choices/choice.js +0 -129
- package/dist/author/design/choices/config.d.ts +0 -21
- package/dist/author/design/choices/config.js +0 -33
- package/dist/author/design/choices/index.d.ts +0 -41
- package/dist/author/design/choices/index.js +0 -110
- package/dist/author/design/header.d.ts +0 -24
- package/dist/author/design/header.js +0 -49
- package/dist/author/design/index.d.ts +0 -52
- package/dist/author/design/index.js +0 -417
- package/dist/author/design/input-header.d.ts +0 -39
- package/dist/author/design/input-header.js +0 -69
- package/dist/author/design/utils.d.ts +0 -9
- package/dist/author/design/utils.js +0 -7
- package/dist/author/index.d.ts +0 -51
- package/dist/author/index.js +0 -87
- package/dist/author/main.d.ts +0 -23
- package/dist/author/main.js +0 -30
- package/dist/author/utils.d.ts +0 -16
- package/dist/author/utils.js +0 -17
- package/dist/browser/author/index.js +0 -2041
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/categorize.css +0 -2
- package/dist/browser/controller/index.js +0 -299
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -1051
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-BINEJ0Vp.js +0 -1954
- package/dist/browser/dist-BINEJ0Vp.js.map +0 -1
- package/dist/browser/dist-DDCLQ8jp.js +0 -49802
- package/dist/browser/dist-DDCLQ8jp.js.map +0 -1
- package/dist/controller/defaults.d.ts +0 -34
- package/dist/controller/defaults.js +0 -29
- package/dist/controller/index.d.ts +0 -61
- package/dist/controller/index.js +0 -155
- package/dist/controller/utils.d.ts +0 -20
- package/dist/controller/utils.js +0 -35
- package/dist/delivery/categorize/categories.d.ts +0 -34
- package/dist/delivery/categorize/categories.js +0 -66
- package/dist/delivery/categorize/category.d.ts +0 -28
- package/dist/delivery/categorize/category.js +0 -48
- package/dist/delivery/categorize/choice.d.ts +0 -27
- package/dist/delivery/categorize/choice.js +0 -94
- package/dist/delivery/categorize/choices.d.ts +0 -39
- package/dist/delivery/categorize/choices.js +0 -51
- package/dist/delivery/categorize/droppable-placeholder.d.ts +0 -32
- package/dist/delivery/categorize/droppable-placeholder.js +0 -64
- package/dist/delivery/categorize/grid-content.d.ts +0 -25
- package/dist/delivery/categorize/grid-content.js +0 -39
- package/dist/delivery/categorize/index.d.ts +0 -57
- package/dist/delivery/categorize/index.js +0 -260
- package/dist/delivery/index.d.ts +0 -27
- package/dist/delivery/index.js +0 -152
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -152
- package/dist/index.js +0 -2
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
package/dist/delivery/index.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import e from "./categorize/index.js";
|
|
2
|
-
import t from "react";
|
|
3
|
-
import { createRoot as n } from "react-dom/client";
|
|
4
|
-
import { renderMath as r } from "@pie-element/shared-math-rendering-mathjax";
|
|
5
|
-
import * as i from "@pie-lib/render-ui";
|
|
6
|
-
import { EnableAudioAutoplayImage as a } from "@pie-lib/render-ui";
|
|
7
|
-
import { ModelSetEvent as o, SessionChangedEvent as s } from "@pie-element/shared-player-events";
|
|
8
|
-
//#region src/delivery/index.ts
|
|
9
|
-
function c(e) {
|
|
10
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
11
|
-
}
|
|
12
|
-
function l(e, t) {
|
|
13
|
-
return !e || c(e) ? e : c(e.default) ? e.default : t && c(e[t]) ? e[t] : t && c(e[t]?.default) ? e[t].default : e;
|
|
14
|
-
}
|
|
15
|
-
var u = l(a, "EnableAudioAutoplayImage") || l(p.EnableAudioAutoplayImage, "EnableAudioAutoplayImage"), d = i, f = d.default, p = f && typeof f == "object" ? f : d, m = class extends HTMLElement {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(), this._root = null, this._mathObserver = null, this._mathRenderPending = !1;
|
|
18
|
-
}
|
|
19
|
-
_scheduleMathRender = () => {
|
|
20
|
-
this._mathRenderPending || (this._mathRenderPending = !0, requestAnimationFrame(() => {
|
|
21
|
-
this._mathObserver && !this._mathObserverPaused && this._mathObserver.disconnect(), r(this), this._mathRenderPending = !1, setTimeout(() => {
|
|
22
|
-
this._mathObserver && !this._mathObserverPaused && this._mathObserver.observe(this, {
|
|
23
|
-
childList: !0,
|
|
24
|
-
subtree: !0,
|
|
25
|
-
characterData: !1
|
|
26
|
-
});
|
|
27
|
-
}, 50);
|
|
28
|
-
}));
|
|
29
|
-
};
|
|
30
|
-
_initMathObserver() {
|
|
31
|
-
this._mathObserver || (this._mathObserver = new MutationObserver(() => {
|
|
32
|
-
this._scheduleMathRender();
|
|
33
|
-
}), this._mathObserver.observe(this, {
|
|
34
|
-
childList: !0,
|
|
35
|
-
subtree: !0,
|
|
36
|
-
characterData: !1
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
_disconnectMathObserver() {
|
|
40
|
-
this._mathObserver &&= (this._mathObserver.disconnect(), null);
|
|
41
|
-
}
|
|
42
|
-
pauseMathObserver = () => {
|
|
43
|
-
this._mathObserver && (this._mathObserver.disconnect(), this._mathObserverPaused = !0);
|
|
44
|
-
};
|
|
45
|
-
resumeMathObserver = () => {
|
|
46
|
-
this._mathObserverPaused && (this._mathObserverPaused = !1, this._mathObserver && this._mathObserver.observe(this, {
|
|
47
|
-
childList: !0,
|
|
48
|
-
subtree: !0,
|
|
49
|
-
characterData: !1
|
|
50
|
-
}));
|
|
51
|
-
};
|
|
52
|
-
set model(e) {
|
|
53
|
-
this._model = e, this.eliminateBlindAnswersFromSession(), this.dispatchEvent(new o(this.tagName.toLowerCase(), this.isComplete(), !!this._model)), this._audioInitialized = !1, this.render();
|
|
54
|
-
}
|
|
55
|
-
isComplete() {
|
|
56
|
-
let { autoplayAudioEnabled: e, choices: t, completeAudioEnabled: n, hasUnplacedChoices: r, possibleResponses: i, responseAreasToBeFilled: a } = this._model || {}, o = this;
|
|
57
|
-
if (e && n && !this.audioComplete && o) {
|
|
58
|
-
let e = o.querySelector("audio"), t = e && e.closest("#preview-prompt");
|
|
59
|
-
if (e && t) return !1;
|
|
60
|
-
}
|
|
61
|
-
if (!this._session || !this._session.answers) return !1;
|
|
62
|
-
let { answers: s } = this._session;
|
|
63
|
-
if (!Array.isArray(s)) return !1;
|
|
64
|
-
let c = s.filter((e) => e.choices.length).length >= a;
|
|
65
|
-
if ((t || []).some((e) => e.categoryCount === 0) || r) return c;
|
|
66
|
-
let l = s.map((e) => e.choices).flat();
|
|
67
|
-
return (i || []).some((e) => e.every((e) => l.includes(e)));
|
|
68
|
-
}
|
|
69
|
-
set session(e) {
|
|
70
|
-
e && !e.answers && (e.answers = []), this._session = e, this.render();
|
|
71
|
-
}
|
|
72
|
-
get session() {
|
|
73
|
-
return this._session;
|
|
74
|
-
}
|
|
75
|
-
eliminateBlindAnswersFromSession() {
|
|
76
|
-
let { answers: e = [] } = this._session || {}, { choices: t = [] } = this._model || {}, n = t.map((e) => e.id) || [], r = e.map((e) => (e.choices = (e?.choices || []).filter((e) => n.includes(e)), e));
|
|
77
|
-
r.length > 0 && this.changeAnswers(r);
|
|
78
|
-
}
|
|
79
|
-
changeAnswers(e) {
|
|
80
|
-
this._session.answers = e, this._session.selector = "Mouse", this.dispatchEvent(new s(this.tagName.toLowerCase(), this.isComplete())), this.render();
|
|
81
|
-
}
|
|
82
|
-
onShowCorrectToggle() {
|
|
83
|
-
r(this);
|
|
84
|
-
}
|
|
85
|
-
_createAudioInfoToast() {
|
|
86
|
-
let e = document.createElement("div");
|
|
87
|
-
e.id = "play-audio-info", Object.assign(e.style, {
|
|
88
|
-
position: "absolute",
|
|
89
|
-
top: 0,
|
|
90
|
-
width: "100%",
|
|
91
|
-
height: "100%",
|
|
92
|
-
display: "flex",
|
|
93
|
-
justifyContent: "center",
|
|
94
|
-
alignItems: "center",
|
|
95
|
-
background: "white",
|
|
96
|
-
zIndex: "1000",
|
|
97
|
-
cursor: "pointer"
|
|
98
|
-
});
|
|
99
|
-
let t = document.createElement("img");
|
|
100
|
-
return t.src = u, t.alt = "Click anywhere to enable audio autoplay", t.width = 500, t.height = 300, e.appendChild(t), e;
|
|
101
|
-
}
|
|
102
|
-
connectedCallback() {
|
|
103
|
-
this._initMathObserver(), new MutationObserver((e, t) => {
|
|
104
|
-
e.forEach((e) => {
|
|
105
|
-
if (e.type === "childList") {
|
|
106
|
-
if (this._audioInitialized) return;
|
|
107
|
-
let e = this.querySelector("audio"), n = e && e.closest("#preview-prompt");
|
|
108
|
-
if (!this._model || !this._model.autoplayAudioEnabled || e && !n || !e) return;
|
|
109
|
-
let r = this._createAudioInfoToast(), i = this.querySelector("#main-container"), a = () => {
|
|
110
|
-
this.querySelector("#play-audio-info") && (e.play(), i.removeChild(r)), document.removeEventListener("click", a);
|
|
111
|
-
};
|
|
112
|
-
setTimeout(() => {
|
|
113
|
-
e.paused && !this.querySelector("#play-audio-info") ? (i.appendChild(r), document.addEventListener("click", a)) : document.removeEventListener("click", a);
|
|
114
|
-
}, 500);
|
|
115
|
-
let o = () => {
|
|
116
|
-
this._session.audioStartTime = this._session.audioStartTime || (/* @__PURE__ */ new Date()).getTime();
|
|
117
|
-
let t = this.querySelector("#play-audio-info");
|
|
118
|
-
t && i.removeChild(t), e.removeEventListener("playing", o);
|
|
119
|
-
};
|
|
120
|
-
e.addEventListener("playing", o);
|
|
121
|
-
let c = () => {
|
|
122
|
-
this._session.audioEndTime = this._session.audioEndTime || (/* @__PURE__ */ new Date()).getTime();
|
|
123
|
-
let { audioStartTime: t, audioEndTime: n, waitTime: r } = this._session;
|
|
124
|
-
!r && t && n && (this._session.waitTime = n - t), this.audioComplete = !0, this.dispatchEvent(new s(this.tagName.toLowerCase(), this.isComplete())), e.removeEventListener("ended", c);
|
|
125
|
-
};
|
|
126
|
-
e.addEventListener("ended", c), this._audio = e, this._handlePlaying = o, this._handleEnded = c, this._enableAudio = a, this._audioInitialized = !0, t.disconnect();
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}).observe(this, {
|
|
130
|
-
childList: !0,
|
|
131
|
-
subtree: !0
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
disconnectedCallback() {
|
|
135
|
-
this._disconnectMathObserver(), document.removeEventListener("click", this._enableAudio), this._audio &&= (this._audio.removeEventListener("playing", this._handlePlaying), this._audio.removeEventListener("ended", this._handleEnded), null), this._root && this._root.unmount();
|
|
136
|
-
}
|
|
137
|
-
render() {
|
|
138
|
-
if (this._model && this._session) {
|
|
139
|
-
let r = t.createElement(e, {
|
|
140
|
-
model: this._model,
|
|
141
|
-
session: this._session,
|
|
142
|
-
onAnswersChange: this.changeAnswers.bind(this),
|
|
143
|
-
onShowCorrectToggle: this.onShowCorrectToggle.bind(this),
|
|
144
|
-
pauseMathObserver: this.pauseMathObserver,
|
|
145
|
-
resumeMathObserver: this.resumeMathObserver
|
|
146
|
-
});
|
|
147
|
-
this._root ||= n(this), this._root.render(r);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
//#endregion
|
|
152
|
-
export { m as default };
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './delivery/index.js';
|
package/dist/index.iife.d.ts
DELETED