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