vue-datocms 1.0.4 → 2.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/README.md +67 -55
- package/dist/index.d.ts +111 -37
- package/dist/index.esm.js +157 -214
- package/dist/index.min.js +165 -219
- package/dist/index.umd.js +165 -219
- package/package.json +16 -20
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
A set of components and utilities to work faster with [DatoCMS](https://www.datocms.com/) in Vue.js environments. Integrates seamlessy with [DatoCMS's GraphQL Content Delivery API](https://www.datocms.com/docs/content-delivery-api).
|
|
6
6
|
|
|
7
|
-
- Works with both Vue 2 and Vue 3;
|
|
7
|
+
- Works with both Vue 2 (only on JS projects, not TypeScript) and Vue 3;
|
|
8
8
|
- TypeScript ready;
|
|
9
9
|
- Compatible with any data-fetching library (axios, Apollo);
|
|
10
10
|
- Usable both client and server side;
|
|
@@ -12,7 +12,7 @@ A set of components and utilities to work faster with [DatoCMS](https://www.dato
|
|
|
12
12
|
|
|
13
13
|
<br /><br />
|
|
14
14
|
<a href="https://www.datocms.com/">
|
|
15
|
-
|
|
15
|
+
<img src="https://www.datocms.com/images/full_logo.svg" height="60">
|
|
16
16
|
</a>
|
|
17
17
|
<br /><br />
|
|
18
18
|
|
|
@@ -53,7 +53,7 @@ A set of components and utilities to work faster with [DatoCMS](https://www.dato
|
|
|
53
53
|
npm install vue-datocms
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
In Vue 2, also install `@vue/composition-api` as a dependency. Everything else should be similar to the example above for Vue 3.
|
|
56
|
+
In Vue 2, also install `@vue/composition-api` as a dependency. Everything else should be similar to the example above for Vue 3. Please note that with Vue 2 support is limited to JS-only projects. TypeScript + Vue 2 is not supported at the moment, sorry.
|
|
57
57
|
|
|
58
58
|
## Live real-time updates
|
|
59
59
|
|
|
@@ -79,19 +79,25 @@ In Vue.js v3, `subscribeToQuery` can be used to implement a custom hook. Please
|
|
|
79
79
|
|
|
80
80
|
### Out-of-the-box features
|
|
81
81
|
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
- Efficiently lazy
|
|
85
|
-
-
|
|
86
|
-
-
|
|
82
|
+
- Offers WebP version of images for browsers that support the format
|
|
83
|
+
- Generates multiple smaller images so smartphones and tablets don’t download desktop-sized images
|
|
84
|
+
- Efficiently lazy loads images to speed initial page load and save bandwidth
|
|
85
|
+
- Holds the image position so your page doesn’t jump while images load
|
|
86
|
+
- Uses either blur-up or background color techniques to show a preview of the image while it loads
|
|
87
|
+
|
|
88
|
+
## Intersection Observer
|
|
89
|
+
|
|
90
|
+
Intersection Observer is the API used to determine if the image is inside the viewport or not. [Browser support is really good](https://caniuse.com/intersectionobserver) - With Safari adding support in 12.1, all major browsers now support Intersection Observers natively.
|
|
91
|
+
|
|
92
|
+
If the IntersectionObserver object is not available, the component treats the image as it's always visible in the viewport. Feel free to add a [polyfill](https://www.npmjs.com/package/intersection-observer) so that it will also 100% work on older versions of iOS and IE11.
|
|
87
93
|
|
|
88
94
|
### Setup
|
|
89
95
|
|
|
90
96
|
You can register the component globally so it's available in all your apps:
|
|
91
97
|
|
|
92
98
|
```js
|
|
93
|
-
import Vue from
|
|
94
|
-
import { DatocmsImagePlugin } from
|
|
99
|
+
import Vue from 'vue';
|
|
100
|
+
import { DatocmsImagePlugin } from 'vue-datocms';
|
|
95
101
|
|
|
96
102
|
Vue.use(DatocmsImagePlugin);
|
|
97
103
|
```
|
|
@@ -99,11 +105,11 @@ Vue.use(DatocmsImagePlugin);
|
|
|
99
105
|
Or use it locally in any of your components:
|
|
100
106
|
|
|
101
107
|
```js
|
|
102
|
-
import { Image } from
|
|
108
|
+
import { Image } from 'vue-datocms';
|
|
103
109
|
|
|
104
110
|
export default {
|
|
105
111
|
components: {
|
|
106
|
-
|
|
112
|
+
'datocms-image': Image,
|
|
107
113
|
},
|
|
108
114
|
};
|
|
109
115
|
```
|
|
@@ -130,8 +136,8 @@ For a fully working example take a look at our [examples directory](https://gith
|
|
|
130
136
|
</template>
|
|
131
137
|
|
|
132
138
|
<script>
|
|
133
|
-
import { request } from
|
|
134
|
-
import { Image } from
|
|
139
|
+
import { request } from './lib/datocms';
|
|
140
|
+
import { Image } from 'vue-datocms';
|
|
135
141
|
|
|
136
142
|
const query = gql`
|
|
137
143
|
query {
|
|
@@ -169,7 +175,7 @@ const query = gql`
|
|
|
169
175
|
|
|
170
176
|
export default {
|
|
171
177
|
components: {
|
|
172
|
-
|
|
178
|
+
'datocms-image': Image,
|
|
173
179
|
},
|
|
174
180
|
data() {
|
|
175
181
|
return {
|
|
@@ -249,8 +255,8 @@ For a working example take a look at our [examples directory](https://github.com
|
|
|
249
255
|
</template>
|
|
250
256
|
|
|
251
257
|
<script>
|
|
252
|
-
import { request } from
|
|
253
|
-
import { toHead } from
|
|
258
|
+
import { request } from './lib/datocms';
|
|
259
|
+
import { toHead } from 'vue-datocms';
|
|
254
260
|
|
|
255
261
|
const query = gql`
|
|
256
262
|
query {
|
|
@@ -301,8 +307,8 @@ export default {
|
|
|
301
307
|
You can register the component globally so it's available in all your apps:
|
|
302
308
|
|
|
303
309
|
```js
|
|
304
|
-
import Vue from
|
|
305
|
-
import { DatocmsStructuredTextPlugin } from
|
|
310
|
+
import Vue from 'vue';
|
|
311
|
+
import { DatocmsStructuredTextPlugin } from 'vue-datocms';
|
|
306
312
|
|
|
307
313
|
Vue.use(DatocmsStructuredTextPlugin);
|
|
308
314
|
```
|
|
@@ -310,11 +316,11 @@ Vue.use(DatocmsStructuredTextPlugin);
|
|
|
310
316
|
Or use it locally in any of your components:
|
|
311
317
|
|
|
312
318
|
```js
|
|
313
|
-
import { StructuredText } from
|
|
319
|
+
import { StructuredText } from 'vue-datocms';
|
|
314
320
|
|
|
315
321
|
export default {
|
|
316
322
|
components: {
|
|
317
|
-
|
|
323
|
+
'datocms-structured-text': StructuredText,
|
|
318
324
|
},
|
|
319
325
|
};
|
|
320
326
|
```
|
|
@@ -336,8 +342,8 @@ export default {
|
|
|
336
342
|
</template>
|
|
337
343
|
|
|
338
344
|
<script>
|
|
339
|
-
import { request } from
|
|
340
|
-
import { StructuredText } from
|
|
345
|
+
import { request } from './lib/datocms';
|
|
346
|
+
import { StructuredText } from 'vue-datocms';
|
|
341
347
|
|
|
342
348
|
const query = gql`
|
|
343
349
|
query {
|
|
@@ -352,7 +358,7 @@ const query = gql`
|
|
|
352
358
|
|
|
353
359
|
export default {
|
|
354
360
|
components: {
|
|
355
|
-
|
|
361
|
+
'datocms-structured-text': StructuredText,
|
|
356
362
|
},
|
|
357
363
|
data() {
|
|
358
364
|
return {
|
|
@@ -425,9 +431,9 @@ You can also pass custom renderers for special nodes (inline records, record lin
|
|
|
425
431
|
</template>
|
|
426
432
|
|
|
427
433
|
<script>
|
|
428
|
-
import { request } from
|
|
429
|
-
import { StructuredText, Image } from
|
|
430
|
-
import { h } from
|
|
434
|
+
import { request } from './lib/datocms';
|
|
435
|
+
import { StructuredText, Image } from 'vue-datocms';
|
|
436
|
+
import { h } from 'vue';
|
|
431
437
|
|
|
432
438
|
const query = gql`
|
|
433
439
|
query {
|
|
@@ -448,7 +454,9 @@ const query = gql`
|
|
|
448
454
|
... on ImageRecord {
|
|
449
455
|
id
|
|
450
456
|
image {
|
|
451
|
-
responsiveImage(
|
|
457
|
+
responsiveImage(
|
|
458
|
+
imgixParams: { fit: crop, w: 300, h: 300, auto: format }
|
|
459
|
+
) {
|
|
452
460
|
srcSet
|
|
453
461
|
webpSrcSet
|
|
454
462
|
sizes
|
|
@@ -470,8 +478,8 @@ const query = gql`
|
|
|
470
478
|
|
|
471
479
|
export default {
|
|
472
480
|
components: {
|
|
473
|
-
|
|
474
|
-
|
|
481
|
+
'datocms-structured-text': StructuredText,
|
|
482
|
+
'datocms-image': Image,
|
|
475
483
|
},
|
|
476
484
|
data() {
|
|
477
485
|
return {
|
|
@@ -481,21 +489,17 @@ export default {
|
|
|
481
489
|
methods: {
|
|
482
490
|
renderInlineRecord: ({ record }) => {
|
|
483
491
|
switch (record.__typename) {
|
|
484
|
-
case
|
|
485
|
-
return h(
|
|
486
|
-
"a",
|
|
487
|
-
{ href: `/team/${record.slug}` },
|
|
488
|
-
record.firstName,
|
|
489
|
-
);
|
|
492
|
+
case 'TeamMemberRecord':
|
|
493
|
+
return h('a', { href: `/team/${record.slug}` }, record.firstName);
|
|
490
494
|
default:
|
|
491
495
|
return null;
|
|
492
496
|
}
|
|
493
497
|
},
|
|
494
498
|
renderLinkToRecord: ({ record, children, transformedMeta }) => {
|
|
495
499
|
switch (record.__typename) {
|
|
496
|
-
case
|
|
500
|
+
case 'TeamMemberRecord':
|
|
497
501
|
return h(
|
|
498
|
-
|
|
502
|
+
'a',
|
|
499
503
|
{ ...transformedMeta, href: `/team/${record.slug}` },
|
|
500
504
|
children,
|
|
501
505
|
);
|
|
@@ -505,8 +509,8 @@ export default {
|
|
|
505
509
|
},
|
|
506
510
|
renderBlock: ({ record }) => {
|
|
507
511
|
switch (record.__typename) {
|
|
508
|
-
case
|
|
509
|
-
return h(
|
|
512
|
+
case 'ImageRecord':
|
|
513
|
+
return h('datocms-image', {
|
|
510
514
|
data: record.image.responsiveImage,
|
|
511
515
|
});
|
|
512
516
|
default:
|
|
@@ -583,18 +587,19 @@ This component automatically renders all nodes except for `inline_item`, `item_l
|
|
|
583
587
|
- For `heading` nodes, you might want to add an anchor;
|
|
584
588
|
- For `code` nodes, you might want to use a custom sytax highlighting component;
|
|
585
589
|
|
|
586
|
-
In this case, you can easily override default rendering rules with the `
|
|
590
|
+
In this case, you can easily override default rendering rules with the `customNodeRules` and `customMarkRules` props.
|
|
587
591
|
|
|
588
592
|
```vue
|
|
589
593
|
<template>
|
|
590
594
|
<datocms-structured-text
|
|
591
595
|
:data="data.blogPost.content"
|
|
592
|
-
:
|
|
596
|
+
:customNodeRules="customNodeRules"
|
|
597
|
+
:customMarkRules="customMarkRules"
|
|
593
598
|
/>
|
|
594
599
|
</template>
|
|
595
600
|
|
|
596
601
|
<script>
|
|
597
|
-
import { StructuredText,
|
|
602
|
+
import { StructuredText, renderNodeRule, renderMarkRule } from "vue-datocms";
|
|
598
603
|
import { isHeading, isCode } from "datocms-structured-text-utils";
|
|
599
604
|
import { render as toPlainText } from 'datocms-structured-text-to-plain-text';
|
|
600
605
|
import SyntaxHighlight from './components/SyntaxHighlight';
|
|
@@ -607,8 +612,8 @@ export default {
|
|
|
607
612
|
data() {
|
|
608
613
|
return {
|
|
609
614
|
data: /* ... */,
|
|
610
|
-
|
|
611
|
-
|
|
615
|
+
customNodeRules: [
|
|
616
|
+
renderNodeRule(isHeading, ({ adapter: { renderNode: h }, node, children, key }) => {
|
|
612
617
|
const anchor = toPlainText(node)
|
|
613
618
|
.toLowerCase()
|
|
614
619
|
.replace(/ /g, '-')
|
|
@@ -622,7 +627,7 @@ export default {
|
|
|
622
627
|
]
|
|
623
628
|
);
|
|
624
629
|
}),
|
|
625
|
-
|
|
630
|
+
renderNodeRule(isCode, ({ adapter: { renderNode: h }, node, key }) => {
|
|
626
631
|
return h('syntax-highlight', {
|
|
627
632
|
key,
|
|
628
633
|
code: node.code,
|
|
@@ -631,6 +636,12 @@ export default {
|
|
|
631
636
|
}, []);
|
|
632
637
|
}),
|
|
633
638
|
],
|
|
639
|
+
customMarkRules: [
|
|
640
|
+
// convert "strong" marks into <b> tags
|
|
641
|
+
renderMarkRule('strong', ({ adapter: { renderNode: h }, mark, children, key }) => {
|
|
642
|
+
return h('b', {key}, children);
|
|
643
|
+
}),
|
|
644
|
+
],
|
|
634
645
|
};
|
|
635
646
|
},
|
|
636
647
|
};
|
|
@@ -641,12 +652,13 @@ Note: if you override the rules for `inline_item`, `item_link` or `block` nodes,
|
|
|
641
652
|
|
|
642
653
|
## Props
|
|
643
654
|
|
|
644
|
-
| prop | type
|
|
645
|
-
| ------------------ |
|
|
646
|
-
| data | `StructuredTextGraphQlResponse \| DastNode`
|
|
647
|
-
| renderInlineRecord | `({ record }) => VNode \| null`
|
|
648
|
-
| renderLinkToRecord | `({ record, children, transformedMeta }) => VNode \| null`
|
|
649
|
-
| renderBlock | `({ record }) => VNode \| null`
|
|
650
|
-
| metaTransformer | `({ node, meta }) => Object \| null`
|
|
651
|
-
|
|
|
652
|
-
|
|
|
655
|
+
| prop | type | required | description | default |
|
|
656
|
+
| ------------------ | ---------------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
|
|
657
|
+
| data | `StructuredTextGraphQlResponse \| DastNode` | :white_check_mark: | The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from DatoCMS | |
|
|
658
|
+
| renderInlineRecord | `({ record }) => VNode \| null` | Only required if document contains `inlineItem` nodes | Convert an `inlineItem` DAST node into a VNode | `[]` |
|
|
659
|
+
| renderLinkToRecord | `({ record, children, transformedMeta }) => VNode \| null` | Only required if document contains `itemLink` nodes | Convert an `itemLink` DAST node into a VNode | `null` |
|
|
660
|
+
| renderBlock | `({ record }) => VNode \| null` | Only required if document contains `block` nodes | Convert a `block` DAST node into a VNode | `null` |
|
|
661
|
+
| metaTransformer | `({ node, meta }) => Object \| null` | :x: | Transform `link` and `itemLink` meta property into HTML props | [See function](https://github.com/datocms/structured-text/blob/main/packages/generic-html-renderer/src/index.ts#L61) |
|
|
662
|
+
| customNodeRules | `Array<RenderRule>` | :x: | Customize how nodes are converted in JSX (use `renderNodeRule()` to generate) | `null` |
|
|
663
|
+
| customMarkRules | `Array<RenderMarkRule>` | :x: | Customize how marks are converted in JSX (use `renderMarkRule()` to generate) | `null` |
|
|
664
|
+
| renderText | `(text: string, key: string) => VNode \| string \| null` | :x: | Convert a simple string text into a VNode | `(text) => text` |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { PropType, VNodeProps, VNode } from 'vue
|
|
3
|
-
import { TransformedMeta, TransformMetaFn } from 'datocms-structured-text-generic-html-renderer';
|
|
4
|
-
export { renderRule } from 'datocms-structured-text-generic-html-renderer';
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, VNodeProps, VNode } from 'vue';
|
|
3
|
+
import { TransformedMeta, RenderMarkRule, TransformMetaFn } from 'datocms-structured-text-generic-html-renderer';
|
|
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';
|
|
6
6
|
export { RenderError, Document as StructuredTextDocument, StructuredText as StructuredTextGraphQlResponse } from 'datocms-structured-text-utils';
|
|
7
7
|
|
|
@@ -29,7 +29,7 @@ declare type ResponsiveImageType = {
|
|
|
29
29
|
/** Title attribute (`title`) for the image */
|
|
30
30
|
title?: string;
|
|
31
31
|
};
|
|
32
|
-
declare const Image:
|
|
32
|
+
declare const Image: vue.DefineComponent<{
|
|
33
33
|
/** The actual response you get from a DatoCMS `responsiveImage` GraphQL query */
|
|
34
34
|
data: {
|
|
35
35
|
type: PropType<ResponsiveImageType>;
|
|
@@ -72,22 +72,53 @@ declare const Image: vue_demi.DefineComponent<{
|
|
|
72
72
|
type: BooleanConstructor;
|
|
73
73
|
};
|
|
74
74
|
}, {
|
|
75
|
-
inView:
|
|
76
|
-
elRef:
|
|
77
|
-
loaded:
|
|
75
|
+
inView: vue.Ref<boolean>;
|
|
76
|
+
elRef: vue.Ref<HTMLElement | null>;
|
|
77
|
+
loaded: vue.Ref<boolean>;
|
|
78
78
|
handleLoad: () => void;
|
|
79
|
-
}, unknown, {}, {},
|
|
80
|
-
|
|
81
|
-
data:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
79
|
+
}, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
80
|
+
/** The actual response you get from a DatoCMS `responsiveImage` GraphQL query */
|
|
81
|
+
data: {
|
|
82
|
+
type: PropType<ResponsiveImageType>;
|
|
83
|
+
required: true;
|
|
84
|
+
};
|
|
85
|
+
/** Additional CSS class for the image inside the `<picture />` tag */
|
|
86
|
+
pictureClass: {
|
|
87
|
+
type: StringConstructor;
|
|
88
|
+
};
|
|
89
|
+
/** Duration (in ms) of the fade-in transition effect upoad image loading */
|
|
90
|
+
fadeInDuration: {
|
|
91
|
+
type: NumberConstructor;
|
|
92
|
+
};
|
|
93
|
+
/** @deprecated Use the intersectionThreshold prop */
|
|
94
|
+
intersectionTreshold: {
|
|
95
|
+
type: NumberConstructor;
|
|
96
|
+
default: number;
|
|
97
|
+
};
|
|
98
|
+
/** 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 */
|
|
99
|
+
intersectionThreshold: {
|
|
100
|
+
type: NumberConstructor;
|
|
101
|
+
};
|
|
102
|
+
/** 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 */
|
|
103
|
+
intersectionMargin: {
|
|
104
|
+
type: StringConstructor;
|
|
105
|
+
default: string;
|
|
106
|
+
};
|
|
107
|
+
/** Wheter enable lazy loading or not */
|
|
108
|
+
lazyLoad: {
|
|
109
|
+
type: BooleanConstructor;
|
|
110
|
+
default: boolean;
|
|
111
|
+
};
|
|
112
|
+
/** Additional CSS rules to add to the image inside the `<picture />` tag */
|
|
113
|
+
pictureStyle: {
|
|
114
|
+
type: ObjectConstructor;
|
|
115
|
+
default: () => {};
|
|
116
|
+
};
|
|
117
|
+
/** Wheter the image wrapper should explicitely declare the width of the image or keep it fluid */
|
|
118
|
+
explicitWidth: {
|
|
119
|
+
type: BooleanConstructor;
|
|
120
|
+
};
|
|
121
|
+
}>>, {
|
|
91
122
|
lazyLoad: boolean;
|
|
92
123
|
intersectionTreshold: number;
|
|
93
124
|
intersectionMargin: string;
|
|
@@ -100,8 +131,8 @@ declare const DatocmsImagePlugin: {
|
|
|
100
131
|
|
|
101
132
|
declare type AdapterReturn = VNode | string | null;
|
|
102
133
|
declare const defaultAdapter: {
|
|
103
|
-
renderNode: (tagName: string, props?: VNodeProps
|
|
104
|
-
renderMark: (tagName: string, props?: VNodeProps
|
|
134
|
+
renderNode: (tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn;
|
|
135
|
+
renderMark: (tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn;
|
|
105
136
|
renderFragment: (children: AdapterReturn[], key: string) => AdapterReturn;
|
|
106
137
|
renderText: (text: string, key: string) => AdapterReturn;
|
|
107
138
|
};
|
|
@@ -120,14 +151,67 @@ declare type RenderRecordLinkContext = {
|
|
|
120
151
|
declare type RenderBlockContext = {
|
|
121
152
|
record: Record$1;
|
|
122
153
|
};
|
|
123
|
-
declare const StructuredText:
|
|
154
|
+
declare const StructuredText: vue.DefineComponent<{
|
|
124
155
|
/** The actual field value you get from DatoCMS **/
|
|
125
156
|
data: {
|
|
126
|
-
type: PropType<StructuredText$1<Record$1> | Document | Node | null | undefined>;
|
|
157
|
+
type: PropType<StructuredText$1<Record$1, Record$1> | Document | Node | null | undefined>;
|
|
158
|
+
};
|
|
159
|
+
/** @deprecated use customNodeRules **/
|
|
160
|
+
customRules: {
|
|
161
|
+
type: PropType<RenderRule<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
|
|
127
162
|
};
|
|
128
163
|
/** A set of additional rules to convert the document to JSX **/
|
|
164
|
+
customNodeRules: {
|
|
165
|
+
type: PropType<RenderRule<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
|
|
166
|
+
};
|
|
167
|
+
/** A set of additional rules to convert the document to JSX **/
|
|
168
|
+
customMarkRules: {
|
|
169
|
+
type: PropType<RenderMarkRule<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
|
|
170
|
+
};
|
|
171
|
+
/** Fuction that converts an 'inlineItem' node into React **/
|
|
172
|
+
renderInlineRecord: {
|
|
173
|
+
type: PropType<(context: RenderInlineRecordContext) => AdapterReturn>;
|
|
174
|
+
};
|
|
175
|
+
/** Fuction that converts an 'itemLink' node into React **/
|
|
176
|
+
renderLinkToRecord: {
|
|
177
|
+
type: PropType<(context: RenderRecordLinkContext) => AdapterReturn>;
|
|
178
|
+
};
|
|
179
|
+
/** Fuction that converts a 'block' node into React **/
|
|
180
|
+
renderBlock: {
|
|
181
|
+
type: PropType<(context: RenderBlockContext) => AdapterReturn>;
|
|
182
|
+
};
|
|
183
|
+
/** Function that converts 'link' and 'itemLink' `meta` into HTML props */
|
|
184
|
+
metaTransformer: {
|
|
185
|
+
type: PropType<TransformMetaFn>;
|
|
186
|
+
};
|
|
187
|
+
/** Fuction that converts a simple string text into React **/
|
|
188
|
+
renderText: {
|
|
189
|
+
type: PropType<(text: string, key: string) => AdapterReturn>;
|
|
190
|
+
};
|
|
191
|
+
/** React.createElement-like function to use to convert a node into React **/
|
|
192
|
+
renderNode: {
|
|
193
|
+
type: PropType<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn>;
|
|
194
|
+
};
|
|
195
|
+
/** Function to use to generate a React.Fragment **/
|
|
196
|
+
renderFragment: {
|
|
197
|
+
type: PropType<(children: AdapterReturn[], key: string) => AdapterReturn>;
|
|
198
|
+
};
|
|
199
|
+
}, () => RenderResult<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
200
|
+
/** The actual field value you get from DatoCMS **/
|
|
201
|
+
data: {
|
|
202
|
+
type: PropType<StructuredText$1<Record$1, Record$1> | Document | Node | null | undefined>;
|
|
203
|
+
};
|
|
204
|
+
/** @deprecated use customNodeRules **/
|
|
129
205
|
customRules: {
|
|
130
|
-
type: PropType<RenderRule<(tagName: string, props?: VNodeProps
|
|
206
|
+
type: PropType<RenderRule<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
|
|
207
|
+
};
|
|
208
|
+
/** A set of additional rules to convert the document to JSX **/
|
|
209
|
+
customNodeRules: {
|
|
210
|
+
type: PropType<RenderRule<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
|
|
211
|
+
};
|
|
212
|
+
/** A set of additional rules to convert the document to JSX **/
|
|
213
|
+
customMarkRules: {
|
|
214
|
+
type: PropType<RenderMarkRule<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
|
|
131
215
|
};
|
|
132
216
|
/** Fuction that converts an 'inlineItem' node into React **/
|
|
133
217
|
renderInlineRecord: {
|
|
@@ -151,23 +235,13 @@ declare const StructuredText: vue_demi.DefineComponent<{
|
|
|
151
235
|
};
|
|
152
236
|
/** React.createElement-like function to use to convert a node into React **/
|
|
153
237
|
renderNode: {
|
|
154
|
-
type: PropType<(tagName: string, props?: VNodeProps
|
|
238
|
+
type: PropType<(tagName: string, props?: VNodeProps, childOrChildren?: AdapterReturn | AdapterReturn[]) => AdapterReturn>;
|
|
155
239
|
};
|
|
156
240
|
/** Function to use to generate a React.Fragment **/
|
|
157
241
|
renderFragment: {
|
|
158
242
|
type: PropType<(children: AdapterReturn[], key: string) => AdapterReturn>;
|
|
159
243
|
};
|
|
160
|
-
}
|
|
161
|
-
data?: StructuredText$1<Record$1> | Document | Node | null | undefined;
|
|
162
|
-
customRules?: RenderRule<(tagName: string, props?: VNodeProps | undefined, childOrChildren?: AdapterReturn | AdapterReturn[] | undefined) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[] | undefined;
|
|
163
|
-
renderInlineRecord?: ((context: RenderInlineRecordContext) => AdapterReturn) | undefined;
|
|
164
|
-
renderLinkToRecord?: ((context: RenderRecordLinkContext) => AdapterReturn) | undefined;
|
|
165
|
-
renderBlock?: ((context: RenderBlockContext) => AdapterReturn) | undefined;
|
|
166
|
-
metaTransformer?: TransformMetaFn | undefined;
|
|
167
|
-
renderText?: ((text: string, key: string) => AdapterReturn) | undefined;
|
|
168
|
-
renderNode?: ((tagName: string, props?: VNodeProps | undefined, childOrChildren?: AdapterReturn | AdapterReturn[] | undefined) => AdapterReturn) | undefined;
|
|
169
|
-
renderFragment?: ((children: AdapterReturn[], key: string) => AdapterReturn) | undefined;
|
|
170
|
-
}>, {}>;
|
|
244
|
+
}>>, {}>;
|
|
171
245
|
declare const DatocmsStructuredTextPlugin: {
|
|
172
246
|
install: (Vue: any) => void;
|
|
173
247
|
};
|