@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/AmplifyRenderer.js
CHANGED
|
@@ -393,6 +393,8 @@ var AmplifyUpSDK = class {
|
|
|
393
393
|
this.showZonesEnabled = false;
|
|
394
394
|
this.componentRegistry = [];
|
|
395
395
|
this.messageListener = null;
|
|
396
|
+
this.composerBoundsRaf = 0;
|
|
397
|
+
this.composerBoundsScrollListener = null;
|
|
396
398
|
this.mutationObserver = null;
|
|
397
399
|
this.composerDragHandlers = null;
|
|
398
400
|
/** Last slot highlighted during Composer drag — avoid clear/re-add flicker. */
|
|
@@ -2051,6 +2053,7 @@ Available Console Commands:
|
|
|
2051
2053
|
this.applyComponentHighlights(highlightComponents, showZones);
|
|
2052
2054
|
this.setupMutationObserver();
|
|
2053
2055
|
this.setupComposerDragDrop();
|
|
2056
|
+
this.setupComposerBoundsTracking();
|
|
2054
2057
|
}
|
|
2055
2058
|
previouslySelected.forEach((el) => {
|
|
2056
2059
|
if (document.contains(el)) {
|
|
@@ -2205,6 +2208,52 @@ Available Console Commands:
|
|
|
2205
2208
|
this.clearComposerSelection();
|
|
2206
2209
|
element.classList.add("amplifyup-selected");
|
|
2207
2210
|
}
|
|
2211
|
+
postComposerSelectionBounds() {
|
|
2212
|
+
if (typeof document === "undefined") return;
|
|
2213
|
+
if (!window.parent || window.parent === window) return;
|
|
2214
|
+
const el = document.querySelector(".amplifyup-selected");
|
|
2215
|
+
if (!el) return;
|
|
2216
|
+
const rect = el.getBoundingClientRect();
|
|
2217
|
+
window.parent.postMessage(
|
|
2218
|
+
{
|
|
2219
|
+
type: "SELECTION_BOUNDS",
|
|
2220
|
+
bounds: {
|
|
2221
|
+
top: rect.top,
|
|
2222
|
+
left: rect.left,
|
|
2223
|
+
width: rect.width,
|
|
2224
|
+
height: rect.height
|
|
2225
|
+
}
|
|
2226
|
+
},
|
|
2227
|
+
"*"
|
|
2228
|
+
);
|
|
2229
|
+
}
|
|
2230
|
+
setupComposerBoundsTracking() {
|
|
2231
|
+
if (typeof document === "undefined") return;
|
|
2232
|
+
this.teardownComposerBoundsTracking();
|
|
2233
|
+
const onScroll = () => {
|
|
2234
|
+
if (this.composerBoundsRaf) return;
|
|
2235
|
+
this.composerBoundsRaf = requestAnimationFrame(() => {
|
|
2236
|
+
this.composerBoundsRaf = 0;
|
|
2237
|
+
this.postComposerSelectionBounds();
|
|
2238
|
+
});
|
|
2239
|
+
};
|
|
2240
|
+
this.composerBoundsScrollListener = onScroll;
|
|
2241
|
+
document.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2242
|
+
window.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2243
|
+
window.addEventListener("resize", onScroll);
|
|
2244
|
+
}
|
|
2245
|
+
teardownComposerBoundsTracking() {
|
|
2246
|
+
const onScroll = this.composerBoundsScrollListener;
|
|
2247
|
+
this.composerBoundsScrollListener = null;
|
|
2248
|
+
if (this.composerBoundsRaf) {
|
|
2249
|
+
cancelAnimationFrame(this.composerBoundsRaf);
|
|
2250
|
+
this.composerBoundsRaf = 0;
|
|
2251
|
+
}
|
|
2252
|
+
if (!onScroll || typeof document === "undefined") return;
|
|
2253
|
+
document.removeEventListener("scroll", onScroll, true);
|
|
2254
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
2255
|
+
window.removeEventListener("resize", onScroll);
|
|
2256
|
+
}
|
|
2208
2257
|
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
2209
2258
|
injectComposerHighlightStyles(highlightComponents, showZones) {
|
|
2210
2259
|
if (typeof document === "undefined") return;
|
|
@@ -2372,6 +2421,7 @@ Available Console Commands:
|
|
|
2372
2421
|
if (typeof document === "undefined") return;
|
|
2373
2422
|
const clearSelection = opts?.clearSelection !== false;
|
|
2374
2423
|
this.highlightingEnabled = false;
|
|
2424
|
+
this.teardownComposerBoundsTracking();
|
|
2375
2425
|
this.teardownComposerDragDrop();
|
|
2376
2426
|
if (opts?.clearSelection !== false && typeof window !== "undefined") {
|
|
2377
2427
|
window.__AMPLIFYUP_COMPOSER_EDIT__ = false;
|