@prismicio/vue 3.0.0-beta.2 → 3.0.0-beta.3
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 +16 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -79
- package/dist/index.js +18 -21
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/PrismicImage.ts +11 -4
- package/src/components/SliceZone.ts +1 -1
- package/src/createPrismic.ts +12 -28
- package/src/index.ts +0 -1
- package/src/types.ts +19 -0
package/src/createPrismic.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { App } from "vue";
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
createClient,
|
|
5
|
-
getEndpoint,
|
|
6
5
|
predicate,
|
|
7
6
|
cookie,
|
|
8
7
|
Client,
|
|
@@ -51,34 +50,19 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => {
|
|
|
51
50
|
if (options.client) {
|
|
52
51
|
client = options.client;
|
|
53
52
|
} else {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
client = createClient(options.endpoint, {
|
|
54
|
+
fetch: async (endpoint, options) => {
|
|
55
|
+
let fetchFunction: FetchLike;
|
|
56
|
+
if (typeof globalThis.fetch === "function") {
|
|
57
|
+
fetchFunction = globalThis.fetch;
|
|
58
|
+
} else {
|
|
59
|
+
fetchFunction = (await import("isomorphic-unfetch")).default;
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
66
|
-
client = createClient(endpoint, options.clientConfig);
|
|
67
|
-
} else {
|
|
68
|
-
client = createClient(endpoint, {
|
|
69
|
-
...options.clientConfig,
|
|
70
|
-
fetch: async (endpoint, options) => {
|
|
71
|
-
let fetchFunction: FetchLike;
|
|
72
|
-
if (typeof globalThis.fetch === "function") {
|
|
73
|
-
fetchFunction = globalThis.fetch;
|
|
74
|
-
} else {
|
|
75
|
-
fetchFunction = (await import("isomorphic-unfetch")).default;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return await fetchFunction(endpoint, options);
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
}
|
|
62
|
+
return await fetchFunction(endpoint, options);
|
|
63
|
+
},
|
|
64
|
+
...options.clientConfig,
|
|
65
|
+
});
|
|
82
66
|
}
|
|
83
67
|
|
|
84
68
|
const prismicClient: PrismicPluginClient = {
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -86,6 +86,25 @@ type PrismicPluginComponentsOptions = {
|
|
|
86
86
|
*/
|
|
87
87
|
imageComponent?: string | ConcreteComponent;
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Default widths to use when rendering an image with `widths="defaults"`
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* Consider configuring image widths within your content type definition and
|
|
94
|
+
* using `widths="auto"` instead to give content writers the ability to crop
|
|
95
|
+
* images in the editor.
|
|
96
|
+
* @defaultValue `@prismicio/helpers` defaults
|
|
97
|
+
*/
|
|
98
|
+
imageWidthSrcSetDefaults?: number[];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Default pixel densities to use when rendering an image with
|
|
102
|
+
* `pixel-densities="defaults"`
|
|
103
|
+
*
|
|
104
|
+
* @defaultValue `@prismicio/helpers` defaults
|
|
105
|
+
*/
|
|
106
|
+
imagePixelDensitySrcSetDefaults?: number[];
|
|
107
|
+
|
|
89
108
|
/**
|
|
90
109
|
* A component or a functional component rendered if a component mapping from
|
|
91
110
|
* the `components` prop cannot be found.
|