@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.
@@ -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
- const endpoint =
55
- /**
56
- * @see Regex101 expression: {@link https://regex101.com/r/GT2cl7/1}
57
- */
58
- /^(https?:)?\/\//gim.test(options.endpoint)
59
- ? options.endpoint
60
- : getEndpoint(options.endpoint);
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
- if (
63
- options.clientConfig &&
64
- typeof options.clientConfig.fetch === "function"
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
@@ -17,7 +17,6 @@ export {
17
17
  getSliceComponentProps,
18
18
  TODOSliceComponent,
19
19
  defineSliceZoneComponents,
20
- SliceZoneImpl,
21
20
  SliceZone,
22
21
  } from "./components";
23
22
  export type {
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.