@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/react.mjs
CHANGED
|
@@ -563,6 +563,8 @@ var AmplifyUpSDK = class {
|
|
|
563
563
|
this.showZonesEnabled = false;
|
|
564
564
|
this.componentRegistry = [];
|
|
565
565
|
this.messageListener = null;
|
|
566
|
+
this.composerBoundsRaf = 0;
|
|
567
|
+
this.composerBoundsScrollListener = null;
|
|
566
568
|
this.mutationObserver = null;
|
|
567
569
|
this.composerDragHandlers = null;
|
|
568
570
|
/** Last slot highlighted during Composer drag — avoid clear/re-add flicker. */
|
|
@@ -2221,6 +2223,7 @@ Available Console Commands:
|
|
|
2221
2223
|
this.applyComponentHighlights(highlightComponents, showZones);
|
|
2222
2224
|
this.setupMutationObserver();
|
|
2223
2225
|
this.setupComposerDragDrop();
|
|
2226
|
+
this.setupComposerBoundsTracking();
|
|
2224
2227
|
}
|
|
2225
2228
|
previouslySelected.forEach((el) => {
|
|
2226
2229
|
if (document.contains(el)) {
|
|
@@ -2375,6 +2378,52 @@ Available Console Commands:
|
|
|
2375
2378
|
this.clearComposerSelection();
|
|
2376
2379
|
element.classList.add("amplifyup-selected");
|
|
2377
2380
|
}
|
|
2381
|
+
postComposerSelectionBounds() {
|
|
2382
|
+
if (typeof document === "undefined") return;
|
|
2383
|
+
if (!window.parent || window.parent === window) return;
|
|
2384
|
+
const el = document.querySelector(".amplifyup-selected");
|
|
2385
|
+
if (!el) return;
|
|
2386
|
+
const rect = el.getBoundingClientRect();
|
|
2387
|
+
window.parent.postMessage(
|
|
2388
|
+
{
|
|
2389
|
+
type: "SELECTION_BOUNDS",
|
|
2390
|
+
bounds: {
|
|
2391
|
+
top: rect.top,
|
|
2392
|
+
left: rect.left,
|
|
2393
|
+
width: rect.width,
|
|
2394
|
+
height: rect.height
|
|
2395
|
+
}
|
|
2396
|
+
},
|
|
2397
|
+
"*"
|
|
2398
|
+
);
|
|
2399
|
+
}
|
|
2400
|
+
setupComposerBoundsTracking() {
|
|
2401
|
+
if (typeof document === "undefined") return;
|
|
2402
|
+
this.teardownComposerBoundsTracking();
|
|
2403
|
+
const onScroll = () => {
|
|
2404
|
+
if (this.composerBoundsRaf) return;
|
|
2405
|
+
this.composerBoundsRaf = requestAnimationFrame(() => {
|
|
2406
|
+
this.composerBoundsRaf = 0;
|
|
2407
|
+
this.postComposerSelectionBounds();
|
|
2408
|
+
});
|
|
2409
|
+
};
|
|
2410
|
+
this.composerBoundsScrollListener = onScroll;
|
|
2411
|
+
document.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2412
|
+
window.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2413
|
+
window.addEventListener("resize", onScroll);
|
|
2414
|
+
}
|
|
2415
|
+
teardownComposerBoundsTracking() {
|
|
2416
|
+
const onScroll = this.composerBoundsScrollListener;
|
|
2417
|
+
this.composerBoundsScrollListener = null;
|
|
2418
|
+
if (this.composerBoundsRaf) {
|
|
2419
|
+
cancelAnimationFrame(this.composerBoundsRaf);
|
|
2420
|
+
this.composerBoundsRaf = 0;
|
|
2421
|
+
}
|
|
2422
|
+
if (!onScroll || typeof document === "undefined") return;
|
|
2423
|
+
document.removeEventListener("scroll", onScroll, true);
|
|
2424
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
2425
|
+
window.removeEventListener("resize", onScroll);
|
|
2426
|
+
}
|
|
2378
2427
|
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
2379
2428
|
injectComposerHighlightStyles(highlightComponents, showZones) {
|
|
2380
2429
|
if (typeof document === "undefined") return;
|
|
@@ -2542,6 +2591,7 @@ Available Console Commands:
|
|
|
2542
2591
|
if (typeof document === "undefined") return;
|
|
2543
2592
|
const clearSelection = opts?.clearSelection !== false;
|
|
2544
2593
|
this.highlightingEnabled = false;
|
|
2594
|
+
this.teardownComposerBoundsTracking();
|
|
2545
2595
|
this.teardownComposerDragDrop();
|
|
2546
2596
|
if (opts?.clearSelection !== false && typeof window !== "undefined") {
|
|
2547
2597
|
window.__AMPLIFYUP_COMPOSER_EDIT__ = false;
|