@amplifyup/sdk 0.1.11 → 0.1.13

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/index.mjs CHANGED
@@ -340,6 +340,15 @@ var AmplifyUpSDK = class {
340
340
  this.messageListener = null;
341
341
  this.mutationObserver = null;
342
342
  this.composerDragHandlers = null;
343
+ /** Last slot highlighted during Composer drag — avoid clear/re-add flicker. */
344
+ this.lastComposerDragSlot = null;
345
+ /** Consecutive miss frames before clearing highlight (anti-jitter). */
346
+ this.composerDragMissFrames = 0;
347
+ /**
348
+ * Parent overlay is driving drag via postMessage. Native iframe dragleave must
349
+ * not clear highlight — overlay takeover fires a spurious document dragleave.
350
+ */
351
+ this.composerOverlayDragActive = false;
343
352
  this.isVisualEditorMode = false;
344
353
  this.eventSelectionMode = false;
345
354
  this.eventSelectionClickHandler = null;
@@ -870,6 +879,12 @@ Available Console Commands:
870
879
  }
871
880
  throw new Error(`Failed to fetch page: ${response.statusText}`);
872
881
  }
882
+ const contentType = response.headers.get("content-type") || "";
883
+ if (!contentType.includes("application/json")) {
884
+ throw new Error(
885
+ `Layout provider returned non-JSON (${contentType || "unknown"}). Check Composer preview routing.`
886
+ );
887
+ }
873
888
  const data = await response.json();
874
889
  const pageConfig = data.page;
875
890
  if (pageConfig?.eventTracking) {
@@ -1154,33 +1169,94 @@ Available Console Commands:
1154
1169
  }
1155
1170
  return;
1156
1171
  }
1172
+ if (event.data?.type === "COMPOSER_DRAG_START") {
1173
+ this.composerOverlayDragActive = true;
1174
+ if (typeof document !== "undefined") {
1175
+ document.body.classList.add("amplifyup-composer-dragging");
1176
+ }
1177
+ return;
1178
+ }
1179
+ if (event.data?.type === "COMPOSER_DRAG_AT_POINT") {
1180
+ const { x, y } = event.data;
1181
+ if (typeof x === "number" && typeof y === "number") {
1182
+ this.handleComposerDragAtPoint(x, y);
1183
+ }
1184
+ return;
1185
+ }
1186
+ if (event.data?.type === "COMPOSER_DROP_AT_POINT") {
1187
+ const { x, y } = event.data;
1188
+ if (typeof x === "number" && typeof y === "number") {
1189
+ this.handleComposerDropAtPoint(x, y);
1190
+ }
1191
+ return;
1192
+ }
1193
+ if (event.data?.type === "COMPOSER_DRAG_END") {
1194
+ this.composerOverlayDragActive = false;
1195
+ this.clearComposerDragHighlight();
1196
+ return;
1197
+ }
1157
1198
  if (event.data?.type === "GET_ELEMENT_POSITION") {
1158
- const { componentId, slotName } = event.data;
1159
- const selector = slotName ? `[data-amplifyup-slot="${slotName}"], [data-slot-id="${slotName}"]` : `[data-amplifyup-component="${componentId}"], [data-component-id="${componentId}"]`;
1160
- console.log("[AmplifyUp SDK] Finding element position:", { selector, componentId, slotName });
1161
- const element = document.querySelector(selector);
1199
+ const { componentId, slotName, nodeId, isPageSlot } = event.data;
1200
+ let element = null;
1201
+ if (isPageSlot || slotName === "main" && !nodeId && !componentId) {
1202
+ element = document.querySelector(
1203
+ '[data-slot-source="page"]'
1204
+ );
1205
+ }
1206
+ if (!element && nodeId && slotName) {
1207
+ element = document.querySelector(
1208
+ `[data-parent-node-id="${nodeId}"][data-slot-id="${slotName}"], [data-parent-node-id="${nodeId}"][data-amplifyup-slot="${slotName}"]`
1209
+ );
1210
+ }
1211
+ if (!element && nodeId && !slotName) {
1212
+ element = document.querySelector(
1213
+ `[data-node-id="${nodeId}"]`
1214
+ );
1215
+ }
1216
+ if (!element && slotName) {
1217
+ element = document.querySelector(
1218
+ `[data-amplifyup-slot="${slotName}"], [data-slot-id="${slotName}"]`
1219
+ );
1220
+ }
1221
+ if (!element && componentId) {
1222
+ element = document.querySelector(
1223
+ `[data-amplifyup-component="${componentId}"], [data-component-id="${componentId}"]`
1224
+ );
1225
+ }
1226
+ console.log("[AmplifyUp SDK] Finding element position:", {
1227
+ componentId,
1228
+ slotName,
1229
+ nodeId,
1230
+ isPageSlot,
1231
+ found: !!element
1232
+ });
1162
1233
  if (element) {
1163
1234
  const rect = element.getBoundingClientRect();
1164
1235
  const position = {
1165
1236
  x: rect.left + rect.width / 2,
1166
- // Center of element
1167
1237
  y: rect.top - 50,
1168
- // Position above element
1169
1238
  width: rect.width,
1170
1239
  height: rect.height
1171
1240
  };
1172
- console.log("[AmplifyUp SDK] Element position calculated:", { rect, position });
1241
+ const bounds = {
1242
+ top: rect.top,
1243
+ left: rect.left,
1244
+ width: rect.width,
1245
+ height: rect.height
1246
+ };
1173
1247
  if (window.parent && window.parent !== window) {
1174
1248
  window.parent.postMessage({
1175
1249
  type: "ELEMENT_POSITION",
1176
- componentId,
1177
- slotName,
1178
- position
1250
+ componentId: componentId || null,
1251
+ slotName: slotName || null,
1252
+ nodeId: nodeId || null,
1253
+ isPageSlot: !!isPageSlot,
1254
+ position,
1255
+ bounds
1179
1256
  }, "*");
1180
- console.log("[AmplifyUp SDK] Sent ELEMENT_POSITION message");
1181
1257
  }
1182
1258
  } else {
1183
- console.warn("[AmplifyUp SDK] Element not found for selector:", selector);
1259
+ console.warn("[AmplifyUp SDK] Element not found for position request");
1184
1260
  }
1185
1261
  return;
1186
1262
  }
@@ -1287,6 +1363,157 @@ Available Console Commands:
1287
1363
  }
1288
1364
  return el.tagName.toLowerCase();
1289
1365
  }
1366
+ /** Clear drag-over highlight state (Composer overlay path or native drag end). */
1367
+ clearComposerDragHighlight() {
1368
+ if (typeof document === "undefined") return;
1369
+ const slotSelector = "[data-slot-id], [data-amplifyup-slot]";
1370
+ document.querySelectorAll(`${slotSelector}.amplifyup-drag-over-slot`).forEach((el) => {
1371
+ el.classList.remove("amplifyup-drag-over-slot");
1372
+ });
1373
+ document.body.classList.remove("amplifyup-drag-no-drop");
1374
+ document.body.classList.remove("amplifyup-composer-dragging");
1375
+ this.lastComposerDragSlot = null;
1376
+ this.composerDragMissFrames = 0;
1377
+ }
1378
+ /** Re-apply drag-over class only if missing (avoids classList churn / flicker). */
1379
+ ensureDragOverClass(slot) {
1380
+ if (!slot.classList.contains("amplifyup-drag-over-slot")) {
1381
+ slot.classList.add("amplifyup-drag-over-slot");
1382
+ }
1383
+ if (document.body.classList.contains("amplifyup-drag-no-drop")) {
1384
+ document.body.classList.remove("amplifyup-drag-no-drop");
1385
+ }
1386
+ }
1387
+ /**
1388
+ * Composer drag targets the innermost (most specific) slot under the cursor.
1389
+ * e.g. FullWidthGrid's main wins over a page-level main that wraps it.
1390
+ */
1391
+ resolveSlotAtPoint(x, y) {
1392
+ if (typeof document === "undefined") return null;
1393
+ const slotSelector = "[data-slot-id], [data-amplifyup-slot]";
1394
+ const containing = [];
1395
+ document.querySelectorAll(slotSelector).forEach((node) => {
1396
+ const el = node;
1397
+ const r = el.getBoundingClientRect();
1398
+ if (x >= r.left && x <= r.right && y >= r.top && y <= r.bottom) {
1399
+ containing.push(el);
1400
+ }
1401
+ });
1402
+ if (containing.length === 0) return null;
1403
+ const innermost = containing.filter(
1404
+ (el) => !containing.some((other) => other !== el && el.contains(other))
1405
+ );
1406
+ if (innermost.length === 1) return innermost[0];
1407
+ let best = innermost[0];
1408
+ let bestArea = Infinity;
1409
+ for (const el of innermost) {
1410
+ const r = el.getBoundingClientRect();
1411
+ const area = Math.max(1, r.width) * Math.max(1, r.height);
1412
+ if (area < bestArea) {
1413
+ bestArea = area;
1414
+ best = el;
1415
+ }
1416
+ }
1417
+ return best;
1418
+ }
1419
+ /** Parent layout node that owns this slot (null for page-level code main). */
1420
+ parentComponentForSlot(slotEl) {
1421
+ let componentId = slotEl.getAttribute("data-parent-component-id");
1422
+ let nodeId = slotEl.getAttribute("data-parent-node-id");
1423
+ let el = slotEl.parentElement;
1424
+ while (el && (!nodeId || !componentId)) {
1425
+ if (!nodeId && el.hasAttribute("data-node-id")) {
1426
+ nodeId = el.getAttribute("data-node-id");
1427
+ }
1428
+ if (!componentId) {
1429
+ componentId = el.getAttribute("data-amplifyup-component") || el.getAttribute("data-component-id");
1430
+ }
1431
+ if (nodeId) break;
1432
+ el = el.parentElement;
1433
+ }
1434
+ return { componentId, nodeId };
1435
+ }
1436
+ pointInRect(x, y, el, pad = 8) {
1437
+ const r = el.getBoundingClientRect();
1438
+ return x >= r.left - pad && x <= r.right + pad && y >= r.top - pad && y <= r.bottom + pad;
1439
+ }
1440
+ setComposerDragHighlight(slot, x, y) {
1441
+ if (slot && slot === this.lastComposerDragSlot) {
1442
+ this.composerDragMissFrames = 0;
1443
+ this.ensureDragOverClass(slot);
1444
+ return;
1445
+ }
1446
+ if (slot && this.lastComposerDragSlot && this.lastComposerDragSlot.contains(slot) && slot !== this.lastComposerDragSlot) {
1447
+ this.composerDragMissFrames = 0;
1448
+ this.lastComposerDragSlot.classList.remove("amplifyup-drag-over-slot");
1449
+ this.lastComposerDragSlot = slot;
1450
+ this.ensureDragOverClass(slot);
1451
+ return;
1452
+ }
1453
+ if (this.lastComposerDragSlot && typeof x === "number" && typeof y === "number" && this.pointInRect(x, y, this.lastComposerDragSlot)) {
1454
+ if (!slot || slot.contains(this.lastComposerDragSlot) || slot === this.lastComposerDragSlot) {
1455
+ this.composerDragMissFrames = 0;
1456
+ this.ensureDragOverClass(this.lastComposerDragSlot);
1457
+ return;
1458
+ }
1459
+ }
1460
+ if (slot) {
1461
+ this.composerDragMissFrames = 0;
1462
+ if (this.lastComposerDragSlot && this.lastComposerDragSlot !== slot) {
1463
+ this.lastComposerDragSlot.classList.remove("amplifyup-drag-over-slot");
1464
+ }
1465
+ this.lastComposerDragSlot = slot;
1466
+ this.ensureDragOverClass(slot);
1467
+ return;
1468
+ }
1469
+ this.composerDragMissFrames += 1;
1470
+ if (this.lastComposerDragSlot && this.composerDragMissFrames < 8) {
1471
+ this.ensureDragOverClass(this.lastComposerDragSlot);
1472
+ return;
1473
+ }
1474
+ if (this.lastComposerDragSlot) {
1475
+ this.lastComposerDragSlot.classList.remove("amplifyup-drag-over-slot");
1476
+ this.lastComposerDragSlot = null;
1477
+ }
1478
+ if (!document.body.classList.contains("amplifyup-drag-no-drop")) {
1479
+ document.body.classList.add("amplifyup-drag-no-drop");
1480
+ }
1481
+ }
1482
+ handleComposerDragAtPoint(x, y) {
1483
+ this.composerOverlayDragActive = true;
1484
+ if (!document.body.classList.contains("amplifyup-composer-dragging")) {
1485
+ document.body.classList.add("amplifyup-composer-dragging");
1486
+ }
1487
+ this.setComposerDragHighlight(this.resolveSlotAtPoint(x, y), x, y);
1488
+ }
1489
+ postDropOnSlot(slotEl) {
1490
+ const win = window;
1491
+ if (!win.parent || win.parent === win) return;
1492
+ const slotName = slotEl.getAttribute("data-amplifyup-slot") || slotEl.getAttribute("data-slot-id");
1493
+ if (!slotName) return;
1494
+ const { componentId, nodeId } = this.parentComponentForSlot(slotEl);
1495
+ const isEmpty = slotEl.getAttribute("data-slot-empty") === "true";
1496
+ win.parent.postMessage(
1497
+ {
1498
+ type: "DROP_ON_SLOT",
1499
+ slotName,
1500
+ slotElement: {
1501
+ path: slotEl.getAttribute("data-slot-path"),
1502
+ isEmpty,
1503
+ parentComponentId: componentId,
1504
+ parentNodeId: nodeId
1505
+ }
1506
+ },
1507
+ "*"
1508
+ );
1509
+ }
1510
+ handleComposerDropAtPoint(x, y) {
1511
+ if (typeof document === "undefined") return;
1512
+ const htmlEl = this.resolveSlotAtPoint(x, y);
1513
+ this.clearComposerDragHighlight();
1514
+ if (!htmlEl) return;
1515
+ this.postDropOnSlot(htmlEl);
1516
+ }
1290
1517
  /**
1291
1518
  * Enable component highlighting
1292
1519
  */
@@ -1313,35 +1540,25 @@ Available Console Commands:
1313
1540
  this.teardownComposerDragDrop();
1314
1541
  const slotSelector = "[data-slot-id], [data-amplifyup-slot]";
1315
1542
  const clearDragOverState = () => {
1316
- document.querySelectorAll(`${slotSelector}.amplifyup-drag-over-slot`).forEach((el) => {
1317
- el.classList.remove("amplifyup-drag-over-slot");
1318
- });
1319
- document.body.classList.remove("amplifyup-drag-no-drop");
1543
+ this.clearComposerDragHighlight();
1320
1544
  };
1321
1545
  const dragenter = (e) => {
1322
1546
  e.preventDefault();
1323
- if (e.dataTransfer?.types?.length) {
1324
- document.body.classList.add("amplifyup-drag-no-drop");
1325
- }
1326
1547
  };
1327
1548
  const dragover = (e) => {
1328
1549
  e.preventDefault();
1329
- const target = e.target;
1330
- const slot = target?.closest?.(slotSelector);
1550
+ if (this.composerOverlayDragActive) {
1551
+ if (e.dataTransfer) e.dataTransfer.dropEffect = "copy";
1552
+ return;
1553
+ }
1554
+ const slot = this.resolveSlotAtPoint(e.clientX, e.clientY);
1331
1555
  if (e.dataTransfer) {
1332
1556
  e.dataTransfer.dropEffect = slot ? "copy" : "none";
1333
1557
  }
1334
- document.querySelectorAll(`${slotSelector}.amplifyup-drag-over-slot`).forEach((el) => {
1335
- el.classList.remove("amplifyup-drag-over-slot");
1336
- });
1337
- if (slot) {
1338
- slot.classList.add("amplifyup-drag-over-slot");
1339
- document.body.classList.remove("amplifyup-drag-no-drop");
1340
- } else {
1341
- document.body.classList.add("amplifyup-drag-no-drop");
1342
- }
1558
+ this.setComposerDragHighlight(slot, e.clientX, e.clientY);
1343
1559
  };
1344
1560
  const dragleave = (e) => {
1561
+ if (this.composerOverlayDragActive) return;
1345
1562
  const related = e.relatedTarget;
1346
1563
  if (!related || !document.body.contains(related)) {
1347
1564
  clearDragOverState();
@@ -1349,20 +1566,10 @@ Available Console Commands:
1349
1566
  };
1350
1567
  const drop = (e) => {
1351
1568
  e.preventDefault();
1352
- const target = e.target;
1353
- const slot = target?.closest?.(slotSelector);
1569
+ const slot = this.resolveSlotAtPoint(e.clientX, e.clientY);
1354
1570
  clearDragOverState();
1355
1571
  if (!slot || !this.isVisualEditorMode) return;
1356
- const slotName = slot.getAttribute("data-amplifyup-slot") || slot.getAttribute("data-slot-id");
1357
- const isEmpty = slot.getAttribute("data-slot-empty") === "true";
1358
- const win = window;
1359
- if (slotName && win.parent && win.parent !== win) {
1360
- win.parent.postMessage({
1361
- type: "DROP_ON_SLOT",
1362
- slotName,
1363
- slotElement: { path: slot.getAttribute("data-slot-path"), isEmpty }
1364
- }, "*");
1365
- }
1572
+ this.postDropOnSlot(slot);
1366
1573
  };
1367
1574
  const mouseover = (e) => {
1368
1575
  if (!this.showZonesEnabled) return;
@@ -1401,7 +1608,11 @@ Available Console Commands:
1401
1608
  document.removeEventListener("mouseover", h.mouseover, true);
1402
1609
  document.removeEventListener("mouseout", h.mouseout, true);
1403
1610
  this.composerDragHandlers = null;
1611
+ this.composerOverlayDragActive = false;
1612
+ this.lastComposerDragSlot = null;
1613
+ this.composerDragMissFrames = 0;
1404
1614
  document.body.classList.remove("amplifyup-drag-no-drop");
1615
+ document.body.classList.remove("amplifyup-composer-dragging");
1405
1616
  document.querySelectorAll("[data-slot-id].amplifyup-drag-over-slot, [data-amplifyup-slot].amplifyup-drag-over-slot").forEach((el) => {
1406
1617
  el.classList.remove("amplifyup-drag-over-slot");
1407
1618
  });
@@ -1442,21 +1653,32 @@ Available Console Commands:
1442
1653
  '[data-slot-id="main"], [data-amplifyup-slot="main"] {',
1443
1654
  " min-height: 50vh !important;",
1444
1655
  "}",
1445
- '[data-slot-id="main"][data-slot-empty="true"]::before,',
1446
- '[data-amplifyup-slot="main"][data-slot-empty="true"]::before {',
1447
- ' content: "Drop components here" !important;',
1448
- " position: absolute !important;",
1449
- " top: 50% !important; left: 50% !important;",
1450
- " transform: translate(-50%, -50%) !important;",
1451
- " font-size: 14px !important; font-weight: 500 !important;",
1452
- " color: rgba(34, 197, 94, 0.65) !important;",
1656
+ /* Single empty-state hint — Slot React label uses .amplifyup-slot-placeholder */
1657
+ ".amplifyup-slot-placeholder {",
1658
+ " display: flex !important;",
1659
+ " align-items: center !important;",
1660
+ " justify-content: center !important;",
1661
+ " min-height: inherit !important;",
1662
+ " color: rgba(34, 197, 94, 0.75) !important;",
1663
+ " font-size: 14px !important;",
1664
+ " font-weight: 500 !important;",
1453
1665
  " pointer-events: none !important;",
1454
- " white-space: nowrap !important;",
1666
+ " text-align: center !important;",
1455
1667
  "}",
1456
1668
  "[data-slot-id].amplifyup-slot-hover, [data-amplifyup-slot].amplifyup-slot-hover {",
1457
1669
  " outline-color: rgba(34, 197, 94, 1) !important;",
1458
1670
  " background: rgba(34, 197, 94, 0.06) !important;",
1459
1671
  "}",
1672
+ /* During any Composer drag, hide idle slot labels so they don't flash
1673
+ when the active drag-over class briefly changes */
1674
+ "body.amplifyup-composer-dragging .amplifyup-slot-placeholder {",
1675
+ " visibility: hidden !important;",
1676
+ " opacity: 0 !important;",
1677
+ "}",
1678
+ "body.amplifyup-composer-dragging [data-slot-id]::before,",
1679
+ "body.amplifyup-composer-dragging [data-amplifyup-slot]::before {",
1680
+ " content: none !important;",
1681
+ "}",
1460
1682
  "[data-slot-id].amplifyup-drag-over-slot, [data-amplifyup-slot].amplifyup-drag-over-slot {",
1461
1683
  " outline: 2px solid rgba(34, 197, 94, 1) !important;",
1462
1684
  " background: rgba(34, 197, 94, 0.18) !important;",
@@ -1472,7 +1694,7 @@ Available Console Commands:
1472
1694
  " color: rgb(22, 163, 74) !important;",
1473
1695
  " pointer-events: none !important;",
1474
1696
  " white-space: nowrap !important;",
1475
- " z-index: 1 !important;",
1697
+ " z-index: 2 !important;",
1476
1698
  "}",
1477
1699
  "body.amplifyup-drag-no-drop { cursor: no-drop !important; }",
1478
1700
  "body.amplifyup-drag-no-drop::before {",
@@ -1599,18 +1821,23 @@ Available Console Commands:
1599
1821
  sendSelectionMessage(element, hierarchy, isEmpty) {
1600
1822
  if (!this.isVisualEditorMode) return;
1601
1823
  const componentId = element.getAttribute("data-amplifyup-component") || element.getAttribute("data-component-id");
1602
- const slotName = element.getAttribute("data-amplifyup-slot") || element.getAttribute("data-slot-id");
1824
+ const slotName = componentId ? null : element.getAttribute("data-amplifyup-slot") || element.getAttribute("data-slot-id");
1603
1825
  const componentName = element.getAttribute("data-component-name");
1604
1826
  const hierarchyInfo = hierarchy.map((el, index) => {
1605
1827
  const elComponentId = el.getAttribute("data-amplifyup-component") || el.getAttribute("data-component-id");
1606
1828
  const elSlotName = el.getAttribute("data-amplifyup-slot") || el.getAttribute("data-slot-id");
1607
1829
  const elComponentName = el.getAttribute("data-component-name");
1830
+ const isSlot = !elComponentId && !!elSlotName;
1831
+ const isPageSlot = isSlot && el.getAttribute("data-slot-source") === "page";
1832
+ const nodeId = el.getAttribute("data-node-id") || (isSlot ? el.getAttribute("data-parent-node-id") : null);
1608
1833
  return {
1609
1834
  index,
1610
1835
  componentId: elComponentId,
1611
- componentName: elComponentName,
1612
- slotName: elSlotName,
1613
- isSlot: !!elSlotName
1836
+ componentName: isPageSlot ? "Page" : elComponentName,
1837
+ slotName: isSlot ? elSlotName : null,
1838
+ isSlot,
1839
+ isPageSlot,
1840
+ nodeId
1614
1841
  };
1615
1842
  });
1616
1843
  const rect = element.getBoundingClientRect ? element.getBoundingClientRect() : null;
@@ -1647,7 +1874,6 @@ Available Console Commands:
1647
1874
  return;
1648
1875
  }
1649
1876
  const doc = document;
1650
- const win = window;
1651
1877
  if (highlightComponents) {
1652
1878
  const componentElements = doc.querySelectorAll("[data-amplifyup-component], [data-component-id]");
1653
1879
  console.log("[AmplifyUp SDK] Found", componentElements.length, "components to highlight");
@@ -1708,52 +1934,8 @@ Available Console Commands:
1708
1934
  e.stopPropagation();
1709
1935
  this.sendSelectionMessage(htmlEl, hierarchy, isEmpty);
1710
1936
  };
1711
- const handleDrop = (e) => {
1712
- e.preventDefault();
1713
- e.stopPropagation();
1714
- htmlEl.classList.remove("amplifyup-drag-over-slot");
1715
- if (!win.parent || win.parent === win) return;
1716
- win.parent.postMessage({
1717
- type: "DROP_ON_SLOT",
1718
- slotName,
1719
- slotElement: { path: htmlEl.getAttribute("data-slot-path"), isEmpty }
1720
- }, "*");
1721
- try {
1722
- const data = JSON.parse(e.dataTransfer.getData("application/json"));
1723
- if (data.type === "component") {
1724
- win.parent.postMessage({
1725
- type: "COMPONENT_DROPPED",
1726
- componentId: data.componentId,
1727
- componentName: data.componentName,
1728
- slotName,
1729
- slotElement: { path: htmlEl.getAttribute("data-slot-path"), isEmpty }
1730
- }, "*");
1731
- }
1732
- } catch (_err) {
1733
- }
1734
- };
1735
- const handleDragOver = (e) => {
1736
- e.preventDefault();
1737
- e.stopPropagation();
1738
- e.dataTransfer.dropEffect = "copy";
1739
- htmlEl.classList.add("amplifyup-drag-over-slot");
1740
- };
1741
- const handleDragLeave = (e) => {
1742
- const related = e.relatedTarget;
1743
- if (!related || !htmlEl.contains(related)) {
1744
- htmlEl.classList.remove("amplifyup-drag-over-slot");
1745
- }
1746
- };
1747
1937
  htmlEl.addEventListener("click", handleClick);
1748
- htmlEl.addEventListener("dragover", handleDragOver);
1749
- htmlEl.addEventListener("dragleave", handleDragLeave);
1750
- htmlEl.addEventListener("drop", handleDrop);
1751
- htmlEl._amplifyupSlotHandlers = {
1752
- handleClick,
1753
- handleDragOver,
1754
- handleDragLeave,
1755
- handleDrop
1756
- };
1938
+ htmlEl._amplifyupSlotHandlers = { handleClick };
1757
1939
  });
1758
1940
  }
1759
1941
  }