@amplifyup/sdk 0.1.76 → 0.1.77
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 +14 -16
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +15 -17
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +3 -1
- package/dist/react.d.ts +3 -1
- package/dist/react.js +23 -23
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +24 -24
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/AmplifyRenderer.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { createContext, memo, useState, useEffect, Fragment as Fragment$1, useContext, useRef, Component
|
|
2
|
+
import { createContext, memo, useState, useEffect, Fragment as Fragment$1, useContext, useRef, Component } from 'react';
|
|
3
3
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import 'marked';
|
|
5
5
|
|
|
@@ -3624,14 +3624,16 @@ function applyComposerPatch(store, name, value, ref, layoutNodeId) {
|
|
|
3624
3624
|
store.set(composerStoreKey(name, ref, layoutNodeId), value);
|
|
3625
3625
|
}
|
|
3626
3626
|
function ComposerProvider({
|
|
3627
|
-
children
|
|
3627
|
+
children,
|
|
3628
|
+
enabled = true
|
|
3628
3629
|
}) {
|
|
3629
3630
|
const existing = useContext(ComposerStoreContext);
|
|
3630
3631
|
const storeRef = useRef(null);
|
|
3631
3632
|
if (!storeRef.current) storeRef.current = new ComposerFieldStore();
|
|
3632
|
-
const
|
|
3633
|
+
const ownsStore = !existing && enabled;
|
|
3634
|
+
const store = existing || (enabled ? storeRef.current : null);
|
|
3633
3635
|
useEffect(() => {
|
|
3634
|
-
if (
|
|
3636
|
+
if (!ownsStore || !store) return;
|
|
3635
3637
|
const applyField = (fieldName, value, nodeId, ref) => {
|
|
3636
3638
|
if (!fieldName || typeof fieldName !== "string") return;
|
|
3637
3639
|
const fieldRef = isFieldRef(ref) ? ref : void 0;
|
|
@@ -3689,8 +3691,7 @@ function ComposerProvider({
|
|
|
3689
3691
|
window.removeEventListener("amplifyup:props-patch", onPropsPatch);
|
|
3690
3692
|
window.removeEventListener("message", onMessage);
|
|
3691
3693
|
};
|
|
3692
|
-
}, [
|
|
3693
|
-
if (existing) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
3694
|
+
}, [ownsStore, store]);
|
|
3694
3695
|
return /* @__PURE__ */ jsx(ComposerStoreContext.Provider, { value: store, children });
|
|
3695
3696
|
}
|
|
3696
3697
|
function MaybeComposerProvider({
|
|
@@ -3698,9 +3699,7 @@ function MaybeComposerProvider({
|
|
|
3698
3699
|
layoutNodeId,
|
|
3699
3700
|
children
|
|
3700
3701
|
}) {
|
|
3701
|
-
|
|
3702
|
-
if (!enabled) return /* @__PURE__ */ jsx(Fragment, { children: content });
|
|
3703
|
-
return /* @__PURE__ */ jsx(ComposerProvider, { children: /* @__PURE__ */ jsx(ComposerNodeContext.Provider, { value: layoutNodeId, children }) });
|
|
3702
|
+
return /* @__PURE__ */ jsx(ComposerProvider, { enabled, children: /* @__PURE__ */ jsx(ComposerNodeContext.Provider, { value: enabled ? layoutNodeId : void 0, children }) });
|
|
3704
3703
|
}
|
|
3705
3704
|
createContext(null);
|
|
3706
3705
|
var usePathname = null;
|
|
@@ -4152,17 +4151,16 @@ function AmplifyRendererInner({
|
|
|
4152
4151
|
if (layoutTree.length === 0) {
|
|
4153
4152
|
return /* @__PURE__ */ jsx("main", { children: emptyComponent || /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-16", children: /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "No content configured for this page." }) }) });
|
|
4154
4153
|
}
|
|
4155
|
-
return /* @__PURE__ */ jsx(ComposerProvider, { children: /* @__PURE__ */ jsx(
|
|
4156
|
-
"
|
|
4154
|
+
return /* @__PURE__ */ jsx(ComposerProvider, { children: /* @__PURE__ */ jsx(
|
|
4155
|
+
"main",
|
|
4157
4156
|
{
|
|
4158
|
-
"data-slot-id": "main",
|
|
4159
|
-
"data-amplifyup-slot": "main",
|
|
4160
|
-
"data-slot-source": "page",
|
|
4161
|
-
"data-slot-state":
|
|
4162
|
-
"data-slot-empty": layoutTree.length === 0 ? "true" : void 0,
|
|
4157
|
+
"data-slot-id": composerPreviewFlag ? "main" : void 0,
|
|
4158
|
+
"data-amplifyup-slot": composerPreviewFlag ? "main" : void 0,
|
|
4159
|
+
"data-slot-source": composerPreviewFlag ? "page" : void 0,
|
|
4160
|
+
"data-slot-state": composerPreviewFlag ? "filled" : void 0,
|
|
4163
4161
|
children: layoutTree.map((node) => /* @__PURE__ */ jsx(Fragment$1, { children: renderNode(node) }, node.id))
|
|
4164
4162
|
}
|
|
4165
|
-
)
|
|
4163
|
+
) });
|
|
4166
4164
|
}
|
|
4167
4165
|
var AmplifyRenderer = memo(AmplifyRendererInner);
|
|
4168
4166
|
|