@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.d.mts
CHANGED
|
@@ -146,6 +146,8 @@ declare class AmplifyUpSDK {
|
|
|
146
146
|
private showZonesEnabled;
|
|
147
147
|
private componentRegistry;
|
|
148
148
|
private messageListener;
|
|
149
|
+
private composerBoundsRaf;
|
|
150
|
+
private composerBoundsScrollListener;
|
|
149
151
|
private mutationObserver;
|
|
150
152
|
private composerDragHandlers;
|
|
151
153
|
/** Last slot highlighted during Composer drag — avoid clear/re-add flicker. */
|
|
@@ -415,6 +417,9 @@ declare class AmplifyUpSDK {
|
|
|
415
417
|
private teardownComposerDragDrop;
|
|
416
418
|
private clearComposerSelection;
|
|
417
419
|
private markComposerSelection;
|
|
420
|
+
private postComposerSelectionBounds;
|
|
421
|
+
private setupComposerBoundsTracking;
|
|
422
|
+
private teardownComposerBoundsTracking;
|
|
418
423
|
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
419
424
|
private injectComposerHighlightStyles;
|
|
420
425
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -146,6 +146,8 @@ declare class AmplifyUpSDK {
|
|
|
146
146
|
private showZonesEnabled;
|
|
147
147
|
private componentRegistry;
|
|
148
148
|
private messageListener;
|
|
149
|
+
private composerBoundsRaf;
|
|
150
|
+
private composerBoundsScrollListener;
|
|
149
151
|
private mutationObserver;
|
|
150
152
|
private composerDragHandlers;
|
|
151
153
|
/** Last slot highlighted during Composer drag — avoid clear/re-add flicker. */
|
|
@@ -415,6 +417,9 @@ declare class AmplifyUpSDK {
|
|
|
415
417
|
private teardownComposerDragDrop;
|
|
416
418
|
private clearComposerSelection;
|
|
417
419
|
private markComposerSelection;
|
|
420
|
+
private postComposerSelectionBounds;
|
|
421
|
+
private setupComposerBoundsTracking;
|
|
422
|
+
private teardownComposerBoundsTracking;
|
|
418
423
|
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
419
424
|
private injectComposerHighlightStyles;
|
|
420
425
|
/**
|
package/dist/index.js
CHANGED
|
@@ -556,6 +556,8 @@ var AmplifyUpSDK = class {
|
|
|
556
556
|
this.showZonesEnabled = false;
|
|
557
557
|
this.componentRegistry = [];
|
|
558
558
|
this.messageListener = null;
|
|
559
|
+
this.composerBoundsRaf = 0;
|
|
560
|
+
this.composerBoundsScrollListener = null;
|
|
559
561
|
this.mutationObserver = null;
|
|
560
562
|
this.composerDragHandlers = null;
|
|
561
563
|
/** Last slot highlighted during Composer drag — avoid clear/re-add flicker. */
|
|
@@ -2214,6 +2216,7 @@ Available Console Commands:
|
|
|
2214
2216
|
this.applyComponentHighlights(highlightComponents, showZones);
|
|
2215
2217
|
this.setupMutationObserver();
|
|
2216
2218
|
this.setupComposerDragDrop();
|
|
2219
|
+
this.setupComposerBoundsTracking();
|
|
2217
2220
|
}
|
|
2218
2221
|
previouslySelected.forEach((el) => {
|
|
2219
2222
|
if (document.contains(el)) {
|
|
@@ -2368,6 +2371,52 @@ Available Console Commands:
|
|
|
2368
2371
|
this.clearComposerSelection();
|
|
2369
2372
|
element.classList.add("amplifyup-selected");
|
|
2370
2373
|
}
|
|
2374
|
+
postComposerSelectionBounds() {
|
|
2375
|
+
if (typeof document === "undefined") return;
|
|
2376
|
+
if (!window.parent || window.parent === window) return;
|
|
2377
|
+
const el = document.querySelector(".amplifyup-selected");
|
|
2378
|
+
if (!el) return;
|
|
2379
|
+
const rect = el.getBoundingClientRect();
|
|
2380
|
+
window.parent.postMessage(
|
|
2381
|
+
{
|
|
2382
|
+
type: "SELECTION_BOUNDS",
|
|
2383
|
+
bounds: {
|
|
2384
|
+
top: rect.top,
|
|
2385
|
+
left: rect.left,
|
|
2386
|
+
width: rect.width,
|
|
2387
|
+
height: rect.height
|
|
2388
|
+
}
|
|
2389
|
+
},
|
|
2390
|
+
"*"
|
|
2391
|
+
);
|
|
2392
|
+
}
|
|
2393
|
+
setupComposerBoundsTracking() {
|
|
2394
|
+
if (typeof document === "undefined") return;
|
|
2395
|
+
this.teardownComposerBoundsTracking();
|
|
2396
|
+
const onScroll = () => {
|
|
2397
|
+
if (this.composerBoundsRaf) return;
|
|
2398
|
+
this.composerBoundsRaf = requestAnimationFrame(() => {
|
|
2399
|
+
this.composerBoundsRaf = 0;
|
|
2400
|
+
this.postComposerSelectionBounds();
|
|
2401
|
+
});
|
|
2402
|
+
};
|
|
2403
|
+
this.composerBoundsScrollListener = onScroll;
|
|
2404
|
+
document.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2405
|
+
window.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2406
|
+
window.addEventListener("resize", onScroll);
|
|
2407
|
+
}
|
|
2408
|
+
teardownComposerBoundsTracking() {
|
|
2409
|
+
const onScroll = this.composerBoundsScrollListener;
|
|
2410
|
+
this.composerBoundsScrollListener = null;
|
|
2411
|
+
if (this.composerBoundsRaf) {
|
|
2412
|
+
cancelAnimationFrame(this.composerBoundsRaf);
|
|
2413
|
+
this.composerBoundsRaf = 0;
|
|
2414
|
+
}
|
|
2415
|
+
if (!onScroll || typeof document === "undefined") return;
|
|
2416
|
+
document.removeEventListener("scroll", onScroll, true);
|
|
2417
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
2418
|
+
window.removeEventListener("resize", onScroll);
|
|
2419
|
+
}
|
|
2371
2420
|
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
2372
2421
|
injectComposerHighlightStyles(highlightComponents, showZones) {
|
|
2373
2422
|
if (typeof document === "undefined") return;
|
|
@@ -2535,6 +2584,7 @@ Available Console Commands:
|
|
|
2535
2584
|
if (typeof document === "undefined") return;
|
|
2536
2585
|
const clearSelection = opts?.clearSelection !== false;
|
|
2537
2586
|
this.highlightingEnabled = false;
|
|
2587
|
+
this.teardownComposerBoundsTracking();
|
|
2538
2588
|
this.teardownComposerDragDrop();
|
|
2539
2589
|
if (opts?.clearSelection !== false && typeof window !== "undefined") {
|
|
2540
2590
|
window.__AMPLIFYUP_COMPOSER_EDIT__ = false;
|