@tmagic/stage 1.1.4 → 1.1.6
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/tmagic-stage.mjs +49 -26
- package/dist/tmagic-stage.mjs.map +1 -1
- package/dist/tmagic-stage.umd.js +49 -26
- package/dist/tmagic-stage.umd.js.map +1 -1
- package/package.json +5 -5
package/dist/tmagic-stage.umd.js
CHANGED
|
@@ -178,7 +178,9 @@
|
|
|
178
178
|
const down = (deltaTop, target) => {
|
|
179
179
|
let swapIndex = 0;
|
|
180
180
|
let addUpH = target.clientHeight;
|
|
181
|
-
const brothers = Array.from(target.parentNode?.children || []).filter(
|
|
181
|
+
const brothers = Array.from(target.parentNode?.children || []).filter(
|
|
182
|
+
(node) => !node.id.startsWith(GHOST_EL_ID_PREFIX)
|
|
183
|
+
);
|
|
182
184
|
const index = brothers.indexOf(target);
|
|
183
185
|
const downEls = brothers.slice(index + 1);
|
|
184
186
|
for (let i = 0; i < downEls.length; i++) {
|
|
@@ -199,7 +201,9 @@
|
|
|
199
201
|
};
|
|
200
202
|
};
|
|
201
203
|
const up = (deltaTop, target) => {
|
|
202
|
-
const brothers = Array.from(target.parentNode?.children || []).filter(
|
|
204
|
+
const brothers = Array.from(target.parentNode?.children || []).filter(
|
|
205
|
+
(node) => !node.id.startsWith(GHOST_EL_ID_PREFIX)
|
|
206
|
+
);
|
|
203
207
|
const index = brothers.indexOf(target);
|
|
204
208
|
const upEls = brothers.slice(0, index);
|
|
205
209
|
let addUpH = target.clientHeight;
|
|
@@ -987,19 +991,22 @@
|
|
|
987
991
|
this.wrapperResizeObserver?.disconnect();
|
|
988
992
|
this.intersectionObserver?.disconnect();
|
|
989
993
|
if (typeof IntersectionObserver !== "undefined") {
|
|
990
|
-
this.intersectionObserver = new IntersectionObserver(
|
|
991
|
-
entries
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
994
|
+
this.intersectionObserver = new IntersectionObserver(
|
|
995
|
+
(entries) => {
|
|
996
|
+
entries.forEach((entry) => {
|
|
997
|
+
const { target, intersectionRatio } = entry;
|
|
998
|
+
if (intersectionRatio <= 0) {
|
|
999
|
+
this.scrollIntoView(target);
|
|
1000
|
+
}
|
|
1001
|
+
this.intersectionObserver?.unobserve(target);
|
|
1002
|
+
});
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
root: this.pageScrollParent,
|
|
1006
|
+
rootMargin: "0px",
|
|
1007
|
+
threshold: 1
|
|
1008
|
+
}
|
|
1009
|
+
);
|
|
1003
1010
|
}
|
|
1004
1011
|
if (typeof ResizeObserver !== "undefined") {
|
|
1005
1012
|
this.pageResizeObserver = new ResizeObserver((entries) => {
|
|
@@ -1175,9 +1182,12 @@
|
|
|
1175
1182
|
});
|
|
1176
1183
|
this.moveableForMulti?.destroy();
|
|
1177
1184
|
this.multiMoveableHelper?.clear();
|
|
1178
|
-
this.moveableForMulti = new Moveable__default.default(
|
|
1179
|
-
|
|
1180
|
-
|
|
1185
|
+
this.moveableForMulti = new Moveable__default.default(
|
|
1186
|
+
this.container,
|
|
1187
|
+
this.getOptions({
|
|
1188
|
+
target: this.dragElList
|
|
1189
|
+
})
|
|
1190
|
+
);
|
|
1181
1191
|
this.multiMoveableHelper = MoveableHelper__default.default.create({
|
|
1182
1192
|
useBeforeRender: true,
|
|
1183
1193
|
useRender: false,
|
|
@@ -1186,7 +1196,9 @@
|
|
|
1186
1196
|
const frames = [];
|
|
1187
1197
|
const setFrames = (events) => {
|
|
1188
1198
|
events.forEach((ev) => {
|
|
1189
|
-
const matchEventTarget = this.targetList.find(
|
|
1199
|
+
const matchEventTarget = this.targetList.find(
|
|
1200
|
+
(targetItem) => targetItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, "")
|
|
1201
|
+
);
|
|
1190
1202
|
if (!matchEventTarget)
|
|
1191
1203
|
return;
|
|
1192
1204
|
frames.push({
|
|
@@ -1205,10 +1217,14 @@
|
|
|
1205
1217
|
const { events } = params;
|
|
1206
1218
|
events.forEach((ev) => {
|
|
1207
1219
|
const { width, height, beforeTranslate } = ev.drag;
|
|
1208
|
-
const frameSnapShot = frames.find(
|
|
1220
|
+
const frameSnapShot = frames.find(
|
|
1221
|
+
(frameItem) => frameItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, "")
|
|
1222
|
+
);
|
|
1209
1223
|
if (!frameSnapShot)
|
|
1210
1224
|
return;
|
|
1211
|
-
const targeEl = this.targetList.find(
|
|
1225
|
+
const targeEl = this.targetList.find(
|
|
1226
|
+
(targetItem) => targetItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, "")
|
|
1227
|
+
);
|
|
1212
1228
|
if (!targeEl)
|
|
1213
1229
|
return;
|
|
1214
1230
|
const isParentIncluded = this.targetList.find((targetItem) => targetItem.id === targeEl.parentElement?.id);
|
|
@@ -1232,10 +1248,14 @@
|
|
|
1232
1248
|
}).on("dragGroup", (params) => {
|
|
1233
1249
|
const { events } = params;
|
|
1234
1250
|
events.forEach((ev) => {
|
|
1235
|
-
const frameSnapShot = frames.find(
|
|
1251
|
+
const frameSnapShot = frames.find(
|
|
1252
|
+
(frameItem) => frameItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, "")
|
|
1253
|
+
);
|
|
1236
1254
|
if (!frameSnapShot)
|
|
1237
1255
|
return;
|
|
1238
|
-
const targeEl = this.targetList.find(
|
|
1256
|
+
const targeEl = this.targetList.find(
|
|
1257
|
+
(targetItem) => targetItem.id === ev.target.id.replace(DRAG_EL_ID_PREFIX, "")
|
|
1258
|
+
);
|
|
1239
1259
|
if (!targeEl)
|
|
1240
1260
|
return;
|
|
1241
1261
|
const isParentIncluded = this.targetList.find((targetItem) => targetItem.id === targeEl.parentElement?.id);
|
|
@@ -1426,9 +1446,12 @@
|
|
|
1426
1446
|
postTmagicRuntimeReady() {
|
|
1427
1447
|
this.contentWindow = this.iframe?.contentWindow;
|
|
1428
1448
|
this.contentWindow.magic = this.getMagicApi();
|
|
1429
|
-
this.contentWindow.postMessage(
|
|
1430
|
-
|
|
1431
|
-
|
|
1449
|
+
this.contentWindow.postMessage(
|
|
1450
|
+
{
|
|
1451
|
+
tmagicRuntimeReady: true
|
|
1452
|
+
},
|
|
1453
|
+
"*"
|
|
1454
|
+
);
|
|
1432
1455
|
}
|
|
1433
1456
|
}
|
|
1434
1457
|
|