@datocms/svelte 0.0.2 → 1.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.
|
@@ -26,7 +26,7 @@ import { onMount } from 'svelte';
|
|
|
26
26
|
|
|
27
27
|
import { StructuredText } from '@datocms/svelte';
|
|
28
28
|
|
|
29
|
-
const query =
|
|
29
|
+
const query = `
|
|
30
30
|
query {
|
|
31
31
|
blogPost {
|
|
32
32
|
title
|
|
@@ -90,7 +90,7 @@ import Block from './Block.svelte';
|
|
|
90
90
|
import InlineItem from './InlineItem.svelte';
|
|
91
91
|
import ItemLink from './ItemLink.svelte';
|
|
92
92
|
|
|
93
|
-
const query =
|
|
93
|
+
const query = `
|
|
94
94
|
query {
|
|
95
95
|
blogPost {
|
|
96
96
|
title
|
|
@@ -176,26 +176,26 @@ In this case, you can easily override default rendering rules with the `componen
|
|
|
176
176
|
|
|
177
177
|
```svelte
|
|
178
178
|
<script>
|
|
179
|
-
|
|
179
|
+
import { isHeading, isCode } from 'datocms-structured-text-utils';
|
|
180
180
|
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
import Heading from './Heading.svelte';
|
|
182
|
+
import Code from './Code.svelte';
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
export let data;
|
|
185
185
|
</script>
|
|
186
186
|
|
|
187
187
|
<StructuredText
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
data={data.blogPost.content}
|
|
189
|
+
components={[
|
|
190
|
+
[isHeading, Heading],
|
|
191
|
+
[isCode, Code]
|
|
192
|
+
]}
|
|
193
193
|
/>
|
|
194
194
|
```
|
|
195
195
|
|
|
196
196
|
## Props
|
|
197
197
|
|
|
198
|
-
| prop
|
|
199
|
-
|
|
|
200
|
-
| data
|
|
201
|
-
| components
|
|
198
|
+
| prop | type | required | description | default |
|
|
199
|
+
| ---------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------- |
|
|
200
|
+
| data | `StructuredText \| DastNode` | :white_check_mark: | The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from DatoCMS | |
|
|
201
|
+
| components | [`PredicateComponentTuple[] \| null`](https://github.com/datocms/datocms-svelte/blob/main/src/lib/index.ts) | Only required if data contain `block`, `inline_item` or `item_link` nodes | Array of tuples formed by a predicate function and custom component | `[]` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datocms/svelte",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A set of components and utilities to work faster with DatoCMS in Svelte",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"type": "module",
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"datocms-structured-text-utils": "^2.0.4",
|
|
43
|
-
"np": "^7.6.3",
|
|
44
43
|
"svelte-intersection-observer": "^0.10.0",
|
|
45
44
|
"universal-base64": "^2.1.0"
|
|
46
45
|
},
|