@amplifyup/sdk 0.1.7 → 0.1.8
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/AmplifyRenderer.js +167 -83
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +167 -83
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +157 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +157 -82
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +176 -84
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +176 -84
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,8 @@ declare class AmplifyUpSDK {
|
|
|
32
32
|
/** Ensures auto page() on init fires once per page load */
|
|
33
33
|
private initialPageSent;
|
|
34
34
|
private highlightingEnabled;
|
|
35
|
+
private highlightComponentsEnabled;
|
|
36
|
+
private showZonesEnabled;
|
|
35
37
|
private componentRegistry;
|
|
36
38
|
private messageListener;
|
|
37
39
|
private mutationObserver;
|
|
@@ -215,6 +217,8 @@ declare class AmplifyUpSDK {
|
|
|
215
217
|
* Enable component highlighting
|
|
216
218
|
*/
|
|
217
219
|
private enableHighlighting;
|
|
220
|
+
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
221
|
+
private injectComposerHighlightStyles;
|
|
218
222
|
/**
|
|
219
223
|
* Set up MutationObserver to watch for new components being added
|
|
220
224
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ declare class AmplifyUpSDK {
|
|
|
32
32
|
/** Ensures auto page() on init fires once per page load */
|
|
33
33
|
private initialPageSent;
|
|
34
34
|
private highlightingEnabled;
|
|
35
|
+
private highlightComponentsEnabled;
|
|
36
|
+
private showZonesEnabled;
|
|
35
37
|
private componentRegistry;
|
|
36
38
|
private messageListener;
|
|
37
39
|
private mutationObserver;
|
|
@@ -215,6 +217,8 @@ declare class AmplifyUpSDK {
|
|
|
215
217
|
* Enable component highlighting
|
|
216
218
|
*/
|
|
217
219
|
private enableHighlighting;
|
|
220
|
+
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
221
|
+
private injectComposerHighlightStyles;
|
|
218
222
|
/**
|
|
219
223
|
* Set up MutationObserver to watch for new components being added
|
|
220
224
|
*/
|
package/dist/index.js
CHANGED
|
@@ -338,6 +338,8 @@ var AmplifyUpSDK = class {
|
|
|
338
338
|
/** Ensures auto page() on init fires once per page load */
|
|
339
339
|
this.initialPageSent = false;
|
|
340
340
|
this.highlightingEnabled = false;
|
|
341
|
+
this.highlightComponentsEnabled = true;
|
|
342
|
+
this.showZonesEnabled = false;
|
|
341
343
|
this.componentRegistry = [];
|
|
342
344
|
this.messageListener = null;
|
|
343
345
|
this.mutationObserver = null;
|
|
@@ -1132,7 +1134,7 @@ Available Console Commands:
|
|
|
1132
1134
|
}
|
|
1133
1135
|
if (event.data?.type === "GET_ELEMENT_POSITION") {
|
|
1134
1136
|
const { componentId, slotName } = event.data;
|
|
1135
|
-
const selector = slotName ? `[data-amplifyup-slot="${slotName}"]` : `[data-amplifyup-component="${componentId}"], [data-component-id="${componentId}"]`;
|
|
1137
|
+
const selector = slotName ? `[data-amplifyup-slot="${slotName}"], [data-slot-id="${slotName}"]` : `[data-amplifyup-component="${componentId}"], [data-component-id="${componentId}"]`;
|
|
1136
1138
|
console.log("[AmplifyUp SDK] Finding element position:", { selector, componentId, slotName });
|
|
1137
1139
|
const element = document.querySelector(selector);
|
|
1138
1140
|
if (element) {
|
|
@@ -1270,12 +1272,62 @@ Available Console Commands:
|
|
|
1270
1272
|
if (typeof document === "undefined") return;
|
|
1271
1273
|
this.componentRegistry = componentRegistry;
|
|
1272
1274
|
this.highlightingEnabled = true;
|
|
1275
|
+
this.highlightComponentsEnabled = highlightComponents;
|
|
1276
|
+
this.showZonesEnabled = showZones;
|
|
1273
1277
|
this.disableHighlighting();
|
|
1274
|
-
|
|
1275
|
-
|
|
1278
|
+
this.highlightingEnabled = true;
|
|
1279
|
+
this.injectComposerHighlightStyles(highlightComponents, showZones);
|
|
1280
|
+
if (highlightComponents || showZones) {
|
|
1281
|
+
this.applyComponentHighlights(highlightComponents, showZones);
|
|
1276
1282
|
this.setupMutationObserver();
|
|
1277
1283
|
}
|
|
1278
1284
|
}
|
|
1285
|
+
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
1286
|
+
injectComposerHighlightStyles(highlightComponents, showZones) {
|
|
1287
|
+
if (typeof document === "undefined") return;
|
|
1288
|
+
if (!highlightComponents && !showZones) return;
|
|
1289
|
+
const existing = document.getElementById("amplifyup-preview-highlights");
|
|
1290
|
+
if (existing) existing.remove();
|
|
1291
|
+
const lines = [];
|
|
1292
|
+
if (highlightComponents) {
|
|
1293
|
+
lines.push(
|
|
1294
|
+
"[data-amplifyup-component], [data-component-id] {",
|
|
1295
|
+
" outline: 1px dashed rgba(59, 130, 246, 0.8) !important;",
|
|
1296
|
+
" outline-offset: 2px !important;",
|
|
1297
|
+
" cursor: pointer !important;",
|
|
1298
|
+
"}",
|
|
1299
|
+
"[data-amplifyup-component]:hover, [data-component-id]:hover {",
|
|
1300
|
+
" outline-color: rgba(59, 130, 246, 1) !important;",
|
|
1301
|
+
"}"
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1304
|
+
if (showZones) {
|
|
1305
|
+
lines.push(
|
|
1306
|
+
"[data-slot-id], [data-amplifyup-slot] {",
|
|
1307
|
+
" outline: 2px dotted rgba(34, 197, 94, 0.75) !important;",
|
|
1308
|
+
" outline-offset: 4px !important;",
|
|
1309
|
+
" min-height: 3rem !important;",
|
|
1310
|
+
" box-sizing: border-box !important;",
|
|
1311
|
+
" cursor: pointer !important;",
|
|
1312
|
+
"}",
|
|
1313
|
+
'[data-slot-id="main"], [data-amplifyup-slot="main"] {',
|
|
1314
|
+
" min-height: 50vh !important;",
|
|
1315
|
+
"}",
|
|
1316
|
+
"[data-slot-id].amplifyup-slot-hover, [data-amplifyup-slot].amplifyup-slot-hover {",
|
|
1317
|
+
" outline-color: rgba(34, 197, 94, 1) !important;",
|
|
1318
|
+
" background: rgba(34, 197, 94, 0.06) !important;",
|
|
1319
|
+
"}",
|
|
1320
|
+
"[data-slot-id].amplifyup-drag-over-slot, [data-amplifyup-slot].amplifyup-drag-over-slot {",
|
|
1321
|
+
" outline: 2px solid rgba(34, 197, 94, 1) !important;",
|
|
1322
|
+
" background: rgba(34, 197, 94, 0.1) !important;",
|
|
1323
|
+
"}"
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
const style = document.createElement("style");
|
|
1327
|
+
style.id = "amplifyup-preview-highlights";
|
|
1328
|
+
style.textContent = lines.join("\n");
|
|
1329
|
+
document.head.appendChild(style);
|
|
1330
|
+
}
|
|
1279
1331
|
/**
|
|
1280
1332
|
* Set up MutationObserver to watch for new components being added
|
|
1281
1333
|
*/
|
|
@@ -1291,14 +1343,14 @@ Available Console Commands:
|
|
|
1291
1343
|
mutation.addedNodes.forEach((node) => {
|
|
1292
1344
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
1293
1345
|
const el = node;
|
|
1294
|
-
if (el.hasAttribute("data-amplifyup-component") || el.hasAttribute("data-component-id") || el.hasAttribute("data-amplifyup-slot") || el.querySelector("[data-amplifyup-component], [data-component-id], [data-amplifyup-slot]")) {
|
|
1346
|
+
if (el.hasAttribute("data-amplifyup-component") || el.hasAttribute("data-component-id") || el.hasAttribute("data-amplifyup-slot") || el.hasAttribute("data-slot-id") || el.querySelector("[data-amplifyup-component], [data-component-id], [data-amplifyup-slot], [data-slot-id]")) {
|
|
1295
1347
|
shouldReapply = true;
|
|
1296
1348
|
}
|
|
1297
1349
|
}
|
|
1298
1350
|
});
|
|
1299
1351
|
if (mutation.type === "attributes") {
|
|
1300
1352
|
const target = mutation.target;
|
|
1301
|
-
if (target.hasAttribute("data-amplifyup-slot") || target.hasAttribute("data-slot-empty")) {
|
|
1353
|
+
if (target.hasAttribute("data-amplifyup-slot") || target.hasAttribute("data-slot-id") || target.hasAttribute("data-slot-empty")) {
|
|
1302
1354
|
shouldReapply = true;
|
|
1303
1355
|
}
|
|
1304
1356
|
}
|
|
@@ -1306,7 +1358,10 @@ Available Console Commands:
|
|
|
1306
1358
|
if (shouldReapply && this.highlightingEnabled) {
|
|
1307
1359
|
setTimeout(() => {
|
|
1308
1360
|
if (this.highlightingEnabled) {
|
|
1309
|
-
this.applyComponentHighlights(
|
|
1361
|
+
this.applyComponentHighlights(
|
|
1362
|
+
this.highlightComponentsEnabled,
|
|
1363
|
+
this.showZonesEnabled
|
|
1364
|
+
);
|
|
1310
1365
|
}
|
|
1311
1366
|
}, 100);
|
|
1312
1367
|
}
|
|
@@ -1315,7 +1370,7 @@ Available Console Commands:
|
|
|
1315
1370
|
childList: true,
|
|
1316
1371
|
subtree: true,
|
|
1317
1372
|
attributes: true,
|
|
1318
|
-
attributeFilter: ["data-amplifyup-component", "data-component-id", "data-amplifyup-slot", "data-slot-empty"]
|
|
1373
|
+
attributeFilter: ["data-amplifyup-component", "data-component-id", "data-amplifyup-slot", "data-slot-id", "data-slot-empty"]
|
|
1319
1374
|
});
|
|
1320
1375
|
}
|
|
1321
1376
|
/**
|
|
@@ -1328,6 +1383,7 @@ Available Console Commands:
|
|
|
1328
1383
|
this.mutationObserver.disconnect();
|
|
1329
1384
|
this.mutationObserver = null;
|
|
1330
1385
|
}
|
|
1386
|
+
document.getElementById("amplifyup-preview-highlights")?.remove();
|
|
1331
1387
|
document.querySelectorAll(".amplifyup-component-highlight").forEach((el) => {
|
|
1332
1388
|
const htmlEl = el;
|
|
1333
1389
|
const handlers = htmlEl._amplifyupHandlers;
|
|
@@ -1343,6 +1399,7 @@ Available Console Commands:
|
|
|
1343
1399
|
if (handlers) {
|
|
1344
1400
|
if (handlers.handleClick) htmlEl.removeEventListener("click", handlers.handleClick);
|
|
1345
1401
|
if (handlers.handleDragOver) htmlEl.removeEventListener("dragover", handlers.handleDragOver);
|
|
1402
|
+
if (handlers.handleDragLeave) htmlEl.removeEventListener("dragleave", handlers.handleDragLeave);
|
|
1346
1403
|
if (handlers.handleDrop) htmlEl.removeEventListener("drop", handlers.handleDrop);
|
|
1347
1404
|
}
|
|
1348
1405
|
delete htmlEl._amplifyupSlotHandlers;
|
|
@@ -1356,7 +1413,7 @@ Available Console Commands:
|
|
|
1356
1413
|
const hierarchy = [];
|
|
1357
1414
|
let current = element;
|
|
1358
1415
|
while (current) {
|
|
1359
|
-
if (current.hasAttribute("data-amplifyup-component") || current.hasAttribute("data-component-id") || current.hasAttribute("data-amplifyup-slot")) {
|
|
1416
|
+
if (current.hasAttribute("data-amplifyup-component") || current.hasAttribute("data-component-id") || current.hasAttribute("data-amplifyup-slot") || current.hasAttribute("data-slot-id")) {
|
|
1360
1417
|
hierarchy.push(current);
|
|
1361
1418
|
}
|
|
1362
1419
|
current = current.parentElement;
|
|
@@ -1369,11 +1426,11 @@ Available Console Commands:
|
|
|
1369
1426
|
sendSelectionMessage(element, hierarchy, isEmpty) {
|
|
1370
1427
|
if (!this.isVisualEditorMode) return;
|
|
1371
1428
|
const componentId = element.getAttribute("data-amplifyup-component") || element.getAttribute("data-component-id");
|
|
1372
|
-
const slotName = element.getAttribute("data-amplifyup-slot");
|
|
1429
|
+
const slotName = element.getAttribute("data-amplifyup-slot") || element.getAttribute("data-slot-id");
|
|
1373
1430
|
const componentName = element.getAttribute("data-component-name");
|
|
1374
1431
|
const hierarchyInfo = hierarchy.map((el, index) => {
|
|
1375
1432
|
const elComponentId = el.getAttribute("data-amplifyup-component") || el.getAttribute("data-component-id");
|
|
1376
|
-
const elSlotName = el.getAttribute("data-amplifyup-slot");
|
|
1433
|
+
const elSlotName = el.getAttribute("data-amplifyup-slot") || el.getAttribute("data-slot-id");
|
|
1377
1434
|
const elComponentName = el.getAttribute("data-component-name");
|
|
1378
1435
|
return {
|
|
1379
1436
|
index,
|
|
@@ -1411,98 +1468,116 @@ Available Console Commands:
|
|
|
1411
1468
|
/**
|
|
1412
1469
|
* Apply component highlights
|
|
1413
1470
|
*/
|
|
1414
|
-
applyComponentHighlights() {
|
|
1471
|
+
applyComponentHighlights(highlightComponents = true, showZones = true) {
|
|
1415
1472
|
if (typeof document === "undefined") return;
|
|
1416
1473
|
if (!this.isVisualEditorMode) {
|
|
1417
1474
|
return;
|
|
1418
1475
|
}
|
|
1419
1476
|
const doc = document;
|
|
1420
1477
|
const win = window;
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
console.log("[AmplifyUp SDK] Found", slotElements.length, "slots to highlight");
|
|
1426
|
-
componentElements.forEach((el) => {
|
|
1427
|
-
const htmlEl = el;
|
|
1428
|
-
const componentId = htmlEl.getAttribute("data-amplifyup-component") || htmlEl.getAttribute("data-component-id");
|
|
1429
|
-
if (!componentId) return;
|
|
1430
|
-
if (htmlEl.classList.contains("amplifyup-component-highlight")) return;
|
|
1431
|
-
const component = this.componentRegistry.find((c) => c.component_id === componentId);
|
|
1432
|
-
htmlEl.classList.add("amplifyup-component-highlight");
|
|
1433
|
-
htmlEl.setAttribute("data-component-id", componentId);
|
|
1434
|
-
htmlEl.setAttribute("data-component-name", component?.component_name || componentId);
|
|
1435
|
-
const hierarchy = this.buildComponentHierarchy(htmlEl);
|
|
1436
|
-
const handleClick = (e) => {
|
|
1437
|
-
e.stopPropagation();
|
|
1438
|
-
this.sendSelectionMessage(htmlEl, hierarchy);
|
|
1439
|
-
if (window.parent && window.parent !== window) {
|
|
1440
|
-
window.parent.postMessage({ type: "CHECK_COMPONENT_DELETABLE", componentId }, "*");
|
|
1441
|
-
}
|
|
1442
|
-
};
|
|
1443
|
-
htmlEl.addEventListener("click", handleClick);
|
|
1444
|
-
htmlEl._amplifyupHandlers = { handleClick };
|
|
1445
|
-
});
|
|
1446
|
-
this.componentRegistry.forEach((component) => {
|
|
1447
|
-
if (!component.data_attribute) return;
|
|
1448
|
-
const elements = doc.querySelectorAll(`[${component.data_attribute}]`);
|
|
1449
|
-
elements.forEach((el) => {
|
|
1478
|
+
if (highlightComponents) {
|
|
1479
|
+
const componentElements = doc.querySelectorAll("[data-amplifyup-component], [data-component-id]");
|
|
1480
|
+
console.log("[AmplifyUp SDK] Found", componentElements.length, "components to highlight");
|
|
1481
|
+
componentElements.forEach((el) => {
|
|
1450
1482
|
const htmlEl = el;
|
|
1483
|
+
const componentId = htmlEl.getAttribute("data-amplifyup-component") || htmlEl.getAttribute("data-component-id");
|
|
1484
|
+
if (!componentId) return;
|
|
1451
1485
|
if (htmlEl.classList.contains("amplifyup-component-highlight")) return;
|
|
1486
|
+
const component = this.componentRegistry.find((c) => c.component_id === componentId);
|
|
1452
1487
|
htmlEl.classList.add("amplifyup-component-highlight");
|
|
1453
|
-
htmlEl.setAttribute("data-component-id",
|
|
1454
|
-
htmlEl.setAttribute("data-component-name", component
|
|
1488
|
+
htmlEl.setAttribute("data-component-id", componentId);
|
|
1489
|
+
htmlEl.setAttribute("data-component-name", component?.component_name || componentId);
|
|
1455
1490
|
const hierarchy = this.buildComponentHierarchy(htmlEl);
|
|
1456
1491
|
const handleClick = (e) => {
|
|
1457
1492
|
e.stopPropagation();
|
|
1458
1493
|
this.sendSelectionMessage(htmlEl, hierarchy);
|
|
1459
1494
|
if (window.parent && window.parent !== window) {
|
|
1460
|
-
window.parent.postMessage({ type: "CHECK_COMPONENT_DELETABLE", componentId
|
|
1495
|
+
window.parent.postMessage({ type: "CHECK_COMPONENT_DELETABLE", componentId }, "*");
|
|
1461
1496
|
}
|
|
1462
1497
|
};
|
|
1463
1498
|
htmlEl.addEventListener("click", handleClick);
|
|
1464
1499
|
htmlEl._amplifyupHandlers = { handleClick };
|
|
1465
1500
|
});
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1501
|
+
this.componentRegistry.forEach((component) => {
|
|
1502
|
+
if (!component.data_attribute) return;
|
|
1503
|
+
const elements = doc.querySelectorAll(`[${component.data_attribute}]`);
|
|
1504
|
+
elements.forEach((el) => {
|
|
1505
|
+
const htmlEl = el;
|
|
1506
|
+
if (htmlEl.classList.contains("amplifyup-component-highlight")) return;
|
|
1507
|
+
htmlEl.classList.add("amplifyup-component-highlight");
|
|
1508
|
+
htmlEl.setAttribute("data-component-id", component.component_id);
|
|
1509
|
+
htmlEl.setAttribute("data-component-name", component.component_name);
|
|
1510
|
+
const hierarchy = this.buildComponentHierarchy(htmlEl);
|
|
1511
|
+
const handleClick = (e) => {
|
|
1512
|
+
e.stopPropagation();
|
|
1513
|
+
this.sendSelectionMessage(htmlEl, hierarchy);
|
|
1514
|
+
if (window.parent && window.parent !== window) {
|
|
1515
|
+
window.parent.postMessage({ type: "CHECK_COMPONENT_DELETABLE", componentId: component.component_id }, "*");
|
|
1516
|
+
}
|
|
1517
|
+
};
|
|
1518
|
+
htmlEl.addEventListener("click", handleClick);
|
|
1519
|
+
htmlEl._amplifyupHandlers = { handleClick };
|
|
1520
|
+
});
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
if (showZones) {
|
|
1524
|
+
const slotElements = doc.querySelectorAll("[data-amplifyup-slot], [data-slot-id]");
|
|
1525
|
+
console.log("[AmplifyUp SDK] Found", slotElements.length, "slots to highlight");
|
|
1526
|
+
slotElements.forEach((el) => {
|
|
1527
|
+
const htmlEl = el;
|
|
1528
|
+
const slotName = htmlEl.getAttribute("data-amplifyup-slot") || htmlEl.getAttribute("data-slot-id");
|
|
1529
|
+
const isEmpty = htmlEl.getAttribute("data-slot-empty") === "true";
|
|
1530
|
+
if (!slotName) return;
|
|
1531
|
+
if (htmlEl.classList.contains("amplifyup-slot-highlight")) return;
|
|
1532
|
+
htmlEl.classList.add("amplifyup-slot-highlight");
|
|
1533
|
+
const hierarchy = this.buildComponentHierarchy(htmlEl);
|
|
1534
|
+
const handleClick = (e) => {
|
|
1535
|
+
e.stopPropagation();
|
|
1536
|
+
this.sendSelectionMessage(htmlEl, hierarchy, isEmpty);
|
|
1537
|
+
};
|
|
1538
|
+
const handleDrop = (e) => {
|
|
1539
|
+
e.preventDefault();
|
|
1540
|
+
e.stopPropagation();
|
|
1541
|
+
htmlEl.classList.remove("amplifyup-drag-over-slot");
|
|
1542
|
+
try {
|
|
1543
|
+
const data = JSON.parse(e.dataTransfer.getData("application/json"));
|
|
1544
|
+
if (data.type === "component" && win.parent && win.parent !== win) {
|
|
1545
|
+
win.parent.postMessage({
|
|
1546
|
+
type: "COMPONENT_DROPPED",
|
|
1547
|
+
componentId: data.componentId,
|
|
1548
|
+
componentName: data.componentName,
|
|
1549
|
+
slotName,
|
|
1550
|
+
slotElement: { path: htmlEl.getAttribute("data-slot-path"), isEmpty }
|
|
1551
|
+
}, "*");
|
|
1552
|
+
win.parent.postMessage({ type: "DROP_ON_SLOT", slotName }, "*");
|
|
1553
|
+
}
|
|
1554
|
+
} catch (_err) {
|
|
1492
1555
|
}
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1556
|
+
};
|
|
1557
|
+
const handleDragOver = (e) => {
|
|
1558
|
+
e.preventDefault();
|
|
1559
|
+
e.stopPropagation();
|
|
1560
|
+
e.dataTransfer.dropEffect = "copy";
|
|
1561
|
+
htmlEl.classList.add("amplifyup-drag-over-slot");
|
|
1562
|
+
};
|
|
1563
|
+
const handleDragLeave = (e) => {
|
|
1564
|
+
const related = e.relatedTarget;
|
|
1565
|
+
if (!related || !htmlEl.contains(related)) {
|
|
1566
|
+
htmlEl.classList.remove("amplifyup-drag-over-slot");
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
htmlEl.addEventListener("click", handleClick);
|
|
1570
|
+
htmlEl.addEventListener("dragover", handleDragOver);
|
|
1571
|
+
htmlEl.addEventListener("dragleave", handleDragLeave);
|
|
1572
|
+
htmlEl.addEventListener("drop", handleDrop);
|
|
1573
|
+
htmlEl._amplifyupSlotHandlers = {
|
|
1574
|
+
handleClick,
|
|
1575
|
+
handleDragOver,
|
|
1576
|
+
handleDragLeave,
|
|
1577
|
+
handleDrop
|
|
1578
|
+
};
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1506
1581
|
}
|
|
1507
1582
|
/**
|
|
1508
1583
|
* Cleanup: Remove message listener and observers
|