@prismicio/svelte 2.2.1 → 2.2.2-canary.6d1bc0d
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 +6 -0
- package/dist/PrismicEmbed.svelte +6 -8
- package/dist/PrismicEmbed.svelte.d.ts +1 -3
- package/dist/PrismicImage.svelte +46 -68
- package/dist/PrismicImage.svelte.d.ts +11 -17
- package/dist/PrismicLink.svelte +23 -34
- package/dist/PrismicLink.svelte.d.ts +5 -10
- package/dist/PrismicRichText/DefaultComponent.svelte +9 -13
- package/dist/PrismicRichText/PrismicRichText.svelte +11 -16
- package/dist/PrismicRichText/PrismicRichText.svelte.d.ts +2 -6
- package/dist/PrismicRichText/Serialize.svelte +11 -19
- package/dist/PrismicTable.svelte +26 -41
- package/dist/PrismicTable.svelte.d.ts +4 -8
- package/dist/PrismicText.svelte +16 -20
- package/dist/PrismicText.svelte.d.ts +4 -8
- package/dist/SliceSimulator.svelte +12 -12
- package/dist/SliceZone/SliceZone.svelte +21 -26
- package/dist/SliceZone/SliceZone.svelte.d.ts +12 -16
- package/dist/SliceZone/TodoComponent.svelte +7 -7
- package/dist/index.d.ts +1 -3
- package/dist/kit/PrismicPreview.svelte +32 -48
- package/dist/kit/PrismicPreview.svelte.d.ts +5 -9
- package/dist/kit/enableAutoPreviews.d.ts +5 -10
- package/dist/kit/enableAutoPreviews.js +1 -2
- package/dist/kit/redirectToPreviewURL.d.ts +13 -21
- package/dist/kit/redirectToPreviewURL.js +10 -11
- package/dist/kit/types.d.ts +3 -6
- package/dist/lib/devMsg.d.ts +6 -8
- package/dist/lib/devMsg.js +6 -8
- package/dist/types.d.ts +23 -39
- package/package.json +41 -44
- package/src/PrismicEmbed.svelte +6 -8
- package/src/PrismicImage.svelte +46 -68
- package/src/PrismicLink.svelte +23 -34
- package/src/PrismicRichText/DefaultComponent.svelte +9 -13
- package/src/PrismicRichText/PrismicRichText.svelte +11 -16
- package/src/PrismicRichText/Serialize.svelte +11 -19
- package/src/PrismicTable.svelte +26 -41
- package/src/PrismicText.svelte +16 -20
- package/src/SliceSimulator.svelte +12 -12
- package/src/SliceZone/SliceZone.svelte +21 -26
- package/src/SliceZone/TodoComponent.svelte +7 -7
- package/src/index.ts +13 -15
- package/src/kit/PrismicPreview.svelte +32 -48
- package/src/kit/enableAutoPreviews.ts +14 -19
- package/src/kit/index.ts +6 -6
- package/src/kit/redirectToPreviewURL.ts +28 -38
- package/src/kit/types.ts +7 -10
- package/src/lib/devMsg.ts +9 -11
- package/src/types.ts +84 -106
|
@@ -1,74 +1,64 @@
|
|
|
1
|
-
import * as prismic from "@prismicio/client"
|
|
2
|
-
import type { Cookies } from "@sveltejs/kit"
|
|
1
|
+
import * as prismic from "@prismicio/client"
|
|
2
|
+
import type { Cookies } from "@sveltejs/kit"
|
|
3
3
|
|
|
4
4
|
export type RedirectToPreviewURLConfig = {
|
|
5
|
-
/**
|
|
6
|
-
* The Prismic client configured for the preview session's repository.
|
|
7
|
-
*/
|
|
5
|
+
/** The Prismic client configured for the preview session's repository. */
|
|
8
6
|
// `Pick` is used to use the smallest possible subset of
|
|
9
7
|
// `prismic.Client`. Doing this reduces the surface area for breaking
|
|
10
8
|
// type changes.
|
|
11
|
-
client: Pick<prismic.Client, "resolvePreviewURL"
|
|
9
|
+
client: Pick<prismic.Client, "resolvePreviewURL">
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* The `request` object from a `+server` file.
|
|
15
13
|
*
|
|
16
14
|
* @see SvelteKit `+server` docs: \<https://kit.svelte.dev/docs/routing#server\>
|
|
17
15
|
*/
|
|
18
|
-
request: Request
|
|
16
|
+
request: Request
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
* The `cookies` object from a `+server` file.
|
|
22
20
|
*
|
|
23
21
|
* @see SvelteKit `+server` docs: \<https://kit.svelte.dev/docs/routing#server\>
|
|
24
22
|
*/
|
|
25
|
-
cookies: Cookies
|
|
23
|
+
cookies: Cookies
|
|
26
24
|
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
* document.
|
|
30
|
-
*/
|
|
31
|
-
defaultURL?: string;
|
|
25
|
+
/** The default redirect URL if a URL cannot be determined for the previewed document. */
|
|
26
|
+
defaultURL?: string
|
|
32
27
|
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
routePrefix?: string;
|
|
37
|
-
};
|
|
28
|
+
/** The route parameter prefixed during preview sessions. */
|
|
29
|
+
routePrefix?: string
|
|
30
|
+
}
|
|
38
31
|
|
|
39
32
|
/**
|
|
40
|
-
* Redirects a visitor to the URL of a previewed Prismic document from within a
|
|
41
|
-
*
|
|
33
|
+
* Redirects a visitor to the URL of a previewed Prismic document from within a SvelteKit `+server`
|
|
34
|
+
* file.
|
|
42
35
|
*
|
|
43
36
|
* Return the created `Response` in your `+server` file.
|
|
44
37
|
*
|
|
45
38
|
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import { createClient } from "$lib/prismicio.js"
|
|
41
|
+
* import { redirectToPreviewURL } from "@prismicio/svelte/kit"
|
|
46
42
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* import { redirectToPreviewURL } from "@prismicio/svelte/kit";
|
|
50
|
-
*
|
|
51
|
-
* export async function GET({ fetch, request }) {
|
|
52
|
-
* const client = createClient({ fetch });
|
|
43
|
+
* export async function GET({ fetch, request }) {
|
|
44
|
+
* const client = createClient({ fetch })
|
|
53
45
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
46
|
+
* return await redirectToPreviewURL({ client, request })
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
57
49
|
*/
|
|
58
50
|
export const redirectToPreviewURL = async (
|
|
59
51
|
config: RedirectToPreviewURLConfig,
|
|
60
52
|
): Promise<Response> => {
|
|
61
|
-
const previewToken =
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
new URL(config.request.url).searchParams.get("documentId") ?? undefined;
|
|
65
|
-
const routePrefix = config.routePrefix ?? "preview";
|
|
53
|
+
const previewToken = new URL(config.request.url).searchParams.get("token") ?? undefined
|
|
54
|
+
const documentID = new URL(config.request.url).searchParams.get("documentId") ?? undefined
|
|
55
|
+
const routePrefix = config.routePrefix ?? "preview"
|
|
66
56
|
|
|
67
57
|
const previewURL = await config.client.resolvePreviewURL({
|
|
68
58
|
previewToken,
|
|
69
59
|
documentID,
|
|
70
60
|
defaultURL: config.defaultURL || "/",
|
|
71
|
-
})
|
|
61
|
+
})
|
|
72
62
|
|
|
73
63
|
// Prevent a flash of non-preview content by setting the preview token
|
|
74
64
|
// on the initial page load.
|
|
@@ -76,7 +66,7 @@ export const redirectToPreviewURL = async (
|
|
|
76
66
|
config.cookies.set(prismic.cookie.preview, previewToken, {
|
|
77
67
|
path: "/",
|
|
78
68
|
httpOnly: false,
|
|
79
|
-
})
|
|
69
|
+
})
|
|
80
70
|
}
|
|
81
71
|
|
|
82
72
|
return new Response(undefined, {
|
|
@@ -84,5 +74,5 @@ export const redirectToPreviewURL = async (
|
|
|
84
74
|
headers: {
|
|
85
75
|
Location: "/" + routePrefix + previewURL,
|
|
86
76
|
},
|
|
87
|
-
})
|
|
88
|
-
}
|
|
77
|
+
})
|
|
78
|
+
}
|
package/src/kit/types.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import type { ClientConfig } from "@prismicio/client"
|
|
2
|
-
import type { Cookies } from "@sveltejs/kit"
|
|
1
|
+
import type { ClientConfig } from "@prismicio/client"
|
|
2
|
+
import type { Cookies } from "@sveltejs/kit"
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Configuration for creating a Prismic client with automatic preview support in
|
|
6
|
-
* SvelteKit apps.
|
|
7
|
-
*/
|
|
4
|
+
/** Configuration for creating a Prismic client with automatic preview support in SvelteKit apps. */
|
|
8
5
|
export type CreateClientConfig = ClientConfig & {
|
|
9
6
|
/**
|
|
10
|
-
* The `cookies` object provided to a route's `load()` function. This
|
|
11
|
-
*
|
|
7
|
+
* The `cookies` object provided to a route's `load()` function. This parameter is required to
|
|
8
|
+
* load previews.
|
|
12
9
|
*/
|
|
13
|
-
cookies?: Cookies
|
|
14
|
-
}
|
|
10
|
+
cookies?: Cookies
|
|
11
|
+
}
|
package/src/lib/devMsg.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { version } from "../../package.json"
|
|
1
|
+
import { version } from "../../package.json"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a `prismic.dev/msg` URL for a given message slug.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* devMsg("missing-param")
|
|
9
|
+
* // => "https://prismic.dev/msg/svelte/v1.2.3/missing-param.md"
|
|
10
|
+
* ```
|
|
7
11
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* // => "https://prismic.dev/msg/svelte/v1.2.3/missing-param.md"
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @param slug - Slug for the message. This corresponds to a Markdown file in
|
|
14
|
-
* the Git repository's `/messages` directory.
|
|
15
|
-
*
|
|
12
|
+
* @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
|
|
13
|
+
* `/messages` directory.
|
|
16
14
|
* @returns The `prismic.dev/msg` URL for the given slug.
|
|
17
15
|
*/
|
|
18
16
|
export const devMsg = (slug: string): string => {
|
|
19
|
-
return `https://prismic.dev/msg/svelte/v${version}/${slug}
|
|
20
|
-
}
|
|
17
|
+
return `https://prismic.dev/msg/svelte/v${version}/${slug}`
|
|
18
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -27,160 +27,140 @@ import type {
|
|
|
27
27
|
TableFieldHead,
|
|
28
28
|
TableFieldHeadRow,
|
|
29
29
|
TableFieldHeaderCell,
|
|
30
|
-
} from "@prismicio/client"
|
|
31
|
-
import type { Component, Snippet } from "svelte"
|
|
32
|
-
import type { HTMLAttributes } from "svelte/elements"
|
|
30
|
+
} from "@prismicio/client"
|
|
31
|
+
import type { Component, Snippet } from "svelte"
|
|
32
|
+
import type { HTMLAttributes } from "svelte/elements"
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* A shorthand definition for `<PrismicRichText />` component types.
|
|
36
|
-
*/
|
|
34
|
+
/** A shorthand definition for `<PrismicRichText />` component types. */
|
|
37
35
|
export type ComponentShorthand = {
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
as?: string;
|
|
42
|
-
} & HTMLAttributes<HTMLElement>;
|
|
36
|
+
/** The HTML element type rendered for this node type. */
|
|
37
|
+
as?: string
|
|
38
|
+
} & HTMLAttributes<HTMLElement>
|
|
43
39
|
|
|
44
40
|
export type RichTextComponents = {
|
|
45
|
-
heading1?: RichTextComponent<RTHeading1Node> | ComponentShorthand
|
|
46
|
-
heading2?: RichTextComponent<RTHeading2Node> | ComponentShorthand
|
|
47
|
-
heading3?: RichTextComponent<RTHeading3Node> | ComponentShorthand
|
|
48
|
-
heading4?: RichTextComponent<RTHeading4Node> | ComponentShorthand
|
|
49
|
-
heading5?: RichTextComponent<RTHeading5Node> | ComponentShorthand
|
|
50
|
-
heading6?: RichTextComponent<RTHeading6Node> | ComponentShorthand
|
|
51
|
-
paragraph?: RichTextComponent<RTParagraphNode> | ComponentShorthand
|
|
52
|
-
preformatted?: RichTextComponent<RTPreformattedNode> | ComponentShorthand
|
|
53
|
-
strong?: RichTextComponent<RTStrongNode> | ComponentShorthand
|
|
54
|
-
em?: RichTextComponent<RTEmNode> | ComponentShorthand
|
|
55
|
-
listItem?: RichTextComponent<RTListItemNode> | ComponentShorthand
|
|
56
|
-
oListItem?: RichTextComponent<RTOListItemNode> | ComponentShorthand
|
|
57
|
-
list?: RichTextComponent<RTListNode> | ComponentShorthand
|
|
58
|
-
oList?: RichTextComponent<RTOListNode> | ComponentShorthand
|
|
59
|
-
image?: RichTextComponent<RTImageNode> | HTMLAttributes<HTMLImageElement
|
|
60
|
-
embed?: RichTextComponent<RTEmbedNode> | HTMLAttributes<HTMLDivElement
|
|
61
|
-
hyperlink?: RichTextComponent<RTLinkNode> | HTMLAttributes<HTMLAnchorElement
|
|
62
|
-
label?: RichTextComponent<RTLabelNode> | HTMLAttributes<HTMLSpanElement
|
|
63
|
-
span?: RichTextComponent<RTSpanNode
|
|
64
|
-
}
|
|
41
|
+
heading1?: RichTextComponent<RTHeading1Node> | ComponentShorthand
|
|
42
|
+
heading2?: RichTextComponent<RTHeading2Node> | ComponentShorthand
|
|
43
|
+
heading3?: RichTextComponent<RTHeading3Node> | ComponentShorthand
|
|
44
|
+
heading4?: RichTextComponent<RTHeading4Node> | ComponentShorthand
|
|
45
|
+
heading5?: RichTextComponent<RTHeading5Node> | ComponentShorthand
|
|
46
|
+
heading6?: RichTextComponent<RTHeading6Node> | ComponentShorthand
|
|
47
|
+
paragraph?: RichTextComponent<RTParagraphNode> | ComponentShorthand
|
|
48
|
+
preformatted?: RichTextComponent<RTPreformattedNode> | ComponentShorthand
|
|
49
|
+
strong?: RichTextComponent<RTStrongNode> | ComponentShorthand
|
|
50
|
+
em?: RichTextComponent<RTEmNode> | ComponentShorthand
|
|
51
|
+
listItem?: RichTextComponent<RTListItemNode> | ComponentShorthand
|
|
52
|
+
oListItem?: RichTextComponent<RTOListItemNode> | ComponentShorthand
|
|
53
|
+
list?: RichTextComponent<RTListNode> | ComponentShorthand
|
|
54
|
+
oList?: RichTextComponent<RTOListNode> | ComponentShorthand
|
|
55
|
+
image?: RichTextComponent<RTImageNode> | HTMLAttributes<HTMLImageElement>
|
|
56
|
+
embed?: RichTextComponent<RTEmbedNode> | HTMLAttributes<HTMLDivElement>
|
|
57
|
+
hyperlink?: RichTextComponent<RTLinkNode> | HTMLAttributes<HTMLAnchorElement>
|
|
58
|
+
label?: RichTextComponent<RTLabelNode> | HTMLAttributes<HTMLSpanElement>
|
|
59
|
+
span?: RichTextComponent<RTSpanNode>
|
|
60
|
+
}
|
|
65
61
|
|
|
66
62
|
export type RichTextComponent<TNode extends RTAnyNode = RTAnyNode> = Component<
|
|
67
63
|
RichTextComponentProps<TNode>
|
|
68
|
-
|
|
64
|
+
>
|
|
69
65
|
|
|
70
66
|
export type RichTextComponentProps<TNode extends RTAnyNode = RTAnyNode> = {
|
|
71
|
-
node: TNode
|
|
72
|
-
children: Snippet
|
|
73
|
-
}
|
|
67
|
+
node: TNode
|
|
68
|
+
children: Snippet
|
|
69
|
+
}
|
|
74
70
|
|
|
75
71
|
// Define the type for the components prop
|
|
76
72
|
export type TableComponents = {
|
|
77
73
|
table?:
|
|
78
74
|
| Component<{
|
|
79
|
-
table: TableField<"filled"
|
|
80
|
-
children: Snippet
|
|
75
|
+
table: TableField<"filled">
|
|
76
|
+
children: Snippet
|
|
81
77
|
}>
|
|
82
|
-
| HTMLAttributes<HTMLTableElement
|
|
78
|
+
| HTMLAttributes<HTMLTableElement>
|
|
83
79
|
thead?:
|
|
84
80
|
| Component<{
|
|
85
|
-
head: TableFieldHead
|
|
86
|
-
children: Snippet
|
|
81
|
+
head: TableFieldHead
|
|
82
|
+
children: Snippet
|
|
87
83
|
}>
|
|
88
|
-
| HTMLAttributes<HTMLTableSectionElement
|
|
84
|
+
| HTMLAttributes<HTMLTableSectionElement>
|
|
89
85
|
tbody?:
|
|
90
86
|
| Component<{
|
|
91
|
-
body: TableFieldBody
|
|
92
|
-
children: Snippet
|
|
87
|
+
body: TableFieldBody
|
|
88
|
+
children: Snippet
|
|
93
89
|
}>
|
|
94
|
-
| HTMLAttributes<HTMLTableSectionElement
|
|
90
|
+
| HTMLAttributes<HTMLTableSectionElement>
|
|
95
91
|
tr?:
|
|
96
92
|
| Component<{
|
|
97
|
-
row: TableFieldHeadRow | TableFieldBodyRow
|
|
98
|
-
children: Snippet
|
|
93
|
+
row: TableFieldHeadRow | TableFieldBodyRow
|
|
94
|
+
children: Snippet
|
|
99
95
|
}>
|
|
100
|
-
| HTMLAttributes<HTMLTableRowElement
|
|
96
|
+
| HTMLAttributes<HTMLTableRowElement>
|
|
101
97
|
th?:
|
|
102
98
|
| Component<{
|
|
103
|
-
cell: TableFieldHeaderCell
|
|
104
|
-
children: Snippet
|
|
99
|
+
cell: TableFieldHeaderCell
|
|
100
|
+
children: Snippet
|
|
105
101
|
}>
|
|
106
|
-
| HTMLAttributes<HTMLTableCellElement
|
|
102
|
+
| HTMLAttributes<HTMLTableCellElement>
|
|
107
103
|
td?:
|
|
108
104
|
| Component<{
|
|
109
|
-
cell: TableFieldDataCell
|
|
110
|
-
children: Snippet
|
|
105
|
+
cell: TableFieldDataCell
|
|
106
|
+
children: Snippet
|
|
111
107
|
}>
|
|
112
|
-
| HTMLAttributes<HTMLTableCellElement
|
|
113
|
-
}
|
|
108
|
+
| HTMLAttributes<HTMLTableCellElement>
|
|
109
|
+
}
|
|
114
110
|
|
|
115
111
|
/**
|
|
116
|
-
* Props for a component rendering content from a Prismic Slice using the
|
|
117
|
-
* `<SliceZone>` component.
|
|
112
|
+
* Props for a component rendering content from a Prismic Slice using the `<SliceZone>` component.
|
|
118
113
|
*
|
|
119
114
|
* @typeParam TSlice - The Slice passed as a prop.
|
|
120
|
-
* @typeParam TContext - Arbitrary data passed to `<SliceZone>` and made
|
|
121
|
-
*
|
|
115
|
+
* @typeParam TContext - Arbitrary data passed to `<SliceZone>` and made available to all Slice
|
|
116
|
+
* components.
|
|
122
117
|
*/
|
|
123
|
-
export type SliceComponentProps<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
> = {
|
|
127
|
-
/**
|
|
128
|
-
* Slice data for this component.
|
|
129
|
-
*/
|
|
130
|
-
slice: TSlice;
|
|
118
|
+
export type SliceComponentProps<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
119
|
+
/** Slice data for this component. */
|
|
120
|
+
slice: TSlice
|
|
131
121
|
|
|
132
|
-
/**
|
|
133
|
-
|
|
134
|
-
*/
|
|
135
|
-
index: number;
|
|
122
|
+
/** The index of the Slice in the Slice Zone. */
|
|
123
|
+
index: number
|
|
136
124
|
|
|
137
|
-
/**
|
|
138
|
-
* All Slices from the Slice Zone to which the Slice belongs.
|
|
139
|
-
*/
|
|
125
|
+
/** All Slices from the Slice Zone to which the Slice belongs. */
|
|
140
126
|
// TODO: We have to keep this list of Slices general due to circular
|
|
141
127
|
// reference limtiations. If we had another generic to determine the full
|
|
142
128
|
// union of Slice types, it would include TSlice. This causes TypeScript to
|
|
143
129
|
// throw a compilation error.
|
|
144
|
-
slices: SliceZoneLike<
|
|
145
|
-
TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2
|
|
146
|
-
>;
|
|
130
|
+
slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>
|
|
147
131
|
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
*/
|
|
152
|
-
context: TContext;
|
|
153
|
-
};
|
|
132
|
+
/** Arbitrary data passed to `<SliceZone>` and made available to all Slice components. */
|
|
133
|
+
context: TContext
|
|
134
|
+
}
|
|
154
135
|
|
|
155
136
|
/**
|
|
156
|
-
* The minimum required properties to represent a Prismic Slice from the Prismic
|
|
157
|
-
*
|
|
137
|
+
* The minimum required properties to represent a Prismic Slice from the Prismic Rest API V2 for the
|
|
138
|
+
* `<SliceZone>` component.
|
|
158
139
|
*
|
|
159
|
-
* If using Prismic's Rest API V2, use the `Slice` export from
|
|
160
|
-
*
|
|
140
|
+
* If using Prismic's Rest API V2, use the `Slice` export from `@prismicio/types` for a full
|
|
141
|
+
* interface.
|
|
161
142
|
*
|
|
162
143
|
* @typeParam SliceType - Type name of the Slice.
|
|
163
144
|
*/
|
|
164
145
|
type SliceLikeRestV2<SliceType extends string = string> = {
|
|
165
|
-
slice_type: Slice<SliceType>["slice_type"]
|
|
166
|
-
}
|
|
146
|
+
slice_type: Slice<SliceType>["slice_type"]
|
|
147
|
+
}
|
|
167
148
|
|
|
168
149
|
/**
|
|
169
|
-
* The minimum required properties to represent a Prismic Slice from the Prismic
|
|
170
|
-
*
|
|
150
|
+
* The minimum required properties to represent a Prismic Slice from the Prismic GraphQL API for the
|
|
151
|
+
* `<SliceZone>` component.
|
|
171
152
|
*
|
|
172
153
|
* @typeParam SliceType - Type name of the Slice.
|
|
173
154
|
*/
|
|
174
155
|
type SliceLikeGraphQL<SliceType extends string = string> = {
|
|
175
|
-
type: Slice<SliceType>["slice_type"]
|
|
176
|
-
}
|
|
156
|
+
type: Slice<SliceType>["slice_type"]
|
|
157
|
+
}
|
|
177
158
|
|
|
178
159
|
/**
|
|
179
|
-
* The minimum required properties to represent a Prismic Slice for the
|
|
180
|
-
* `<SliceZone>` component.
|
|
160
|
+
* The minimum required properties to represent a Prismic Slice for the `<SliceZone>` component.
|
|
181
161
|
*
|
|
182
|
-
* If using Prismic's Rest API V2, use the `Slice` export from
|
|
183
|
-
*
|
|
162
|
+
* If using Prismic's Rest API V2, use the `Slice` export from `@prismicio/types` for a full
|
|
163
|
+
* interface.
|
|
184
164
|
*
|
|
185
165
|
* @typeParam SliceType - Type name of the Slice.
|
|
186
166
|
*/
|
|
@@ -189,22 +169,20 @@ type SliceLike<SliceType extends string = string> = (
|
|
|
189
169
|
| SliceLikeGraphQL<SliceType>
|
|
190
170
|
) & {
|
|
191
171
|
/**
|
|
192
|
-
* If `true`, this Slice has been modified from its original value using a
|
|
193
|
-
*
|
|
172
|
+
* If `true`, this Slice has been modified from its original value using a mapper and
|
|
173
|
+
* `@prismicio/client`'s `mapSliceZone()`.
|
|
194
174
|
*
|
|
195
175
|
* @internal
|
|
196
176
|
*/
|
|
197
|
-
__mapped?: true
|
|
198
|
-
}
|
|
177
|
+
__mapped?: true
|
|
178
|
+
}
|
|
199
179
|
|
|
200
180
|
/**
|
|
201
|
-
* A looser version of the `SliceZone` type from `@prismicio/client` using
|
|
202
|
-
* `SliceLike`.
|
|
181
|
+
* A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.
|
|
203
182
|
*
|
|
204
|
-
* If using Prismic's Rest API V2, use the `SliceZone` export from
|
|
205
|
-
*
|
|
183
|
+
* If using Prismic's Rest API V2, use the `SliceZone` export from `@prismicio/client` for the full
|
|
184
|
+
* type.
|
|
206
185
|
*
|
|
207
186
|
* @typeParam TSlice - The type(s) of a Slice in the Slice Zone.
|
|
208
187
|
*/
|
|
209
|
-
export type SliceZoneLike<TSlice extends SliceLike = SliceLike> =
|
|
210
|
-
readonly TSlice[];
|
|
188
|
+
export type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]
|