@amplifyup/sdk 0.1.62 → 0.1.63
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/README.md +401 -12
- package/dist/{AmplifyRenderer-BQ8-H2H4.d.ts → AmplifyRenderer-Bwob7ICJ.d.ts} +23 -4
- package/dist/{AmplifyRenderer-W7eqltSj.d.mts → AmplifyRenderer-TawbUIKZ.d.mts} +23 -4
- package/dist/AmplifyRenderer.d.mts +1 -1
- package/dist/AmplifyRenderer.d.ts +1 -1
- package/dist/AmplifyRenderer.js +70 -0
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +70 -0
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +45 -11
- package/dist/react.d.ts +45 -11
- package/dist/react.js +310 -75
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +310 -76
- package/dist/react.mjs.map +1 -1
- package/dist/server.js +37 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +37 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-Db_eLrfU.mjs';
|
|
3
3
|
export { Z as ZoneConfig } from './types-Db_eLrfU.mjs';
|
|
4
|
-
import
|
|
5
|
-
import { L as LayoutComponentProps, F as Field$1 } from './AmplifyRenderer-
|
|
6
|
-
export { A as AmplifyRenderer,
|
|
4
|
+
import react__default, { ReactNode } from 'react';
|
|
5
|
+
import { L as LayoutComponentProps, F as Field$1, C as CollectionField, a as Fields } from './AmplifyRenderer-TawbUIKZ.mjs';
|
|
6
|
+
export { A as AmplifyRenderer, I as ImageValue, P as PortableRef, b as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-TawbUIKZ.mjs';
|
|
7
7
|
export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-DIZjc7st.mjs';
|
|
8
8
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
|
|
9
9
|
|
|
@@ -81,16 +81,50 @@ declare function Slot({ name, className, }: {
|
|
|
81
81
|
name: string;
|
|
82
82
|
className?: string;
|
|
83
83
|
}): react_jsx_runtime.JSX.Element | null;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
|
|
85
|
+
/**
|
|
86
|
+
* Field Component
|
|
87
|
+
*
|
|
88
|
+
* Pass a field envelope: `<Field field={fields.title} />`.
|
|
89
|
+
* For a computed value, pass `value` and `name`.
|
|
90
|
+
*
|
|
91
|
+
* For markdown / rich text fields, use {@link RichText} instead.
|
|
92
|
+
* List fields use {@link Collection} (repeaters) or `.value` (reference lists).
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* function Hero({ fields }: { fields: Fields<{ title: string; description: string }> }) {
|
|
97
|
+
* return (
|
|
98
|
+
* <section className="hero">
|
|
99
|
+
* <h1>
|
|
100
|
+
* <Field field={fields.title} />
|
|
101
|
+
* </h1>
|
|
102
|
+
* <p>{fields.description.value}</p>
|
|
103
|
+
* </section>
|
|
104
|
+
* );
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
declare function Field<T = unknown>(props: {
|
|
109
|
+
/** Envelope from `props.fields` (`{ value, name }`). Arrays are not allowed. */
|
|
110
|
+
field?: Field$1<RejectArray<T>>;
|
|
87
111
|
/** Computed value — requires `name`. */
|
|
88
|
-
value?:
|
|
112
|
+
value?: RejectArray<T>;
|
|
89
113
|
/** Required with `value` for computed values. */
|
|
90
114
|
name?: string;
|
|
91
115
|
className?: string;
|
|
92
|
-
|
|
93
|
-
|
|
116
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
117
|
+
/**
|
|
118
|
+
* Repeater (inline-authored list). Inside Composer: empty placeholder plus
|
|
119
|
+
* add / remove / reorder. Outside Composer: children only.
|
|
120
|
+
*
|
|
121
|
+
* Reference lists are not canvas-bound — map `fields.posts.value` instead.
|
|
122
|
+
*/
|
|
123
|
+
declare function Collection<T extends Record<string, unknown>>({ field, children, className, }: {
|
|
124
|
+
field: CollectionField<T> | Field$1<T[]>;
|
|
125
|
+
children: (item: Fields<T>, index: number) => ReactNode;
|
|
126
|
+
className?: string;
|
|
127
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
94
128
|
/**
|
|
95
129
|
* RichText - Renders a markdown (or HTML string) value as formatted HTML.
|
|
96
130
|
*
|
|
@@ -142,7 +176,7 @@ declare function Image(props: {
|
|
|
142
176
|
/** Required with `value` for computed values. */
|
|
143
177
|
name?: string;
|
|
144
178
|
alt?: string;
|
|
145
|
-
} & Omit<
|
|
179
|
+
} & Omit<react__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
|
|
146
180
|
|
|
147
181
|
declare function ComposerProvider({ layoutNodeId, children, }: {
|
|
148
182
|
layoutNodeId?: string;
|
|
@@ -173,4 +207,4 @@ interface AmplifyUpProviderProps {
|
|
|
173
207
|
declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
|
|
174
208
|
declare function useAmplifyUp(): AmplifyUpContextType;
|
|
175
209
|
|
|
176
|
-
export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
|
|
210
|
+
export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, Collection, CollectionField, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Fields, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-Db_eLrfU.js';
|
|
3
3
|
export { Z as ZoneConfig } from './types-Db_eLrfU.js';
|
|
4
|
-
import
|
|
5
|
-
import { L as LayoutComponentProps, F as Field$1 } from './AmplifyRenderer-
|
|
6
|
-
export { A as AmplifyRenderer,
|
|
4
|
+
import react__default, { ReactNode } from 'react';
|
|
5
|
+
import { L as LayoutComponentProps, F as Field$1, C as CollectionField, a as Fields } from './AmplifyRenderer-Bwob7ICJ.js';
|
|
6
|
+
export { A as AmplifyRenderer, I as ImageValue, P as PortableRef, b as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-Bwob7ICJ.js';
|
|
7
7
|
export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-3AXnQgzO.js';
|
|
8
8
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
|
|
9
9
|
|
|
@@ -81,16 +81,50 @@ declare function Slot({ name, className, }: {
|
|
|
81
81
|
name: string;
|
|
82
82
|
className?: string;
|
|
83
83
|
}): react_jsx_runtime.JSX.Element | null;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
|
|
85
|
+
/**
|
|
86
|
+
* Field Component
|
|
87
|
+
*
|
|
88
|
+
* Pass a field envelope: `<Field field={fields.title} />`.
|
|
89
|
+
* For a computed value, pass `value` and `name`.
|
|
90
|
+
*
|
|
91
|
+
* For markdown / rich text fields, use {@link RichText} instead.
|
|
92
|
+
* List fields use {@link Collection} (repeaters) or `.value` (reference lists).
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* function Hero({ fields }: { fields: Fields<{ title: string; description: string }> }) {
|
|
97
|
+
* return (
|
|
98
|
+
* <section className="hero">
|
|
99
|
+
* <h1>
|
|
100
|
+
* <Field field={fields.title} />
|
|
101
|
+
* </h1>
|
|
102
|
+
* <p>{fields.description.value}</p>
|
|
103
|
+
* </section>
|
|
104
|
+
* );
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
declare function Field<T = unknown>(props: {
|
|
109
|
+
/** Envelope from `props.fields` (`{ value, name }`). Arrays are not allowed. */
|
|
110
|
+
field?: Field$1<RejectArray<T>>;
|
|
87
111
|
/** Computed value — requires `name`. */
|
|
88
|
-
value?:
|
|
112
|
+
value?: RejectArray<T>;
|
|
89
113
|
/** Required with `value` for computed values. */
|
|
90
114
|
name?: string;
|
|
91
115
|
className?: string;
|
|
92
|
-
|
|
93
|
-
|
|
116
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
117
|
+
/**
|
|
118
|
+
* Repeater (inline-authored list). Inside Composer: empty placeholder plus
|
|
119
|
+
* add / remove / reorder. Outside Composer: children only.
|
|
120
|
+
*
|
|
121
|
+
* Reference lists are not canvas-bound — map `fields.posts.value` instead.
|
|
122
|
+
*/
|
|
123
|
+
declare function Collection<T extends Record<string, unknown>>({ field, children, className, }: {
|
|
124
|
+
field: CollectionField<T> | Field$1<T[]>;
|
|
125
|
+
children: (item: Fields<T>, index: number) => ReactNode;
|
|
126
|
+
className?: string;
|
|
127
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
94
128
|
/**
|
|
95
129
|
* RichText - Renders a markdown (or HTML string) value as formatted HTML.
|
|
96
130
|
*
|
|
@@ -142,7 +176,7 @@ declare function Image(props: {
|
|
|
142
176
|
/** Required with `value` for computed values. */
|
|
143
177
|
name?: string;
|
|
144
178
|
alt?: string;
|
|
145
|
-
} & Omit<
|
|
179
|
+
} & Omit<react__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
|
|
146
180
|
|
|
147
181
|
declare function ComposerProvider({ layoutNodeId, children, }: {
|
|
148
182
|
layoutNodeId?: string;
|
|
@@ -173,4 +207,4 @@ interface AmplifyUpProviderProps {
|
|
|
173
207
|
declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
|
|
174
208
|
declare function useAmplifyUp(): AmplifyUpContextType;
|
|
175
209
|
|
|
176
|
-
export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
|
|
210
|
+
export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, Collection, CollectionField, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Fields, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
|