@datocms/svelte 1.2.0 → 1.2.2

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.
Files changed (70) hide show
  1. package/README.md +33 -6
  2. package/package.json +186 -41
  3. package/components/Head/Head.svelte +0 -14
  4. package/components/Head/Head.svelte.d.ts +0 -61
  5. package/components/Head/README.md +0 -68
  6. package/components/Head/__tests__/Head.test.d.ts +0 -1
  7. package/components/Head/__tests__/Head.test.js +0 -11
  8. package/components/Head/__tests__/__fixtures__/head.d.ts +0 -2
  9. package/components/Head/__tests__/__fixtures__/head.js +0 -280
  10. package/components/Head/__tests__/__snapshots__/Head.test.ts.snap +0 -221
  11. package/components/Image/Image.svelte +0 -172
  12. package/components/Image/Image.svelte.d.ts +0 -83
  13. package/components/Image/Placeholder.svelte +0 -30
  14. package/components/Image/Placeholder.svelte.d.ts +0 -22
  15. package/components/Image/README.md +0 -167
  16. package/components/Image/Sizer.svelte +0 -17
  17. package/components/Image/Sizer.svelte.d.ts +0 -19
  18. package/components/Image/Source.svelte +0 -6
  19. package/components/Image/Source.svelte.d.ts +0 -18
  20. package/components/Image/__tests__/Image.svelte.test.d.ts +0 -1
  21. package/components/Image/__tests__/Image.svelte.test.js +0 -44
  22. package/components/Image/__tests__/__fixtures__/image.d.ts +0 -40
  23. package/components/Image/__tests__/__fixtures__/image.js +0 -40
  24. package/components/Image/__tests__/__snapshots__/Image.svelte.test.ts.snap +0 -903
  25. package/components/StructuredText/Node.svelte +0 -112
  26. package/components/StructuredText/Node.svelte.d.ts +0 -22
  27. package/components/StructuredText/README.md +0 -201
  28. package/components/StructuredText/StructuredText.svelte +0 -15
  29. package/components/StructuredText/StructuredText.svelte.d.ts +0 -19
  30. package/components/StructuredText/__tests__/StructuredText.svelte.test.d.ts +0 -1
  31. package/components/StructuredText/__tests__/StructuredText.svelte.test.js +0 -171
  32. package/components/StructuredText/__tests__/__fixtures__/Block.svelte +0 -11
  33. package/components/StructuredText/__tests__/__fixtures__/Block.svelte.d.ts +0 -19
  34. package/components/StructuredText/__tests__/__fixtures__/CustomSpan.svelte +0 -49
  35. package/components/StructuredText/__tests__/__fixtures__/CustomSpan.svelte.d.ts +0 -19
  36. package/components/StructuredText/__tests__/__fixtures__/IncreasedLevelHeading.svelte +0 -8
  37. package/components/StructuredText/__tests__/__fixtures__/IncreasedLevelHeading.svelte.d.ts +0 -19
  38. package/components/StructuredText/__tests__/__fixtures__/InlineItem.svelte +0 -8
  39. package/components/StructuredText/__tests__/__fixtures__/InlineItem.svelte.d.ts +0 -19
  40. package/components/StructuredText/__tests__/__fixtures__/ItemLink.svelte +0 -15
  41. package/components/StructuredText/__tests__/__fixtures__/ItemLink.svelte.d.ts +0 -21
  42. package/components/StructuredText/__tests__/__fixtures__/structuredText.d.ts +0 -7
  43. package/components/StructuredText/__tests__/__fixtures__/structuredText.js +0 -575
  44. package/components/StructuredText/__tests__/__fixtures__/types.d.ts +0 -27
  45. package/components/StructuredText/__tests__/__fixtures__/types.js +0 -1
  46. package/components/StructuredText/__tests__/__snapshots__/StructuredText.svelte.test.ts.snap +0 -531
  47. package/components/StructuredText/nodes/Blockquote.svelte +0 -5
  48. package/components/StructuredText/nodes/Blockquote.svelte.d.ts +0 -19
  49. package/components/StructuredText/nodes/Code.svelte +0 -6
  50. package/components/StructuredText/nodes/Code.svelte.d.ts +0 -17
  51. package/components/StructuredText/nodes/Heading.svelte +0 -8
  52. package/components/StructuredText/nodes/Heading.svelte.d.ts +0 -19
  53. package/components/StructuredText/nodes/Link.svelte +0 -20
  54. package/components/StructuredText/nodes/Link.svelte.d.ts +0 -19
  55. package/components/StructuredText/nodes/List.svelte +0 -10
  56. package/components/StructuredText/nodes/List.svelte.d.ts +0 -19
  57. package/components/StructuredText/nodes/ListItem.svelte +0 -5
  58. package/components/StructuredText/nodes/ListItem.svelte.d.ts +0 -19
  59. package/components/StructuredText/nodes/Paragraph.svelte +0 -5
  60. package/components/StructuredText/nodes/Paragraph.svelte.d.ts +0 -19
  61. package/components/StructuredText/nodes/Root.svelte +0 -5
  62. package/components/StructuredText/nodes/Root.svelte.d.ts +0 -19
  63. package/components/StructuredText/nodes/Span.svelte +0 -49
  64. package/components/StructuredText/nodes/Span.svelte.d.ts +0 -19
  65. package/components/StructuredText/nodes/ThematicBreak.svelte +0 -5
  66. package/components/StructuredText/nodes/ThematicBreak.svelte.d.ts +0 -17
  67. package/components/StructuredText/utils/Lines.svelte +0 -11
  68. package/components/StructuredText/utils/Lines.svelte.d.ts +0 -16
  69. package/index.d.ts +0 -9
  70. package/index.js +0 -3
@@ -1,531 +0,0 @@
1
- // Vitest Snapshot v1
2
-
3
- exports[`StructuredText > with a dast including links and blocks > with default rules > renders the document 1`] = `
4
- <body>
5
- <div>
6
- <h1>
7
- This is a
8
-
9
-
10
- <!--&lt;Lines&gt;-->
11
-
12
- <!--&lt;Span&gt;-->
13
-
14
-
15
-
16
- <!--&lt;Node&gt;-->
17
- <mark>
18
- title
19
-
20
-
21
- <!--&lt;Lines&gt;-->
22
-
23
- <!--&lt;Span&gt;-->
24
- </mark>
25
-
26
-
27
- <!--&lt;Span&gt;-->
28
-
29
-
30
-
31
- <!--&lt;Node&gt;-->
32
- <a
33
- href="/docs/how-to-code"
34
- >
35
- How to code
36
- </a>
37
- ;
38
-
39
- <!--&lt;InlineItem&gt;-->
40
-
41
-
42
-
43
- <!--&lt;Node&gt;-->
44
- <a
45
- href="/docs/how-to-code"
46
- target="_blank"
47
- >
48
- here!
49
-
50
-
51
- <!--&lt;Lines&gt;-->
52
-
53
- <!--&lt;Span&gt;-->
54
-
55
-
56
-
57
- <!--&lt;Node&gt;-->
58
-
59
-
60
- </a>
61
-
62
- <!--&lt;ItemLink&gt;-->
63
-
64
-
65
-
66
- <!--&lt;Node&gt;-->
67
-
68
-
69
- </h1>
70
-
71
- <!--&lt;Heading&gt;-->
72
-
73
-
74
-
75
- <!--&lt;Node&gt;-->
76
- <figure>
77
- <blockquote>
78
- Foo bar.
79
- </blockquote>
80
-
81
- <figcaption>
82
- Mark Smith
83
- </figcaption>
84
- </figure>
85
-
86
- <!--&lt;Block&gt;-->
87
-
88
-
89
-
90
- <!--&lt;Node&gt;-->
91
-
92
-
93
- <!--&lt;Root&gt;-->
94
-
95
-
96
-
97
- <!--&lt;Node&gt;-->
98
-
99
- <!--&lt;StructuredText&gt;-->
100
- </div>
101
- </body>
102
- `;
103
-
104
- exports[`StructuredText > with a dast including links and blocks > with missing blocks > raises an error 1`] = `"The Structured Text document contains a 'block' node, but cannot find a record with ID 456 inside data.blocks!"`;
105
-
106
- exports[`StructuredText > with a dast including links and blocks > with missing component for blocks > raises an error 1`] = `"The Structured Text document contains a 'block' node, but no component for rendering is specified!"`;
107
-
108
- exports[`StructuredText > with a dast including links and blocks > with missing component for inline items > raises an error 1`] = `"The Structured Text document contains an 'inlineItem' node, but no component for rendering is specified!"`;
109
-
110
- exports[`StructuredText > with a dast including links and blocks > with missing component for item links > raises an error 1`] = `"The Structured Text document contains an 'itemLink' node, but no component for rendering is specified!"`;
111
-
112
- exports[`StructuredText > with a dast including links and blocks > with missing links > raises an error 1`] = `"The Structured Text document contains an 'itemLink' node, but cannot find a record with ID 123 inside data.links!"`;
113
-
114
- exports[`StructuredText > with a dast which has a link inside > with default rules > renders the document 1`] = `
115
- <body>
116
- <div>
117
- <p>
118
- This is a paragraph with a
119
-
120
-
121
- <!--&lt;Lines&gt;-->
122
-
123
- <!--&lt;Span&gt;-->
124
-
125
-
126
-
127
- <!--&lt;Node&gt;-->
128
- <a
129
- href="https://random.link"
130
- rel="nofollow"
131
- target="_blank"
132
- >
133
- very cool link
134
-
135
-
136
- <!--&lt;Lines&gt;-->
137
-
138
- <!--&lt;Span&gt;-->
139
-
140
-
141
-
142
- <!--&lt;Node&gt;-->
143
-
144
-
145
- </a>
146
- <!--&lt;Link&gt;-->
147
-
148
-
149
-
150
- <!--&lt;Node&gt;-->
151
- . And the link has the target and the rel attributes set.
152
-
153
-
154
- <!--&lt;Lines&gt;-->
155
-
156
- <!--&lt;Span&gt;-->
157
-
158
-
159
-
160
- <!--&lt;Node&gt;-->
161
-
162
-
163
- </p>
164
- <!--&lt;Paragraph&gt;-->
165
-
166
-
167
-
168
- <!--&lt;Node&gt;-->
169
-
170
-
171
- <!--&lt;Root&gt;-->
172
-
173
-
174
-
175
- <!--&lt;Node&gt;-->
176
-
177
- <!--&lt;StructuredText&gt;-->
178
- </div>
179
- </body>
180
- `;
181
-
182
- exports[`StructuredText > with a dast with no links nor blocks > with custom rules > renders the document 1`] = `
183
- <body>
184
- <div>
185
- <h2>
186
- This
187
-
188
- <br />
189
-
190
- is a
191
-
192
-
193
- <!--&lt;Lines&gt;-->
194
-
195
- <!--&lt;Lines&gt;-->
196
-
197
- <!--&lt;Span&gt;-->
198
-
199
-
200
-
201
- <!--&lt;Node&gt;-->
202
- <strong>
203
- title
204
-
205
-
206
- <!--&lt;Lines&gt;-->
207
-
208
- <!--&lt;Span&gt;-->
209
- </strong>
210
-
211
-
212
- <!--&lt;Span&gt;-->
213
-
214
-
215
-
216
- <!--&lt;Node&gt;-->
217
-
218
-
219
- </h2>
220
-
221
- <!--&lt;IncreasedLevelHeading&gt;-->
222
-
223
-
224
-
225
- <!--&lt;Node&gt;-->
226
-
227
-
228
- <!--&lt;Root&gt;-->
229
-
230
-
231
-
232
- <!--&lt;Node&gt;-->
233
-
234
- <!--&lt;StructuredText&gt;-->
235
- </div>
236
- </body>
237
- `;
238
-
239
- exports[`StructuredText > with a dast with no links nor blocks > with default rules > renders the document 1`] = `
240
- <body>
241
- <div>
242
- <h1>
243
- This
244
-
245
- <br />
246
-
247
- is a
248
-
249
-
250
- <!--&lt;Lines&gt;-->
251
-
252
- <!--&lt;Lines&gt;-->
253
-
254
- <!--&lt;Span&gt;-->
255
-
256
-
257
-
258
- <!--&lt;Node&gt;-->
259
- <strong>
260
- title
261
-
262
-
263
- <!--&lt;Lines&gt;-->
264
-
265
- <!--&lt;Span&gt;-->
266
- </strong>
267
-
268
-
269
- <!--&lt;Span&gt;-->
270
-
271
-
272
-
273
- <!--&lt;Node&gt;-->
274
-
275
-
276
- </h1>
277
-
278
- <!--&lt;Heading&gt;-->
279
-
280
-
281
-
282
- <!--&lt;Node&gt;-->
283
-
284
-
285
- <!--&lt;Root&gt;-->
286
-
287
-
288
-
289
- <!--&lt;Node&gt;-->
290
-
291
- <!--&lt;StructuredText&gt;-->
292
- </div>
293
- </body>
294
- `;
295
-
296
- exports[`StructuredText > with a very simple dast > with custom mark rules > renders the document 1`] = `
297
- <body>
298
- <div>
299
- <h1>
300
- This
301
-
302
- <br />
303
-
304
- is a
305
-
306
-
307
- <!--&lt;Lines&gt;-->
308
-
309
- <!--&lt;Lines&gt;-->
310
-
311
- <!--&lt;CustomSpan&gt;-->
312
-
313
-
314
-
315
- <!--&lt;Node&gt;-->
316
- <b>
317
- title
318
-
319
-
320
- <!--&lt;Lines&gt;-->
321
-
322
- <!--&lt;CustomSpan&gt;-->
323
- </b>
324
-
325
-
326
- <!--&lt;CustomSpan&gt;-->
327
-
328
-
329
-
330
- <!--&lt;Node&gt;-->
331
-
332
-
333
- </h1>
334
-
335
- <!--&lt;Heading&gt;-->
336
-
337
-
338
-
339
- <!--&lt;Node&gt;-->
340
-
341
-
342
- <!--&lt;Root&gt;-->
343
-
344
-
345
-
346
- <!--&lt;Node&gt;-->
347
-
348
- <!--&lt;StructuredText&gt;-->
349
- </div>
350
- </body>
351
- `;
352
-
353
- exports[`StructuredText > with a very simple dast > with default rules > renders the document 1`] = `
354
- <body>
355
- <div>
356
- <h1>
357
- This
358
-
359
- <br />
360
-
361
- is a
362
-
363
-
364
- <!--&lt;Lines&gt;-->
365
-
366
- <!--&lt;Lines&gt;-->
367
-
368
- <!--&lt;Span&gt;-->
369
-
370
-
371
-
372
- <!--&lt;Node&gt;-->
373
- <strong>
374
- title
375
-
376
-
377
- <!--&lt;Lines&gt;-->
378
-
379
- <!--&lt;Span&gt;-->
380
- </strong>
381
-
382
-
383
- <!--&lt;Span&gt;-->
384
-
385
-
386
-
387
- <!--&lt;Node&gt;-->
388
-
389
-
390
- </h1>
391
-
392
- <!--&lt;Heading&gt;-->
393
-
394
-
395
-
396
- <!--&lt;Node&gt;-->
397
-
398
-
399
- <!--&lt;Root&gt;-->
400
-
401
-
402
-
403
- <!--&lt;Node&gt;-->
404
-
405
- <!--&lt;StructuredText&gt;-->
406
- </div>
407
- </body>
408
- `;
409
-
410
- exports[`StructuredText > with a very simple pure dast (only the \`value\` of a structured text) > with custom mark rules > renders the document 1`] = `
411
- <body>
412
- <div>
413
- <h1>
414
- This
415
-
416
- <br />
417
-
418
- is a
419
-
420
-
421
- <!--&lt;Lines&gt;-->
422
-
423
- <!--&lt;Lines&gt;-->
424
-
425
- <!--&lt;CustomSpan&gt;-->
426
-
427
-
428
-
429
- <!--&lt;Node&gt;-->
430
- <b>
431
- title
432
-
433
-
434
- <!--&lt;Lines&gt;-->
435
-
436
- <!--&lt;CustomSpan&gt;-->
437
- </b>
438
-
439
-
440
- <!--&lt;CustomSpan&gt;-->
441
-
442
-
443
-
444
- <!--&lt;Node&gt;-->
445
-
446
-
447
- </h1>
448
-
449
- <!--&lt;Heading&gt;-->
450
-
451
-
452
-
453
- <!--&lt;Node&gt;-->
454
-
455
-
456
- <!--&lt;Root&gt;-->
457
-
458
-
459
-
460
- <!--&lt;Node&gt;-->
461
-
462
- <!--&lt;StructuredText&gt;-->
463
- </div>
464
- </body>
465
- `;
466
-
467
- exports[`StructuredText > with a very simple pure dast (only the \`value\` of a structured text) > with default rules > renders the document 1`] = `
468
- <body>
469
- <div>
470
- <h1>
471
- This
472
-
473
- <br />
474
-
475
- is a
476
-
477
-
478
- <!--&lt;Lines&gt;-->
479
-
480
- <!--&lt;Lines&gt;-->
481
-
482
- <!--&lt;Span&gt;-->
483
-
484
-
485
-
486
- <!--&lt;Node&gt;-->
487
- <strong>
488
- title
489
-
490
-
491
- <!--&lt;Lines&gt;-->
492
-
493
- <!--&lt;Span&gt;-->
494
- </strong>
495
-
496
-
497
- <!--&lt;Span&gt;-->
498
-
499
-
500
-
501
- <!--&lt;Node&gt;-->
502
-
503
-
504
- </h1>
505
-
506
- <!--&lt;Heading&gt;-->
507
-
508
-
509
-
510
- <!--&lt;Node&gt;-->
511
-
512
-
513
- <!--&lt;Root&gt;-->
514
-
515
-
516
-
517
- <!--&lt;Node&gt;-->
518
-
519
- <!--&lt;StructuredText&gt;-->
520
- </div>
521
- </body>
522
- `;
523
-
524
- exports[`StructuredText > with no value > renders null 1`] = `
525
- <body>
526
- <div>
527
-
528
- <!--&lt;StructuredText&gt;-->
529
- </div>
530
- </body>
531
- `;
@@ -1,5 +0,0 @@
1
- <script>export let node;
2
- node;
3
- </script>
4
-
5
- <blockquote><slot /></blockquote>
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { Blockquote } from 'datocms-structured-text-utils';
3
- declare const __propDef: {
4
- props: {
5
- node: Blockquote;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type BlockquoteProps = typeof __propDef.props;
15
- export type BlockquoteEvents = typeof __propDef.events;
16
- export type BlockquoteSlots = typeof __propDef.slots;
17
- export default class Blockquote extends SvelteComponentTyped<BlockquoteProps, BlockquoteEvents, BlockquoteSlots> {
18
- }
19
- export {};
@@ -1,6 +0,0 @@
1
- <script>export let node;
2
- $:
3
- ({ code, language } = node);
4
- </script>
5
-
6
- <pre class={language}>{code}</pre>
@@ -1,17 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { Code } from 'datocms-structured-text-utils';
3
- declare const __propDef: {
4
- props: {
5
- node: Code;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {};
11
- };
12
- export type CodeProps = typeof __propDef.props;
13
- export type CodeEvents = typeof __propDef.events;
14
- export type CodeSlots = typeof __propDef.slots;
15
- export default class Code extends SvelteComponentTyped<CodeProps, CodeEvents, CodeSlots> {
16
- }
17
- export {};
@@ -1,8 +0,0 @@
1
- <script>export let node;
2
- $:
3
- ({ level = 1 } = node);
4
- $:
5
- element = `h${level}`;
6
- </script>
7
-
8
- <svelte:element this={element}><slot /></svelte:element>
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { Heading } from 'datocms-structured-text-utils';
3
- declare const __propDef: {
4
- props: {
5
- node: Heading;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type HeadingProps = typeof __propDef.props;
15
- export type HeadingEvents = typeof __propDef.events;
16
- export type HeadingSlots = typeof __propDef.slots;
17
- export default class Heading extends SvelteComponentTyped<HeadingProps, HeadingEvents, HeadingSlots> {
18
- }
19
- export {};
@@ -1,20 +0,0 @@
1
- <script>export let node;
2
- $:
3
- ({ url, meta } = node);
4
- let target = void 0;
5
- $: {
6
- const targetMetaEntry = meta?.find((metaEntry) => metaEntry.id === "target");
7
- if (targetMetaEntry?.value) {
8
- target = targetMetaEntry.value;
9
- }
10
- }
11
- let rel = void 0;
12
- $: {
13
- const relMetaEntry = meta?.find((metaEntry) => metaEntry.id === "rel");
14
- if (relMetaEntry?.value) {
15
- rel = relMetaEntry.value;
16
- }
17
- }
18
- </script>
19
-
20
- <a href={url} {target} {rel}><slot /></a>
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { Link } from 'datocms-structured-text-utils';
3
- declare const __propDef: {
4
- props: {
5
- node: Link;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type LinkProps = typeof __propDef.props;
15
- export type LinkEvents = typeof __propDef.events;
16
- export type LinkSlots = typeof __propDef.slots;
17
- export default class Link extends SvelteComponentTyped<LinkProps, LinkEvents, LinkSlots> {
18
- }
19
- export {};
@@ -1,10 +0,0 @@
1
- <script>export let node;
2
- $:
3
- ({ style } = node);
4
- </script>
5
-
6
- {#if style === 'numbered'}
7
- <ol><slot /></ol>
8
- {:else}
9
- <ul><slot /></ul>
10
- {/if}
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { List } from 'datocms-structured-text-utils';
3
- declare const __propDef: {
4
- props: {
5
- node: List;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type ListProps = typeof __propDef.props;
15
- export type ListEvents = typeof __propDef.events;
16
- export type ListSlots = typeof __propDef.slots;
17
- export default class List extends SvelteComponentTyped<ListProps, ListEvents, ListSlots> {
18
- }
19
- export {};
@@ -1,5 +0,0 @@
1
- <script>export let node;
2
- node;
3
- </script>
4
-
5
- <li><slot /></li>
@@ -1,19 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { ListItem } from 'datocms-structured-text-utils';
3
- declare const __propDef: {
4
- props: {
5
- node: ListItem;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type ListItemProps = typeof __propDef.props;
15
- export type ListItemEvents = typeof __propDef.events;
16
- export type ListItemSlots = typeof __propDef.slots;
17
- export default class ListItem extends SvelteComponentTyped<ListItemProps, ListItemEvents, ListItemSlots> {
18
- }
19
- export {};
@@ -1,5 +0,0 @@
1
- <script>export let node;
2
- node;
3
- </script>
4
-
5
- <p><slot /></p>