@amplifyup/sdk 0.1.31 → 0.1.32
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 +50 -0
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +50 -0
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +50 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +50 -0
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -552,6 +552,8 @@ var AmplifyUpSDK = class {
|
|
|
552
552
|
this.showZonesEnabled = false;
|
|
553
553
|
this.componentRegistry = [];
|
|
554
554
|
this.messageListener = null;
|
|
555
|
+
this.composerBoundsRaf = 0;
|
|
556
|
+
this.composerBoundsScrollListener = null;
|
|
555
557
|
this.mutationObserver = null;
|
|
556
558
|
this.composerDragHandlers = null;
|
|
557
559
|
/** Last slot highlighted during Composer drag — avoid clear/re-add flicker. */
|
|
@@ -2210,6 +2212,7 @@ Available Console Commands:
|
|
|
2210
2212
|
this.applyComponentHighlights(highlightComponents, showZones);
|
|
2211
2213
|
this.setupMutationObserver();
|
|
2212
2214
|
this.setupComposerDragDrop();
|
|
2215
|
+
this.setupComposerBoundsTracking();
|
|
2213
2216
|
}
|
|
2214
2217
|
previouslySelected.forEach((el) => {
|
|
2215
2218
|
if (document.contains(el)) {
|
|
@@ -2364,6 +2367,52 @@ Available Console Commands:
|
|
|
2364
2367
|
this.clearComposerSelection();
|
|
2365
2368
|
element.classList.add("amplifyup-selected");
|
|
2366
2369
|
}
|
|
2370
|
+
postComposerSelectionBounds() {
|
|
2371
|
+
if (typeof document === "undefined") return;
|
|
2372
|
+
if (!window.parent || window.parent === window) return;
|
|
2373
|
+
const el = document.querySelector(".amplifyup-selected");
|
|
2374
|
+
if (!el) return;
|
|
2375
|
+
const rect = el.getBoundingClientRect();
|
|
2376
|
+
window.parent.postMessage(
|
|
2377
|
+
{
|
|
2378
|
+
type: "SELECTION_BOUNDS",
|
|
2379
|
+
bounds: {
|
|
2380
|
+
top: rect.top,
|
|
2381
|
+
left: rect.left,
|
|
2382
|
+
width: rect.width,
|
|
2383
|
+
height: rect.height
|
|
2384
|
+
}
|
|
2385
|
+
},
|
|
2386
|
+
"*"
|
|
2387
|
+
);
|
|
2388
|
+
}
|
|
2389
|
+
setupComposerBoundsTracking() {
|
|
2390
|
+
if (typeof document === "undefined") return;
|
|
2391
|
+
this.teardownComposerBoundsTracking();
|
|
2392
|
+
const onScroll = () => {
|
|
2393
|
+
if (this.composerBoundsRaf) return;
|
|
2394
|
+
this.composerBoundsRaf = requestAnimationFrame(() => {
|
|
2395
|
+
this.composerBoundsRaf = 0;
|
|
2396
|
+
this.postComposerSelectionBounds();
|
|
2397
|
+
});
|
|
2398
|
+
};
|
|
2399
|
+
this.composerBoundsScrollListener = onScroll;
|
|
2400
|
+
document.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2401
|
+
window.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2402
|
+
window.addEventListener("resize", onScroll);
|
|
2403
|
+
}
|
|
2404
|
+
teardownComposerBoundsTracking() {
|
|
2405
|
+
const onScroll = this.composerBoundsScrollListener;
|
|
2406
|
+
this.composerBoundsScrollListener = null;
|
|
2407
|
+
if (this.composerBoundsRaf) {
|
|
2408
|
+
cancelAnimationFrame(this.composerBoundsRaf);
|
|
2409
|
+
this.composerBoundsRaf = 0;
|
|
2410
|
+
}
|
|
2411
|
+
if (!onScroll || typeof document === "undefined") return;
|
|
2412
|
+
document.removeEventListener("scroll", onScroll, true);
|
|
2413
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
2414
|
+
window.removeEventListener("resize", onScroll);
|
|
2415
|
+
}
|
|
2367
2416
|
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
2368
2417
|
injectComposerHighlightStyles(highlightComponents, showZones) {
|
|
2369
2418
|
if (typeof document === "undefined") return;
|
|
@@ -2531,6 +2580,7 @@ Available Console Commands:
|
|
|
2531
2580
|
if (typeof document === "undefined") return;
|
|
2532
2581
|
const clearSelection = opts?.clearSelection !== false;
|
|
2533
2582
|
this.highlightingEnabled = false;
|
|
2583
|
+
this.teardownComposerBoundsTracking();
|
|
2534
2584
|
this.teardownComposerDragDrop();
|
|
2535
2585
|
if (opts?.clearSelection !== false && typeof window !== "undefined") {
|
|
2536
2586
|
window.__AMPLIFYUP_COMPOSER_EDIT__ = false;
|