vue-datocms 7.0.4 → 8.0.0-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/dist/index.cjs.js CHANGED
@@ -678,36 +678,8 @@ function appendKeyToValidElement(element, key) {
678
678
  }
679
679
  return element;
680
680
  }
681
- const StructuredText = vue.defineComponent({
682
- name: "DatocmsStructuredText",
683
- props: {
684
- data: {
685
- type: Object
686
- },
687
- customRules: {
688
- type: Array
689
- },
690
- customNodeRules: {
691
- type: Array
692
- },
693
- customMarkRules: {
694
- type: Array
695
- },
696
- renderInlineRecord: {
697
- type: Function
698
- },
699
- renderLinkToRecord: {
700
- type: Function
701
- },
702
- renderBlock: {
703
- type: Function
704
- },
705
- metaTransformer: { type: Function },
706
- renderText: { type: Function },
707
- renderNode: { type: Function },
708
- renderFragment: { type: Function }
709
- },
710
- setup(props) {
681
+ const StructuredText = vue.defineComponent(
682
+ (props) => {
711
683
  return () => {
712
684
  return datocmsStructuredTextGenericHtmlRenderer.render(props.data, {
713
685
  adapter: {
@@ -812,8 +784,11 @@ const StructuredText = vue.defineComponent({
812
784
  ]
813
785
  });
814
786
  };
787
+ },
788
+ {
789
+ name: "DatocmsStructuredText"
815
790
  }
816
- });
791
+ );
817
792
  const DatocmsStructuredTextPlugin = {
818
793
  install: (Vue) => {
819
794
  Vue.component("DatocmsStructuredText", StructuredText);
package/dist/index.d.ts CHANGED
@@ -426,97 +426,31 @@ 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
- declare const StructuredText: vue.DefineComponent<{
429
+ type StructuredTextPropTypes<R1 extends Record$1, R2 extends Record$1 = R1> = {
430
430
  /** The actual field value you get from DatoCMS **/
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<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (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<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (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<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
445
- };
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>[];
446
436
  /** Fuction that converts an 'inlineItem' node into React **/
447
- renderInlineRecord: {
448
- type: PropType<(context: RenderInlineRecordContext) => AdapterReturn>;
449
- };
437
+ renderInlineRecord?: (context: RenderInlineRecordContext<R2>) => AdapterReturn;
450
438
  /** Fuction that converts an 'itemLink' node into React **/
451
- renderLinkToRecord: {
452
- type: PropType<(context: RenderRecordLinkContext) => AdapterReturn>;
453
- };
439
+ renderLinkToRecord?: (context: RenderRecordLinkContext<R2>) => AdapterReturn;
454
440
  /** Fuction that converts a 'block' node into React **/
455
- renderBlock: {
456
- type: PropType<(context: RenderBlockContext) => AdapterReturn>;
457
- };
441
+ renderBlock?: (context: RenderBlockContext<R1>) => AdapterReturn;
458
442
  /** Function that converts 'link' and 'itemLink' `meta` into HTML props */
459
- metaTransformer: {
460
- type: PropType<TransformMetaFn>;
461
- };
443
+ metaTransformer?: TransformMetaFn;
462
444
  /** Fuction that converts a simple string text into React **/
463
- renderText: {
464
- type: PropType<(text: string, key: string) => AdapterReturn>;
465
- };
445
+ renderText?: T;
466
446
  /** React.createElement-like function to use to convert a node into React **/
467
- renderNode: {
468
- type: PropType<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn>;
469
- };
447
+ renderNode?: H;
470
448
  /** Function to use to generate a React.Fragment **/
471
- renderFragment: {
472
- type: PropType<(children: AdapterReturn[], key: string) => AdapterReturn>;
473
- };
474
- }, () => RenderResult<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
475
- /** The actual field value you get from DatoCMS **/
476
- data: {
477
- type: PropType<StructuredText$1<Record$1, Record$1> | Document | Node | null | undefined>;
478
- };
449
+ renderFragment?: F;
479
450
  /** @deprecated use customNodeRules **/
480
- customRules: {
481
- type: PropType<RenderRule<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
482
- };
483
- /** A set of additional rules to convert the document to JSX **/
484
- customNodeRules: {
485
- type: PropType<RenderRule<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
486
- };
487
- /** A set of additional rules to convert the document to JSX **/
488
- customMarkRules: {
489
- type: PropType<RenderMarkRule<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
490
- };
491
- /** Fuction that converts an 'inlineItem' node into React **/
492
- renderInlineRecord: {
493
- type: PropType<(context: RenderInlineRecordContext) => AdapterReturn>;
494
- };
495
- /** Fuction that converts an 'itemLink' node into React **/
496
- renderLinkToRecord: {
497
- type: PropType<(context: RenderRecordLinkContext) => AdapterReturn>;
498
- };
499
- /** Fuction that converts a 'block' node into React **/
500
- renderBlock: {
501
- type: PropType<(context: RenderBlockContext) => AdapterReturn>;
502
- };
503
- /** Function that converts 'link' and 'itemLink' `meta` into HTML props */
504
- metaTransformer: {
505
- type: PropType<TransformMetaFn>;
506
- };
507
- /** Fuction that converts a simple string text into React **/
508
- renderText: {
509
- type: PropType<(text: string, key: string) => AdapterReturn>;
510
- };
511
- /** React.createElement-like function to use to convert a node into React **/
512
- renderNode: {
513
- type: PropType<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn>;
514
- };
515
- /** Function to use to generate a React.Fragment **/
516
- renderFragment: {
517
- type: PropType<(children: AdapterReturn[], key: string) => AdapterReturn>;
518
- };
519
- }>>, {}, {}>;
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;
520
454
  declare const DatocmsStructuredTextPlugin: {
521
455
  install: (Vue: any) => void;
522
456
  };
@@ -1288,4 +1222,4 @@ declare const toHead: (...args: ToMetaTagsType[]) => {
1288
1222
  }[];
1289
1223
  };
1290
1224
 
1291
- 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 };
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 };
@@ -654,36 +654,8 @@ function appendKeyToValidElement(element, key) {
654
654
  }
655
655
  return element;
656
656
  }
657
- const StructuredText = defineComponent({
658
- name: "DatocmsStructuredText",
659
- props: {
660
- data: {
661
- type: Object
662
- },
663
- customRules: {
664
- type: Array
665
- },
666
- customNodeRules: {
667
- type: Array
668
- },
669
- customMarkRules: {
670
- type: Array
671
- },
672
- renderInlineRecord: {
673
- type: Function
674
- },
675
- renderLinkToRecord: {
676
- type: Function
677
- },
678
- renderBlock: {
679
- type: Function
680
- },
681
- metaTransformer: { type: Function },
682
- renderText: { type: Function },
683
- renderNode: { type: Function },
684
- renderFragment: { type: Function }
685
- },
686
- setup(props) {
657
+ const StructuredText = defineComponent(
658
+ (props) => {
687
659
  return () => {
688
660
  return render(props.data, {
689
661
  adapter: {
@@ -788,8 +760,11 @@ const StructuredText = defineComponent({
788
760
  ]
789
761
  });
790
762
  };
763
+ },
764
+ {
765
+ name: "DatocmsStructuredText"
791
766
  }
792
- });
767
+ );
793
768
  const DatocmsStructuredTextPlugin = {
794
769
  install: (Vue) => {
795
770
  Vue.component("DatocmsStructuredText", StructuredText);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-datocms",
3
- "version": "7.0.4",
3
+ "version": "8.0.0-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",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@mux/mux-player": "*",
51
- "vue": "^3.0.0"
51
+ "vue": "^3.3.0"
52
52
  },
53
53
  "peerDependenciesMeta": {
54
54
  "@mux/mux-player": {