@amplifyup/sdk 0.1.31 → 0.1.33
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 +62 -4
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +62 -4
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +63 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{preview-BMrIgUvp.d.mts → preview-_vHmzRen.d.mts} +6 -1
- package/dist/{preview-BMrIgUvp.d.ts → preview-_vHmzRen.d.ts} +6 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +65 -4
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +65 -5
- package/dist/react.mjs.map +1 -1
- package/dist/server.js +13 -4
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +13 -4
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as CDPAdapter, b as AmplifyUpConfig, c as EventProperties, I as IdentifyInput, d as IdentifyTraits, e as ProfileFieldsInput, f as AmplifyUpTarget } from './types-npF_lNoq.mjs';
|
|
2
2
|
export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-npF_lNoq.mjs';
|
|
3
|
-
export { i as isComposerPreview, a as isPreviewRequest } from './preview-
|
|
3
|
+
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
|
|
4
4
|
|
|
5
5
|
interface FetchContentResult {
|
|
6
6
|
pageConfig: PageConfig | null;
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as PageConfig, C as ContentSource, A as AmplifyContentMeta, E as EventTrackingConfig$1, a as CDPAdapter, b as AmplifyUpConfig, c as EventProperties, I as IdentifyInput, d as IdentifyTraits, e as ProfileFieldsInput, f as AmplifyUpTarget } from './types-npF_lNoq.js';
|
|
2
2
|
export { Z as ZoneConfig, i as isAmplifyUpTarget, n as normalizeAmplifyUpTarget, r as resolveAmplifyUpTarget, g as resolveAmplifyUpUrls } from './types-npF_lNoq.js';
|
|
3
|
-
export { i as isComposerPreview, a as isPreviewRequest } from './preview-
|
|
3
|
+
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
|
|
4
4
|
|
|
5
5
|
interface FetchContentResult {
|
|
6
6
|
pageConfig: PageConfig | null;
|
|
@@ -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
|
@@ -316,12 +316,17 @@ function resolveAmplifyUpUrls(target) {
|
|
|
316
316
|
|
|
317
317
|
// src/preview.ts
|
|
318
318
|
function isPreviewRequest(searchParams) {
|
|
319
|
+
return paramIsTrue(searchParams, "preview") || paramIsTrue(searchParams, "visualEditor");
|
|
320
|
+
}
|
|
321
|
+
function isWorkingContentRequest(searchParams) {
|
|
322
|
+
return paramIsTrue(searchParams, "working");
|
|
323
|
+
}
|
|
324
|
+
function paramIsTrue(searchParams, key) {
|
|
319
325
|
if (searchParams instanceof URLSearchParams) {
|
|
320
|
-
return searchParams.get(
|
|
326
|
+
return searchParams.get(key) === "true";
|
|
321
327
|
}
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
return preview === "true" || visualEditor === "true";
|
|
328
|
+
const value = searchParams[key];
|
|
329
|
+
return value === "true" || Array.isArray(value) && value[0] === "true";
|
|
325
330
|
}
|
|
326
331
|
function isComposerPreview() {
|
|
327
332
|
if (typeof window === "undefined") return false;
|
|
@@ -556,6 +561,8 @@ var AmplifyUpSDK = class {
|
|
|
556
561
|
this.showZonesEnabled = false;
|
|
557
562
|
this.componentRegistry = [];
|
|
558
563
|
this.messageListener = null;
|
|
564
|
+
this.composerBoundsRaf = 0;
|
|
565
|
+
this.composerBoundsScrollListener = null;
|
|
559
566
|
this.mutationObserver = null;
|
|
560
567
|
this.composerDragHandlers = null;
|
|
561
568
|
/** Last slot highlighted during Composer drag — avoid clear/re-add flicker. */
|
|
@@ -1455,6 +1462,9 @@ Available Console Commands:
|
|
|
1455
1462
|
});
|
|
1456
1463
|
if (preview) {
|
|
1457
1464
|
params.set("preview", "true");
|
|
1465
|
+
if (typeof window !== "undefined" && isWorkingContentRequest(new URLSearchParams(window.location.search))) {
|
|
1466
|
+
params.set("working", "true");
|
|
1467
|
+
}
|
|
1458
1468
|
}
|
|
1459
1469
|
if (isOnOrchestratorOrigin) {
|
|
1460
1470
|
return `/api/layout/provider?${params.toString()}`;
|
|
@@ -2214,6 +2224,7 @@ Available Console Commands:
|
|
|
2214
2224
|
this.applyComponentHighlights(highlightComponents, showZones);
|
|
2215
2225
|
this.setupMutationObserver();
|
|
2216
2226
|
this.setupComposerDragDrop();
|
|
2227
|
+
this.setupComposerBoundsTracking();
|
|
2217
2228
|
}
|
|
2218
2229
|
previouslySelected.forEach((el) => {
|
|
2219
2230
|
if (document.contains(el)) {
|
|
@@ -2368,6 +2379,52 @@ Available Console Commands:
|
|
|
2368
2379
|
this.clearComposerSelection();
|
|
2369
2380
|
element.classList.add("amplifyup-selected");
|
|
2370
2381
|
}
|
|
2382
|
+
postComposerSelectionBounds() {
|
|
2383
|
+
if (typeof document === "undefined") return;
|
|
2384
|
+
if (!window.parent || window.parent === window) return;
|
|
2385
|
+
const el = document.querySelector(".amplifyup-selected");
|
|
2386
|
+
if (!el) return;
|
|
2387
|
+
const rect = el.getBoundingClientRect();
|
|
2388
|
+
window.parent.postMessage(
|
|
2389
|
+
{
|
|
2390
|
+
type: "SELECTION_BOUNDS",
|
|
2391
|
+
bounds: {
|
|
2392
|
+
top: rect.top,
|
|
2393
|
+
left: rect.left,
|
|
2394
|
+
width: rect.width,
|
|
2395
|
+
height: rect.height
|
|
2396
|
+
}
|
|
2397
|
+
},
|
|
2398
|
+
"*"
|
|
2399
|
+
);
|
|
2400
|
+
}
|
|
2401
|
+
setupComposerBoundsTracking() {
|
|
2402
|
+
if (typeof document === "undefined") return;
|
|
2403
|
+
this.teardownComposerBoundsTracking();
|
|
2404
|
+
const onScroll = () => {
|
|
2405
|
+
if (this.composerBoundsRaf) return;
|
|
2406
|
+
this.composerBoundsRaf = requestAnimationFrame(() => {
|
|
2407
|
+
this.composerBoundsRaf = 0;
|
|
2408
|
+
this.postComposerSelectionBounds();
|
|
2409
|
+
});
|
|
2410
|
+
};
|
|
2411
|
+
this.composerBoundsScrollListener = onScroll;
|
|
2412
|
+
document.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2413
|
+
window.addEventListener("scroll", onScroll, { capture: true, passive: true });
|
|
2414
|
+
window.addEventListener("resize", onScroll);
|
|
2415
|
+
}
|
|
2416
|
+
teardownComposerBoundsTracking() {
|
|
2417
|
+
const onScroll = this.composerBoundsScrollListener;
|
|
2418
|
+
this.composerBoundsScrollListener = null;
|
|
2419
|
+
if (this.composerBoundsRaf) {
|
|
2420
|
+
cancelAnimationFrame(this.composerBoundsRaf);
|
|
2421
|
+
this.composerBoundsRaf = 0;
|
|
2422
|
+
}
|
|
2423
|
+
if (!onScroll || typeof document === "undefined") return;
|
|
2424
|
+
document.removeEventListener("scroll", onScroll, true);
|
|
2425
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
2426
|
+
window.removeEventListener("resize", onScroll);
|
|
2427
|
+
}
|
|
2371
2428
|
/** Visual outlines for Composer (direct iframe path — no preview-frame proxy). */
|
|
2372
2429
|
injectComposerHighlightStyles(highlightComponents, showZones) {
|
|
2373
2430
|
if (typeof document === "undefined") return;
|
|
@@ -2535,6 +2592,7 @@ Available Console Commands:
|
|
|
2535
2592
|
if (typeof document === "undefined") return;
|
|
2536
2593
|
const clearSelection = opts?.clearSelection !== false;
|
|
2537
2594
|
this.highlightingEnabled = false;
|
|
2595
|
+
this.teardownComposerBoundsTracking();
|
|
2538
2596
|
this.teardownComposerDragDrop();
|
|
2539
2597
|
if (opts?.clearSelection !== false && typeof window !== "undefined") {
|
|
2540
2598
|
window.__AMPLIFYUP_COMPOSER_EDIT__ = false;
|
|
@@ -2810,6 +2868,7 @@ exports.init = init;
|
|
|
2810
2868
|
exports.isAmplifyUpTarget = isAmplifyUpTarget;
|
|
2811
2869
|
exports.isComposerPreview = isComposerPreview;
|
|
2812
2870
|
exports.isPreviewRequest = isPreviewRequest;
|
|
2871
|
+
exports.isWorkingContentRequest = isWorkingContentRequest;
|
|
2813
2872
|
exports.mapResolvedToPageConfig = mapResolvedToPageConfig;
|
|
2814
2873
|
exports.normalizeAmplifyUpTarget = normalizeAmplifyUpTarget;
|
|
2815
2874
|
exports.normalizeRoute = normalizeRoute;
|