vue-datocms 8.1.4 → 8.1.5-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 +2 -0
- package/dist/index.cjs.js +277 -41
- package/dist/index.d.ts +317 -28
- package/dist/index.esm.mjs +272 -22
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -35,12 +35,14 @@ A set of components and utilities to work faster with [DatoCMS](https://www.dato
|
|
|
35
35
|
|
|
36
36
|
[Components](https://vuejs.org/guide/essentials/component-basics.html):
|
|
37
37
|
|
|
38
|
+
- [`<ContentLink />`](src/components/ContentLink) for Visual Editing with click-to-edit overlays
|
|
38
39
|
- [`<Image />` and `<NakedImage />`](src/components/Image)
|
|
39
40
|
- [`<VideoPlayer />`](src/components/VideoPlayer)
|
|
40
41
|
- [`<StructuredText />`](src/components/StructuredText)
|
|
41
42
|
|
|
42
43
|
[Composables](https://vuejs.org/guide/reusability/composables.html):
|
|
43
44
|
|
|
45
|
+
- [`useContentLink`](src/composables/useContentLink) for Visual Editing
|
|
44
46
|
- [`useQuerySubscription`](src/composables/useQuerySubscription)
|
|
45
47
|
- [`useSiteSearch`](src/composables/useSiteSearch)
|
|
46
48
|
- [`useVideoPlayer`](src/composables/useVideoPlayer)
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,34 +1,177 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var vue = require('vue');
|
|
4
|
+
var contentLink = require('@datocms/content-link');
|
|
6
5
|
var hypenateStyleName = require('hyphenate-style-name');
|
|
7
6
|
var datocmsStructuredTextGenericHtmlRenderer = require('datocms-structured-text-generic-html-renderer');
|
|
8
7
|
var datocmsStructuredTextUtils = require('datocms-structured-text-utils');
|
|
9
8
|
var datocmsListen = require('datocms-listen');
|
|
10
9
|
|
|
11
|
-
function
|
|
10
|
+
function useContentLink(options = {}) {
|
|
11
|
+
const { enabled = true, onNavigateTo, root } = options;
|
|
12
|
+
const controller = vue.ref(null);
|
|
13
|
+
const onNavigateToRef = vue.ref(onNavigateTo);
|
|
14
|
+
vue.watch(
|
|
15
|
+
() => onNavigateTo,
|
|
16
|
+
(newCallback) => {
|
|
17
|
+
onNavigateToRef.value = newCallback;
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
const initializeController = () => {
|
|
21
|
+
const isEnabled = enabled === true || typeof enabled === "object" && enabled !== null;
|
|
22
|
+
if (!isEnabled) return;
|
|
23
|
+
if (controller.value) {
|
|
24
|
+
controller.value.dispose();
|
|
25
|
+
}
|
|
26
|
+
const controllerOptions = {};
|
|
27
|
+
if (typeof enabled === "object") {
|
|
28
|
+
controllerOptions.stripStega = enabled.stripStega;
|
|
29
|
+
}
|
|
30
|
+
if (onNavigateToRef.value) {
|
|
31
|
+
controllerOptions.onNavigateTo = (path) => {
|
|
32
|
+
var _a;
|
|
33
|
+
return (_a = onNavigateToRef.value) == null ? void 0 : _a.call(onNavigateToRef, path);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (root == null ? void 0 : root.value) {
|
|
37
|
+
controllerOptions.root = root.value;
|
|
38
|
+
}
|
|
39
|
+
controller.value = contentLink.createController(controllerOptions);
|
|
40
|
+
};
|
|
41
|
+
vue.onMounted(() => {
|
|
42
|
+
initializeController();
|
|
43
|
+
});
|
|
44
|
+
vue.onUnmounted(() => {
|
|
45
|
+
if (controller.value) {
|
|
46
|
+
controller.value.dispose();
|
|
47
|
+
controller.value = null;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (root) {
|
|
51
|
+
vue.watch(
|
|
52
|
+
root,
|
|
53
|
+
() => {
|
|
54
|
+
if (enabled) {
|
|
55
|
+
initializeController();
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{ flush: "post" }
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const enableClickToEdit = (opts) => {
|
|
62
|
+
var _a;
|
|
63
|
+
(_a = controller.value) == null ? void 0 : _a.enableClickToEdit(opts);
|
|
64
|
+
};
|
|
65
|
+
const disableClickToEdit = () => {
|
|
66
|
+
var _a;
|
|
67
|
+
(_a = controller.value) == null ? void 0 : _a.disableClickToEdit();
|
|
68
|
+
};
|
|
69
|
+
const isClickToEditEnabled = () => {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
return (_b = (_a = controller.value) == null ? void 0 : _a.isClickToEditEnabled()) != null ? _b : false;
|
|
72
|
+
};
|
|
73
|
+
const flashAll = (scrollToNearestTarget) => {
|
|
74
|
+
var _a;
|
|
75
|
+
(_a = controller.value) == null ? void 0 : _a.flashAll(scrollToNearestTarget);
|
|
76
|
+
};
|
|
77
|
+
const setCurrentPath = (path) => {
|
|
78
|
+
var _a;
|
|
79
|
+
(_a = controller.value) == null ? void 0 : _a.setCurrentPath(path);
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
controller,
|
|
83
|
+
enableClickToEdit,
|
|
84
|
+
disableClickToEdit,
|
|
85
|
+
isClickToEditEnabled,
|
|
86
|
+
flashAll,
|
|
87
|
+
setCurrentPath
|
|
88
|
+
};
|
|
89
|
+
}
|
|
12
90
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
91
|
+
const ContentLink = vue.defineComponent({
|
|
92
|
+
name: "DatocmsContentLink",
|
|
93
|
+
props: {
|
|
94
|
+
/**
|
|
95
|
+
* Callback when Web Previews plugin requests navigation.
|
|
96
|
+
* Use this to integrate with your router.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* With Vue Router: `(path) => router.push(path)`
|
|
100
|
+
* With Nuxt: `(path) => navigateTo(path)`
|
|
101
|
+
*/
|
|
102
|
+
onNavigateTo: {
|
|
103
|
+
type: Function,
|
|
104
|
+
required: false
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* Root element to limit scanning to (instead of document).
|
|
108
|
+
* Pass a ref to a parent element to limit the scope of content link scanning.
|
|
109
|
+
*/
|
|
110
|
+
root: {
|
|
111
|
+
type: Object,
|
|
112
|
+
required: false
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* Current pathname to sync with Web Previews plugin.
|
|
116
|
+
* This keeps the plugin in sync with the current page being previewed.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* With Vue Router: `route.path`
|
|
120
|
+
* With Nuxt: `route.path`
|
|
121
|
+
*/
|
|
122
|
+
currentPath: {
|
|
123
|
+
type: String,
|
|
124
|
+
required: false
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* Enable click-to-edit on mount. Pass true for default behavior or an object with scrollToNearestTarget.
|
|
128
|
+
* If undefined, click-to-edit is disabled and editors can use Alt/Option key for temporary activation.
|
|
129
|
+
*/
|
|
130
|
+
enableClickToEdit: {
|
|
131
|
+
type: [Boolean, Object],
|
|
132
|
+
required: false
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* Whether to strip stega encoding from text nodes after stamping.
|
|
136
|
+
*/
|
|
137
|
+
stripStega: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
required: false
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
setup(props) {
|
|
143
|
+
const {
|
|
144
|
+
enableClickToEdit: enableClickToEditFn,
|
|
145
|
+
setCurrentPath
|
|
146
|
+
} = useContentLink({
|
|
147
|
+
enabled: props.stripStega !== void 0 ? { stripStega: props.stripStega } : true,
|
|
148
|
+
onNavigateTo: props.onNavigateTo,
|
|
149
|
+
root: props.root
|
|
150
|
+
});
|
|
151
|
+
vue.onMounted(() => {
|
|
152
|
+
if (props.enableClickToEdit !== void 0) {
|
|
153
|
+
enableClickToEditFn(
|
|
154
|
+
props.enableClickToEdit === true ? void 0 : props.enableClickToEdit
|
|
155
|
+
);
|
|
24
156
|
}
|
|
25
157
|
});
|
|
158
|
+
vue.watch(
|
|
159
|
+
() => props.currentPath,
|
|
160
|
+
(newPath) => {
|
|
161
|
+
if (newPath !== void 0) {
|
|
162
|
+
setCurrentPath(newPath);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{ immediate: true }
|
|
166
|
+
);
|
|
167
|
+
return () => null;
|
|
26
168
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
169
|
+
});
|
|
170
|
+
const DatocmsContentLinkPlugin = {
|
|
171
|
+
install: (Vue) => {
|
|
172
|
+
Vue.component("DatocmsContentLink", ContentLink);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
32
175
|
|
|
33
176
|
const isSsr = () => {
|
|
34
177
|
return typeof window === "undefined";
|
|
@@ -60,7 +203,7 @@ const toCss = (object) => {
|
|
|
60
203
|
let result = "";
|
|
61
204
|
for (const styleName in object) {
|
|
62
205
|
if (Object.prototype.hasOwnProperty.call(object, styleName) && object[styleName]) {
|
|
63
|
-
result += `${
|
|
206
|
+
result += `${hypenateStyleName(styleName)}: ${object[styleName]}; `;
|
|
64
207
|
}
|
|
65
208
|
}
|
|
66
209
|
return result.length > 0 ? result : null;
|
|
@@ -279,67 +422,108 @@ const Image$1 = vue.defineComponent({
|
|
|
279
422
|
inheritAttrs: false,
|
|
280
423
|
emits: ["load"],
|
|
281
424
|
props: {
|
|
425
|
+
/** The actual response you get from a DatoCMS `responsiveImage` GraphQL query */
|
|
282
426
|
data: {
|
|
283
427
|
type: Object,
|
|
284
428
|
required: true
|
|
285
429
|
},
|
|
430
|
+
/** Additional CSS class for the `<picture />` tag */
|
|
286
431
|
pictureClass: {
|
|
287
432
|
type: String
|
|
288
433
|
},
|
|
434
|
+
/** Additional CSS class for the image inside the `<picture />` tag */
|
|
289
435
|
imgClass: {
|
|
290
436
|
type: String
|
|
291
437
|
},
|
|
438
|
+
/** Additional CSS class for the placeholder image */
|
|
292
439
|
placeholderClass: {
|
|
293
440
|
type: String
|
|
294
441
|
},
|
|
442
|
+
/** Duration (in ms) of the fade-in transition effect upoad image loading */
|
|
295
443
|
fadeInDuration: {
|
|
296
444
|
type: Number
|
|
297
445
|
},
|
|
446
|
+
/** @deprecated Use the intersectionThreshold prop */
|
|
298
447
|
intersectionTreshold: {
|
|
299
448
|
type: Number,
|
|
300
449
|
default: 0
|
|
301
450
|
},
|
|
451
|
+
/** Indicate at what percentage of the placeholder visibility the loading of the image should be triggered. A value of 0 means that as soon as even one pixel is visible, the callback will be run. A value of 1.0 means that the threshold isn't considered passed until every pixel is visible */
|
|
302
452
|
intersectionThreshold: {
|
|
303
453
|
type: Number
|
|
304
454
|
},
|
|
455
|
+
/** Margin around the placeholder. Can have values similar to the CSS margin property (top, right, bottom, left). The values can be percentages. This set of values serves to grow or shrink each side of the placeholder element's bounding box before computing intersections */
|
|
305
456
|
intersectionMargin: {
|
|
306
457
|
type: String,
|
|
307
458
|
default: "0px 0px 0px 0px"
|
|
308
459
|
},
|
|
460
|
+
/** Additional CSS rules to add to the `<picture />` tag */
|
|
309
461
|
pictureStyle: {
|
|
310
462
|
type: Object,
|
|
311
463
|
default: () => ({})
|
|
312
464
|
},
|
|
465
|
+
/** Additional CSS rules to add to the image inside the `<picture />` tag */
|
|
313
466
|
imgStyle: {
|
|
314
467
|
type: Object,
|
|
315
468
|
default: () => ({})
|
|
316
469
|
},
|
|
470
|
+
/** Additional CSS rules to add to the placeholder image */
|
|
317
471
|
placeholderStyle: {
|
|
318
472
|
type: Object,
|
|
319
473
|
default: () => ({})
|
|
320
474
|
},
|
|
475
|
+
/**
|
|
476
|
+
* The layout behavior of the image as the viewport changes size
|
|
477
|
+
*
|
|
478
|
+
* Possible values:
|
|
479
|
+
*
|
|
480
|
+
* * `intrinsic`: the image will scale the dimensions down for smaller viewports, but maintain the original dimensions for larger viewports
|
|
481
|
+
* * `fixed`: the image dimensions will not change as the viewport changes (no responsiveness) similar to the native img element
|
|
482
|
+
* * `responsive` (default): the image will scale the dimensions down for smaller viewports and scale up for larger viewports
|
|
483
|
+
* * `fill`: image will stretch both width and height to the dimensions of the parent element, provided the parent element is `relative`
|
|
484
|
+
**/
|
|
321
485
|
layout: {
|
|
322
486
|
type: String,
|
|
323
487
|
default: () => "intrinsic",
|
|
324
488
|
validator: (value) => ["intrinsic", "fixed", "responsive", "fill"].includes(value)
|
|
325
489
|
},
|
|
490
|
+
/** Defines how the image will fit into its parent container when using layout="fill" */
|
|
326
491
|
objectFit: {
|
|
327
492
|
type: String
|
|
328
493
|
},
|
|
494
|
+
/** Defines how the image is positioned within its parent element when using layout="fill". */
|
|
329
495
|
objectPosition: {
|
|
330
496
|
type: String
|
|
331
497
|
},
|
|
498
|
+
/** Whether the component should use a blurred image placeholder */
|
|
332
499
|
usePlaceholder: {
|
|
333
500
|
type: Boolean,
|
|
334
501
|
default: true
|
|
335
502
|
},
|
|
503
|
+
/**
|
|
504
|
+
* The HTML5 `sizes` attribute for the image
|
|
505
|
+
*
|
|
506
|
+
* Learn more about srcset and sizes:
|
|
507
|
+
* -> https://web.dev/learn/design/responsive-images/#sizes
|
|
508
|
+
* -> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-sizes
|
|
509
|
+
**/
|
|
336
510
|
sizes: {
|
|
337
511
|
type: String
|
|
338
512
|
},
|
|
513
|
+
/**
|
|
514
|
+
* When true, the image will be considered high priority. Lazy loading is automatically disabled, and fetchpriority="high" is added to the image.
|
|
515
|
+
* You should use the priority property on any image detected as the Largest Contentful Paint (LCP) element. It may be appropriate to have multiple priority images, as different images may be the LCP element for different viewport sizes.
|
|
516
|
+
* Should only be used when the image is visible above the fold.
|
|
517
|
+
**/
|
|
339
518
|
priority: {
|
|
340
519
|
type: Boolean,
|
|
341
520
|
default: false
|
|
342
521
|
},
|
|
522
|
+
/**
|
|
523
|
+
* If `data` does not contain `srcSet`, the candidates for the `srcset` of the image will be auto-generated based on these width multipliers
|
|
524
|
+
*
|
|
525
|
+
* Default candidate multipliers are [0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4]
|
|
526
|
+
**/
|
|
343
527
|
srcSetCandidates: {
|
|
344
528
|
type: Array,
|
|
345
529
|
validator: (values) => values.every((value) => {
|
|
@@ -347,6 +531,12 @@ const Image$1 = vue.defineComponent({
|
|
|
347
531
|
}),
|
|
348
532
|
default: () => [0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4]
|
|
349
533
|
},
|
|
534
|
+
/**
|
|
535
|
+
* Defines which referrer is sent when fetching the image
|
|
536
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy
|
|
537
|
+
*
|
|
538
|
+
* Defaults to `no-referrer-when-downgrade` to give more useful stats in DatoCMS Project Usages
|
|
539
|
+
**/
|
|
350
540
|
referrerPolicy: {
|
|
351
541
|
type: String,
|
|
352
542
|
default: "no-referrer-when-downgrade"
|
|
@@ -405,6 +595,10 @@ const Image$1 = vue.defineComponent({
|
|
|
405
595
|
const basePlaceholderStyle = __spreadValues$5({
|
|
406
596
|
transition,
|
|
407
597
|
opacity: showImage ? 0 : 1,
|
|
598
|
+
// During the opacity transition of the placeholder to the definitive version,
|
|
599
|
+
// hardware acceleration is triggered. This results in the browser trying to render the
|
|
600
|
+
// placeholder with your GPU, causing blurred edges. Solution: style the placeholder
|
|
601
|
+
// so the edges overflow the container
|
|
408
602
|
position: "absolute",
|
|
409
603
|
left: "-5%",
|
|
410
604
|
top: "-5%",
|
|
@@ -532,21 +726,40 @@ const NakedImage = vue.defineComponent({
|
|
|
532
726
|
name: "DatocmsNakedImage",
|
|
533
727
|
inheritAttrs: false,
|
|
534
728
|
props: {
|
|
729
|
+
/** The actual response you get from a DatoCMS `responsiveImage` GraphQL query */
|
|
535
730
|
data: {
|
|
536
731
|
type: Object,
|
|
537
732
|
required: true
|
|
538
733
|
},
|
|
734
|
+
/** Whether the component should use a blurred image placeholder */
|
|
539
735
|
usePlaceholder: {
|
|
540
736
|
type: Boolean,
|
|
541
737
|
default: true
|
|
542
738
|
},
|
|
739
|
+
/**
|
|
740
|
+
* The HTML5 `sizes` attribute for the image
|
|
741
|
+
*
|
|
742
|
+
* Learn more about srcset and sizes:
|
|
743
|
+
* -> https://web.dev/learn/design/responsive-images/#sizes
|
|
744
|
+
* -> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-sizes
|
|
745
|
+
**/
|
|
543
746
|
sizes: {
|
|
544
747
|
type: String
|
|
545
748
|
},
|
|
749
|
+
/**
|
|
750
|
+
* When true, the image will be considered high priority. Lazy loading is automatically disabled, and fetchpriority="high" is added to the image.
|
|
751
|
+
* You should use the priority property on any image detected as the Largest Contentful Paint (LCP) element. It may be appropriate to have multiple priority images, as different images may be the LCP element for different viewport sizes.
|
|
752
|
+
* Should only be used when the image is visible above the fold.
|
|
753
|
+
**/
|
|
546
754
|
priority: {
|
|
547
755
|
type: Boolean,
|
|
548
756
|
default: false
|
|
549
757
|
},
|
|
758
|
+
/**
|
|
759
|
+
* If `data` does not contain `srcSet`, the candidates for the `srcset` of the image will be auto-generated based on these width multipliers
|
|
760
|
+
*
|
|
761
|
+
* Default candidate multipliers are [0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4]
|
|
762
|
+
**/
|
|
550
763
|
srcSetCandidates: {
|
|
551
764
|
type: Array,
|
|
552
765
|
validator: (values) => values.every((value) => {
|
|
@@ -554,20 +767,30 @@ const NakedImage = vue.defineComponent({
|
|
|
554
767
|
}),
|
|
555
768
|
default: () => [0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4]
|
|
556
769
|
},
|
|
770
|
+
/** Additional CSS class for the root `<picture />` tag */
|
|
557
771
|
pictureClass: {
|
|
558
772
|
type: String
|
|
559
773
|
},
|
|
774
|
+
/** Additional CSS rules to add to the root `<picture />` tag */
|
|
560
775
|
pictureStyle: {
|
|
561
776
|
type: Object,
|
|
562
777
|
default: () => ({})
|
|
563
778
|
},
|
|
779
|
+
/** Additional CSS class for the `<img />` tag */
|
|
564
780
|
imgClass: {
|
|
565
781
|
type: String
|
|
566
782
|
},
|
|
783
|
+
/** Additional CSS rules to add to the `<img />` tag */
|
|
567
784
|
imgStyle: {
|
|
568
785
|
type: Object,
|
|
569
786
|
default: () => ({})
|
|
570
787
|
},
|
|
788
|
+
/**
|
|
789
|
+
* Defines which referrer is sent when fetching the image
|
|
790
|
+
* Read more: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#referrerpolicy
|
|
791
|
+
*
|
|
792
|
+
* Defaults to `no-referrer-when-downgrade` to give more useful stats in DatoCMS Project Usages
|
|
793
|
+
**/
|
|
571
794
|
referrerPolicy: {
|
|
572
795
|
type: String,
|
|
573
796
|
default: "no-referrer-when-downgrade"
|
|
@@ -669,33 +892,45 @@ function appendKeyToValidElement(element, key) {
|
|
|
669
892
|
const StructuredText = vue.defineComponent({
|
|
670
893
|
name: "DatocmsStructuredText",
|
|
671
894
|
props: {
|
|
895
|
+
/** The actual field value you get from DatoCMS **/
|
|
672
896
|
data: {
|
|
673
897
|
type: Object
|
|
674
898
|
},
|
|
899
|
+
/** @deprecated use customNodeRules **/
|
|
675
900
|
customRules: {
|
|
676
901
|
type: Array
|
|
677
902
|
},
|
|
903
|
+
/** A set of additional rules to convert the document to JSX **/
|
|
678
904
|
customNodeRules: {
|
|
679
905
|
type: Array
|
|
680
906
|
},
|
|
907
|
+
/** A set of additional rules to convert the document to JSX **/
|
|
681
908
|
customMarkRules: {
|
|
682
909
|
type: Array
|
|
683
910
|
},
|
|
911
|
+
/** Fuction that converts an 'inlineItem' node into a Vue component **/
|
|
684
912
|
renderInlineRecord: {
|
|
685
913
|
type: Function
|
|
686
914
|
},
|
|
915
|
+
/** Fuction that converts an 'itemLink' node into a Vue component **/
|
|
687
916
|
renderLinkToRecord: {
|
|
688
917
|
type: Function
|
|
689
918
|
},
|
|
919
|
+
/** Fuction that converts a 'block' node into a Vue component **/
|
|
690
920
|
renderBlock: {
|
|
691
921
|
type: Function
|
|
692
922
|
},
|
|
923
|
+
/** Fuction that converts an 'inlineBlock' node into a Vue component **/
|
|
693
924
|
renderInlineBlock: {
|
|
694
925
|
type: Function
|
|
695
926
|
},
|
|
927
|
+
/** Function that converts 'link' and 'itemLink' `meta` into HTML props */
|
|
696
928
|
metaTransformer: { type: Function },
|
|
929
|
+
/** Fuction that converts a simple string text into a Vue component **/
|
|
697
930
|
renderText: { type: Function },
|
|
931
|
+
/** React.createElement-like function to use to convert a node into a Vue component **/
|
|
698
932
|
renderNode: { type: Function },
|
|
933
|
+
/** Function to use to generate a Vue.Fragment **/
|
|
699
934
|
renderFragment: { type: Function }
|
|
700
935
|
},
|
|
701
936
|
setup(props) {
|
|
@@ -858,13 +1093,11 @@ const computedTitle = (title) => {
|
|
|
858
1093
|
return title ? { title } : void 0;
|
|
859
1094
|
};
|
|
860
1095
|
const computedPlaybackId = (muxPlaybackId, playbackId) => {
|
|
861
|
-
if (!(muxPlaybackId || playbackId))
|
|
862
|
-
return void 0;
|
|
1096
|
+
if (!(muxPlaybackId || playbackId)) return void 0;
|
|
863
1097
|
return { playbackId: `${muxPlaybackId || playbackId}` };
|
|
864
1098
|
};
|
|
865
1099
|
const computedStyle = (width, height) => {
|
|
866
|
-
if (!(width && height))
|
|
867
|
-
return void 0;
|
|
1100
|
+
if (!(width && height)) return void 0;
|
|
868
1101
|
return {
|
|
869
1102
|
style: {
|
|
870
1103
|
aspectRatio: `${width} / ${height}`
|
|
@@ -878,8 +1111,7 @@ const useVideoPlayer = ({
|
|
|
878
1111
|
data
|
|
879
1112
|
}) => {
|
|
880
1113
|
const { title, width, height, playbackId, muxPlaybackId, blurUpThumb } = data || {};
|
|
881
|
-
if (data === void 0)
|
|
882
|
-
return {};
|
|
1114
|
+
if (data === void 0) return {};
|
|
883
1115
|
return __spreadValues$3(__spreadValues$3(__spreadValues$3(__spreadValues$3({}, computedTitle(title) || {}), computedPlaybackId(muxPlaybackId, playbackId) || {}), computedStyle(width, height) || {}), computedPlaceholder(blurUpThumb) || {});
|
|
884
1116
|
};
|
|
885
1117
|
|
|
@@ -916,8 +1148,7 @@ var __objRest$1 = (source, exclude) => {
|
|
|
916
1148
|
};
|
|
917
1149
|
const isNil = (x) => x == void 0;
|
|
918
1150
|
const isKeyOf = (k, o) => {
|
|
919
|
-
if (isNil(o))
|
|
920
|
-
return false;
|
|
1151
|
+
if (isNil(o)) return false;
|
|
921
1152
|
return k in o;
|
|
922
1153
|
};
|
|
923
1154
|
const PropToAttrNameMap = {
|
|
@@ -930,21 +1161,15 @@ const PropToAttrNameMap = {
|
|
|
930
1161
|
};
|
|
931
1162
|
const toKebabCase = (string) => string.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
932
1163
|
const toNativeAttrName = (propName, propValue) => {
|
|
933
|
-
if (typeof propValue === "boolean" && !propValue)
|
|
934
|
-
|
|
935
|
-
if (
|
|
936
|
-
|
|
937
|
-
if (typeof propValue == void 0)
|
|
938
|
-
return void 0;
|
|
939
|
-
if (/[A-Z]/.test(propName))
|
|
940
|
-
return toKebabCase(propName);
|
|
1164
|
+
if (typeof propValue === "boolean" && !propValue) return void 0;
|
|
1165
|
+
if (isKeyOf(propName, PropToAttrNameMap)) return PropToAttrNameMap[propName];
|
|
1166
|
+
if (typeof propValue == void 0) return void 0;
|
|
1167
|
+
if (/[A-Z]/.test(propName)) return toKebabCase(propName);
|
|
941
1168
|
return propName;
|
|
942
1169
|
};
|
|
943
1170
|
const toNativeAttrValue = (propValue, propName) => {
|
|
944
|
-
if (Array.isArray(propValue))
|
|
945
|
-
|
|
946
|
-
if (typeof propValue === "boolean")
|
|
947
|
-
return propValue;
|
|
1171
|
+
if (Array.isArray(propValue)) return propValue.join(" ");
|
|
1172
|
+
if (typeof propValue === "boolean") return propValue;
|
|
948
1173
|
return propValue;
|
|
949
1174
|
};
|
|
950
1175
|
const toHTMLAttrs = (props = {}) => {
|
|
@@ -1242,7 +1467,7 @@ const VideoPlayer = vue.defineComponent({
|
|
|
1242
1467
|
"disableTracking",
|
|
1243
1468
|
"preload"
|
|
1244
1469
|
]);
|
|
1245
|
-
|
|
1470
|
+
import('@mux/mux-player');
|
|
1246
1471
|
const muxPlayerRef = vue.ref();
|
|
1247
1472
|
const computedProps = __spreadProps$2(__spreadValues$2({}, useVideoPlayer({ data })), {
|
|
1248
1473
|
disableCookies,
|
|
@@ -1592,6 +1817,14 @@ const toHead = (...args) => {
|
|
|
1592
1817
|
};
|
|
1593
1818
|
};
|
|
1594
1819
|
|
|
1820
|
+
Object.defineProperty(exports, 'decodeStega', {
|
|
1821
|
+
enumerable: true,
|
|
1822
|
+
get: function () { return contentLink.decodeStega; }
|
|
1823
|
+
});
|
|
1824
|
+
Object.defineProperty(exports, 'stripStega', {
|
|
1825
|
+
enumerable: true,
|
|
1826
|
+
get: function () { return contentLink.stripStega; }
|
|
1827
|
+
});
|
|
1595
1828
|
Object.defineProperty(exports, 'renderMarkRule', {
|
|
1596
1829
|
enumerable: true,
|
|
1597
1830
|
get: function () { return datocmsStructuredTextGenericHtmlRenderer.renderMarkRule; }
|
|
@@ -1608,6 +1841,8 @@ Object.defineProperty(exports, 'RenderError', {
|
|
|
1608
1841
|
enumerable: true,
|
|
1609
1842
|
get: function () { return datocmsStructuredTextUtils.RenderError; }
|
|
1610
1843
|
});
|
|
1844
|
+
exports.ContentLink = ContentLink;
|
|
1845
|
+
exports.DatocmsContentLinkPlugin = DatocmsContentLinkPlugin;
|
|
1611
1846
|
exports.DatocmsImagePlugin = DatocmsImagePlugin;
|
|
1612
1847
|
exports.DatocmsNakedImagePlugin = DatocmsNakedImagePlugin;
|
|
1613
1848
|
exports.DatocmsStructuredTextPlugin = DatocmsStructuredTextPlugin;
|
|
@@ -1623,6 +1858,7 @@ exports.isNil = isNil;
|
|
|
1623
1858
|
exports.toHead = toHead;
|
|
1624
1859
|
exports.toNativeAttrName = toNativeAttrName;
|
|
1625
1860
|
exports.toNativeAttrValue = toNativeAttrValue;
|
|
1861
|
+
exports.useContentLink = useContentLink;
|
|
1626
1862
|
exports.useQuerySubscription = useQuerySubscription;
|
|
1627
1863
|
exports.useSiteSearch = useSiteSearch;
|
|
1628
1864
|
exports.useVideoPlayer = useVideoPlayer;
|