vue-datocms 1.0.1 → 1.1.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 +129 -48
- package/dist/index.d.ts +13 -3
- package/dist/index.esm.js +74 -58
- package/dist/index.min.js +72 -56
- package/dist/index.umd.js +72 -56
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -4,12 +4,18 @@
|
|
|
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;
|
|
11
11
|
- Compatible with vanilla Vue, Nuxt.js and pretty much any other Vue-based solution;
|
|
12
12
|
|
|
13
|
+
<br /><br />
|
|
14
|
+
<a href="https://www.datocms.com/">
|
|
15
|
+
<img src="https://www.datocms.com/images/full_logo.svg" height="60">
|
|
16
|
+
</a>
|
|
17
|
+
<br /><br />
|
|
18
|
+
|
|
13
19
|
## Table of Contents
|
|
14
20
|
|
|
15
21
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
@@ -47,7 +53,7 @@ A set of components and utilities to work faster with [DatoCMS](https://www.dato
|
|
|
47
53
|
npm install vue-datocms
|
|
48
54
|
```
|
|
49
55
|
|
|
50
|
-
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.
|
|
51
57
|
|
|
52
58
|
## Live real-time updates
|
|
53
59
|
|
|
@@ -73,19 +79,25 @@ In Vue.js v3, `subscribeToQuery` can be used to implement a custom hook. Please
|
|
|
73
79
|
|
|
74
80
|
### Out-of-the-box features
|
|
75
81
|
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
- Efficiently lazy
|
|
79
|
-
-
|
|
80
|
-
-
|
|
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.
|
|
81
93
|
|
|
82
94
|
### Setup
|
|
83
95
|
|
|
84
96
|
You can register the component globally so it's available in all your apps:
|
|
85
97
|
|
|
86
98
|
```js
|
|
87
|
-
import Vue from
|
|
88
|
-
import { DatocmsImagePlugin } from
|
|
99
|
+
import Vue from 'vue';
|
|
100
|
+
import { DatocmsImagePlugin } from 'vue-datocms';
|
|
89
101
|
|
|
90
102
|
Vue.use(DatocmsImagePlugin);
|
|
91
103
|
```
|
|
@@ -93,11 +105,11 @@ Vue.use(DatocmsImagePlugin);
|
|
|
93
105
|
Or use it locally in any of your components:
|
|
94
106
|
|
|
95
107
|
```js
|
|
96
|
-
import { Image } from
|
|
108
|
+
import { Image } from 'vue-datocms';
|
|
97
109
|
|
|
98
110
|
export default {
|
|
99
111
|
components: {
|
|
100
|
-
|
|
112
|
+
'datocms-image': Image,
|
|
101
113
|
},
|
|
102
114
|
};
|
|
103
115
|
```
|
|
@@ -124,8 +136,8 @@ For a fully working example take a look at our [examples directory](https://gith
|
|
|
124
136
|
</template>
|
|
125
137
|
|
|
126
138
|
<script>
|
|
127
|
-
import { request } from
|
|
128
|
-
import { Image } from
|
|
139
|
+
import { request } from './lib/datocms';
|
|
140
|
+
import { Image } from 'vue-datocms';
|
|
129
141
|
|
|
130
142
|
const query = gql`
|
|
131
143
|
query {
|
|
@@ -163,7 +175,7 @@ const query = gql`
|
|
|
163
175
|
|
|
164
176
|
export default {
|
|
165
177
|
components: {
|
|
166
|
-
|
|
178
|
+
'datocms-image': Image,
|
|
167
179
|
},
|
|
168
180
|
data() {
|
|
169
181
|
return {
|
|
@@ -243,8 +255,8 @@ For a working example take a look at our [examples directory](https://github.com
|
|
|
243
255
|
</template>
|
|
244
256
|
|
|
245
257
|
<script>
|
|
246
|
-
import { request } from
|
|
247
|
-
import { toHead } from
|
|
258
|
+
import { request } from './lib/datocms';
|
|
259
|
+
import { toHead } from 'vue-datocms';
|
|
248
260
|
|
|
249
261
|
const query = gql`
|
|
250
262
|
query {
|
|
@@ -295,8 +307,8 @@ export default {
|
|
|
295
307
|
You can register the component globally so it's available in all your apps:
|
|
296
308
|
|
|
297
309
|
```js
|
|
298
|
-
import Vue from
|
|
299
|
-
import { DatocmsStructuredTextPlugin } from
|
|
310
|
+
import Vue from 'vue';
|
|
311
|
+
import { DatocmsStructuredTextPlugin } from 'vue-datocms';
|
|
300
312
|
|
|
301
313
|
Vue.use(DatocmsStructuredTextPlugin);
|
|
302
314
|
```
|
|
@@ -304,11 +316,11 @@ Vue.use(DatocmsStructuredTextPlugin);
|
|
|
304
316
|
Or use it locally in any of your components:
|
|
305
317
|
|
|
306
318
|
```js
|
|
307
|
-
import { StructuredText } from
|
|
319
|
+
import { StructuredText } from 'vue-datocms';
|
|
308
320
|
|
|
309
321
|
export default {
|
|
310
322
|
components: {
|
|
311
|
-
|
|
323
|
+
'datocms-structured-text': StructuredText,
|
|
312
324
|
},
|
|
313
325
|
};
|
|
314
326
|
```
|
|
@@ -330,8 +342,8 @@ export default {
|
|
|
330
342
|
</template>
|
|
331
343
|
|
|
332
344
|
<script>
|
|
333
|
-
import { request } from
|
|
334
|
-
import { StructuredText } from
|
|
345
|
+
import { request } from './lib/datocms';
|
|
346
|
+
import { StructuredText } from 'vue-datocms';
|
|
335
347
|
|
|
336
348
|
const query = gql`
|
|
337
349
|
query {
|
|
@@ -346,7 +358,7 @@ const query = gql`
|
|
|
346
358
|
|
|
347
359
|
export default {
|
|
348
360
|
components: {
|
|
349
|
-
|
|
361
|
+
'datocms-structured-text': StructuredText,
|
|
350
362
|
},
|
|
351
363
|
data() {
|
|
352
364
|
return {
|
|
@@ -419,9 +431,9 @@ You can also pass custom renderers for special nodes (inline records, record lin
|
|
|
419
431
|
</template>
|
|
420
432
|
|
|
421
433
|
<script>
|
|
422
|
-
import { request } from
|
|
423
|
-
import { StructuredText, Image } from
|
|
424
|
-
import { h } from
|
|
434
|
+
import { request } from './lib/datocms';
|
|
435
|
+
import { StructuredText, Image } from 'vue-datocms';
|
|
436
|
+
import { h } from 'vue-demi';
|
|
425
437
|
|
|
426
438
|
const query = gql`
|
|
427
439
|
query {
|
|
@@ -442,7 +454,9 @@ const query = gql`
|
|
|
442
454
|
... on ImageRecord {
|
|
443
455
|
id
|
|
444
456
|
image {
|
|
445
|
-
responsiveImage(
|
|
457
|
+
responsiveImage(
|
|
458
|
+
imgixParams: { fit: crop, w: 300, h: 300, auto: format }
|
|
459
|
+
) {
|
|
446
460
|
srcSet
|
|
447
461
|
webpSrcSet
|
|
448
462
|
sizes
|
|
@@ -464,8 +478,8 @@ const query = gql`
|
|
|
464
478
|
|
|
465
479
|
export default {
|
|
466
480
|
components: {
|
|
467
|
-
|
|
468
|
-
|
|
481
|
+
'datocms-structured-text': StructuredText,
|
|
482
|
+
'datocms-image': Image,
|
|
469
483
|
},
|
|
470
484
|
data() {
|
|
471
485
|
return {
|
|
@@ -475,21 +489,17 @@ export default {
|
|
|
475
489
|
methods: {
|
|
476
490
|
renderInlineRecord: ({ record }) => {
|
|
477
491
|
switch (record.__typename) {
|
|
478
|
-
case
|
|
479
|
-
return h(
|
|
480
|
-
"a",
|
|
481
|
-
{ href: `/team/${record.slug}` },
|
|
482
|
-
record.firstName,
|
|
483
|
-
);
|
|
492
|
+
case 'TeamMemberRecord':
|
|
493
|
+
return h('a', { href: `/team/${record.slug}` }, record.firstName);
|
|
484
494
|
default:
|
|
485
495
|
return null;
|
|
486
496
|
}
|
|
487
497
|
},
|
|
488
498
|
renderLinkToRecord: ({ record, children, transformedMeta }) => {
|
|
489
499
|
switch (record.__typename) {
|
|
490
|
-
case
|
|
500
|
+
case 'TeamMemberRecord':
|
|
491
501
|
return h(
|
|
492
|
-
|
|
502
|
+
'a',
|
|
493
503
|
{ ...transformedMeta, href: `/team/${record.slug}` },
|
|
494
504
|
children,
|
|
495
505
|
);
|
|
@@ -499,8 +509,8 @@ export default {
|
|
|
499
509
|
},
|
|
500
510
|
renderBlock: ({ record }) => {
|
|
501
511
|
switch (record.__typename) {
|
|
502
|
-
case
|
|
503
|
-
return h(
|
|
512
|
+
case 'ImageRecord':
|
|
513
|
+
return h('datocms-image', {
|
|
504
514
|
data: record.image.responsiveImage,
|
|
505
515
|
});
|
|
506
516
|
default:
|
|
@@ -570,14 +580,85 @@ export default {
|
|
|
570
580
|
</script>
|
|
571
581
|
```
|
|
572
582
|
|
|
583
|
+
## Override default rendering of nodes
|
|
584
|
+
|
|
585
|
+
This component automatically renders all nodes except for `inline_item`, `item_link` and `block` using a set of default rules, but you might want to customize those. For example:
|
|
586
|
+
|
|
587
|
+
- For `heading` nodes, you might want to add an anchor;
|
|
588
|
+
- For `code` nodes, you might want to use a custom sytax highlighting component;
|
|
589
|
+
|
|
590
|
+
In this case, you can easily override default rendering rules with the `customNodeRules` and `customMarkRules` props.
|
|
591
|
+
|
|
592
|
+
```vue
|
|
593
|
+
<template>
|
|
594
|
+
<datocms-structured-text
|
|
595
|
+
:data="data.blogPost.content"
|
|
596
|
+
:customNodeRules="customNodeRules"
|
|
597
|
+
:customMarkRules="customMarkRules"
|
|
598
|
+
/>
|
|
599
|
+
</template>
|
|
600
|
+
|
|
601
|
+
<script>
|
|
602
|
+
import { StructuredText, renderNodeRule, renderMarkRule } from "vue-datocms";
|
|
603
|
+
import { isHeading, isCode } from "datocms-structured-text-utils";
|
|
604
|
+
import { render as toPlainText } from 'datocms-structured-text-to-plain-text';
|
|
605
|
+
import SyntaxHighlight from './components/SyntaxHighlight';
|
|
606
|
+
|
|
607
|
+
export default {
|
|
608
|
+
components: {
|
|
609
|
+
"datocms-structured-text": StructuredText,
|
|
610
|
+
"syntax-highlight": SyntaxHighlight,
|
|
611
|
+
},
|
|
612
|
+
data() {
|
|
613
|
+
return {
|
|
614
|
+
data: /* ... */,
|
|
615
|
+
customNodeRules: [
|
|
616
|
+
renderNodeRule(isHeading, ({ adapter: { renderNode: h }, node, children, key }) => {
|
|
617
|
+
const anchor = toPlainText(node)
|
|
618
|
+
.toLowerCase()
|
|
619
|
+
.replace(/ /g, '-')
|
|
620
|
+
.replace(/[^\w-]+/g, '');
|
|
621
|
+
|
|
622
|
+
return h(
|
|
623
|
+
`h${node.level}`, { key }, [
|
|
624
|
+
...children,
|
|
625
|
+
h('a', { attrs: { id: anchor } }, []),
|
|
626
|
+
h('a', { attrs: { href: `#${anchor}` } }, []),
|
|
627
|
+
]
|
|
628
|
+
);
|
|
629
|
+
}),
|
|
630
|
+
renderNodeRule(isCode, ({ adapter: { renderNode: h }, node, key }) => {
|
|
631
|
+
return h('syntax-highlight', {
|
|
632
|
+
key,
|
|
633
|
+
code: node.code,
|
|
634
|
+
language: node.language,
|
|
635
|
+
linesToBeHighlighted: node.highlight,
|
|
636
|
+
}, []);
|
|
637
|
+
}),
|
|
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
|
+
],
|
|
645
|
+
};
|
|
646
|
+
},
|
|
647
|
+
};
|
|
648
|
+
</script>
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
Note: if you override the rules for `inline_item`, `item_link` or `block` nodes, then the `renderInlineRecord`, `renderLinkToRecord` and `renderBlock` props won't be considered!
|
|
652
|
+
|
|
573
653
|
## Props
|
|
574
654
|
|
|
575
|
-
| prop | type
|
|
576
|
-
| ------------------ |
|
|
577
|
-
| data | `StructuredTextGraphQlResponse \| DastNode`
|
|
578
|
-
| renderInlineRecord | `({ record }) => VNode \| null`
|
|
579
|
-
| renderLinkToRecord | `({ record, children, transformedMeta }) => VNode \| null`
|
|
580
|
-
| renderBlock | `({ record }) => VNode \| null`
|
|
581
|
-
| metaTransformer | `({ node, meta }) => Object \| null`
|
|
582
|
-
|
|
|
583
|
-
|
|
|
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
1
|
import * as vue_demi from 'vue-demi';
|
|
2
2
|
import { PropType, VNodeProps, VNode } from 'vue-demi';
|
|
3
|
-
import { TransformedMeta, TransformMetaFn } from 'datocms-structured-text-generic-html-renderer';
|
|
4
|
-
export { renderRule } from 'datocms-structured-text-generic-html-renderer';
|
|
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
|
|
|
@@ -125,10 +125,18 @@ declare const StructuredText: vue_demi.DefineComponent<{
|
|
|
125
125
|
data: {
|
|
126
126
|
type: PropType<StructuredText$1<Record$1> | Document | Node | null | undefined>;
|
|
127
127
|
};
|
|
128
|
-
/**
|
|
128
|
+
/** @deprecated use customNodeRules **/
|
|
129
129
|
customRules: {
|
|
130
130
|
type: PropType<RenderRule<(tagName: string, props?: VNodeProps | undefined, childOrChildren?: AdapterReturn | AdapterReturn[] | undefined) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
|
|
131
131
|
};
|
|
132
|
+
/** A set of additional rules to convert the document to JSX **/
|
|
133
|
+
customNodeRules: {
|
|
134
|
+
type: PropType<RenderRule<(tagName: string, props?: VNodeProps | undefined, childOrChildren?: AdapterReturn | AdapterReturn[] | undefined) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
|
|
135
|
+
};
|
|
136
|
+
/** A set of additional rules to convert the document to JSX **/
|
|
137
|
+
customMarkRules: {
|
|
138
|
+
type: PropType<RenderMarkRule<(tagName: string, props?: VNodeProps | undefined, childOrChildren?: AdapterReturn | AdapterReturn[] | undefined) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[]>;
|
|
139
|
+
};
|
|
132
140
|
/** Fuction that converts an 'inlineItem' node into React **/
|
|
133
141
|
renderInlineRecord: {
|
|
134
142
|
type: PropType<(context: RenderInlineRecordContext) => AdapterReturn>;
|
|
@@ -160,6 +168,8 @@ declare const StructuredText: vue_demi.DefineComponent<{
|
|
|
160
168
|
}, () => RenderResult<(tagName: string, props?: VNodeProps | undefined, childOrChildren?: AdapterReturn | AdapterReturn[] | undefined) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>, unknown, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, Record<string, any>, string, VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<{} & {
|
|
161
169
|
data?: StructuredText$1<Record$1> | Document | Node | null | undefined;
|
|
162
170
|
customRules?: RenderRule<(tagName: string, props?: VNodeProps | undefined, childOrChildren?: AdapterReturn | AdapterReturn[] | undefined) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[] | undefined;
|
|
171
|
+
customNodeRules?: RenderRule<(tagName: string, props?: VNodeProps | undefined, childOrChildren?: AdapterReturn | AdapterReturn[] | undefined) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[] | undefined;
|
|
172
|
+
customMarkRules?: RenderMarkRule<(tagName: string, props?: VNodeProps | undefined, childOrChildren?: AdapterReturn | AdapterReturn[] | undefined) => AdapterReturn, (text: string, key: string) => AdapterReturn, (children: AdapterReturn[], key: string) => AdapterReturn>[] | undefined;
|
|
163
173
|
renderInlineRecord?: ((context: RenderInlineRecordContext) => AdapterReturn) | undefined;
|
|
164
174
|
renderLinkToRecord?: ((context: RenderRecordLinkContext) => AdapterReturn) | undefined;
|
|
165
175
|
renderBlock?: ((context: RenderBlockContext) => AdapterReturn) | undefined;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import hypenateStyleName from 'hyphenate-style-name';
|
|
2
|
-
import { isVue3, h, defineComponent, ref, onMounted, onBeforeUnmount
|
|
3
|
-
import { render,
|
|
4
|
-
export { renderRule } from 'datocms-structured-text-generic-html-renderer';
|
|
5
|
-
import { isInlineItem, RenderError, isStructuredText, isItemLink, isBlock } from 'datocms-structured-text-utils';
|
|
6
|
-
export { RenderError
|
|
2
|
+
import { isVue3, h, defineComponent, ref, onMounted, onBeforeUnmount } from 'vue-demi';
|
|
3
|
+
import { render, renderNodeRule, defaultMetaTransformer } from 'datocms-structured-text-generic-html-renderer';
|
|
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';
|
|
6
|
+
export { RenderError } from 'datocms-structured-text-utils';
|
|
7
7
|
|
|
8
8
|
var __defProp$2 = Object.defineProperty;
|
|
9
9
|
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
@@ -348,11 +348,12 @@ const hAdapter = (tagName, props, childOrChildren) => {
|
|
|
348
348
|
const defaultAdapter = {
|
|
349
349
|
renderNode: hAdapter,
|
|
350
350
|
renderMark: hAdapter,
|
|
351
|
-
renderFragment: (children, key) =>
|
|
351
|
+
renderFragment: (children, key) => children,
|
|
352
352
|
renderText: (text, key) => text
|
|
353
353
|
};
|
|
354
354
|
function appendKeyToValidElement(element, key) {
|
|
355
355
|
if (isVue3) {
|
|
356
|
+
const {isVNode, cloneVNode} = require("vue");
|
|
356
357
|
if (isVNode(element) && element.key === null) {
|
|
357
358
|
return cloneVNode(element, {key});
|
|
358
359
|
}
|
|
@@ -371,6 +372,12 @@ const StructuredText = defineComponent({
|
|
|
371
372
|
customRules: {
|
|
372
373
|
type: Array
|
|
373
374
|
},
|
|
375
|
+
customNodeRules: {
|
|
376
|
+
type: Array
|
|
377
|
+
},
|
|
378
|
+
customMarkRules: {
|
|
379
|
+
type: Array
|
|
380
|
+
},
|
|
374
381
|
renderInlineRecord: {
|
|
375
382
|
type: Function
|
|
376
383
|
},
|
|
@@ -387,58 +394,67 @@ const StructuredText = defineComponent({
|
|
|
387
394
|
},
|
|
388
395
|
setup(props) {
|
|
389
396
|
return () => {
|
|
390
|
-
return render({
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
397
|
+
return render(props.data, {
|
|
398
|
+
adapter: {
|
|
399
|
+
renderText: props.renderText || defaultAdapter.renderText,
|
|
400
|
+
renderNode: props.renderNode || defaultAdapter.renderNode,
|
|
401
|
+
renderFragment: props.renderFragment || defaultAdapter.renderFragment
|
|
402
|
+
},
|
|
403
|
+
metaTransformer: props.metaTransformer,
|
|
404
|
+
customMarkRules: props.customMarkRules,
|
|
405
|
+
customNodeRules: [
|
|
406
|
+
renderNodeRule(isRoot, ({adapter: {renderNode}, key, children}) => {
|
|
407
|
+
return renderNode("div", {key}, children);
|
|
408
|
+
}),
|
|
409
|
+
renderNodeRule(isInlineItem, ({node, key}) => {
|
|
410
|
+
if (!props.renderInlineRecord) {
|
|
411
|
+
throw new RenderError(`The Structured Text document contains an 'inlineItem' node, but no 'renderInlineRecord' prop is specified!`, node);
|
|
412
|
+
}
|
|
413
|
+
if (!isStructuredText(props.data) || !props.data.links) {
|
|
414
|
+
throw new RenderError(`The Structured Text document contains an 'inlineItem' node, but .links is not present!`, node);
|
|
415
|
+
}
|
|
416
|
+
const item = props.data.links.find((item2) => item2.id === node.item);
|
|
417
|
+
if (!item) {
|
|
418
|
+
throw new RenderError(`The Structured Text document contains an 'inlineItem' node, but cannot find a record with ID ${node.item} inside .links!`, node);
|
|
419
|
+
}
|
|
420
|
+
return appendKeyToValidElement(props.renderInlineRecord({record: item}), key);
|
|
421
|
+
}),
|
|
422
|
+
renderNodeRule(isItemLink, ({node, key, children}) => {
|
|
423
|
+
if (!props.renderLinkToRecord) {
|
|
424
|
+
throw new RenderError(`The Structured Text document contains an 'itemLink' node, but no 'renderLinkToRecord' prop is specified!`, node);
|
|
425
|
+
}
|
|
426
|
+
if (!isStructuredText(props.data) || !props.data.links) {
|
|
427
|
+
throw new RenderError(`The Structured Text document contains an 'itemLink' node, but .links is not present!`, node);
|
|
428
|
+
}
|
|
429
|
+
const item = props.data.links.find((item2) => item2.id === node.item);
|
|
430
|
+
if (!item) {
|
|
431
|
+
throw new RenderError(`The Structured Text document contains an 'itemLink' node, but cannot find a record with ID ${node.item} inside .links!`, node);
|
|
432
|
+
}
|
|
433
|
+
return appendKeyToValidElement(props.renderLinkToRecord({
|
|
434
|
+
record: item,
|
|
435
|
+
children,
|
|
436
|
+
transformedMeta: node.meta ? (props.metaTransformer || defaultMetaTransformer)({
|
|
437
|
+
node,
|
|
438
|
+
meta: node.meta
|
|
439
|
+
}) : null
|
|
440
|
+
}), key);
|
|
441
|
+
}),
|
|
442
|
+
renderNodeRule(isBlock, ({node, key}) => {
|
|
443
|
+
if (!props.renderBlock) {
|
|
444
|
+
throw new RenderError(`The Structured Text document contains a 'block' node, but no 'renderBlock' prop is specified!`, node);
|
|
445
|
+
}
|
|
446
|
+
if (!isStructuredText(props.data) || !props.data.blocks) {
|
|
447
|
+
throw new RenderError(`The Structured Text document contains a 'block' node, but .blocks is not present!`, node);
|
|
448
|
+
}
|
|
449
|
+
const item = props.data.blocks.find((item2) => item2.id === node.item);
|
|
450
|
+
if (!item) {
|
|
451
|
+
throw new RenderError(`The Structured Text document contains a 'block' node, but cannot find a record with ID ${node.item} inside .blocks!`, node);
|
|
452
|
+
}
|
|
453
|
+
return appendKeyToValidElement(props.renderBlock({record: item}), key);
|
|
454
|
+
}),
|
|
455
|
+
...props.customNodeRules || props.customRules || []
|
|
456
|
+
]
|
|
457
|
+
});
|
|
442
458
|
};
|
|
443
459
|
}
|
|
444
460
|
});
|
package/dist/index.min.js
CHANGED
|
@@ -337,13 +337,14 @@ const hAdapter = (tagName, props, childOrChildren) => {
|
|
|
337
337
|
const defaultAdapter = {
|
|
338
338
|
renderNode: hAdapter,
|
|
339
339
|
renderMark: hAdapter,
|
|
340
|
-
renderFragment: (children, key) =>
|
|
340
|
+
renderFragment: (children, key) => children,
|
|
341
341
|
renderText: (text, key) => text
|
|
342
342
|
};
|
|
343
343
|
function appendKeyToValidElement(element, key) {
|
|
344
344
|
if (vueDemi.isVue3) {
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
const {isVNode, cloneVNode} = require("vue");
|
|
346
|
+
if (isVNode(element) && element.key === null) {
|
|
347
|
+
return cloneVNode(element, {key});
|
|
347
348
|
}
|
|
348
349
|
} else if (element && typeof element === "object" && (element.key === null || element.key === void 0)) {
|
|
349
350
|
element.key = key;
|
|
@@ -360,6 +361,12 @@ const StructuredText = vueDemi.defineComponent({
|
|
|
360
361
|
customRules: {
|
|
361
362
|
type: Array
|
|
362
363
|
},
|
|
364
|
+
customNodeRules: {
|
|
365
|
+
type: Array
|
|
366
|
+
},
|
|
367
|
+
customMarkRules: {
|
|
368
|
+
type: Array
|
|
369
|
+
},
|
|
363
370
|
renderInlineRecord: {
|
|
364
371
|
type: Function
|
|
365
372
|
},
|
|
@@ -376,58 +383,67 @@ const StructuredText = vueDemi.defineComponent({
|
|
|
376
383
|
},
|
|
377
384
|
setup(props) {
|
|
378
385
|
return () => {
|
|
379
|
-
return datocmsStructuredTextGenericHtmlRenderer.render({
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
386
|
+
return datocmsStructuredTextGenericHtmlRenderer.render(props.data, {
|
|
387
|
+
adapter: {
|
|
388
|
+
renderText: props.renderText || defaultAdapter.renderText,
|
|
389
|
+
renderNode: props.renderNode || defaultAdapter.renderNode,
|
|
390
|
+
renderFragment: props.renderFragment || defaultAdapter.renderFragment
|
|
391
|
+
},
|
|
392
|
+
metaTransformer: props.metaTransformer,
|
|
393
|
+
customMarkRules: props.customMarkRules,
|
|
394
|
+
customNodeRules: [
|
|
395
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isRoot, ({adapter: {renderNode}, key, children}) => {
|
|
396
|
+
return renderNode("div", {key}, children);
|
|
397
|
+
}),
|
|
398
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isInlineItem, ({node, key}) => {
|
|
399
|
+
if (!props.renderInlineRecord) {
|
|
400
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'inlineItem' node, but no 'renderInlineRecord' prop is specified!`, node);
|
|
401
|
+
}
|
|
402
|
+
if (!datocmsStructuredTextUtils.isStructuredText(props.data) || !props.data.links) {
|
|
403
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'inlineItem' node, but .links is not present!`, node);
|
|
404
|
+
}
|
|
405
|
+
const item = props.data.links.find((item2) => item2.id === node.item);
|
|
406
|
+
if (!item) {
|
|
407
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'inlineItem' node, but cannot find a record with ID ${node.item} inside .links!`, node);
|
|
408
|
+
}
|
|
409
|
+
return appendKeyToValidElement(props.renderInlineRecord({record: item}), key);
|
|
410
|
+
}),
|
|
411
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isItemLink, ({node, key, children}) => {
|
|
412
|
+
if (!props.renderLinkToRecord) {
|
|
413
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'itemLink' node, but no 'renderLinkToRecord' prop is specified!`, node);
|
|
414
|
+
}
|
|
415
|
+
if (!datocmsStructuredTextUtils.isStructuredText(props.data) || !props.data.links) {
|
|
416
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'itemLink' node, but .links is not present!`, node);
|
|
417
|
+
}
|
|
418
|
+
const item = props.data.links.find((item2) => item2.id === node.item);
|
|
419
|
+
if (!item) {
|
|
420
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'itemLink' node, but cannot find a record with ID ${node.item} inside .links!`, node);
|
|
421
|
+
}
|
|
422
|
+
return appendKeyToValidElement(props.renderLinkToRecord({
|
|
423
|
+
record: item,
|
|
424
|
+
children,
|
|
425
|
+
transformedMeta: node.meta ? (props.metaTransformer || datocmsStructuredTextGenericHtmlRenderer.defaultMetaTransformer)({
|
|
426
|
+
node,
|
|
427
|
+
meta: node.meta
|
|
428
|
+
}) : null
|
|
429
|
+
}), key);
|
|
430
|
+
}),
|
|
431
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isBlock, ({node, key}) => {
|
|
432
|
+
if (!props.renderBlock) {
|
|
433
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains a 'block' node, but no 'renderBlock' prop is specified!`, node);
|
|
434
|
+
}
|
|
435
|
+
if (!datocmsStructuredTextUtils.isStructuredText(props.data) || !props.data.blocks) {
|
|
436
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains a 'block' node, but .blocks is not present!`, node);
|
|
437
|
+
}
|
|
438
|
+
const item = props.data.blocks.find((item2) => item2.id === node.item);
|
|
439
|
+
if (!item) {
|
|
440
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains a 'block' node, but cannot find a record with ID ${node.item} inside .blocks!`, node);
|
|
441
|
+
}
|
|
442
|
+
return appendKeyToValidElement(props.renderBlock({record: item}), key);
|
|
443
|
+
}),
|
|
444
|
+
...props.customNodeRules || props.customRules || []
|
|
445
|
+
]
|
|
446
|
+
});
|
|
431
447
|
};
|
|
432
448
|
}
|
|
433
449
|
});
|
|
@@ -473,4 +489,4 @@ const toHead = (...args) => {
|
|
|
473
489
|
});
|
|
474
490
|
})
|
|
475
491
|
};
|
|
476
|
-
};Object.defineProperty(exports,'
|
|
492
|
+
};Object.defineProperty(exports,'renderMarkRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderMarkRule;}});Object.defineProperty(exports,'renderNodeRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderNodeRule;}});Object.defineProperty(exports,'renderRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderNodeRule;}});Object.defineProperty(exports,'RenderError',{enumerable:true,get:function(){return datocmsStructuredTextUtils.RenderError;}});exports.DatocmsImagePlugin=DatocmsImagePlugin;exports.DatocmsStructuredTextPlugin=DatocmsStructuredTextPlugin;exports.Image=Image;exports.StructuredText=StructuredText;exports.appendKeyToValidElement=appendKeyToValidElement;exports.defaultAdapter=defaultAdapter;exports.toHead=toHead;Object.defineProperty(exports,'__esModule',{value:true});return exports;}({},hypenateStyleName,VueDemi,datocmsStructuredTextGenericHtmlRenderer,datocmsStructuredTextUtils));
|
package/dist/index.umd.js
CHANGED
|
@@ -337,13 +337,14 @@ const hAdapter = (tagName, props, childOrChildren) => {
|
|
|
337
337
|
const defaultAdapter = {
|
|
338
338
|
renderNode: hAdapter,
|
|
339
339
|
renderMark: hAdapter,
|
|
340
|
-
renderFragment: (children, key) =>
|
|
340
|
+
renderFragment: (children, key) => children,
|
|
341
341
|
renderText: (text, key) => text
|
|
342
342
|
};
|
|
343
343
|
function appendKeyToValidElement(element, key) {
|
|
344
344
|
if (vueDemi.isVue3) {
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
const {isVNode, cloneVNode} = require("vue");
|
|
346
|
+
if (isVNode(element) && element.key === null) {
|
|
347
|
+
return cloneVNode(element, {key});
|
|
347
348
|
}
|
|
348
349
|
} else if (element && typeof element === "object" && (element.key === null || element.key === void 0)) {
|
|
349
350
|
element.key = key;
|
|
@@ -360,6 +361,12 @@ const StructuredText = vueDemi.defineComponent({
|
|
|
360
361
|
customRules: {
|
|
361
362
|
type: Array
|
|
362
363
|
},
|
|
364
|
+
customNodeRules: {
|
|
365
|
+
type: Array
|
|
366
|
+
},
|
|
367
|
+
customMarkRules: {
|
|
368
|
+
type: Array
|
|
369
|
+
},
|
|
363
370
|
renderInlineRecord: {
|
|
364
371
|
type: Function
|
|
365
372
|
},
|
|
@@ -376,58 +383,67 @@ const StructuredText = vueDemi.defineComponent({
|
|
|
376
383
|
},
|
|
377
384
|
setup(props) {
|
|
378
385
|
return () => {
|
|
379
|
-
return datocmsStructuredTextGenericHtmlRenderer.render({
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
386
|
+
return datocmsStructuredTextGenericHtmlRenderer.render(props.data, {
|
|
387
|
+
adapter: {
|
|
388
|
+
renderText: props.renderText || defaultAdapter.renderText,
|
|
389
|
+
renderNode: props.renderNode || defaultAdapter.renderNode,
|
|
390
|
+
renderFragment: props.renderFragment || defaultAdapter.renderFragment
|
|
391
|
+
},
|
|
392
|
+
metaTransformer: props.metaTransformer,
|
|
393
|
+
customMarkRules: props.customMarkRules,
|
|
394
|
+
customNodeRules: [
|
|
395
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isRoot, ({adapter: {renderNode}, key, children}) => {
|
|
396
|
+
return renderNode("div", {key}, children);
|
|
397
|
+
}),
|
|
398
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isInlineItem, ({node, key}) => {
|
|
399
|
+
if (!props.renderInlineRecord) {
|
|
400
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'inlineItem' node, but no 'renderInlineRecord' prop is specified!`, node);
|
|
401
|
+
}
|
|
402
|
+
if (!datocmsStructuredTextUtils.isStructuredText(props.data) || !props.data.links) {
|
|
403
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'inlineItem' node, but .links is not present!`, node);
|
|
404
|
+
}
|
|
405
|
+
const item = props.data.links.find((item2) => item2.id === node.item);
|
|
406
|
+
if (!item) {
|
|
407
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'inlineItem' node, but cannot find a record with ID ${node.item} inside .links!`, node);
|
|
408
|
+
}
|
|
409
|
+
return appendKeyToValidElement(props.renderInlineRecord({record: item}), key);
|
|
410
|
+
}),
|
|
411
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isItemLink, ({node, key, children}) => {
|
|
412
|
+
if (!props.renderLinkToRecord) {
|
|
413
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'itemLink' node, but no 'renderLinkToRecord' prop is specified!`, node);
|
|
414
|
+
}
|
|
415
|
+
if (!datocmsStructuredTextUtils.isStructuredText(props.data) || !props.data.links) {
|
|
416
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'itemLink' node, but .links is not present!`, node);
|
|
417
|
+
}
|
|
418
|
+
const item = props.data.links.find((item2) => item2.id === node.item);
|
|
419
|
+
if (!item) {
|
|
420
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains an 'itemLink' node, but cannot find a record with ID ${node.item} inside .links!`, node);
|
|
421
|
+
}
|
|
422
|
+
return appendKeyToValidElement(props.renderLinkToRecord({
|
|
423
|
+
record: item,
|
|
424
|
+
children,
|
|
425
|
+
transformedMeta: node.meta ? (props.metaTransformer || datocmsStructuredTextGenericHtmlRenderer.defaultMetaTransformer)({
|
|
426
|
+
node,
|
|
427
|
+
meta: node.meta
|
|
428
|
+
}) : null
|
|
429
|
+
}), key);
|
|
430
|
+
}),
|
|
431
|
+
datocmsStructuredTextGenericHtmlRenderer.renderNodeRule(datocmsStructuredTextUtils.isBlock, ({node, key}) => {
|
|
432
|
+
if (!props.renderBlock) {
|
|
433
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains a 'block' node, but no 'renderBlock' prop is specified!`, node);
|
|
434
|
+
}
|
|
435
|
+
if (!datocmsStructuredTextUtils.isStructuredText(props.data) || !props.data.blocks) {
|
|
436
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains a 'block' node, but .blocks is not present!`, node);
|
|
437
|
+
}
|
|
438
|
+
const item = props.data.blocks.find((item2) => item2.id === node.item);
|
|
439
|
+
if (!item) {
|
|
440
|
+
throw new datocmsStructuredTextUtils.RenderError(`The Structured Text document contains a 'block' node, but cannot find a record with ID ${node.item} inside .blocks!`, node);
|
|
441
|
+
}
|
|
442
|
+
return appendKeyToValidElement(props.renderBlock({record: item}), key);
|
|
443
|
+
}),
|
|
444
|
+
...props.customNodeRules || props.customRules || []
|
|
445
|
+
]
|
|
446
|
+
});
|
|
431
447
|
};
|
|
432
448
|
}
|
|
433
449
|
});
|
|
@@ -473,4 +489,4 @@ const toHead = (...args) => {
|
|
|
473
489
|
});
|
|
474
490
|
})
|
|
475
491
|
};
|
|
476
|
-
};Object.defineProperty(exports,'
|
|
492
|
+
};Object.defineProperty(exports,'renderMarkRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderMarkRule;}});Object.defineProperty(exports,'renderNodeRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderNodeRule;}});Object.defineProperty(exports,'renderRule',{enumerable:true,get:function(){return datocmsStructuredTextGenericHtmlRenderer.renderNodeRule;}});Object.defineProperty(exports,'RenderError',{enumerable:true,get:function(){return datocmsStructuredTextUtils.RenderError;}});exports.DatocmsImagePlugin=DatocmsImagePlugin;exports.DatocmsStructuredTextPlugin=DatocmsStructuredTextPlugin;exports.Image=Image;exports.StructuredText=StructuredText;exports.appendKeyToValidElement=appendKeyToValidElement;exports.defaultAdapter=defaultAdapter;exports.toHead=toHead;Object.defineProperty(exports,'__esModule',{value:true});})));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-datocms",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A set of components and utilities to work faster with DatoCMS in Vue.js environments",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datocms",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"module": "./dist/index.esm.js",
|
|
13
13
|
"unpkg": "./dist/index.min.js",
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
|
+
"license": "MIT",
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|
|
17
18
|
"import": "./dist/index.esm.js",
|
|
@@ -27,8 +28,8 @@
|
|
|
27
28
|
"test": "jest src"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"datocms-structured-text-generic-html-renderer": "^1.0
|
|
31
|
-
"datocms-structured-text-utils": "^1.0
|
|
31
|
+
"datocms-structured-text-generic-html-renderer": "^1.3.0",
|
|
32
|
+
"datocms-structured-text-utils": "^1.1.0",
|
|
32
33
|
"hyphenate-style-name": "^1.0.4",
|
|
33
34
|
"vue-demi": "^0.7.5"
|
|
34
35
|
},
|