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