@pie-element/match-list 7.1.2-next.5 → 7.1.3
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 +572 -0
- package/CHANGELOG.md +1499 -0
- package/LICENSE.md +5 -0
- package/README.md +1 -0
- package/controller/CHANGELOG.json +242 -0
- package/controller/CHANGELOG.md +1047 -0
- package/controller/lib/defaults.js +15 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +246 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/package.json +25 -0
- package/docs/config-schema.json +70 -0
- package/docs/config-schema.json.md +55 -0
- package/docs/demo/config.js +34 -0
- package/docs/demo/generate.js +54 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +6 -0
- package/docs/pie-schema.json +170 -0
- package/docs/pie-schema.json.md +104 -0
- package/lib/answer-area.js +168 -0
- package/lib/answer-area.js.map +1 -0
- package/lib/answer.js +267 -0
- package/lib/answer.js.map +1 -0
- package/lib/arrow.js +57 -0
- package/lib/arrow.js.map +1 -0
- package/lib/choices-list.js +60 -0
- package/lib/choices-list.js.map +1 -0
- package/lib/droppable-placeholder.js +60 -0
- package/lib/droppable-placeholder.js.map +1 -0
- package/lib/index.js +86 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +220 -0
- package/lib/main.js.map +1 -0
- package/package.json +22 -69
- package/controller.js +0 -1
- package/dist/browser/controller/index.js +0 -201
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -13062
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-DksDR3d3.js +0 -278
- package/dist/browser/dist-DksDR3d3.js.map +0 -1
- package/dist/controller/defaults.d.ts +0 -17
- package/dist/controller/defaults.js +0 -9
- package/dist/controller/index.d.ts +0 -38
- package/dist/controller/index.js +0 -105
- package/dist/delivery/answer-area.d.ts +0 -27
- package/dist/delivery/answer-area.js +0 -92
- package/dist/delivery/answer.d.ts +0 -40
- package/dist/delivery/answer.js +0 -176
- package/dist/delivery/arrow.d.ts +0 -17
- package/dist/delivery/arrow.js +0 -35
- package/dist/delivery/choices-list.d.ts +0 -21
- package/dist/delivery/choices-list.js +0 -35
- package/dist/delivery/droppable-placeholder.d.ts +0 -24
- package/dist/delivery/droppable-placeholder.js +0 -42
- package/dist/delivery/index.d.ts +0 -21
- package/dist/delivery/index.js +0 -49
- package/dist/delivery/main.d.ts +0 -26
- package/dist/delivery/main.js +0 -147
- 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
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/match-list/src/answer.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import React from 'react';
|
|
11
|
-
export declare class Answer extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
className: PropTypes.Requireable<string>;
|
|
14
|
-
isDragging: PropTypes.Requireable<boolean>;
|
|
15
|
-
id: PropTypes.Requireable<any>;
|
|
16
|
-
title: PropTypes.Requireable<string>;
|
|
17
|
-
isOver: PropTypes.Requireable<boolean>;
|
|
18
|
-
empty: PropTypes.Requireable<boolean>;
|
|
19
|
-
type: PropTypes.Requireable<string>;
|
|
20
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
21
|
-
correct: PropTypes.Requireable<boolean>;
|
|
22
|
-
};
|
|
23
|
-
componentDidMount(): void;
|
|
24
|
-
componentWillUnmount(): void;
|
|
25
|
-
handleTouchStart: any;
|
|
26
|
-
render(): React.JSX.Element;
|
|
27
|
-
}
|
|
28
|
-
declare function DragAndDropAnswer(props: any): React.JSX.Element;
|
|
29
|
-
declare namespace DragAndDropAnswer {
|
|
30
|
-
var propTypes: {
|
|
31
|
-
id: PropTypes.Requireable<any>;
|
|
32
|
-
instanceId: PropTypes.Requireable<string>;
|
|
33
|
-
promptId: PropTypes.Requireable<any>;
|
|
34
|
-
title: PropTypes.Requireable<string>;
|
|
35
|
-
draggable: PropTypes.Requireable<boolean>;
|
|
36
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
37
|
-
type: PropTypes.Requireable<string>;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export default DragAndDropAnswer;
|
package/dist/delivery/answer.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "debug";
|
|
3
|
-
import n from "prop-types";
|
|
4
|
-
import { PlaceHolder as r } from "@pie-lib/drag";
|
|
5
|
-
import { useDraggable as i, useDroppable as a } from "@dnd-kit/core";
|
|
6
|
-
import { color as o } from "@pie-lib/render-ui";
|
|
7
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
8
|
-
import { styled as c } from "@mui/material/styles";
|
|
9
|
-
import { isEmpty as l } from "@pie-element/shared-lodash";
|
|
10
|
-
//#region src/delivery/answer.tsx
|
|
11
|
-
var u = t("pie-elements:match-title:answer"), d = c("div")(({ theme: e }) => ({
|
|
12
|
-
width: "100%",
|
|
13
|
-
fontSize: "18px",
|
|
14
|
-
textAlign: "center",
|
|
15
|
-
color: `rgba(${e.palette.common.black}, 0.6)`
|
|
16
|
-
})), f = ({ index: e, isOver: t, disabled: n, type: i }) => /* @__PURE__ */ s(r, {
|
|
17
|
-
extraStyles: {
|
|
18
|
-
display: "flex",
|
|
19
|
-
padding: "0",
|
|
20
|
-
alignItems: "center",
|
|
21
|
-
justifyContent: "center",
|
|
22
|
-
height: "40px"
|
|
23
|
-
},
|
|
24
|
-
disabled: n,
|
|
25
|
-
isOver: t,
|
|
26
|
-
type: i,
|
|
27
|
-
children: e !== void 0 && /* @__PURE__ */ s(d, { children: e })
|
|
28
|
-
});
|
|
29
|
-
f.propTypes = {
|
|
30
|
-
index: n.number,
|
|
31
|
-
isOver: n.bool,
|
|
32
|
-
disabled: n.bool,
|
|
33
|
-
type: n.string
|
|
34
|
-
};
|
|
35
|
-
var p = c("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i }) => ({
|
|
36
|
-
color: o.text(),
|
|
37
|
-
backgroundColor: o.white(),
|
|
38
|
-
border: `1px solid ${i === "correct" ? o.correct() : i === "incorrect" ? o.incorrect() : e.palette.grey[400]}`,
|
|
39
|
-
cursor: r ? "not-allowed" : "pointer",
|
|
40
|
-
width: "100%",
|
|
41
|
-
padding: "10px",
|
|
42
|
-
boxSizing: "border-box",
|
|
43
|
-
overflow: "hidden",
|
|
44
|
-
transition: "opacity 200ms linear",
|
|
45
|
-
wordBreak: "break-word",
|
|
46
|
-
opacity: t && !r ? .5 : n && !r ? .2 : 1,
|
|
47
|
-
touchAction: "none"
|
|
48
|
-
})), m = (e) => {
|
|
49
|
-
let { isDragging: t, isOver: n, title: r, disabled: i, empty: a, outcome: o, guideIndex: c, type: l } = e;
|
|
50
|
-
return a ? /* @__PURE__ */ s(f, {
|
|
51
|
-
index: c,
|
|
52
|
-
isOver: n,
|
|
53
|
-
disabled: i,
|
|
54
|
-
type: l
|
|
55
|
-
}) : /* @__PURE__ */ s(p, {
|
|
56
|
-
isDragging: t,
|
|
57
|
-
isOver: n,
|
|
58
|
-
disabled: i,
|
|
59
|
-
outcome: o,
|
|
60
|
-
dangerouslySetInnerHTML: { __html: r }
|
|
61
|
-
});
|
|
62
|
-
}, h = c("div")(({ correct: e, theme: t }) => ({
|
|
63
|
-
boxSizing: "border-box",
|
|
64
|
-
minHeight: 40,
|
|
65
|
-
minWidth: "200px",
|
|
66
|
-
overflow: "hidden",
|
|
67
|
-
margin: t.spacing(.5),
|
|
68
|
-
padding: "0px",
|
|
69
|
-
textAlign: "center",
|
|
70
|
-
height: "initial",
|
|
71
|
-
border: e === !0 ? `1px solid var(--feedback-correct-bg-color, ${o.correct()})` : e === !1 ? `1px solid var(--feedback-incorrect-bg-color, ${o.incorrect()})` : "none"
|
|
72
|
-
})), g = class extends e.Component {
|
|
73
|
-
static propTypes = {
|
|
74
|
-
className: n.string,
|
|
75
|
-
isDragging: n.bool,
|
|
76
|
-
id: n.any,
|
|
77
|
-
title: n.string,
|
|
78
|
-
isOver: n.bool,
|
|
79
|
-
empty: n.bool,
|
|
80
|
-
type: n.string,
|
|
81
|
-
disabled: n.bool,
|
|
82
|
-
correct: n.bool
|
|
83
|
-
};
|
|
84
|
-
componentDidMount() {
|
|
85
|
-
this.ref && this.ref.addEventListener("touchstart", this.handleTouchStart, { passive: !0 });
|
|
86
|
-
}
|
|
87
|
-
componentWillUnmount() {
|
|
88
|
-
this.ref && this.ref.removeEventListener("touchstart", this.handleTouchStart);
|
|
89
|
-
}
|
|
90
|
-
handleTouchStart = (e) => {};
|
|
91
|
-
render() {
|
|
92
|
-
let { id: e, title: t, isDragging: n = !1, className: r, disabled: i, isOver: a = !1, type: o, correct: c } = this.props;
|
|
93
|
-
return u("[render], props: ", this.props), /* @__PURE__ */ s(h, {
|
|
94
|
-
correct: c,
|
|
95
|
-
className: r,
|
|
96
|
-
ref: (e) => this.ref = e,
|
|
97
|
-
children: /* @__PURE__ */ s(m, {
|
|
98
|
-
title: t,
|
|
99
|
-
id: e,
|
|
100
|
-
isOver: a,
|
|
101
|
-
empty: l(t),
|
|
102
|
-
isDragging: n,
|
|
103
|
-
disabled: i,
|
|
104
|
-
type: o
|
|
105
|
-
})
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
function _(e) {
|
|
110
|
-
let { id: t, instanceId: n, promptId: r, draggable: o = !0, disabled: c = !1, type: l } = e, u = `${l || "answer"}-${t}`, d = r == null ? void 0 : `drop-${r}`, { attributes: f, listeners: p, setNodeRef: m, transform: h, transition: _, isDragging: v } = i({
|
|
111
|
-
id: u,
|
|
112
|
-
data: {
|
|
113
|
-
type: l || "answer",
|
|
114
|
-
id: t,
|
|
115
|
-
instanceId: n,
|
|
116
|
-
value: e.title,
|
|
117
|
-
promptId: r
|
|
118
|
-
},
|
|
119
|
-
disabled: !o || c
|
|
120
|
-
}), y = a({
|
|
121
|
-
id: d,
|
|
122
|
-
data: d ? {
|
|
123
|
-
type: "drop-zone",
|
|
124
|
-
promptId: r,
|
|
125
|
-
instanceId: n
|
|
126
|
-
} : void 0,
|
|
127
|
-
disabled: c || !d
|
|
128
|
-
}), b = y.setNodeRef, x = y.isOver, S = h ? `translate3d(${h.x}px, ${h.y}px, 0)` : void 0;
|
|
129
|
-
return d ? /* @__PURE__ */ s("div", {
|
|
130
|
-
ref: b,
|
|
131
|
-
style: {
|
|
132
|
-
flex: 1,
|
|
133
|
-
transform: S,
|
|
134
|
-
transition: _,
|
|
135
|
-
opacity: v ? .5 : 1,
|
|
136
|
-
backgroundColor: x ? "rgba(0,0,0,0.05)" : "transparent"
|
|
137
|
-
},
|
|
138
|
-
children: /* @__PURE__ */ s("div", {
|
|
139
|
-
ref: m,
|
|
140
|
-
...p,
|
|
141
|
-
...f,
|
|
142
|
-
children: /* @__PURE__ */ s(g, {
|
|
143
|
-
...e,
|
|
144
|
-
isDragging: v,
|
|
145
|
-
isOver: x
|
|
146
|
-
})
|
|
147
|
-
})
|
|
148
|
-
}) : /* @__PURE__ */ s("div", {
|
|
149
|
-
ref: m,
|
|
150
|
-
...p,
|
|
151
|
-
...f,
|
|
152
|
-
style: {
|
|
153
|
-
transform: S,
|
|
154
|
-
transition: _,
|
|
155
|
-
cursor: c ? "not-allowed" : "grab",
|
|
156
|
-
opacity: v ? .5 : 1,
|
|
157
|
-
touchAction: o && !c ? "none" : "auto"
|
|
158
|
-
},
|
|
159
|
-
children: /* @__PURE__ */ s(g, {
|
|
160
|
-
...e,
|
|
161
|
-
isDragging: v,
|
|
162
|
-
isOver: !1
|
|
163
|
-
})
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
_.propTypes = {
|
|
167
|
-
id: n.any,
|
|
168
|
-
instanceId: n.string,
|
|
169
|
-
promptId: n.any,
|
|
170
|
-
title: n.string,
|
|
171
|
-
draggable: n.bool,
|
|
172
|
-
disabled: n.bool,
|
|
173
|
-
type: n.string
|
|
174
|
-
};
|
|
175
|
-
//#endregion
|
|
176
|
-
export { g as Answer, _ as default };
|
package/dist/delivery/arrow.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/match-list/src/arrow.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class Arrow extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
direction: PropTypes.Requireable<string>;
|
|
14
|
-
};
|
|
15
|
-
render(): React.JSX.Element;
|
|
16
|
-
}
|
|
17
|
-
export default Arrow;
|
package/dist/delivery/arrow.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
-
import { styled as i } from "@mui/material/styles";
|
|
5
|
-
import a from "@mui/icons-material/ArrowDropDown";
|
|
6
|
-
//#region src/delivery/arrow.tsx
|
|
7
|
-
var o = i("div")({
|
|
8
|
-
display: "inline-block",
|
|
9
|
-
position: "relative",
|
|
10
|
-
width: "100%"
|
|
11
|
-
}), s = i("span")(({ theme: e, isRight: t }) => ({
|
|
12
|
-
backgroundColor: e.palette.grey[500],
|
|
13
|
-
bottom: t ? 20 : 19,
|
|
14
|
-
content: "\"\"",
|
|
15
|
-
display: "block",
|
|
16
|
-
height: 1,
|
|
17
|
-
left: 20,
|
|
18
|
-
position: "absolute",
|
|
19
|
-
width: "100%"
|
|
20
|
-
})), c = class extends e.Component {
|
|
21
|
-
static propTypes = { direction: t.string };
|
|
22
|
-
render() {
|
|
23
|
-
let { direction: e } = this.props;
|
|
24
|
-
return /* @__PURE__ */ r(o, {
|
|
25
|
-
style: e === "left" ? {} : { transform: "rotate(180deg)" },
|
|
26
|
-
children: [/* @__PURE__ */ n(a, { style: {
|
|
27
|
-
transform: "rotate(90deg)",
|
|
28
|
-
color: "#979797",
|
|
29
|
-
fontSize: 40
|
|
30
|
-
} }), /* @__PURE__ */ n(s, { isRight: e !== "left" })]
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
//#endregion
|
|
35
|
-
export { c as default };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/match-list/src/choices-list.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class ChoicesList extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
session: PropTypes.Validator<object>;
|
|
14
|
-
instanceId: PropTypes.Validator<string>;
|
|
15
|
-
model: PropTypes.Validator<object>;
|
|
16
|
-
disabled: PropTypes.Validator<boolean>;
|
|
17
|
-
onRemoveAnswer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
-
};
|
|
19
|
-
render(): React.JSX.Element;
|
|
20
|
-
}
|
|
21
|
-
export default ChoicesList;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import e from "./answer.js";
|
|
2
|
-
import t from "./droppable-placeholder.js";
|
|
3
|
-
import n from "react";
|
|
4
|
-
import r from "prop-types";
|
|
5
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
-
import { styled as a } from "@mui/material/styles";
|
|
7
|
-
import { find as o, isEmpty as s, isUndefined as c } from "@pie-element/shared-lodash";
|
|
8
|
-
//#region src/delivery/choices-list.tsx
|
|
9
|
-
var l = a("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), u = class extends n.Component {
|
|
10
|
-
static propTypes = {
|
|
11
|
-
session: r.object.isRequired,
|
|
12
|
-
instanceId: r.string.isRequired,
|
|
13
|
-
model: r.object.isRequired,
|
|
14
|
-
disabled: r.bool.isRequired,
|
|
15
|
-
onRemoveAnswer: r.func
|
|
16
|
-
};
|
|
17
|
-
render() {
|
|
18
|
-
let { model: n, disabled: r, session: a, instanceId: u, onRemoveAnswer: d } = this.props, { config: f } = n, { duplicates: p } = f;
|
|
19
|
-
return /* @__PURE__ */ i(l, { children: /* @__PURE__ */ i(t, {
|
|
20
|
-
id: "choices-pool",
|
|
21
|
-
disabled: r,
|
|
22
|
-
onRemoveAnswer: d,
|
|
23
|
-
children: f.answers.filter((e) => p || s(a) || !a.value || c(o(a.value, (t) => t === e.id))).map((t) => /* @__PURE__ */ i(e, {
|
|
24
|
-
instanceId: u,
|
|
25
|
-
draggable: !0,
|
|
26
|
-
disabled: r,
|
|
27
|
-
session: a,
|
|
28
|
-
type: "choice",
|
|
29
|
-
...t
|
|
30
|
-
}, t.id))
|
|
31
|
-
}) });
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
//#endregion
|
|
35
|
-
export { u as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/match-list/src/droppable-placeholder.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare function DroppablePlaceholder({ id, disabled, children, ...rest }: {
|
|
12
|
-
[x: string]: any;
|
|
13
|
-
id: any;
|
|
14
|
-
disabled: any;
|
|
15
|
-
children: any;
|
|
16
|
-
}): React.JSX.Element;
|
|
17
|
-
export declare namespace DroppablePlaceholder {
|
|
18
|
-
var propTypes: {
|
|
19
|
-
id: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
20
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
21
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export default DroppablePlaceholder;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import e from "prop-types";
|
|
3
|
-
import { MatchDroppablePlaceholder as t } from "@pie-lib/drag";
|
|
4
|
-
import { useDroppable as n } from "@dnd-kit/core";
|
|
5
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
-
import { styled as i } from "@mui/material/styles";
|
|
7
|
-
//#region src/delivery/droppable-placeholder.tsx
|
|
8
|
-
var a = i("div")(({ theme: e }) => ({
|
|
9
|
-
alignItems: "center",
|
|
10
|
-
display: "flex",
|
|
11
|
-
flexDirection: "row",
|
|
12
|
-
flexWrap: "wrap",
|
|
13
|
-
justifyContent: "space-between",
|
|
14
|
-
marginTop: e.spacing(1),
|
|
15
|
-
marginBottom: e.spacing(1),
|
|
16
|
-
minHeight: 50,
|
|
17
|
-
transition: "background-color 200ms ease"
|
|
18
|
-
}));
|
|
19
|
-
function o({ id: e, disabled: i, children: o, ...s }) {
|
|
20
|
-
let { setNodeRef: c, isOver: l } = n({
|
|
21
|
-
id: e || "choices-pool",
|
|
22
|
-
data: { type: "choices-pool" },
|
|
23
|
-
disabled: i
|
|
24
|
-
});
|
|
25
|
-
return /* @__PURE__ */ r(a, {
|
|
26
|
-
ref: c,
|
|
27
|
-
style: { backgroundColor: l ? "rgba(0,0,0,0.05)" : "transparent" },
|
|
28
|
-
...s,
|
|
29
|
-
children: /* @__PURE__ */ r(t, {
|
|
30
|
-
id: e,
|
|
31
|
-
disabled: i,
|
|
32
|
-
children: o
|
|
33
|
-
})
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
o.propTypes = {
|
|
37
|
-
id: e.oneOfType([e.string, e.number]),
|
|
38
|
-
disabled: e.bool,
|
|
39
|
-
children: e.node
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
42
|
-
export { o as default };
|
package/dist/delivery/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/match-list/src/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import Main from './main.js';
|
|
10
|
-
export { Main as Component };
|
|
11
|
-
export declare const isComplete: (session: any, model: any) => boolean;
|
|
12
|
-
export default class MatchList extends HTMLElement {
|
|
13
|
-
constructor();
|
|
14
|
-
set model(m: any);
|
|
15
|
-
set session(s: any);
|
|
16
|
-
get session(): any;
|
|
17
|
-
sessionChanged(s: any): void;
|
|
18
|
-
connectedCallback(): void;
|
|
19
|
-
_render(): void;
|
|
20
|
-
disconnectedCallback(): void;
|
|
21
|
-
}
|
package/dist/delivery/index.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import e from "./main.js";
|
|
2
|
-
import t from "react";
|
|
3
|
-
import { createRoot as n } from "react-dom/client";
|
|
4
|
-
import r from "debug";
|
|
5
|
-
import { SessionChangedEvent as i } from "@pie-element/shared-player-events";
|
|
6
|
-
import { renderMath as a } from "@pie-element/shared-math-rendering-mathjax";
|
|
7
|
-
//#region src/delivery/index.ts
|
|
8
|
-
var o = r("pie-ui:graph-lines"), s = (e, t) => {
|
|
9
|
-
if (!e) return !1;
|
|
10
|
-
let n = e.value, r = !0;
|
|
11
|
-
return n && (t.config.prompts || []).forEach((e) => {
|
|
12
|
-
Number.isFinite(n[e.id]) || (r = !1);
|
|
13
|
-
}), r;
|
|
14
|
-
}, c = class extends HTMLElement {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(), this._root = null;
|
|
17
|
-
}
|
|
18
|
-
set model(e) {
|
|
19
|
-
this._model = e, this._render();
|
|
20
|
-
}
|
|
21
|
-
set session(e) {
|
|
22
|
-
this._session = e, this._render();
|
|
23
|
-
}
|
|
24
|
-
get session() {
|
|
25
|
-
return this._session;
|
|
26
|
-
}
|
|
27
|
-
sessionChanged(e) {
|
|
28
|
-
this._session.value = e.value, this.dispatchEvent(new i(this.tagName.toLowerCase(), s(this._session, this._model))), o("session: ", this._session), this._render();
|
|
29
|
-
}
|
|
30
|
-
connectedCallback() {
|
|
31
|
-
this._render();
|
|
32
|
-
}
|
|
33
|
-
_render() {
|
|
34
|
-
if (!this._model || !this._session) return;
|
|
35
|
-
let r = t.createElement(e, {
|
|
36
|
-
model: this._model,
|
|
37
|
-
session: this._session,
|
|
38
|
-
onSessionChange: this.sessionChanged.bind(this)
|
|
39
|
-
});
|
|
40
|
-
this._root ||= n(this), this._root.render(r), queueMicrotask(() => {
|
|
41
|
-
a(this);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
disconnectedCallback() {
|
|
45
|
-
this._root && this._root.unmount();
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
//#endregion
|
|
49
|
-
export { e as Component, c as default, s as isComplete };
|
package/dist/delivery/main.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/match-list/src/main.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class Main extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
session: PropTypes.Validator<object>;
|
|
14
|
-
onSessionChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
model: PropTypes.Validator<object>;
|
|
16
|
-
prompt: PropTypes.Requireable<string>;
|
|
17
|
-
};
|
|
18
|
-
constructor(props: any);
|
|
19
|
-
onRemoveAnswer(id: any): void;
|
|
20
|
-
onDragStart: any;
|
|
21
|
-
onPlaceAnswer: any;
|
|
22
|
-
toggleShowCorrect: any;
|
|
23
|
-
renderDragOverlay: any;
|
|
24
|
-
render(): React.JSX.Element;
|
|
25
|
-
}
|
|
26
|
-
export default Main;
|
package/dist/delivery/main.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Answer as e } from "./answer.js";
|
|
2
|
-
import t from "./answer-area.js";
|
|
3
|
-
import n from "./choices-list.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import i from "prop-types";
|
|
6
|
-
import { swap as a } from "@pie-lib/drag";
|
|
7
|
-
import { DndContext as o, DragOverlay as s } from "@dnd-kit/core";
|
|
8
|
-
import { restrictToFirstScrollableAncestor as c } from "@dnd-kit/modifiers";
|
|
9
|
-
import l from "@pie-lib/correct-answer-toggle";
|
|
10
|
-
import * as u from "@pie-lib/render-ui";
|
|
11
|
-
import { Feedback as d, PreviewPrompt as f, color as p } from "@pie-lib/render-ui";
|
|
12
|
-
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
13
|
-
import { styled as g } from "@mui/material/styles";
|
|
14
|
-
import { findKey as _, isUndefined as v, uniqueId as y } from "@pie-element/shared-lodash";
|
|
15
|
-
//#region src/delivery/main.tsx
|
|
16
|
-
function b(e) {
|
|
17
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
18
|
-
}
|
|
19
|
-
function x(e, t) {
|
|
20
|
-
return !e || b(e) ? e : b(e.default) ? e.default : t && b(e[t]) ? e[t] : t && b(e[t]?.default) ? e[t].default : e;
|
|
21
|
-
}
|
|
22
|
-
var S = x(f, "PreviewPrompt") || x(E.PreviewPrompt, "PreviewPrompt"), C = x(d, "Feedback") || x(E.Feedback, "Feedback"), w = u, T = w.default, E = T && typeof T == "object" ? T : w, D = g("div")({
|
|
23
|
-
display: "flex",
|
|
24
|
-
flexDirection: "column",
|
|
25
|
-
justifyContent: "center",
|
|
26
|
-
color: p.text(),
|
|
27
|
-
backgroundColor: p.background()
|
|
28
|
-
}), O = class extends r.Component {
|
|
29
|
-
static propTypes = {
|
|
30
|
-
session: i.object.isRequired,
|
|
31
|
-
onSessionChange: i.func,
|
|
32
|
-
model: i.object.isRequired,
|
|
33
|
-
prompt: i.string
|
|
34
|
-
};
|
|
35
|
-
constructor(e) {
|
|
36
|
-
super(e), this.instanceId = y(), this.state = {
|
|
37
|
-
showCorrectAnswer: !1,
|
|
38
|
-
draggingElement: null
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
onRemoveAnswer(e) {
|
|
42
|
-
let { session: t, onSessionChange: n } = this.props;
|
|
43
|
-
t.value[e] = void 0, n(t);
|
|
44
|
-
}
|
|
45
|
-
onDragStart = (e) => {
|
|
46
|
-
let { active: t } = e;
|
|
47
|
-
if (t?.data?.current) {
|
|
48
|
-
let e = null, n = t.node?.current;
|
|
49
|
-
if (n) {
|
|
50
|
-
let { width: t, height: r } = n.getBoundingClientRect();
|
|
51
|
-
e = {
|
|
52
|
-
width: t,
|
|
53
|
-
height: r
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
this.setState({ draggingElement: {
|
|
57
|
-
...t.data.current,
|
|
58
|
-
rect: e
|
|
59
|
-
} });
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
onPlaceAnswer = (e) => {
|
|
63
|
-
this.setState({ draggingElement: null });
|
|
64
|
-
let { active: t, over: n } = e;
|
|
65
|
-
if (!t) return;
|
|
66
|
-
let r = t.data.current, i = n?.data.current;
|
|
67
|
-
if (!r) return;
|
|
68
|
-
let { session: o, onSessionChange: s, model: c } = this.props, { config: { duplicates: l } } = c;
|
|
69
|
-
if (v(o.value) && (o.value = {}), i.type === "choices-pool" && r.promptId !== void 0) {
|
|
70
|
-
o.value[r.promptId] = void 0, s(o);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
let u = r.id, d = r.promptId;
|
|
74
|
-
if (i && i.type === "drop-zone" && i.promptId != null) {
|
|
75
|
-
let e = i.promptId;
|
|
76
|
-
if (r.type === "choice" && i.type === "drop-zone" && e !== void 0) {
|
|
77
|
-
let t = _(o.value, (e) => e === u);
|
|
78
|
-
t && !l ? o.value = a(o.value, t, e) : o.value[e] = u;
|
|
79
|
-
} else if (r.type === "target" && d != null && d !== e) {
|
|
80
|
-
let t = o.value[e] != null;
|
|
81
|
-
if (t && !l) {
|
|
82
|
-
let t = o.value[e];
|
|
83
|
-
o.value[e] = u, o.value[d] = t;
|
|
84
|
-
} else t || (o.value[e] = u, delete o.value[d]);
|
|
85
|
-
}
|
|
86
|
-
s(o);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
toggleShowCorrect = () => {
|
|
90
|
-
this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
|
|
91
|
-
};
|
|
92
|
-
renderDragOverlay = () => {
|
|
93
|
-
let { draggingElement: t } = this.state;
|
|
94
|
-
return t ? /* @__PURE__ */ m(e, {
|
|
95
|
-
id: t.id,
|
|
96
|
-
title: t.value,
|
|
97
|
-
disabled: !1,
|
|
98
|
-
isDragging: !1,
|
|
99
|
-
style: t.rect ? {
|
|
100
|
-
width: t.rect.width,
|
|
101
|
-
height: t.rect.height,
|
|
102
|
-
boxSizing: "border-box"
|
|
103
|
-
} : {}
|
|
104
|
-
}) : null;
|
|
105
|
-
};
|
|
106
|
-
render() {
|
|
107
|
-
let { showCorrectAnswer: e } = this.state, { model: r, session: i } = this.props, { config: a, mode: u } = r, { prompt: d, language: f } = a;
|
|
108
|
-
return /* @__PURE__ */ h(o, {
|
|
109
|
-
onDragStart: this.onDragStart,
|
|
110
|
-
onDragEnd: this.onPlaceAnswer,
|
|
111
|
-
modifiers: [c],
|
|
112
|
-
children: [/* @__PURE__ */ h(D, { children: [
|
|
113
|
-
/* @__PURE__ */ m(S, {
|
|
114
|
-
className: "prompt",
|
|
115
|
-
prompt: d
|
|
116
|
-
}),
|
|
117
|
-
/* @__PURE__ */ m(l, {
|
|
118
|
-
show: u === "evaluate",
|
|
119
|
-
toggled: e,
|
|
120
|
-
onToggle: this.toggleShowCorrect,
|
|
121
|
-
language: f
|
|
122
|
-
}),
|
|
123
|
-
/* @__PURE__ */ m(t, {
|
|
124
|
-
instanceId: this.instanceId,
|
|
125
|
-
model: r,
|
|
126
|
-
session: i,
|
|
127
|
-
onRemoveAnswer: (e) => this.onRemoveAnswer(e),
|
|
128
|
-
disabled: u !== "gather",
|
|
129
|
-
showCorrect: e
|
|
130
|
-
}),
|
|
131
|
-
/* @__PURE__ */ m(n, {
|
|
132
|
-
instanceId: this.instanceId,
|
|
133
|
-
model: r,
|
|
134
|
-
session: i,
|
|
135
|
-
disabled: u !== "gather",
|
|
136
|
-
onRemoveAnswer: (e) => this.onRemoveAnswer(e)
|
|
137
|
-
}),
|
|
138
|
-
r.correctness && r.feedback && !e && /* @__PURE__ */ m(C, {
|
|
139
|
-
correctness: r.correctness.correctness,
|
|
140
|
-
feedback: r.feedback
|
|
141
|
-
})
|
|
142
|
-
] }), /* @__PURE__ */ m(s, { children: this.renderDragOverlay() })]
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
//#endregion
|
|
147
|
-
export { O 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