vue-datocms 1.0.5 → 2.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 -57
- package/dist/index.d.ts +111 -37
- package/dist/index.esm.js +157 -214
- package/dist/index.min.js +165 -220
- package/dist/index.umd.js +165 -220
- 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
|
|
7
|
+
- Works with 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
|
-
|
|
56
|
+
If you want to use this package with Vue 2, please, install `vue-datocms@1`. The latest versions are only compatible with Vue 3.
|
|
57
57
|
|
|
58
58
|
## Live real-time updates
|
|
59
59
|
|
|
@@ -67,8 +67,6 @@ Live updates are great both to get instant previews of your content while editin
|
|
|
67
67
|
|
|
68
68
|
Please consult the [datocms-listen package documentation](https://www.npmjs.com/package/datocms-listen) to learn more about how to configure `subscribeToQuery`.
|
|
69
69
|
|
|
70
|
-
In Vue.js v2, the subscription can be created inside of the [`mounted`](https://vuejs.org/v2/api/#mounted) lifecycle method. Please refer to the [query-subscription example](./examples/query-subscription/src/App.vue#L47) for a sample implementation.
|
|
71
|
-
|
|
72
70
|
In Vue.js v3, `subscribeToQuery` can be used to implement a custom hook. Please take a look at the [React.js one](https://github.com/datocms/react-datocms/blob/master/src/useQuerySubscription/index.ts) for a sample implementation.
|
|
73
71
|
|
|
74
72
|
## Progressive/responsive image
|
|
@@ -79,19 +77,25 @@ In Vue.js v3, `subscribeToQuery` can be used to implement a custom hook. Please
|
|
|
79
77
|
|
|
80
78
|
### Out-of-the-box features
|
|
81
79
|
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
- Efficiently lazy
|
|
85
|
-
-
|
|
86
|
-
-
|
|
80
|
+
- Offers WebP version of images for browsers that support the format
|
|
81
|
+
- Generates multiple smaller images so smartphones and tablets don’t download desktop-sized images
|
|
82
|
+
- Efficiently lazy loads images to speed initial page load and save bandwidth
|
|
83
|
+
- Holds the image position so your page doesn’t jump while images load
|
|
84
|
+
- Uses either blur-up or background color techniques to show a preview of the image while it loads
|
|
85
|
+
|
|
86
|
+
## Intersection Observer
|
|
87
|
+
|
|
88
|
+
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.
|
|
89
|
+
|
|
90
|
+
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
91
|
|
|
88
92
|
### Setup
|
|
89
93
|
|
|
90
94
|
You can register the component globally so it's available in all your apps:
|
|
91
95
|
|
|
92
96
|
```js
|
|
93
|
-
import Vue from
|
|
94
|
-
import { DatocmsImagePlugin } from
|
|
97
|
+
import Vue from 'vue';
|
|
98
|
+
import { DatocmsImagePlugin } from 'vue-datocms';
|
|
95
99
|
|
|
96
100
|
Vue.use(DatocmsImagePlugin);
|
|
97
101
|
```
|
|
@@ -99,11 +103,11 @@ Vue.use(DatocmsImagePlugin);
|
|
|
99
103
|
Or use it locally in any of your components:
|
|
100
104
|
|
|
101
105
|
```js
|
|
102
|
-
import { Image } from
|
|
106
|
+
import { Image } from 'vue-datocms';
|
|
103
107
|
|
|
104
108
|
export default {
|
|
105
109
|
components: {
|
|
106
|
-
|
|
110
|
+
'datocms-image': Image,
|
|
107
111
|
},
|
|
108
112
|
};
|
|
109
113
|
```
|
|
@@ -130,8 +134,8 @@ For a fully working example take a look at our [examples directory](https://gith
|
|
|
130
134
|
</template>
|
|
131
135
|
|
|
132
136
|
<script>
|
|
133
|
-
import { request } from
|
|
134
|
-
import { Image } from
|
|
137
|
+
import { request } from './lib/datocms';
|
|
138
|
+
import { Image } from 'vue-datocms';
|
|
135
139
|
|
|
136
140
|
const query = gql`
|
|
137
141
|
query {
|
|
@@ -169,7 +173,7 @@ const query = gql`
|
|
|
169
173
|
|
|
170
174
|
export default {
|
|
171
175
|
components: {
|
|
172
|
-
|
|
176
|
+
'datocms-image': Image,
|
|
173
177
|
},
|
|
174
178
|
data() {
|
|
175
179
|
return {
|
|
@@ -249,8 +253,8 @@ For a working example take a look at our [examples directory](https://github.com
|
|
|
249
253
|
</template>
|
|
250
254
|
|
|
251
255
|
<script>
|
|
252
|
-
import { request } from
|
|
253
|
-
import { toHead } from
|
|
256
|
+
import { request } from './lib/datocms';
|
|
257
|
+
import { toHead } from 'vue-datocms';
|
|
254
258
|
|
|
255
259
|
const query = gql`
|
|
256
260
|
query {
|
|
@@ -301,8 +305,8 @@ export default {
|
|
|
301
305
|
You can register the component globally so it's available in all your apps:
|
|
302
306
|
|
|
303
307
|
```js
|
|
304
|
-
import Vue from
|
|
305
|
-
import { DatocmsStructuredTextPlugin } from
|
|
308
|
+
import Vue from 'vue';
|
|
309
|
+
import { DatocmsStructuredTextPlugin } from 'vue-datocms';
|
|
306
310
|
|
|
307
311
|
Vue.use(DatocmsStructuredTextPlugin);
|
|
308
312
|
```
|
|
@@ -310,11 +314,11 @@ Vue.use(DatocmsStructuredTextPlugin);
|
|
|
310
314
|
Or use it locally in any of your components:
|
|
311
315
|
|
|
312
316
|
```js
|
|
313
|
-
import { StructuredText } from
|
|
317
|
+
import { StructuredText } from 'vue-datocms';
|
|
314
318
|
|
|
315
319
|
export default {
|
|
316
320
|
components: {
|
|
317
|
-
|
|
321
|
+
'datocms-structured-text': StructuredText,
|
|
318
322
|
},
|
|
319
323
|
};
|
|
320
324
|
```
|
|
@@ -336,8 +340,8 @@ export default {
|
|
|
336
340
|
</template>
|
|
337
341
|
|
|
338
342
|
<script>
|
|
339
|
-
import { request } from
|
|
340
|
-
import { StructuredText } from
|
|
343
|
+
import { request } from './lib/datocms';
|
|
344
|
+
import { StructuredText } from 'vue-datocms';
|
|
341
345
|
|
|
342
346
|
const query = gql`
|
|
343
347
|
query {
|
|
@@ -352,7 +356,7 @@ const query = gql`
|
|
|
352
356
|
|
|
353
357
|
export default {
|
|
354
358
|
components: {
|
|
355
|
-
|
|
359
|
+
'datocms-structured-text': StructuredText,
|
|
356
360
|
},
|
|
357
361
|
data() {
|
|
358
362
|
return {
|
|
@@ -425,9 +429,9 @@ You can also pass custom renderers for special nodes (inline records, record lin
|
|
|
425
429
|
</template>
|
|
426
430
|
|
|
427
431
|
<script>
|
|
428
|
-
import { request } from
|
|
429
|
-
import { StructuredText, Image } from
|
|
430
|
-
import { h } from
|
|
432
|
+
import { request } from './lib/datocms';
|
|
433
|
+
import { StructuredText, Image } from 'vue-datocms';
|
|
434
|
+
import { h } from 'vue';
|
|
431
435
|
|
|
432
436
|
const query = gql`
|
|
433
437
|
query {
|
|
@@ -448,7 +452,9 @@ const query = gql`
|
|
|
448
452
|
... on ImageRecord {
|
|
449
453
|
id
|
|
450
454
|
image {
|
|
451
|
-
responsiveImage(
|
|
455
|
+
responsiveImage(
|
|
456
|
+
imgixParams: { fit: crop, w: 300, h: 300, auto: format }
|
|
457
|
+
) {
|
|
452
458
|
srcSet
|
|
453
459
|
webpSrcSet
|
|
454
460
|
sizes
|
|
@@ -470,8 +476,8 @@ const query = gql`
|
|
|
470
476
|
|
|
471
477
|
export default {
|
|
472
478
|
components: {
|
|
473
|
-
|
|
474
|
-
|
|
479
|
+
'datocms-structured-text': StructuredText,
|
|
480
|
+
'datocms-image': Image,
|
|
475
481
|
},
|
|
476
482
|
data() {
|
|
477
483
|
return {
|
|
@@ -481,21 +487,17 @@ export default {
|
|
|
481
487
|
methods: {
|
|
482
488
|
renderInlineRecord: ({ record }) => {
|
|
483
489
|
switch (record.__typename) {
|
|
484
|
-
case
|
|
485
|
-
return h(
|
|
486
|
-
"a",
|
|
487
|
-
{ href: `/team/${record.slug}` },
|
|
488
|
-
record.firstName,
|
|
489
|
-
);
|
|
490
|
+
case 'TeamMemberRecord':
|
|
491
|
+
return h('a', { href: `/team/${record.slug}` }, record.firstName);
|
|
490
492
|
default:
|
|
491
493
|
return null;
|
|
492
494
|
}
|
|
493
495
|
},
|
|
494
496
|
renderLinkToRecord: ({ record, children, transformedMeta }) => {
|
|
495
497
|
switch (record.__typename) {
|
|
496
|
-
case
|
|
498
|
+
case 'TeamMemberRecord':
|
|
497
499
|
return h(
|
|
498
|
-
|
|
500
|
+
'a',
|
|
499
501
|
{ ...transformedMeta, href: `/team/${record.slug}` },
|
|
500
502
|
children,
|
|
501
503
|
);
|
|
@@ -505,8 +507,8 @@ export default {
|
|
|
505
507
|
},
|
|
506
508
|
renderBlock: ({ record }) => {
|
|
507
509
|
switch (record.__typename) {
|
|
508
|
-
case
|
|
509
|
-
return h(
|
|
510
|
+
case 'ImageRecord':
|
|
511
|
+
return h('datocms-image', {
|
|
510
512
|
data: record.image.responsiveImage,
|
|
511
513
|
});
|
|
512
514
|
default:
|
|
@@ -583,18 +585,19 @@ This component automatically renders all nodes except for `inline_item`, `item_l
|
|
|
583
585
|
- For `heading` nodes, you might want to add an anchor;
|
|
584
586
|
- For `code` nodes, you might want to use a custom sytax highlighting component;
|
|
585
587
|
|
|
586
|
-
In this case, you can easily override default rendering rules with the `
|
|
588
|
+
In this case, you can easily override default rendering rules with the `customNodeRules` and `customMarkRules` props.
|
|
587
589
|
|
|
588
590
|
```vue
|
|
589
591
|
<template>
|
|
590
592
|
<datocms-structured-text
|
|
591
593
|
:data="data.blogPost.content"
|
|
592
|
-
:
|
|
594
|
+
:customNodeRules="customNodeRules"
|
|
595
|
+
:customMarkRules="customMarkRules"
|
|
593
596
|
/>
|
|
594
597
|
</template>
|
|
595
598
|
|
|
596
599
|
<script>
|
|
597
|
-
import { StructuredText,
|
|
600
|
+
import { StructuredText, renderNodeRule, renderMarkRule } from "vue-datocms";
|
|
598
601
|
import { isHeading, isCode } from "datocms-structured-text-utils";
|
|
599
602
|
import { render as toPlainText } from 'datocms-structured-text-to-plain-text';
|
|
600
603
|
import SyntaxHighlight from './components/SyntaxHighlight';
|
|
@@ -607,8 +610,8 @@ export default {
|
|
|
607
610
|
data() {
|
|
608
611
|
return {
|
|
609
612
|
data: /* ... */,
|
|
610
|
-
|
|
611
|
-
|
|
613
|
+
customNodeRules: [
|
|
614
|
+
renderNodeRule(isHeading, ({ adapter: { renderNode: h }, node, children, key }) => {
|
|
612
615
|
const anchor = toPlainText(node)
|
|
613
616
|
.toLowerCase()
|
|
614
617
|
.replace(/ /g, '-')
|
|
@@ -622,7 +625,7 @@ export default {
|
|
|
622
625
|
]
|
|
623
626
|
);
|
|
624
627
|
}),
|
|
625
|
-
|
|
628
|
+
renderNodeRule(isCode, ({ adapter: { renderNode: h }, node, key }) => {
|
|
626
629
|
return h('syntax-highlight', {
|
|
627
630
|
key,
|
|
628
631
|
code: node.code,
|
|
@@ -631,6 +634,12 @@ export default {
|
|
|
631
634
|
}, []);
|
|
632
635
|
}),
|
|
633
636
|
],
|
|
637
|
+
customMarkRules: [
|
|
638
|
+
// convert "strong" marks into <b> tags
|
|
639
|
+
renderMarkRule('strong', ({ adapter: { renderNode: h }, mark, children, key }) => {
|
|
640
|
+
return h('b', {key}, children);
|
|
641
|
+
}),
|
|
642
|
+
],
|
|
634
643
|
};
|
|
635
644
|
},
|
|
636
645
|
};
|
|
@@ -641,12 +650,13 @@ Note: if you override the rules for `inline_item`, `item_link` or `block` nodes,
|
|
|
641
650
|
|
|
642
651
|
## Props
|
|
643
652
|
|
|
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
|
-
|
|
|
653
|
+
| prop | type | required | description | default |
|
|
654
|
+
| ------------------ | ---------------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
|
|
655
|
+
| data | `StructuredTextGraphQlResponse \| DastNode` | :white_check_mark: | The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from DatoCMS | |
|
|
656
|
+
| renderInlineRecord | `({ record }) => VNode \| null` | Only required if document contains `inlineItem` nodes | Convert an `inlineItem` DAST node into a VNode | `[]` |
|
|
657
|
+
| renderLinkToRecord | `({ record, children, transformedMeta }) => VNode \| null` | Only required if document contains `itemLink` nodes | Convert an `itemLink` DAST node into a VNode | `null` |
|
|
658
|
+
| renderBlock | `({ record }) => VNode \| null` | Only required if document contains `block` nodes | Convert a `block` DAST node into a VNode | `null` |
|
|
659
|
+
| 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) |
|
|
660
|
+
| customNodeRules | `Array<RenderRule>` | :x: | Customize how nodes are converted in JSX (use `renderNodeRule()` to generate) | `null` |
|
|
661
|
+
| customMarkRules | `Array<RenderMarkRule>` | :x: | Customize how marks are converted in JSX (use `renderMarkRule()` to generate) | `null` |
|
|
662
|
+
| 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
|
};
|