@prismicio/vue 3.0.0-beta.3 → 3.0.0-beta.6
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 +15 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +16 -4
- package/dist/index.js +10 -15
- package/dist/index.js.map +1 -1
- package/package.json +21 -21
- package/src/components/PrismicImage.ts +13 -23
- package/src/components/PrismicRichText.ts +1 -2
- package/src/components/PrismicText.ts +1 -2
package/dist/index.cjs
CHANGED
|
@@ -84,15 +84,10 @@ const usePrismicImage = (props) => {
|
|
|
84
84
|
if (pixelDensities) {
|
|
85
85
|
console.warn("[PrismicImage] `widths` and `pixelDensities` props should not be use alongside each others, only `widths` will be applied", props);
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return helpers.asImageWidthSrcSet({ url, dimensions, alt: alt2, copyright: copyright2 }, {
|
|
92
|
-
...imgixParams,
|
|
93
|
-
widths: widths === "defaults" ? (_a = options.components) == null ? void 0 : _a.imageWidthSrcSetDefaults : widths
|
|
94
|
-
});
|
|
95
|
-
}
|
|
87
|
+
return helpers.asImageWidthSrcSet(field, {
|
|
88
|
+
...imgixParams,
|
|
89
|
+
widths: widths === "defaults" ? (_a = options.components) == null ? void 0 : _a.imageWidthSrcSetDefaults : widths
|
|
90
|
+
});
|
|
96
91
|
} else if (pixelDensities) {
|
|
97
92
|
return helpers.asImagePixelDensitySrcSet(field, {
|
|
98
93
|
...imgixParams,
|
|
@@ -112,7 +107,7 @@ const usePrismicImage = (props) => {
|
|
|
112
107
|
return asImage.value.srcset;
|
|
113
108
|
});
|
|
114
109
|
const alt = vue.computed(() => {
|
|
115
|
-
return vue.unref(props.field).alt ||
|
|
110
|
+
return vue.unref(props.field).alt || "";
|
|
116
111
|
});
|
|
117
112
|
const copyright = vue.computed(() => {
|
|
118
113
|
return vue.unref(props.field).copyright || null;
|
|
@@ -312,7 +307,7 @@ const PrismicLink = PrismicLinkImpl;
|
|
|
312
307
|
const defaultWrapper$1 = "div";
|
|
313
308
|
const usePrismicText = (props) => {
|
|
314
309
|
const text = vue.computed(() => {
|
|
315
|
-
return helpers.asText(vue.unref(props.field), vue.unref(props.separator))
|
|
310
|
+
return helpers.asText(vue.unref(props.field), vue.unref(props.separator));
|
|
316
311
|
});
|
|
317
312
|
return {
|
|
318
313
|
text
|
|
@@ -358,7 +353,7 @@ const usePrismicRichText = (props) => {
|
|
|
358
353
|
var _a, _b;
|
|
359
354
|
const linkResolver = (_a = vue.unref(props.linkResolver)) != null ? _a : options.linkResolver;
|
|
360
355
|
const htmlSerializer = (_b = vue.unref(props.htmlSerializer)) != null ? _b : options.htmlSerializer;
|
|
361
|
-
return helpers.asHTML(vue.unref(props.field), linkResolver, htmlSerializer)
|
|
356
|
+
return helpers.asHTML(vue.unref(props.field), linkResolver, htmlSerializer);
|
|
362
357
|
});
|
|
363
358
|
return {
|
|
364
359
|
html
|
|
@@ -621,34 +616,34 @@ const createPrismic = (options) => {
|
|
|
621
616
|
return prismic;
|
|
622
617
|
};
|
|
623
618
|
|
|
624
|
-
|
|
625
|
-
(function(PrismicClientComposableState2) {
|
|
619
|
+
var PrismicClientComposableState = /* @__PURE__ */ ((PrismicClientComposableState2) => {
|
|
626
620
|
PrismicClientComposableState2["Idle"] = "idle";
|
|
627
621
|
PrismicClientComposableState2["Pending"] = "pending";
|
|
628
622
|
PrismicClientComposableState2["Success"] = "success";
|
|
629
623
|
PrismicClientComposableState2["Error"] = "error";
|
|
630
|
-
|
|
624
|
+
return PrismicClientComposableState2;
|
|
625
|
+
})(PrismicClientComposableState || {});
|
|
631
626
|
|
|
632
627
|
const isParams = (value) => {
|
|
633
628
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
634
629
|
};
|
|
635
630
|
const useStatefulPrismicClientMethod = (methodName, args) => {
|
|
636
631
|
const { client } = usePrismic();
|
|
637
|
-
const state = vue.ref(
|
|
632
|
+
const state = vue.ref(PrismicClientComposableState.Idle);
|
|
638
633
|
const data = vue.shallowRef(null);
|
|
639
634
|
const error = vue.ref(null);
|
|
640
635
|
const refresh = async () => {
|
|
641
636
|
const lastArg = vue.unref(args[args.length - 1]);
|
|
642
637
|
const { client: explicitClient, ...params } = isParams(lastArg) ? lastArg : {};
|
|
643
638
|
const argsWithoutParams = isParams(lastArg) ? args.slice(0, -1) : args;
|
|
644
|
-
state.value =
|
|
639
|
+
state.value = PrismicClientComposableState.Pending;
|
|
645
640
|
data.value = null;
|
|
646
641
|
error.value = null;
|
|
647
642
|
try {
|
|
648
643
|
data.value = await (vue.unref(explicitClient) || client)[methodName](...argsWithoutParams.map((arg) => vue.unref(arg)), params);
|
|
649
|
-
state.value =
|
|
644
|
+
state.value = PrismicClientComposableState.Success;
|
|
650
645
|
} catch (err) {
|
|
651
|
-
state.value =
|
|
646
|
+
state.value = PrismicClientComposableState.Error;
|
|
652
647
|
error.value = err;
|
|
653
648
|
}
|
|
654
649
|
};
|
|
@@ -679,6 +674,7 @@ const usePrismicDocumentsBySomeTags = (...args) => useStatefulPrismicClientMetho
|
|
|
679
674
|
const useAllPrismicDocumentsBySomeTags = (...args) => useStatefulPrismicClientMethod("getAllBySomeTags", args);
|
|
680
675
|
const dangerouslyUseAllPrismicDocuments = (...args) => useStatefulPrismicClientMethod("dangerouslyGetAll", args);
|
|
681
676
|
|
|
677
|
+
exports.PrismicClientComposableState = PrismicClientComposableState;
|
|
682
678
|
exports.PrismicEmbed = PrismicEmbed;
|
|
683
679
|
exports.PrismicImage = PrismicImage;
|
|
684
680
|
exports.PrismicLink = PrismicLink;
|