vue-datocms 8.1.15 → 8.1.17
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 +9 -31
- package/dist/index.cjs.js +29 -12
- package/dist/index.d.ts +5 -0
- package/dist/index.esm.mjs +29 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,42 +84,20 @@ npm run dev
|
|
|
84
84
|
|
|
85
85
|
<a href="https://www.datocms.com/"><img src="https://www.datocms.com/images/full_logo.svg" height="60" alt="DatoCMS - The Headless CMS for the Modern Web"></a>
|
|
86
86
|
|
|
87
|
-
[DatoCMS](https://www.datocms.com/) is
|
|
87
|
+
[DatoCMS](https://www.datocms.com/) is Headless CMS for the modern web. Trusted by 25,000+ businesses, agencies, and individuals, it gives your team one place to manage content and ship it to any website, app, or device via API.
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
**New here?** Start with [Create free account](https://dashboard.datocms.com/signup) and the [Documentation](https://www.datocms.com/docs). Stuck? Ask the [Community](https://community.datocms.com/). Curious what's new? [Product Updates](https://www.datocms.com/product-updates).
|
|
90
90
|
|
|
91
|
-
**
|
|
91
|
+
**Building with AI:** [Agent Skills](https://www.datocms.com/docs/agent-skills) turn coding assistants (Claude Code, Cursor) into expert DatoCMS developers, with full read/write via the auto-installed CLI. No local terminal? Use the [MCP Server](https://www.datocms.com/docs/mcp-server) instead.
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
93
|
+
**Talking to DatoCMS from code:**
|
|
94
|
+
- [Content Delivery API](https://www.datocms.com/docs/content-delivery-api) (CDA) — the fast, read-only GraphQL API your website/app uses to **fetch** published content.
|
|
95
|
+
- [Content Management API](https://www.datocms.com/docs/content-management-api) (CMA) — the REST API for **creating and updating** content, models, and project settings (think scripts, migrations, integrations).
|
|
96
|
+
- [CLI](https://www.datocms.com/docs/scripting-migrations/installing-the-cli) — terminal tool for schema migrations and importing from Contentful/WordPress.
|
|
96
97
|
|
|
97
|
-
**
|
|
98
|
+
**Framework guides:** end-to-end recipes for fetching content, rendering Structured Text, optimizing images/video, handling SEO, and setting up live preview with visual editing in [Next.js](https://www.datocms.com/docs/next-js), [Nuxt](https://www.datocms.com/docs/nuxt), [Svelte](https://www.datocms.com/docs/svelte), and [Astro](https://www.datocms.com/docs/astro).
|
|
98
99
|
|
|
99
|
-
|
|
100
|
-
- 🔖 [Documentation](https://www.datocms.com/docs) - Comprehensive guides and API references
|
|
101
|
-
- ⚙️ [Community Support](https://community.datocms.com/) - Get help from our team and community
|
|
102
|
-
- 🆕 [Changelog](https://www.datocms.com/product-updates) - Latest features and improvements
|
|
100
|
+
**Want a head start?** Browse our [starter projects](https://www.datocms.com/marketplace/starters) — ready-to-deploy example sites for popular frameworks.
|
|
103
101
|
|
|
104
|
-
**Official Libraries:**
|
|
105
|
-
|
|
106
|
-
- [**Content Delivery Client**](https://github.com/datocms/cda-client) - TypeScript GraphQL client for content fetching
|
|
107
|
-
- [**REST API Clients**](https://github.com/datocms/js-rest-api-clients) - Node.js/Browser clients for content management
|
|
108
|
-
- [**CLI Tools**](https://github.com/datocms/cli) - Command-line utilities for schema migrations (includes [Contentful](https://github.com/datocms/cli/tree/main/packages/cli-plugin-contentful) and [WordPress](https://github.com/datocms/cli/tree/main/packages/cli-plugin-wordpress) importers)
|
|
109
|
-
|
|
110
|
-
**Official Framework Integrations**
|
|
111
|
-
|
|
112
|
-
Helpers to manage SEO, images, video and Structured Text coming from your DatoCMS projects:
|
|
113
|
-
|
|
114
|
-
- [**React Components**](https://github.com/datocms/react-datocms)
|
|
115
|
-
- [**Vue Components**](https://github.com/datocms/vue-datocms)
|
|
116
|
-
- [**Svelte Components**](https://github.com/datocms/datocms-svelte)
|
|
117
|
-
- [**Astro Components**](https://github.com/datocms/astro-datocms)
|
|
118
|
-
|
|
119
|
-
**Additional Resources:**
|
|
120
|
-
|
|
121
|
-
- [**Plugin Examples**](https://github.com/datocms/plugins) - Example plugins we've made that extend the editor/admin dashboard
|
|
122
|
-
- [**Starter Projects**](https://www.datocms.com/marketplace/starters) - Example website implementations for popular frameworks
|
|
123
|
-
- [**All Public Repositories**](https://github.com/orgs/datocms/repositories?q=&type=public&language=&sort=stargazers)
|
|
124
102
|
|
|
125
103
|
<!--datocms-autoinclude-footer end-->
|
package/dist/index.cjs.js
CHANGED
|
@@ -604,7 +604,7 @@ const Image$1 = vue.defineComponent({
|
|
|
604
604
|
};
|
|
605
605
|
},
|
|
606
606
|
render() {
|
|
607
|
-
var _a, _b, _c, _d
|
|
607
|
+
var _a, _b, _c, _d;
|
|
608
608
|
const addImage = imageAddStrategy({
|
|
609
609
|
priority: this.priority,
|
|
610
610
|
inView: this.inView,
|
|
@@ -615,10 +615,11 @@ const Image$1 = vue.defineComponent({
|
|
|
615
615
|
inView: this.inView,
|
|
616
616
|
loaded: this.loaded
|
|
617
617
|
});
|
|
618
|
-
const
|
|
618
|
+
const resolvedSizes = (_b = (_a = this.sizes) != null ? _a : this.data.sizes) != null ? _b : this.priority ? void 0 : "auto, 100vw";
|
|
619
|
+
const webpSource = buildWebpSource(this.data, resolvedSizes);
|
|
619
620
|
const regularSource = buildRegularSource(
|
|
620
621
|
this.data,
|
|
621
|
-
|
|
622
|
+
resolvedSizes,
|
|
622
623
|
this.srcSetCandidates
|
|
623
624
|
);
|
|
624
625
|
const transition = typeof this.fadeInDuration === "undefined" || this.fadeInDuration > 0 ? `opacity ${this.fadeInDuration || 500}ms` : void 0;
|
|
@@ -652,7 +653,7 @@ const Image$1 = vue.defineComponent({
|
|
|
652
653
|
}, basePlaceholderStyle)
|
|
653
654
|
}) : null;
|
|
654
655
|
const { width, aspectRatio } = this.data;
|
|
655
|
-
const height = (
|
|
656
|
+
const height = (_c = this.data.height) != null ? _c : aspectRatio ? width / aspectRatio : 0;
|
|
656
657
|
const sizer = this.layout !== "fill" ? vue.h(Sizer, {
|
|
657
658
|
sizerClass: this.imgClass,
|
|
658
659
|
sizerStyle: this.imgStyle,
|
|
@@ -678,6 +679,8 @@ const Image$1 = vue.defineComponent({
|
|
|
678
679
|
src: this.data.src,
|
|
679
680
|
alt: this.data.alt,
|
|
680
681
|
title: this.data.title,
|
|
682
|
+
sizes: resolvedSizes,
|
|
683
|
+
loading: this.priority ? void 0 : "lazy",
|
|
681
684
|
fetchpriority: this.priority ? "high" : void 0,
|
|
682
685
|
onLoad: this.handleLoad,
|
|
683
686
|
ref: "imageRef",
|
|
@@ -699,7 +702,7 @@ const Image$1 = vue.defineComponent({
|
|
|
699
702
|
[
|
|
700
703
|
this.data.webpSrcSet && tag("source", {
|
|
701
704
|
srcset: this.data.webpSrcSet,
|
|
702
|
-
sizes:
|
|
705
|
+
sizes: resolvedSizes,
|
|
703
706
|
type: "image/webp"
|
|
704
707
|
}),
|
|
705
708
|
tag("source", {
|
|
@@ -708,13 +711,14 @@ const Image$1 = vue.defineComponent({
|
|
|
708
711
|
this.data.width,
|
|
709
712
|
this.srcSetCandidates
|
|
710
713
|
),
|
|
711
|
-
sizes:
|
|
714
|
+
sizes: resolvedSizes
|
|
712
715
|
}),
|
|
713
716
|
tag("img", {
|
|
714
717
|
src: this.data.src,
|
|
715
718
|
alt: this.data.alt,
|
|
716
719
|
title: this.data.title,
|
|
717
720
|
class: this.imgClass,
|
|
721
|
+
sizes: resolvedSizes,
|
|
718
722
|
style: toCss(__spreadValues$5(__spreadProps$3(__spreadValues$5({}, absolutePositioning), {
|
|
719
723
|
objectFit: this.objectFit,
|
|
720
724
|
objectPosition: this.objectPosition
|
|
@@ -851,15 +855,16 @@ const NakedImage = vue.defineComponent({
|
|
|
851
855
|
};
|
|
852
856
|
},
|
|
853
857
|
render() {
|
|
854
|
-
var _a;
|
|
855
|
-
const
|
|
858
|
+
var _a, _b, _c;
|
|
859
|
+
const resolvedSizes = (_b = (_a = this.sizes) != null ? _a : this.data.sizes) != null ? _b : this.priority ? void 0 : "auto, 100vw";
|
|
860
|
+
const webpSource = buildWebpSource(this.data, resolvedSizes);
|
|
856
861
|
const regularSource = buildRegularSource(
|
|
857
862
|
this.data,
|
|
858
|
-
|
|
863
|
+
resolvedSizes,
|
|
859
864
|
this.srcSetCandidates
|
|
860
865
|
);
|
|
861
866
|
const { width } = this.data;
|
|
862
|
-
const height = (
|
|
867
|
+
const height = (_c = this.data.height) != null ? _c : Math.round(this.data.aspectRatio ? width / this.data.aspectRatio : 0);
|
|
863
868
|
const sizingStyle = {
|
|
864
869
|
aspectRatio: `${width} / ${height}`,
|
|
865
870
|
width: "100%",
|
|
@@ -891,6 +896,7 @@ const NakedImage = vue.defineComponent({
|
|
|
891
896
|
alt: this.data.alt,
|
|
892
897
|
onLoad: this.handleLoad,
|
|
893
898
|
title: this.data.title,
|
|
899
|
+
sizes: resolvedSizes,
|
|
894
900
|
fetchpriority: this.priority ? "high" : void 0,
|
|
895
901
|
loading: this.priority ? void 0 : "lazy",
|
|
896
902
|
style: __spreadValues$4(__spreadValues$4(__spreadValues$4({}, placeholderStyle), sizingStyle), this.imgStyle || {}),
|
|
@@ -1137,12 +1143,23 @@ const computedStyle = (width, height) => {
|
|
|
1137
1143
|
const computedPlaceholder = (blurUpThumb) => {
|
|
1138
1144
|
return blurUpThumb ? { placeholder: blurUpThumb } : void 0;
|
|
1139
1145
|
};
|
|
1146
|
+
const computedPoster = (thumbnailUrl) => {
|
|
1147
|
+
return thumbnailUrl ? { poster: thumbnailUrl } : void 0;
|
|
1148
|
+
};
|
|
1140
1149
|
const useVideoPlayer = ({
|
|
1141
1150
|
data
|
|
1142
1151
|
}) => {
|
|
1143
|
-
const {
|
|
1152
|
+
const {
|
|
1153
|
+
title,
|
|
1154
|
+
width,
|
|
1155
|
+
height,
|
|
1156
|
+
playbackId,
|
|
1157
|
+
muxPlaybackId,
|
|
1158
|
+
blurUpThumb,
|
|
1159
|
+
thumbnailUrl
|
|
1160
|
+
} = data || {};
|
|
1144
1161
|
if (data === void 0) return {};
|
|
1145
|
-
return __spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3({}, computedTitle(title) || {}), computedPlaybackId(muxPlaybackId, playbackId) || {}), computedStyle(width, height) || {}), computedPlaceholder(blurUpThumb) || {});
|
|
1162
|
+
return __spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3({}, computedTitle(title) || {}), computedPlaybackId(muxPlaybackId, playbackId) || {}), computedStyle(width, height) || {}), computedPlaceholder(blurUpThumb) || {}), computedPoster(thumbnailUrl) || {});
|
|
1146
1163
|
};
|
|
1147
1164
|
|
|
1148
1165
|
var __defProp$2 = Object.defineProperty;
|
package/dist/index.d.ts
CHANGED
|
@@ -959,6 +959,8 @@ type Video = {
|
|
|
959
959
|
playbackId?: Possibly<string>;
|
|
960
960
|
/** A data: URI containing a blurhash for the video */
|
|
961
961
|
blurUpThumb?: Possibly<string>;
|
|
962
|
+
/** A URL for the video thumbnail, used as the poster image */
|
|
963
|
+
thumbnailUrl?: Possibly<string>;
|
|
962
964
|
/** Other data can be passed, but they have no effect on rendering the player */
|
|
963
965
|
[k: string]: any;
|
|
964
966
|
};
|
|
@@ -1213,6 +1215,7 @@ declare const VideoPlayer: vue.DefineComponent<{
|
|
|
1213
1215
|
title?: string | null;
|
|
1214
1216
|
playbackId?: string | null;
|
|
1215
1217
|
placeholder?: string | null;
|
|
1218
|
+
poster?: string | null;
|
|
1216
1219
|
};
|
|
1217
1220
|
otherProps: {
|
|
1218
1221
|
disablePictureInPicture: boolean;
|
|
@@ -1693,11 +1696,13 @@ type Style = Maybe<CSSProperties>;
|
|
|
1693
1696
|
type Title = Maybe<string>;
|
|
1694
1697
|
type PlaybackId = Maybe<string>;
|
|
1695
1698
|
type Placeholder = Maybe<string>;
|
|
1699
|
+
type Poster = Maybe<string>;
|
|
1696
1700
|
type AttrsForMuxPlayer = {
|
|
1697
1701
|
style?: Style;
|
|
1698
1702
|
title?: Title;
|
|
1699
1703
|
playbackId?: PlaybackId;
|
|
1700
1704
|
placeholder?: Placeholder;
|
|
1705
|
+
poster?: Poster;
|
|
1701
1706
|
};
|
|
1702
1707
|
type UseVideoPlayerArgs = {
|
|
1703
1708
|
data?: Video;
|
package/dist/index.esm.mjs
CHANGED
|
@@ -605,7 +605,7 @@ const Image$1 = defineComponent({
|
|
|
605
605
|
};
|
|
606
606
|
},
|
|
607
607
|
render() {
|
|
608
|
-
var _a, _b, _c, _d
|
|
608
|
+
var _a, _b, _c, _d;
|
|
609
609
|
const addImage = imageAddStrategy({
|
|
610
610
|
priority: this.priority,
|
|
611
611
|
inView: this.inView,
|
|
@@ -616,10 +616,11 @@ const Image$1 = defineComponent({
|
|
|
616
616
|
inView: this.inView,
|
|
617
617
|
loaded: this.loaded
|
|
618
618
|
});
|
|
619
|
-
const
|
|
619
|
+
const resolvedSizes = (_b = (_a = this.sizes) != null ? _a : this.data.sizes) != null ? _b : this.priority ? void 0 : "auto, 100vw";
|
|
620
|
+
const webpSource = buildWebpSource(this.data, resolvedSizes);
|
|
620
621
|
const regularSource = buildRegularSource(
|
|
621
622
|
this.data,
|
|
622
|
-
|
|
623
|
+
resolvedSizes,
|
|
623
624
|
this.srcSetCandidates
|
|
624
625
|
);
|
|
625
626
|
const transition = typeof this.fadeInDuration === "undefined" || this.fadeInDuration > 0 ? `opacity ${this.fadeInDuration || 500}ms` : void 0;
|
|
@@ -653,7 +654,7 @@ const Image$1 = defineComponent({
|
|
|
653
654
|
}, basePlaceholderStyle)
|
|
654
655
|
}) : null;
|
|
655
656
|
const { width, aspectRatio } = this.data;
|
|
656
|
-
const height = (
|
|
657
|
+
const height = (_c = this.data.height) != null ? _c : aspectRatio ? width / aspectRatio : 0;
|
|
657
658
|
const sizer = this.layout !== "fill" ? h(Sizer, {
|
|
658
659
|
sizerClass: this.imgClass,
|
|
659
660
|
sizerStyle: this.imgStyle,
|
|
@@ -679,6 +680,8 @@ const Image$1 = defineComponent({
|
|
|
679
680
|
src: this.data.src,
|
|
680
681
|
alt: this.data.alt,
|
|
681
682
|
title: this.data.title,
|
|
683
|
+
sizes: resolvedSizes,
|
|
684
|
+
loading: this.priority ? void 0 : "lazy",
|
|
682
685
|
fetchpriority: this.priority ? "high" : void 0,
|
|
683
686
|
onLoad: this.handleLoad,
|
|
684
687
|
ref: "imageRef",
|
|
@@ -700,7 +703,7 @@ const Image$1 = defineComponent({
|
|
|
700
703
|
[
|
|
701
704
|
this.data.webpSrcSet && tag("source", {
|
|
702
705
|
srcset: this.data.webpSrcSet,
|
|
703
|
-
sizes:
|
|
706
|
+
sizes: resolvedSizes,
|
|
704
707
|
type: "image/webp"
|
|
705
708
|
}),
|
|
706
709
|
tag("source", {
|
|
@@ -709,13 +712,14 @@ const Image$1 = defineComponent({
|
|
|
709
712
|
this.data.width,
|
|
710
713
|
this.srcSetCandidates
|
|
711
714
|
),
|
|
712
|
-
sizes:
|
|
715
|
+
sizes: resolvedSizes
|
|
713
716
|
}),
|
|
714
717
|
tag("img", {
|
|
715
718
|
src: this.data.src,
|
|
716
719
|
alt: this.data.alt,
|
|
717
720
|
title: this.data.title,
|
|
718
721
|
class: this.imgClass,
|
|
722
|
+
sizes: resolvedSizes,
|
|
719
723
|
style: toCss(__spreadValues$5(__spreadProps$3(__spreadValues$5({}, absolutePositioning), {
|
|
720
724
|
objectFit: this.objectFit,
|
|
721
725
|
objectPosition: this.objectPosition
|
|
@@ -852,15 +856,16 @@ const NakedImage = defineComponent({
|
|
|
852
856
|
};
|
|
853
857
|
},
|
|
854
858
|
render() {
|
|
855
|
-
var _a;
|
|
856
|
-
const
|
|
859
|
+
var _a, _b, _c;
|
|
860
|
+
const resolvedSizes = (_b = (_a = this.sizes) != null ? _a : this.data.sizes) != null ? _b : this.priority ? void 0 : "auto, 100vw";
|
|
861
|
+
const webpSource = buildWebpSource(this.data, resolvedSizes);
|
|
857
862
|
const regularSource = buildRegularSource(
|
|
858
863
|
this.data,
|
|
859
|
-
|
|
864
|
+
resolvedSizes,
|
|
860
865
|
this.srcSetCandidates
|
|
861
866
|
);
|
|
862
867
|
const { width } = this.data;
|
|
863
|
-
const height = (
|
|
868
|
+
const height = (_c = this.data.height) != null ? _c : Math.round(this.data.aspectRatio ? width / this.data.aspectRatio : 0);
|
|
864
869
|
const sizingStyle = {
|
|
865
870
|
aspectRatio: `${width} / ${height}`,
|
|
866
871
|
width: "100%",
|
|
@@ -892,6 +897,7 @@ const NakedImage = defineComponent({
|
|
|
892
897
|
alt: this.data.alt,
|
|
893
898
|
onLoad: this.handleLoad,
|
|
894
899
|
title: this.data.title,
|
|
900
|
+
sizes: resolvedSizes,
|
|
895
901
|
fetchpriority: this.priority ? "high" : void 0,
|
|
896
902
|
loading: this.priority ? void 0 : "lazy",
|
|
897
903
|
style: __spreadValues$4(__spreadValues$4(__spreadValues$4({}, placeholderStyle), sizingStyle), this.imgStyle || {}),
|
|
@@ -1138,12 +1144,23 @@ const computedStyle = (width, height) => {
|
|
|
1138
1144
|
const computedPlaceholder = (blurUpThumb) => {
|
|
1139
1145
|
return blurUpThumb ? { placeholder: blurUpThumb } : void 0;
|
|
1140
1146
|
};
|
|
1147
|
+
const computedPoster = (thumbnailUrl) => {
|
|
1148
|
+
return thumbnailUrl ? { poster: thumbnailUrl } : void 0;
|
|
1149
|
+
};
|
|
1141
1150
|
const useVideoPlayer = ({
|
|
1142
1151
|
data
|
|
1143
1152
|
}) => {
|
|
1144
|
-
const {
|
|
1153
|
+
const {
|
|
1154
|
+
title,
|
|
1155
|
+
width,
|
|
1156
|
+
height,
|
|
1157
|
+
playbackId,
|
|
1158
|
+
muxPlaybackId,
|
|
1159
|
+
blurUpThumb,
|
|
1160
|
+
thumbnailUrl
|
|
1161
|
+
} = data || {};
|
|
1145
1162
|
if (data === void 0) return {};
|
|
1146
|
-
return __spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3({}, computedTitle(title) || {}), computedPlaybackId(muxPlaybackId, playbackId) || {}), computedStyle(width, height) || {}), computedPlaceholder(blurUpThumb) || {});
|
|
1163
|
+
return __spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3({}, computedTitle(title) || {}), computedPlaybackId(muxPlaybackId, playbackId) || {}), computedStyle(width, height) || {}), computedPlaceholder(blurUpThumb) || {}), computedPoster(thumbnailUrl) || {});
|
|
1147
1164
|
};
|
|
1148
1165
|
|
|
1149
1166
|
var __defProp$2 = Object.defineProperty;
|