vue-datocms 8.1.14 → 8.1.16

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 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 the REST & GraphQL Headless CMS for the modern web.
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
- Trusted by over 25,000 enterprise businesses, agencies, and individuals across the world, DatoCMS users create online content at scale from a central hub and distribute it via API. We ❤️ our [developers](https://www.datocms.com/team/best-cms-for-developers), [content editors](https://www.datocms.com/team/content-creators) and [marketers](https://www.datocms.com/team/cms-digital-marketing)!
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
- **Why DatoCMS?**
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
- - **API-First Architecture**: Built for both REST and GraphQL, enabling flexible content delivery
94
- - **Just Enough Features**: We believe in keeping things simple, and giving you [the right feature-set tools](https://www.datocms.com/features) to get the job done
95
- - **Developer Experience**: First-class TypeScript support with powerful developer tools
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
- **Getting Started:**
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
- - ⚡️ [Create Free Account](https://dashboard.datocms.com/signup) - Get started with DatoCMS in minutes
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
@@ -8,7 +8,7 @@ var datocmsStructuredTextUtils = require('datocms-structured-text-utils');
8
8
  var datocmsListen = require('datocms-listen');
9
9
 
10
10
  function useContentLink(options = {}) {
11
- const { enabled = true, onNavigateTo, root } = options;
11
+ const { enabled = true, onNavigateTo, root, hue } = options;
12
12
  const controller = vue.ref(null);
13
13
  const onNavigateToRef = vue.ref(onNavigateTo);
14
14
  vue.watch(
@@ -36,6 +36,9 @@ function useContentLink(options = {}) {
36
36
  if (root == null ? void 0 : root.value) {
37
37
  controllerOptions.root = root.value;
38
38
  }
39
+ if (hue !== void 0) {
40
+ controllerOptions.hue = hue;
41
+ }
39
42
  controller.value = contentLink.createController(controllerOptions);
40
43
  };
41
44
  vue.onMounted(() => {
@@ -153,13 +156,23 @@ const ContentLink = vue.defineComponent({
153
156
  stripStega: {
154
157
  type: Boolean,
155
158
  required: false
159
+ },
160
+ /**
161
+ * Hue (0–359) of the overlay accent color.
162
+ *
163
+ * @default 17 (orange)
164
+ */
165
+ hue: {
166
+ type: Number,
167
+ required: false
156
168
  }
157
169
  },
158
170
  setup(props) {
159
171
  const { enableClickToEdit: enableClickToEditFn, setCurrentPath } = useContentLink({
160
172
  enabled: props.stripStega !== void 0 ? { stripStega: props.stripStega } : true,
161
173
  onNavigateTo: props.onNavigateTo,
162
- root: props.root
174
+ root: props.root,
175
+ hue: props.hue
163
176
  });
164
177
  vue.onMounted(() => {
165
178
  if (!props.enableClickToEdit) {
@@ -591,7 +604,7 @@ const Image$1 = vue.defineComponent({
591
604
  };
592
605
  },
593
606
  render() {
594
- var _a, _b, _c, _d, _e, _f;
607
+ var _a, _b, _c, _d;
595
608
  const addImage = imageAddStrategy({
596
609
  priority: this.priority,
597
610
  inView: this.inView,
@@ -602,10 +615,11 @@ const Image$1 = vue.defineComponent({
602
615
  inView: this.inView,
603
616
  loaded: this.loaded
604
617
  });
605
- const webpSource = buildWebpSource(this.data, this.sizes);
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);
606
620
  const regularSource = buildRegularSource(
607
621
  this.data,
608
- this.sizes,
622
+ resolvedSizes,
609
623
  this.srcSetCandidates
610
624
  );
611
625
  const transition = typeof this.fadeInDuration === "undefined" || this.fadeInDuration > 0 ? `opacity ${this.fadeInDuration || 500}ms` : void 0;
@@ -639,7 +653,7 @@ const Image$1 = vue.defineComponent({
639
653
  }, basePlaceholderStyle)
640
654
  }) : null;
641
655
  const { width, aspectRatio } = this.data;
642
- const height = (_a = this.data.height) != null ? _a : aspectRatio ? width / aspectRatio : 0;
656
+ const height = (_c = this.data.height) != null ? _c : aspectRatio ? width / aspectRatio : 0;
643
657
  const sizer = this.layout !== "fill" ? vue.h(Sizer, {
644
658
  sizerClass: this.imgClass,
645
659
  sizerStyle: this.imgStyle,
@@ -665,6 +679,8 @@ const Image$1 = vue.defineComponent({
665
679
  src: this.data.src,
666
680
  alt: this.data.alt,
667
681
  title: this.data.title,
682
+ sizes: resolvedSizes,
683
+ loading: this.priority ? void 0 : "lazy",
668
684
  fetchpriority: this.priority ? "high" : void 0,
669
685
  onLoad: this.handleLoad,
670
686
  ref: "imageRef",
@@ -686,7 +702,7 @@ const Image$1 = vue.defineComponent({
686
702
  [
687
703
  this.data.webpSrcSet && tag("source", {
688
704
  srcset: this.data.webpSrcSet,
689
- sizes: (_c = (_b = this.sizes) != null ? _b : this.data.sizes) != null ? _c : void 0,
705
+ sizes: resolvedSizes,
690
706
  type: "image/webp"
691
707
  }),
692
708
  tag("source", {
@@ -695,13 +711,14 @@ const Image$1 = vue.defineComponent({
695
711
  this.data.width,
696
712
  this.srcSetCandidates
697
713
  ),
698
- sizes: (_f = (_e = this.sizes) != null ? _e : this.data.sizes) != null ? _f : void 0
714
+ sizes: resolvedSizes
699
715
  }),
700
716
  tag("img", {
701
717
  src: this.data.src,
702
718
  alt: this.data.alt,
703
719
  title: this.data.title,
704
720
  class: this.imgClass,
721
+ sizes: resolvedSizes,
705
722
  style: toCss(__spreadValues$5(__spreadProps$3(__spreadValues$5({}, absolutePositioning), {
706
723
  objectFit: this.objectFit,
707
724
  objectPosition: this.objectPosition
@@ -838,15 +855,16 @@ const NakedImage = vue.defineComponent({
838
855
  };
839
856
  },
840
857
  render() {
841
- var _a;
842
- const webpSource = buildWebpSource(this.data, this.sizes);
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);
843
861
  const regularSource = buildRegularSource(
844
862
  this.data,
845
- this.sizes,
863
+ resolvedSizes,
846
864
  this.srcSetCandidates
847
865
  );
848
866
  const { width } = this.data;
849
- const height = (_a = this.data.height) != null ? _a : Math.round(this.data.aspectRatio ? width / this.data.aspectRatio : 0);
867
+ const height = (_c = this.data.height) != null ? _c : Math.round(this.data.aspectRatio ? width / this.data.aspectRatio : 0);
850
868
  const sizingStyle = {
851
869
  aspectRatio: `${width} / ${height}`,
852
870
  width: "100%",
@@ -878,6 +896,7 @@ const NakedImage = vue.defineComponent({
878
896
  alt: this.data.alt,
879
897
  onLoad: this.handleLoad,
880
898
  title: this.data.title,
899
+ sizes: resolvedSizes,
881
900
  fetchpriority: this.priority ? "high" : void 0,
882
901
  loading: this.priority ? void 0 : "lazy",
883
902
  style: __spreadValues$4(__spreadValues$4(__spreadValues$4({}, placeholderStyle), sizingStyle), this.imgStyle || {}),
package/dist/index.d.ts CHANGED
@@ -56,6 +56,12 @@ type UseContentLinkOptions = {
56
56
  onNavigateTo?: (path: string) => void;
57
57
  /** Root element to limit scanning to (instead of document) */
58
58
  root?: Ref<ParentNode | null | undefined>;
59
+ /**
60
+ * Hue (0–359) of the overlay accent color.
61
+ *
62
+ * @default 17 (orange)
63
+ */
64
+ hue?: number;
59
65
  };
60
66
  type UseContentLinkResult = {
61
67
  /** The controller instance, or null if disabled */
@@ -112,7 +118,7 @@ type UseContentLinkResult = {
112
118
  */
113
119
  declare function useContentLink(options?: UseContentLinkOptions): UseContentLinkResult;
114
120
 
115
- type ContentLinkProps = Omit<UseContentLinkOptions, 'enabled'> & {
121
+ type ContentLinkProps = Omit<UseContentLinkOptions, 'enabled' | 'hue'> & {
116
122
  /** Current pathname to sync with Web Previews plugin */
117
123
  currentPath?: string;
118
124
  /**
@@ -133,6 +139,12 @@ type ContentLinkProps = Omit<UseContentLinkOptions, 'enabled'> & {
133
139
  enableClickToEdit?: boolean | ClickToEditOptions;
134
140
  /** Whether to strip stega encoding from text nodes after stamping. */
135
141
  stripStega?: boolean;
142
+ /**
143
+ * Hue (0–359) of the overlay accent color.
144
+ *
145
+ * @default 17 (orange)
146
+ */
147
+ hue?: number;
136
148
  };
137
149
  /**
138
150
  * ContentLink component enables Visual Editing for DatoCMS content.
@@ -283,6 +295,15 @@ declare const ContentLink: vue.DefineComponent<{
283
295
  type: BooleanConstructor;
284
296
  required: false;
285
297
  };
298
+ /**
299
+ * Hue (0–359) of the overlay accent color.
300
+ *
301
+ * @default 17 (orange)
302
+ */
303
+ hue: {
304
+ type: NumberConstructor;
305
+ required: false;
306
+ };
286
307
  }, () => null, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
287
308
  /**
288
309
  * Callback when Web Previews plugin requests navigation.
@@ -342,6 +363,15 @@ declare const ContentLink: vue.DefineComponent<{
342
363
  type: BooleanConstructor;
343
364
  required: false;
344
365
  };
366
+ /**
367
+ * Hue (0–359) of the overlay accent color.
368
+ *
369
+ * @default 17 (orange)
370
+ */
371
+ hue: {
372
+ type: NumberConstructor;
373
+ required: false;
374
+ };
345
375
  }>>, {
346
376
  stripStega: boolean;
347
377
  }, {}>;
@@ -9,7 +9,7 @@ export { RenderError } from 'datocms-structured-text-utils';
9
9
  import { subscribeToQuery } from 'datocms-listen';
10
10
 
11
11
  function useContentLink(options = {}) {
12
- const { enabled = true, onNavigateTo, root } = options;
12
+ const { enabled = true, onNavigateTo, root, hue } = options;
13
13
  const controller = ref(null);
14
14
  const onNavigateToRef = ref(onNavigateTo);
15
15
  watch(
@@ -37,6 +37,9 @@ function useContentLink(options = {}) {
37
37
  if (root == null ? void 0 : root.value) {
38
38
  controllerOptions.root = root.value;
39
39
  }
40
+ if (hue !== void 0) {
41
+ controllerOptions.hue = hue;
42
+ }
40
43
  controller.value = createController(controllerOptions);
41
44
  };
42
45
  onMounted(() => {
@@ -154,13 +157,23 @@ const ContentLink = defineComponent({
154
157
  stripStega: {
155
158
  type: Boolean,
156
159
  required: false
160
+ },
161
+ /**
162
+ * Hue (0–359) of the overlay accent color.
163
+ *
164
+ * @default 17 (orange)
165
+ */
166
+ hue: {
167
+ type: Number,
168
+ required: false
157
169
  }
158
170
  },
159
171
  setup(props) {
160
172
  const { enableClickToEdit: enableClickToEditFn, setCurrentPath } = useContentLink({
161
173
  enabled: props.stripStega !== void 0 ? { stripStega: props.stripStega } : true,
162
174
  onNavigateTo: props.onNavigateTo,
163
- root: props.root
175
+ root: props.root,
176
+ hue: props.hue
164
177
  });
165
178
  onMounted(() => {
166
179
  if (!props.enableClickToEdit) {
@@ -592,7 +605,7 @@ const Image$1 = defineComponent({
592
605
  };
593
606
  },
594
607
  render() {
595
- var _a, _b, _c, _d, _e, _f;
608
+ var _a, _b, _c, _d;
596
609
  const addImage = imageAddStrategy({
597
610
  priority: this.priority,
598
611
  inView: this.inView,
@@ -603,10 +616,11 @@ const Image$1 = defineComponent({
603
616
  inView: this.inView,
604
617
  loaded: this.loaded
605
618
  });
606
- const webpSource = buildWebpSource(this.data, this.sizes);
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);
607
621
  const regularSource = buildRegularSource(
608
622
  this.data,
609
- this.sizes,
623
+ resolvedSizes,
610
624
  this.srcSetCandidates
611
625
  );
612
626
  const transition = typeof this.fadeInDuration === "undefined" || this.fadeInDuration > 0 ? `opacity ${this.fadeInDuration || 500}ms` : void 0;
@@ -640,7 +654,7 @@ const Image$1 = defineComponent({
640
654
  }, basePlaceholderStyle)
641
655
  }) : null;
642
656
  const { width, aspectRatio } = this.data;
643
- const height = (_a = this.data.height) != null ? _a : aspectRatio ? width / aspectRatio : 0;
657
+ const height = (_c = this.data.height) != null ? _c : aspectRatio ? width / aspectRatio : 0;
644
658
  const sizer = this.layout !== "fill" ? h(Sizer, {
645
659
  sizerClass: this.imgClass,
646
660
  sizerStyle: this.imgStyle,
@@ -666,6 +680,8 @@ const Image$1 = defineComponent({
666
680
  src: this.data.src,
667
681
  alt: this.data.alt,
668
682
  title: this.data.title,
683
+ sizes: resolvedSizes,
684
+ loading: this.priority ? void 0 : "lazy",
669
685
  fetchpriority: this.priority ? "high" : void 0,
670
686
  onLoad: this.handleLoad,
671
687
  ref: "imageRef",
@@ -687,7 +703,7 @@ const Image$1 = defineComponent({
687
703
  [
688
704
  this.data.webpSrcSet && tag("source", {
689
705
  srcset: this.data.webpSrcSet,
690
- sizes: (_c = (_b = this.sizes) != null ? _b : this.data.sizes) != null ? _c : void 0,
706
+ sizes: resolvedSizes,
691
707
  type: "image/webp"
692
708
  }),
693
709
  tag("source", {
@@ -696,13 +712,14 @@ const Image$1 = defineComponent({
696
712
  this.data.width,
697
713
  this.srcSetCandidates
698
714
  ),
699
- sizes: (_f = (_e = this.sizes) != null ? _e : this.data.sizes) != null ? _f : void 0
715
+ sizes: resolvedSizes
700
716
  }),
701
717
  tag("img", {
702
718
  src: this.data.src,
703
719
  alt: this.data.alt,
704
720
  title: this.data.title,
705
721
  class: this.imgClass,
722
+ sizes: resolvedSizes,
706
723
  style: toCss(__spreadValues$5(__spreadProps$3(__spreadValues$5({}, absolutePositioning), {
707
724
  objectFit: this.objectFit,
708
725
  objectPosition: this.objectPosition
@@ -839,15 +856,16 @@ const NakedImage = defineComponent({
839
856
  };
840
857
  },
841
858
  render() {
842
- var _a;
843
- const webpSource = buildWebpSource(this.data, this.sizes);
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);
844
862
  const regularSource = buildRegularSource(
845
863
  this.data,
846
- this.sizes,
864
+ resolvedSizes,
847
865
  this.srcSetCandidates
848
866
  );
849
867
  const { width } = this.data;
850
- const height = (_a = this.data.height) != null ? _a : Math.round(this.data.aspectRatio ? width / this.data.aspectRatio : 0);
868
+ const height = (_c = this.data.height) != null ? _c : Math.round(this.data.aspectRatio ? width / this.data.aspectRatio : 0);
851
869
  const sizingStyle = {
852
870
  aspectRatio: `${width} / ${height}`,
853
871
  width: "100%",
@@ -879,6 +897,7 @@ const NakedImage = defineComponent({
879
897
  alt: this.data.alt,
880
898
  onLoad: this.handleLoad,
881
899
  title: this.data.title,
900
+ sizes: resolvedSizes,
882
901
  fetchpriority: this.priority ? "high" : void 0,
883
902
  loading: this.priority ? void 0 : "lazy",
884
903
  style: __spreadValues$4(__spreadValues$4(__spreadValues$4({}, placeholderStyle), sizingStyle), this.imgStyle || {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-datocms",
3
- "version": "8.1.14",
3
+ "version": "8.1.16",
4
4
  "type": "module",
5
5
  "description": "A set of components and utilities to work faster with DatoCMS in Vue.js environments",
6
6
  "keywords": [
@@ -42,7 +42,7 @@
42
42
  "toc": "doctoc --github src/components src/lib"
43
43
  },
44
44
  "dependencies": {
45
- "@datocms/content-link": "^0.3.13",
45
+ "@datocms/content-link": "^0.3.19",
46
46
  "datocms-listen": "^1.0.2",
47
47
  "hls.js": "^1.5.17",
48
48
  "datocms-structured-text-generic-html-renderer": "^5.0.0",