@amplifyup/sdk 0.1.62 → 0.1.64
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 +446 -12
- package/dist/AmplifyRenderer.d.mts +40 -4
- package/dist/AmplifyRenderer.d.ts +40 -4
- package/dist/AmplifyRenderer.js +219 -27
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +220 -28
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +155 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +155 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{query-3AXnQgzO.d.ts → query-BLjZYjHJ.d.ts} +4 -3
- package/dist/{query-DIZjc7st.d.mts → query-DuRilU_n.d.mts} +4 -3
- package/dist/react.d.mts +44 -21
- package/dist/react.d.ts +44 -21
- package/dist/react.js +356 -127
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +353 -129
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +155 -9
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +155 -9
- package/dist/server.mjs.map +1 -1
- package/dist/{types-Db_eLrfU.d.mts → types-C32MgOiv.d.mts} +96 -1
- package/dist/{types-Db_eLrfU.d.ts → types-C32MgOiv.d.ts} +96 -1
- package/package.json +1 -1
- package/dist/AmplifyRenderer-BQ8-H2H4.d.ts +0 -74
- package/dist/AmplifyRenderer-W7eqltSj.d.mts +0 -74
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as AmplifyUpTarget } from './types-
|
|
1
|
+
import { i as AmplifyUpTarget, y as ListRow } from './types-C32MgOiv.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* On-request variant selection (tier 3).
|
|
@@ -60,7 +60,8 @@ declare function selectVariants(options: SelectVariantsOptions): Promise<SelectV
|
|
|
60
60
|
* Page resolve covers data known at Deploy. Visitor-triggered data — search,
|
|
61
61
|
* load more, pickers — runs here: the browser asks AmplifyUp, AmplifyUp asks
|
|
62
62
|
* the CMS. Only entities published with the page can be queried.
|
|
63
|
-
*
|
|
63
|
+
* Edge JSON stays raw. `queryContent` envelopes rows on the SDK so they
|
|
64
|
+
* edit in Composer the same way as list-field rows.
|
|
64
65
|
*/
|
|
65
66
|
|
|
66
67
|
type QueryFilterOp = 'eq' | 'neq' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'exists';
|
|
@@ -148,7 +149,7 @@ interface QueryContentOptions {
|
|
|
148
149
|
* });
|
|
149
150
|
* ```
|
|
150
151
|
*/
|
|
151
|
-
declare function queryContent<T = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<T
|
|
152
|
+
declare function queryContent<T extends Record<string, unknown> = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<ListRow<T>>>;
|
|
152
153
|
/** Convenience: next page from pagination meta on a list prop. */
|
|
153
154
|
declare function nextPageSpec(pagination: QueryPagination): QuerySpec;
|
|
154
155
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as AmplifyUpTarget } from './types-
|
|
1
|
+
import { i as AmplifyUpTarget, y as ListRow } from './types-C32MgOiv.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* On-request variant selection (tier 3).
|
|
@@ -60,7 +60,8 @@ declare function selectVariants(options: SelectVariantsOptions): Promise<SelectV
|
|
|
60
60
|
* Page resolve covers data known at Deploy. Visitor-triggered data — search,
|
|
61
61
|
* load more, pickers — runs here: the browser asks AmplifyUp, AmplifyUp asks
|
|
62
62
|
* the CMS. Only entities published with the page can be queried.
|
|
63
|
-
*
|
|
63
|
+
* Edge JSON stays raw. `queryContent` envelopes rows on the SDK so they
|
|
64
|
+
* edit in Composer the same way as list-field rows.
|
|
64
65
|
*/
|
|
65
66
|
|
|
66
67
|
type QueryFilterOp = 'eq' | 'neq' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'exists';
|
|
@@ -148,7 +149,7 @@ interface QueryContentOptions {
|
|
|
148
149
|
* });
|
|
149
150
|
* ```
|
|
150
151
|
*/
|
|
151
|
-
declare function queryContent<T = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<T
|
|
152
|
+
declare function queryContent<T extends Record<string, unknown> = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<ListRow<T>>>;
|
|
152
153
|
/** Convenience: next page from pagination meta on a list prop. */
|
|
153
154
|
declare function nextPageSpec(pagination: QueryPagination): QuerySpec;
|
|
154
155
|
/**
|
package/dist/react.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-
|
|
3
|
-
export { Z as ZoneConfig } from './types-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
export {
|
|
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';
|
|
2
|
+
import { L as LayoutComponentProps, P as PageConfig, F as Field$1, l as FIELDS_BRAND, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-C32MgOiv.mjs';
|
|
3
|
+
export { w as FieldRef, x as Fields, z as ImageValue, y as ListRow, B as PortableRef, Z as ZoneConfig, m as attachFieldEnvelopes, p as composerStoreKey, o as envelopeListRows, v as isBrandedFields, s as isFieldEnvelope, u as isReadOnlyRowField, q as listOwnerFromSpec, t as toFieldEnvelopes } from './types-C32MgOiv.mjs';
|
|
4
|
+
import react__default, { ReactNode } from 'react';
|
|
5
|
+
export { AmplifyRenderer } from './AmplifyRenderer.mjs';
|
|
6
|
+
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-DuRilU_n.mjs';
|
|
8
7
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
|
|
9
8
|
|
|
10
9
|
type RenderComponentContext = {
|
|
@@ -81,16 +80,41 @@ declare function Slot({ name, className, }: {
|
|
|
81
80
|
name: string;
|
|
82
81
|
className?: string;
|
|
83
82
|
}): react_jsx_runtime.JSX.Element | null;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
type RejectFieldInput<T> = [T] extends [readonly unknown[]] ? never : T extends {
|
|
84
|
+
readonly [FIELDS_BRAND]: true;
|
|
85
|
+
} ? never : T;
|
|
86
|
+
/**
|
|
87
|
+
* Field Component
|
|
88
|
+
*
|
|
89
|
+
* Pass a field envelope: `<Field field={fields.title} />`.
|
|
90
|
+
* For a computed value, pass `value` and `name`.
|
|
91
|
+
*
|
|
92
|
+
* For markdown / rich text fields, use {@link RichText} instead.
|
|
93
|
+
* Do not pass a list or a list row — use `<Field field={post.title} />`.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* function Hero({ fields }: { fields: Fields<{ title: string; description: string }> }) {
|
|
98
|
+
* return (
|
|
99
|
+
* <section className="hero">
|
|
100
|
+
* <h1>
|
|
101
|
+
* <Field field={fields.title} />
|
|
102
|
+
* </h1>
|
|
103
|
+
* <p>{fields.description.value}</p>
|
|
104
|
+
* </section>
|
|
105
|
+
* );
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare function Field<T = unknown>(props: {
|
|
110
|
+
/** Envelope from `props.fields` (`{ value, name, ref? }`). Lists and rows are not allowed. */
|
|
111
|
+
field?: Field$1<RejectFieldInput<T>>;
|
|
87
112
|
/** Computed value — requires `name`. */
|
|
88
|
-
value?:
|
|
113
|
+
value?: RejectFieldInput<T>;
|
|
89
114
|
/** Required with `value` for computed values. */
|
|
90
115
|
name?: string;
|
|
91
116
|
className?: string;
|
|
92
|
-
|
|
93
|
-
}): string | number | true | Iterable<React__default.ReactNode> | react_jsx_runtime.JSX.Element | null;
|
|
117
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
94
118
|
/**
|
|
95
119
|
* RichText - Renders a markdown (or HTML string) value as formatted HTML.
|
|
96
120
|
*
|
|
@@ -109,10 +133,10 @@ declare function Field(props: {
|
|
|
109
133
|
* }
|
|
110
134
|
* ```
|
|
111
135
|
*/
|
|
112
|
-
declare function RichText(props: {
|
|
113
|
-
field?: Field$1<
|
|
136
|
+
declare function RichText<T = string | null>(props: {
|
|
137
|
+
field?: Field$1<RejectFieldInput<T>>;
|
|
114
138
|
/** Computed markdown — requires `name`. */
|
|
115
|
-
value?:
|
|
139
|
+
value?: RejectFieldInput<T>;
|
|
116
140
|
/** Required with `value` for computed values. */
|
|
117
141
|
name?: string;
|
|
118
142
|
className?: string;
|
|
@@ -135,17 +159,16 @@ declare function RichText(props: {
|
|
|
135
159
|
* }
|
|
136
160
|
* ```
|
|
137
161
|
*/
|
|
138
|
-
declare function Image(props: {
|
|
139
|
-
field?: Field$1<
|
|
162
|
+
declare function Image<T = unknown>(props: {
|
|
163
|
+
field?: Field$1<RejectFieldInput<T>>;
|
|
140
164
|
/** Computed image — requires `name`. */
|
|
141
|
-
value?:
|
|
165
|
+
value?: RejectFieldInput<T>;
|
|
142
166
|
/** Required with `value` for computed values. */
|
|
143
167
|
name?: string;
|
|
144
168
|
alt?: string;
|
|
145
|
-
} & Omit<
|
|
169
|
+
} & Omit<react__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
|
|
146
170
|
|
|
147
|
-
declare function ComposerProvider({
|
|
148
|
-
layoutNodeId?: string;
|
|
171
|
+
declare function ComposerProvider({ children, }: {
|
|
149
172
|
children: ReactNode;
|
|
150
173
|
}): react_jsx_runtime.JSX.Element;
|
|
151
174
|
declare function MaybeComposerProvider({ enabled, layoutNodeId, children, }: {
|
package/dist/react.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-
|
|
3
|
-
export { Z as ZoneConfig } from './types-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
export {
|
|
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';
|
|
2
|
+
import { L as LayoutComponentProps, P as PageConfig, F as Field$1, l as FIELDS_BRAND, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-C32MgOiv.js';
|
|
3
|
+
export { w as FieldRef, x as Fields, z as ImageValue, y as ListRow, B as PortableRef, Z as ZoneConfig, m as attachFieldEnvelopes, p as composerStoreKey, o as envelopeListRows, v as isBrandedFields, s as isFieldEnvelope, u as isReadOnlyRowField, q as listOwnerFromSpec, t as toFieldEnvelopes } from './types-C32MgOiv.js';
|
|
4
|
+
import react__default, { ReactNode } from 'react';
|
|
5
|
+
export { AmplifyRenderer } from './AmplifyRenderer.js';
|
|
6
|
+
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-BLjZYjHJ.js';
|
|
8
7
|
export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
|
|
9
8
|
|
|
10
9
|
type RenderComponentContext = {
|
|
@@ -81,16 +80,41 @@ declare function Slot({ name, className, }: {
|
|
|
81
80
|
name: string;
|
|
82
81
|
className?: string;
|
|
83
82
|
}): react_jsx_runtime.JSX.Element | null;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
type RejectFieldInput<T> = [T] extends [readonly unknown[]] ? never : T extends {
|
|
84
|
+
readonly [FIELDS_BRAND]: true;
|
|
85
|
+
} ? never : T;
|
|
86
|
+
/**
|
|
87
|
+
* Field Component
|
|
88
|
+
*
|
|
89
|
+
* Pass a field envelope: `<Field field={fields.title} />`.
|
|
90
|
+
* For a computed value, pass `value` and `name`.
|
|
91
|
+
*
|
|
92
|
+
* For markdown / rich text fields, use {@link RichText} instead.
|
|
93
|
+
* Do not pass a list or a list row — use `<Field field={post.title} />`.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* function Hero({ fields }: { fields: Fields<{ title: string; description: string }> }) {
|
|
98
|
+
* return (
|
|
99
|
+
* <section className="hero">
|
|
100
|
+
* <h1>
|
|
101
|
+
* <Field field={fields.title} />
|
|
102
|
+
* </h1>
|
|
103
|
+
* <p>{fields.description.value}</p>
|
|
104
|
+
* </section>
|
|
105
|
+
* );
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare function Field<T = unknown>(props: {
|
|
110
|
+
/** Envelope from `props.fields` (`{ value, name, ref? }`). Lists and rows are not allowed. */
|
|
111
|
+
field?: Field$1<RejectFieldInput<T>>;
|
|
87
112
|
/** Computed value — requires `name`. */
|
|
88
|
-
value?:
|
|
113
|
+
value?: RejectFieldInput<T>;
|
|
89
114
|
/** Required with `value` for computed values. */
|
|
90
115
|
name?: string;
|
|
91
116
|
className?: string;
|
|
92
|
-
|
|
93
|
-
}): string | number | true | Iterable<React__default.ReactNode> | react_jsx_runtime.JSX.Element | null;
|
|
117
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
94
118
|
/**
|
|
95
119
|
* RichText - Renders a markdown (or HTML string) value as formatted HTML.
|
|
96
120
|
*
|
|
@@ -109,10 +133,10 @@ declare function Field(props: {
|
|
|
109
133
|
* }
|
|
110
134
|
* ```
|
|
111
135
|
*/
|
|
112
|
-
declare function RichText(props: {
|
|
113
|
-
field?: Field$1<
|
|
136
|
+
declare function RichText<T = string | null>(props: {
|
|
137
|
+
field?: Field$1<RejectFieldInput<T>>;
|
|
114
138
|
/** Computed markdown — requires `name`. */
|
|
115
|
-
value?:
|
|
139
|
+
value?: RejectFieldInput<T>;
|
|
116
140
|
/** Required with `value` for computed values. */
|
|
117
141
|
name?: string;
|
|
118
142
|
className?: string;
|
|
@@ -135,17 +159,16 @@ declare function RichText(props: {
|
|
|
135
159
|
* }
|
|
136
160
|
* ```
|
|
137
161
|
*/
|
|
138
|
-
declare function Image(props: {
|
|
139
|
-
field?: Field$1<
|
|
162
|
+
declare function Image<T = unknown>(props: {
|
|
163
|
+
field?: Field$1<RejectFieldInput<T>>;
|
|
140
164
|
/** Computed image — requires `name`. */
|
|
141
|
-
value?:
|
|
165
|
+
value?: RejectFieldInput<T>;
|
|
142
166
|
/** Required with `value` for computed values. */
|
|
143
167
|
name?: string;
|
|
144
168
|
alt?: string;
|
|
145
|
-
} & Omit<
|
|
169
|
+
} & Omit<react__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
|
|
146
170
|
|
|
147
|
-
declare function ComposerProvider({
|
|
148
|
-
layoutNodeId?: string;
|
|
171
|
+
declare function ComposerProvider({ children, }: {
|
|
149
172
|
children: ReactNode;
|
|
150
173
|
}): react_jsx_runtime.JSX.Element;
|
|
151
174
|
declare function MaybeComposerProvider({ enabled, layoutNodeId, children, }: {
|