@amplifyup/sdk 0.1.37 → 0.1.39
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 +35 -8
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +35 -8
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -3
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +35 -8
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +35 -8
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -1993,6 +1993,12 @@ Available Console Commands:
|
|
|
1993
1993
|
);
|
|
1994
1994
|
return;
|
|
1995
1995
|
}
|
|
1996
|
+
if (event.data?.type === "AMPLIFYUP_PROPS_PATCH") {
|
|
1997
|
+
window.dispatchEvent(
|
|
1998
|
+
new CustomEvent("amplifyup:props-patch", { detail: event.data })
|
|
1999
|
+
);
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
1996
2002
|
if (event.data?.type === "COMPONENT_DELETABLE_STATUS") {
|
|
1997
2003
|
const { componentId, deletable, nodeId } = event.data;
|
|
1998
2004
|
const element = document.querySelector(`[data-component-id="${componentId}"]`);
|
|
@@ -2628,7 +2634,7 @@ Available Console Commands:
|
|
|
2628
2634
|
if (!highlightComponents && !showZones) return;
|
|
2629
2635
|
const existing = document.getElementById("amplifyup-preview-highlights");
|
|
2630
2636
|
if (existing) existing.remove();
|
|
2631
|
-
const primary = "hsl(82
|
|
2637
|
+
const primary = "hsl(82 100% 52%)";
|
|
2632
2638
|
const lines = [];
|
|
2633
2639
|
if (highlightComponents) {
|
|
2634
2640
|
lines.push(
|
|
@@ -2638,7 +2644,7 @@ Available Console Commands:
|
|
|
2638
2644
|
"[data-amplifyup-component].amplifyup-selected, [data-component-id].amplifyup-selected {",
|
|
2639
2645
|
` outline: 2px solid ${primary} !important;`,
|
|
2640
2646
|
" outline-offset: -2px !important;",
|
|
2641
|
-
" box-shadow: inset 0 0 0 1px hsl(82
|
|
2647
|
+
" box-shadow: inset 0 0 0 1px hsl(82 100% 52% / 0.25) !important;",
|
|
2642
2648
|
"}",
|
|
2643
2649
|
"[data-amplifyup-component].amplifyup-component-hover:not(.amplifyup-selected),",
|
|
2644
2650
|
"[data-component-id].amplifyup-component-hover:not(.amplifyup-selected) {",
|
|
@@ -2650,7 +2656,7 @@ Available Console Commands:
|
|
|
2650
2656
|
if (highlightComponents || showZones) {
|
|
2651
2657
|
lines.push(
|
|
2652
2658
|
"[data-slot-id].amplifyup-selected, [data-amplifyup-slot].amplifyup-selected {",
|
|
2653
|
-
" background-color:
|
|
2659
|
+
" background-color: hsl(82 100% 52% / 0.12) !important;",
|
|
2654
2660
|
"}"
|
|
2655
2661
|
);
|
|
2656
2662
|
}
|
|
@@ -3009,25 +3015,46 @@ function useLiveComposerProps(layoutNodeId, props) {
|
|
|
3009
3015
|
setLive(props);
|
|
3010
3016
|
}, [props]);
|
|
3011
3017
|
useEffect(() => {
|
|
3012
|
-
const
|
|
3013
|
-
if (!fieldName || typeof fieldName !== "string") return;
|
|
3018
|
+
const matchesNode = (nodeId) => {
|
|
3014
3019
|
if (nodeId && layoutNodeId && String(nodeId) !== String(layoutNodeId)) {
|
|
3015
|
-
return;
|
|
3020
|
+
return false;
|
|
3016
3021
|
}
|
|
3022
|
+
return true;
|
|
3023
|
+
};
|
|
3024
|
+
const applyField = (fieldName, value, nodeId) => {
|
|
3025
|
+
if (!fieldName || typeof fieldName !== "string") return;
|
|
3026
|
+
if (!matchesNode(nodeId)) return;
|
|
3017
3027
|
setLive((prev) => ({ ...prev, [fieldName]: value }));
|
|
3018
3028
|
};
|
|
3029
|
+
const applyProps = (nextProps, nodeId) => {
|
|
3030
|
+
if (!nextProps || typeof nextProps !== "object" || Array.isArray(nextProps)) {
|
|
3031
|
+
return;
|
|
3032
|
+
}
|
|
3033
|
+
if (!matchesNode(nodeId)) return;
|
|
3034
|
+
setLive(nextProps);
|
|
3035
|
+
};
|
|
3019
3036
|
const onPatch = (event) => {
|
|
3020
3037
|
const detail = event.detail || {};
|
|
3021
|
-
|
|
3038
|
+
applyField(detail.fieldName, detail.value, detail.layoutNodeId);
|
|
3039
|
+
};
|
|
3040
|
+
const onPropsPatch = (event) => {
|
|
3041
|
+
const detail = event.detail || {};
|
|
3042
|
+
applyProps(detail.props, detail.layoutNodeId);
|
|
3022
3043
|
};
|
|
3023
3044
|
const onMessage = (event) => {
|
|
3045
|
+
if (event.data?.type === "AMPLIFYUP_PROPS_PATCH") {
|
|
3046
|
+
applyProps(event.data.props, event.data.layoutNodeId);
|
|
3047
|
+
return;
|
|
3048
|
+
}
|
|
3024
3049
|
if (event.data?.type !== "AMPLIFYUP_FIELD_PATCH") return;
|
|
3025
|
-
|
|
3050
|
+
applyField(event.data.fieldName, event.data.value, event.data.layoutNodeId);
|
|
3026
3051
|
};
|
|
3027
3052
|
window.addEventListener("amplifyup:field-patch", onPatch);
|
|
3053
|
+
window.addEventListener("amplifyup:props-patch", onPropsPatch);
|
|
3028
3054
|
window.addEventListener("message", onMessage);
|
|
3029
3055
|
return () => {
|
|
3030
3056
|
window.removeEventListener("amplifyup:field-patch", onPatch);
|
|
3057
|
+
window.removeEventListener("amplifyup:props-patch", onPropsPatch);
|
|
3031
3058
|
window.removeEventListener("message", onMessage);
|
|
3032
3059
|
};
|
|
3033
3060
|
}, [layoutNodeId]);
|