vue-datocms 8.0.0 → 8.1.1
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 +44 -3
- package/dist/index.d.ts +62 -12
- package/dist/index.esm.mjs +45 -4
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -346,6 +346,10 @@ const Image$1 = vue.defineComponent({
|
|
|
346
346
|
return typeof value === "number";
|
|
347
347
|
}),
|
|
348
348
|
default: () => [0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4]
|
|
349
|
+
},
|
|
350
|
+
referrerPolicy: {
|
|
351
|
+
type: String,
|
|
352
|
+
default: "no-referrer-when-downgrade"
|
|
349
353
|
}
|
|
350
354
|
},
|
|
351
355
|
setup(props, { emit, expose }) {
|
|
@@ -460,7 +464,8 @@ const Image$1 = vue.defineComponent({
|
|
|
460
464
|
}, absolutePositioning), {
|
|
461
465
|
objectFit: this.objectFit,
|
|
462
466
|
objectPosition: this.objectPosition
|
|
463
|
-
}), this.imgStyle)
|
|
467
|
+
}), this.imgStyle),
|
|
468
|
+
referrerpolicy: this.referrerPolicy
|
|
464
469
|
})
|
|
465
470
|
]),
|
|
466
471
|
vue.h("noscript", {
|
|
@@ -491,7 +496,8 @@ const Image$1 = vue.defineComponent({
|
|
|
491
496
|
objectPosition: this.objectPosition
|
|
492
497
|
}), this.imgStyle)),
|
|
493
498
|
loading: this.priority ? void 0 : "lazy",
|
|
494
|
-
fetchpriority: this.priority ? "high" : void 0
|
|
499
|
+
fetchpriority: this.priority ? "high" : void 0,
|
|
500
|
+
referrerpolicy: this.referrerPolicy
|
|
495
501
|
})
|
|
496
502
|
]
|
|
497
503
|
)
|
|
@@ -561,6 +567,10 @@ const NakedImage = vue.defineComponent({
|
|
|
561
567
|
imgStyle: {
|
|
562
568
|
type: Object,
|
|
563
569
|
default: () => ({})
|
|
570
|
+
},
|
|
571
|
+
referrerPolicy: {
|
|
572
|
+
type: String,
|
|
573
|
+
default: "no-referrer-when-downgrade"
|
|
564
574
|
}
|
|
565
575
|
},
|
|
566
576
|
setup(_props, { emit, expose }) {
|
|
@@ -631,7 +641,8 @@ const NakedImage = vue.defineComponent({
|
|
|
631
641
|
fetchpriority: this.priority ? "high" : void 0,
|
|
632
642
|
loading: this.priority ? void 0 : "lazy",
|
|
633
643
|
style: __spreadValues$4(__spreadValues$4(__spreadValues$4({}, placeholderStyle), sizingStyle), this.imgStyle || {}),
|
|
634
|
-
class: this.imgClass
|
|
644
|
+
class: this.imgClass,
|
|
645
|
+
referrerpolicy: this.referrerPolicy
|
|
635
646
|
})
|
|
636
647
|
]
|
|
637
648
|
);
|
|
@@ -679,6 +690,9 @@ const StructuredText = vue.defineComponent({
|
|
|
679
690
|
renderBlock: {
|
|
680
691
|
type: Function
|
|
681
692
|
},
|
|
693
|
+
renderInlineBlock: {
|
|
694
|
+
type: Function
|
|
695
|
+
},
|
|
682
696
|
metaTransformer: { type: Function },
|
|
683
697
|
renderText: { type: Function },
|
|
684
698
|
renderNode: { type: Function },
|
|
@@ -785,6 +799,33 @@ const StructuredText = vue.defineComponent({
|
|
|
785
799
|
key
|
|
786
800
|
);
|
|
787
801
|
}),
|
|
802
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isInlineBlock, ({ node, key }) => {
|
|
803
|
+
if (!props.renderInlineBlock) {
|
|
804
|
+
throw new datocmsStructuredTextUtils.RenderError(
|
|
805
|
+
`The Structured Text document contains an 'inlineBlock' node, but no 'renderInlineBlock' prop is specified!`,
|
|
806
|
+
node
|
|
807
|
+
);
|
|
808
|
+
}
|
|
809
|
+
if (!datocmsStructuredTextUtils.isStructuredText(props.data) || !props.data.blocks) {
|
|
810
|
+
throw new datocmsStructuredTextUtils.RenderError(
|
|
811
|
+
`The Structured Text document contains an 'inlineBlock' node, but .blocks is not present!`,
|
|
812
|
+
node
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
const item = props.data.blocks.find(
|
|
816
|
+
(item2) => item2.id === node.item
|
|
817
|
+
);
|
|
818
|
+
if (!item) {
|
|
819
|
+
throw new datocmsStructuredTextUtils.RenderError(
|
|
820
|
+
`The Structured Text document contains a 'block' node, but cannot find a record with ID ${node.item} inside .blocks!`,
|
|
821
|
+
node
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
return appendKeyToValidElement(
|
|
825
|
+
props.renderInlineBlock({ record: item }),
|
|
826
|
+
key
|
|
827
|
+
);
|
|
828
|
+
}),
|
|
788
829
|
...props.customNodeRules || props.customRules || []
|
|
789
830
|
]
|
|
790
831
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -142,6 +142,16 @@ declare const Image: vue.DefineComponent<{
|
|
|
142
142
|
validator: (values: any[]) => values is number[];
|
|
143
143
|
default: () => number[];
|
|
144
144
|
};
|
|
145
|
+
/**
|
|
146
|
+
* Defines which referrer is sent when fetching the image
|
|
147
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy
|
|
148
|
+
*
|
|
149
|
+
* Defaults to `no-referrer-when-downgrade` to give more useful stats in DatoCMS Project Usages
|
|
150
|
+
**/
|
|
151
|
+
referrerPolicy: {
|
|
152
|
+
type: StringConstructor;
|
|
153
|
+
default: string;
|
|
154
|
+
};
|
|
145
155
|
}, {
|
|
146
156
|
inView: vue.Ref<boolean>;
|
|
147
157
|
rootRef: vue.Ref<HTMLElement | null>;
|
|
@@ -256,6 +266,16 @@ declare const Image: vue.DefineComponent<{
|
|
|
256
266
|
validator: (values: any[]) => values is number[];
|
|
257
267
|
default: () => number[];
|
|
258
268
|
};
|
|
269
|
+
/**
|
|
270
|
+
* Defines which referrer is sent when fetching the image
|
|
271
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy
|
|
272
|
+
*
|
|
273
|
+
* Defaults to `no-referrer-when-downgrade` to give more useful stats in DatoCMS Project Usages
|
|
274
|
+
**/
|
|
275
|
+
referrerPolicy: {
|
|
276
|
+
type: StringConstructor;
|
|
277
|
+
default: string;
|
|
278
|
+
};
|
|
259
279
|
}>> & {
|
|
260
280
|
onLoad?: ((...args: any[]) => any) | undefined;
|
|
261
281
|
}, {
|
|
@@ -268,6 +288,7 @@ declare const Image: vue.DefineComponent<{
|
|
|
268
288
|
layout: string;
|
|
269
289
|
usePlaceholder: boolean;
|
|
270
290
|
srcSetCandidates: unknown[];
|
|
291
|
+
referrerPolicy: string;
|
|
271
292
|
}, {}>;
|
|
272
293
|
declare const DatocmsImagePlugin: {
|
|
273
294
|
install: (Vue: any) => void;
|
|
@@ -331,6 +352,16 @@ declare const NakedImage: vue.DefineComponent<{
|
|
|
331
352
|
type: ObjectConstructor;
|
|
332
353
|
default: () => {};
|
|
333
354
|
};
|
|
355
|
+
/**
|
|
356
|
+
* Defines which referrer is sent when fetching the image
|
|
357
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy
|
|
358
|
+
*
|
|
359
|
+
* Defaults to `no-referrer-when-downgrade` to give more useful stats in DatoCMS Project Usages
|
|
360
|
+
**/
|
|
361
|
+
referrerPolicy: {
|
|
362
|
+
type: StringConstructor;
|
|
363
|
+
default: string;
|
|
364
|
+
};
|
|
334
365
|
}, {
|
|
335
366
|
loaded: vue.Ref<boolean>;
|
|
336
367
|
handleLoad: () => void;
|
|
@@ -393,12 +424,23 @@ declare const NakedImage: vue.DefineComponent<{
|
|
|
393
424
|
type: ObjectConstructor;
|
|
394
425
|
default: () => {};
|
|
395
426
|
};
|
|
427
|
+
/**
|
|
428
|
+
* Defines which referrer is sent when fetching the image
|
|
429
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy
|
|
430
|
+
*
|
|
431
|
+
* Defaults to `no-referrer-when-downgrade` to give more useful stats in DatoCMS Project Usages
|
|
432
|
+
**/
|
|
433
|
+
referrerPolicy: {
|
|
434
|
+
type: StringConstructor;
|
|
435
|
+
default: string;
|
|
436
|
+
};
|
|
396
437
|
}>>, {
|
|
397
438
|
priority: boolean;
|
|
398
439
|
pictureStyle: Record<string, any>;
|
|
399
440
|
imgStyle: Record<string, any>;
|
|
400
441
|
usePlaceholder: boolean;
|
|
401
442
|
srcSetCandidates: unknown[];
|
|
443
|
+
referrerPolicy: string;
|
|
402
444
|
}, {}>;
|
|
403
445
|
declare const DatocmsNakedImagePlugin: {
|
|
404
446
|
install: (Vue: any) => void;
|
|
@@ -443,31 +485,35 @@ declare const StructuredText: vue.DefineComponent<{
|
|
|
443
485
|
customMarkRules: {
|
|
444
486
|
type: PropType<RenderMarkRule<typeof h, (text: string, _key: string) => AdapterReturn, (children: AdapterReturn[], _key: string) => AdapterReturn>[]>;
|
|
445
487
|
};
|
|
446
|
-
/** Fuction that converts an 'inlineItem' node into
|
|
488
|
+
/** Fuction that converts an 'inlineItem' node into a Vue component **/
|
|
447
489
|
renderInlineRecord: {
|
|
448
490
|
type: PropType<(context: RenderInlineRecordContext<any>) => AdapterReturn>;
|
|
449
491
|
};
|
|
450
|
-
/** Fuction that converts an 'itemLink' node into
|
|
492
|
+
/** Fuction that converts an 'itemLink' node into a Vue component **/
|
|
451
493
|
renderLinkToRecord: {
|
|
452
494
|
type: PropType<(context: RenderRecordLinkContext<any>) => AdapterReturn>;
|
|
453
495
|
};
|
|
454
|
-
/** Fuction that converts a 'block' node into
|
|
496
|
+
/** Fuction that converts a 'block' node into a Vue component **/
|
|
455
497
|
renderBlock: {
|
|
456
498
|
type: PropType<(context: RenderBlockContext<any>) => AdapterReturn>;
|
|
457
499
|
};
|
|
500
|
+
/** Fuction that converts an 'inlineBlock' node into a Vue component **/
|
|
501
|
+
renderInlineBlock: {
|
|
502
|
+
type: PropType<(context: RenderBlockContext<any>) => AdapterReturn>;
|
|
503
|
+
};
|
|
458
504
|
/** Function that converts 'link' and 'itemLink' `meta` into HTML props */
|
|
459
505
|
metaTransformer: {
|
|
460
506
|
type: PropType<TransformMetaFn>;
|
|
461
507
|
};
|
|
462
|
-
/** Fuction that converts a simple string text into
|
|
508
|
+
/** Fuction that converts a simple string text into a Vue component **/
|
|
463
509
|
renderText: {
|
|
464
510
|
type: PropType<(text: string, _key: string) => AdapterReturn>;
|
|
465
511
|
};
|
|
466
|
-
/** React.createElement-like function to use to convert a node into
|
|
512
|
+
/** React.createElement-like function to use to convert a node into a Vue component **/
|
|
467
513
|
renderNode: {
|
|
468
514
|
type: PropType<typeof h>;
|
|
469
515
|
};
|
|
470
|
-
/** Function to use to generate a
|
|
516
|
+
/** Function to use to generate a Vue.Fragment **/
|
|
471
517
|
renderFragment: {
|
|
472
518
|
type: PropType<(children: AdapterReturn[], _key: string) => AdapterReturn>;
|
|
473
519
|
};
|
|
@@ -488,31 +534,35 @@ declare const StructuredText: vue.DefineComponent<{
|
|
|
488
534
|
customMarkRules: {
|
|
489
535
|
type: PropType<RenderMarkRule<typeof h, (text: string, _key: string) => AdapterReturn, (children: AdapterReturn[], _key: string) => AdapterReturn>[]>;
|
|
490
536
|
};
|
|
491
|
-
/** Fuction that converts an 'inlineItem' node into
|
|
537
|
+
/** Fuction that converts an 'inlineItem' node into a Vue component **/
|
|
492
538
|
renderInlineRecord: {
|
|
493
539
|
type: PropType<(context: RenderInlineRecordContext<any>) => AdapterReturn>;
|
|
494
540
|
};
|
|
495
|
-
/** Fuction that converts an 'itemLink' node into
|
|
541
|
+
/** Fuction that converts an 'itemLink' node into a Vue component **/
|
|
496
542
|
renderLinkToRecord: {
|
|
497
543
|
type: PropType<(context: RenderRecordLinkContext<any>) => AdapterReturn>;
|
|
498
544
|
};
|
|
499
|
-
/** Fuction that converts a 'block' node into
|
|
545
|
+
/** Fuction that converts a 'block' node into a Vue component **/
|
|
500
546
|
renderBlock: {
|
|
501
547
|
type: PropType<(context: RenderBlockContext<any>) => AdapterReturn>;
|
|
502
548
|
};
|
|
549
|
+
/** Fuction that converts an 'inlineBlock' node into a Vue component **/
|
|
550
|
+
renderInlineBlock: {
|
|
551
|
+
type: PropType<(context: RenderBlockContext<any>) => AdapterReturn>;
|
|
552
|
+
};
|
|
503
553
|
/** Function that converts 'link' and 'itemLink' `meta` into HTML props */
|
|
504
554
|
metaTransformer: {
|
|
505
555
|
type: PropType<TransformMetaFn>;
|
|
506
556
|
};
|
|
507
|
-
/** Fuction that converts a simple string text into
|
|
557
|
+
/** Fuction that converts a simple string text into a Vue component **/
|
|
508
558
|
renderText: {
|
|
509
559
|
type: PropType<(text: string, _key: string) => AdapterReturn>;
|
|
510
560
|
};
|
|
511
|
-
/** React.createElement-like function to use to convert a node into
|
|
561
|
+
/** React.createElement-like function to use to convert a node into a Vue component **/
|
|
512
562
|
renderNode: {
|
|
513
563
|
type: PropType<typeof h>;
|
|
514
564
|
};
|
|
515
|
-
/** Function to use to generate a
|
|
565
|
+
/** Function to use to generate a Vue.Fragment **/
|
|
516
566
|
renderFragment: {
|
|
517
567
|
type: PropType<(children: AdapterReturn[], _key: string) => AdapterReturn>;
|
|
518
568
|
};
|
package/dist/index.esm.mjs
CHANGED
|
@@ -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
|
|
|
@@ -322,6 +322,10 @@ const Image$1 = defineComponent({
|
|
|
322
322
|
return typeof value === "number";
|
|
323
323
|
}),
|
|
324
324
|
default: () => [0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4]
|
|
325
|
+
},
|
|
326
|
+
referrerPolicy: {
|
|
327
|
+
type: String,
|
|
328
|
+
default: "no-referrer-when-downgrade"
|
|
325
329
|
}
|
|
326
330
|
},
|
|
327
331
|
setup(props, { emit, expose }) {
|
|
@@ -436,7 +440,8 @@ const Image$1 = defineComponent({
|
|
|
436
440
|
}, absolutePositioning), {
|
|
437
441
|
objectFit: this.objectFit,
|
|
438
442
|
objectPosition: this.objectPosition
|
|
439
|
-
}), this.imgStyle)
|
|
443
|
+
}), this.imgStyle),
|
|
444
|
+
referrerpolicy: this.referrerPolicy
|
|
440
445
|
})
|
|
441
446
|
]),
|
|
442
447
|
h("noscript", {
|
|
@@ -467,7 +472,8 @@ const Image$1 = defineComponent({
|
|
|
467
472
|
objectPosition: this.objectPosition
|
|
468
473
|
}), this.imgStyle)),
|
|
469
474
|
loading: this.priority ? void 0 : "lazy",
|
|
470
|
-
fetchpriority: this.priority ? "high" : void 0
|
|
475
|
+
fetchpriority: this.priority ? "high" : void 0,
|
|
476
|
+
referrerpolicy: this.referrerPolicy
|
|
471
477
|
})
|
|
472
478
|
]
|
|
473
479
|
)
|
|
@@ -537,6 +543,10 @@ const NakedImage = defineComponent({
|
|
|
537
543
|
imgStyle: {
|
|
538
544
|
type: Object,
|
|
539
545
|
default: () => ({})
|
|
546
|
+
},
|
|
547
|
+
referrerPolicy: {
|
|
548
|
+
type: String,
|
|
549
|
+
default: "no-referrer-when-downgrade"
|
|
540
550
|
}
|
|
541
551
|
},
|
|
542
552
|
setup(_props, { emit, expose }) {
|
|
@@ -607,7 +617,8 @@ const NakedImage = defineComponent({
|
|
|
607
617
|
fetchpriority: this.priority ? "high" : void 0,
|
|
608
618
|
loading: this.priority ? void 0 : "lazy",
|
|
609
619
|
style: __spreadValues$4(__spreadValues$4(__spreadValues$4({}, placeholderStyle), sizingStyle), this.imgStyle || {}),
|
|
610
|
-
class: this.imgClass
|
|
620
|
+
class: this.imgClass,
|
|
621
|
+
referrerpolicy: this.referrerPolicy
|
|
611
622
|
})
|
|
612
623
|
]
|
|
613
624
|
);
|
|
@@ -655,6 +666,9 @@ const StructuredText = defineComponent({
|
|
|
655
666
|
renderBlock: {
|
|
656
667
|
type: Function
|
|
657
668
|
},
|
|
669
|
+
renderInlineBlock: {
|
|
670
|
+
type: Function
|
|
671
|
+
},
|
|
658
672
|
metaTransformer: { type: Function },
|
|
659
673
|
renderText: { type: Function },
|
|
660
674
|
renderNode: { type: Function },
|
|
@@ -761,6 +775,33 @@ const StructuredText = defineComponent({
|
|
|
761
775
|
key
|
|
762
776
|
);
|
|
763
777
|
}),
|
|
778
|
+
renderNodeRule(isInlineBlock, ({ node, key }) => {
|
|
779
|
+
if (!props.renderInlineBlock) {
|
|
780
|
+
throw new RenderError(
|
|
781
|
+
`The Structured Text document contains an 'inlineBlock' node, but no 'renderInlineBlock' prop is specified!`,
|
|
782
|
+
node
|
|
783
|
+
);
|
|
784
|
+
}
|
|
785
|
+
if (!isStructuredText(props.data) || !props.data.blocks) {
|
|
786
|
+
throw new RenderError(
|
|
787
|
+
`The Structured Text document contains an 'inlineBlock' node, but .blocks is not present!`,
|
|
788
|
+
node
|
|
789
|
+
);
|
|
790
|
+
}
|
|
791
|
+
const item = props.data.blocks.find(
|
|
792
|
+
(item2) => item2.id === node.item
|
|
793
|
+
);
|
|
794
|
+
if (!item) {
|
|
795
|
+
throw new RenderError(
|
|
796
|
+
`The Structured Text document contains a 'block' node, but cannot find a record with ID ${node.item} inside .blocks!`,
|
|
797
|
+
node
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
return appendKeyToValidElement(
|
|
801
|
+
props.renderInlineBlock({ record: item }),
|
|
802
|
+
key
|
|
803
|
+
);
|
|
804
|
+
}),
|
|
764
805
|
...props.customNodeRules || props.customRules || []
|
|
765
806
|
]
|
|
766
807
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-datocms",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1",
|
|
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,9 +42,9 @@
|
|
|
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",
|
|
47
45
|
"hls.js": "^1.5.17",
|
|
46
|
+
"datocms-structured-text-generic-html-renderer": "^4.1.2",
|
|
47
|
+
"datocms-structured-text-utils": "^4.1.2",
|
|
48
48
|
"hyphenate-style-name": "^1.0.4"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|