@prismicio/vue 3.1.0 → 3.1.1
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/index.cjs.map +1 -1
- package/dist/index.d.ts +127 -92
- package/dist/index.js.map +1 -1
- package/package.json +23 -23
- package/src/components/PrismicEmbed.ts +2 -1
- package/src/components/PrismicImage.ts +6 -3
- package/src/components/PrismicLink.ts +4 -2
- package/src/components/PrismicRichText.ts +4 -2
- package/src/components/PrismicText.ts +6 -3
- package/src/components/SliceZone.ts +12 -7
- package/src/composables.ts +56 -46
- package/src/injectionSymbols.ts +2 -1
- package/src/types.ts +14 -7
- package/src/useStatefulPrismicClientMethod.ts +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/vue",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Vue plugin, components, and composables to fetch and present Prismic content",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -50,40 +50,40 @@
|
|
|
50
50
|
"unit:watch": "vitest watch"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@prismicio/client": "^6.7.
|
|
54
|
-
"@prismicio/helpers": "^2.3.
|
|
53
|
+
"@prismicio/client": "^6.7.1",
|
|
54
|
+
"@prismicio/helpers": "^2.3.5",
|
|
55
55
|
"@prismicio/types": "^0.2.3",
|
|
56
56
|
"isomorphic-unfetch": "^3.1.0",
|
|
57
|
-
"vue-router": "^4.1.
|
|
57
|
+
"vue-router": "^4.1.5"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@prismicio/mock": "^0.1.1",
|
|
61
|
-
"@size-limit/preset-small-lib": "^8.0
|
|
61
|
+
"@size-limit/preset-small-lib": "^8.1.0",
|
|
62
62
|
"@types/escape-html": "^1.0.2",
|
|
63
|
-
"@types/jsdom-global": "^3.0.
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "
|
|
65
|
-
"@typescript-eslint/parser": "^5.
|
|
66
|
-
"@vitejs/plugin-vue": "^3.
|
|
67
|
-
"@vitest/coverage-c8": "0.
|
|
68
|
-
"@vue/compiler-sfc": "^3.2.
|
|
69
|
-
"@vue/eslint-config-typescript": "^11.0.
|
|
70
|
-
"@vue/test-utils": "^2.0
|
|
71
|
-
"eslint": "^8.
|
|
63
|
+
"@types/jsdom-global": "^3.0.4",
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^5.39.0",
|
|
65
|
+
"@typescript-eslint/parser": "^5.39.0",
|
|
66
|
+
"@vitejs/plugin-vue": "^3.1.2",
|
|
67
|
+
"@vitest/coverage-c8": "^0.23.4",
|
|
68
|
+
"@vue/compiler-sfc": "^3.2.40",
|
|
69
|
+
"@vue/eslint-config-typescript": "^11.0.2",
|
|
70
|
+
"@vue/test-utils": "^2.1.0",
|
|
71
|
+
"eslint": "^8.24.0",
|
|
72
72
|
"eslint-config-prettier": "^8.5.0",
|
|
73
73
|
"eslint-plugin-prettier": "^4.2.1",
|
|
74
|
-
"eslint-plugin-tsdoc": "^0.2.
|
|
75
|
-
"eslint-plugin-vue": "^9.
|
|
76
|
-
"jsdom": "^20.0.
|
|
74
|
+
"eslint-plugin-tsdoc": "^0.2.17",
|
|
75
|
+
"eslint-plugin-vue": "^9.6.0",
|
|
76
|
+
"jsdom": "^20.0.1",
|
|
77
77
|
"jsdom-global": "^3.0.2",
|
|
78
78
|
"prettier": "^2.7.1",
|
|
79
|
-
"prettier-plugin-jsdoc": "^0.
|
|
79
|
+
"prettier-plugin-jsdoc": "^0.4.2",
|
|
80
80
|
"siroc": "^0.16.0",
|
|
81
|
-
"size-limit": "^8.0
|
|
81
|
+
"size-limit": "^8.1.0",
|
|
82
82
|
"standard-version": "^9.5.0",
|
|
83
|
-
"typescript": "^4.
|
|
84
|
-
"vite": "^3.
|
|
85
|
-
"vitest": "^0.
|
|
86
|
-
"vue": "^3.2.
|
|
83
|
+
"typescript": "^4.8.4",
|
|
84
|
+
"vite": "^3.1.4",
|
|
85
|
+
"vitest": "^0.23.4",
|
|
86
|
+
"vue": "^3.2.40"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"vue": "^3.0.0"
|
|
@@ -26,7 +26,8 @@ export type PrismicEmbedProps = {
|
|
|
26
26
|
field: EmbedField;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* An HTML tag name, a component, or a functional component used to wrap the
|
|
29
|
+
* An HTML tag name, a component, or a functional component used to wrap the
|
|
30
|
+
* output.
|
|
30
31
|
*
|
|
31
32
|
* @defaultValue `"div"`
|
|
32
33
|
*/
|
|
@@ -39,7 +39,8 @@ export type PrismicImageProps = {
|
|
|
39
39
|
field: ImageField;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* An HTML tag name, a component, or a functional component used to render
|
|
42
|
+
* An HTML tag name, a component, or a functional component used to render
|
|
43
|
+
* images.
|
|
43
44
|
*
|
|
44
45
|
* @remarks
|
|
45
46
|
* HTML tag names and components will be rendered using the `img` tag
|
|
@@ -75,7 +76,8 @@ export type PrismicImageProps = {
|
|
|
75
76
|
| "defaults";
|
|
76
77
|
|
|
77
78
|
/**
|
|
78
|
-
* Adds an additional `srcset` attribute to the image following giving pixel
|
|
79
|
+
* Adds an additional `srcset` attribute to the image following giving pixel
|
|
80
|
+
* densities.
|
|
79
81
|
*
|
|
80
82
|
* @remarks
|
|
81
83
|
* A special value of `"defaults"` is accepted to automatically use image
|
|
@@ -124,7 +126,8 @@ export type UsePrismicImageReturnType = {
|
|
|
124
126
|
};
|
|
125
127
|
|
|
126
128
|
/**
|
|
127
|
-
* A low level composable that returns a resolved information about a Prismic
|
|
129
|
+
* A low level composable that returns a resolved information about a Prismic
|
|
130
|
+
* image field.
|
|
128
131
|
*
|
|
129
132
|
* @param props - {@link UsePrismicImageOptions}
|
|
130
133
|
*
|
|
@@ -66,7 +66,8 @@ export type PrismicLinkProps = {
|
|
|
66
66
|
rel?: string | null;
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* Value of the `rel` attribute to use on links rendered with
|
|
69
|
+
* Value of the `rel` attribute to use on links rendered with
|
|
70
|
+
* `target="_blank"`.
|
|
70
71
|
*
|
|
71
72
|
* @defaultValue The one provided to `@prismicio/vue` plugin if configured, `"noopener noreferrer"` otherwise.
|
|
72
73
|
*/
|
|
@@ -132,7 +133,8 @@ export type UsePrismicLinkReturnType = {
|
|
|
132
133
|
};
|
|
133
134
|
|
|
134
135
|
/**
|
|
135
|
-
* A low level composable that returns resolved information about a Prismic link
|
|
136
|
+
* A low level composable that returns resolved information about a Prismic link
|
|
137
|
+
* field.
|
|
136
138
|
*
|
|
137
139
|
* @param props - {@link UsePrismicLinkOptions}
|
|
138
140
|
*
|
|
@@ -66,7 +66,8 @@ export type PrismicRichTextProps = {
|
|
|
66
66
|
htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* An HTML tag name, a component, or a functional component used to wrap the
|
|
69
|
+
* An HTML tag name, a component, or a functional component used to wrap the
|
|
70
|
+
* output.
|
|
70
71
|
*
|
|
71
72
|
* @defaultValue `"div"`
|
|
72
73
|
*/
|
|
@@ -101,7 +102,8 @@ export type UsePrismicRichTextReturnType = {
|
|
|
101
102
|
*
|
|
102
103
|
* @param props - {@link UsePrismicRichTextOptions}
|
|
103
104
|
*
|
|
104
|
-
* @returns - Serialized rich text field as HTML
|
|
105
|
+
* @returns - Serialized rich text field as HTML
|
|
106
|
+
* {@link UsePrismicRichTextReturnType}
|
|
105
107
|
*/
|
|
106
108
|
export const usePrismicRichText = (
|
|
107
109
|
props: UsePrismicRichTextOptions,
|
|
@@ -39,7 +39,8 @@ export type PrismicTextProps = {
|
|
|
39
39
|
separator?: string;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* An HTML tag name, a component, or a functional component used to wrap the
|
|
42
|
+
* An HTML tag name, a component, or a functional component used to wrap the
|
|
43
|
+
* output.
|
|
43
44
|
*
|
|
44
45
|
* @defaultValue `"div"`
|
|
45
46
|
*/
|
|
@@ -70,11 +71,13 @@ export type UsePrismicTextReturnType = {
|
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
|
-
* A low level composable that returns a serialized rich text field as plain
|
|
74
|
+
* A low level composable that returns a serialized rich text field as plain
|
|
75
|
+
* text.
|
|
74
76
|
*
|
|
75
77
|
* @param props - {@link UsePrismicTextOptions}
|
|
76
78
|
*
|
|
77
|
-
* @returns - Serialized rich text field as plain text
|
|
79
|
+
* @returns - Serialized rich text field as plain text
|
|
80
|
+
* {@link UsePrismicTextReturnType}
|
|
78
81
|
*/
|
|
79
82
|
export const usePrismicText = (
|
|
80
83
|
props: UsePrismicTextOptions,
|
|
@@ -68,7 +68,8 @@ export type SliceLike<TSliceType extends string = string> =
|
|
|
68
68
|
| SliceLikeGraphQL<TSliceType>;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* A looser version of the `SliceZone` type from `@prismicio/types` using
|
|
71
|
+
* A looser version of the `SliceZone` type from `@prismicio/types` using
|
|
72
|
+
* `SliceLike`.
|
|
72
73
|
*
|
|
73
74
|
* If using Prismic's REST API, use the `SliceZone` export from
|
|
74
75
|
* `@prismicio/types` for the full type.
|
|
@@ -111,7 +112,8 @@ export type SliceComponentProps<
|
|
|
111
112
|
slices: SliceZoneLike<SliceLike>;
|
|
112
113
|
|
|
113
114
|
/**
|
|
114
|
-
* Arbitrary data passed to `<SliceZone />` and made available to all Slice
|
|
115
|
+
* Arbitrary data passed to `<SliceZone />` and made available to all Slice
|
|
116
|
+
* components.
|
|
115
117
|
*/
|
|
116
118
|
context: TContext;
|
|
117
119
|
};
|
|
@@ -120,7 +122,7 @@ export type SliceComponentProps<
|
|
|
120
122
|
* Native Vue props for a component rendering content from a Prismic Slice using
|
|
121
123
|
* the `<SliceZone />` component.
|
|
122
124
|
*
|
|
123
|
-
* @typeParam TSlice - The
|
|
125
|
+
* @typeParam TSlice - The Slice type
|
|
124
126
|
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
125
127
|
* available to all Slice components
|
|
126
128
|
*/
|
|
@@ -172,7 +174,7 @@ export type DefineComponentSliceComponentProps<
|
|
|
172
174
|
* };
|
|
173
175
|
* ```
|
|
174
176
|
*
|
|
175
|
-
* @typeParam TSlice - The
|
|
177
|
+
* @typeParam TSlice - The Slice type
|
|
176
178
|
* @typeParam TContext - Arbitrary data passed to `<SliceZone />` and made
|
|
177
179
|
* available to all Slice components
|
|
178
180
|
* @param propsHint - An optional array of prop names used for the sole purpose
|
|
@@ -182,7 +184,8 @@ export type DefineComponentSliceComponentProps<
|
|
|
182
184
|
* @returns Props object to use with {@link defineComponent}
|
|
183
185
|
*/
|
|
184
186
|
export const getSliceComponentProps = <
|
|
185
|
-
|
|
187
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
188
|
+
TSlice extends SliceLike = any,
|
|
186
189
|
TContext = unknown,
|
|
187
190
|
>(
|
|
188
191
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -223,7 +226,8 @@ export type SliceComponentType<
|
|
|
223
226
|
| FunctionalComponent<SliceComponentProps<TSlice, TContext>>;
|
|
224
227
|
|
|
225
228
|
/**
|
|
226
|
-
* This Slice component can be used as a reminder to provide a proper
|
|
229
|
+
* This Slice component can be used as a reminder to provide a proper
|
|
230
|
+
* implementation.
|
|
227
231
|
*
|
|
228
232
|
* This is also the default Vue component rendered when a component mapping
|
|
229
233
|
* cannot be found in `<SliceZone />`.
|
|
@@ -367,7 +371,8 @@ export type SliceZoneResolverArgs<TSlice extends SliceLike = SliceLike> = {
|
|
|
367
371
|
/**
|
|
368
372
|
* A function that determines the rendered Vue component for each Slice in the
|
|
369
373
|
* Slice Zone. If a nullish value is returned, the component will fallback to
|
|
370
|
-
* the `components` or `defaultComponent` props to determine the rendered
|
|
374
|
+
* the `components` or `defaultComponent` props to determine the rendered
|
|
375
|
+
* component.
|
|
371
376
|
*
|
|
372
377
|
* @deprecated Use the `components` prop instead.
|
|
373
378
|
*
|
package/src/composables.ts
CHANGED
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
* A composable that queries content from the Prismic repository.
|
|
22
22
|
*
|
|
23
23
|
* @remarks
|
|
24
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
25
|
-
*
|
|
24
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
25
|
+
* `params.client`.
|
|
26
26
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
27
27
|
*
|
|
28
28
|
* @param params - Parameters to filter, sort, and paginate results
|
|
@@ -43,8 +43,8 @@ export const usePrismicDocuments = <TDocument extends PrismicDocument>(
|
|
|
43
43
|
* only the first result, if any.
|
|
44
44
|
*
|
|
45
45
|
* @remarks
|
|
46
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
47
|
-
*
|
|
46
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
47
|
+
* `params.client`.
|
|
48
48
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
49
49
|
*
|
|
50
50
|
* @param params - Parameters to filter, sort, and paginate results
|
|
@@ -61,11 +61,12 @@ export const useFirstPrismicDocument = <TDocument extends PrismicDocument>(
|
|
|
61
61
|
useStatefulPrismicClientMethod("getFirst", args);
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* A composable that queries a document from the Prismic repository with a
|
|
64
|
+
* A composable that queries a document from the Prismic repository with a
|
|
65
|
+
* specific ID.
|
|
65
66
|
*
|
|
66
67
|
* @remarks
|
|
67
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
68
|
-
*
|
|
68
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
69
|
+
* `params.client`.
|
|
69
70
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
70
71
|
*
|
|
71
72
|
* @param id - ID of the document
|
|
@@ -84,11 +85,12 @@ export const usePrismicDocumentByID = <TDocument extends PrismicDocument>(
|
|
|
84
85
|
useStatefulPrismicClientMethod("getByID", args);
|
|
85
86
|
|
|
86
87
|
/**
|
|
87
|
-
* A composable that queries documents from the Prismic repository with specific
|
|
88
|
+
* A composable that queries documents from the Prismic repository with specific
|
|
89
|
+
* IDs.
|
|
88
90
|
*
|
|
89
91
|
* @remarks
|
|
90
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
91
|
-
*
|
|
92
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
93
|
+
* `params.client`.
|
|
92
94
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
93
95
|
*
|
|
94
96
|
* @param ids - A list of document IDs
|
|
@@ -107,11 +109,12 @@ export const usePrismicDocumentsByIDs = <TDocument extends PrismicDocument>(
|
|
|
107
109
|
useStatefulPrismicClientMethod("getByIDs", args);
|
|
108
110
|
|
|
109
111
|
/**
|
|
110
|
-
* A composable that queries all documents from the Prismic repository with
|
|
112
|
+
* A composable that queries all documents from the Prismic repository with
|
|
113
|
+
* specific IDs.
|
|
111
114
|
*
|
|
112
115
|
* @remarks
|
|
113
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
114
|
-
*
|
|
116
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
117
|
+
* `params.client`.
|
|
115
118
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
116
119
|
*
|
|
117
120
|
* @param ids - A list of document IDs
|
|
@@ -135,8 +138,8 @@ export const useAllPrismicDocumentsByIDs = <TDocument extends PrismicDocument>(
|
|
|
135
138
|
* specific UID and Custom Type.
|
|
136
139
|
*
|
|
137
140
|
* @remarks
|
|
138
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
139
|
-
*
|
|
141
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
142
|
+
* `params.client`.
|
|
140
143
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
141
144
|
*
|
|
142
145
|
* @param documentType - The API ID of the document's Custom Type
|
|
@@ -157,11 +160,12 @@ export const usePrismicDocumentByUID = <TDocument extends PrismicDocument>(
|
|
|
157
160
|
useStatefulPrismicClientMethod("getByUID", args);
|
|
158
161
|
|
|
159
162
|
/**
|
|
160
|
-
* A composable that queries documents from the Prismic repository with specific
|
|
163
|
+
* A composable that queries documents from the Prismic repository with specific
|
|
164
|
+
* UIDs.
|
|
161
165
|
*
|
|
162
166
|
* @remarks
|
|
163
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
164
|
-
*
|
|
167
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
168
|
+
* `params.client`.
|
|
165
169
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
166
170
|
*
|
|
167
171
|
* @param documentType - The API ID of the document's Custom Type
|
|
@@ -182,11 +186,12 @@ export const usePrismicDocumentsByUIDs = <TDocument extends PrismicDocument>(
|
|
|
182
186
|
useStatefulPrismicClientMethod("getByUIDs", args);
|
|
183
187
|
|
|
184
188
|
/**
|
|
185
|
-
* A composable that queries all documents from the Prismic repository with
|
|
189
|
+
* A composable that queries all documents from the Prismic repository with
|
|
190
|
+
* specific UIDs.
|
|
186
191
|
*
|
|
187
192
|
* @remarks
|
|
188
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
189
|
-
*
|
|
193
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
194
|
+
* `params.client`.
|
|
190
195
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
191
196
|
*
|
|
192
197
|
* @param documentType - The API ID of the document's Custom Type
|
|
@@ -212,8 +217,8 @@ export const useAllPrismicDocumentsByUIDs = <TDocument extends PrismicDocument>(
|
|
|
212
217
|
* for a specific Custom Type.
|
|
213
218
|
*
|
|
214
219
|
* @remarks
|
|
215
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
216
|
-
*
|
|
220
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
221
|
+
* `params.client`.
|
|
217
222
|
* @typeParam TDocument - Type of the Prismic document returned
|
|
218
223
|
*
|
|
219
224
|
* @param documentType - The API ID of the singleton Custom Type
|
|
@@ -236,8 +241,8 @@ export const useSinglePrismicDocument = <TDocument extends PrismicDocument>(
|
|
|
236
241
|
* specific Custom Type.
|
|
237
242
|
*
|
|
238
243
|
* @remarks
|
|
239
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
240
|
-
*
|
|
244
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
245
|
+
* `params.client`.
|
|
241
246
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
242
247
|
*
|
|
243
248
|
* @param documentType - The API ID of the Custom Type
|
|
@@ -260,8 +265,8 @@ export const usePrismicDocumentsByType = <TDocument extends PrismicDocument>(
|
|
|
260
265
|
* specific Custom Type.
|
|
261
266
|
*
|
|
262
267
|
* @remarks
|
|
263
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
264
|
-
*
|
|
268
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
269
|
+
* `params.client`.
|
|
265
270
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
266
271
|
*
|
|
267
272
|
* @param documentType - The API ID of the Custom Type
|
|
@@ -281,11 +286,12 @@ export const useAllPrismicDocumentsByType = <TDocument extends PrismicDocument>(
|
|
|
281
286
|
useStatefulPrismicClientMethod("getAllByType", args);
|
|
282
287
|
|
|
283
288
|
/**
|
|
284
|
-
* A composable that queries documents from the Prismic repository with a
|
|
289
|
+
* A composable that queries documents from the Prismic repository with a
|
|
290
|
+
* specific tag.
|
|
285
291
|
*
|
|
286
292
|
* @remarks
|
|
287
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
288
|
-
*
|
|
293
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
294
|
+
* `params.client`.
|
|
289
295
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
290
296
|
*
|
|
291
297
|
* @param tag - The tag that must be included on a document
|
|
@@ -308,8 +314,8 @@ export const usePrismicDocumentsByTag = <TDocument extends PrismicDocument>(
|
|
|
308
314
|
* specific tag.
|
|
309
315
|
*
|
|
310
316
|
* @remarks
|
|
311
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
312
|
-
*
|
|
317
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
318
|
+
* `params.client`.
|
|
313
319
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
314
320
|
*
|
|
315
321
|
* @param tag - The tag that must be included on a document
|
|
@@ -333,8 +339,8 @@ export const useAllPrismicDocumentsByTag = <TDocument extends PrismicDocument>(
|
|
|
333
339
|
* tags. A document must be tagged with all of the queried tags to be included.
|
|
334
340
|
*
|
|
335
341
|
* @remarks
|
|
336
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
337
|
-
*
|
|
342
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
343
|
+
* `params.client`.
|
|
338
344
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
339
345
|
*
|
|
340
346
|
* @param tags - A list of tags that must be included on a document
|
|
@@ -357,11 +363,12 @@ export const usePrismicDocumentsByEveryTag = <
|
|
|
357
363
|
|
|
358
364
|
/**
|
|
359
365
|
* A composable that queries all documents from the Prismic repository with
|
|
360
|
-
* specific tags. A document must be tagged with all of the queried tags to be
|
|
366
|
+
* specific tags. A document must be tagged with all of the queried tags to be
|
|
367
|
+
* included.
|
|
361
368
|
*
|
|
362
369
|
* @remarks
|
|
363
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
364
|
-
*
|
|
370
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
371
|
+
* `params.client`.
|
|
365
372
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
366
373
|
*
|
|
367
374
|
* @param tags - A list of tags that must be included on a document
|
|
@@ -384,11 +391,12 @@ export const useAllPrismicDocumentsByEveryTag = <
|
|
|
384
391
|
|
|
385
392
|
/**
|
|
386
393
|
* A composable that queries documents from the Prismic repository with specific
|
|
387
|
-
* tags. A document must be tagged with at least one of the queried tags to be
|
|
394
|
+
* tags. A document must be tagged with at least one of the queried tags to be
|
|
395
|
+
* included.
|
|
388
396
|
*
|
|
389
397
|
* @remarks
|
|
390
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
391
|
-
*
|
|
398
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
399
|
+
* `params.client`.
|
|
392
400
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
393
401
|
*
|
|
394
402
|
* @param tags - A list of tags that must be included on a document
|
|
@@ -415,8 +423,8 @@ export const usePrismicDocumentsBySomeTags = <
|
|
|
415
423
|
* tags to be included.
|
|
416
424
|
*
|
|
417
425
|
* @remarks
|
|
418
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
419
|
-
*
|
|
426
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
427
|
+
* `params.client`.
|
|
420
428
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
421
429
|
*
|
|
422
430
|
* @param tags - A list of tags that must be included on a document
|
|
@@ -440,14 +448,16 @@ export const useAllPrismicDocumentsBySomeTags = <
|
|
|
440
448
|
/**
|
|
441
449
|
* **IMPORTANT**: Avoid using `dangerouslyUseAllPrismicDocuments` as it may be
|
|
442
450
|
* slower and require more resources than other composables. Prefer using other
|
|
443
|
-
* composables that filter by predicates such as
|
|
451
|
+
* composables that filter by predicates such as
|
|
452
|
+
* `useAllPrismicDocumentsByType`.
|
|
444
453
|
*
|
|
445
454
|
* A composable that queries content from the Prismic repository and returns all
|
|
446
|
-
* matching content. If no predicates are provided, all documents will be
|
|
455
|
+
* matching content. If no predicates are provided, all documents will be
|
|
456
|
+
* fetched.
|
|
447
457
|
*
|
|
448
458
|
* @remarks
|
|
449
|
-
* An additional `@prismicio/client` instance can be provided at
|
|
450
|
-
*
|
|
459
|
+
* An additional `@prismicio/client` instance can be provided at
|
|
460
|
+
* `params.client`.
|
|
451
461
|
* @typeParam TDocument - Type of Prismic documents returned
|
|
452
462
|
*
|
|
453
463
|
* @param params - Parameters to filter and sort results
|
package/src/injectionSymbols.ts
CHANGED
|
@@ -11,7 +11,8 @@ import type { usePrismic } from "./usePrismic";
|
|
|
11
11
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* `@prismicio/vue` plugin interface interface location used for
|
|
14
|
+
* `@prismicio/vue` plugin interface interface location used for
|
|
15
|
+
* {@link usePrismic}.
|
|
15
16
|
*
|
|
16
17
|
* @internal
|
|
17
18
|
*/
|
package/src/types.ts
CHANGED
|
@@ -41,7 +41,8 @@ import type { usePrismicDocuments } from "./composables";
|
|
|
41
41
|
*/
|
|
42
42
|
type PrismicPluginComponentsOptions = {
|
|
43
43
|
/**
|
|
44
|
-
* Value of the `rel` attribute to use on links rendered with
|
|
44
|
+
* Value of the `rel` attribute to use on links rendered with
|
|
45
|
+
* `target="_blank"`
|
|
45
46
|
*
|
|
46
47
|
* @defaultValue `"noopener noreferrer"`
|
|
47
48
|
*/
|
|
@@ -76,7 +77,8 @@ type PrismicPluginComponentsOptions = {
|
|
|
76
77
|
linkExternalComponent?: string | ConcreteComponent;
|
|
77
78
|
|
|
78
79
|
/**
|
|
79
|
-
* An HTML tag name, a component, or a functional component used to render
|
|
80
|
+
* An HTML tag name, a component, or a functional component used to render
|
|
81
|
+
* images.
|
|
80
82
|
*
|
|
81
83
|
* @remarks
|
|
82
84
|
* HTML tag names and components will be rendered using the `img` tag
|
|
@@ -123,14 +125,16 @@ type PrismicPluginComponentsOptions = {
|
|
|
123
125
|
type PrismicPluginOptionsBase = {
|
|
124
126
|
/**
|
|
125
127
|
* An optional link resolver function used to resolve links to Prismic
|
|
126
|
-
* documents when not using the route resolver parameter with
|
|
128
|
+
* documents when not using the route resolver parameter with
|
|
129
|
+
* `@prismicio/client`.
|
|
127
130
|
*
|
|
128
131
|
* @see Link resolver documentation {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#link-resolver}
|
|
129
132
|
*/
|
|
130
133
|
linkResolver?: LinkResolverFunction;
|
|
131
134
|
|
|
132
135
|
/**
|
|
133
|
-
* An optional HTML serializer to customize the way rich text fields are
|
|
136
|
+
* An optional HTML serializer to customize the way rich text fields are
|
|
137
|
+
* rendered.
|
|
134
138
|
*
|
|
135
139
|
* @see HTML serializer documentation {@link https://prismic.io/docs/core-concepts/html-serializer}
|
|
136
140
|
*/
|
|
@@ -265,7 +269,8 @@ export type PrismicPluginOptions =
|
|
|
265
269
|
|
|
266
270
|
/**
|
|
267
271
|
* `@prismicio/client` related methods and properties exposed by
|
|
268
|
-
* `@prismicio/vue` plugin and accessible through `this.$prismic` and
|
|
272
|
+
* `@prismicio/vue` plugin and accessible through `this.$prismic` and
|
|
273
|
+
* `usePrismic()`.
|
|
269
274
|
*/
|
|
270
275
|
export type PrismicPluginClient = {
|
|
271
276
|
/**
|
|
@@ -333,7 +338,8 @@ export type PrismicPluginHelpers = {
|
|
|
333
338
|
|
|
334
339
|
/**
|
|
335
340
|
* Returns the URL of an Image field with optional image transformations (via
|
|
336
|
-
* Imgix URL parameters). This is `@prismicio/helpers` {@link asImageSrc}
|
|
341
|
+
* Imgix URL parameters). This is `@prismicio/helpers` {@link asImageSrc}
|
|
342
|
+
* function.
|
|
337
343
|
*/
|
|
338
344
|
asImageSrc: typeof asImageSrc;
|
|
339
345
|
|
|
@@ -409,7 +415,8 @@ export const enum PrismicClientComposableState {
|
|
|
409
415
|
// Helpers
|
|
410
416
|
|
|
411
417
|
/**
|
|
412
|
-
* Type to transform a static object into one that allows passing Refs as
|
|
418
|
+
* Type to transform a static object into one that allows passing Refs as
|
|
419
|
+
* values.
|
|
413
420
|
*
|
|
414
421
|
* @internal
|
|
415
422
|
*/
|
|
@@ -45,7 +45,8 @@ export type ComposableOnlyParameters = {
|
|
|
45
45
|
/**
|
|
46
46
|
* The return type of a `@prismicio/client` Vue composable.
|
|
47
47
|
*
|
|
48
|
-
* @typeParam TData - The expected format of the `data` property of the returned
|
|
48
|
+
* @typeParam TData - The expected format of the `data` property of the returned
|
|
49
|
+
* object
|
|
49
50
|
*/
|
|
50
51
|
export type ClientComposableReturnType<TData = unknown> = {
|
|
51
52
|
/**
|
|
@@ -59,7 +60,8 @@ export type ClientComposableReturnType<TData = unknown> = {
|
|
|
59
60
|
data: Ref<TData | null>;
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
|
-
* Error returned by the composable's client method call if in an errror
|
|
63
|
+
* Error returned by the composable's client method call if in an errror
|
|
64
|
+
* state.
|
|
63
65
|
*/
|
|
64
66
|
error: Ref<ClientError | Error | null>;
|
|
65
67
|
|
|
@@ -74,7 +76,8 @@ export type ClientComposableReturnType<TData = unknown> = {
|
|
|
74
76
|
*
|
|
75
77
|
* @param value - The value to check
|
|
76
78
|
*
|
|
77
|
-
* @returns `true` if `value` is a `@prismicio/client` params object, `false`
|
|
79
|
+
* @returns `true` if `value` is a `@prismicio/client` params object, `false`
|
|
80
|
+
* otherwise
|
|
78
81
|
*/
|
|
79
82
|
const isParams = (
|
|
80
83
|
value: unknown,
|