@pie-element/placement-ordering 14.1.2-next.5 → 14.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 +1312 -0
- package/CHANGELOG.md +2444 -0
- package/LICENSE.md +5 -0
- package/README.md +57 -0
- package/configure/CHANGELOG.json +952 -0
- package/configure/CHANGELOG.md +2139 -0
- package/configure/lib/choice-editor.js +252 -0
- package/configure/lib/choice-editor.js.map +1 -0
- package/configure/lib/choice-tile.js +205 -0
- package/configure/lib/choice-tile.js.map +1 -0
- package/configure/lib/defaults.js +211 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/design.js +427 -0
- package/configure/lib/design.js.map +1 -0
- package/configure/lib/help.js +14 -0
- package/configure/lib/help.js.map +1 -0
- package/configure/lib/index.js +155 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/utils.js +108 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +26 -0
- package/controller/CHANGELOG.json +517 -0
- package/controller/CHANGELOG.md +1518 -0
- package/controller/lib/defaults.js +29 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +285 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/scoring.js +109 -0
- package/controller/lib/scoring.js.map +1 -0
- package/controller/package.json +15 -0
- package/docs/config-schema.json +2964 -0
- package/docs/config-schema.json.md +2190 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +50 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +7 -0
- package/docs/pie-schema.json +1613 -0
- package/docs/pie-schema.json.md +973 -0
- package/icon.png +0 -0
- package/lib/index.js +122 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +32 -0
- package/lib/main.js.map +1 -0
- package/lib/ordering.js +165 -0
- package/lib/ordering.js.map +1 -0
- package/lib/placement-ordering.js +419 -0
- package/lib/placement-ordering.js.map +1 -0
- package/lib/tile.js +259 -0
- package/lib/tile.js.map +1 -0
- package/lib/tiler.js +165 -0
- package/lib/tiler.js.map +1 -0
- package/lib/utils.js +18 -0
- package/lib/utils.js.map +1 -0
- package/package.json +21 -88
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/choice-editor.d.ts +0 -39
- package/dist/author/choice-editor.js +0 -156
- package/dist/author/choice-tile.d.ts +0 -40
- package/dist/author/choice-tile.js +0 -132
- package/dist/author/defaults.d.ts +0 -213
- package/dist/author/defaults.js +0 -159
- package/dist/author/design.d.ts +0 -21
- package/dist/author/design.js +0 -273
- package/dist/author/help.d.ts +0 -11
- package/dist/author/index.d.ts +0 -45
- package/dist/author/index.js +0 -85
- package/dist/author/utils.d.ts +0 -15
- package/dist/author/utils.js +0 -62
- package/dist/browser/author/index.js +0 -46600
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/browser-DHPggtaA.js +0 -376
- package/dist/browser/browser-DHPggtaA.js.map +0 -1
- package/dist/browser/controller/index.js +0 -242
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -1035
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-D9ARZhQk.js +0 -1426
- package/dist/browser/dist-D9ARZhQk.js.map +0 -1
- package/dist/browser/drag-provider-C1slTlsc.js +0 -10555
- package/dist/browser/drag-provider-C1slTlsc.js.map +0 -1
- package/dist/browser/placement-ordering.css +0 -2
- package/dist/controller/defaults.d.ts +0 -31
- package/dist/controller/defaults.js +0 -25
- package/dist/controller/index.d.ts +0 -29
- package/dist/controller/index.js +0 -123
- package/dist/controller/scoring.d.ts +0 -27
- package/dist/controller/scoring.js +0 -30
- package/dist/delivery/index.d.ts +0 -26
- package/dist/delivery/index.js +0 -70
- package/dist/delivery/main.d.ts +0 -19
- package/dist/delivery/main.js +0 -22
- package/dist/delivery/ordering.d.ts +0 -18
- package/dist/delivery/ordering.js +0 -93
- package/dist/delivery/placement-ordering.d.ts +0 -28
- package/dist/delivery/placement-ordering.js +0 -213
- package/dist/delivery/tile.d.ts +0 -28
- package/dist/delivery/tile.js +0 -165
- package/dist/delivery/tiler.d.ts +0 -42
- package/dist/delivery/tiler.js +0 -89
- package/dist/delivery/utils.d.ts +0 -9
- package/dist/delivery/utils.js +0 -8
- 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,213 +0,0 @@
|
|
|
1
|
-
import { HorizontalTiler as e, VerticalTiler as t } from "./tiler.js";
|
|
2
|
-
import { buildState as n, reducer as r } from "./ordering.js";
|
|
3
|
-
import { haveSameValuesButDifferentOrder as i } from "./utils.js";
|
|
4
|
-
import a from "react";
|
|
5
|
-
import { difference as o, isEqual as s, uniqueId as c } from "@pie-element/shared-lodash";
|
|
6
|
-
import l from "debug";
|
|
7
|
-
import { renderMath as u } from "@pie-element/shared-math-rendering-mathjax";
|
|
8
|
-
import d from "prop-types";
|
|
9
|
-
import f from "react-dom";
|
|
10
|
-
import { styled as p } from "@mui/material/styles";
|
|
11
|
-
import { closestCenter as m } from "@dnd-kit/core";
|
|
12
|
-
import * as h from "@pie-lib/render-ui";
|
|
13
|
-
import { Collapsible as g, Feedback as _, PreviewPrompt as v, UiLayout as y, color as b, hasMedia as x, hasText as S } from "@pie-lib/render-ui";
|
|
14
|
-
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
15
|
-
import T from "@pie-lib/translator";
|
|
16
|
-
import E from "@pie-lib/correct-answer-toggle";
|
|
17
|
-
import { DragProvider as D } from "@pie-lib/drag";
|
|
18
|
-
//#region src/delivery/placement-ordering.tsx
|
|
19
|
-
function O(e) {
|
|
20
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
21
|
-
}
|
|
22
|
-
function k(e, t) {
|
|
23
|
-
return !e || O(e) ? e : O(e.default) ? e.default : t && O(e[t]) ? e[t] : t && O(e[t]?.default) ? e[t].default : e;
|
|
24
|
-
}
|
|
25
|
-
var A = k(y, "UiLayout") || k(I.UiLayout, "UiLayout"), j = k(v, "PreviewPrompt") || k(I.PreviewPrompt, "PreviewPrompt"), M = k(_, "Feedback") || k(I.Feedback, "Feedback"), N = k(g, "Collapsible") || k(I.Collapsible, "Collapsible"), P = h, F = P.default, I = F && typeof F == "object" ? F : P, { translator: L } = T, R = l("pie-elements:placement-ordering"), z = p("div")({
|
|
26
|
-
color: b.text(),
|
|
27
|
-
backgroundColor: b.background(),
|
|
28
|
-
display: "flex",
|
|
29
|
-
flexDirection: "column",
|
|
30
|
-
alignItems: "center",
|
|
31
|
-
boxSizing: "border-box"
|
|
32
|
-
}), B = p("div")(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), V = p("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), H = p(E)(({ theme: e }) => ({ paddingBottom: e.spacing(1) })), U = p(N)(({ theme: e }) => ({
|
|
33
|
-
marginBottom: e.spacing(2),
|
|
34
|
-
alignSelf: "flex-start"
|
|
35
|
-
})), W = (e) => {
|
|
36
|
-
let { tiler: t, ordering: n, onDropChoice: r, onRemoveChoice: i, ...a } = e;
|
|
37
|
-
return /* @__PURE__ */ C(t, {
|
|
38
|
-
...a,
|
|
39
|
-
tiles: n.tiles,
|
|
40
|
-
onDropChoice: (e, t) => r(e, t, n),
|
|
41
|
-
onRemoveChoice: (e) => i(e, n)
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
W.propTypes = {
|
|
45
|
-
tiler: d.func,
|
|
46
|
-
ordering: d.any,
|
|
47
|
-
onDropChoice: d.func,
|
|
48
|
-
onRemoveChoice: d.func
|
|
49
|
-
};
|
|
50
|
-
var G = class extends a.Component {
|
|
51
|
-
static propTypes = {
|
|
52
|
-
onSessionChange: d.func.isRequired,
|
|
53
|
-
model: d.object.isRequired,
|
|
54
|
-
session: d.oneOfType([d.array.isRequired, d.object.isRequired])
|
|
55
|
-
};
|
|
56
|
-
constructor(e) {
|
|
57
|
-
super(e), this.instanceId = c();
|
|
58
|
-
let { value: t, needsReset: n } = this.validateSession(e);
|
|
59
|
-
this.state = { showingCorrect: !1 };
|
|
60
|
-
let { model: r } = e || {}, { env: i } = r || {}, { mode: a } = i || {};
|
|
61
|
-
n && a === "gather" && this.props.onSessionChange({
|
|
62
|
-
...e.session,
|
|
63
|
-
value: t
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
toggleCorrect = (e) => this.setState({ showingCorrect: e });
|
|
67
|
-
componentDidUpdate() {
|
|
68
|
-
u(f.findDOMNode(this));
|
|
69
|
-
}
|
|
70
|
-
validateSession = ({ model: e, session: t }, n = !1) => {
|
|
71
|
-
let { config: r, choices: i } = e || {}, { includeTargets: a } = r || {}, c = i.map((e) => e.id), { value: l } = t || {}, u;
|
|
72
|
-
if (a) l && l.length !== c.length && (u = !0, l = l.length < c.length ? l.concat(Array(c.length - l.length)) : l.filter((e) => c.includes(e)));
|
|
73
|
-
else {
|
|
74
|
-
if (!l || !l.length || n) l = c;
|
|
75
|
-
else {
|
|
76
|
-
let e = o(c, l), t = o(l, c);
|
|
77
|
-
(e.length || t.length) && (l = c);
|
|
78
|
-
}
|
|
79
|
-
u = !s(t.value, l);
|
|
80
|
-
}
|
|
81
|
-
return u && console.warn("This session is not valid anymore. It will be reset."), {
|
|
82
|
-
value: l,
|
|
83
|
-
needsReset: u
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
UNSAFE_componentWillReceiveProps(e) {
|
|
87
|
-
let { model: t = {} } = e || {}, { model: n = {} } = this.props || {}, { correctResponse: r, config: a, choices: o = [], env: s } = t, { includeTargets: c } = a || {}, l = {}, u = n.language && n.language !== t.language, d = n.note && n.note === L.t("common:commonCorrectAnswerWithAlternates", { lng: n.language });
|
|
88
|
-
u && d && (n.note = L.t("common:commonCorrectAnswerWithAlternates", { lng: t.language })), r || (l.showingCorrect = !1);
|
|
89
|
-
let f = i(o, n.choices), { value: p, needsReset: m } = this.validateSession(e, f), h = {
|
|
90
|
-
...e.session,
|
|
91
|
-
value: p
|
|
92
|
-
}, g = n.config?.includeTargets !== c;
|
|
93
|
-
c && g && (m = !0, delete h.value), this.setState(l, () => {
|
|
94
|
-
let { mode: e } = s || {};
|
|
95
|
-
m && e === "gather" && this.props.onSessionChange(h);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
onDropChoice = (e, t, n) => {
|
|
99
|
-
let { onSessionChange: i, session: a } = this.props, o = n.tiles.find((e) => e.id === t.id && e.type === t.type && e.index === t.index), s = e;
|
|
100
|
-
R("[onDropChoice] ", o, s);
|
|
101
|
-
let c = r({
|
|
102
|
-
type: "move",
|
|
103
|
-
from: o,
|
|
104
|
-
to: s
|
|
105
|
-
}, n);
|
|
106
|
-
i(Object.assign({}, a, { value: c.response }));
|
|
107
|
-
};
|
|
108
|
-
onRemoveChoice = (e, t) => {
|
|
109
|
-
let { onSessionChange: n, session: i } = this.props;
|
|
110
|
-
R("[onRemoveChoice]", e);
|
|
111
|
-
let a = r({
|
|
112
|
-
type: "remove",
|
|
113
|
-
target: e
|
|
114
|
-
}, t);
|
|
115
|
-
n(Object.assign({}, i, { value: a.response }));
|
|
116
|
-
};
|
|
117
|
-
createOrdering = () => {
|
|
118
|
-
let { model: e, session: t } = this.props, { showingCorrect: r } = this.state, { includeTargets: i } = e.config || {
|
|
119
|
-
orientation: "vertical",
|
|
120
|
-
includeTargets: !0
|
|
121
|
-
};
|
|
122
|
-
return r ? n(e.choices, e.correctResponse, e.correctResponse.map((e) => ({
|
|
123
|
-
id: e,
|
|
124
|
-
outcome: "correct"
|
|
125
|
-
})), {
|
|
126
|
-
includeTargets: i,
|
|
127
|
-
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
128
|
-
}) : n(e.choices, t.value, e.outcomes, {
|
|
129
|
-
includeTargets: i,
|
|
130
|
-
allowSameChoiceInTargets: e.config.allowSameChoiceInTargets
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
onDragEnd = (e) => {
|
|
134
|
-
let { over: t, active: n } = e, r = this.createOrdering();
|
|
135
|
-
if (t && n) {
|
|
136
|
-
let e = n.data.current, i = t.data.current;
|
|
137
|
-
if (e && i && i.type === "target") {
|
|
138
|
-
this.onDropChoice(i, e, r);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
e && i && this.onDropChoice(i, e, r);
|
|
142
|
-
} else if (!t && n) {
|
|
143
|
-
let e = n.data.current;
|
|
144
|
-
e && e.type === "target" && this.onRemoveChoice(e, r);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
render() {
|
|
148
|
-
let { model: n } = this.props, { correctResponse: r, correctness: i, extraCSSRules: a, prompt: o, rationale: s, feedback: c, config: l, note: u, showNote: d, env: f, disabled: p, teacherInstructions: h, language: g } = n, _ = r && r.length > 0, { showingCorrect: v } = this.state, y = l || {
|
|
149
|
-
orientation: "vertical",
|
|
150
|
-
includeTargets: !0
|
|
151
|
-
}, { orientation: T, includeTargets: E } = y, O = T === "vertical", k = this.createOrdering(), { mode: N, role: P } = f || {}, F = O ? t : e, I = (v || N === "view" && P === "instructor") && d && u, L = s && (S(s) || x(s)), R = h && (S(h) || x(h)), G = {
|
|
152
|
-
color: b.text(),
|
|
153
|
-
backgroundColor: b.background(),
|
|
154
|
-
display: "flex",
|
|
155
|
-
flexDirection: "column",
|
|
156
|
-
alignItems: "center",
|
|
157
|
-
boxSizing: "border-box"
|
|
158
|
-
};
|
|
159
|
-
return /* @__PURE__ */ C(D, {
|
|
160
|
-
onDragStart: () => {},
|
|
161
|
-
onDragEnd: this.onDragEnd,
|
|
162
|
-
collisionDetection: m,
|
|
163
|
-
children: /* @__PURE__ */ C(z, { children: /* @__PURE__ */ w(A, {
|
|
164
|
-
extraCSSRules: a,
|
|
165
|
-
style: G,
|
|
166
|
-
children: [
|
|
167
|
-
R && /* @__PURE__ */ C(U, {
|
|
168
|
-
labels: {
|
|
169
|
-
hidden: "Show Teacher Instructions",
|
|
170
|
-
visible: "Hide Teacher Instructions"
|
|
171
|
-
},
|
|
172
|
-
className: "collapsible",
|
|
173
|
-
children: /* @__PURE__ */ C(j, { prompt: h })
|
|
174
|
-
}),
|
|
175
|
-
/* @__PURE__ */ C(B, { children: /* @__PURE__ */ C(j, { prompt: o }) }),
|
|
176
|
-
/* @__PURE__ */ C(H, {
|
|
177
|
-
show: _,
|
|
178
|
-
toggled: v,
|
|
179
|
-
onToggle: this.toggleCorrect,
|
|
180
|
-
language: g
|
|
181
|
-
}),
|
|
182
|
-
/* @__PURE__ */ C(W, {
|
|
183
|
-
instanceId: this.instanceId,
|
|
184
|
-
choiceLabel: y.choiceLabel,
|
|
185
|
-
targetLabel: y.targetLabel,
|
|
186
|
-
ordering: k,
|
|
187
|
-
tiler: F,
|
|
188
|
-
disabled: p,
|
|
189
|
-
addGuide: y.showOrdering,
|
|
190
|
-
tileSize: y.tileSize,
|
|
191
|
-
includeTargets: E,
|
|
192
|
-
choiceLabelEnabled: n.config && n.config.choiceLabelEnabled
|
|
193
|
-
}),
|
|
194
|
-
I && /* @__PURE__ */ C(V, { dangerouslySetInnerHTML: { __html: u } }),
|
|
195
|
-
L && /* @__PURE__ */ C(U, {
|
|
196
|
-
labels: {
|
|
197
|
-
hidden: "Show Rationale",
|
|
198
|
-
visible: "Hide Rationale"
|
|
199
|
-
},
|
|
200
|
-
className: "collapsible",
|
|
201
|
-
children: /* @__PURE__ */ C(j, { prompt: s })
|
|
202
|
-
}),
|
|
203
|
-
!v && /* @__PURE__ */ C(M, {
|
|
204
|
-
correctness: i,
|
|
205
|
-
feedback: c
|
|
206
|
-
})
|
|
207
|
-
]
|
|
208
|
-
}) })
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
//#endregion
|
|
213
|
-
export { G as default };
|
package/dist/delivery/tile.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/placement-ordering/src/tile.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 const Tile: {
|
|
12
|
-
(props: any): React.JSX.Element;
|
|
13
|
-
propTypes: {
|
|
14
|
-
id: PropTypes.Requireable<any>;
|
|
15
|
-
label: PropTypes.Requireable<string>;
|
|
16
|
-
isOver: PropTypes.Requireable<boolean>;
|
|
17
|
-
type: PropTypes.Requireable<string>;
|
|
18
|
-
empty: PropTypes.Requireable<boolean>;
|
|
19
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
20
|
-
outcome: PropTypes.Requireable<string>;
|
|
21
|
-
index: PropTypes.Requireable<number>;
|
|
22
|
-
guideIndex: PropTypes.Requireable<number>;
|
|
23
|
-
instanceId: PropTypes.Requireable<any>;
|
|
24
|
-
draggable: PropTypes.Requireable<boolean>;
|
|
25
|
-
tileIndex: PropTypes.Requireable<number>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export default Tile;
|
package/dist/delivery/tile.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "debug";
|
|
3
|
-
import n from "prop-types";
|
|
4
|
-
import { styled as r } from "@mui/material/styles";
|
|
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 { PlaceHolder as c } from "@pie-lib/drag";
|
|
9
|
-
//#region src/delivery/tile.tsx
|
|
10
|
-
var l = t("pie-elements:placement-ordering:tile"), u = r("div")(({ theme: e }) => ({
|
|
11
|
-
width: "100%",
|
|
12
|
-
fontSize: e.typography.fontSize + 4,
|
|
13
|
-
textAlign: "center",
|
|
14
|
-
color: `rgba(${e.palette.common.black}, 0.6)`
|
|
15
|
-
})), d = ({ type: e, index: t, isOver: n, disabled: r }) => /* @__PURE__ */ s(c, {
|
|
16
|
-
type: e,
|
|
17
|
-
isOver: n,
|
|
18
|
-
disabled: r,
|
|
19
|
-
children: e === "target" && t !== void 0 && /* @__PURE__ */ s(u, { children: t })
|
|
20
|
-
});
|
|
21
|
-
d.propTypes = {
|
|
22
|
-
type: n.string,
|
|
23
|
-
index: n.number,
|
|
24
|
-
isOver: n.bool,
|
|
25
|
-
disabled: n.bool
|
|
26
|
-
};
|
|
27
|
-
var f = r("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i, label: a, type: s }) => ({
|
|
28
|
-
cursor: r ? "not-allowed" : "grab",
|
|
29
|
-
width: "100%",
|
|
30
|
-
height: "100%",
|
|
31
|
-
padding: "10px",
|
|
32
|
-
boxSizing: "border-box",
|
|
33
|
-
overflow: "hidden",
|
|
34
|
-
border: s === "choice" || s === "target" ? `1px solid ${e.palette.grey[400]}` : "1px solid transparent",
|
|
35
|
-
backgroundColor: s === "choice" || s === "target" ? o.background() : "transparent",
|
|
36
|
-
transition: s === "choice" || s === "target" ? "background-color 150ms ease, border-color 150ms ease, opacity 150ms ease" : "none",
|
|
37
|
-
pointerEvents: "none",
|
|
38
|
-
userSelect: "none",
|
|
39
|
-
...(s === "choice" || s === "target") && { "&:hover": {
|
|
40
|
-
backgroundColor: r ? o.background() : o.secondary(),
|
|
41
|
-
borderColor: r ? e.palette.grey[400] : e.palette.primary.main,
|
|
42
|
-
transform: r ? "none" : "scale(1.02)"
|
|
43
|
-
} },
|
|
44
|
-
...(s === "choice" || s === "target") && n && !r && {
|
|
45
|
-
opacity: .4,
|
|
46
|
-
backgroundColor: o.primaryLight(),
|
|
47
|
-
borderColor: e.palette.primary.main,
|
|
48
|
-
borderStyle: "dashed",
|
|
49
|
-
transform: "scale(1.05)"
|
|
50
|
-
},
|
|
51
|
-
...(s === "choice" || s === "target") && t && !r && {
|
|
52
|
-
opacity: .6,
|
|
53
|
-
backgroundColor: o.secondaryLight(),
|
|
54
|
-
transform: "scale(1.05) rotate(2deg)",
|
|
55
|
-
boxShadow: "0 8px 16px rgba(0,0,0,0.2)",
|
|
56
|
-
cursor: "grabbing"
|
|
57
|
-
},
|
|
58
|
-
...(s === "choice" || s === "target") && r && {
|
|
59
|
-
cursor: "not-allowed",
|
|
60
|
-
"&:hover": {
|
|
61
|
-
backgroundColor: o.background(),
|
|
62
|
-
transform: "none"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
...(s === "choice" || s === "target") && i === "incorrect" && { border: `1px solid ${o.incorrect()}` },
|
|
66
|
-
...(s === "choice" || s === "target") && i === "correct" && { border: `1px solid ${o.correct()}` },
|
|
67
|
-
...!a && {
|
|
68
|
-
border: "none",
|
|
69
|
-
"&:hover": { backgroundColor: "unset" }
|
|
70
|
-
}
|
|
71
|
-
})), p = (e) => {
|
|
72
|
-
let { type: t, isDragging: n, empty: r, isOver: i, label: a, disabled: o, outcome: c, guideIndex: l } = e;
|
|
73
|
-
return r ? /* @__PURE__ */ s(d, {
|
|
74
|
-
type: t,
|
|
75
|
-
index: l,
|
|
76
|
-
isOver: i,
|
|
77
|
-
disabled: o
|
|
78
|
-
}) : /* @__PURE__ */ s(f, {
|
|
79
|
-
type: t,
|
|
80
|
-
isDragging: n,
|
|
81
|
-
isOver: i,
|
|
82
|
-
disabled: o,
|
|
83
|
-
outcome: c,
|
|
84
|
-
label: a,
|
|
85
|
-
dangerouslySetInnerHTML: { __html: a }
|
|
86
|
-
});
|
|
87
|
-
}, m = (t) => {
|
|
88
|
-
let { label: n, type: r, id: o, empty: c, disabled: u, outcome: d, index: f, guideIndex: m, instanceId: h, draggable: g, tileIndex: _ } = t, v = `tile-${r}-${o ?? "empty"}-${_}-${h}`, y = `drop-${r}-${o ?? "empty"}-${_}-${h}`, { attributes: b, listeners: x, setNodeRef: S, transform: C, isDragging: w } = i({
|
|
89
|
-
id: v,
|
|
90
|
-
data: {
|
|
91
|
-
id: o,
|
|
92
|
-
type: r,
|
|
93
|
-
instanceId: h,
|
|
94
|
-
value: n,
|
|
95
|
-
index: f
|
|
96
|
-
},
|
|
97
|
-
disabled: !g || u
|
|
98
|
-
}), { setNodeRef: T, isOver: E } = a({
|
|
99
|
-
id: y,
|
|
100
|
-
data: {
|
|
101
|
-
id: o,
|
|
102
|
-
type: r,
|
|
103
|
-
instanceId: h,
|
|
104
|
-
value: n,
|
|
105
|
-
index: f
|
|
106
|
-
},
|
|
107
|
-
disabled: w
|
|
108
|
-
}), D = e.useRef(null);
|
|
109
|
-
return e.useEffect(() => {
|
|
110
|
-
let e = D.current, t = (e) => {
|
|
111
|
-
e.preventDefault();
|
|
112
|
-
};
|
|
113
|
-
return e && e.addEventListener("touchstart", t, { passive: !1 }), () => {
|
|
114
|
-
e && e.removeEventListener("touchstart", t);
|
|
115
|
-
};
|
|
116
|
-
}, []), l("[render], props: ", t), /* @__PURE__ */ s("div", {
|
|
117
|
-
ref: (e) => {
|
|
118
|
-
D.current = e, S(e), T(e);
|
|
119
|
-
},
|
|
120
|
-
style: {
|
|
121
|
-
transform: C ? `translate3d(${C.x}px, ${C.y}px, 0)` : void 0,
|
|
122
|
-
boxSizing: "border-box",
|
|
123
|
-
overflow: "visible",
|
|
124
|
-
padding: 0,
|
|
125
|
-
margin: 0,
|
|
126
|
-
textAlign: "center",
|
|
127
|
-
pointerEvents: "auto",
|
|
128
|
-
cursor: u ? "not-allowed" : w ? "grabbing" : "grab",
|
|
129
|
-
zIndex: w ? 1e3 : "auto",
|
|
130
|
-
willChange: w ? "transform" : "auto"
|
|
131
|
-
},
|
|
132
|
-
...g && !u ? {
|
|
133
|
-
...x,
|
|
134
|
-
...b
|
|
135
|
-
} : {},
|
|
136
|
-
children: /* @__PURE__ */ s(p, {
|
|
137
|
-
label: n,
|
|
138
|
-
id: o,
|
|
139
|
-
empty: c,
|
|
140
|
-
index: f,
|
|
141
|
-
guideIndex: m,
|
|
142
|
-
isOver: E,
|
|
143
|
-
isDragging: w,
|
|
144
|
-
disabled: u,
|
|
145
|
-
outcome: d,
|
|
146
|
-
type: r
|
|
147
|
-
})
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
m.propTypes = {
|
|
151
|
-
id: n.any,
|
|
152
|
-
label: n.string,
|
|
153
|
-
isOver: n.bool,
|
|
154
|
-
type: n.string,
|
|
155
|
-
empty: n.bool,
|
|
156
|
-
disabled: n.bool,
|
|
157
|
-
outcome: n.string,
|
|
158
|
-
index: n.number,
|
|
159
|
-
guideIndex: n.number,
|
|
160
|
-
instanceId: n.any,
|
|
161
|
-
draggable: n.bool,
|
|
162
|
-
tileIndex: n.number
|
|
163
|
-
};
|
|
164
|
-
//#endregion
|
|
165
|
-
export { m as default };
|
package/dist/delivery/tiler.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/placement-ordering/src/tiler.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 HorizontalTiler extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
choiceLabel: PropTypes.Requireable<string>;
|
|
14
|
-
targetLabel: PropTypes.Requireable<string>;
|
|
15
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
16
|
-
tiles: PropTypes.Validator<any[]>;
|
|
17
|
-
tileSize: PropTypes.Requireable<string>;
|
|
18
|
-
addGuide: PropTypes.Requireable<boolean>;
|
|
19
|
-
};
|
|
20
|
-
static defaultProps: {
|
|
21
|
-
tileSize: string;
|
|
22
|
-
disabled: boolean;
|
|
23
|
-
addGuide: boolean;
|
|
24
|
-
};
|
|
25
|
-
render(): React.JSX.Element;
|
|
26
|
-
}
|
|
27
|
-
export declare class VerticalTiler extends React.Component {
|
|
28
|
-
static propTypes: {
|
|
29
|
-
choiceLabel: PropTypes.Requireable<string>;
|
|
30
|
-
targetLabel: PropTypes.Requireable<string>;
|
|
31
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
32
|
-
tiles: PropTypes.Validator<any[]>;
|
|
33
|
-
tileSize: PropTypes.Requireable<string>;
|
|
34
|
-
addGuide: PropTypes.Requireable<boolean>;
|
|
35
|
-
};
|
|
36
|
-
static defaultProps: {
|
|
37
|
-
tileSize: string;
|
|
38
|
-
disabled: boolean;
|
|
39
|
-
addGuide: boolean;
|
|
40
|
-
};
|
|
41
|
-
render(): React.JSX.Element;
|
|
42
|
-
}
|
package/dist/delivery/tiler.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import e from "./tile.js";
|
|
2
|
-
import t, { createElement as n } from "react";
|
|
3
|
-
import r from "prop-types";
|
|
4
|
-
import { styled as i } from "@mui/material/styles";
|
|
5
|
-
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
-
//#region src/delivery/tiler.tsx
|
|
7
|
-
var s = {
|
|
8
|
-
choiceLabel: r.string,
|
|
9
|
-
targetLabel: r.string,
|
|
10
|
-
disabled: r.bool,
|
|
11
|
-
tiles: r.array.isRequired,
|
|
12
|
-
tileSize: r.string,
|
|
13
|
-
addGuide: r.bool
|
|
14
|
-
}, c = {
|
|
15
|
-
tileSize: "1fr",
|
|
16
|
-
disabled: !1,
|
|
17
|
-
addGuide: !1
|
|
18
|
-
}, l = (t) => {
|
|
19
|
-
let r = (r, i) => (r.instanceId = t.instanceId, r.disabled = t.disabled, r.guideIndex = t.addGuide ? r.index + 1 : void 0, r.tileIndex = i, t.includeTargets || r.type === "choice" ? /* @__PURE__ */ n(e, {
|
|
20
|
-
...r,
|
|
21
|
-
key: i
|
|
22
|
-
}) : /* @__PURE__ */ n(e, {
|
|
23
|
-
...r,
|
|
24
|
-
label: "",
|
|
25
|
-
key: i
|
|
26
|
-
}));
|
|
27
|
-
return r.propTypes = { ...s }, r;
|
|
28
|
-
}, u = i("div")(({ theme: e, includeTargets: t }) => ({
|
|
29
|
-
display: "grid",
|
|
30
|
-
paddingBottom: e.spacing(2),
|
|
31
|
-
...t && { gridGap: "10px" }
|
|
32
|
-
})), d = i("div")({ textAlign: "center" }), f = i("div")({
|
|
33
|
-
textAlign: "center",
|
|
34
|
-
gridRow: "3/4"
|
|
35
|
-
}), p = i("div")(({ includeTargets: e }) => ({
|
|
36
|
-
gridAutoFlow: "column",
|
|
37
|
-
display: "grid",
|
|
38
|
-
...e && { gridGap: "10px" }
|
|
39
|
-
})), m = i("div")({
|
|
40
|
-
gridColumn: "1/2",
|
|
41
|
-
textAlign: "center"
|
|
42
|
-
}), h = i("div")({
|
|
43
|
-
gridColumn: "2/3",
|
|
44
|
-
textAlign: "center"
|
|
45
|
-
}), g = class extends t.Component {
|
|
46
|
-
static propTypes = { ...s };
|
|
47
|
-
static defaultProps = { ...c };
|
|
48
|
-
render() {
|
|
49
|
-
let { includeTargets: e, choiceLabelEnabled: t, choiceLabel: n, targetLabel: r, tiles: i, tileSize: s } = this.props, c = e ? `auto ${s} auto ${s}` : `auto ${s} auto`, p = e ? i.length / 2 : i.length, m = {
|
|
50
|
-
gridTemplateColumns: e ? `repeat(${p}, ${s})` : `auto repeat(${Math.floor(p / 2) - 1}, ${s} 10px) ${s} auto`,
|
|
51
|
-
gridTemplateRows: c
|
|
52
|
-
}, h = { gridColumn: `1/${p + 1}` };
|
|
53
|
-
return /* @__PURE__ */ o(u, {
|
|
54
|
-
includeTargets: e,
|
|
55
|
-
style: m,
|
|
56
|
-
children: [
|
|
57
|
-
/* @__PURE__ */ a(d, {
|
|
58
|
-
style: h,
|
|
59
|
-
dangerouslySetInnerHTML: { __html: t ? n : "" }
|
|
60
|
-
}),
|
|
61
|
-
e && /* @__PURE__ */ a(f, {
|
|
62
|
-
style: h,
|
|
63
|
-
dangerouslySetInnerHTML: { __html: r }
|
|
64
|
-
}),
|
|
65
|
-
i.map(l(this.props))
|
|
66
|
-
]
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}, _ = class extends t.Component {
|
|
70
|
-
static propTypes = { ...s };
|
|
71
|
-
static defaultProps = { ...c };
|
|
72
|
-
render() {
|
|
73
|
-
let { includeTargets: e, choiceLabelEnabled: t, choiceLabel: n, targetLabel: r, tiles: i, tileSize: s } = this.props, c = e ? 2 : 1, u = e ? i.length / 2 : i.length;
|
|
74
|
-
return /* @__PURE__ */ o(p, {
|
|
75
|
-
includeTargets: e,
|
|
76
|
-
style: {
|
|
77
|
-
gridTemplateColumns: `repeat(${c}, ${s})`,
|
|
78
|
-
gridTemplateRows: e ? `auto repeat(${u}, ${s})` : `auto auto repeat(${Math.floor(u / 2) - 1}, ${s} 10px) ${s} auto`
|
|
79
|
-
},
|
|
80
|
-
children: [
|
|
81
|
-
/* @__PURE__ */ a(m, { dangerouslySetInnerHTML: { __html: t ? n : "" } }),
|
|
82
|
-
e && /* @__PURE__ */ a(h, { dangerouslySetInnerHTML: { __html: r } }),
|
|
83
|
-
i.map(l(this.props))
|
|
84
|
-
]
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
//#endregion
|
|
89
|
-
export { g as HorizontalTiler, _ as VerticalTiler };
|
package/dist/delivery/utils.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/placement-ordering/src/utils.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
|
-
export declare const haveSameValuesButDifferentOrder: (arr1: any, arr2: any) => any;
|
package/dist/delivery/utils.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
//#region src/delivery/utils.ts
|
|
2
|
-
var e = (e, t) => {
|
|
3
|
-
if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) return !1;
|
|
4
|
-
let n = (e) => e.map((e) => JSON.stringify(e)).sort(), r = n(e), i = n(t), a = r.every((e, t) => e === i[t]), o = e.every((e, n) => JSON.stringify(e) === JSON.stringify(t[n]));
|
|
5
|
-
return a && !o;
|
|
6
|
-
};
|
|
7
|
-
//#endregion
|
|
8
|
-
export { e as haveSameValuesButDifferentOrder };
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './delivery/index.js';
|
package/dist/index.iife.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IIFE entry point for placement-ordering element
|
|
3
|
-
* This file is only used for IIFE builds and includes auto-registration
|
|
4
|
-
*
|
|
5
|
-
* @sync-generated - Auto-generated during sync from pie-elements
|
|
6
|
-
*/
|
|
7
|
-
import Element from './index.js';
|
|
8
|
-
export default Element;
|