vue-datocms 8.0.0-0 → 8.1.0

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
@@ -1,7 +1,11 @@
1
1
  <!--datocms-autoinclude-header start-->
2
+
2
3
  <a href="https://www.datocms.com/"><img src="https://www.datocms.com/images/full_logo.svg" height="60"></a>
3
4
 
4
5
  👉 [Visit the DatoCMS homepage](https://www.datocms.com) or see [What is DatoCMS?](#what-is-datocms)
6
+
7
+ ---
8
+
5
9
  <!--datocms-autoinclude-header end-->
6
10
 
7
11
  # vue-datocms
@@ -71,27 +75,49 @@ npm run dev
71
75
  ```
72
76
 
73
77
  <!--datocms-autoinclude-footer start-->
74
- -----------------
78
+
79
+ ---
80
+
75
81
  # What is DatoCMS?
76
- <a href="https://www.datocms.com/"><img src="https://www.datocms.com/images/full_logo.svg" height="60"></a>
82
+
83
+ <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>
77
84
 
78
85
  [DatoCMS](https://www.datocms.com/) is the REST & GraphQL Headless CMS for the modern web.
79
86
 
80
- Trusted by over 25,000 enterprise businesses, agency partners, 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)!
87
+ 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)!
88
+
89
+ **Why DatoCMS?**
90
+
91
+ - **API-First Architecture**: Built for both REST and GraphQL, enabling flexible content delivery
92
+ - **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
93
+ - **Developer Experience**: First-class TypeScript support with powerful developer tools
94
+
95
+ **Getting Started:**
96
+
97
+ - ⚡️ [Create Free Account](https://dashboard.datocms.com/signup) - Get started with DatoCMS in minutes
98
+ - 🔖 [Documentation](https://www.datocms.com/docs) - Comprehensive guides and API references
99
+ - ⚙️ [Community Support](https://community.datocms.com/) - Get help from our team and community
100
+ - 🆕 [Changelog](https://www.datocms.com/product-updates) - Latest features and improvements
101
+
102
+ **Official Libraries:**
103
+
104
+ - [**Content Delivery Client**](https://github.com/datocms/cda-client) - TypeScript GraphQL client for content fetching
105
+ - [**REST API Clients**](https://github.com/datocms/js-rest-api-clients) - Node.js/Browser clients for content management
106
+ - [**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)
107
+
108
+ **Official Framework Integrations**
109
+
110
+ Helpers to manage SEO, images, video and Structured Text coming from your DatoCMS projects:
81
111
 
82
- **Quick links:**
112
+ - [**React Components**](https://github.com/datocms/react-datocms)
113
+ - [**Vue Components**](https://github.com/datocms/vue-datocms)
114
+ - [**Svelte Components**](https://github.com/datocms/datocms-svelte)
115
+ - [**Astro Components**](https://github.com/datocms/astro-datocms)
83
116
 
84
- - ⚡️ Get started with a [free DatoCMS account](https://dashboard.datocms.com/signup)
85
- - 🔖 Go through the [docs](https://www.datocms.com/docs)
86
- - ⚙️ Get [support from us and the community](https://community.datocms.com/)
87
- - 🆕 Stay up to date on new features and fixes on the [changelog](https://www.datocms.com/product-updates)
117
+ **Additional Resources:**
88
118
 
89
- **Our featured repos:**
90
- - [datocms/react-datocms](https://github.com/datocms/react-datocms): React helper components for images, Structured Text rendering, and more
91
- - [datocms/js-rest-api-clients](https://github.com/datocms/js-rest-api-clients): Node and browser JavaScript clients for updating and administering your content. For frontend fetches, we recommend using our [GraphQL Content Delivery API](https://www.datocms.com/docs/content-delivery-api) instead.
92
- - [datocms/cli](https://github.com/datocms/cli): Command-line interface that includes our [Contentful importer](https://github.com/datocms/cli/tree/main/packages/cli-plugin-contentful) and [Wordpress importer](https://github.com/datocms/cli/tree/main/packages/cli-plugin-wordpress)
93
- - [datocms/plugins](https://github.com/datocms/plugins): Example plugins we've made that extend the editor/admin dashboard
94
- - [DatoCMS Starters](https://www.datocms.com/marketplace/starters) has examples for various Javascript frontend frameworks
119
+ - [**Plugin Examples**](https://github.com/datocms/plugins) - Example plugins we've made that extend the editor/admin dashboard
120
+ - [**Starter Projects**](https://www.datocms.com/marketplace/starters) - Example website implementations for popular frameworks
121
+ - [**All Public Repositories**](https://github.com/orgs/datocms/repositories?q=&type=public&language=&sort=stargazers)
95
122
 
96
- Or see [all our public repos](https://github.com/orgs/datocms/repositories?q=&type=public&language=&sort=stargazers)
97
123
  <!--datocms-autoinclude-footer end-->
package/dist/index.cjs.js CHANGED
@@ -186,17 +186,17 @@ function buildRegularSource(data, sizes, srcSetCandidates) {
186
186
  }
187
187
 
188
188
  var __defProp$6 = Object.defineProperty;
189
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
190
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
191
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
189
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
190
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
191
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
192
192
  var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
193
193
  var __spreadValues$6 = (a, b) => {
194
194
  for (var prop in b || (b = {}))
195
- if (__hasOwnProp$7.call(b, prop))
195
+ if (__hasOwnProp$6.call(b, prop))
196
196
  __defNormalProp$6(a, prop, b[prop]);
197
- if (__getOwnPropSymbols$7)
198
- for (var prop of __getOwnPropSymbols$7(b)) {
199
- if (__propIsEnum$7.call(b, prop))
197
+ if (__getOwnPropSymbols$6)
198
+ for (var prop of __getOwnPropSymbols$6(b)) {
199
+ if (__propIsEnum$6.call(b, prop))
200
200
  __defNormalProp$6(a, prop, b[prop]);
201
201
  }
202
202
  return a;
@@ -234,17 +234,17 @@ const Sizer = vue.defineComponent({
234
234
  var __defProp$5 = Object.defineProperty;
235
235
  var __defProps$3 = Object.defineProperties;
236
236
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
237
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
238
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
239
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
237
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
238
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
239
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
240
240
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
241
241
  var __spreadValues$5 = (a, b) => {
242
242
  for (var prop in b || (b = {}))
243
- if (__hasOwnProp$6.call(b, prop))
243
+ if (__hasOwnProp$5.call(b, prop))
244
244
  __defNormalProp$5(a, prop, b[prop]);
245
- if (__getOwnPropSymbols$6)
246
- for (var prop of __getOwnPropSymbols$6(b)) {
247
- if (__propIsEnum$6.call(b, prop))
245
+ if (__getOwnPropSymbols$5)
246
+ for (var prop of __getOwnPropSymbols$5(b)) {
247
+ if (__propIsEnum$5.call(b, prop))
248
248
  __defNormalProp$5(a, prop, b[prop]);
249
249
  }
250
250
  return a;
@@ -507,17 +507,17 @@ const DatocmsImagePlugin = {
507
507
  };
508
508
 
509
509
  var __defProp$4 = Object.defineProperty;
510
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
511
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
512
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
510
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
511
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
512
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
513
513
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
514
514
  var __spreadValues$4 = (a, b) => {
515
515
  for (var prop in b || (b = {}))
516
- if (__hasOwnProp$5.call(b, prop))
516
+ if (__hasOwnProp$4.call(b, prop))
517
517
  __defNormalProp$4(a, prop, b[prop]);
518
- if (__getOwnPropSymbols$5)
519
- for (var prop of __getOwnPropSymbols$5(b)) {
520
- if (__propIsEnum$5.call(b, prop))
518
+ if (__getOwnPropSymbols$4)
519
+ for (var prop of __getOwnPropSymbols$4(b)) {
520
+ if (__propIsEnum$4.call(b, prop))
521
521
  __defNormalProp$4(a, prop, b[prop]);
522
522
  }
523
523
  return a;
@@ -643,34 +643,11 @@ const DatocmsNakedImagePlugin = {
643
643
  }
644
644
  };
645
645
 
646
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
647
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
648
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
649
- var __objRest$2 = (source, exclude) => {
650
- var target = {};
651
- for (var prop in source)
652
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
653
- target[prop] = source[prop];
654
- if (source != null && __getOwnPropSymbols$4)
655
- for (var prop of __getOwnPropSymbols$4(source)) {
656
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
657
- target[prop] = source[prop];
658
- }
659
- return target;
660
- };
661
- const hAdapter = (tagName, props, childOrChildren) => {
662
- const _a = props || {}; __objRest$2(_a, ["href", "target", "rel"]);
663
- return vue.h(
664
- tagName,
665
- props,
666
- typeof childOrChildren === "undefined" || Array.isArray(childOrChildren) ? childOrChildren : [childOrChildren]
667
- );
668
- };
669
646
  const defaultAdapter = {
670
- renderNode: hAdapter,
671
- renderMark: hAdapter,
672
- renderFragment: (children, key) => children,
673
- renderText: (text, key) => text
647
+ renderNode: vue.h,
648
+ renderMark: vue.h,
649
+ renderFragment: (children, _key) => children,
650
+ renderText: (text, _key) => text
674
651
  };
675
652
  function appendKeyToValidElement(element, key) {
676
653
  if (element !== null && typeof element !== "string" && element.key === null) {
@@ -678,8 +655,39 @@ function appendKeyToValidElement(element, key) {
678
655
  }
679
656
  return element;
680
657
  }
681
- const StructuredText = vue.defineComponent(
682
- (props) => {
658
+ const StructuredText = vue.defineComponent({
659
+ name: "DatocmsStructuredText",
660
+ props: {
661
+ data: {
662
+ type: Object
663
+ },
664
+ customRules: {
665
+ type: Array
666
+ },
667
+ customNodeRules: {
668
+ type: Array
669
+ },
670
+ customMarkRules: {
671
+ type: Array
672
+ },
673
+ renderInlineRecord: {
674
+ type: Function
675
+ },
676
+ renderLinkToRecord: {
677
+ type: Function
678
+ },
679
+ renderBlock: {
680
+ type: Function
681
+ },
682
+ renderInlineBlock: {
683
+ type: Function
684
+ },
685
+ metaTransformer: { type: Function },
686
+ renderText: { type: Function },
687
+ renderNode: { type: Function },
688
+ renderFragment: { type: Function }
689
+ },
690
+ setup(props) {
683
691
  return () => {
684
692
  return datocmsStructuredTextGenericHtmlRenderer.render(props.data, {
685
693
  adapter: {
@@ -780,15 +788,39 @@ const StructuredText = vue.defineComponent(
780
788
  key
781
789
  );
782
790
  }),
791
+ datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isInlineBlock, ({ node, key }) => {
792
+ if (!props.renderInlineBlock) {
793
+ throw new datocmsStructuredTextUtils.RenderError(
794
+ `The Structured Text document contains an 'inlineBlock' node, but no 'renderInlineBlock' prop is specified!`,
795
+ node
796
+ );
797
+ }
798
+ if (!datocmsStructuredTextUtils.isStructuredText(props.data) || !props.data.blocks) {
799
+ throw new datocmsStructuredTextUtils.RenderError(
800
+ `The Structured Text document contains an 'inlineBlock' node, but .blocks is not present!`,
801
+ node
802
+ );
803
+ }
804
+ const item = props.data.blocks.find(
805
+ (item2) => item2.id === node.item
806
+ );
807
+ if (!item) {
808
+ throw new datocmsStructuredTextUtils.RenderError(
809
+ `The Structured Text document contains a 'block' node, but cannot find a record with ID ${node.item} inside .blocks!`,
810
+ node
811
+ );
812
+ }
813
+ return appendKeyToValidElement(
814
+ props.renderInlineBlock({ record: item }),
815
+ key
816
+ );
817
+ }),
783
818
  ...props.customNodeRules || props.customRules || []
784
819
  ]
785
820
  });
786
821
  };
787
- },
788
- {
789
- name: "DatocmsStructuredText"
790
822
  }
791
- );
823
+ });
792
824
  const DatocmsStructuredTextPlugin = {
793
825
  install: (Vue) => {
794
826
  Vue.component("DatocmsStructuredText", StructuredText);
@@ -989,6 +1021,11 @@ const VideoPlayer = vue.defineComponent({
989
1021
  required: false,
990
1022
  default: () => true
991
1023
  },
1024
+ disableTracking: {
1025
+ type: Boolean,
1026
+ required: false,
1027
+ default: () => true
1028
+ },
992
1029
  disablePictureInPicture: {
993
1030
  type: Boolean,
994
1031
  required: false
@@ -1186,16 +1223,19 @@ const VideoPlayer = vue.defineComponent({
1186
1223
  var _b = _a, {
1187
1224
  data = {},
1188
1225
  disableCookies = true,
1226
+ disableTracking = true,
1189
1227
  preload = "metadata"
1190
1228
  } = _b, otherProps = __objRest$1(_b, [
1191
1229
  "data",
1192
1230
  "disableCookies",
1231
+ "disableTracking",
1193
1232
  "preload"
1194
1233
  ]);
1195
1234
  Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@mux/mux-player')); });
1196
1235
  const muxPlayerRef = vue.ref();
1197
1236
  const computedProps = __spreadProps$2(__spreadValues$2({}, useVideoPlayer({ data })), {
1198
1237
  disableCookies,
1238
+ disableTracking,
1199
1239
  preload
1200
1240
  });
1201
1241
  return {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { PropType, VNodeProps, VNode, Ref, UnwrapRef, CSSProperties } from 'vue';
2
+ import { PropType, h, VNode, Ref, UnwrapRef, CSSProperties } from 'vue';
3
3
  import { TransformedMeta, RenderMarkRule, TransformMetaFn } from 'datocms-structured-text-generic-html-renderer';
4
4
  export { renderMarkRule, renderNodeRule, renderNodeRule as renderRule } from 'datocms-structured-text-generic-html-renderer';
5
5
  import { Record as Record$1, RenderResult, StructuredText as StructuredText$1, Document, Node, RenderRule } from 'datocms-structured-text-utils';
@@ -406,10 +406,10 @@ declare const DatocmsNakedImagePlugin: {
406
406
 
407
407
  type AdapterReturn = VNode | string | null;
408
408
  declare const defaultAdapter: {
409
- renderNode: (tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn;
410
- renderMark: (tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn;
411
- renderFragment: (children: AdapterReturn[], key: string) => AdapterReturn;
412
- renderText: (text: string, key: string) => AdapterReturn;
409
+ renderNode: typeof h;
410
+ renderMark: typeof h;
411
+ renderFragment: (children: AdapterReturn[], _key: string) => AdapterReturn;
412
+ renderText: (text: string, _key: string) => AdapterReturn;
413
413
  };
414
414
  type H = typeof defaultAdapter.renderNode;
415
415
  type T = typeof defaultAdapter.renderText;
@@ -426,31 +426,105 @@ type RenderRecordLinkContext<R extends Record$1 = Record$1> = {
426
426
  type RenderBlockContext<R extends Record$1 = Record$1> = {
427
427
  record: R;
428
428
  };
429
- type StructuredTextPropTypes<R1 extends Record$1, R2 extends Record$1 = R1> = {
429
+ declare const StructuredText: vue.DefineComponent<{
430
430
  /** The actual field value you get from DatoCMS **/
431
- data: StructuredText$1<R1, R2> | Document | Node | null | undefined;
432
- /** A set of additional rules to convert nodes to JSX **/
433
- customNodeRules?: RenderRule<H, T, F>[];
434
- /** A set of additional rules to convert marks to JSX **/
435
- customMarkRules?: RenderMarkRule<H, T, F>[];
436
- /** Fuction that converts an 'inlineItem' node into React **/
437
- renderInlineRecord?: (context: RenderInlineRecordContext<R2>) => AdapterReturn;
438
- /** Fuction that converts an 'itemLink' node into React **/
439
- renderLinkToRecord?: (context: RenderRecordLinkContext<R2>) => AdapterReturn;
440
- /** Fuction that converts a 'block' node into React **/
441
- renderBlock?: (context: RenderBlockContext<R1>) => AdapterReturn;
431
+ data: {
432
+ type: PropType<StructuredText$1<Record$1, Record$1> | Document | Node | null | undefined>;
433
+ };
434
+ /** @deprecated use customNodeRules **/
435
+ customRules: {
436
+ type: PropType<RenderRule<typeof h, (text: string, _key: string) => AdapterReturn, (children: AdapterReturn[], _key: string) => AdapterReturn>[]>;
437
+ };
438
+ /** A set of additional rules to convert the document to JSX **/
439
+ customNodeRules: {
440
+ type: PropType<RenderRule<typeof h, (text: string, _key: string) => AdapterReturn, (children: AdapterReturn[], _key: string) => AdapterReturn>[]>;
441
+ };
442
+ /** A set of additional rules to convert the document to JSX **/
443
+ customMarkRules: {
444
+ type: PropType<RenderMarkRule<typeof h, (text: string, _key: string) => AdapterReturn, (children: AdapterReturn[], _key: string) => AdapterReturn>[]>;
445
+ };
446
+ /** Fuction that converts an 'inlineItem' node into a Vue component **/
447
+ renderInlineRecord: {
448
+ type: PropType<(context: RenderInlineRecordContext<any>) => AdapterReturn>;
449
+ };
450
+ /** Fuction that converts an 'itemLink' node into a Vue component **/
451
+ renderLinkToRecord: {
452
+ type: PropType<(context: RenderRecordLinkContext<any>) => AdapterReturn>;
453
+ };
454
+ /** Fuction that converts a 'block' node into a Vue component **/
455
+ renderBlock: {
456
+ type: PropType<(context: RenderBlockContext<any>) => AdapterReturn>;
457
+ };
458
+ /** Fuction that converts an 'inlineBlock' node into a Vue component **/
459
+ renderInlineBlock: {
460
+ type: PropType<(context: RenderBlockContext<any>) => AdapterReturn>;
461
+ };
442
462
  /** Function that converts 'link' and 'itemLink' `meta` into HTML props */
443
- metaTransformer?: TransformMetaFn;
444
- /** Fuction that converts a simple string text into React **/
445
- renderText?: T;
446
- /** React.createElement-like function to use to convert a node into React **/
447
- renderNode?: H;
448
- /** Function to use to generate a React.Fragment **/
449
- renderFragment?: F;
463
+ metaTransformer: {
464
+ type: PropType<TransformMetaFn>;
465
+ };
466
+ /** Fuction that converts a simple string text into a Vue component **/
467
+ renderText: {
468
+ type: PropType<(text: string, _key: string) => AdapterReturn>;
469
+ };
470
+ /** React.createElement-like function to use to convert a node into a Vue component **/
471
+ renderNode: {
472
+ type: PropType<typeof h>;
473
+ };
474
+ /** Function to use to generate a Vue.Fragment **/
475
+ renderFragment: {
476
+ type: PropType<(children: AdapterReturn[], _key: string) => AdapterReturn>;
477
+ };
478
+ }, () => RenderResult<typeof h, (text: string, _key: string) => AdapterReturn, (children: AdapterReturn[], _key: string) => AdapterReturn>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
479
+ /** The actual field value you get from DatoCMS **/
480
+ data: {
481
+ type: PropType<StructuredText$1<Record$1, Record$1> | Document | Node | null | undefined>;
482
+ };
450
483
  /** @deprecated use customNodeRules **/
451
- customRules?: RenderRule<H, T, F>[];
452
- };
453
- declare const StructuredText: <R1 extends Record$1, R2 extends Record$1 = R1>(props: StructuredTextPropTypes<R1, R2> & {}) => any;
484
+ customRules: {
485
+ type: PropType<RenderRule<typeof h, (text: string, _key: string) => AdapterReturn, (children: AdapterReturn[], _key: string) => AdapterReturn>[]>;
486
+ };
487
+ /** A set of additional rules to convert the document to JSX **/
488
+ customNodeRules: {
489
+ type: PropType<RenderRule<typeof h, (text: string, _key: string) => AdapterReturn, (children: AdapterReturn[], _key: string) => AdapterReturn>[]>;
490
+ };
491
+ /** A set of additional rules to convert the document to JSX **/
492
+ customMarkRules: {
493
+ type: PropType<RenderMarkRule<typeof h, (text: string, _key: string) => AdapterReturn, (children: AdapterReturn[], _key: string) => AdapterReturn>[]>;
494
+ };
495
+ /** Fuction that converts an 'inlineItem' node into a Vue component **/
496
+ renderInlineRecord: {
497
+ type: PropType<(context: RenderInlineRecordContext<any>) => AdapterReturn>;
498
+ };
499
+ /** Fuction that converts an 'itemLink' node into a Vue component **/
500
+ renderLinkToRecord: {
501
+ type: PropType<(context: RenderRecordLinkContext<any>) => AdapterReturn>;
502
+ };
503
+ /** Fuction that converts a 'block' node into a Vue component **/
504
+ renderBlock: {
505
+ type: PropType<(context: RenderBlockContext<any>) => AdapterReturn>;
506
+ };
507
+ /** Fuction that converts an 'inlineBlock' node into a Vue component **/
508
+ renderInlineBlock: {
509
+ type: PropType<(context: RenderBlockContext<any>) => AdapterReturn>;
510
+ };
511
+ /** Function that converts 'link' and 'itemLink' `meta` into HTML props */
512
+ metaTransformer: {
513
+ type: PropType<TransformMetaFn>;
514
+ };
515
+ /** Fuction that converts a simple string text into a Vue component **/
516
+ renderText: {
517
+ type: PropType<(text: string, _key: string) => AdapterReturn>;
518
+ };
519
+ /** React.createElement-like function to use to convert a node into a Vue component **/
520
+ renderNode: {
521
+ type: PropType<typeof h>;
522
+ };
523
+ /** Function to use to generate a Vue.Fragment **/
524
+ renderFragment: {
525
+ type: PropType<(children: AdapterReturn[], _key: string) => AdapterReturn>;
526
+ };
527
+ }>>, {}, {}>;
454
528
  declare const DatocmsStructuredTextPlugin: {
455
529
  install: (Vue: any) => void;
456
530
  };
@@ -545,6 +619,11 @@ declare const VideoPlayer: vue.DefineComponent<{
545
619
  required: false;
546
620
  default: () => boolean;
547
621
  };
622
+ disableTracking: {
623
+ type: BooleanConstructor;
624
+ required: false;
625
+ default: () => boolean;
626
+ };
548
627
  disablePictureInPicture: {
549
628
  type: BooleanConstructor;
550
629
  required: false;
@@ -714,6 +793,7 @@ declare const VideoPlayer: vue.DefineComponent<{
714
793
  muxPlayerRef: vue.Ref<MuxPlayerElement | undefined>;
715
794
  computedProps: {
716
795
  disableCookies: boolean;
796
+ disableTracking: boolean;
717
797
  preload: string;
718
798
  style?: (vue.CSSProperties | null) | undefined;
719
799
  title?: (string | null) | undefined;
@@ -867,6 +947,11 @@ declare const VideoPlayer: vue.DefineComponent<{
867
947
  required: false;
868
948
  default: () => boolean;
869
949
  };
950
+ disableTracking: {
951
+ type: BooleanConstructor;
952
+ required: false;
953
+ default: () => boolean;
954
+ };
870
955
  disablePictureInPicture: {
871
956
  type: BooleanConstructor;
872
957
  required: false;
@@ -1070,6 +1155,7 @@ declare const VideoPlayer: vue.DefineComponent<{
1070
1155
  defaultHiddenCaptions: boolean;
1071
1156
  defaultShowRemainingTime: boolean;
1072
1157
  disableCookies: boolean;
1158
+ disableTracking: boolean;
1073
1159
  noVolumePref: boolean;
1074
1160
  }, {}>;
1075
1161
  declare const DatocmsVideoPlayerPlugin: {
@@ -1222,4 +1308,4 @@ declare const toHead: (...args: ToMetaTagsType[]) => {
1222
1308
  }[];
1223
1309
  };
1224
1310
 
1225
- export { DatocmsImagePlugin, DatocmsNakedImagePlugin, DatocmsStructuredTextPlugin, DatocmsVideoPlayerPlugin, DisabledQueryListenerOptions, EnabledQueryListenerOptions, GenericClient, Image, NakedImage, QueryListenerOptions, RawSearchResult, RenderBlockContext, RenderInlineRecordContext, RenderRecordLinkContext, ResponsiveImageType, SeoMetaTagType, StructuredText, StructuredTextPropTypes, SubscribeToQueryOptions, ToMetaTagsType, UseSiteSearchConfig, UseSiteSearchData, UseSiteSearchResult, Video, VideoPlayer, appendKeyToValidElement, defaultAdapter, isKeyOf, isNil, toHead, toNativeAttrName, toNativeAttrValue, useQuerySubscription, useSiteSearch, useVideoPlayer };
1311
+ export { DatocmsImagePlugin, DatocmsNakedImagePlugin, DatocmsStructuredTextPlugin, DatocmsVideoPlayerPlugin, DisabledQueryListenerOptions, EnabledQueryListenerOptions, GenericClient, Image, NakedImage, QueryListenerOptions, RawSearchResult, RenderBlockContext, RenderInlineRecordContext, RenderRecordLinkContext, ResponsiveImageType, SeoMetaTagType, StructuredText, SubscribeToQueryOptions, ToMetaTagsType, UseSiteSearchConfig, UseSiteSearchData, UseSiteSearchResult, Video, VideoPlayer, appendKeyToValidElement, defaultAdapter, isKeyOf, isNil, toHead, toNativeAttrName, toNativeAttrValue, useQuerySubscription, useSiteSearch, useVideoPlayer };
@@ -2,7 +2,7 @@ import { ref, onMounted, onBeforeUnmount, defineComponent, h, watchEffect, unref
2
2
  import hypenateStyleName from 'hyphenate-style-name';
3
3
  import { render, renderNodeRule, defaultMetaTransformer } from 'datocms-structured-text-generic-html-renderer';
4
4
  export { renderMarkRule, renderNodeRule, renderNodeRule as renderRule } from 'datocms-structured-text-generic-html-renderer';
5
- import { isRoot, isInlineItem, RenderError, isStructuredText, isItemLink, isBlock } from 'datocms-structured-text-utils';
5
+ import { isRoot, isInlineItem, RenderError, isStructuredText, isItemLink, isBlock, isInlineBlock } from 'datocms-structured-text-utils';
6
6
  export { RenderError } from 'datocms-structured-text-utils';
7
7
  import { subscribeToQuery } from 'datocms-listen';
8
8
 
@@ -162,17 +162,17 @@ function buildRegularSource(data, sizes, srcSetCandidates) {
162
162
  }
163
163
 
164
164
  var __defProp$6 = Object.defineProperty;
165
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
166
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
167
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
165
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
166
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
167
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
168
168
  var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
169
169
  var __spreadValues$6 = (a, b) => {
170
170
  for (var prop in b || (b = {}))
171
- if (__hasOwnProp$7.call(b, prop))
171
+ if (__hasOwnProp$6.call(b, prop))
172
172
  __defNormalProp$6(a, prop, b[prop]);
173
- if (__getOwnPropSymbols$7)
174
- for (var prop of __getOwnPropSymbols$7(b)) {
175
- if (__propIsEnum$7.call(b, prop))
173
+ if (__getOwnPropSymbols$6)
174
+ for (var prop of __getOwnPropSymbols$6(b)) {
175
+ if (__propIsEnum$6.call(b, prop))
176
176
  __defNormalProp$6(a, prop, b[prop]);
177
177
  }
178
178
  return a;
@@ -210,17 +210,17 @@ const Sizer = defineComponent({
210
210
  var __defProp$5 = Object.defineProperty;
211
211
  var __defProps$3 = Object.defineProperties;
212
212
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
213
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
214
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
215
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
213
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
214
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
215
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
216
216
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
217
217
  var __spreadValues$5 = (a, b) => {
218
218
  for (var prop in b || (b = {}))
219
- if (__hasOwnProp$6.call(b, prop))
219
+ if (__hasOwnProp$5.call(b, prop))
220
220
  __defNormalProp$5(a, prop, b[prop]);
221
- if (__getOwnPropSymbols$6)
222
- for (var prop of __getOwnPropSymbols$6(b)) {
223
- if (__propIsEnum$6.call(b, prop))
221
+ if (__getOwnPropSymbols$5)
222
+ for (var prop of __getOwnPropSymbols$5(b)) {
223
+ if (__propIsEnum$5.call(b, prop))
224
224
  __defNormalProp$5(a, prop, b[prop]);
225
225
  }
226
226
  return a;
@@ -483,17 +483,17 @@ const DatocmsImagePlugin = {
483
483
  };
484
484
 
485
485
  var __defProp$4 = Object.defineProperty;
486
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
487
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
488
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
486
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
487
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
488
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
489
489
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
490
490
  var __spreadValues$4 = (a, b) => {
491
491
  for (var prop in b || (b = {}))
492
- if (__hasOwnProp$5.call(b, prop))
492
+ if (__hasOwnProp$4.call(b, prop))
493
493
  __defNormalProp$4(a, prop, b[prop]);
494
- if (__getOwnPropSymbols$5)
495
- for (var prop of __getOwnPropSymbols$5(b)) {
496
- if (__propIsEnum$5.call(b, prop))
494
+ if (__getOwnPropSymbols$4)
495
+ for (var prop of __getOwnPropSymbols$4(b)) {
496
+ if (__propIsEnum$4.call(b, prop))
497
497
  __defNormalProp$4(a, prop, b[prop]);
498
498
  }
499
499
  return a;
@@ -619,34 +619,11 @@ const DatocmsNakedImagePlugin = {
619
619
  }
620
620
  };
621
621
 
622
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
623
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
624
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
625
- var __objRest$2 = (source, exclude) => {
626
- var target = {};
627
- for (var prop in source)
628
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
629
- target[prop] = source[prop];
630
- if (source != null && __getOwnPropSymbols$4)
631
- for (var prop of __getOwnPropSymbols$4(source)) {
632
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
633
- target[prop] = source[prop];
634
- }
635
- return target;
636
- };
637
- const hAdapter = (tagName, props, childOrChildren) => {
638
- const _a = props || {}; __objRest$2(_a, ["href", "target", "rel"]);
639
- return h(
640
- tagName,
641
- props,
642
- typeof childOrChildren === "undefined" || Array.isArray(childOrChildren) ? childOrChildren : [childOrChildren]
643
- );
644
- };
645
622
  const defaultAdapter = {
646
- renderNode: hAdapter,
647
- renderMark: hAdapter,
648
- renderFragment: (children, key) => children,
649
- renderText: (text, key) => text
623
+ renderNode: h,
624
+ renderMark: h,
625
+ renderFragment: (children, _key) => children,
626
+ renderText: (text, _key) => text
650
627
  };
651
628
  function appendKeyToValidElement(element, key) {
652
629
  if (element !== null && typeof element !== "string" && element.key === null) {
@@ -654,8 +631,39 @@ function appendKeyToValidElement(element, key) {
654
631
  }
655
632
  return element;
656
633
  }
657
- const StructuredText = defineComponent(
658
- (props) => {
634
+ const StructuredText = defineComponent({
635
+ name: "DatocmsStructuredText",
636
+ props: {
637
+ data: {
638
+ type: Object
639
+ },
640
+ customRules: {
641
+ type: Array
642
+ },
643
+ customNodeRules: {
644
+ type: Array
645
+ },
646
+ customMarkRules: {
647
+ type: Array
648
+ },
649
+ renderInlineRecord: {
650
+ type: Function
651
+ },
652
+ renderLinkToRecord: {
653
+ type: Function
654
+ },
655
+ renderBlock: {
656
+ type: Function
657
+ },
658
+ renderInlineBlock: {
659
+ type: Function
660
+ },
661
+ metaTransformer: { type: Function },
662
+ renderText: { type: Function },
663
+ renderNode: { type: Function },
664
+ renderFragment: { type: Function }
665
+ },
666
+ setup(props) {
659
667
  return () => {
660
668
  return render(props.data, {
661
669
  adapter: {
@@ -756,15 +764,39 @@ const StructuredText = defineComponent(
756
764
  key
757
765
  );
758
766
  }),
767
+ renderNodeRule(isInlineBlock, ({ node, key }) => {
768
+ if (!props.renderInlineBlock) {
769
+ throw new RenderError(
770
+ `The Structured Text document contains an 'inlineBlock' node, but no 'renderInlineBlock' prop is specified!`,
771
+ node
772
+ );
773
+ }
774
+ if (!isStructuredText(props.data) || !props.data.blocks) {
775
+ throw new RenderError(
776
+ `The Structured Text document contains an 'inlineBlock' node, but .blocks is not present!`,
777
+ node
778
+ );
779
+ }
780
+ const item = props.data.blocks.find(
781
+ (item2) => item2.id === node.item
782
+ );
783
+ if (!item) {
784
+ throw new RenderError(
785
+ `The Structured Text document contains a 'block' node, but cannot find a record with ID ${node.item} inside .blocks!`,
786
+ node
787
+ );
788
+ }
789
+ return appendKeyToValidElement(
790
+ props.renderInlineBlock({ record: item }),
791
+ key
792
+ );
793
+ }),
759
794
  ...props.customNodeRules || props.customRules || []
760
795
  ]
761
796
  });
762
797
  };
763
- },
764
- {
765
- name: "DatocmsStructuredText"
766
798
  }
767
- );
799
+ });
768
800
  const DatocmsStructuredTextPlugin = {
769
801
  install: (Vue) => {
770
802
  Vue.component("DatocmsStructuredText", StructuredText);
@@ -965,6 +997,11 @@ const VideoPlayer = defineComponent({
965
997
  required: false,
966
998
  default: () => true
967
999
  },
1000
+ disableTracking: {
1001
+ type: Boolean,
1002
+ required: false,
1003
+ default: () => true
1004
+ },
968
1005
  disablePictureInPicture: {
969
1006
  type: Boolean,
970
1007
  required: false
@@ -1162,16 +1199,19 @@ const VideoPlayer = defineComponent({
1162
1199
  var _b = _a, {
1163
1200
  data = {},
1164
1201
  disableCookies = true,
1202
+ disableTracking = true,
1165
1203
  preload = "metadata"
1166
1204
  } = _b, otherProps = __objRest$1(_b, [
1167
1205
  "data",
1168
1206
  "disableCookies",
1207
+ "disableTracking",
1169
1208
  "preload"
1170
1209
  ]);
1171
1210
  import('@mux/mux-player');
1172
1211
  const muxPlayerRef = ref();
1173
1212
  const computedProps = __spreadProps$2(__spreadValues$2({}, useVideoPlayer({ data })), {
1174
1213
  disableCookies,
1214
+ disableTracking,
1175
1215
  preload
1176
1216
  });
1177
1217
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-datocms",
3
- "version": "8.0.0-0",
3
+ "version": "8.1.0",
4
4
  "description": "A set of components and utilities to work faster with DatoCMS in Vue.js environments",
5
5
  "keywords": [
6
6
  "datocms",
@@ -42,13 +42,14 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "datocms-listen": "^0.1.15",
45
- "datocms-structured-text-generic-html-renderer": "^4.0.1",
46
- "datocms-structured-text-utils": "^4.0.1",
45
+ "hls.js": "^1.5.17",
46
+ "datocms-structured-text-generic-html-renderer": "^4.1.2",
47
+ "datocms-structured-text-utils": "^4.1.2",
47
48
  "hyphenate-style-name": "^1.0.4"
48
49
  },
49
50
  "peerDependencies": {
50
51
  "@mux/mux-player": "*",
51
- "vue": "^3.3.0"
52
+ "vue": "^3.0.0"
52
53
  },
53
54
  "peerDependenciesMeta": {
54
55
  "@mux/mux-player": {
@@ -57,18 +58,20 @@
57
58
  },
58
59
  "devDependencies": {
59
60
  "@biomejs/biome": "^1.6.3",
60
- "@mux/mux-player": "*",
61
+ "@mux/mux-player": "^2.5.0",
61
62
  "@mux/playback-core": "^0.22.1",
62
63
  "@types/hyphenate-style-name": "^1.0.2",
63
64
  "@types/jest": "^29.5.11",
64
65
  "@types/node": "^14.18.63",
65
66
  "@vue/test-utils": "^2.4.3",
66
67
  "@vuedx/typescript-plugin-vue": "^0.7.6",
68
+ "doctoc": "^2.0.0",
67
69
  "esbuild": "^0.15.18",
68
70
  "jest": "^29.7.0",
69
71
  "jest-environment-jsdom": "^29.7.0",
70
72
  "jest-serializer-vue": "^2.0.2",
71
73
  "jsdom": "^19.0.0",
74
+ "matchmedia-polyfill": "^0.3.2",
72
75
  "np": "^9.2.0",
73
76
  "resize-observer-polyfill": "^1.5.1",
74
77
  "rollup": "^2.79.1",
@@ -77,7 +80,6 @@
77
80
  "ts-jest": "^29.1.1",
78
81
  "tslib": "^2.6.2",
79
82
  "typescript": "^4.9.5",
80
- "vue-tsc": "^0.37.9",
81
- "doctoc": "^2.0.0"
83
+ "vue-tsc": "^0.37.9"
82
84
  }
83
85
  }