@pie-element/placement-ordering 15.0.3-next.20261007184841 → 15.0.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/dist/browser/author/index.js +1369 -1369
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +237 -238
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{drag-provider-ClKwhQWw.js → drag-provider-CD83T8uu.js} +2938 -2975
- package/dist/browser/drag-provider-CD83T8uu.js.map +1 -0
- package/dist/browser/editor-runtime/author/index.js +4277 -4277
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +237 -238
- package/dist/browser/editor-runtime/delivery/index.js.map +1 -1
- package/dist/browser/editor-runtime/{drag-provider-DZxHQkwd.js → drag-provider-DqD0-DIx.js} +2938 -2975
- package/dist/browser/editor-runtime/drag-provider-DqD0-DIx.js.map +1 -0
- package/dist/delivery/tile.js +66 -67
- package/dist/index.iife.js +33 -33
- package/package.json +15 -15
- package/dist/browser/drag-provider-ClKwhQWw.js.map +0 -1
- package/dist/browser/editor-runtime/drag-provider-DZxHQkwd.js.map +0 -1
- package/dist/delivery/__tests__/math-control-names.test.d.ts +0 -1
package/dist/delivery/tile.js
CHANGED
|
@@ -2,30 +2,30 @@ import e from "react";
|
|
|
2
2
|
import t from "debug";
|
|
3
3
|
import n from "prop-types";
|
|
4
4
|
import { styled as r } from "@mui/material/styles";
|
|
5
|
-
import { color as i
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { PlaceHolder as
|
|
8
|
-
import { useDraggable as
|
|
9
|
-
import { sanitizeModelHtml as
|
|
5
|
+
import { color as i } from "@pie-lib/render-ui";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
import { PlaceHolder as o } from "@pie-lib/drag";
|
|
8
|
+
import { useDraggable as s, useDroppable as c } from "@dnd-kit/core";
|
|
9
|
+
import { sanitizeModelHtml as l } from "@pie-element/shared-utils";
|
|
10
10
|
//#region src/delivery/tile.tsx
|
|
11
|
-
var
|
|
11
|
+
var u = t("pie-elements:placement-ordering:tile"), d = r("div")(({ theme: e }) => ({
|
|
12
12
|
width: "100%",
|
|
13
13
|
fontSize: e.typography.fontSize + 4,
|
|
14
14
|
textAlign: "center",
|
|
15
15
|
color: "inherit"
|
|
16
|
-
})),
|
|
16
|
+
})), f = ({ type: e, index: t, isOver: n, disabled: r }) => /* @__PURE__ */ a(o, {
|
|
17
17
|
type: e,
|
|
18
18
|
isOver: n,
|
|
19
19
|
disabled: r,
|
|
20
|
-
children: e === "target" && t !== void 0 && /* @__PURE__ */
|
|
20
|
+
children: e === "target" && t !== void 0 && /* @__PURE__ */ a(d, { children: t })
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
f.propTypes = {
|
|
23
23
|
type: n.string,
|
|
24
24
|
index: n.number,
|
|
25
25
|
isOver: n.bool,
|
|
26
26
|
disabled: n.bool
|
|
27
27
|
};
|
|
28
|
-
var
|
|
28
|
+
var p = r("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled: a, outcome: o, label: s, type: c }) => ({
|
|
29
29
|
cursor: a ? "not-allowed" : "grab",
|
|
30
30
|
width: "100%",
|
|
31
31
|
height: "100%",
|
|
@@ -69,98 +69,97 @@ var m = r("div")(({ theme: e, isDragging: t, isSelected: n, isOver: r, disabled:
|
|
|
69
69
|
border: "none",
|
|
70
70
|
"&:hover": { backgroundColor: "unset" }
|
|
71
71
|
}
|
|
72
|
-
})),
|
|
73
|
-
let { type: t, isDragging: n, isSelected: r, empty: i, isOver:
|
|
74
|
-
return i ? /* @__PURE__ */
|
|
72
|
+
})), m = (e) => {
|
|
73
|
+
let { type: t, isDragging: n, isSelected: r, empty: i, isOver: o, label: s, disabled: c, outcome: u, guideIndex: d } = e;
|
|
74
|
+
return i ? /* @__PURE__ */ a(f, {
|
|
75
75
|
type: t,
|
|
76
76
|
index: d,
|
|
77
|
-
isOver:
|
|
77
|
+
isOver: o,
|
|
78
78
|
disabled: c
|
|
79
|
-
}) : /* @__PURE__ */
|
|
79
|
+
}) : /* @__PURE__ */ a(p, {
|
|
80
80
|
type: t,
|
|
81
81
|
isDragging: n,
|
|
82
82
|
isSelected: r,
|
|
83
|
-
isOver:
|
|
83
|
+
isOver: o,
|
|
84
84
|
disabled: c,
|
|
85
|
-
outcome:
|
|
85
|
+
outcome: u,
|
|
86
86
|
label: s,
|
|
87
|
-
dangerouslySetInnerHTML: { __html:
|
|
87
|
+
dangerouslySetInnerHTML: { __html: l(s) }
|
|
88
88
|
});
|
|
89
|
-
},
|
|
90
|
-
let { label: n, type: r, id: i, empty:
|
|
89
|
+
}, h = (t) => {
|
|
90
|
+
let { label: n, type: r, id: i, empty: o, disabled: l, outcome: d, index: f, guideIndex: p, instanceId: h, draggable: g, tileIndex: _, selectedChoice: v, onChoiceClick: y, onPlacementClick: b } = t, x = `tile-${r}-${i ?? "empty"}-${_}-${h}`, S = `drop-${r}-${i ?? "empty"}-${_}-${h}`, C = {
|
|
91
91
|
id: i,
|
|
92
92
|
type: r,
|
|
93
|
-
instanceId:
|
|
93
|
+
instanceId: h,
|
|
94
94
|
value: n,
|
|
95
|
-
index:
|
|
96
|
-
}, { attributes:
|
|
95
|
+
index: f
|
|
96
|
+
}, { attributes: w, listeners: T, setNodeRef: E, transform: D, isDragging: O } = s({
|
|
97
|
+
id: x,
|
|
98
|
+
data: C,
|
|
99
|
+
disabled: !g || l
|
|
100
|
+
}), { setNodeRef: k, isOver: A } = c({
|
|
97
101
|
id: S,
|
|
98
|
-
data:
|
|
99
|
-
disabled:
|
|
100
|
-
}),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
u || (r === "choice" ? y?.type === "target" ? x?.(w) : _ && b?.(w) : r === "target" && (M ? b?.(w) : y ? x?.(w) : _ && b?.(w)));
|
|
106
|
-
}, R = _ && !u, z = !R && !u && F, B = (e) => {
|
|
107
|
-
(e.code === "Space" || e.code === "Enter") && (e.preventDefault(), L());
|
|
108
|
-
}, V = e.useRef(null), H = a(V);
|
|
102
|
+
data: C,
|
|
103
|
+
disabled: O
|
|
104
|
+
}), j = !!v && v.type === C.type && v.id === C.id && v.index === C.index, [M, N] = e.useState(!1), P = !!v && !l, F = A || r === "target" && P && M, I = () => {
|
|
105
|
+
l || (r === "choice" ? v?.type === "target" ? b?.(C) : g && y?.(C) : r === "target" && (j ? y?.(C) : v ? b?.(C) : g && y?.(C)));
|
|
106
|
+
}, L = !(g && !l) && !l && P, R = (e) => {
|
|
107
|
+
(e.code === "Space" || e.code === "Enter") && (e.preventDefault(), I());
|
|
108
|
+
}, z = e.useRef(null);
|
|
109
109
|
e.useEffect(() => {
|
|
110
|
-
let e =
|
|
110
|
+
let e = z.current, t = (e) => {
|
|
111
111
|
e.preventDefault();
|
|
112
112
|
};
|
|
113
113
|
return e && e.addEventListener("touchstart", t, { passive: !1 }), () => {
|
|
114
114
|
e && e.removeEventListener("touchstart", t);
|
|
115
115
|
};
|
|
116
116
|
}, []);
|
|
117
|
-
let
|
|
118
|
-
|
|
117
|
+
let B = (e) => {
|
|
118
|
+
z.current = e, E(e), k(e);
|
|
119
119
|
};
|
|
120
|
-
|
|
121
|
-
let
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
ref:
|
|
120
|
+
u("[render], props: ", t);
|
|
121
|
+
let V = r === "target" ? `target-${f}` : r === "choice" ? `choice-${i}` : null, H = V ? `${h}:${V}` : void 0;
|
|
122
|
+
return /* @__PURE__ */ a("div", {
|
|
123
|
+
ref: B,
|
|
124
124
|
style: {
|
|
125
|
-
transform:
|
|
125
|
+
transform: D ? `translate3d(${D.x}px, ${D.y}px, 0)` : void 0,
|
|
126
126
|
boxSizing: "border-box",
|
|
127
127
|
overflow: "visible",
|
|
128
128
|
padding: 0,
|
|
129
129
|
margin: 0,
|
|
130
130
|
textAlign: "center",
|
|
131
131
|
pointerEvents: "auto",
|
|
132
|
-
cursor:
|
|
133
|
-
zIndex:
|
|
134
|
-
willChange:
|
|
132
|
+
cursor: l ? "not-allowed" : r === "target" && P ? "pointer" : O ? "grabbing" : "grab",
|
|
133
|
+
zIndex: O ? 1e3 : "auto",
|
|
134
|
+
willChange: O ? "transform" : "auto"
|
|
135
135
|
},
|
|
136
|
-
role:
|
|
137
|
-
tabIndex:
|
|
138
|
-
onKeyDown:
|
|
139
|
-
onClick:
|
|
140
|
-
onMouseEnter: () =>
|
|
141
|
-
onMouseLeave: () =>
|
|
142
|
-
"data-tile-id":
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
...
|
|
146
|
-
...T
|
|
136
|
+
role: L ? "button" : void 0,
|
|
137
|
+
tabIndex: L ? 0 : void 0,
|
|
138
|
+
onKeyDown: L ? R : void 0,
|
|
139
|
+
onClick: I,
|
|
140
|
+
onMouseEnter: () => N(!0),
|
|
141
|
+
onMouseLeave: () => N(!1),
|
|
142
|
+
"data-tile-id": H,
|
|
143
|
+
...g && !l ? {
|
|
144
|
+
...T,
|
|
145
|
+
...w
|
|
147
146
|
} : {},
|
|
148
|
-
children: /* @__PURE__ */
|
|
147
|
+
children: /* @__PURE__ */ a(m, {
|
|
149
148
|
label: n,
|
|
150
149
|
id: i,
|
|
151
|
-
empty:
|
|
152
|
-
index:
|
|
153
|
-
guideIndex:
|
|
154
|
-
isOver:
|
|
155
|
-
isDragging:
|
|
156
|
-
isSelected:
|
|
157
|
-
disabled:
|
|
158
|
-
outcome:
|
|
150
|
+
empty: o,
|
|
151
|
+
index: f,
|
|
152
|
+
guideIndex: p,
|
|
153
|
+
isOver: F,
|
|
154
|
+
isDragging: O,
|
|
155
|
+
isSelected: j,
|
|
156
|
+
disabled: l,
|
|
157
|
+
outcome: d,
|
|
159
158
|
type: r
|
|
160
159
|
})
|
|
161
160
|
});
|
|
162
161
|
};
|
|
163
|
-
|
|
162
|
+
h.propTypes = {
|
|
164
163
|
id: n.any,
|
|
165
164
|
label: n.string,
|
|
166
165
|
isOver: n.bool,
|
|
@@ -178,4 +177,4 @@ g.propTypes = {
|
|
|
178
177
|
onPlacementClick: n.func
|
|
179
178
|
};
|
|
180
179
|
//#endregion
|
|
181
|
-
export {
|
|
180
|
+
export { h as Tile, h as default };
|